diff --git a/Server/src/main/content/global/handlers/item/ExplorersRingPlugin.kt b/Server/src/main/content/global/handlers/item/ExplorersRingPlugin.kt index 586967573..79208d80f 100644 --- a/Server/src/main/content/global/handlers/item/ExplorersRingPlugin.kt +++ b/Server/src/main/content/global/handlers/item/ExplorersRingPlugin.kt @@ -53,9 +53,9 @@ class ExplorersRingPlugin : InteractionListener { sendMessage(player, "You have used up all of your charges for the day.") return@on true } - sendDialogue(player, "Choose the item that you wish to convert to coins.") - addDialogueAction (player) {_,_ -> - sendItemSelect (player, "Choose") { slot, optionIndex -> + //sendDialogue(player, "Choose the item that you wish to convert to coins.") + //addDialogueAction (player) {_,_ -> + sendItemSelect (player, "Cast Low Level Alchemy on:") { slot, optionIndex -> val item = player.inventory[slot] if (item == null) return@sendItemSelect @@ -63,7 +63,7 @@ class ExplorersRingPlugin : InteractionListener { return@sendItemSelect getStoreFile()[player.username.lowercase() + ":alchs"] = remaining - 1 } - } + //} return@on true } diff --git a/Server/src/main/content/global/skill/magic/modern/ModernListeners.kt b/Server/src/main/content/global/skill/magic/modern/ModernListeners.kt index 6b96e386a..8c0eb276f 100644 --- a/Server/src/main/content/global/skill/magic/modern/ModernListeners.kt +++ b/Server/src/main/content/global/skill/magic/modern/ModernListeners.kt @@ -110,7 +110,7 @@ class ModernListeners : SpellListener("modern"){ onCast(Modern.LOW_ALCHEMY, ITEM){ player, node -> val item = node?.asItem() ?: return@onCast requires(player,21, arrayOf(Item(Items.FIRE_RUNE_554,3),Item(Items.NATURE_RUNE_561))) - notespell(player,item) + alchemize(player,item,high = false) } onCast(Modern.HIGH_ALCHEMY, ITEM){ player, node -> @@ -224,51 +224,7 @@ class ModernListeners : SpellListener("modern"){ setDelay(player,false) } - //Snowscape custom: Low Alch spell replaced with Note spell. This spell converts up to 10 items to notes. - public fun notespell(player: Player, item: Item) : Boolean { - if (item.definition.isUnnoted) { - if (item.definition.noteId < 0) { - player.sendMessage("This item cannot be noted.") - return false - } - val amount = kotlin.math.min(player.inventory.getAmount(item.id), 10) - player.inventory.remove(Item(item.id, amount)) - player.inventory.add(note(Item(item.id, amount))) - //player.sendMessage("The Bank of Gielinor appreciates your business.") - } else { - player.sendMessage("This item is already noted!") - return false - /* Unnoting is too strong, allowing runecrafting to happen at breakneck speeds and allowing infinite food to be brought along. Leaving the code here in case we want to enable it again someday. - val startingamount = player.inventory.getAmount(item.id) - val freespace = player.inventory.freeSlots() - var amount = minOf(startingamount, freespace) - if (startingamount - amount == 1) amount++ - if (amount == 0) { - player.sendMessage("You do not have enough inventory space to unnote this item.") - return false - } - player.inventory.remove(Item(item.id, amount)) - player.inventory.add(unnote(Item(item.id, amount))) - */ - } - - - val weapon = player.equipment.getItem(getItemFromEquipment(player, EquipmentSlot.WEAPON)) - if (weapon != null && !weapon.equals(MagicStaff.FIRE_RUNE)) { - player.animate(Animation(9625)) - player.graphics(Graphics(1692)) - } else { - player.animate(Animation(712)) - player.graphics(Graphics(112)) - } - playAudio(player,Sounds.LOW_ALCHEMY_98) - - removeRunes(player) - addXP(player, 31.0) - showMagicTab(player) - //setDelay(player, 5) - return true - } + // Snowscape: Alchemy spells have been modified. Spells now repeat, and low alchemy converts up to 100 items at a time for bulk pricing. fun alchemize(player: Player, item: Item, high: Boolean, explorersRing: Boolean = false): Boolean { if(item.name == "Coins") player.sendMessage("You can't alchemize something that's already gold!").also { return false } if((!item.definition.isTradeable) && (!item.definition.isAlchemizable)) player.sendMessage("You can't cast this spell on something like that.").also { return false } @@ -290,7 +246,7 @@ class ModernListeners : SpellListener("modern"){ if(high && ringOfWealth.contains(item.id)){ if (getAttribute(player, "ringofwealth:unlocked", false)) { player.sendMessage("You have already unlocked the permanent Wealth effect and can no longer ") - player.sendMessage("alchemize this ring.") + player.sendMessage("high alchemize this ring.") return false } else { player.setAttribute("/save:ringofwealth:unlocked", true) @@ -305,13 +261,15 @@ class ModernListeners : SpellListener("modern"){ player.pulseManager.clear() } - player.pulseManager.run(object : Pulse(){ + player.setAttribute("alchemyspelltime", getWorldTicks() + 100) + + player.pulseManager.run(object : Pulse(){ var counter = 0 override fun pulse(): Boolean { - if (amountInInventory(player, item.id) == 0 || counter >= 150) + if (amountInInventory(player, item.id) == 0 || getAttribute(player, "alchemyspelltime", 0) <= getWorldTicks()) return true - removeAttribute(player, "spell:runes") - if (counter % 5 == 0) { + + if (counter % (if (high) 5 else 2) == 0) { if (explorersRing) { visualize(player, LOW_ALCH_ANIM, EXPLORERS_RING_GFX) } else { @@ -324,19 +282,23 @@ class ModernListeners : SpellListener("modern"){ } playAudio(player, if (high) Sounds.HIGH_ALCHEMY_97 else Sounds.LOW_ALCHEMY_98) player.dispatch(ItemAlchemizationEvent(item.id, high)) - if (high) - requires(player,55, arrayOf(Item(Items.FIRE_RUNE_554,5),Item(Items.NATURE_RUNE_561,1))) - else - requires(player,21, arrayOf(Item(Items.FIRE_RUNE_554,3),Item(Items.NATURE_RUNE_561))) - removeRunes(player, false) - addXP(player, if (high) 65.0 else 31.0) - if (player.inventory.remove(Item(item.id, 1)) && coins.amount > 0) { - player.inventory.add(coins) + if (!explorersRing) { + removeAttribute(player, "spell:runes") + if (high) + requires(player,55, arrayOf(Item(Items.FIRE_RUNE_554,5),Item(Items.NATURE_RUNE_561,1))) + else + requires(player,21, arrayOf(Item(Items.FIRE_RUNE_554,3),Item(Items.NATURE_RUNE_561))) + removeRunes(player, false) + addXP(player, if (high) 65.0 else 31.0) + } + val amount = if (high) 1 else kotlin.math.min(10, amountInInventory(player, item.id)) + if (player.inventory.remove(Item(item.id, amount)) && coins.amount > 0) { + player.inventory.add(Item(coins.id, coins.amount * amount)) } //showMagicTab(player) - setDelay(player, 5) + //setDelay(player, 2) } - if (loop) { + if (loop && !explorersRing) { counter++ return false } else {