From 7be39c73b9c11ff9d79a8698d799bc0418208c82 Mon Sep 17 00:00:00 2001 From: randy Date: Mon, 17 Mar 2025 15:48:40 -0600 Subject: [PATCH] All satchels now autoloot items they can hold The plain satchel, due to its ability to carry any item, will only loot items that already exist in the satchel. --- .../handlers/item/SnowscapeSatchelListener.kt | 2 +- .../game/node/entity/npc/drop/NPCDropTables.java | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Server/src/main/content/global/handlers/item/SnowscapeSatchelListener.kt b/Server/src/main/content/global/handlers/item/SnowscapeSatchelListener.kt index d2eed85fc..7df3b7d74 100755 --- a/Server/src/main/content/global/handlers/item/SnowscapeSatchelListener.kt +++ b/Server/src/main/content/global/handlers/item/SnowscapeSatchelListener.kt @@ -133,7 +133,7 @@ class SnowscapeSatchelListener : InteractionListener { return satchel!! } - // Checks if the item is allowed in the satchel. The NPCDropTables.java function calls this on the Red Satchel if the player has one + // Checks if the item is allowed in the satchel. The NPCDropTables.java function calls this on satchels the player is carrying. fun isAllowed(player: Player, satchelId: Int, itemId: Int): Boolean { when (satchelId) { plainSatchelId -> return itemId !in satchelIds diff --git a/Server/src/main/core/game/node/entity/npc/drop/NPCDropTables.java b/Server/src/main/core/game/node/entity/npc/drop/NPCDropTables.java index e971313df..07a58af70 100644 --- a/Server/src/main/core/game/node/entity/npc/drop/NPCDropTables.java +++ b/Server/src/main/core/game/node/entity/npc/drop/NPCDropTables.java @@ -271,12 +271,17 @@ public final class NPCDropTables { return true; } - //Snowscape modification: loot certain items into the red satchel if carried + //Snowscape modification: loot certain items into the satchels if carried private boolean handleSatchel(Player player, Item item) { - if (inEquipmentOrInventory(player,10879,1)){ - if (SnowscapeSatchelListener.Companion.isAllowed(player,10879,item.getId()) && player.redSatchel.add(item)) { - player.sendMessage("Your red satchel stashed " + item.getAmount() + " " + item.getName() + "."); - return true; + for (int satchelId = 10877; satchelId <= 10882; satchelId++) { + if (inEquipmentOrInventory(player,satchelId,1) && SnowscapeSatchelListener.Companion.isAllowed(player,satchelId,item.getId())){ + if (satchelId == 10877 && !player.plainSatchel.contains(item.getId(),1)) { + continue; + } + if (SnowscapeSatchelListener.Companion.getSatchel(player, satchelId).add(unnote(item))) { + player.sendMessage("Your " + new Item(satchelId).getName() + " stashed " + item.getAmount() + " " + item.getName() + "."); + return true; + } } } return false;