mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-09 16:45:44 -07:00
Implement clearing BoB inventory
This commit is contained in:
parent
47157671f6
commit
a7c1c510d8
3 changed files with 25 additions and 3 deletions
|
|
@ -156,9 +156,9 @@ public final class HouseZone extends MapZone {
|
||||||
};
|
};
|
||||||
|
|
||||||
private void remove_items(Player p) {
|
private void remove_items(Player p) {
|
||||||
// todo check BoB
|
|
||||||
for (int item : itemsToRemove) {
|
for (int item : itemsToRemove) {
|
||||||
removeItem(p, item, Container.INVENTORY);
|
removeAll(p, item, Container.INVENTORY);
|
||||||
|
removeAll(p, item, Container.BoB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,6 @@ package core.api
|
||||||
enum class Container {
|
enum class Container {
|
||||||
INVENTORY,
|
INVENTORY,
|
||||||
BANK,
|
BANK,
|
||||||
EQUIPMENT
|
EQUIPMENT,
|
||||||
|
BoB
|
||||||
}
|
}
|
||||||
|
|
@ -340,6 +340,12 @@ fun <T> removeItem(player: Player, item: T, container: Container = Container.INV
|
||||||
Container.INVENTORY -> player.inventory.remove(it)
|
Container.INVENTORY -> player.inventory.remove(it)
|
||||||
Container.BANK -> player.bank.remove(it) || player.bankSecondary.remove(it)
|
Container.BANK -> player.bank.remove(it) || player.bankSecondary.remove(it)
|
||||||
Container.EQUIPMENT -> player.equipment.remove(it)
|
Container.EQUIPMENT -> player.equipment.remove(it)
|
||||||
|
Container.BoB -> {
|
||||||
|
if (player.familiarManager.hasFamiliar() && player.familiarManager.familiar.isBurdenBeast)
|
||||||
|
(player.familiarManager.familiar as BurdenBeast).container.remove(it)
|
||||||
|
else
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -356,6 +362,12 @@ fun addItem(player: Player, id: Int, amount: Int = 1, container: Container = Con
|
||||||
Container.INVENTORY -> player.inventory
|
Container.INVENTORY -> player.inventory
|
||||||
Container.BANK -> player.bank
|
Container.BANK -> player.bank
|
||||||
Container.EQUIPMENT -> player.equipment
|
Container.EQUIPMENT -> player.equipment
|
||||||
|
Container.BoB -> {
|
||||||
|
if(player.familiarManager.hasFamiliar() && player.familiarManager.familiar.isBurdenBeast)
|
||||||
|
(player.familiarManager.familiar as BurdenBeast).container
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cont.add(Item(id, amount))
|
return cont.add(Item(id, amount))
|
||||||
|
|
@ -375,6 +387,7 @@ fun replaceSlot(player: Player, slot: Int, item: Item, currentItem: Item? = null
|
||||||
Container.INVENTORY -> player.inventory
|
Container.INVENTORY -> player.inventory
|
||||||
Container.EQUIPMENT -> player.equipment
|
Container.EQUIPMENT -> player.equipment
|
||||||
Container.BANK -> player.bank
|
Container.BANK -> player.bank
|
||||||
|
Container.BoB -> (player.familiarManager.familiar as BurdenBeast).container
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.id == 65535 || item.amount <= 0) {
|
if (item.id == 65535 || item.amount <= 0) {
|
||||||
|
|
@ -1665,6 +1678,14 @@ fun <T> removeAll(player: Player, item: T, container: Container = Container.INVE
|
||||||
player.bank.remove(Item(it, amountInPrimary)) && player.bankSecondary.remove(Item(it, amountInSecondary))
|
player.bank.remove(Item(it, amountInPrimary)) && player.bankSecondary.remove(Item(it, amountInSecondary))
|
||||||
}
|
}
|
||||||
Container.INVENTORY -> player.inventory.remove(Item(it, amountInInventory(player, it)))
|
Container.INVENTORY -> player.inventory.remove(Item(it, amountInInventory(player, it)))
|
||||||
|
Container.BoB -> {
|
||||||
|
if (player.familiarManager.hasFamiliar() && player.familiarManager.familiar.isBurdenBeast){
|
||||||
|
val cont = (player.familiarManager.familiar as BurdenBeast).container
|
||||||
|
cont.remove(Item(it, cont.getAmount(it)))
|
||||||
|
}
|
||||||
|
else
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue