Miscellaneous farming fixes

This commit is contained in:
Ceikry
2021-07-30 12:42:46 +00:00
parent 2210f8af85
commit aece20453c
11 changed files with 213 additions and 40 deletions
+22 -2
View File
@@ -167,6 +167,26 @@ object ContentAPI {
if(!player.inventory.add(item)) GroundItemManager.create(item,player)
}
/**
* Clears an NPC with the "poof" smoke graphics commonly seen with random event NPCs.
* @param npc the NPC object to initialize
*/
@JvmStatic
fun poofClear(npc: NPC){
submitWorldPulse(object : Pulse(){
var counter = 0
override fun pulse(): Boolean {
when(counter++){
2 -> {
npc.isInvisible = true; Graphics.send(Graphics(86), npc.location)
}
3 -> npc.clear().also { return true }
}
return false
}
})
}
/**
* Check if an item exists in a player's bank
* @param player the player whose bank to check
@@ -546,8 +566,8 @@ object ContentAPI {
@JvmStatic
fun openDialogue(player: Player, dialogue: Any, vararg args: Any) {
when (dialogue) {
is Int -> player.dialogueInterpreter.open(dialogue, args)
is DialogueFile -> player.dialogueInterpreter.open(dialogue, args)
is Int -> player.dialogueInterpreter.open(dialogue, *args)
is DialogueFile -> player.dialogueInterpreter.open(dialogue, *args)
else -> SystemLogger.logErr("Invalid object type passed to openDialogue() -> ${dialogue.javaClass.simpleName}")
}
}