Improved pet handling and fixed some bugs

Players with merged pets will have the merge resolved next time they are dropped
This commit is contained in:
Player Name
2023-12-29 01:09:55 +00:00
committed by Ryan
parent ee88bfe3f0
commit 279cfb8b42
6 changed files with 74 additions and 57 deletions
@@ -848,6 +848,26 @@ public class Container {
return -1;
}
/**
* Gets the item slot, taking into account the item's whole hash rather than just the ID part.
*
* @param item The item.
* @return The slot of the item in this container.
*/
public int getSlotHash(Item item) {
if (item == null) {
return -1;
}
int idHash = item.getIdHash();
for (int i = 0; i < items.length; i++) {
Item it = items[i];
if (it != null && it.getIdHash() == idHash) {
return i;
}
}
return -1;
}
/**
* Gets the item instance.
*