forked from 2009Scape/Server
Tool Leprechaun Interface complete
This commit is contained in:
parent
038ded5753
commit
4886e54b06
1 changed files with 14 additions and 1 deletions
|
|
@ -158,7 +158,12 @@ class ToolLeprechaunInterface : ComponentPlugin() {
|
|||
player ?: return
|
||||
val hasAmount = player.inventory.getAmount(item)
|
||||
var finalAmount = amount
|
||||
val spaceLeft = 255 - quantityCheckMethod.invoke(player)
|
||||
val spaceLeft = (if(item == Items.BUCKET_1925) 31 else 255) - quantityCheckMethod.invoke(player)
|
||||
|
||||
if(hasAmount == 0){
|
||||
player.dialogueInterpreter.sendDialogue("You don't have any of those to store.")
|
||||
return
|
||||
}
|
||||
|
||||
if(amount == -2){
|
||||
player.setAttribute("runscript", object : RunScript() {
|
||||
|
|
@ -170,6 +175,10 @@ class ToolLeprechaunInterface : ComponentPlugin() {
|
|||
if(amt > spaceLeft){
|
||||
amt = spaceLeft
|
||||
}
|
||||
if(amt == 0){
|
||||
player.dialogueInterpreter.sendDialogue("You don't have any of those to store.")
|
||||
return true
|
||||
}
|
||||
player.inventory.remove(Item(item,amt))
|
||||
updateQuantityMethod.invoke(player,amt)
|
||||
player.varpManager.get(varp).send(player)
|
||||
|
|
@ -186,6 +195,10 @@ class ToolLeprechaunInterface : ComponentPlugin() {
|
|||
}
|
||||
}
|
||||
|
||||
if(!player.inventory.contains(item,finalAmount)){
|
||||
player.dialogueInterpreter.sendDialogue("You don't have any of those to store.")
|
||||
}
|
||||
|
||||
player.inventory.remove(Item(item,finalAmount))
|
||||
updateQuantityMethod.invoke(player,finalAmount)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue