Added Storage's "Arrange Items" + Fixed equipped pet on CS issue

Implemented the "Arrange Items" Storage feature (merge & sort items on the Storage). Fixed items from different ownerships being merged together when trying to swap their positions. Fixed a bug where putting equipped pets onto Cash Shop inventory would cause a crash the returning to the game.
This commit is contained in:
ronancpl
2017-10-22 16:39:46 -02:00
parent d91c893400
commit 08658f406b
24 changed files with 436 additions and 13 deletions
+5 -1
View File
@@ -353,6 +353,10 @@ public class MapleInventoryManipulator {
}
}
private static boolean isSameOwner(Item source, Item target) {
return source.getOwner().equals(target.getOwner());
}
public static void move(MapleClient c, MapleInventoryType type, short src, short dst) {
if (src < 0 || dst < 0) {
return;
@@ -374,7 +378,7 @@ public class MapleInventoryManipulator {
short slotMax = ii.getSlotMax(c, source.getItemId());
c.getPlayer().getInventory(type).move(src, dst, slotMax);
final List<ModifyInventory> mods = new ArrayList<>();
if (!(type.equals(MapleInventoryType.EQUIP) || type.equals(MapleInventoryType.CASH)) && initialTarget != null && initialTarget.getItemId() == source.getItemId() && !ItemConstants.isRechargable(source.getItemId())) {
if (!(type.equals(MapleInventoryType.EQUIP) || type.equals(MapleInventoryType.CASH)) && initialTarget != null && initialTarget.getItemId() == source.getItemId() && !ItemConstants.isRechargable(source.getItemId()) && isSameOwner(source, initialTarget)) {
if ((olddstQ + oldsrcQ) > slotMax) {
mods.add(new ModifyInventory(1, source));
mods.add(new ModifyInventory(1, initialTarget));