The Fremennik Trials Bugfixes

Fixed various issues with using items on objects
Quest log now pluralises votes
Draugen no longer spawns multiple times
Added pet rock interactions
This commit is contained in:
MatthewGould123 2022-09-09 09:11:13 +00:00 committed by Ryan
parent 2d871e5000
commit c32f5dfa93
8 changed files with 118 additions and 65 deletions

View file

@ -1,11 +1,12 @@
package rs09.game.content.quest.members.thefremenniktrials
import api.*
import core.game.node.entity.Entity
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.game.node.item.Item
class Draugen(val player: Player?) : NPC(1279,player?.location?.transform(1,0,0)){
class Draugen(val player: Player) : NPC(1279,player.location?.transform(1,0,0)){
override fun init() {
super.init()
@ -17,13 +18,17 @@ class Draugen(val player: Player?) : NPC(1279,player?.location?.transform(1,0,0)
if(!properties.combatPulse.isAttacking){
properties.combatPulse.attack(player)
}
if (!player.isActive) {
removeAttribute(player, "fremtrials:draugen-spawned")
this.clear()
}
}
override fun finalizeDeath(killer: Entity?) {
super.finalizeDeath(killer)
player?.setAttribute("/save:fremtrials:draugen-killed",true)
player?.removeAttribute("fremtrials:draugen-loc")
player?.inventory?.remove(Item(3696))
player?.inventory?.add(Item(3697))
setAttribute(player, "/save:fremtrials:draugen-killed",true)
removeAttribute(player, "fremtrials:draugen-loc")
removeItem(player, Item(3696), Container.INVENTORY)
addItem(player, 3697, 1, Container.INVENTORY)
}
}

View file

@ -45,7 +45,12 @@ class FremennikTrials : Quest("Fremennik Trials",64,63,3,347,0,1,10){
line(player,"Thorvald the Warrior",line++,player.getAttribute("fremtrials:thorvald-vote",false))
line(player,"Sigmund the Merchant",line++,player.getAttribute("fremtrials:sigmund-vote",false))
line(player,"Peer the Seer",line++,player.getAttribute("fremtrials:peer-vote",false))
line(player,"So far I have gotten ${player.getAttribute("fremtrials:votes",0)} votes.",line++)
val voteCount = player.getAttribute("fremtrials:votes",0);
var voteText = "${voteCount} votes";
if (voteCount === 1) {
voteText = "1 vote"
}
line(player,"So far I have gotten ${voteText}.",line++)
}
else if(stage == 100){
line(player,"I made my way to the far north of !!Kandarin?? and found",line++)

View file

@ -1,5 +1,6 @@
package rs09.game.content.quest.members.thefremenniktrials
import api.*
import core.game.node.entity.Entity
import core.game.node.entity.player.Player
import core.game.system.task.Pulse
@ -17,32 +18,37 @@ class HunterTalismanListener : InteractionListener {
override fun defineListeners() {
on(TALISMAN,ITEM,"locate"){player,_ ->
var locationString = player.getAttribute("fremtrials:draugen-loc","none")
var locationString = getAttribute(player,"fremtrials:draugen-loc","none")
if(locationString == "none"){
val newLoc = possibleLocations.random()
player.setAttribute("/save:fremtrials:draugen-loc","${newLoc.x},${newLoc.y}")
setAttribute(player, "/save:fremtrials:draugen-loc","${newLoc.x},${newLoc.y}")
locationString = "${newLoc.x},${newLoc.y}"
}
val locationComponents = locationString?.split(",")
val draugenLoc = Location(Integer.parseInt(locationComponents?.get(0)),Integer.parseInt(locationComponents?.get(1)))
if(player.location?.withinDistance(draugenLoc,5)!!){
player.dialogueInterpreter.sendDialogue("The Draugen is nearby, be careful!")
sendDialogue(player, "The Draugen is nearby, be careful!")
Pulser.submit(DraugenPulse(player))
} else {
val neededDirection = draugenLoc.getDirection(player as Entity)
player.sendMessage("The talisman pulls you to the $neededDirection")
sendMessage(player, "The talisman pulls you to the $neededDirection")
}
return@on true
}
}
class DraugenPulse(val player: Player?) : Pulse(){
class DraugenPulse(val player: Player) : Pulse(){
var count = 0
override fun pulse(): Boolean {
when(count++){
3 -> Draugen(player).init().also { return true }
3 -> {
if(getAttribute(player, "fremtrials:draugen-spawned", false)) return true
Draugen(player).init()
setAttribute(player, "fremtrials:draugen-spawned", true)
return true
}
}
return false
}

View file

@ -1,7 +1,6 @@
package rs09.game.content.quest.members.thefremenniktrials
import api.addItem
import api.removeItem
import api.*
import core.game.content.dialogue.DialoguePlugin
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.player.Player
@ -103,8 +102,8 @@ class OlafTheBard(player: Player? = null) : DialoguePlugin(player){
40 -> npcl(FacialExpression.HAPPY,"You have a truly poetic soul! Anyone who can compose such a beautiful epic, and then perform it so flawlessly can only bring good to our clan!").also { stage++ }
41 -> playerl(FacialExpression.THINKING,"Erm... so that's a yes, then?").also { stage++ }
42 -> npcl(FacialExpression.HAPPY,"Absolutely! We must collaborate together on a duet sometime, don't you think?").also {
player?.setAttribute("/save:fremtrials:olaf-vote",true)
player?.setAttribute("/save:fremtrials:votes",player.getAttribute("fremtrials:votes",0) + 1)
setAttribute(player, "/save:fremtrials:olaf-vote",true)
setAttribute(player, "/save:fremtrials:votes",getAttribute(player, "fremtrials:votes",0) + 1)
stage = 1000
}

View file

@ -309,7 +309,7 @@ class SeersHouseListeners : InteractionListener {
return@on true
}
onUseWith(SCENERY,TAP,*BUCKETS) { player, _, bucket ->
onUseWith(SCENERY, BUCKETS, TAP) { player, bucket, _ ->
when(bucket.id){
3727 ->{
removeItem(player,EMPTYBUCKET)
@ -345,8 +345,8 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY,TAP,*JUGS) { player, used, with ->
when(with.id){
onUseWith(SCENERY, JUGS, TAP) { player, used, with ->
when(used.id){
EMPTYJUG ->{
removeItem(player,EMPTYJUG)
addItem(player,FULLJUG)
@ -369,8 +369,8 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY,DRAIN,*BUCKETS) { player, used, with ->
when(with.id){
onUseWith(SCENERY, BUCKETS, DRAIN) { player, used, with ->
when(used.id){
EMPTYBUCKET ->{
sendMessage(player,"The bucket is already empty!")
}
@ -403,8 +403,8 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY,DRAIN,*JUGS) { player, used, with ->
when(with.id){
onUseWith(SCENERY, JUGS, DRAIN) { player, used, with ->
when(used.id){
EMPTYJUG ->{
sendMessage(player,"The jug is already empty!")
}
@ -434,7 +434,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY,BALANCECHEST, FOURFIFTHBUCKET) { player, used, with ->
onUseWith(SCENERY, FOURFIFTHBUCKET, BALANCECHEST) { player, used, with ->
removeItem(player,FOURFIFTHBUCKET)
addItem(player,VASE)
sendMessage(player,"You place the bucket on the scale.")
@ -443,8 +443,8 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY,MURAL,*DISKS) { player, used, with ->
when(with.id){
onUseWith(SCENERY, DISKS, MURAL) { player, used, with ->
when(used.id){
REDDISK ->{
if(player.getAttribute("olddiskplaced",false)){
removeItem(player,REDDISK)
@ -481,8 +481,8 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY,BALANCECHEST,*BUCKETS) { player, used, with ->
when(with.id){
onUseWith(SCENERY, BUCKETS, BALANCECHEST) { player, used, with ->
when(used.id){
EMPTYBUCKET ->{
player.animate(Animation(883,Animator.Priority.HIGH))
sendMessage(player,"You place the bucket on the scale")
@ -519,8 +519,8 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY,BALANCECHEST,*JUGS) { player, used, with ->
when(with.id){
onUseWith(SCENERY, JUGS, BALANCECHEST) { player, used, with ->
when(used.id){
EMPTYJUG ->{
player.animate(Animation(883,Animator.Priority.HIGH))
sendMessage(player,"You place the jug on the scale")
@ -545,8 +545,8 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY,FROZENTABLE,*BUCKETS) { player, used, with ->
when(with.id){
onUseWith(SCENERY, BUCKETS, FROZENTABLE) { player, used, with ->
when(used.id){
EMPTYBUCKET -> sendMessage(player,"Your empty bucket gets very cold on the icy table.")
FULLBUCKET -> {
player.animate(Animation(883,Animator.Priority.HIGH))
@ -558,8 +558,8 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY,FROZENTABLE, *JUGS) { player, used, with ->
when(with.id){
onUseWith(SCENERY, JUGS, FROZENTABLE) { player, used, with ->
when(used.id){
EMPTYJUG -> sendMessage(player,"Your empty jug gets very cold on the icy table.")
FULLJUG -> {
player.animate(Animation(883,Animator.Priority.HIGH))
@ -849,7 +849,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY,TAP,VASE) { player, used, with ->
onUseWith(SCENERY, VASE, TAP) { player, used, with ->
removeItem(player,VASE)
addItem(player,FULLVASE)
sendMessage(player,"You fill the strange looking vase with water.")
@ -902,7 +902,7 @@ class SeersHouseListeners : InteractionListener {
return@on true
}
onUseWith(SCENERY,FROZENTABLE, FULLVASE) { player, used, with ->
onUseWith(SCENERY, FULLVASE, FROZENTABLE) { player, used, with ->
player.animate(Animation(883,Animator.Priority.HIGH))
removeItem(player,VASE)
addItem(player,FROZENVASE)
@ -910,7 +910,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY,FROZENTABLE, SEALEDFULLVASE) { player, used, with ->
onUseWith(SCENERY, SEALEDFULLVASE, FROZENTABLE) { player, used, with ->
player.animate(Animation(883,Animator.Priority.HIGH))
removeItem(player,SEALEDFULLVASE)
addItem(player,FROZENKEY)
@ -919,7 +919,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY,COOKINGRANGE, FROZENBUCKET) { player, used, with ->
onUseWith(SCENERY, FROZENBUCKET, COOKINGRANGE) { player, used, with ->
player.animate(Animation(883,Animator.Priority.HIGH))
player.audioManager.send(Audio(2577, 1, 1))
removeItem(player,FROZENBUCKET)
@ -928,7 +928,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY,COOKINGRANGE, FROZENJUG) { player, used, with ->
onUseWith(SCENERY, FROZENJUG, COOKINGRANGE) { player, used, with ->
player.animate(Animation(883,Animator.Priority.HIGH))
player.audioManager.send(Audio(2577, 1, 1))
removeItem(player,FROZENJUG)
@ -937,7 +937,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY,COOKINGRANGE, FROZENVASE) { player, used, with ->
onUseWith(SCENERY, FROZENVASE, COOKINGRANGE) { player, used, with ->
player.animate(Animation(883,Animator.Priority.HIGH))
player.audioManager.send(Audio(2577, 1, 1))
removeItem(player,FROZENVASE)
@ -946,7 +946,7 @@ class SeersHouseListeners : InteractionListener {
return@onUseWith true
}
onUseWith(SCENERY,COOKINGRANGE, FROZENKEY) { player, used, with ->
onUseWith(SCENERY, FROZENKEY, COOKINGRANGE) { player, used, with ->
player.animate(Animation(883,Animator.Priority.HIGH))
player.audioManager.send(Audio(2577, 1, 1))
removeItem(player,FROZENKEY)

View file

@ -11,7 +11,6 @@ import core.game.node.entity.player.Player
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.gather.SkillingTool
import core.game.node.entity.skill.gather.woodcutting.WoodcuttingSkillPulse
import core.game.node.scenery.Scenery
import core.game.system.task.Pulse
@ -53,7 +52,6 @@ class TFTInteractionListeners : InteractionListener{
private 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)
private 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?*/)
override fun defineListeners() {
onUseWith(NPC,BEER,WORKER){ player, beer, _ ->
@ -61,7 +59,7 @@ class TFTInteractionListeners : InteractionListener{
return@onUseWith true
}
onUseWith(SCENERY,FISH_ALTAR,*FISH){ player, _, fish ->
onUseWith(SCENERY, FISH, FISH_ALTAR){ player,fish,_ ->
if(inInventory(player,Items.LYRE_3689) || inInventory(player,Items.ENCHANTED_LYRE_3690)) {
Pulser.submit(SpiritPulse(player, fish.id))
} else {
@ -105,7 +103,7 @@ class TFTInteractionListeners : InteractionListener{
return@onUseWith true
}
onUseWith(SCENERY,LALLIS_STEW,*STEW_INGREDIENT_IDS){player,_,stewIngredient ->
onUseWith(SCENERY, STEW_INGREDIENT_IDS, LALLIS_STEW){player,stewIngredient,_ ->
when(stewIngredient.id){
Items.ONION_1957 -> {
sendDialogue(player,"You added an onion to the stew")
@ -131,7 +129,7 @@ class TFTInteractionListeners : InteractionListener{
return@onUseWith true
}
onUseWith(SCENERY,SPINNING_WHEEL_IDS,GOLDEN_FLEECE){ player, _, _ ->
onUseWith(SCENERY,GOLDEN_FLEECE,*SPINNING_WHEEL_IDS){ player, _, _ ->
if(removeItem(player,GOLDEN_FLEECE)){
addItem(player,GOLDEN_WOOL)
animate(player,896)
@ -306,7 +304,7 @@ class TFTInteractionListeners : InteractionListener{
if (i == null) {
continue
}
if (i.name.toLowerCase().contains(" rune")) {
if (i.name.lowercase().contains(" rune")) {
return true
}
var slot: Int = i.definition.getConfiguration(ItemConfigParser.EQUIP_SLOT, -1)
@ -350,21 +348,6 @@ class TFTInteractionListeners : InteractionListener{
}
}
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()
addItem(player,Items.BRANCH_3692)
return true
}
}
return false
}
}
class LyreConcertPulse(val player: Player, val Lyre: Int) : Pulse(){
val GENERIC_LYRICS = arrayOf(
"${player.name?.capitalize()} is my name,",
@ -390,7 +373,6 @@ class TFTInteractionListeners : InteractionListener{
"I will simply tell you this:",
"I've joined the Legends' Guild!"
)
val SKILLS = mutableListOf(Skills.SKILL_NAME)
var counter = 0
val questPoints = getQP(player)
val champGuild = player.achievementDiaryManager?.hasCompletedTask(DiaryType.VARROCK, 1, 1)?: false
@ -444,7 +426,7 @@ class TFTInteractionListeners : InteractionListener{
player.musicPlayer.play(MusicEntry.forId(164))
sendChat(player,LYRICS[3])
}
12 ->{
14 ->{
setAttribute(player,"/save:lyreConcertPlayed",true)
player.removeAttribute("LyreEnchanted")
if(removeItem(player,Lyre))

View file

@ -24,7 +24,7 @@ class YrsaDialogue(player: Player? = null) : DialoguePlugin(player) {
return true
}
else if(player?.getAttribute("sigmundreturning",false) == true){
playerl(FacialExpression.ASKING,"I have this trade item but I can't remember who it's for")
playerl(FacialExpression.ASKING,"I have this trade item but I can't remember who it's for.")
stage = 25
return true
}

View file

@ -0,0 +1,56 @@
package rs09.game.interaction.item
import api.openDialogue
import core.game.content.dialogue.FacialExpression
import org.rs09.consts.Items
import rs09.game.content.dialogue.DialogueFile
import rs09.game.interaction.InteractionListener
import rs09.tools.END_DIALOGUE
class PetRockPlugin : InteractionListener {
override fun defineListeners() {
on(Items.PET_ROCK_3695, ITEM, "interact"){ player, _ ->
openDialogue(player, PetRockDialogue())
return@on true
}
}
}
class PetRockDialogue() : DialogueFile() {
override fun handle(componentID: Int, buttonID: Int) {
when(stage) {
0 -> options("Talk", "Stroke", "Feed", "Fetch", "Stay").also { stage++ }
1 -> {
when(buttonID) {
1 -> {
playerl(FacialExpression.FRIENDLY, "Who's a good rock then? Yes you are... You're such a good rock... ooga booga googa.")
player!!.sendMessage("Your rock seems a little happier.")
stage = END_DIALOGUE
}
2 -> {
player!!.sendMessage("You stroke your pet rock.")
// Missing animation
player!!.sendMessage("Your rock seems much happier.")
end()
}
3 -> {
player!!.sendMessage("You try and feed the rock.")
player!!.sendMessage("Your rock doesn't seem hungry.")
end()
}
4 -> {
playerl(FacialExpression.FRIENDLY, "Want to fetch the stick, rock? Of course you do...")
// Missing animation
stage = END_DIALOGUE
}
5 -> {
playerl(FacialExpression.FRIENDLY, "Be a good rock...")
player!!.sendMessage("You wait a few seconds and pick your rock back up and pet it.")
// Missing animation
stage = END_DIALOGUE
}
}
}
}
}
}