Miscellaneous farming fixes
This commit is contained in:
@@ -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}")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user