From e7fa5b576d72d9ec4637519c5bc910032c0e870b Mon Sep 17 00:00:00 2001 From: Oven Bread Date: Wed, 2 Aug 2023 01:25:23 +0000 Subject: [PATCH] Fixed unnoting of ore by Ordan Corrected Ordan's and Jorzik's dialogue and faces --- Server/data/configs/npc_configs.json | 10 ++++ Server/data/configs/npc_spawns.json | 16 +++--- .../misc/keldagrim/dialogue/JorzikDialogue.kt | 52 ++++++++----------- .../misc/keldagrim/dialogue/OrdanDialogue.kt | 30 ++++------- 4 files changed, 52 insertions(+), 56 deletions(-) diff --git a/Server/data/configs/npc_configs.json b/Server/data/configs/npc_configs.json index 0ede1da6f..2cb342a0d 100644 --- a/Server/data/configs/npc_configs.json +++ b/Server/data/configs/npc_configs.json @@ -24735,6 +24735,16 @@ "range_level": "1", "attack_level": "1" }, + { + "examine": "He smells of rock dust.", + "name": "Ordan", + "id": "2564" + }, + { + "examine": "He buys stuff.", + "name": "Jorzik", + "id": "2565" + }, { "death_animation": "836", "name": "Market Guard", diff --git a/Server/data/configs/npc_spawns.json b/Server/data/configs/npc_spawns.json index 3d3ef9a1a..50909ccac 100644 --- a/Server/data/configs/npc_spawns.json +++ b/Server/data/configs/npc_spawns.json @@ -4875,6 +4875,14 @@ "npc_id": "2549", "loc_data": "{3364,3001,0,0,6}" }, + { + "npc_id": "2564", + "loc_data": "{1936,4966,0,0,4}" + }, + { + "npc_id": "2565", + "loc_data": "{1939,4968,0,1,0}" + }, { "npc_id": "2568", "loc_data": "{2729,3495,0,0,6}-{2724,3495,0,0,6}-{2728,3495,0,0,6}-{2721,3495,0,0,6}" @@ -10523,14 +10531,6 @@ "npc_id": "2159", "loc_data": "{2885,10196,0,1,0}" }, - { - "npc_id": "2565", - "loc_data": "{1937,4972,0,1,0}" - }, - { - "npc_id": "2564", - "loc_data": "{1935,4964,0,0,4}" - }, { "npc_id": "2321", "loc_data": "{2918,10194,0,0,3}" diff --git a/Server/src/main/content/region/misc/keldagrim/dialogue/JorzikDialogue.kt b/Server/src/main/content/region/misc/keldagrim/dialogue/JorzikDialogue.kt index 0c0b33e7e..8844f3758 100644 --- a/Server/src/main/content/region/misc/keldagrim/dialogue/JorzikDialogue.kt +++ b/Server/src/main/content/region/misc/keldagrim/dialogue/JorzikDialogue.kt @@ -1,52 +1,46 @@ package content.region.misc.keldagrim.dialogue import core.game.dialogue.DialoguePlugin -import core.game.node.entity.npc.NPC import core.game.node.entity.player.Player import core.plugin.Initializable -import core.api.* +import core.game.dialogue.FacialExpression +import core.game.dialogue.Topic import core.tools.END_DIALOGUE +import core.tools.START_DIALOGUE +import org.rs09.consts.NPCs -const val JORZIK = 2565 - -/**Just some silly little dialogue for Jorzik hehe - * @author phil lips*/ +/** + * Jorzik dialogue. + * @author phil lips + */ @Initializable -class JorzikDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) { - - override fun open(vararg args: Any?): Boolean { - npc = args[0] as NPC - npc("Do you want to trade?") - stage = 0 - return true - } +class JorzikDialogue(player: Player? = null) : DialoguePlugin(player) { override fun handle(interfaceId: Int, buttonId: Int): Boolean { when(stage){ - 0 -> options("What are you selling?","No, thanks").also { stage = 10 } - 10 -> when(buttonId){ - 1 -> sendPlayerDialogue(player,"What are you selling?").also { stage = 15 } - 2 -> sendPlayerDialogue(player,"No, thanks.").also {stage = 50} - } - 15 -> sendNPCDialogue(player, JORZIK,"The finest smiths from all over Gielinor come here to work, and I buy the fruit of their craft. Armour made from the strongest metals!").also { stage = 20 } - 20 -> options("Lets have a look, then.","No, thanks").also { stage = 30 } - 30 -> when(buttonId){ - 1 -> sendPlayerDialogue(player,"Let's have a look, then.").also { stage = 40 } - 2 -> sendPlayerDialogue(player,"No, thanks.").also {stage = 50} - } - 40 -> end().also { npc.openShop(player) } - 50 ->sendNPCDialogue(player, JORZIK,"You just don't appreciate the beauty of fine metalwork.").also { stage = END_DIALOGUE } + START_DIALOGUE -> npc(FacialExpression.OLD_DEFAULT,"Do you want to trade?").also { stage++ } + 1 -> showTopics( + Topic(FacialExpression.FRIENDLY,"What are you selling?",2), + Topic(FacialExpression.FRIENDLY,"No, thanks.", 5) + ) + 2 -> npcl(FacialExpression.OLD_DEFAULT,"The finest smiths from all over Gielinor come here to work, and I buy the fruit of their craft. Armour made from the strongest metals!").also { stage++ } + 3 -> showTopics( + Topic(FacialExpression.FRIENDLY,"Let's have a look, then.",4), + Topic(FacialExpression.FRIENDLY,"No, thanks.", 5) + ) + 4 -> end().also { npc.openShop(player) } + 5 -> npcl(FacialExpression.OLD_DEFAULT,"You just don't appreciate the beauty of fine metalwork.").also { stage = END_DIALOGUE } } return true } - override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin { + override fun newInstance(player: Player?): DialoguePlugin { return JorzikDialogue(player) } override fun getIds(): IntArray { - return intArrayOf(JORZIK) + return intArrayOf(NPCs.JORZIK_2565) } } \ No newline at end of file diff --git a/Server/src/main/content/region/misc/keldagrim/dialogue/OrdanDialogue.kt b/Server/src/main/content/region/misc/keldagrim/dialogue/OrdanDialogue.kt index 567720bf3..f70248512 100644 --- a/Server/src/main/content/region/misc/keldagrim/dialogue/OrdanDialogue.kt +++ b/Server/src/main/content/region/misc/keldagrim/dialogue/OrdanDialogue.kt @@ -1,37 +1,29 @@ package content.region.misc.keldagrim.dialogue -import core.game.node.entity.npc.NPC import core.game.node.entity.player.Player import core.plugin.Initializable import core.api.* +import core.game.dialogue.FacialExpression import core.game.node.item.Item import org.rs09.consts.Items import org.rs09.consts.NPCs import core.game.interaction.InteractionListener import core.game.interaction.IntType import core.tools.END_DIALOGUE +import core.tools.START_DIALOGUE -/**It's just some simple Ordan dialogue - * don't look at the unnoting code if you care - * about your braincells - * @author phil lips*/ - -const val ORDAN = 2564 - +/** + * Ordan dialogue and unnoting. + * @author phil lips + */ @Initializable class OrdanDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) { - override fun open(vararg args: Any?): Boolean { - npc = args[0] as NPC - sendPlayerDialogue(player,"Can you un-note any of my items?") - stage = 0 - return true - } - override fun handle(interfaceId: Int, buttonId: Int): Boolean { when(stage){ - 0 -> sendNPCDialogue(player, ORDAN,"I can un-note Tin, Copper, Iron, Coal, and Mithril.").also { stage++ } - 1 -> sendNPCDialogue(player, ORDAN,"I can even un-note Adamantite and Runite, but you're gonna need deep pocktes for that.").also { stage = END_DIALOGUE } + START_DIALOGUE-> playerl(FacialExpression.FRIENDLY, "Can you un-note any of my items?").also { stage++ } + 1 -> npcl(FacialExpression.OLD_DEFAULT,"I can un-note Tin, Copper, Iron, Coal, and Mithril.").also { stage++ } + 2 -> npcl(FacialExpression.OLD_DEFAULT,"I can even un-note Adamantite and Runite, but you're gonna need deep pocktes for that.").also { stage = END_DIALOGUE } } return true } @@ -41,7 +33,7 @@ class OrdanDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin( } override fun getIds(): IntArray { - return intArrayOf(ORDAN) + return intArrayOf(NPCs.ORDAN_2564) } /**This is for unnoting ores from Ordan, yeah I know being able to unnote Addy and Rune isn't authentic @@ -74,7 +66,7 @@ class OrdanDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin( Items.RUNITE_ORE_452 to 1000 ) override fun defineListeners() { - onUseWith(IntType.NPC, NPCs.ORDAN_2564,*notedOre){ player, _, noteType -> + onUseWith(IntType.NPC, notedOre, NPCs.ORDAN_2564){ player, noteType, _ -> val noteAmount = amountInInventory(player, noteType.id) val noteName = noteType.name var unNoteAmount = 0