From 25e910437595e710b6ca270b28595f71988fca9e Mon Sep 17 00:00:00 2001 From: Bonesy Date: Wed, 13 Dec 2023 12:08:10 +0000 Subject: [PATCH] Pet rock animations & fixes Made the Pet rock two-handed Changed Pet rock weight to 1 kg Edited dialogue for the Talk option to be more authentic Added animation for the Stroke option & a delay for the second message to wait for the animation to finish Edited dialogue for the Fetch option to be more authentic, added animations & graphics, and added the projectile with graphics Added animations & graphics for the Stay option --- Server/data/configs/item_configs.json | 8 +- .../content/global/handlers/item/PetRock.kt | 90 ++++++++++--------- 2 files changed, 55 insertions(+), 43 deletions(-) diff --git a/Server/data/configs/item_configs.json b/Server/data/configs/item_configs.json index 9e77e8647..97ffccbef 100644 --- a/Server/data/configs/item_configs.json +++ b/Server/data/configs/item_configs.json @@ -20737,8 +20737,8 @@ "durability": null, "name": "Burnt curry", "tradeable": "true", - "archery_ticket_price":"0", - "id":"2013" + "archery_ticket_price": "0", + "id": "2013" }, { "durability": null, @@ -34994,7 +34994,9 @@ "examine": "The lowest maintenance pet you will ever have.", "walk_anim": "6658", "durability": null, + "weight": "1", "turn90ccw_anim": "6663", + "two_handed": "true", "turn180_anim": "6659", "render_anim": "792", "equipment_slot": "3", @@ -130984,4 +130986,4 @@ "name": "ASDT Slot", "id": "14430" } -] +] \ No newline at end of file diff --git a/Server/src/main/content/global/handlers/item/PetRock.kt b/Server/src/main/content/global/handlers/item/PetRock.kt index d91763171..355ea3742 100644 --- a/Server/src/main/content/global/handlers/item/PetRock.kt +++ b/Server/src/main/content/global/handlers/item/PetRock.kt @@ -1,56 +1,66 @@ package content.global.handlers.item -import core.api.openDialogue -import org.rs09.consts.Items +import core.api.* import core.game.dialogue.DialogueFile -import core.game.interaction.InteractionListener +import core.game.dialogue.FacialExpression import core.game.interaction.IntType +import core.game.interaction.InteractionListener +import core.game.interaction.QueueStrength +import core.game.node.entity.impl.Projectile.getLocation +import core.game.world.map.Location +import core.game.world.update.flag.context.Animation import core.tools.END_DIALOGUE +import org.rs09.consts.Items -class PetRockPlugin : InteractionListener { +class PetRockListener : InteractionListener { override fun defineListeners() { - on(Items.PET_ROCK_3695, IntType.ITEM, "interact"){ player, _ -> - openDialogue(player, PetRockDialogue()) - return@on true - } + on(Items.PET_ROCK_3695, IntType.ITEM, "interact") { player, _ -> + openDialogue(player, PetRockDialogue()) + return@on true + } } } -class PetRockDialogue() : DialogueFile() { +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(core.game.dialogue.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(core.game.dialogue.FacialExpression.FRIENDLY, "Want to fetch the stick, rock? Of course you do...") - // Missing animation - stage = END_DIALOGUE - } - 5 -> { - playerl(core.game.dialogue.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 - } + 0 -> options("Talk", "Stroke", "Feed", "Fetch", "Stay").also { stage++ } + 1 -> when(buttonID) { + 1 -> { + sendPlayerDialogue(player!!, "Who's a good rock, then? Yes, you are! You're such a good rock. Ooga booga googa.", FacialExpression.FRIENDLY) + sendMessage(player!!, "Your rock seems a little happier.") + stage = END_DIALOGUE + } + 2 -> { + end() + sendMessage(player!!, "You stroke your pet rock.") + animate(player!!, 1333, false) + //waits for the animation to finish before sending the message + queueScript(player!!, animationDuration(Animation(1333)), QueueStrength.SOFT) { + sendMessage(player!!, "Your rock seems much happier.") + return@queueScript stopExecuting(player!!) + } + } + 3 -> { + end() + sendMessage(player!!, "You try and feed the rock.") + sendMessage(player!!, "Your rock doesn't seem hungry.") + } + 4 -> { + sendPlayerDialogue(player!!, "Want to fetch the stick, rock? Of course you do.", FacialExpression.FRIENDLY) + face(player!!, Location.getRandomLocation(getLocation(player), 2, true)) + visualize(player!!, 6665, 1157) + spawnProjectile(getLocation(player), Location.getRandomLocation(getLocation(player), 5, true), 1158, 40, 0,150, 250, 25) + stage = END_DIALOGUE + } + 5 -> { + face(player!!, Location.getRandomLocation(getLocation(player), 2, true)) + sendPlayerDialogue(player!!, "Be a good rock...", FacialExpression.FRIENDLY) + sendMessage(player!!, "You wait a few seconds and pick your rock back up and pet it.") + visualize(player!!, anim = 6664, gfx = 1156) + stage = END_DIALOGUE + } } - } } } } \ No newline at end of file