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
+18
View File
@@ -27,6 +27,7 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
@@ -266,6 +267,23 @@ public class MapleStorage {
lock.unlock();
}
}
public void arrangeItems(MapleClient c) {
lock.lock();
try {
MapleStorageInventory msi = new MapleStorageInventory(c, items);
msi.mergeItems();
items = msi.sortItems();
for (MapleInventoryType type : MapleInventoryType.values()) {
typeItems.put(type, new ArrayList<>(items));
}
c.announce(MaplePacketCreator.arrangeStorage(slots, items));
} finally {
lock.unlock();
}
}
public int getMeso() {
return meso;