Beer item ID Council Workman interaction changed from normal beer to the beer from Fremennik longhall

Koschei boss fight sessions are now World Pulses instead of player pulses
Refactor TFTInteractionListener to use ContentAPI
Allow Neitiznot items to be equiped after Frem trials
This commit is contained in:
downthecrop 2022-05-14 05:31:26 +00:00 committed by Ryan
parent d91396d0ea
commit a5a0e9c9b4
5 changed files with 244 additions and 218 deletions

View file

@ -13,7 +13,7 @@ class CouncilWorkerDialogue(player: Player? = null) : DialoguePlugin(player){
override fun open(vararg args: Any?): Boolean { override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC npc = args[0] as NPC
if(questStage(player, "Fremennik Trials") in 1..99){ if(questStage(player, "Fremennik Trials") in 1..99){
loadFile(CouncilWorkerFTDialogue(1)) player.dialogueInterpreter.open((CouncilWorkerFTDialogue(1)))
} else { } else {
npc(FacialExpression.FRIENDLY,"'Ello there.").also { stage = 0 } npc(FacialExpression.FRIENDLY,"'Ello there.").also { stage = 0 }
} }

View file

@ -8,7 +8,7 @@ import rs09.tools.START_DIALOGUE
const val COUNCIL_WORKER = 1287 const val COUNCIL_WORKER = 1287
class CouncilWorkerFTDialogue(val questStage: Int,var isBeerInteraction: Boolean = false) : DialogueFile(){ class CouncilWorkerFTDialogue(val questStage: Int, var isBeerInteraction: Boolean = false, val beerId: Int? = null) : DialogueFile(){
override fun handle(componentID: Int, buttonID: Int) { override fun handle(componentID: Int, buttonID: Int) {
@ -17,8 +17,13 @@ class CouncilWorkerFTDialogue(val questStage: Int,var isBeerInteraction: Boolean
START_DIALOGUE -> {npc(COUNCIL_WORKER,"Oh, thank you much ${if(player!!.isMale) "sir" else "miss"}");stage++} START_DIALOGUE -> {npc(COUNCIL_WORKER,"Oh, thank you much ${if(player!!.isMale) "sir" else "miss"}");stage++}
1 -> { 1 -> {
npc(COUNCIL_WORKER,"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.") npc(COUNCIL_WORKER,"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.")
addItem(player!!, Items.STRANGE_OBJECT_3713) if(beerId != null){
removeItem(player!!, Items.BEER_1917, Container.INVENTORY) if(removeItem(player!!, beerId)){
addItem(player!!, Items.STRANGE_OBJECT_3713)
}
} else if(removeItem(player!!, Items.BEER_3803) || removeItem(player!!, Items.BEER_1917)) {
addItem(player!!, Items.STRANGE_OBJECT_3713)
}
stage = END_DIALOGUE stage = END_DIALOGUE
} }
} }
@ -34,13 +39,13 @@ class CouncilWorkerFTDialogue(val questStage: Int,var isBeerInteraction: Boolean
} }
1 -> {npc(COUNCIL_WORKER,"'fraid not, ${if(player!!.isMale) "sir" else "miss"}."); stage++} 1 -> {npc(COUNCIL_WORKER,"'fraid not, ${if(player!!.isMale) "sir" else "miss"}."); stage++}
2 -> {npc(COUNCIL_WORKER,"Say, would you do me a favor? I'm quite parched.","If you bring me a beer, I'll make it worthwhile.");stage++} 2 -> {npc(COUNCIL_WORKER,"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(inInventory(player!!,Items.BEER_1917)) { 3 -> if(inInventory(player!!,Items.BEER_3803) || inInventory(player!!,Items.BEER_1917)) {
player("Oh, I have one here! Take it.") player("Oh, I have one here! Take it.")
stage = 0 stage = 0
isBeerInteraction = true isBeerInteraction = true
} else { } else {
stage = END_DIALOGUE end()
} }
} }
} }
} }

View file

@ -49,7 +49,13 @@ class KoscheiNPC constructor(id: Int = 0, location: Location? = null, session: K
override fun init() { override fun init() {
super.init() super.init()
Pulser.submit(KoscheiSpawnPulse(session?.player, this))
/**
* Ensure the player is in the arena then spawn.
*/
if (session?.player?.location?.regionId == 10653)
Pulser.submit(KoscheiSpawnPulse(session.player, this))
else session?.close()
} }
override fun handleTickActions() { override fun handleTickActions() {

View file

@ -9,225 +9,218 @@ import core.game.node.entity.impl.Animator
import core.game.node.entity.npc.NPC import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.node.entity.player.link.diary.DiaryType import core.game.node.entity.player.link.diary.DiaryType
import core.game.node.entity.player.link.music.MusicEntry
import core.game.node.entity.skill.Skills import core.game.node.entity.skill.Skills
import core.game.node.entity.skill.gather.SkillingTool import core.game.node.entity.skill.gather.SkillingTool
import core.game.node.item.Item
import core.game.node.scenery.Scenery import core.game.node.scenery.Scenery
import core.game.system.task.Pulse import core.game.system.task.Pulse
import core.game.world.map.Location import core.game.world.map.Location
import core.game.world.map.RegionManager import core.game.world.map.RegionManager
import core.game.world.update.flag.context.Animation import core.game.world.update.flag.context.Animation
import core.game.world.update.flag.context.Graphics import core.game.world.update.flag.context.Graphics
import core.net.packet.PacketRepository
import core.net.packet.context.MusicContext
import core.net.packet.out.MusicPacket
import org.rs09.consts.Items import org.rs09.consts.Items
import org.rs09.consts.NPCs import org.rs09.consts.NPCs
import org.rs09.primextends.getNext import org.rs09.primextends.getNext
import org.rs09.primextends.isLast import org.rs09.primextends.isLast
import rs09.game.interaction.InteractionListener import rs09.game.interaction.InteractionListener
import rs09.game.system.config.ItemConfigParser import rs09.game.system.config.ItemConfigParser
import rs09.game.world.GameWorld
import rs09.game.world.GameWorld.Pulser import rs09.game.world.GameWorld.Pulser
class TFTInteractionListeners : InteractionListener{ class TFTInteractionListeners : InteractionListener{
val BEER = Items.BEER_1917 private val BEER = intArrayOf(Items.BEER_3803,Items.BEER_1917)
val WORKER = NPCs.COUNCIL_WORKMAN_1287 private val WORKER = NPCs.COUNCIL_WORKMAN_1287
val FISH_ALTAR = 4141 private val FISH_ALTAR = 4141
val LYRE = Items.LYRE_3689 private val FISH = intArrayOf(Items.RAW_SHARK_383,Items.RAW_SEA_TURTLE_395,Items.RAW_MANTA_RAY_389)
val FISH = intArrayOf(Items.RAW_SHARK_383,Items.RAW_SEA_TURTLE_395,Items.RAW_MANTA_RAY_389) private val LOW_ALC_KEG = Items.LOW_ALCOHOL_KEG_3712
val LOW_ALC_KEG = Items.LOW_ALCOHOL_KEG_3712 private val KEG = Items.KEG_OF_BEER_3711
val KEG = Items.KEG_OF_BEER_3711 private val TINDERBOX = Items.TINDERBOX_590
val TINDERBOX = Items.TINDERBOX_590 private val CHERRY_BOMB = Items.STRANGE_OBJECT_3713
val CHERRY_BOMB = Items.STRANGE_OBJECT_3713 private val LIT_BOMB = Items.LIT_STRANGE_OBJECT_3714
val LIT_BOMB = Items.LIT_STRANGE_OBJECT_3714 private val PIPE = 4162
val PIPE = 4162 private val PORTALIDs = intArrayOf(2273,2274,2506,2507,2505,2503,2504,5138)
val PORTALIDs = intArrayOf(2273,2274,2506,2507,2505,2503,2504,5138) private val SWENSEN_LADDER = 4158
val SWENSEN_LADDER = 4158 private val SWAYING_TREE = 4142
val SWAYING_TREE = 4142 private val KNIFE = Items.KNIFE_946
val KNIFE = Items.KNIFE_946 private val TREE_BRANCH = Items.BRANCH_3692
val TREE_BRANCH = Items.BRANCH_3692 private val LYRE_IDs = intArrayOf(14591,14590,6127,6126,6125,3691,3690)
val LYRE_IDs = intArrayOf(14591,14590,6127,6126,6125,3691,3690) private val THORVALD_LADDER = 34286
val THORVALD_LADDER = 34286 private val THORVALD_LADDER_LOWER = 4188
val THORVALD_LADDER_LOWER = 4188 private val LALLIS_STEW = 4149
val LALLIS_STEW = 4149 private val UNSTRUNG_LYRE = Items.UNSTRUNG_LYRE_3688
val UNSTRUNG_LYRE = Items.UNSTRUNG_LYRE_3688 private val GOLDEN_FLEECE = Items.GOLDEN_FLEECE_3693
val GOLDEN_FLEECE = Items.GOLDEN_FLEECE_3693 private val GOLDEN_WOOL = Items.GOLDEN_WOOL_3694
val GOLDEN_WOOL = Items.GOLDEN_WOOL_3694 private val LONGHALL_BACKDOOR = 4148
val LONGHALL_BACKDOOR = 4148 private val SHOPNPCS = intArrayOf(NPCs.YRSA_1301,NPCs.SKULGRIMEN_1303,NPCs.THORA_THE_BARKEEP_1300,NPCs.SIGMUND_THE_MERCHANT_1282,NPCs.FISH_MONGER_1315)
val SHOPNPCS = intArrayOf(NPCs.YRSA_1301,NPCs.SKULGRIMEN_1303,NPCs.THORA_THE_BARKEEP_1300,NPCs.SIGMUND_THE_MERCHANT_1282,NPCs.FISH_MONGER_1315) private val SPINNING_WHEEL_IDS = intArrayOf(2644,4309,8748,20365,21304,25824,26143,34497,36970,37476)
val SPINNING_WHEEL_IDS = intArrayOf(2644,4309,8748,20365,21304,25824,26143,34497,36970,37476) private val STEW_INGREDIENT_IDS = intArrayOf(Items.POTATO_1942,Items.ONION_1957,Items.CABBAGE_1965,Items.PET_ROCK_3695)
val STEW_INGREDIENT_IDS = intArrayOf(Items.POTATO_1942,Items.ONION_1957,Items.CABBAGE_1965,Items.PET_ROCK_3695) //private val FREMENNIK_HELMS = intArrayOf(Items.ARCHER_HELM_3749, Items.BERSERKER_HELM_3751, Items.WARRIOR_HELM_3753, Items.FARSEER_HELM_3755/*, Items.HELM_OF_NEITIZNOT_10828 Should this be included?*/)
var FREMENNIK_HELMS = intArrayOf(Items.ARCHER_HELM_3749, Items.BERSERKER_HELM_3751, Items.WARRIOR_HELM_3753, Items.FARSEER_HELM_3755/*, Items.HELM_OF_NEITIZNOT_10828 Should this be included?*/)
override fun defineListeners() { override fun defineListeners() {
onUseWith(NPC,BEER,WORKER){ player, _, _ -> onUseWith(NPC,BEER,WORKER){ player, beer, _ ->
player.dialogueInterpreter.open(CouncilWorkerFTDialogue(0,true), NPC(WORKER)) player.dialogueInterpreter.open(CouncilWorkerFTDialogue(0,true,beer.id), NPC(WORKER))
return@onUseWith true return@onUseWith true
} }
onUseWith(SCENERY,FISH_ALTAR,*FISH){ player, _, fish -> onUseWith(SCENERY,FISH_ALTAR,*FISH){ player, _, fish ->
if(player.inventory.contains(LYRE,1)) { if(inInventory(player,Items.LYRE_3689)) {
Pulser.submit(spiritPulse(player, fish.id)) Pulser.submit(SpiritPulse(player, fish.id))
} else { } else {
player.sendMessage("I should probably have my lyre with me.") sendMessage(player,"I should probably have my lyre with me.")
} }
return@onUseWith true return@onUseWith true
} }
onUseWith(ITEM,LOW_ALC_KEG,KEG){player,lowKeg,_ -> onUseWith(ITEM,LOW_ALC_KEG,KEG){player,_,_ ->
if(!player.getAttribute("fremtrials:keg-mixed",false)!!){ if(!getAttribute(player,"fremtrials:keg-mixed",false)){
if(player.getAttribute("fremtrials:cherrybomb",false)) { if(getAttribute(player,"fremtrials:cherrybomb",false)) {
player.inventory?.remove(lowKeg.asItem()) removeItem(player,LOW_ALC_KEG)
player.setAttribute("/save:fremtrials:keg-mixed", true) setAttribute(player,"/save:fremtrials:keg-mixed", true)
player.sendMessage("The cherry bomb in the pipe goes off.") sendMessage(player,"The cherry bomb in the pipe goes off.")
RegionManager.getLocalEntitys(player).stream().forEach { e -> e.sendChat("What was THAT??") } RegionManager.getLocalEntitys(player).stream().forEach { e -> e.sendChat("What was THAT??") }
player.sendMessage("You mix the kegs together.") sendMessage(player,"You mix the kegs together.")
return@onUseWith true
} else { } else {
player.dialogueInterpreter?.sendDialogue("I can't do this right now. I should create","a distraction.") player.dialogueInterpreter?.sendDialogue("I can't do this right now. I should create","a distraction.")
return@onUseWith true
} }
} else return@onUseWith false } 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 return@onUseWith true
} }
onUseWith(ITEM,KNIFE,TREE_BRANCH){player,knife,_ -> onUseWith(ITEM,TINDERBOX,CHERRY_BOMB){player,_,_ ->
if (player.inventory.containsItem(knife.asItem())) { if(removeItem(player,CHERRY_BOMB)){
GameWorld.submit(BranchFletchingPulse(player)) addItem(player,LIT_BOMB)
} else { sendMessage(player,"You light the strange object.")
player.sendMessage("You need a knife to do this.")
} }
return@onUseWith true return@onUseWith true
} }
onUseWith(ITEM,KNIFE,TREE_BRANCH){player,_,_ ->
if (inInventory(player,KNIFE))
Pulser.submit(BranchFletchingPulse(player))
else
sendMessage(player,"You need a knife to do this.")
return@onUseWith true
}
onUseWith(SCENERY,LALLIS_STEW,*STEW_INGREDIENT_IDS){player,_,stewIngredient -> onUseWith(SCENERY,LALLIS_STEW,*STEW_INGREDIENT_IDS){player,_,stewIngredient ->
when(stewIngredient.id){ when(stewIngredient.id){
Items.ONION_1957 -> { Items.ONION_1957 -> {
sendDialogue(player,"You added an onion to the stew") sendDialogue(player,"You added an onion to the stew")
player.setAttribute("/save:lalliStewOnionAdded",true) setAttribute(player,"/save:lalliStewOnionAdded",true)
removeItem(player,Items.ONION_1957) removeItem(player,stewIngredient)
} }
Items.POTATO_1942 -> { Items.POTATO_1942 -> {
sendDialogue(player,"You added a potato to the stew") sendDialogue(player,"You added a potato to the stew")
player.setAttribute("/save:lalliStewPotatoAdded",true) setAttribute(player,"/save:lalliStewPotatoAdded",true)
removeItem(player,Items.POTATO_1942) removeItem(player,stewIngredient)
} }
Items.CABBAGE_1965 -> { Items.CABBAGE_1965 -> {
sendDialogue(player,"You added a cabbage to the stew") sendDialogue(player,"You added a cabbage to the stew")
player.setAttribute("/save:lalliStewCabbageAdded",true) setAttribute(player,"/save:lalliStewCabbageAdded",true)
removeItem(player,Items.CABBAGE_1965) removeItem(player,stewIngredient)
} }
Items.PET_ROCK_3695 -> { Items.PET_ROCK_3695 -> {
sendDialogue(player,"You added your dear pet rock to the stew") sendDialogue(player,"You added your dear pet rock to the stew")
player.setAttribute("/save:lalliStewRockAdded",true) setAttribute(player,"/save:lalliStewRockAdded",true)
removeItem(player,Items.PET_ROCK_3695) removeItem(player,stewIngredient)
} }
} }
return@onUseWith true return@onUseWith true
} }
onUseWith(SCENERY,SPINNING_WHEEL_IDS,GOLDEN_FLEECE){player,_,item -> onUseWith(SCENERY,SPINNING_WHEEL_IDS,GOLDEN_FLEECE){ player, _, _ ->
animate(player,896) if(removeItem(player,GOLDEN_FLEECE)){
sendDialogue(player,"You spin the Golden Fleece into a ball of Golden Wool") addItem(player,GOLDEN_WOOL)
removeItem(player,GOLDEN_FLEECE) animate(player,896)
addItem(player,Items.GOLDEN_WOOL_3694) sendDialogue(player,"You spin the Golden Fleece into a ball of Golden Wool")
}
return@onUseWith true return@onUseWith true
} }
onUseWith(ITEM,UNSTRUNG_LYRE,GOLDEN_WOOL){player,lyre,wool -> onUseWith(ITEM,UNSTRUNG_LYRE,GOLDEN_WOOL){ player, _, _ ->
if(player.getSkills().getLevel(Skills.FLETCHING) >= 25){ if(player.getSkills().getLevel(Skills.FLETCHING) >= 25){
animate(player,1248) if(removeItem(player,GOLDEN_WOOL) &&
removeItem(player,Items.GOLDEN_WOOL_3694) removeItem(player,Items.UNSTRUNG_LYRE_3688)){
removeItem(player,Items.UNSTRUNG_LYRE_3688) animate(player,1248)
addItem(player,Items.LYRE_3689) addItem(player,Items.LYRE_3689)
sendDialogue(player,"You string the Lyre with the Golden Wool.") sendDialogue(player,"You string the Lyre with the Golden Wool.")
} }
else{ } else sendDialogue(player,"You need 25 fletching to do this!")
sendDialogue(player,"You need 25 fletching to do this!")
}
return@onUseWith true return@onUseWith true
} }
on(LONGHALL_BACKDOOR, SCENERY,"open"){player,door -> on(LONGHALL_BACKDOOR, SCENERY,"open"){player,door ->
if(player.getAttribute("LyreEnchanted",false)){ when {
sendNPCDialogue(player,1278,"Yeah you're good to go through. Olaf tells me you're some kind of outerlander bard here on tour. I doubt you're worse than Olaf is.") getAttribute(player,"LyreEnchanted",false) -> {
DoorActionHandler.handleAutowalkDoor(player,door.asScenery()) sendNPCDialogue(player,1278,"Yeah you're good to go through. Olaf tells me you're some kind of outerlander bard here on tour. I doubt you're worse than Olaf is.")
} DoorActionHandler.handleAutowalkDoor(player,door.asScenery())
else if(player.getAttribute("lyreConcertPlayed")){ }
DoorActionHandler.handleAutowalkDoor(player,door.asScenery()) getAttribute(player,"lyreConcertPlayed",false) -> {
DoorActionHandler.handleAutowalkDoor(player,door.asScenery())
}
else -> {
sendNPCDialogue(player,1278,"I didn't give you permission to go backstage!")
}
} }
return@on true return@on true
} }
on(LYRE_IDs,ITEM,"play"){player,lyre -> on(LYRE_IDs,ITEM,"play"){player,lyre ->
if(player.getAttribute("onStage",false) && player.getAttribute("lyreConcertPlayed",false) == false){ if(getAttribute(player,"onStage",false) && !getAttribute(player,"lyreConcertPlayed",false)){
Pulser.submit(LyreConcertPulse(player,lyre.id)) Pulser.submit(LyreConcertPulse(player,lyre.id))
} } else if(questStage(player, "Fremennik Trials") < 20 || !isQuestComplete(player, "Fremennik Trials")){
else if(questStage(player, "Fremennik Trials")!! < 20 || !isQuestComplete(player, "Fremennik Trials")!!){ sendMessage(player,"You lack the knowledge to play this.")
player.sendMessage("You lack the knowledge to play this.") } else if(LYRE_IDs.isLast(lyre.id)){
return@on true sendMessage(player,"Your lyre is out of charges!")
}
else if(LYRE_IDs.isLast(lyre.id)){
player.sendMessage("Your lyre is out of charges!")
} else { } else {
player.inventory?.remove(lyre.asItem()) if(removeItem(player,lyre.asItem())){
player.inventory?.add(Item(LYRE_IDs.getNext(lyre.id))) addItem(player,LYRE_IDs.getNext(lyre.id))
player.lock() Pulser.submit(TelePulse(player))
Pulser.submit(telePulse(player)) }
} }
return@on true return@on true
} }
on(PIPE,SCENERY,"put-inside"){ player, _ -> on(PIPE,SCENERY,"put-inside"){ player, _ ->
val bombItem = Item(LIT_BOMB) if(inInventory(player,LIT_BOMB)){
if(player.inventory.containsItem(bombItem)){ sendMessage(player,"You stuff the lit object into the pipe.")
player.sendMessage("You stuff the lit object into the pipe.") setAttribute(player,"/save:fremtrials:cherrybomb",true)
player.setAttribute("/save:fremtrials:cherrybomb",true) removeItem(player,LIT_BOMB)
player.inventory.remove(bombItem)
} else { } else {
player.sendMessage("What am I supposed to put in there? A shoe?") sendMessage(player,"What am I supposed to put in there? A shoe?")
} }
return@on true return@on true
} }
on(PORTALIDs,SCENERY,"use"){ player, portal -> on(PORTALIDs,SCENERY,"use"){ player, portal ->
val toLocation = player.properties?.teleportLocation = when(portal.id){
when(portal.id){ 2273 -> DestRoom(2639, 10012, 2645, 10018).getCenter()
2273 -> destRoom(2639, 10012, 2645, 10018).getCenter() 2274 -> DestRoom(2650, 10034, 2656, 10040).getCenter()
2274 -> destRoom(2650, 10034, 2656, 10040).getCenter() 2506 -> DestRoom(2662, 10023, 2669, 10029).getCenter()
2506 -> destRoom(2662, 10023, 2669, 10029).getCenter() 2507 -> DestRoom(2626, 10023, 2633, 10029).getCenter()
2507 -> destRoom(2626, 10023, 2633, 10029).getCenter() 2505 -> DestRoom(2650, 10001, 2656, 10007).getCenter()
2505 -> destRoom(2650, 10001, 2656, 10007).getCenter() 2503 -> DestRoom(2662, 10012, 2668, 10018).getCenter()
2503 -> destRoom(2662, 10012, 2668, 10018).getCenter() 2504 -> {
2504 -> {player.setAttribute("/save:fremtrials:maze-complete",true); destRoom(2662, 10034, 2668, 10039).getCenter()} setAttribute(player,"/save:fremtrials:maze-complete",true)
DestRoom(2662, 10034, 2668, 10039).getCenter()
}
else -> getRandomLocation(player) else -> getRandomLocation(player)
} }
player.properties?.teleportLocation = toLocation return@on true
return@on true;
} }
on(SWENSEN_LADDER,SCENERY,"climb"){ player, _ -> on(SWENSEN_LADDER,SCENERY,"climb"){ player, _ ->
if(player.getAttribute("fremtrials:swensen-accepted",false) == false){ if(!getAttribute(player,"fremtrials:swensen-accepted",false)){
player.dialogueInterpreter?.sendDialogues(1283,FacialExpression.ANGRY,"Where do you think you're going?") sendNPCDialogue(player,1283,"Where do you think you're going?",FacialExpression.ANGRY)
return@on true
} }
return@on true return@on true
} }
on(THORVALD_LADDER, SCENERY, "climb-down") { player, _ -> on(THORVALD_LADDER, SCENERY, "climb-down") { player, _ ->
if (isQuestComplete(player, "Fremennik Trials") || player.getAttribute("fremtrials:thorvald-vote",false)!!) { if (isQuestComplete(player, "Fremennik Trials") || getAttribute(player, "fremtrials:thorvald-vote", false)) {
player.sendMessage("You have no reason to go back down there.") sendMessage(player,"You have no reason to go back down there.")
return@on true return@on true
} else if (!player.getAttribute("fremtrials:warrior-accepted",false)!!) { } else if (!getAttribute(player,"fremtrials:warrior-accepted",false)) {
player.dialogueInterpreter?.sendDialogues(NPCs.THORVALD_THE_WARRIOR_1289, FacialExpression.ANGRY, player.dialogueInterpreter?.sendDialogues(NPCs.THORVALD_THE_WARRIOR_1289, FacialExpression.ANGRY,
"Outerlander... do not test my patience. I do not take", "Outerlander... do not test my patience. I do not take",
"kindly to people wandering in here and acting as though", "kindly to people wandering in here and acting as though",
@ -239,7 +232,7 @@ class TFTInteractionListeners : InteractionListener{
"You may not enter the battleground with any armour", "You may not enter the battleground with any armour",
"or weaponry of any kind." "or weaponry of any kind."
) )
player.dialogueInterpreter.addAction { player, buttonId -> player.dialogueInterpreter.addAction { _, _ ->
player.dialogueInterpreter?.sendDialogues(NPCs.THORVALD_THE_WARRIOR_1289, FacialExpression.ANGRY, player.dialogueInterpreter?.sendDialogues(NPCs.THORVALD_THE_WARRIOR_1289, FacialExpression.ANGRY,
"If you need to place your equipment into your bank", "If you need to place your equipment into your bank",
"account, I recommend that you speak to the seer. He", "account, I recommend that you speak to the seer. He",
@ -249,42 +242,45 @@ class TFTInteractionListeners : InteractionListener{
return@on true return@on true
} }
if (player.getExtension<Any?>(KoscheiSession::class.java) != null) {
KoscheiSession.getSession(player).close()
}
ClimbActionHandler.climb(player, Animation(828), Location.create(2671, 10099, 2)) ClimbActionHandler.climb(player, Animation(828), Location.create(2671, 10099, 2))
player.pulseManager.run(KoscheiPulse(player)) Pulser.submit(KoscheiPulse(player))
return@on true return@on true
} }
on(THORVALD_LADDER_LOWER, SCENERY, "climb-up") { player, _ -> on(THORVALD_LADDER_LOWER, SCENERY, "climb-up") { player, _ ->
if (player.getExtension<Any?>(KoscheiSession::class.java) != null) {
KoscheiSession.getSession(player).close()
}
ClimbActionHandler.climb(player, Animation(828), Location.create(2666, 3694, 0)) ClimbActionHandler.climb(player, Animation(828), Location.create(2666, 3694, 0))
return@on true return@on true
} }
on(SWAYING_TREE,SCENERY,"cut-branch"){ player, _ -> on(SWAYING_TREE,SCENERY,"cut-branch"){ player, _ ->
SkillingTool.getHatchet(player)?.let { Pulser.submit(ChoppingPulse(player)).also { return@on true } } 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.") sendMessage(player,"You need an axe which you have the woodcutting level to use to do this.")
return@on true return@on true
} }
on(SHOPNPCS,NPC,"Trade") { player, npc -> on(SHOPNPCS,NPC,"Trade") { player, npc ->
if(isQuestComplete(player, "Fremennik Trials")){ if(isQuestComplete(player, "Fremennik Trials")){
npc.asNpc().openShop(player) npc.asNpc().openShop(player)
} } else when(npc.id){
else { NPCs.THORA_THE_BARKEEP_1300 -> sendDialogue(player,"Only Fremenniks may buy drinks here.")
when(npc.id){ NPCs.SKULGRIMEN_1303 -> sendDialogue(player,"Only Fremenniks may purchase weapons and armour here.")
NPCs.THORA_THE_BARKEEP_1300 -> sendDialogue(player,"Only Fremenniks may buy drinks here.") NPCs.SIGMUND_THE_MERCHANT_1282 -> sendDialogue(player,"Only Fremenniks may trade with this merchant.")
NPCs.SKULGRIMEN_1303 -> sendDialogue(player,"Only Fremenniks may purchase weapons and armour here.") NPCs.YRSA_1301 -> sendDialogue(player,"Only Fremenniks may buy clothes here.")
NPCs.SIGMUND_THE_MERCHANT_1282 -> sendDialogue(player,"Only Fremenniks may trade with this merchant.") NPCs.FISH_MONGER_1315 -> sendDialogue(player,"Only Fremenniks may purchase fish here.")
NPCs.YRSA_1301 -> sendDialogue(player,"Only Fremenniks may buy clothes here.")
NPCs.FISH_MONGER_1315 -> sendDialogue(player,"Only Fremenniks may purchase fish here.")
}
} }
return@on true return@on true
} }
} }
class destRoom(val swx: Int, val swy: Int, val nex: Int, val ney: Int) class DestRoom(val swx: Int, val swy: Int, val nex: Int, val ney: Int)
fun destRoom.getCenter(): Location { fun DestRoom.getCenter(): Location {
return Location((swx + nex) / 2, (swy + ney) / 2).transform(1,0,0) return Location((swx + nex) / 2, (swy + ney) / 2).transform(1,0,0)
} }
@ -323,25 +319,29 @@ class TFTInteractionListeners : InteractionListener{
return false return false
} }
class spiritPulse(val player: Player?, val fish: Int) : Pulse(){ class SpiritPulse(val player: Player, val fish: Int) : Pulse(){
var counter = 0 var counter = 0
val npc = NPC(1273,player?.location) val npc = NPC(1273, player.location)
override fun pulse(): Boolean { override fun pulse(): Boolean {
when(counter++){ when(counter++){
0 -> npc.init().also { player?.lock() }.also { player?.inventory?.remove(Item(fish)) } 0 -> {
1 -> npc.moveStep() npc.init()
2 -> npc.face(player).also { player?.face(npc) } player.lock()
3 -> player?.dialogueInterpreter?.sendDialogues(npc, removeItem(player,fish)
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() 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 -> removeItem(player,Items.LYRE_3689)
5 -> when(fish){
383 -> addItem(player,Items.ENCHANTED_LYRE2_6125)
389 -> addItem(player,Items.ENCHANTED_LYRE3_6126)
395 -> addItem(player,Items.ENCHANTED_LYRE4_6127)
}
6 -> player.unlock()
10 -> npc.clear().also { 10 -> npc.clear().also {
player?.setAttribute("/save:LyreEnchanted",true) setAttribute(player,"/save:LyreEnchanted",true)
return true } return true }
} }
return false return false
@ -353,15 +353,19 @@ class TFTInteractionListeners : InteractionListener{
override fun pulse(): Boolean { override fun pulse(): Boolean {
when(counter++){ when(counter++){
0 -> player.animator.animate(SkillingTool.getHatchet(player).animation) 0 -> player.animator.animate(SkillingTool.getHatchet(player).animation)
4 -> player.animator.reset().also { player.inventory.add(Item(3692));return true} 4 -> {
player.animator.reset()
addItem(player,Items.BRANCH_3692)
return true
}
} }
return false return false
} }
} }
class LyreConcertPulse(val player: Player?, val Lyre: Int) : Pulse(){ class LyreConcertPulse(val player: Player, val Lyre: Int) : Pulse(){
val GENERIC_LYRICS = arrayOf( val GENERIC_LYRICS = arrayOf(
"${player?.name?.capitalize()} is my name,", "${player.name?.capitalize()} is my name,",
"I haven't much to say", "I haven't much to say",
"But since I have to sing this song.", "But since I have to sing this song.",
"I'll just go ahead and play." "I'll just go ahead and play."
@ -386,90 +390,95 @@ class TFTInteractionListeners : InteractionListener{
) )
val SKILLS = mutableListOf(Skills.SKILL_NAME) val SKILLS = mutableListOf(Skills.SKILL_NAME)
var counter = 0 var counter = 0
val questPoints = player?.questRepository?.points val questPoints = getQP(player)
val champGuild = player?.getAchievementDiaryManager()?.hasCompletedTask(DiaryType.VARROCK, 1, 1)?: false val champGuild = player.achievementDiaryManager?.hasCompletedTask(DiaryType.VARROCK, 1, 1)?: false
val legGuild = questPoints!! >= 111 val legGuild = questPoints >= 111
val heroGuild = questPoints!! >= 5 val heroGuild = questPoints >= 5
val masteredAmount = player?.getSkills()?.masteredSkills!! > 0 val masteredAmount = player.getSkills()?.masteredSkills!! > 0
var SKILLNAME = getMasteredSkillNames(player!!) var SKILLNAME = getMasteredSkillNames(player)
val SKILLER_LYRICS = if(masteredAmount){arrayOf( val LYRICS = when {
"When people speak of training,", masteredAmount -> {
"Some people think they're fine.", arrayOf(
"But they just all seem jealous that", "When people speak of training,",
"My ${SKILLNAME.random()}'s ninety-nine!" "Some people think they're fine.",
)} else arrayOf("Pee pee poo poo pee","I really have to pee","If you sing this song","Let me know that this is what you see") "But they just all seem jealous that",
"My ${SKILLNAME.random()}'s ninety-nine!"
val LYRICS = if(masteredAmount){ )
println(masteredAmount) }
SKILLER_LYRICS legGuild -> LEGENDS_LYRICS
} else if(legGuild){ heroGuild -> HEROES_LYRICS
LEGENDS_LYRICS champGuild -> CHAMPS_LYRICS
}else if(heroGuild){ else -> GENERIC_LYRICS
HEROES_LYRICS }
}else if(champGuild){
CHAMPS_LYRICS
}else{GENERIC_LYRICS}
override fun pulse(): Boolean { override fun pulse(): Boolean {
when(counter++){ when(counter++){
0 -> { 0 -> {
player?.lock() player.lock()
animate(player!!,1318,true) animate(player,1318,true)
} }
2 -> { 2 -> {
animate(player!!,1320,true) animate(player,1320,true)
PacketRepository.send(MusicPacket::class.java, MusicContext(player, 165, true)) player.musicPlayer.play(MusicEntry.forId(165))
} }
4 -> { 4 -> {
animate(player!!,1320,true) animate(player,1320,true)
PacketRepository.send(MusicPacket::class.java, MusicContext(player, 164, true)) player.musicPlayer.play(MusicEntry.forId(164))
sendChat(player,LYRICS[0]) sendChat(player,LYRICS[0])
} }
6 -> { 6 -> {
animate(player!!,1320,true) animate(player,1320,true)
PacketRepository.send(MusicPacket::class.java, MusicContext(player, 164, true)) player.musicPlayer.play(MusicEntry.forId(164))
sendChat(player,LYRICS[1]) sendChat(player,LYRICS[1])
} }
8 -> { 8 -> {
animate(player!!,1320,true) animate(player,1320,true)
PacketRepository.send(MusicPacket::class.java, MusicContext(player, 164, true)) player.musicPlayer.play(MusicEntry.forId(164))
sendChat(player,LYRICS[2]) sendChat(player,LYRICS[2])
} }
10 ->{ 10 ->{
animate(player!!,1320,true) animate(player,1320,true)
PacketRepository.send(MusicPacket::class.java, MusicContext(player, 163, true)) player.musicPlayer.play(MusicEntry.forId(164))
sendChat(player,LYRICS[3]) sendChat(player,LYRICS[3])
} }
12 ->{ 12 ->{
player?.setAttribute("/save:lyreConcertPlayed",true) setAttribute(player,"/save:lyreConcertPlayed",true)
player?.removeAttribute("LyreEnchanted") player.removeAttribute("LyreEnchanted")
player?.inventory?.remove(Item(Lyre)) if(removeItem(player,Lyre))
addItem(player!!,3689) addItem(player,3689)
player?.unlock() player.unlock()
} }
} }
return false return false
} }
} }
class BranchFletchingPulse(val player: Player?) : Pulse(){ class BranchFletchingPulse(val player: Player) : Pulse(){
var counter = 0 var counter = 0
override fun pulse(): Boolean { override fun pulse(): Boolean {
when(counter++){ when(counter++){
0 -> player?.animator?.animate(Animation(1248)).also { player!!.lock() } 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} 3 -> {
if(removeItem(player,Items.BRANCH_3692))
addItem(player,Items.UNSTRUNG_LYRE_3688)
player.unlock()
return true
}
} }
return false return false
} }
} }
class telePulse(val player: Player) : Pulse(){ class TelePulse(val player: Player) : Pulse(){
var counter = 0 var counter = 0
override fun pulse(): Boolean { override fun pulse(): Boolean {
when(counter++){ when(counter++){
0 -> player.animator.animate(Animation(9600, Animator.Priority.VERY_HIGH), Graphics(1682)) 0 -> {
6 -> player.properties.teleportLocation = Location.create(2661, 3646, 0) player.lock()
player.animator.animate(Animation(9600, Animator.Priority.VERY_HIGH), Graphics(1682))
}
6 -> player.properties.teleportLocation = Location(2661, 3646, 0)
7 -> player.unlock().also { return true } 7 -> player.unlock().also { return true }
} }
return false return false
@ -480,8 +489,12 @@ class TFTInteractionListeners : InteractionListener{
var counter = 0 var counter = 0
override fun pulse(): Boolean { override fun pulse(): Boolean {
when(counter++) { when(counter++) {
0 -> player.sendMessage("Explore this battleground and find your foe...") 0 -> sendMessage(player,"Explore this battleground and find your foe...")
20 -> KoscheiSession.create(player).start().also { return true } 20 -> {
if (player.getExtension<Any?>(KoscheiSession::class.java) != null)
return true
KoscheiSession.create(player).start().also { return true }
}
} }
return false return false
} }

View file

@ -4,7 +4,6 @@ import api.*
import core.game.node.entity.player.link.quest.QuestRepository import core.game.node.entity.player.link.quest.QuestRepository
import org.rs09.consts.Items import org.rs09.consts.Items
import rs09.game.interaction.InteractionListener import rs09.game.interaction.InteractionListener
import rs09.game.interaction.InteractionListeners.run
class ItemQuestRequirementListener : InteractionListener { class ItemQuestRequirementListener : InteractionListener {
@ -40,6 +39,8 @@ class ItemQuestRequirementListener : InteractionListener {
private val questCapes = intArrayOf(9813,9814) private val questCapes = intArrayOf(9813,9814)
override fun defineListeners() { override fun defineListeners() {
/*
onEquip(fremennikIslesEquipment) { player, _ -> onEquip(fremennikIslesEquipment) { player, _ ->
if (!isQuestComplete(player, "Fremennik Isles")) { if (!isQuestComplete(player, "Fremennik Isles")) {
sendMessage(player, "You must have completed The Fremennik Isles to equip this.") sendMessage(player, "You must have completed The Fremennik Isles to equip this.")
@ -48,17 +49,18 @@ class ItemQuestRequirementListener : InteractionListener {
return@onEquip true return@onEquip true
} }
onEquip(fremennikTrialsEquipment) { player, _ -> onEquip(fremennikIslesDuringQuestEquipment){ player, _ ->
if (!isQuestComplete(player, "Fremennik Trials")) { if (questStage(player, "Fremennik Isles") > 0) {
sendMessage(player, "You must have completed The Fremennik Trials to equip this.") sendMessage(player, "You must have started The Fremennik Isles to equip this.")
return@onEquip false return@onEquip false
} }
return@onEquip true return@onEquip true
} }
*/
onEquip(fremennikIslesDuringQuestEquipment){ player, _ -> onEquip(fremennikTrialsEquipment.plus(fremennikIslesEquipment)) { player, _ ->
if (questStage(player, "Fremennik Isles") > 0) { if (!isQuestComplete(player, "Fremennik Trials")) {
sendMessage(player, "You must have started The Fremennik Isles to equip this.") sendMessage(player, "You must have completed The Fremennik Trials to equip this.")
return@onEquip false return@onEquip false
} }
return@onEquip true return@onEquip true