From 1401ab94bb75b80b81e665c00a2f1f275e5f4d91 Mon Sep 17 00:00:00 2001 From: Ceikry Date: Sat, 13 Mar 2021 14:03:45 -0600 Subject: [PATCH] Moved all currently existing Freminnik Trials option handlers to TFTInteractionListeners.kt, added new library PrimitiveExtensions-1.0.jar --- Server/build.gradle | 2 + Server/libs/PrimitiveExtensions-1.0.jar | Bin 0 -> 1958 bytes .../content/dialogue/CouncilWorkerDialogue.kt | 30 +++ .../thefremenniktrials/BeerOnCouncilWorker.kt | 32 --- .../thefremenniktrials/BranchFletcher.kt | 52 ---- .../CouncilWorkerDialogue.kt | 56 ----- .../CouncilWorkerFTDialogue.kt | 42 ++++ .../members/thefremenniktrials/FishOnAltar.kt | 77 ------ .../HunterTalismanListener.kt | 5 +- .../thefremenniktrials/KegOnKegAction.kt | 50 ---- .../thefremenniktrials/LyreOptionHandler.kt | 65 ----- .../thefremenniktrials/PipeInserter.kt | 47 ---- .../thefremenniktrials/SwayingTreeHandler.kt | 61 ----- .../thefremenniktrials/SwensenLadder.kt | 34 --- .../thefremenniktrials/SwensenPortals.kt | 72 ------ .../TFTInteractionListeners.kt | 226 ++++++++++++++++++ .../thefremenniktrials/TinderboxOnBomb.kt | 34 --- .../bonegrinder/BoneGrinderListener.kt | 4 +- .../game/interaction/InteractionListener.kt | 6 +- .../kotlin/rs09/game/interaction/Listeners.kt | 8 + .../item/withobject/CoalTrucksHandler.kt | 4 +- .../combat/equipment/EquipmentDegrader.kt | 17 +- 22 files changed, 321 insertions(+), 603 deletions(-) create mode 100644 Server/libs/PrimitiveExtensions-1.0.jar create mode 100644 Server/src/main/kotlin/rs09/game/content/dialogue/CouncilWorkerDialogue.kt delete mode 100644 Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/BeerOnCouncilWorker.kt delete mode 100644 Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/BranchFletcher.kt delete mode 100644 Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/CouncilWorkerDialogue.kt create mode 100644 Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/CouncilWorkerFTDialogue.kt delete mode 100644 Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/FishOnAltar.kt delete mode 100644 Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/KegOnKegAction.kt delete mode 100644 Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/LyreOptionHandler.kt delete mode 100644 Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/PipeInserter.kt delete mode 100644 Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/SwayingTreeHandler.kt delete mode 100644 Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/SwensenLadder.kt delete mode 100644 Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/SwensenPortals.kt create mode 100644 Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/TFTInteractionListeners.kt delete mode 100644 Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/TinderboxOnBomb.kt diff --git a/Server/build.gradle b/Server/build.gradle index efd5030c3..ff4459643 100644 --- a/Server/build.gradle +++ b/Server/build.gradle @@ -29,6 +29,8 @@ dependencies { implementation 'org.jetbrains.kotlin:kotlin-reflect' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2' implementation files("libs/ConstLib-1.0.jar") + implementation files("libs/PrimitiveExtensions-1.0.jar") + } /*sourceSets { diff --git a/Server/libs/PrimitiveExtensions-1.0.jar b/Server/libs/PrimitiveExtensions-1.0.jar new file mode 100644 index 0000000000000000000000000000000000000000..d26128c92e20f3088592037b15a33fa718b615bd GIT binary patch literal 1958 zcmWIWW@h1HVBp|j_>-3#!~g_LAOZ+Df!NnI#8KDN&rP41Apk|;rh2A#(m(~0KrDi+ z(AUw=)6F$FM9Yg1xC~?Vjb*g0F(>&?Z(WbkdGFlY(<^E3H zl&s-5g{gbldD-NHpV!Ryj`?x)(#zzde%qF{rt|YsKR|7&h!59B&$j~ zoc*@lrhE6H4KdpvM%(3I*mdW_Y2V|DtM3*5XBB_Ea5txlJMv(e+U2>yvKowYg={w_&YDzWv8G_@LyITw7la!3Oz^E;oh+$x;(|eI zCR^&^B^rN^Ez+@JHcsWVo2>eyY2kViBfXpZLbuj*JB7Vk%W+p#jXji)D>0gp&GLe7 zqRWzybcuhKH)OB!m6@u}UGTqQnTm+-$+rJ4EgR%4pBuewzB|Y0Y)NXA=8;Q+JI~$a zI-ve)#Vm^(zN@R$7N=!c%dSv8X|H>6_sU8>y5DZMs+pTnK!y1ysZw6&Nl$gcU~=KD5)c|~`xmZ|6a zRr#T1)7DJSzBbMI_i5F4x1Ofep8n>f5}XyHlYaNpjyvrMMN{*4PrLsm!}ee9<*%K$ zOQK^6e$`am7Vnc2$=ZL_?egjy{X1>!Mdn53&$meHkj#<@-Nuk4;WXtK$Gi*g*k_5( za{tn^t$&N%&i?*7*OE`Y>-^s-F3)@S@YL)D#b**yGHsT&zS%D^$>Z`X$+zscRa#VG1LpJYzvj%otS`jB^k(dgPPaZ literal 0 HcmV?d00001 diff --git a/Server/src/main/kotlin/rs09/game/content/dialogue/CouncilWorkerDialogue.kt b/Server/src/main/kotlin/rs09/game/content/dialogue/CouncilWorkerDialogue.kt new file mode 100644 index 000000000..52822d60b --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/content/dialogue/CouncilWorkerDialogue.kt @@ -0,0 +1,30 @@ +package rs09.game.content.dialogue + +import core.game.content.dialogue.DialoguePlugin +import core.game.node.entity.player.Player +import core.plugin.Initializable +import rs09.game.content.quest.members.thefremenniktrials.CouncilWorkerFTDialogue + +@Initializable +class CouncilWorkerDialogue(player: Player? = null) : DialoguePlugin(player){ + override fun open(vararg args: Any?): Boolean { + if(player.questRepository.getStage("Fremennik Trials") in 1..99){ + loadFile(CouncilWorkerFTDialogue(1)) + } + npc("'Ello there.") + return true + } + + override fun handle(interfaceId: Int, buttonId: Int): Boolean { + return true + } + + override fun newInstance(player: Player?): DialoguePlugin { + return CouncilWorkerDialogue(player) + } + + override fun getIds(): IntArray { + return intArrayOf(1287) + } + +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/BeerOnCouncilWorker.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/BeerOnCouncilWorker.kt deleted file mode 100644 index 4355bbd9b..000000000 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/BeerOnCouncilWorker.kt +++ /dev/null @@ -1,32 +0,0 @@ -package rs09.game.content.quest.members.thefremenniktrials - -import core.game.interaction.NodeUsageEvent -import core.game.node.entity.npc.NPC -import core.game.node.entity.player.Player -import core.plugin.Initializable -import core.plugin.Plugin -import core.game.content.quest.PluginInteraction -import core.game.content.quest.PluginInteractionManager - -@Initializable -class BeerOnCouncilWorker : PluginInteraction(1917){ - - override fun handle(player: Player?, event: NodeUsageEvent?): Boolean { - val with = event?.usedWith - if(with?.id?.equals(1287)!! && with is NPC){ - player?.dialogueInterpreter?.open(1287,true,true) - return true - } - return false - } - - override fun fireEvent(identifier: String?, vararg args: Any?): Any { - return Unit - } - - override fun newInstance(arg: Any?): Plugin { - PluginInteractionManager.register(this,PluginInteractionManager.InteractionType.USEWITH) - return this - } - -} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/BranchFletcher.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/BranchFletcher.kt deleted file mode 100644 index 59cd4012b..000000000 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/BranchFletcher.kt +++ /dev/null @@ -1,52 +0,0 @@ -package rs09.game.content.quest.members.thefremenniktrials - -import core.game.interaction.NodeUsageEvent -import core.game.node.entity.player.Player -import core.game.node.item.Item -import core.game.system.task.Pulse -import rs09.game.world.GameWorld -import core.game.world.update.flag.context.Animation -import core.plugin.Initializable -import core.plugin.Plugin -import core.game.content.quest.PluginInteraction -import core.game.content.quest.PluginInteractionManager - -@Initializable -class BranchFletcher : PluginInteraction(3692){ - - class BranchFletchingPulse(val player: Player?) : Pulse(){ - var counter = 0 - override fun pulse(): Boolean { - when(counter++){ - 0 -> player?.animator?.animate(Animation(1248)).also { player!!.lock() } - 3 -> player?.inventory?.remove(Item(3692)).also { player?.inventory?.add(Item(3688)); player!!.unlock(); return true} - } - return false - } - } - - override fun handle(player: Player?, event: NodeUsageEvent?): Boolean { - val with = event?.usedWith - if(with is Item && with.id == 946) { - player?.let { - if (it.inventory.containsItem(Item(946))) { - GameWorld.submit(BranchFletchingPulse(it)) - } else { - it.sendMessage("You need a knife to do this.") - } - } - return true - } - return false - } - - override fun fireEvent(identifier: String?, vararg args: Any?): Any { - return Unit - } - - override fun newInstance(arg: Any?): Plugin { - PluginInteractionManager.register(this,PluginInteractionManager.InteractionType.USEWITH) - return this - } - -} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/CouncilWorkerDialogue.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/CouncilWorkerDialogue.kt deleted file mode 100644 index f559f0755..000000000 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/CouncilWorkerDialogue.kt +++ /dev/null @@ -1,56 +0,0 @@ -package rs09.game.content.quest.members.thefremenniktrials - -import core.game.node.entity.player.Player -import core.game.node.entity.player.info.PlayerDetails -import core.game.node.item.Item -import core.plugin.Initializable -import core.game.content.dialogue.DialoguePlugin - -@Initializable -class CouncilWorkerDialogue(player: Player? = null) : DialoguePlugin(player){ - override fun open(vararg args: Any?): Boolean { - if(args.size > 1){ - npc("Ta very much like. That'll hit the spot nicely.. Here,","You can have this. I picked it up as a souvenir on me","last holz") - player?.inventory?.add(Item(3713)); player?.inventory?.remove(Item(1917)); stage = 10 - stage = 100; - } else { - npc("'Ello there.") - stage = 0; - } - return true - } - - override fun handle(interfaceId: Int, buttonId: Int): Boolean { - when(stage){ - 0 -> if(player?.questRepository?.getStage("Fremennik Trials")!! > 0){ - player("I know this is an odd question, but are you","a member of the elder council?") - stage++ - } else { - end() - } - 1 -> {npc("'fraid not, ${if(player?.appearance?.isMale!!) "sir" else "miss"}"); stage++} - 2 -> {npc("Say, would you do me a favor? I'm quite parched.","If you bring me a beer, I'll make it worthwhile.");stage++} - 3 -> if(player?.inventory?.containsItem(Item(1917))!!){ - player("Oh, I have one here! Take it.") - stage++ - } else { - end() - } - 4 -> {npc("Oh, thank you much ${if(player?.appearance?.isMale!!) "sir" else "miss"}");stage++} - 5 -> {npc("Ta very much like. That'll hit the spot nicely.. Here,","You can have this. I picked it up as a souvenir on me","last holz");player?.inventory?.add(Item(3713)); player?.inventory?.remove(Item(1917)); stage = 100} - - 100 -> end() - - } - return true - } - - override fun newInstance(player: Player?): DialoguePlugin { - return CouncilWorkerDialogue(player) - } - - override fun getIds(): IntArray { - return intArrayOf(1287) - } - -} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/CouncilWorkerFTDialogue.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/CouncilWorkerFTDialogue.kt new file mode 100644 index 000000000..d9502019d --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/CouncilWorkerFTDialogue.kt @@ -0,0 +1,42 @@ +package rs09.game.content.quest.members.thefremenniktrials + +import core.game.node.item.Item +import rs09.game.content.dialogue.DialogueFile +import rs09.tools.END_DIALOGUE +import rs09.tools.START_DIALOGUE + +class CouncilWorkerFTDialogue(val questStage: Int,var isBeerInteraction: Boolean = false) : DialogueFile(){ + + override fun handle(componentID: Int, buttonID: Int) { + + if(isBeerInteraction){ + when(stage){ + START_DIALOGUE -> {npc("Oh, thank you much ${if(player?.appearance?.isMale!!) "sir" else "miss"}");stage++} + 1 -> {npc("Ta very much like. That'll hit the spot nicely.. Here,","You can have this. I picked it up as a souvenir on me","last holz");player?.inventory?.add( + Item(3713) + ); player?.inventory?.remove(Item(1917)); stage = END_DIALOGUE} + } + } + + else if(questStage in 1..99){ + when(stage){ + START_DIALOGUE -> if(player?.questRepository?.getStage("Fremennik Trials")!! > 0){ + player("I know this is an odd question, but are you","a member of the elder council?") + } else { + end() + } + 1 -> {npc("'fraid not, ${if(player?.appearance?.isMale!!) "sir" else "miss"}"); stage++} + 2 -> {npc("Say, would you do me a favor? I'm quite parched.","If you bring me a beer, I'll make it worthwhile.");stage++} + 3 -> if(player?.inventory?.containsItem(Item(1917))!!){ + player("Oh, I have one here! Take it.") + stage = 0 + isBeerInteraction = true + } else { + stage = END_DIALOGUE + } + } + } + + } + +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/FishOnAltar.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/FishOnAltar.kt deleted file mode 100644 index f8b1fc4e0..000000000 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/FishOnAltar.kt +++ /dev/null @@ -1,77 +0,0 @@ -package rs09.game.content.quest.members.thefremenniktrials - -import core.game.content.dialogue.FacialExpression -import core.game.content.quest.PluginInteraction -import core.game.content.quest.PluginInteractionManager -import core.game.interaction.DestinationFlag -import core.game.interaction.MovementPulse -import core.game.interaction.NodeUsageEvent -import core.game.node.Node -import core.game.node.`object`.GameObject -import core.game.node.entity.npc.NPC -import core.game.node.entity.player.Player -import core.game.node.item.Item -import core.game.system.task.Pulse -import rs09.game.world.GameWorld -import core.plugin.Initializable -import core.plugin.Plugin - -@Initializable -class FishOnAltar : PluginInteraction(383, 389, 395){ - var fishUsed = 0 - - override fun handle(player: Player?, event: NodeUsageEvent?): Boolean { - fishUsed = event?.used!!.id - val with = event.usedWith - if(with is GameObject && with.id == 4141){ - if(player?.questRepository?.getStage("Fremennik Trials")!! >= 10){ - GameWorld.submit(moveToPulse(player,with,fishUsed)) - return true - } - } - return false - } - - class moveToPulse(val player: Player?, dest: Node, val fish: Int) : MovementPulse(player,dest, DestinationFlag.OBJECT){ - override fun pulse(): Boolean { - if(player?.inventory?.containsItem(Item(3689))!!){ - GameWorld.submit(spiritPulse(player, fish)) - } else { - player.dialogueInterpreter.sendDialogue("I should probably have my lyre with me.") - } - return true - } - } - - class spiritPulse(val player: Player?, val fish: Int) : Pulse(){ - var counter = 0 - val npc = NPC(1273,player?.location) - override fun pulse(): Boolean { - when(counter++){ - 0 -> npc.init().also { player?.lock() }.also { player?.inventory?.remove(Item(fish)) } - 1 -> npc.moveStep() - 2 -> npc.face(player).also { player?.face(npc) } - 3 -> player?.dialogueInterpreter?.sendDialogues(npc,FacialExpression.HAPPY,"I will kindly accept this offering, and","bestow upon you a gift in return.") - 4 -> player?.inventory?.remove(Item(3689)) - 5 -> when(fish){ - 383 -> player?.inventory?.add(Item(6125)) - 389 -> player?.inventory?.add(Item(6126)) - 395 -> player?.inventory?.add(Item(6127)) - } - 6 -> player?.unlock() - 10 -> npc.clear().also { return true } - } - return false - } - } - - override fun fireEvent(identifier: String, vararg args: Any): Any { - return Unit - } - - override fun newInstance(arg: Any?): Plugin { - PluginInteractionManager.register(this,PluginInteractionManager.InteractionType.USEWITH) - return this - } - -} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/HunterTalismanListener.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/HunterTalismanListener.kt index 1425db6aa..a52a0d5ec 100644 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/HunterTalismanListener.kt +++ b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/HunterTalismanListener.kt @@ -4,7 +4,6 @@ import core.game.node.entity.Entity import core.game.node.entity.player.Player import core.game.system.task.Pulse import core.game.world.map.Location -import core.plugin.Initializable import org.rs09.consts.Items import rs09.game.interaction.InteractionListener import rs09.game.world.GameWorld.Pulser @@ -18,10 +17,10 @@ class HunterTalismanListener : InteractionListener() { override fun defineListeners() { on(TALISMAN,ITEM,"locate"){player,_ -> - var locationString = player?.getAttribute("fremtrials:draugen-loc","none") + var locationString = player.getAttribute("fremtrials:draugen-loc","none") if(locationString == "none"){ val newLoc = possibleLocations.random() - player?.setAttribute("/save:fremtrials:draugen-loc","${newLoc.x},${newLoc.y}") + player.setAttribute("/save:fremtrials:draugen-loc","${newLoc.x},${newLoc.y}") locationString = "${newLoc.x},${newLoc.y}" } val locationComponents = locationString?.split(",") diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/KegOnKegAction.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/KegOnKegAction.kt deleted file mode 100644 index 1d8996b58..000000000 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/KegOnKegAction.kt +++ /dev/null @@ -1,50 +0,0 @@ -package rs09.game.content.quest.members.thefremenniktrials - -import core.game.interaction.NodeUsageEvent -import core.game.node.entity.player.Player -import core.game.node.item.Item -import core.game.world.map.RegionManager -import core.plugin.Initializable -import core.plugin.Plugin -import core.game.content.quest.PluginInteraction -import core.game.content.quest.PluginInteractionManager - -@Initializable -class KegOnKegAction : PluginInteraction(3712){ - - override fun handle(player: Player?, event: NodeUsageEvent?): Boolean { - val used = event?.used - val with = event?.usedWith - if(with?.id?.equals(3711)!! && player?.isInLongHouse()!!){ - if(!player.getAttribute("fremtrials:keg-mixed",false)!!){ - if(player.getAttribute("fremtrials:cherrybomb",false)) { - player.inventory?.remove(used as? Item) - player.setAttribute("/save:fremtrials:keg-mixed", true) - player.sendMessage("The cherry bomb in the pipe goes off.") - RegionManager.getLocalEntitys(player).stream().forEach { e -> e.sendChat("What was THAT??") } - player.sendMessage("You mix the kegs together.") - return true - } else { - player.dialogueInterpreter?.sendDialogue("I can't do this right now. I should create","a distraction.") - return true - } - } - return false - } - return false - } - - fun Player.isInLongHouse(): Boolean{ - return this.location.x >= 2655 && this.location.y >= 3665 && this.location.x <= 2662 && this.location.y <= 3681 - } - - override fun fireEvent(identifier: String?, vararg args: Any?): Any { - return Unit - } - - override fun newInstance(arg: Any?): Plugin { - PluginInteractionManager.register(this,PluginInteractionManager.InteractionType.USEWITH) - return this - } - -} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/LyreOptionHandler.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/LyreOptionHandler.kt deleted file mode 100644 index 0919ff739..000000000 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/LyreOptionHandler.kt +++ /dev/null @@ -1,65 +0,0 @@ -package core.plugin.quest.fremtrials - -import core.cache.def.impl.ItemDefinition -import core.game.interaction.OptionHandler -import core.game.node.Node -import core.game.node.entity.impl.Animator -import core.game.node.entity.player.Player -import core.game.node.item.Item -import core.game.system.task.Pulse -import rs09.game.world.GameWorld -import core.game.world.map.Location -import core.game.world.update.flag.context.Animation -import core.game.world.update.flag.context.Graphics -import core.plugin.Initializable -import core.plugin.Plugin - -@Initializable -class LyreOptionHandler : OptionHandler(){ - val ids = arrayListOf(14591,14590,6127,6126,6125,3691,3690) - - override fun handle(player: Player?, node: Node?, option: String?): Boolean { - if(player?.questRepository?.getStage("Fremennik Trials")!! < 20){ - player.sendMessage("You lack the knowledge to play this.") - return true - } - if(ids.isLast(ids.indexOf(node?.id))){ - player.sendMessage("Your lyre is out of charges!") - } else { - player.inventory?.remove(node as Item) - player.inventory?.add(Item(ids.getNext(node?.id))) - player.lock() - GameWorld.submit(telePulse(player)) - } - return true - } - - class telePulse(val player: Player) : Pulse(){ - var counter = 0 - override fun pulse(): Boolean { - when(counter++){ - 0 -> player.animator.animate(Animation(9600,Animator.Priority.VERY_HIGH), Graphics(1682)) - 6 -> player.properties.teleportLocation = Location.create(2661, 3646, 0) - 7 -> player.unlock().also { return true } - } - return false - } - } - - override fun newInstance(arg: Any?): Plugin { - for(id in ids){ - ItemDefinition.forId(id).handlers.put("option:play",this) - } - return this - } - - private fun ArrayList.getNext(any: Any?): T{ //gets the next member from a list - val indexOfCurrent = this.indexOf(any) - return get(indexOfCurrent + 1) - } - - private fun ArrayList.isLast(current: Int): Boolean{ - return current + 1 > size - 1 - } - -} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/PipeInserter.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/PipeInserter.kt deleted file mode 100644 index f32dd8006..000000000 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/PipeInserter.kt +++ /dev/null @@ -1,47 +0,0 @@ -package rs09.game.content.quest.members.thefremenniktrials - -import core.game.content.quest.PluginInteraction -import core.game.content.quest.PluginInteractionManager -import core.game.interaction.DestinationFlag -import core.game.interaction.MovementPulse -import core.game.node.Node -import core.game.node.`object`.GameObject -import core.game.node.entity.player.Player -import core.game.node.item.Item -import rs09.game.world.GameWorld -import core.plugin.Initializable -import core.plugin.Plugin - -@Initializable -class PipeInserter : PluginInteraction(4162){ - - override fun handle(player: Player?, node: Node?): Boolean { - class toPipePulse : MovementPulse(player,DestinationFlag.OBJECT.getDestination(player,node)) { - override fun pulse(): Boolean { - if(player?.inventory?.containsItem(Item(3714))!!){ - player.sendMessage("You stuff the lit object into the pipe.") - player.setAttribute("/save:fremtrials:cherrybomb",true) - player.inventory?.remove(Item(3714)) - } else { - player.sendMessage("What am I supposed to put in there? A shoe?") - } - return true - } - } - - if(node is GameObject){ - GameWorld.submit(toPipePulse()) - return true - } - return false - } - - override fun fireEvent(identifier: String?, vararg args: Any?): Any { - return Unit - } - - override fun newInstance(arg: Any?): Plugin { - PluginInteractionManager.register(this,PluginInteractionManager.InteractionType.OBJECT) - return this - } -} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/SwayingTreeHandler.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/SwayingTreeHandler.kt deleted file mode 100644 index 340cb6095..000000000 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/SwayingTreeHandler.kt +++ /dev/null @@ -1,61 +0,0 @@ -package rs09.game.content.quest.members.thefremenniktrials - -import core.game.interaction.DestinationFlag -import core.game.interaction.MovementPulse -import core.game.node.Node -import core.game.node.`object`.GameObject -import core.game.node.entity.player.Player -import core.game.node.item.Item -import core.game.system.task.Pulse -import rs09.game.world.GameWorld -import core.plugin.Initializable -import core.plugin.Plugin -import core.game.content.quest.PluginInteraction -import core.game.content.quest.PluginInteractionManager -import core.game.node.entity.skill.gather.SkillingTool - -@Initializable -class SwayingTreeHandler : PluginInteraction(4142) { - - class ChoppingPulse(val player: Player) : Pulse() { - var counter = 0 - override fun pulse(): Boolean { - when(counter++){ - 0 -> player.animator.animate(SkillingTool.getHatchet(player).animation) - 4 -> player.animator.reset().also { player.inventory.add(Item(3692));return true} - } - return false - } - } - - override fun handle(player: Player?, node: Node?): Boolean { - class toTreePulse(player: Player) : MovementPulse(player,DestinationFlag.OBJECT.getDestination(player,node)){ - override fun pulse(): Boolean { - SkillingTool.getHatchet(player)?.let { GameWorld.submit(ChoppingPulse(player!!)).also { return true } } - - player?.sendMessage("You need an axe which you have the woodcutting level to use to do this.") - return true - } - } - - if(node is GameObject){ - if(!player?.inventory?.containsItem(Item(3692))!!){ - GameWorld.submit(toTreePulse(player)) - return true - } else { - player.sendMessage("You already have a branch.") - } - } - return false - } - - override fun fireEvent(identifier: String?, vararg args: Any?): Any { - return Unit - } - - override fun newInstance(arg: Any?): Plugin { - PluginInteractionManager.register(this,PluginInteractionManager.InteractionType.OBJECT) - return this - } - -} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/SwensenLadder.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/SwensenLadder.kt deleted file mode 100644 index e5521757d..000000000 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/SwensenLadder.kt +++ /dev/null @@ -1,34 +0,0 @@ -package rs09.game.content.quest.members.thefremenniktrials - -import core.game.node.Node -import core.game.node.`object`.GameObject -import core.game.node.entity.player.Player -import core.plugin.Initializable -import core.plugin.Plugin -import core.game.content.dialogue.FacialExpression -import core.game.content.quest.PluginInteraction -import core.game.content.quest.PluginInteractionManager - -@Initializable -class SwensenLadder : PluginInteraction(4158){ - - override fun handle(player: Player?, node: Node?): Boolean { - if(node is GameObject){ - if(player?.getAttribute("fremtrials:swensen-accepted",false) == false){ - player.dialogueInterpreter?.sendDialogues(1283,FacialExpression.ANGRY,"Where do you think you're going?") - return true - } - } - return false - } - - override fun fireEvent(identifier: String?, vararg args: Any?): Any { - return Unit - } - - override fun newInstance(arg: Any?): Plugin { - PluginInteractionManager.register(this,PluginInteractionManager.InteractionType.OBJECT) - return this - } - -} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/SwensenPortals.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/SwensenPortals.kt deleted file mode 100644 index 7ba7b3aa5..000000000 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/SwensenPortals.kt +++ /dev/null @@ -1,72 +0,0 @@ -package rs09.game.content.quest.members.thefremenniktrials - -import core.game.interaction.DestinationFlag -import core.game.interaction.MovementPulse -import core.game.node.Node -import core.game.node.`object`.GameObject -import core.game.node.entity.player.Player -import rs09.game.world.GameWorld -import core.game.world.map.Location -import core.plugin.Initializable -import core.plugin.Plugin -import core.game.content.quest.PluginInteraction -import core.game.content.quest.PluginInteractionManager - -@Initializable -class SwensenPortals : PluginInteraction(2273,2274,2506,2507,2508,2505,2503,2504,5138){ - - class destRoom(val swx: Int, val swy: Int, val nex: Int, val ney: Int) - - fun destRoom.getCenter(): Location{ - return Location((swx + nex) / 2, (swy + ney) / 2).transform(1,0,0) - } - - override fun handle(player: Player?, node: Node?): Boolean { - val portal: GameObject? = node as GameObject - var toLocation: Location? = Location(0,0,0) - if(portal != null){ - class toPortal(val to: GameObject?) : MovementPulse(player,DestinationFlag.OBJECT.getDestination(player,portal)){ - override fun pulse(): Boolean { - when(to?.id){ - 2273 -> toLocation = destRoom(2639,10012,2645,10018).getCenter() - 2274 -> toLocation = destRoom(2650,10034,2656,10040).getCenter() - 2506 -> toLocation = destRoom(2662,10023,2669,10029).getCenter() - 2507 -> toLocation = destRoom(2626,10023,2633,10029).getCenter() - 2505 -> toLocation = destRoom(2650,10001,2656,10007).getCenter() - 2503 -> toLocation = destRoom(2662,10012,2668,10018).getCenter() - 2504 -> {toLocation = destRoom(2662,10034,2668,10039).getCenter(); player?.setAttribute("/save:fremtrials:maze-complete",true)} - 5138 -> toLocation = getRandomLocation(player) - } - player?.properties?.teleportLocation = toLocation - return true; - } - } - GameWorld.submit(toPortal(portal)) - return true - } - return false - } - - fun getRandomLocation(player: Player?): Location{ - var obj: GameObject? = null - - while(obj?.id != 5138) { - val objects = player?.viewport?.chunks?.random()?.random()?.objects - obj = objects?.random()?.random() - if(obj == null || obj.location?.equals(Location(0,0,0))!!){ - continue - } - } - return obj.location - } - - override fun fireEvent(identifier: String?, vararg args: Any?): Any { - return Unit - } - - override fun newInstance(arg: Any?): Plugin { - PluginInteractionManager.register(this,PluginInteractionManager.InteractionType.OBJECT) - return this - } - -} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/TFTInteractionListeners.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/TFTInteractionListeners.kt new file mode 100644 index 000000000..6802b2ffe --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/TFTInteractionListeners.kt @@ -0,0 +1,226 @@ +package rs09.game.content.quest.members.thefremenniktrials + +import core.game.content.dialogue.FacialExpression +import core.game.node.`object`.GameObject +import core.game.node.entity.impl.Animator +import core.game.node.entity.npc.NPC +import core.game.node.entity.player.Player +import core.game.node.entity.skill.gather.SkillingTool +import core.game.node.item.Item +import core.game.system.task.Pulse +import core.game.world.map.Location +import core.game.world.map.RegionManager +import core.game.world.update.flag.context.Animation +import core.game.world.update.flag.context.Graphics +import org.rs09.consts.Items +import org.rs09.consts.NPCs +import org.rs09.primextends.getNext +import org.rs09.primextends.isLast +import rs09.game.interaction.InteractionListener +import rs09.game.world.GameWorld +import rs09.game.world.GameWorld.Pulser + +class TFTInteractionListeners : InteractionListener(){ + + val BEER = Items.BEER_1917 + val WORKER = NPCs.COUNCIL_WORKMAN_1287 + val FISH_ALTAR = 4141 + val LYRE = Items.LYRE_3689 + val FISH = intArrayOf(Items.RAW_SHARK_383,Items.RAW_SEA_TURTLE_395,Items.RAW_MANTA_RAY_389) + val LOW_ALC_KEG = Items.LOW_ALCOHOL_KEG_3712 + val KEG = Items.KEG_OF_BEER_3711 + val TINDERBOX = Items.TINDERBOX_590 + val CHERRY_BOMB = Items.STRANGE_OBJECT_3713 + val LIT_BOMB = Items.LIT_STRANGE_OBJECT_3714 + val PIPE = 4162 + val PORTALIDs = intArrayOf(2273,2274,2506,2507,2505,2503,2504,5138) + val SWENSEN_LADDER = 4158 + val SWAYING_TREE = 4142 + val KNIFE = Items.KNIFE_946 + val TREE_BRANCH = Items.BRANCH_3692 + val LYRE_IDs = intArrayOf(14591,14590,6127,6126,6125,3691,3690) + + + override fun defineListeners() { + onUseWith(NPC,BEER,WORKER){ player, _, _ -> + player.dialogueInterpreter.open(CouncilWorkerFTDialogue(0,true), NPC(WORKER)) + return@onUseWith true + } + + onUseWith(OBJECT,FISH_ALTAR,*FISH){ player, _, fish -> + if(player.inventory.contains(LYRE,1)) { + Pulser.submit(spiritPulse(player, fish.id)) + } else { + player.sendMessage("I should probably have my lyre with me.") + } + return@onUseWith true + } + + onUseWith(ITEM,LOW_ALC_KEG,KEG){player,lowKeg,_ -> + if(!player.getAttribute("fremtrials:keg-mixed",false)!!){ + if(player.getAttribute("fremtrials:cherrybomb",false)) { + player.inventory?.remove(lowKeg.asItem()) + player.setAttribute("/save:fremtrials:keg-mixed", true) + player.sendMessage("The cherry bomb in the pipe goes off.") + RegionManager.getLocalEntitys(player).stream().forEach { e -> e.sendChat("What was THAT??") } + player.sendMessage("You mix the kegs together.") + return@onUseWith true + } else { + player.dialogueInterpreter?.sendDialogue("I can't do this right now. I should create","a distraction.") + return@onUseWith true + } + } else return@onUseWith false + } + + onUseWith(ITEM,TINDERBOX,CHERRY_BOMB){player,_,bomb -> + player.inventory.remove(bomb.asItem()) + player.inventory.add(Item(LIT_BOMB)) + player.sendMessage("You light the strange object.") + return@onUseWith true + } + + onUseWith(ITEM,KNIFE,TREE_BRANCH){player,knife,_ -> + if (player.inventory.containsItem(knife.asItem())) { + GameWorld.submit(BranchFletchingPulse(player)) + } else { + player.sendMessage("You need a knife to do this.") + } + return@onUseWith true + } + + on(LYRE_IDs,ITEM,"play"){player,lyre -> + if(player.questRepository?.getStage("Fremennik Trials")!! < 20){ + player.sendMessage("You lack the knowledge to play this.") + return@on true + } + if(LYRE_IDs.isLast(lyre.id)){ + player.sendMessage("Your lyre is out of charges!") + } else { + player.inventory?.remove(lyre.asItem()) + player.inventory?.add(Item(LYRE_IDs.getNext(lyre.id))) + player.lock() + Pulser.submit(telePulse(player)) + } + return@on true + } + + on(PIPE,OBJECT,"put-inside"){player, _ -> + val bombItem = Item(LIT_BOMB) + if(player.inventory.containsItem(bombItem)){ + player.sendMessage("You stuff the lit object into the pipe.") + player.setAttribute("/save:fremtrials:cherrybomb",true) + player.inventory.remove(bombItem) + } else { + player.sendMessage("What am I supposed to put in there? A shoe?") + } + return@on true + } + + on(PORTALIDs,OBJECT,"use"){player,portal -> + val toLocation = + when(portal.id){ + 2273 -> destRoom(2639, 10012, 2645, 10018).getCenter() + 2274 -> destRoom(2650, 10034, 2656, 10040).getCenter() + 2506 -> destRoom(2662, 10023, 2669, 10029).getCenter() + 2507 -> destRoom(2626, 10023, 2633, 10029).getCenter() + 2505 -> destRoom(2650, 10001, 2656, 10007).getCenter() + 2503 -> destRoom(2662, 10012, 2668, 10018).getCenter() + 2504 -> {player.setAttribute("/save:fremtrials:maze-complete",true); destRoom(2662, 10034, 2668, 10039).getCenter()} + else -> getRandomLocation(player) + } + player.properties?.teleportLocation = toLocation + return@on true; + } + + on(SWENSEN_LADDER,OBJECT,"climb"){player,_ -> + if(player.getAttribute("fremtrials:swensen-accepted",false) == false){ + player.dialogueInterpreter?.sendDialogues(1283,FacialExpression.ANGRY,"Where do you think you're going?") + return@on true + } + return@on true + } + + on(SWAYING_TREE,OBJECT,"chop down"){player,_ -> + SkillingTool.getHatchet(player)?.let { Pulser.submit(ChoppingPulse(player)).also { return@on true } } + + player.sendMessage("You need an axe which you have the woodcutting level to use to do this.") + return@on true + } + } + + class destRoom(val swx: Int, val swy: Int, val nex: Int, val ney: Int) + + fun destRoom.getCenter(): Location { + return Location((swx + nex) / 2, (swy + ney) / 2).transform(1,0,0) + } + + fun getRandomLocation(player: Player?): Location{ + var obj: GameObject? = null + + while(obj?.id != 5138) { + val objects = player?.viewport?.chunks?.random()?.random()?.objects + obj = objects?.random()?.random() + if(obj == null || obj.location?.equals(Location(0,0,0))!!){ + continue + } + } + return obj.location + } + + class spiritPulse(val player: Player?, val fish: Int) : Pulse(){ + var counter = 0 + val npc = NPC(1273,player?.location) + override fun pulse(): Boolean { + when(counter++){ + 0 -> npc.init().also { player?.lock() }.also { player?.inventory?.remove(Item(fish)) } + 1 -> npc.moveStep() + 2 -> npc.face(player).also { player?.face(npc) } + 3 -> player?.dialogueInterpreter?.sendDialogues(npc, + FacialExpression.HAPPY,"I will kindly accept this offering, and","bestow upon you a gift in return.") + 4 -> player?.inventory?.remove(Item(3689)) + 5 -> when(fish){ + 383 -> player?.inventory?.add(Item(6125)) + 389 -> player?.inventory?.add(Item(6126)) + 395 -> player?.inventory?.add(Item(6127)) + } + 6 -> player?.unlock() + 10 -> npc.clear().also { return true } + } + return false + } + } + + class ChoppingPulse(val player: Player) : Pulse() { + var counter = 0 + override fun pulse(): Boolean { + when(counter++){ + 0 -> player.animator.animate(SkillingTool.getHatchet(player).animation) + 4 -> player.animator.reset().also { player.inventory.add(Item(3692));return true} + } + return false + } + } + + class BranchFletchingPulse(val player: Player?) : Pulse(){ + var counter = 0 + override fun pulse(): Boolean { + when(counter++){ + 0 -> player?.animator?.animate(Animation(1248)).also { player!!.lock() } + 3 -> player?.inventory?.remove(Item(Items.BRANCH_3692)).also { player?.inventory?.add(Item(Items.UNSTRUNG_LYRE_3688)); player!!.unlock(); return true} + } + return false + } + } + + class telePulse(val player: Player) : Pulse(){ + var counter = 0 + override fun pulse(): Boolean { + when(counter++){ + 0 -> player.animator.animate(Animation(9600, Animator.Priority.VERY_HIGH), Graphics(1682)) + 6 -> player.properties.teleportLocation = Location.create(2661, 3646, 0) + 7 -> player.unlock().also { return true } + } + return false + } + } +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/TinderboxOnBomb.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/TinderboxOnBomb.kt deleted file mode 100644 index 9c20f5fcc..000000000 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/TinderboxOnBomb.kt +++ /dev/null @@ -1,34 +0,0 @@ -package rs09.game.content.quest.members.thefremenniktrials - -import core.game.interaction.NodeUsageEvent -import core.game.node.entity.player.Player -import core.game.node.item.Item -import core.plugin.Initializable -import core.plugin.Plugin -import core.game.content.quest.PluginInteraction -import core.game.content.quest.PluginInteractionManager - -@Initializable -class TinderboxOnBomb : PluginInteraction(3713){ - - override fun handle(player: Player?, event: NodeUsageEvent?): Boolean { - val with = event?.usedWith - if(with is Item && with.id.equals(590)){ - player?.inventory?.remove(event.used as Item) - player?.inventory?.add(Item(3714)) - player?.sendMessage("You light the strange object.") - return true - } - return false - } - - override fun fireEvent(identifier: String?, vararg args: Any?): Any { - return Unit - } - - override fun newInstance(arg: Any?): Plugin { - PluginInteractionManager.register(this,PluginInteractionManager.InteractionType.USEWITH) - return this - } - -} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/zone/phasmatys/bonegrinder/BoneGrinderListener.kt b/Server/src/main/kotlin/rs09/game/content/zone/phasmatys/bonegrinder/BoneGrinderListener.kt index e51f6d6e3..6f9abfd4a 100644 --- a/Server/src/main/kotlin/rs09/game/content/zone/phasmatys/bonegrinder/BoneGrinderListener.kt +++ b/Server/src/main/kotlin/rs09/game/content/zone/phasmatys/bonegrinder/BoneGrinderListener.kt @@ -57,9 +57,9 @@ class BoneGrinderListener : InteractionListener() { /** * Handle Bone -> Hopper */ - on(OBJECT,LOADER,*boneIDs){player,_,_ -> + onUseWith(OBJECT,LOADER,*boneIDs){ player, _, _ -> handleFill(player) - return@on true + return@onUseWith true } } diff --git a/Server/src/main/kotlin/rs09/game/interaction/InteractionListener.kt b/Server/src/main/kotlin/rs09/game/interaction/InteractionListener.kt index aa013661e..690d29609 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/InteractionListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/InteractionListener.kt @@ -19,10 +19,10 @@ abstract class InteractionListener : Listener{ fun on(type: Int, vararg option: String, handler: (Player, Node) -> Boolean){ Listeners.add(option,type,handler) } - fun on(used: Int, with: Int, type: Int, handler: (Player, Node, Node) -> Boolean){ - Listeners.add(used,with,type,handler) + fun onUseWith(type: Int, used: Int, vararg with: Int, handler: (Player, Node, Node) -> Boolean){ + Listeners.add(type,used,with,handler) } - fun on(type: Int,used: Int,vararg with: Int, handler: (Player, Node, Node) -> Boolean){ + fun onUseWith(type: Int, used: IntArray, vararg with: Int, handler: (Player, Node, Node) -> Boolean){ Listeners.add(type,used,with,handler) } } \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/interaction/Listeners.kt b/Server/src/main/kotlin/rs09/game/interaction/Listeners.kt index 550d52aa3..aafbaa517 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/Listeners.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/Listeners.kt @@ -115,4 +115,12 @@ object Listeners { } return true } + + fun add(type: Int, used: IntArray, with: IntArray, handler: (Player, Node, Node) -> Boolean) { + for(u in used){ + for (w in with){ + useWithListeners["$u:$w:$type"] = handler + } + } + } } \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withobject/CoalTrucksHandler.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withobject/CoalTrucksHandler.kt index cd5c09981..456542056 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/withobject/CoalTrucksHandler.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withobject/CoalTrucksHandler.kt @@ -54,7 +54,7 @@ class CoalTruckInteractionListeners : InteractionListener() { return@on true } - on(COAL,COAL_TRUCK_2114,OBJECT){player,_,_ -> + onUseWith(OBJECT,COAL,COAL_TRUCK_2114){ player, _, _ -> var coalInTruck = player.getAttribute("coal-truck-inventory", 0) var coalInInventory = player.inventory.getAmount(Items.COAL_453) @@ -74,7 +74,7 @@ class CoalTruckInteractionListeners : InteractionListener() { coalInTruck += coalInInventory player.setAttribute("/save:coal-truck-inventory",coalInTruck) - return@on true + return@onUseWith true } } } \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/node/entity/combat/equipment/EquipmentDegrader.kt b/Server/src/main/kotlin/rs09/game/node/entity/combat/equipment/EquipmentDegrader.kt index 2e109941a..76bea28ce 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/combat/equipment/EquipmentDegrader.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/combat/equipment/EquipmentDegrader.kt @@ -2,6 +2,10 @@ package rs09.game.node.entity.combat.equipment import core.game.node.entity.player.Player import core.game.node.item.Item +import org.rs09.primextends.getNext +import org.rs09.primextends.isLast +import org.rs09.primextends.isNextLast + /** * Handles equipment degrading * @author ceik @@ -81,17 +85,4 @@ class EquipmentDegrader{ } return null } - - private fun ArrayList.getNext(any: Any?): T{ //gets the next member from a list - val indexOfCurrent = this.indexOf(any) - return get(indexOfCurrent + 1) - } - - private fun ArrayList.isNextLast(current: Int): Boolean{ //checks if the next member in a list is last. - return current + 1 >= size - 1 - } - - private fun ArrayList.isLast(current: Int): Boolean{ - return current + 1 > size - 1 - } } \ No newline at end of file