Crafting guild no longer gives "welcome" messages on leave
Refactored crafting guild
This commit is contained in:
+47
@@ -0,0 +1,47 @@
|
||||
package rs09.game.content.activity.guild.crafting
|
||||
|
||||
import api.*
|
||||
import core.game.content.global.action.DoorActionHandler
|
||||
import core.game.node.entity.skill.Skills
|
||||
import core.game.world.map.Location
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.Scenery
|
||||
import rs09.game.content.dialogue.region.craftingguild.TheDoorDialogues
|
||||
import rs09.game.interaction.InteractionListener
|
||||
|
||||
/**
|
||||
* @author bushtail
|
||||
*/
|
||||
|
||||
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
|
||||
|
||||
override fun defineListeners() {
|
||||
on(GUILD_DOOR, 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))
|
||||
DoorActionHandler.handleAutowalkDoor(player, door.asScenery())
|
||||
return@on true
|
||||
} else if (inEquipment(player, CAPE)) {
|
||||
openDialogue(player, TheDoorDialogues(0))
|
||||
DoorActionHandler.handleAutowalkDoor(player, door.asScenery())
|
||||
return@on true
|
||||
} else {
|
||||
openDialogue(player, TheDoorDialogues(1))
|
||||
return@on false
|
||||
}
|
||||
} else {
|
||||
openDialogue(player, TheDoorDialogues(2))
|
||||
return@on false
|
||||
}
|
||||
} else {
|
||||
DoorActionHandler.handleAutowalkDoor(player, door.asScenery())
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
package rs09.game.content.dialogue.region.craftingguild
|
||||
|
||||
import api.*
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.npc.NPC
|
||||
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
|
||||
import rs09.tools.END_DIALOGUE
|
||||
|
||||
/**
|
||||
* @author bushtail
|
||||
*/
|
||||
|
||||
@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 {
|
||||
return MasterCrafterDialogue(player)
|
||||
}
|
||||
|
||||
override fun open(vararg args: Any?) : Boolean {
|
||||
npc = args[0] as NPC
|
||||
stage = 0
|
||||
return true
|
||||
}
|
||||
|
||||
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++ }
|
||||
}
|
||||
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 }
|
||||
}
|
||||
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 }
|
||||
}
|
||||
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 {
|
||||
return intArrayOf(NPCs.MASTER_CRAFTER_805)
|
||||
}
|
||||
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
package rs09.game.content.dialogue.region.craftingguild
|
||||
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.tools.END_DIALOGUE
|
||||
|
||||
/**
|
||||
* @author bushtail
|
||||
*/
|
||||
|
||||
@Initializable
|
||||
class TannerDialogue(player: Player? = null) : DialoguePlugin(player) {
|
||||
|
||||
override fun newInstance(player: Player) : DialoguePlugin {
|
||||
return TannerDialogue(player)
|
||||
}
|
||||
|
||||
override fun open(vararg args: Any?) : Boolean {
|
||||
npc = args[0] as NPC
|
||||
npcl(FacialExpression.NEUTRAL, "Greetings friend. I am a manufacturer of leather.")
|
||||
stage = 0
|
||||
return true
|
||||
}
|
||||
|
||||
override fun handle(interfaceId: Int, buttonId: Int) : Boolean {
|
||||
when(stage) {
|
||||
0 -> options("Can I buy some leather then?", "Leather is rather weak stuff.").also{ stage++ }
|
||||
1 -> when(buttonId) {
|
||||
1 -> player(FacialExpression.ASKING,"Can I buy some leather then?").also{ stage = 10 }
|
||||
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) }
|
||||
|
||||
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 " +
|
||||
"to craft, but I only charge 3 gp per cowhide to prepare it, and it makes much sturdier armour.").also{ stage++ }
|
||||
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 }
|
||||
}
|
||||
return true
|
||||
}
|
||||
override fun getIds() : IntArray {
|
||||
return intArrayOf(NPCs.TANNER_804)
|
||||
}
|
||||
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package rs09.game.content.dialogue.region.craftingguild
|
||||
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.npc.NPC
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.game.content.dialogue.DialogueFile
|
||||
import rs09.tools.END_DIALOGUE
|
||||
|
||||
/**
|
||||
* @author bushtail
|
||||
*/
|
||||
|
||||
class TheDoorDialogues(val it: Int) : DialogueFile() {
|
||||
override fun handle(interfaceId: Int, buttonId: Int) {
|
||||
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 }
|
||||
}
|
||||
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++ }
|
||||
1 -> player(FacialExpression.SAD, "Err... I haven't got one.").also { stage = END_DIALOGUE }
|
||||
}
|
||||
2 -> when(stage) {
|
||||
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 }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+4
-1
@@ -10,10 +10,13 @@ import core.game.world.map.Location
|
||||
import core.plugin.Initializable
|
||||
import rs09.tools.END_DIALOGUE
|
||||
|
||||
/**
|
||||
* @author bushtail
|
||||
*/
|
||||
@Initializable
|
||||
class ZandarHorfyreDialogue(player: Player? = null) : DialoguePlugin(player) {
|
||||
|
||||
override fun newInstance(player: Player): DialoguePlugin {
|
||||
override fun newInstance(player: Player) : DialoguePlugin {
|
||||
return ZandarHorfyreDialogue(player)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user