Little update to item giving handling (#2363)

* Little update to HandlerItemGivingReq.java

GIVING_METHOD_GROUP is used in cooking girl's quest

* Send the giving packet at the start of relogs, even if encountered before.

* Make item checking not exact

You can have more items in your inventory than what you are submitting.
This commit is contained in:
Nazrin
2023-09-14 17:44:08 -07:00
committed by GitHub
Unverified
parent 2b64814534
commit f955bb1e16
3 changed files with 7 additions and 12 deletions
@@ -101,22 +101,17 @@ public final class QuestManager extends BasePlayerManager {
* Attempts to add the giving action.
*
* @param givingId The giving action ID.
* @throws IllegalStateException If the giving action is already active.
*/
public void addGiveItemAction(int givingId) throws IllegalStateException {
var progress = this.player.getPlayerProgress();
var givings = progress.getItemGivings();
// Check if the action is already present.
if (givings.containsKey(givingId)) {
throw new IllegalStateException("Giving action " + givingId + " is already active.");
// Check if the action is not present.
if (!givings.containsKey(givingId)) {
givings.put(givingId, ItemGiveRecord.resolve(givingId));
player.save();
}
// Add the action.
givings.put(givingId, ItemGiveRecord.resolve(givingId));
// Save the givings.
player.save();
this.sendGivingRecords();
}