diff --git a/src/main/java/emu/grasscutter/game/inventory/Inventory.java b/src/main/java/emu/grasscutter/game/inventory/Inventory.java index 9a293f0f0..7967617c1 100644 --- a/src/main/java/emu/grasscutter/game/inventory/Inventory.java +++ b/src/main/java/emu/grasscutter/game/inventory/Inventory.java @@ -216,14 +216,14 @@ public class Inventory extends BasePlayerManager implements Iterable { } /** - * Checks to see if the player has the item in their inventory. This is exact. + * Checks to see if the player has the item in their inventory. This is not exact. * * @param items A map of item game IDs to their count. * @return True if the player has the items, false otherwise. */ public boolean hasAllItems(Collection items) { for (var item : items) { - if (!this.hasItem(item.getItemId(), item.getCount(), true)) return false; + if (!this.hasItem(item.getItemId(), item.getCount(), false)) return false; } return true; diff --git a/src/main/java/emu/grasscutter/game/quest/QuestManager.java b/src/main/java/emu/grasscutter/game/quest/QuestManager.java index a14350327..5cf0e02f7 100644 --- a/src/main/java/emu/grasscutter/game/quest/QuestManager.java +++ b/src/main/java/emu/grasscutter/game/quest/QuestManager.java @@ -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(); } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerItemGivingReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerItemGivingReq.java index 23db1bfb8..f78c5c521 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerItemGivingReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerItemGivingReq.java @@ -55,7 +55,7 @@ public final class HandlerItemGivingReq extends PacketHandler { questManager.queueEvent(QuestContent.QUEST_CONTENT_FINISH_ITEM_GIVING, giveId, 0); questManager.queueEvent(QuestCond.QUEST_COND_ITEM_GIVING_FINISHED, giveId, 0); } - case GIVING_METHOD_VAGUE_GROUP -> { + case GIVING_METHOD_VAGUE_GROUP, GIVING_METHOD_GROUP -> { var matchedGroups = new ArrayList(); var givenItems = new HashMap();