Fixed crafting guild tanning interface

Rewrote master crafter dialogue
Added missing master crafter dialogues
Fixed issue preventing crafting guild entry with trimmed crafting cape
This commit is contained in:
Bonesy 2024-03-17 08:59:11 +00:00 committed by Ryan
parent a1fc0ba7cc
commit b8a887b319
6 changed files with 185 additions and 44 deletions

View file

@ -0,0 +1,29 @@
package content.region.asgarnia.dialogue
import core.game.dialogue.DialoguePlugin
import core.game.dialogue.FacialExpression
import core.game.node.entity.player.Player
import core.plugin.Initializable
import core.tools.END_DIALOGUE
import org.rs09.consts.NPCs
@Initializable
class CapelessMasterCrafterDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun newInstance(player: Player): DialoguePlugin {
return CapelessMasterCrafterDialogue(player)
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
npcl(
FacialExpression.FRIENDLY,
"Hello, and welcome to the Crafting Guild. Accomplished crafters from all " +
"over the land come here to use our top notch workshops."
).also { stage = END_DIALOGUE }
return true
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.MASTER_CRAFTER_2732)
}
}

View file

@ -3,10 +3,9 @@ package content.region.asgarnia.dialogue
import core.api.*
import core.game.dialogue.DialoguePlugin
import core.game.dialogue.FacialExpression
import core.game.node.entity.npc.NPC
import core.game.global.Skillcape
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import core.game.node.item.Item
import core.plugin.Initializable
import org.rs09.consts.Items
import org.rs09.consts.NPCs
@ -19,44 +18,94 @@ import core.tools.END_DIALOGUE
@Initializable
class MasterCrafterDialogue(player: Player? = null) : DialoguePlugin(player) {
var CAPE = Items.CRAFTING_CAPE_9780
var COIN = Items.COINS_995
override fun newInstance(player: Player) : DialoguePlugin {
override fun newInstance(player: Player): DialoguePlugin {
return MasterCrafterDialogue(player)
}
override fun handle(interfaceId: Int, buttonId: Int) : Boolean {
when(stage) {
0 -> if(hasLevelStat(player, Skills.CRAFTING, 99)) {
player(FacialExpression.ASKING, "Hey, could I buy a Skillcape of Crafting?").also{ stage = 10 }
} else {
player(FacialExpression.ASKING,"Hey, what is that cape you're wearing? I don't recognize it.").also { stage++ }
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when (stage) {
0 -> npcl(
FacialExpression.FRIENDLY,
"Hello, and welcome to the Crafting Guild. Accomplished crafters from all " +
"over the land come here to use our top notch workshops."
).also { stage++ }
1 -> {
if (Skillcape.isMaster(player, Skills.CRAFTING)) {
playerl(
FacialExpression.ASKING,
"Are you the person I need to talk to about buying a Skillcape of Crafting?"
).also { stage = 100 }
} else {
end()
}
}
1 -> npcl(FacialExpression.FRIENDLY, "This? This is a Skillcape of Crafting. It is a symbol of my ability " +
"and standing here in the Crafting Guild. If you should ever achieve level 99 Crafting come and talk to me " +
"and we'll see if we can sort you out with one.").also{ stage = END_DIALOGUE }
10 -> npcl(FacialExpression.HAPPY, "Certainly! Right after you pay me 99000 coins.").also{ stage++ }
11 -> options("Okay, here you go.", "No thanks.").also{ stage++ }
12 -> when(buttonId) {
1 -> player(FacialExpression.FRIENDLY, "Okay, here you go.").also{ stage++ }
2 -> player(FacialExpression.HALF_THINKING, "No, thanks.").also{ stage = END_DIALOGUE }
100 -> npcl(
FacialExpression.FRIENDLY,
"I certainly am, and I can see that you are definitely talented enough to own one! " +
"Unfortunately, being such a prestigious item, they are appropriately expensive. " +
"I'm afraid I must ask you for 99000 gold."
).also { stage++ }
101 -> options(
"99000 gold! Are you mad?", "That's fine."
).also { stage++ }
102 -> {
when (buttonId) {
1 -> playerl(
FacialExpression.ASKING,
"99000 gold! Are you mad?"
).also { stage++ }
2 -> {
when {
!inInventory(player, Items.COINS_995, 99000) -> playerl(
FacialExpression.NEUTRAL,
"But, unfortunately, I don't have enough money with me."
).also { stage = 111 }
freeSlots(player) < 2 -> npcl(
FacialExpression.FRIENDLY,
"Unfortunately all Skillcapes are only available with a free hood, it's part " +
"of a skill promotion deal; buy one get one free, you know. So you'll need " +
"to free up some inventory space before I can sell you one."
).also { stage = END_DIALOGUE }
else -> playerl(
FacialExpression.FRIENDLY,
"That's fine."
).also { stage = 112 }
}
}
}
}
13 -> if(inInventory(player, COIN, 99000)) {
removeItem(player, Item(COIN, 99000), Container.INVENTORY)
addItem(player, CAPE, 1)
npcl(FacialExpression.HAPPY, "There you go! Enjoy.").also{ stage = END_DIALOGUE }
} else {
npcl(FacialExpression.NEUTRAL, "You don't have enough coins for a cape.").also{ stage = END_DIALOGUE }
103 -> npcl(
FacialExpression.FRIENDLY,
"Not at all; there are many other adventurers who would love the opportunity to purchase " +
"such a prestigious item! You can find me here if you change your mind."
).also { stage = END_DIALOGUE }
111 -> npcl(
FacialExpression.FRIENDLY,
"Well, come back and see me when you do."
).also { stage = END_DIALOGUE }
112 -> {
Skillcape.purchase(player, Skills.CRAFTING)
npcl(
FacialExpression.FRIENDLY,
"Excellent! Wear that cape with pride my friend."
).also { stage = END_DIALOGUE }
}
20 -> npcl(FacialExpression.NEUTRAL, "Where's your brown apron? You can't come in here unless you're wearing one.").also{ stage++ }
21 -> player(FacialExpression.HALF_GUILTY, "Err... I haven't got one.").also{ stage = END_DIALOGUE }
}
return true
}
override fun getIds() : IntArray {
override fun getIds(): IntArray {
return intArrayOf(NPCs.MASTER_CRAFTER_805)
}
}

View file

@ -1,5 +1,6 @@
package content.region.asgarnia.dialogue
import content.global.skill.crafting.TanningProduct
import core.game.dialogue.DialoguePlugin
import core.game.dialogue.FacialExpression
import core.game.node.entity.npc.NPC
@ -34,8 +35,7 @@ class TannerDialogue(player: Player? = null) : DialoguePlugin(player) {
2 -> player(FacialExpression.SUSPICIOUS, "Leather is rather weak stuff.").also { stage = 20 }
}
10 -> npcl(FacialExpression.FRIENDLY, "Certainly!").also { stage = END_DIALOGUE }.also{ npc.openShop(player) }
10 -> npcl(FacialExpression.FRIENDLY, "Certainly!").also { stage = 30 }
20 -> npcl(FacialExpression.NOD_YES, "Normal leather may be quite weak, but it's very cheap - I " +
"make it from cowhides for only 1 gp per hide - and it's so easy to craft that anyone can work with it.").also{ stage++ }
21 -> npcl(FacialExpression.HALF_THINKING, "Alternatively you could try hard leather. It's not so easy " +
@ -43,6 +43,10 @@ class TannerDialogue(player: Player? = null) : DialoguePlugin(player) {
22 -> npcl(FacialExpression.FRIENDLY, "I can also tan snake hides and dragonhides, suitable for crafting" +
"into the highest quality armour for rangers.").also{ stage++ }
23 -> player(FacialExpression.NEUTRAL, "Thanks, I'll bear it in mind.").also { stage = END_DIALOGUE }
30 -> {
end()
TanningProduct.open(player, npc.id)
}
}
return true
}

View file

@ -15,7 +15,7 @@ class TheDoorDialogues(val it: Int) : DialogueFile() {
npc = NPC(NPCs.MASTER_CRAFTER_805)
when(it) {
0 -> when(stage) {
0 -> npcl(FacialExpression.FRIENDLY, "Welcome to the Guild of Master craftsmen.").also{ stage = END_DIALOGUE }
0 -> npcl(FacialExpression.FRIENDLY, "Welcome to the Guild of Master Craftsmen.").also{ stage = END_DIALOGUE }
}
1 -> when(stage) {
0 -> npcl(FacialExpression.ASKING, "Where's your brown apron? You can't come in here unless you're wearing one.").also{ stage++ }
@ -25,8 +25,5 @@ class TheDoorDialogues(val it: Int) : DialogueFile() {
0 -> npcl(FacialExpression.NEUTRAL, "Sorry, only experienced crafters are allowed in here. You must be level 40 or above to enter.").also{ stage = END_DIALOGUE }
}
}
}
}

View file

@ -0,0 +1,60 @@
package content.region.asgarnia.dialogue
import core.game.dialogue.DialoguePlugin
import core.game.dialogue.FacialExpression
import core.game.node.entity.player.Player
import core.plugin.Initializable
import core.tools.END_DIALOGUE
import org.rs09.consts.NPCs
@Initializable
class YoungMasterCrafterDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun newInstance(player: Player): DialoguePlugin {
return YoungMasterCrafterDialogue(player)
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when (stage) {
0 -> npcl(
FacialExpression.HALF_ASKING,
"Yeah?"
).also { stage++ }
1 -> playerl(
FacialExpression.FRIENDLY,
"Hello."
).also { stage++ }
2 -> npcl(
FacialExpression.HALF_ASKING,
"Whassup?"
).also { stage++ }
3 -> playerl(
FacialExpression.NEUTRAL,
"So... are you here to give crafting tips?"
).also { stage++ }
4 -> npcl(
FacialExpression.ANNOYED,
"Dude, do I look like I wanna talk to you?"
).also { stage++ }
5 -> playerl(
FacialExpression.NEUTRAL,
"I suppose not."
).also { stage++ }
6 -> npcl(
FacialExpression.NEUTRAL,
"Right on!"
).also { stage = END_DIALOGUE }
}
return true
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.MASTER_CRAFTER_2733)
}
}

View file

@ -1,5 +1,6 @@
package content.region.asgarnia.handlers
import content.global.skill.crafting.TanningProduct
import core.api.*
import core.game.node.entity.skill.Skills
import core.game.world.map.Location
@ -8,6 +9,7 @@ import org.rs09.consts.Scenery
import content.region.asgarnia.dialogue.TheDoorDialogues
import core.game.interaction.InteractionListener
import core.game.interaction.IntType
import org.rs09.consts.NPCs
/**
* @author bushtail
@ -15,18 +17,13 @@ import core.game.interaction.IntType
class CraftingGuildListeners : InteractionListener {
private val GUILD_DOOR = Scenery.GUILD_DOOR_2647
private val APRON = Items.BROWN_APRON_1757
private val CAPE = Items.CRAFTING_CAPE_9780
private val REQUIRED_ITEMS = intArrayOf(Items.BROWN_APRON_1757, Items.CRAFTING_CAPE_9780, Items.CRAFTING_CAPET_9781)
override fun defineListeners() {
on(GUILD_DOOR, IntType.SCENERY, "open") { player, door ->
if (player.location == Location.create(2933, 3289, 0)) {
if (hasLevelStat(player, Skills.CRAFTING, 40)) {
if (inEquipment(player, APRON)) {
openDialogue(player, TheDoorDialogues(0))
core.game.global.action.DoorActionHandler.handleAutowalkDoor(player, door.asScenery())
return@on true
} else if (inEquipment(player, CAPE)) {
if (anyInEquipment(player, *REQUIRED_ITEMS)) {
openDialogue(player, TheDoorDialogues(0))
core.game.global.action.DoorActionHandler.handleAutowalkDoor(player, door.asScenery())
return@on true
@ -43,5 +40,10 @@ class CraftingGuildListeners : InteractionListener {
return@on true
}
}
on(NPCs.TANNER_804, IntType.NPC, "trade") { player, node ->
TanningProduct.open(player, node.id)
return@on true
}
}
}
}