forked from 2009Scape/Server
Runecrafting pouch improvements
Using any of the essence pouches on a bank booth, bank chest, or banker npc will refill all the pouches in the player inventory, as well as their familiar. When runecrafting, if the player runs out of essence then essence will be withdrawn from the familiar and pouches. Both of the previous functions only work on pure essence, not rune essence. Also moved the Ourania teleport closer to the altar.
This commit is contained in:
parent
269eb82850
commit
54055e36d0
4 changed files with 95 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,6 +173,7 @@ public final class RuneCraftPulse extends SkillPulse<Item> {
|
|||
} else {
|
||||
combine();
|
||||
}
|
||||
SnowscapePouchListener.Companion.emptyPouches(player);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -326,7 +327,7 @@ public final class RuneCraftPulse extends SkillPulse<Item> {
|
|||
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.");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
89
Server/src/main/content/global/skill/runecrafting/SnowscapePouchListener.kt
Executable file
89
Server/src/main/content/global/skill/runecrafting/SnowscapePouchListener.kt
Executable file
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue