Implemented taxidermist

This commit is contained in:
GregF
2024-08-10 11:13:56 +00:00
committed by Ryan
parent 37836ae992
commit 209e1ae8cf
4 changed files with 182 additions and 112 deletions
+39 -36
View File
@@ -4243,8 +4243,8 @@
"tradeable": "false", "tradeable": "false",
"destroy": "true", "destroy": "true",
"archery_ticket_price": "0", "archery_ticket_price": "0",
"id": "456", "weight": "0.15",
"weight": "0.15" "id": "456"
}, },
{ {
"destroy_message": "You will need to speak to Thormac to get another cage.", "destroy_message": "You will need to speak to Thormac to get another cage.",
@@ -4254,8 +4254,8 @@
"tradeable": "false", "tradeable": "false",
"destroy": "true", "destroy": "true",
"archery_ticket_price": "0", "archery_ticket_price": "0",
"id": "457", "weight": "0.175",
"weight": "0.175" "id": "457"
}, },
{ {
"destroy_message": "You will need to speak to Thormac to get another cage.", "destroy_message": "You will need to speak to Thormac to get another cage.",
@@ -4265,8 +4265,8 @@
"tradeable": "false", "tradeable": "false",
"destroy": "true", "destroy": "true",
"archery_ticket_price": "0", "archery_ticket_price": "0",
"id": "458", "weight": "0.2",
"weight": "0.2" "id": "458"
}, },
{ {
"destroy_message": "You will need to speak to Thormac to get another cage.", "destroy_message": "You will need to speak to Thormac to get another cage.",
@@ -4276,8 +4276,8 @@
"tradeable": "false", "tradeable": "false",
"destroy": "true", "destroy": "true",
"archery_ticket_price": "0", "archery_ticket_price": "0",
"id": "459", "weight": "0.175",
"weight": "0.175" "id": "459"
}, },
{ {
"destroy_message": "You will need to speak to Thormac to get another cage.", "destroy_message": "You will need to speak to Thormac to get another cage.",
@@ -4287,8 +4287,8 @@
"tradeable": "false", "tradeable": "false",
"destroy": "true", "destroy": "true",
"archery_ticket_price": "0", "archery_ticket_price": "0",
"id": "460", "weight": "0.2",
"weight": "0.2" "id": "460"
}, },
{ {
"destroy_message": "You will need to speak to Thormac to get another cage.", "destroy_message": "You will need to speak to Thormac to get another cage.",
@@ -4298,8 +4298,8 @@
"tradeable": "false", "tradeable": "false",
"destroy": "true", "destroy": "true",
"archery_ticket_price": "0", "archery_ticket_price": "0",
"id": "461", "weight": "0.175",
"weight": "0.175" "id": "461"
}, },
{ {
"destroy_message": "You will need to speak to Thormac to get another cage.", "destroy_message": "You will need to speak to Thormac to get another cage.",
@@ -4309,8 +4309,8 @@
"tradeable": "false", "tradeable": "false",
"destroy": "true", "destroy": "true",
"archery_ticket_price": "0", "archery_ticket_price": "0",
"id": "462", "weight": "0.2",
"weight": "0.2" "id": "462"
}, },
{ {
"destroy_message": "You will need to speak to Thormac to get another cage.", "destroy_message": "You will need to speak to Thormac to get another cage.",
@@ -4320,8 +4320,8 @@
"tradeable": "false", "tradeable": "false",
"destroy": "true", "destroy": "true",
"archery_ticket_price": "0", "archery_ticket_price": "0",
"id": "463", "weight": "0.225",
"weight": "0.225" "id": "463"
}, },
{ {
"ge_buy_limit": "10000", "ge_buy_limit": "10000",
@@ -72394,6 +72394,7 @@
"id": "7973" "id": "7973"
}, },
{ {
"examine": "I should get it stuffed!",
"durability": null, "durability": null,
"name": "Crawling hand", "name": "Crawling hand",
"archery_ticket_price": "0", "archery_ticket_price": "0",
@@ -72458,6 +72459,7 @@
"id": "7981" "id": "7981"
}, },
{ {
"examine": "I could mount this on my wall!",
"durability": null, "durability": null,
"name": "Crawling hand", "name": "Crawling hand",
"archery_ticket_price": "0", "archery_ticket_price": "0",
@@ -72465,7 +72467,7 @@
"id": "7982" "id": "7982"
}, },
{ {
"examine": "I should get it stuffed!", "examine": "I could mount this on my wall!",
"durability": null, "durability": null,
"name": "Cockatrice head", "name": "Cockatrice head",
"tradeable": "false", "tradeable": "false",
@@ -72475,7 +72477,7 @@
"id": "7983" "id": "7983"
}, },
{ {
"examine": "I should get it stuffed!", "examine": "I could mount this on my wall!",
"durability": null, "durability": null,
"name": "Basilisk head", "name": "Basilisk head",
"tradeable": "false", "tradeable": "false",
@@ -72485,7 +72487,7 @@
"id": "7984" "id": "7984"
}, },
{ {
"examine": "I should get it stuffed!", "examine": "I could mount this on my wall!",
"durability": null, "durability": null,
"name": "Kurask head", "name": "Kurask head",
"tradeable": "false", "tradeable": "false",
@@ -72495,7 +72497,7 @@
"id": "7985" "id": "7985"
}, },
{ {
"examine": "I should get it stuffed!", "examine": "I could mount this on my wall!",
"durability": null, "durability": null,
"name": "Abyssal head", "name": "Abyssal head",
"tradeable": "false", "tradeable": "false",
@@ -72505,7 +72507,7 @@
"id": "7986" "id": "7986"
}, },
{ {
"examine": "I should get it stuffed!", "examine": "I could mount these on my wall!",
"durability": null, "durability": null,
"name": "Kbd heads", "name": "Kbd heads",
"tradeable": "false", "tradeable": "false",
@@ -72515,7 +72517,7 @@
"id": "7987" "id": "7987"
}, },
{ {
"examine": "I should get it stuffed!", "examine": "I could mount this on my wall!",
"durability": null, "durability": null,
"name": "Kq head", "name": "Kq head",
"archery_ticket_price": "0", "archery_ticket_price": "0",
@@ -72530,7 +72532,7 @@
"id": "7989" "id": "7989"
}, },
{ {
"examine": "Whopper! I should get this stuffed!", "examine": "I should mount this on my wall!",
"durability": null, "durability": null,
"name": "Big bass", "name": "Big bass",
"weight": "6", "weight": "6",
@@ -72545,14 +72547,14 @@
"id": "7991" "id": "7991"
}, },
{ {
"examine": "Whopper! I should get this stuffed!", "examine": "I should mount this on my wall!",
"durability": null, "durability": null,
"name": "Big swordfish", "name": "Big swordfish",
"archery_ticket_price": "0", "archery_ticket_price": "0",
"id": "7992" "id": "7992"
}, },
{ {
"examine": "Its a monster! I should get this stuffed!", "examine": "It's a monster! I should get this stuffed!",
"durability": null, "durability": null,
"name": "Big shark", "name": "Big shark",
"weight": "0.7", "weight": "0.7",
@@ -72560,7 +72562,7 @@
"id": "7993" "id": "7993"
}, },
{ {
"examine": "Its a monster! I should get this stuffed!", "examine": "I should mount this on my wall!",
"durability": null, "durability": null,
"name": "Big shark", "name": "Big shark",
"weight": "0.7", "weight": "0.7",
@@ -73289,6 +73291,7 @@
"id": "8248" "id": "8248"
}, },
{ {
"examine": "A trophy of a mighty slayer!",
"durability": null, "durability": null,
"name": "Crawling hand", "name": "Crawling hand",
"archery_ticket_price": "0", "archery_ticket_price": "0",
@@ -73296,7 +73299,7 @@
"id": "8260" "id": "8260"
}, },
{ {
"examine": "I should get it stuffed!", "examine": "A trophy of a mighty slayer!",
"durability": null, "durability": null,
"name": "Cockatrice head", "name": "Cockatrice head",
"tradeable": "false", "tradeable": "false",
@@ -73306,7 +73309,7 @@
"id": "8261" "id": "8261"
}, },
{ {
"examine": "I should get it stuffed!", "examine": "A trophy of a mighty slayer!",
"durability": null, "durability": null,
"name": "Basilisk head", "name": "Basilisk head",
"tradeable": "false", "tradeable": "false",
@@ -73316,7 +73319,7 @@
"id": "8262" "id": "8262"
}, },
{ {
"examine": "I should get it stuffed!", "examine": "A trophy of a mighty slayer!",
"durability": null, "durability": null,
"name": "Kurask head", "name": "Kurask head",
"tradeable": "false", "tradeable": "false",
@@ -73326,7 +73329,7 @@
"id": "8263" "id": "8263"
}, },
{ {
"examine": "I should get it stuffed!", "examine": "A trophy of a mighty slayer!!",
"durability": null, "durability": null,
"name": "Abyssal head", "name": "Abyssal head",
"tradeable": "false", "tradeable": "false",
@@ -73336,7 +73339,7 @@
"id": "8264" "id": "8264"
}, },
{ {
"examine": "I should get it stuffed!", "examine": "A trophy of a mighty dragon-slayer!",
"durability": null, "durability": null,
"name": "Kbd heads", "name": "Kbd heads",
"tradeable": "false", "tradeable": "false",
@@ -73346,7 +73349,7 @@
"id": "8265" "id": "8265"
}, },
{ {
"examine": "I should get it stuffed!", "examine": "A trophy of a mighty kalphite slayer!",
"durability": null, "durability": null,
"name": "Kq head", "name": "Kq head",
"archery_ticket_price": "0", "archery_ticket_price": "0",
@@ -77088,16 +77091,16 @@
"requirements": "{1,20}-{2,10}", "requirements": "{1,20}-{2,10}",
"ge_buy_limit": "10", "ge_buy_limit": "10",
"examine": "A magic cave horror mask.", "examine": "A magic cave horror mask.",
"grand_exchange_price": "989400",
"durability": null, "durability": null,
"rare_item": "true", "rare_item": "true",
"weight": "10",
"equipment_slot": "0",
"grand_exchange_price": "989400",
"name": "Black mask (10)", "name": "Black mask (10)",
"tradeable": "true", "tradeable": "true",
"weight": "10",
"archery_ticket_price": "0", "archery_ticket_price": "0",
"id": "8901", "id": "8901",
"bonuses": "0,0,0,-3,-1,9,10,8,-1,9,0,0,0,0,0", "bonuses": "0,0,0,-3,-1,9,10,8,-1,9,0,0,0,0,0"
"equipment_slot": "0"
}, },
{ {
"ge_buy_limit": "10", "ge_buy_limit": "10",
@@ -1,76 +0,0 @@
package content.region.morytania.canifis.dialogue;
import core.game.dialogue.DialoguePlugin;
import core.game.dialogue.FacialExpression;
import core.game.node.entity.npc.NPC;
import core.plugin.Initializable;
import core.game.node.entity.player.Player;
/**
* Handles the TaxidermistDialogue dialogue.
* @author 'Vexia
*/
@Initializable
public class TaxidermistDialogue extends DialoguePlugin {
public TaxidermistDialogue() {
}
public TaxidermistDialogue(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new TaxidermistDialogue(player);
}
@Override
public boolean open(Object... args) {
npc = (NPC) args[0];
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Oh, hello. Have you got something you want", "preserving?");
stage = 0;
return true;
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
interpreter.sendOptions("Select an Option", "Yes please", "Not right now");
stage = 1;
break;
case 1:
switch (buttonId) {
case 1:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Yes please.");
stage = 10;
break;
case 2:
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Not right now.");
stage = 20;
break;
}
break;
case 10:
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Give it to me to look at then.");
stage = 11;
break;
case 11:
end();
break;
case 20:
end();
break;
}
return true;
}
@Override
public int[] getIds() {
return new int[] { 4246 };
}
}
@@ -0,0 +1,43 @@
package content.region.morytania.canifis.dialogue
import core.game.dialogue.DialoguePlugin
import core.game.dialogue.FacialExpression
import core.game.dialogue.Topic
import core.game.node.entity.player.Player
import core.plugin.Initializable
import core.tools.END_DIALOGUE
import core.tools.START_DIALOGUE
import org.rs09.consts.NPCs
@Initializable
open class TaxidermistDialogue(player: Player? = null) : DialoguePlugin(player) {
companion object{
const val YES = 10
const val NO = 20
const val WHAT = 30
}
override fun open(vararg args: Any?): Boolean {
npcl(FacialExpression.HAPPY, "Oh, hello. Have you got something you want preserving?").also { stage++ }
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){
START_DIALOGUE + 1 -> showTopics(
Topic("Yes please.", YES),
Topic("Not right now.", NO),
Topic("What?", WHAT)
)
YES -> npcl(FacialExpression.HAPPY, "Give it to me to look at then.").also { stage = END_DIALOGUE }
NO -> npcl(FacialExpression.ANNOYED, "Well, you go kill things so I can stuff them, eh?").also { stage = END_DIALOGUE }
WHAT -> npcl(FacialExpression.NEUTRAL, " If you bring me a monster head or a very big fish, I can preserve it for you so you can mount it in your house.").also { stage++ }
WHAT + 1 -> npcl(FacialExpression.HAPPY, "I hear there are all sorts of exotic creatures in the Slayer Tower -- I'd like a chance to stuff one of them!").also { stage = END_DIALOGUE }
}
return true
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.TAXIDERMIST_4246)
}
}
@@ -0,0 +1,100 @@
package content.region.morytania.canifis.handlers
import content.region.morytania.canifis.dialogue.TaxidermistDialogue
import core.api.*
import core.game.dialogue.DialogueFile
import core.game.dialogue.FacialExpression
import core.game.dialogue.Topic
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.game.node.item.Item
import core.tools.END_DIALOGUE
import core.tools.START_DIALOGUE
import org.rs09.consts.Items
import org.rs09.consts.NPCs
class TaxidermistInteraction : InteractionListener {
enum class StuffableItem(val toStuff : Int, val product : Int, val message : String, val cost : Int){
BASS(Items.BIG_BASS_7989, Items.BIG_BASS_7990, "That's a mighty fine sea bass you've caught there.", 1000),
SWORDFISH(Items.BIG_SWORDFISH_7991, Items.BIG_SWORDFISH_7992, "Don't point that thing at me!", 2500),
SHARK(Items.BIG_SHARK_7993,Items.BIG_SHARK_7994, "That's quite a fearsome shark! You've done everyone a service by removing it from the sea!", 5000),
CRAWLING_HAND(Items.CRAWLING_HAND_7975,Items.CRAWLING_HAND_7982, "That's a very fine crawling hand.", 1000),
COCKATRICE(Items.COCKATRICE_HEAD_7976, Items.COCKATRICE_HEAD_7983, "A cockatrice! Beautiful, isn't it? Look at the plumage!", 2000),
BASILISK( Items.BASILISK_HEAD_7977, Items.BASILISK_HEAD_7984, "My, he's a scary-looking fellow, isn't he? He'll look good on your wall!",4000),
KURASK(Items.KURASK_HEAD_7978, Items.KURASK_HEAD_7985, "A kurask? Splendid! Look at those horns!", 6000),
ABYSSAL(Items.ABYSSAL_HEAD_7979, Items.ABYSSAL_HEAD_7986, "Goodness, an abyssal demon!", 12000),
KBD(Items.KBD_HEADS_7980, Items.KBD_HEADS_7987, " This must be a King Black Dragon!", 50000),
KQ(Items.KQ_HEAD_7981, Items.KQ_HEAD_7988, " That must be the biggest kalphite I've ever seen!", 50000)
}
class TaxidermistTradeDialogue : DialogueFile() {
companion object{
const val TRADE = 10
const val YES = 20
const val NO = 30
const val POOR = 40
}
lateinit var stuffableItem : StuffableItem
override fun handle(componentID: Int, buttonID: Int) {
when (stage) {
START_DIALOGUE -> npcl(FacialExpression.HAPPY, stuffableItem.message).also {
stage = when(stuffableItem){
StuffableItem.ABYSSAL -> stage + 1
StuffableItem.KBD -> stage + 2
StuffableItem.KQ -> stage + 3
else -> TRADE
}
}
START_DIALOGUE + 1 -> npcl(FacialExpression.HAPPY, "See how it's still glowing? I'll have to use some magic to preserve that.").also { stage = TRADE }
START_DIALOGUE + 2 -> npcl(FacialExpression.HAPPY, "I'll have to get out my heavy duty tools -- this skin's as tough as iron!").also { stage = TRADE }
START_DIALOGUE + 3 -> npcl(FacialExpression.HAPPY, "Preserving insects is always tricky. I'll have to be careful...").also { stage = TRADE }
TRADE -> npcl(FacialExpression.HAPPY, "I can preserve that for you for ${stuffableItem.cost} coins.").also { stage++ }
TRADE + 1 -> showTopics(
Topic("Yes please.", YES),
Topic("No thanks.", NO)
)
YES -> {
if (inInventory(player!!, Items.COINS_995, stuffableItem.cost)){
if (removeItem(player!!, stuffableItem.toStuff) && removeItem(player!!, Item(Items.COINS_995, stuffableItem.cost))){
addItem(player!!, stuffableItem.product)
npcl(FacialExpression.HAPPY, "There you go!").also { stage = END_DIALOGUE }
}
}
else {
playerl(FacialExpression.SAD, "But I don't have enough money on me.").also { stage = POOR }
}
}
POOR -> npcl(FacialExpression.ANNOYED, "Don't waste my time, then!").also { stage = END_DIALOGUE }
NO -> npcl(FacialExpression.NEUTRAL, "All right, come back if you change your mind, eh?").also { stage = END_DIALOGUE }
}
}
}
override fun defineListeners() {
onUseAnyWith(IntType.NPC, NPCs.TAXIDERMIST_4246) { player, used, with ->
val item = used.id
StuffableItem.values().map { if(it.toStuff == item){
val dialogueFile = TaxidermistTradeDialogue()
dialogueFile.stuffableItem = it
openDialogue(player, dialogueFile, with as NPC)
return@onUseAnyWith true
}
}
when (item) {
// all fish
Items.RAW_CHICKEN_2138 -> sendNPCDialogue(player, with.id, "Killing a chicken is hardly worth boasting about!")
else -> sendNPCDialogue(player, with.id, "Don't be silly, I can't preserve that!")
}
return@onUseAnyWith true
}
}
}