diff --git a/Server/src/main/content/global/skill/magic/lunar/LunarListeners.kt b/Server/src/main/content/global/skill/magic/lunar/LunarListeners.kt index a55a32bac..d88710205 100644 --- a/Server/src/main/content/global/skill/magic/lunar/LunarListeners.kt +++ b/Server/src/main/content/global/skill/magic/lunar/LunarListeners.kt @@ -93,7 +93,8 @@ class LunarListeners : SpellListener("lunar"), Commands { onCast(Lunar.OURANIA_TELEPORT, NONE) { player, _ -> requires(player, 71, arrayOf(Item(Items.ASTRAL_RUNE_9075, 2), Item(Items.LAW_RUNE_563, 1), Item(Items.EARTH_RUNE_557, 6))) if (!player.isTeleBlocked) playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200) - sendTeleport(player, 69.0, Location.create(2469, 3247, 0)) + //sendTeleport(player, 69.0, Location.create(2469, 3247, 0)) + sendTeleport(player, 69.0, Location.create(3314, 4818, 0)) } // Level 71 diff --git a/Server/src/main/content/global/skill/runecrafting/PouchManager.kt b/Server/src/main/content/global/skill/runecrafting/PouchManager.kt index 22cc1865f..6bb4020f0 100644 --- a/Server/src/main/content/global/skill/runecrafting/PouchManager.kt +++ b/Server/src/main/content/global/skill/runecrafting/PouchManager.kt @@ -29,7 +29,7 @@ class PouchManager(val player: Player) { * @param essence the ID of the essence item we are trying to add * @author Ceikry, Player Name */ - fun addToPouch(itemId: Int, amount: Int, essence: Int) { + fun addToPouch(itemId: Int, amount: Int, essence: Int, fromBank: Boolean = false) { val pouchId = if (isDecayedPouch(itemId)) itemId - 1 else itemId if (!checkRequirement(pouchId)) { sendMessage(player, "You lack the required level to use this pouch.") @@ -90,7 +90,7 @@ class PouchManager(val player: Player) { } } val essItem = Item(essence, amt) - if (!disappeared && removeItem(player, essItem)) { + if (!disappeared && (fromBank && player.getBank().remove(essItem)) || removeItem(player, essItem)) { pouch.container.add(essItem) } } diff --git a/Server/src/main/content/global/skill/runecrafting/RuneCraftPulse.java b/Server/src/main/content/global/skill/runecrafting/RuneCraftPulse.java index 819337a57..017efe99c 100644 --- a/Server/src/main/content/global/skill/runecrafting/RuneCraftPulse.java +++ b/Server/src/main/content/global/skill/runecrafting/RuneCraftPulse.java @@ -173,6 +173,7 @@ public final class RuneCraftPulse extends SkillPulse { } else { combine(); } + SnowscapePouchListener.Companion.emptyPouches(player); return false; } @@ -326,7 +327,7 @@ public final class RuneCraftPulse extends SkillPulse { if (altar == Altar.SOUL) { tablet = new Item(8022, amount); } if (tablet != null && player.getInventory().remove(clay)) { player.getInventory().add(tablet); - player.getSkills().addExperience(Skills.RUNECRAFTING, rune.getExperience() * amount, true); + player.getSkills().addExperience(Skills.RUNECRAFTING, rune.getExperience() * amount * 2, true); player.getPacketDispatch().sendMessage("You bind the temple's power into teleport tablets."); } } diff --git a/Server/src/main/content/global/skill/runecrafting/SnowscapePouchListener.kt b/Server/src/main/content/global/skill/runecrafting/SnowscapePouchListener.kt new file mode 100755 index 000000000..549c4445e --- /dev/null +++ b/Server/src/main/content/global/skill/runecrafting/SnowscapePouchListener.kt @@ -0,0 +1,89 @@ +package content.global.skill.runecrafting + +import core.api.* +import core.game.node.Node +import core.game.node.entity.player.Player +import core.game.node.item.Item +import core.game.interaction.InteractionListener +import core.game.interaction.IntType +import org.rs09.consts.Items +import content.global.handlers.scenery.BankBoothListener +import content.global.handlers.npc.BankerNPC +import content.global.skill.summoning.familiar.BurdenBeast +import content.global.skill.summoning.familiar.Forager + +/** + * Listener for using runecrafting pouches on banks for easier refilling. + * Using any pouch on a bank booth, chest, or banker will refill all the carried pouches as well as the familiar inventory. + * @author + */ +class SnowscapePouchListener : InteractionListener { + + companion object { + + val pouchIds = intArrayOf(5509,5510,5511,5512,5513,5514,5515) + + // Called by the runecraft pulse + fun emptyPouches(player: Player) { + if (amountInInventory(player, Items.PURE_ESSENCE_7936) > 0 || amountInInventory(player, Items.RUNE_ESSENCE_1436) > 0) return + + val familiar = player.getFamiliarManager().getFamiliar() + if (familiar.isBurdenBeast() && (familiar as BurdenBeast).getContainer().containsAtLeastOneItem(Items.PURE_ESSENCE_7936)) { + (familiar as BurdenBeast).transfer(Item(Items.PURE_ESSENCE_7936), 99, true) + } + + for (pouchId in pouchIds) { + if (inInventory(player, pouchId, 1)) { + player.pouchManager.withdrawFromPouch(pouchId) + } + } + } + } + + private fun fillPouchFromBank(player: Player) { + val playerBank = player.getBank() + for (pouchId in pouchIds) { + if (inInventory(player, pouchId, 1)) { + player.pouchManager.addToPouch(pouchId, playerBank.getAmount(Items.PURE_ESSENCE_7936), Items.PURE_ESSENCE_7936, true) + } + } + + if (player.getFamiliarManager().hasFamiliar()) { + val familiar = player.getFamiliarManager().getFamiliar() + if (familiar.isBurdenBeast() && (familiar !is Forager)) { + val familiarContainer = (familiar as BurdenBeast).getContainer() + val amount = kotlin.math.min(familiarContainer.getMaximumAdd(Item(Items.PURE_ESSENCE_7936)), playerBank.getAmount(Item(Items.PURE_ESSENCE_7936))) + val item = Item(Items.PURE_ESSENCE_7936, amount) + if (playerBank.remove(item)) familiarContainer.add(item) + if (familiarContainer.freeSlots() == 0) sendMessage(player, "Your familiar is full.") + + } + } + + sendMessage(player, "There is ${player.getBank().getAmount(Items.PURE_ESSENCE_7936)} Pure Essence remaining in your bank.") + } + + + + override fun defineListeners() { + + // BankBoothListener values are public but BankChestListener values are not, so rather than edit the BankChestListener file I have copied the IDs here. 12309 is the Culinomancer's chest. + val bankChests = intArrayOf(3194,4483,10562,14382,16695,16696,21301,27662,27663) + val bankUseWiths = intArrayOf(*BankBoothListener.BANK_BOOTHS, 12309, *bankChests) + + //6362 is the Ourania Altar banker. + val bankers = intArrayOf(*BankerNPC.NPC_IDS, *BankerNPC.SPECIAL_NPC_IDS, 6362) + + onUseWith(IntType.SCENERY, pouchIds, *bankUseWiths) { player, used, with -> + fillPouchFromBank(player) + return@onUseWith true + } + + onUseWith(IntType.NPC, pouchIds, *bankers) { player, used, with -> + fillPouchFromBank(player) + return@onUseWith true + } + } + + +}