forked from 2009Scape/Server
All satchels now autoloot items they can hold
The plain satchel, due to its ability to carry any item, will only loot items that already exist in the satchel.
This commit is contained in:
parent
a5eb1ea929
commit
7be39c73b9
2 changed files with 11 additions and 6 deletions
|
|
@ -133,7 +133,7 @@ class SnowscapeSatchelListener : InteractionListener {
|
|||
return satchel!!
|
||||
}
|
||||
|
||||
// Checks if the item is allowed in the satchel. The NPCDropTables.java function calls this on the Red Satchel if the player has one
|
||||
// Checks if the item is allowed in the satchel. The NPCDropTables.java function calls this on satchels the player is carrying.
|
||||
fun isAllowed(player: Player, satchelId: Int, itemId: Int): Boolean {
|
||||
when (satchelId) {
|
||||
plainSatchelId -> return itemId !in satchelIds
|
||||
|
|
|
|||
|
|
@ -271,12 +271,17 @@ public final class NPCDropTables {
|
|||
return true;
|
||||
}
|
||||
|
||||
//Snowscape modification: loot certain items into the red satchel if carried
|
||||
//Snowscape modification: loot certain items into the satchels if carried
|
||||
private boolean handleSatchel(Player player, Item item) {
|
||||
if (inEquipmentOrInventory(player,10879,1)){
|
||||
if (SnowscapeSatchelListener.Companion.isAllowed(player,10879,item.getId()) && player.redSatchel.add(item)) {
|
||||
player.sendMessage("Your red satchel stashed <col=ffa07a>" + item.getAmount() + " " + item.getName() + ".</col>");
|
||||
return true;
|
||||
for (int satchelId = 10877; satchelId <= 10882; satchelId++) {
|
||||
if (inEquipmentOrInventory(player,satchelId,1) && SnowscapeSatchelListener.Companion.isAllowed(player,satchelId,item.getId())){
|
||||
if (satchelId == 10877 && !player.plainSatchel.contains(item.getId(),1)) {
|
||||
continue;
|
||||
}
|
||||
if (SnowscapeSatchelListener.Companion.getSatchel(player, satchelId).add(unnote(item))) {
|
||||
player.sendMessage("Your " + new Item(satchelId).getName() + " stashed <col=ffa07a>" + item.getAmount() + " " + item.getName() + ".</col>");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue