mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-01 14:39:13 -06:00
Leprechauns now properly explain why they can't note your items
This commit is contained in:
parent
4c2188aab5
commit
685157543b
1 changed files with 16 additions and 13 deletions
|
|
@ -12,26 +12,29 @@ class LeprechaunNoter : InteractionListener {
|
|||
val LEPRECHAUNS = intArrayOf(NPCs.TOOL_LEPRECHAUN_3021,NPCs.GOTH_LEPRECHAUN_8000,NPCs.TOOL_LEPRECHAUN_4965,NPCs.TECLYN_2861)
|
||||
|
||||
override fun defineListeners() {
|
||||
onUseWith(IntType.NPC,CROPS,*LEPRECHAUNS){ player, used, with ->
|
||||
onUseAnyWith(IntType.NPC,*LEPRECHAUNS) { player, used, with ->
|
||||
val usedItem = used.asItem()
|
||||
val npc = with.asNpc()
|
||||
val expr = when(npc.id){
|
||||
3021 -> core.game.dialogue.FacialExpression.OLD_NORMAL
|
||||
NPCs.TOOL_LEPRECHAUN_3021 -> core.game.dialogue.FacialExpression.OLD_NORMAL
|
||||
else -> core.game.dialogue.FacialExpression.FRIENDLY
|
||||
}
|
||||
|
||||
if(usedItem.noteChange != usedItem.id){
|
||||
val amt = player.inventory.getAmount(usedItem.id)
|
||||
if(player.inventory.remove(Item(usedItem.id,amt))){
|
||||
player.inventory.add(Item(usedItem.noteChange,amt))
|
||||
when {
|
||||
(!usedItem.definition.isUnnoted) -> { // If the item is a banknote
|
||||
player.dialogueInterpreter.sendDialogues(npc.id,expr,"That IS a banknote!")
|
||||
}
|
||||
(usedItem.id !in CROPS || usedItem.definition.noteId < 0) -> { // If the item is not a crop or cannot be noted
|
||||
player.dialogueInterpreter.sendDialogues(npc.id,expr,"Nay, I can't turn that into a banknote.")
|
||||
}
|
||||
else -> { // Note the item
|
||||
val amt = amountInInventory(player, usedItem.id)
|
||||
if (removeItem(player, Item(usedItem.id, amt))) {
|
||||
addItem(player, usedItem.noteChange, amt)
|
||||
}
|
||||
sendItemDialogue(player, usedItem.id, "The leprechaun exchanges your items for banknotes.")
|
||||
}
|
||||
sendItemDialogue(player,usedItem.id,"The leprechaun exchanges your items for banknotes.")
|
||||
} else {
|
||||
// Unsure why the line below no longer functions, despite only changing the line above to be more correct. Using your note(NOT CROP) on the leprechaun no longer functions because of this. - Crash
|
||||
player.dialogueInterpreter.sendDialogues(npc.id,expr,"That IS a banknote!")
|
||||
}
|
||||
|
||||
return@onUseWith true
|
||||
return@onUseAnyWith true
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue