Fixed the listener for Shamus Tree (fixes lost city quest)

This commit is contained in:
Lila Hioh 2022-07-28 14:08:58 +00:00 committed by Ryan
parent 208d3adb7d
commit 180145336e
2 changed files with 72 additions and 1 deletions

View file

@ -3,6 +3,7 @@ package core.game.content.quest.members.lostcity;
import core.game.content.dialogue.DialoguePlugin;
import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.quest.Quest;
import rs09.game.content.quest.members.lostcity.ShamusTreeListener;
/**
* Handles the shamus npc dialogue.
@ -150,7 +151,7 @@ public final class ShamusDialogue extends DialoguePlugin {
* Makes dhamus disappear.
*/
private void disappear() {
LostCityPlugin.SHAMUS.setInvisible(true);
ShamusTreeListener.Companion.disappearShamus();
interpreter.sendPlainMessage(false, "The leprechaun magically disappears.");
stage++;
}

View file

@ -0,0 +1,70 @@
package rs09.game.content.quest.members.lostcity
import core.game.content.dialogue.FacialExpression
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.system.task.Pulse
import core.game.world.map.Location
import core.plugin.Initializable
import org.rs09.consts.NPCs
import org.rs09.consts.Scenery
import rs09.game.interaction.InteractionListener
import rs09.game.world.GameWorld
/**
* Shamus tree listener, to handle when a player chops Shamus's home tree,
* and to handle some details about the Shamus NPC
* @author lila
* @author Vexia
*/
@Initializable
class ShamusTreeListener : InteractionListener {
init {
SHAMUS.init()
SHAMUS.isWalks = true
SHAMUS.isInvisible = true
}
companion object {
val SHAMUS = NPC(NPCs.SHAMUS_654, Location(3138, 3211, 0))
fun disappearShamus() {
SHAMUS.isInvisible = true
}
}
fun handleShamusTree(player: Player): Boolean {
if (SkillingTool.getHatchet(player) == null) {
player.packetDispatch.sendMessage("You do not have an axe which you have the level to use.")
return true
}
showShamus(player)
return true
}
fun showShamus(player: Player) {
if(SHAMUS.isInvisible) {
SHAMUS.isInvisible = false
SHAMUS.properties.teleportLocation = SHAMUS.properties.spawnLocation
}
player.dialogueInterpreter.sendDialogues(SHAMUS, FacialExpression.FURIOUS, "Hey! Yer big elephant! Don't go choppin' down me", "house, now!")
GameWorld.Pulser.submit(object : Pulse(100) {
override fun pulse(): Boolean {
if (SHAMUS.dialoguePlayer == null) {
SHAMUS.isInvisible = true
return true
}
return false
}
})
}
override fun defineListeners() {
on(Scenery.TREE_2409,SCENERY,"chop") { player, _ ->
handleShamusTree(player)
return@on true
}
}
}