From 9c1b69ce21a81ddc47c7c1c0c1ec0a2f68279d2b Mon Sep 17 00:00:00 2001 From: aidan Date: Sun, 26 Jul 2026 11:43:49 -0500 Subject: [PATCH 1/3] change hasanitem to default false for second bank and poh storage, update drill demon and freaky forester --- .../ame/events/drilldemon/DrillDemonUtils.kt | 6 +-- .../ame/events/freakyforester/FreakUtils.kt | 6 +-- Server/src/main/core/api/ContentAPI.kt | 46 +++++++++---------- 3 files changed, 27 insertions(+), 31 deletions(-) diff --git a/Server/src/main/content/global/ame/events/drilldemon/DrillDemonUtils.kt b/Server/src/main/content/global/ame/events/drilldemon/DrillDemonUtils.kt index 8c90bd77f..14568c803 100644 --- a/Server/src/main/content/global/ame/events/drilldemon/DrillDemonUtils.kt +++ b/Server/src/main/content/global/ame/events/drilldemon/DrillDemonUtils.kt @@ -73,9 +73,9 @@ object DrillDemonUtils { fun reward(player: Player) { queueScript(player, 2, QueueStrength.SOFT) { - val hasHat = hasAnItem(player, Items.CAMO_HELMET_6656).container != null - val hasShirt = hasAnItem(player, Items.CAMO_TOP_6654).container != null - val hasPants = hasAnItem(player, Items.CAMO_BOTTOMS_6655).container != null + val hasHat = hasAnItem(player, Items.CAMO_HELMET_6656, checkSecondBank = true, checkPOH = true).exists() + val hasShirt = hasAnItem(player, Items.CAMO_TOP_6654, checkSecondBank = true, checkPOH = true).exists() + val hasPants = hasAnItem(player, Items.CAMO_BOTTOMS_6655, checkSecondBank = true, checkPOH = true).exists() when { !hasHat -> addItemOrDrop(player, Items.CAMO_HELMET_6656) !hasShirt -> addItemOrDrop(player, Items.CAMO_TOP_6654) diff --git a/Server/src/main/content/global/ame/events/freakyforester/FreakUtils.kt b/Server/src/main/content/global/ame/events/freakyforester/FreakUtils.kt index 84e491f89..2819a9474 100644 --- a/Server/src/main/content/global/ame/events/freakyforester/FreakUtils.kt +++ b/Server/src/main/content/global/ame/events/freakyforester/FreakUtils.kt @@ -35,9 +35,9 @@ object FreakUtils{ } fun reward(player: Player){ - val hasHat = hasAnItem(player, Items.LEDERHOSEN_HAT_6182).container != null - val hasTop = hasAnItem(player, Items.LEDERHOSEN_TOP_6180).container != null - val hasShort = hasAnItem(player, Items.LEDERHOSEN_SHORTS_6181).container != null + val hasHat = hasAnItem(player, Items.LEDERHOSEN_HAT_6182, checkSecondBank = true, checkPOH = true).exists() + val hasTop = hasAnItem(player, Items.LEDERHOSEN_TOP_6180, checkSecondBank = true, checkPOH = true).exists() + val hasShort = hasAnItem(player, Items.LEDERHOSEN_SHORTS_6181, checkSecondBank = true, checkPOH = true).exists() sendNPCDialogue(player, freakNpc, "You get a lederhosen item as a reward for your help, many thanks!") when{ (!hasHat) -> addItemOrDrop(player, Items.LEDERHOSEN_HAT_6182, 1) diff --git a/Server/src/main/core/api/ContentAPI.kt b/Server/src/main/core/api/ContentAPI.kt index 71eb72f91..1583579ff 100644 --- a/Server/src/main/core/api/ContentAPI.kt +++ b/Server/src/main/core/api/ContentAPI.kt @@ -264,31 +264,25 @@ class ContainerisedItem(val container: core.game.container.Container?, val itemI } /** - * Check if player has the specified item ID equipped, in inventory, or in their bank + * Check if player has the specified item ID equipped, in inventory, in their bank, or in their POH storage. * @param id The item ID to check + * @param checkSecondBank Whether to check the player's second bank (default false). + * @param checkPOH Whether to check a player's POH storage (default false). * @return A ContainerisedItem containing the container and the item ID if found, otherwise ContainerisedItem(null, -1) if not found */ -fun hasAnItem(player: Player, id: Int): ContainerisedItem { - return hasAnItem(player, arrayOf(id), false) +@JvmOverloads +fun hasAnItem(player: Player, id: Int, checkSecondBank: Boolean = false, checkPOH: Boolean = false): ContainerisedItem { + return hasAnItem(player, arrayOf(id), checkSecondBank, checkPOH) } /** - * Check if player has the specified item ID equipped, in inventory, or in their bank - * @param id The item ID to check - * @param checkSecondBank Whether to check the player's second bank. - * @return A ContainerisedItem containing the container and the item ID if found, otherwise ContainerisedItem(null, -1) if not found - */ -fun hasAnItem(player: Player, id: Int, checkSecondBank: Boolean): ContainerisedItem { - return hasAnItem(player, arrayOf(id), checkSecondBank) -} - -/** - * Check if player has any of the specified item IDs equipped, in inventory, or in their bank + * Check if player has any of the specified item IDs equipped, in inventory, in their bank, or in their POH storage. * @param ids An array of item IDs to check - * @param checkSecondBank Whether to check the player's second bank. + * @param checkSecondBank Whether to check the player's second bank (default false). + * @param checkPOH Whether to check a player's POH storage (default false). * @return A ContainerisedItem containing the container and the item ID if found, otherwise ContainerisedItem(null, -1) if not found */ -fun hasAnItem(player: Player, ids: Array, checkSecondBank: Boolean): ContainerisedItem { +fun hasAnItem(player: Player, ids: Array, checkSecondBank: Boolean = false, checkPOH: Boolean = false): ContainerisedItem { // Search bank/equip/inv and return if item is found there. val searchSpace = if (checkSecondBank) { arrayOf(player.inventory, player.equipment, player.bankPrimary, player.bankSecondary) @@ -303,15 +297,17 @@ fun hasAnItem(player: Player, ids: Array, checkSecondBank: Boolean): Contai } } - // Check all costume storage containers and return if item is found there. - for (id in ids) { - if (StorableFamily.values().any { family -> - player.getPOHStorageState() - .getContainer(family) - .contains(id) - }) { - // Note that this proxy container is a fake container just used to get the correct return type. - return ContainerisedItem(player.POHStorageProxyContainer, id) + // Check all costume storage and bookcase containers and return if item is found there. + if (checkPOH) { + for (id in ids) { + if (StorableFamily.values().any { family -> + player.getPOHStorageState() + .getContainer(family) + .contains(id) + }) { + // Note that this proxy container is a fake container just used to get the correct return type. + return ContainerisedItem(player.POHStorageProxyContainer, id) + } } } From 7b52dd1e6c5e0c8e3cb8cd734474dbd58490bb06 Mon Sep 17 00:00:00 2001 From: aidan Date: Sun, 26 Jul 2026 15:39:23 -0500 Subject: [PATCH 2/3] ok to hide shit in second bank --- .../content/global/ame/events/drilldemon/DrillDemonUtils.kt | 6 +++--- .../content/global/ame/events/freakyforester/FreakUtils.kt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Server/src/main/content/global/ame/events/drilldemon/DrillDemonUtils.kt b/Server/src/main/content/global/ame/events/drilldemon/DrillDemonUtils.kt index 14568c803..287406ad5 100644 --- a/Server/src/main/content/global/ame/events/drilldemon/DrillDemonUtils.kt +++ b/Server/src/main/content/global/ame/events/drilldemon/DrillDemonUtils.kt @@ -73,9 +73,9 @@ object DrillDemonUtils { fun reward(player: Player) { queueScript(player, 2, QueueStrength.SOFT) { - val hasHat = hasAnItem(player, Items.CAMO_HELMET_6656, checkSecondBank = true, checkPOH = true).exists() - val hasShirt = hasAnItem(player, Items.CAMO_TOP_6654, checkSecondBank = true, checkPOH = true).exists() - val hasPants = hasAnItem(player, Items.CAMO_BOTTOMS_6655, checkSecondBank = true, checkPOH = true).exists() + val hasHat = hasAnItem(player, Items.CAMO_HELMET_6656, checkPOH = true).exists() + val hasShirt = hasAnItem(player, Items.CAMO_TOP_6654, checkPOH = true).exists() + val hasPants = hasAnItem(player, Items.CAMO_BOTTOMS_6655, checkPOH = true).exists() when { !hasHat -> addItemOrDrop(player, Items.CAMO_HELMET_6656) !hasShirt -> addItemOrDrop(player, Items.CAMO_TOP_6654) diff --git a/Server/src/main/content/global/ame/events/freakyforester/FreakUtils.kt b/Server/src/main/content/global/ame/events/freakyforester/FreakUtils.kt index 2819a9474..b6fbd647d 100644 --- a/Server/src/main/content/global/ame/events/freakyforester/FreakUtils.kt +++ b/Server/src/main/content/global/ame/events/freakyforester/FreakUtils.kt @@ -35,9 +35,9 @@ object FreakUtils{ } fun reward(player: Player){ - val hasHat = hasAnItem(player, Items.LEDERHOSEN_HAT_6182, checkSecondBank = true, checkPOH = true).exists() - val hasTop = hasAnItem(player, Items.LEDERHOSEN_TOP_6180, checkSecondBank = true, checkPOH = true).exists() - val hasShort = hasAnItem(player, Items.LEDERHOSEN_SHORTS_6181, checkSecondBank = true, checkPOH = true).exists() + val hasHat = hasAnItem(player, Items.LEDERHOSEN_HAT_6182, checkPOH = true).exists() + val hasTop = hasAnItem(player, Items.LEDERHOSEN_TOP_6180, checkPOH = true).exists() + val hasShort = hasAnItem(player, Items.LEDERHOSEN_SHORTS_6181, checkPOH = true).exists() sendNPCDialogue(player, freakNpc, "You get a lederhosen item as a reward for your help, many thanks!") when{ (!hasHat) -> addItemOrDrop(player, Items.LEDERHOSEN_HAT_6182, 1) From ae028a20f3ad80f37c212f9b505388936f8a9f5a Mon Sep 17 00:00:00 2001 From: aidan Date: Sat, 1 Aug 2026 14:20:37 -0500 Subject: [PATCH 3/3] check which bank is active, and change the secondbank flag to inactivebank --- Server/src/main/core/api/ContentAPI.kt | 33 ++++++++++++++++---------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/Server/src/main/core/api/ContentAPI.kt b/Server/src/main/core/api/ContentAPI.kt index 1583579ff..8b4443c6e 100644 --- a/Server/src/main/core/api/ContentAPI.kt +++ b/Server/src/main/core/api/ContentAPI.kt @@ -264,30 +264,39 @@ class ContainerisedItem(val container: core.game.container.Container?, val itemI } /** - * Check if player has the specified item ID equipped, in inventory, in their bank, or in their POH storage. + * Check if player has the specified item ID equipped, in inventory, in their active bank, or in their POH storage. * @param id The item ID to check - * @param checkSecondBank Whether to check the player's second bank (default false). + * @param checkInactiveBank Whether to check the player's inactive bank (default false). * @param checkPOH Whether to check a player's POH storage (default false). * @return A ContainerisedItem containing the container and the item ID if found, otherwise ContainerisedItem(null, -1) if not found */ @JvmOverloads -fun hasAnItem(player: Player, id: Int, checkSecondBank: Boolean = false, checkPOH: Boolean = false): ContainerisedItem { - return hasAnItem(player, arrayOf(id), checkSecondBank, checkPOH) +fun hasAnItem(player: Player, id: Int, checkInactiveBank: Boolean = false, checkPOH: Boolean = false): ContainerisedItem { + return hasAnItem(player, arrayOf(id), checkInactiveBank, checkPOH) } /** - * Check if player has any of the specified item IDs equipped, in inventory, in their bank, or in their POH storage. + * Check if player has any of the specified item IDs equipped, in inventory, in their active bank, or in their POH storage. * @param ids An array of item IDs to check - * @param checkSecondBank Whether to check the player's second bank (default false). + * @param checkInactiveBank Whether to check the player's inactive bank (default false). * @param checkPOH Whether to check a player's POH storage (default false). * @return A ContainerisedItem containing the container and the item ID if found, otherwise ContainerisedItem(null, -1) if not found */ -fun hasAnItem(player: Player, ids: Array, checkSecondBank: Boolean = false, checkPOH: Boolean = false): ContainerisedItem { - // Search bank/equip/inv and return if item is found there. - val searchSpace = if (checkSecondBank) { - arrayOf(player.inventory, player.equipment, player.bankPrimary, player.bankSecondary) +fun hasAnItem(player: Player, ids: Array, checkInactiveBank: Boolean = false, checkPOH: Boolean = false): ContainerisedItem { + // Gets which bank account is active. + val (active, inactive) = if (isUsingSecondaryBankAccount(player)) { + // Active // Inactive + player.bankSecondary to player.bankPrimary } else { - arrayOf(player.inventory, player.equipment, player.bankPrimary) + // Active // Inactive + player.bankPrimary to player.bankSecondary + } + + // Search bank/equip/inv and return if item is found there. + val searchSpace = if (checkInactiveBank) { + arrayOf(player.inventory, player.equipment, active, inactive) + } else { + arrayOf(player.inventory, player.equipment, active) } for (container in searchSpace) { for (id in ids) { @@ -2784,7 +2793,7 @@ fun toggleBankAccount(player: Player) { } /** - * Checks if a player is currentl using their secondary bank account. + * Checks if a player is currently using their secondary bank account. * * @author vddCore * @param player The player whose bank account toggle state to inspect.