diff --git a/Server/src/main/content/global/skill/construction/decoration/workshop/EaselListeners.kt b/Server/src/main/content/global/skill/construction/decoration/workshop/EaselListeners.kt index fc8167d8d..e95eef913 100644 --- a/Server/src/main/content/global/skill/construction/decoration/workshop/EaselListeners.kt +++ b/Server/src/main/content/global/skill/construction/decoration/workshop/EaselListeners.kt @@ -7,11 +7,12 @@ import core.api.* import core.game.interaction.InteractionListener import core.game.node.entity.player.Player import core.game.node.entity.skill.Skills +import org.rs09.consts.Animations import org.rs09.consts.Items import org.rs09.consts.Scenery /** - * Listens for use of the easel furniture pieces in a POH, with which players may make heraldic items. + * Handles easel type furniture in a POH, with which players may make heraldic items. * @author Bishop */ @@ -22,27 +23,19 @@ class EaselListener : InteractionListener { Scenery.PAINTING_STAND_13717, Scenery.BANNER_MAKING_STAND_13718 ) - private val buttonsToProducts = mapOf( - 2 to HeraldicProduct.STEEL_HELM, - 3 to HeraldicProduct.RUNE_HELM, - 4 to HeraldicProduct.STEEL_SHIELD, - 5 to HeraldicProduct.RUNE_SHIELD, - 6 to HeraldicProduct.BANNER - ) - private val heraldryAnimation = 3654 private fun checkRequirements(player: Player, product: HeraldicProduct) : Boolean { when { - (!getAttribute(player, SirReniteeDialogueFile.attributeCrest, false) || player.houseManager.crest == CrestType.NULL) -> { + (!getAttribute(player, SirReniteeDialogueFile.ATTRIBUTE_CREST, false) || player.houseManager.crest == CrestType.NULL) -> { sendDialogue(player, "You need a crest to make heraldic items.") // Placeholder return false } (!inInventory(player, product.primaryMaterialId)) -> { - sendDialogue(player, "You need a ${product.primaryMaterialId.asItem().name.toLowerCase()} to make this.") + sendDialogue(player, "You need a ${product.primaryMaterialId.asItem().name.lowercase()} to make this.") return false } (product.secondaryMaterialId != null && !inInventory(player, product.secondaryMaterialId)) -> { - sendDialogue(player, "You need a ${product.secondaryMaterialId.asItem().name.toLowerCase()} to make this.") + sendDialogue(player, "You need a ${product.secondaryMaterialId.asItem().name.lowercase()} to make this.") return false } (!hasLevelDyn(player, Skills.CONSTRUCTION, product.constructionReq)) -> { @@ -65,7 +58,7 @@ class EaselListener : InteractionListener { if (product.secondaryMaterialId == null || removeItem(player, product.secondaryMaterialId)) { addItemOrDrop(player, product.productForCrest(crest)) rewardXP(player, Skills.CRAFTING, product.craftingXp) - animate(player, heraldryAnimation) + animate(player, Animations.HUMAN_CRAFT_POH_CREST_3654) when (product) { HeraldicProduct.STEEL_HELM, HeraldicProduct.RUNE_HELM -> sendMessage(player, "You make a helmet in your colours.") @@ -90,6 +83,13 @@ class EaselListener : InteractionListener { else -> return@on false } + val buttonsToProducts = mapOf( + 2 to HeraldicProduct.STEEL_HELM, + 3 to HeraldicProduct.RUNE_HELM, + 4 to HeraldicProduct.STEEL_SHIELD, + 5 to HeraldicProduct.RUNE_SHIELD, + 6 to HeraldicProduct.BANNER + ) sendDialogueOptions(player, "What do you want to make?", *options) addDialogueAction(player) { player, button -> if (checkRequirements(player, buttonsToProducts[button] ?: return@addDialogueAction)) { @@ -99,6 +99,7 @@ class EaselListener : InteractionListener { } return@on true } + onUseWith(SCENERY, Items.BOLT_OF_CLOTH_8790, Scenery.BANNER_MAKING_STAND_13718) { player, _, _ -> if (checkRequirements(player, HeraldicProduct.BANNER)) { giveProduct(player, HeraldicProduct.BANNER) @@ -106,4 +107,5 @@ class EaselListener : InteractionListener { return@onUseWith true } } + } \ No newline at end of file diff --git a/Server/src/main/content/region/asgarnia/falador/dialogue/SirReniteeDialogue.kt b/Server/src/main/content/region/asgarnia/falador/dialogue/SirReniteeDialogue.kt index 06440bdc7..4103a82dd 100644 --- a/Server/src/main/content/region/asgarnia/falador/dialogue/SirReniteeDialogue.kt +++ b/Server/src/main/content/region/asgarnia/falador/dialogue/SirReniteeDialogue.kt @@ -37,15 +37,15 @@ class SirReniteeDialogue : InteractionListener { class SirReniteeDialogueFile : DialogueLabeller() { companion object { - const val attributeCrest = "/save:sir-renitee-assigned-crest" - const val attributeTempCrest = "sir-renitee-temp-crest" - const val attributeTempPainting = "sir-renitee-temp-painting" + const val ATTRIBUTE_CREST = "/save:sir-renitee-assigned-crest" + private const val ATTRIBUTE_CREST_TEMP = "sir-renitee-temp-crest" + private const val ATTRIBUTE_PAINTING_TEMP = "sir-renitee-temp-painting" } private fun selectCrest(crestType: CrestType, labelName: String) { label(labelName) exec { player, _ -> - setAttribute(player, attributeTempCrest, crestType) + setAttribute(player, ATTRIBUTE_CREST_TEMP, crestType) loadLabel(player, "crest_buy") } } @@ -53,7 +53,7 @@ class SirReniteeDialogueFile : DialogueLabeller() { private fun selectPainting(painting: PaintingType, labelName: String) { label(labelName) exec { player, _ -> - setAttribute(player, attributeTempPainting, painting) + setAttribute(player, ATTRIBUTE_PAINTING_TEMP, painting) loadLabel(player, "painting_buy") } } @@ -107,12 +107,12 @@ class SirReniteeDialogueFile : DialogueLabeller() { label("has_construction_level") exec { player, _ -> - if (getAttribute(player, attributeCrest, false)) { + if (getAttribute(player, ATTRIBUTE_CREST, false)) { loadLabel(player, "show_existing_crest") } else { val crests = arrayOf(CrestType.VARROCK, CrestType.ASGARNIA, CrestType.KANDARIN, CrestType.MISTHALIN) player.houseManager.crest = crests[RandomFunction.random(4)] - setAttribute(player, attributeCrest, true) + setAttribute(player, ATTRIBUTE_CREST, true) loadLabel(player, "show_new_crest") } if (!player.achievementDiaryManager.getDiary(DiaryType.FALADOR).isComplete(0, 4)) { @@ -214,7 +214,7 @@ class SirReniteeDialogueFile : DialogueLabeller() { label("crest_buy") exec { player, _ -> - val crest = getAttribute(player, attributeTempCrest, CrestType.ASGARNIA) + val crest = getAttribute(player, ATTRIBUTE_CREST_TEMP, CrestType.ASGARNIA) if (crest.eligible(player) && removeItem(player, Item(Items.COINS_995, crest.cost))) { player.houseManager.crest = crest if (crest == CrestType.SARADOMIN && !player.achievementDiaryManager.getDiary(DiaryType.FALADOR).isComplete(2, 1)) { @@ -228,7 +228,7 @@ class SirReniteeDialogueFile : DialogueLabeller() { label("crest_buy_ok") manual { player, _ -> - val crest = getAttribute(player, attributeTempCrest, CrestType.ASGARNIA) + val crest = getAttribute(player, ATTRIBUTE_CREST_TEMP, CrestType.ASGARNIA) val expression = if (crest == CrestType.SKULL) { ChatAnim.AFRAID } else { @@ -283,7 +283,7 @@ class SirReniteeDialogueFile : DialogueLabeller() { label("crest_buy_fail") manual { player, _ -> - val crest = getAttribute(player, attributeTempCrest, CrestType.ASGARNIA) + val crest = getAttribute(player, ATTRIBUTE_CREST_TEMP, CrestType.ASGARNIA) val messages = when (crest) { CrestType.ARRAV -> arrayOf("But that legendary shield is still lost! I don't think", @@ -412,7 +412,7 @@ class SirReniteeDialogueFile : DialogueLabeller() { label("painting_buy") exec { player, _ -> - val painting = getAttribute(player, attributeTempPainting, PaintingType.MAP_SMALL) + val painting = getAttribute(player, ATTRIBUTE_PAINTING_TEMP, PaintingType.MAP_SMALL) if (painting.eligible(player)) { loadLabel(player, "painting_show_cost") } else { @@ -422,11 +422,11 @@ class SirReniteeDialogueFile : DialogueLabeller() { label("painting_show_cost") manual { player, _ -> - val painting = getAttribute(player, attributeTempPainting, PaintingType.MAP_SMALL) + val painting = getAttribute(player, ATTRIBUTE_PAINTING_TEMP, PaintingType.MAP_SMALL) interpreter!!.sendDialogues(npc, ChatAnim.NEUTRAL, "That will be, mmm, ${painting.cost} coins please.") } exec { player, _ -> - val painting = getAttribute(player, attributeTempPainting, PaintingType.MAP_SMALL) + val painting = getAttribute(player, ATTRIBUTE_PAINTING_TEMP, PaintingType.MAP_SMALL) if (inInventory(player, Items.COINS_995, painting.cost)) { loadLabel(player, "painting_buy_confirm") } else { @@ -442,7 +442,7 @@ class SirReniteeDialogueFile : DialogueLabeller() { label("painting_buy_fail") manual { player, _ -> - val painting = getAttribute(player, attributeTempPainting, PaintingType.MAP_SMALL) + val painting = getAttribute(player, ATTRIBUTE_PAINTING_TEMP, PaintingType.MAP_SMALL) val messages = when (painting) { PaintingType.ARTHUR -> arrayOf("Do you have, mmm, a connection with King Arthur? He", @@ -480,7 +480,7 @@ class SirReniteeDialogueFile : DialogueLabeller() { interpreter!!.sendDialogues(npc, ChatAnim.NEUTRAL, *messages) } manual { player, _ -> - val painting = getAttribute(player, attributeTempPainting, PaintingType.MAP_SMALL) + val painting = getAttribute(player, ATTRIBUTE_PAINTING_TEMP, PaintingType.MAP_SMALL) val messages = when (painting) { PaintingType.ARTHUR -> arrayOf("To buy the portrait of King Arthur you must have", @@ -524,7 +524,7 @@ class SirReniteeDialogueFile : DialogueLabeller() { label("painting_accept") exec { player, _ -> - val painting = getAttribute(player, attributeTempPainting, PaintingType.MAP_SMALL) + val painting = getAttribute(player, ATTRIBUTE_PAINTING_TEMP, PaintingType.MAP_SMALL) if (removeItem(player, Item(Items.COINS_995, painting.cost))) { addItemOrDrop(player, painting.paintingId) } @@ -544,5 +544,7 @@ class SirReniteeDialogueFile : DialogueLabeller() { DialogueOption("map", "Yes - a map", "A map please.", expression = ChatAnim.NEUTRAL), DialogueOption("nothing", "No, thanks.", expression = ChatAnim.NEUTRAL), ) + } + } \ No newline at end of file