Rename and clean up MapleInventoryType
This commit is contained in:
@@ -90,7 +90,7 @@ public class CashShop {
|
||||
petid = MaplePet.createPet(itemId);
|
||||
}
|
||||
|
||||
if (ItemConstants.getInventoryType(itemId).equals(MapleInventoryType.EQUIP)) {
|
||||
if (ItemConstants.getInventoryType(itemId).equals(InventoryType.EQUIP)) {
|
||||
item = MapleItemInformationProvider.getInstance().getEquipById(itemId);
|
||||
} else {
|
||||
item = new Item(itemId, (byte) 0, count, petid);
|
||||
@@ -277,7 +277,7 @@ public class CashShop {
|
||||
}
|
||||
}
|
||||
|
||||
for (Pair<Item, MapleInventoryType> item : factory.loadItems(accountId, false)) {
|
||||
for (Pair<Item, InventoryType> item : factory.loadItems(accountId, false)) {
|
||||
inventory.add(item.getLeft());
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ public class CashShop {
|
||||
boolean isRing;
|
||||
Equip equip = null;
|
||||
for (Item item : getInventory()) {
|
||||
if (item.getInventoryType().equals(MapleInventoryType.EQUIP)) {
|
||||
if (item.getInventoryType().equals(InventoryType.EQUIP)) {
|
||||
equip = (Equip) item;
|
||||
isRing = equip.getRingId() > -1;
|
||||
} else {
|
||||
@@ -426,7 +426,7 @@ public class CashShop {
|
||||
Item item = cItem.toItem();
|
||||
Equip equip = null;
|
||||
item.setGiftFrom(rs.getString("from"));
|
||||
if (item.getInventoryType().equals(MapleInventoryType.EQUIP)) {
|
||||
if (item.getInventoryType().equals(InventoryType.EQUIP)) {
|
||||
equip = (Equip) item;
|
||||
equip.setRingId(rs.getInt("ringid"));
|
||||
gifts.add(new Pair<>(equip, rs.getString("message")));
|
||||
@@ -474,7 +474,7 @@ public class CashShop {
|
||||
ps.executeUpdate();
|
||||
}
|
||||
|
||||
List<Pair<Item, MapleInventoryType>> itemsWithType = new ArrayList<>();
|
||||
List<Pair<Item, InventoryType>> itemsWithType = new ArrayList<>();
|
||||
|
||||
List<Item> inv = getInventory();
|
||||
for (Item item : inv) {
|
||||
|
||||
@@ -345,7 +345,7 @@ public class MapleItemInformationProvider {
|
||||
if (item != null) {
|
||||
MapleData smEntry = item.getChildByPath("info/slotMax");
|
||||
if (smEntry == null) {
|
||||
if (ItemConstants.getInventoryType(itemId).getType() == MapleInventoryType.EQUIP.getType()) {
|
||||
if (ItemConstants.getInventoryType(itemId).getType() == InventoryType.EQUIP.getType()) {
|
||||
ret = 1;
|
||||
} else {
|
||||
ret = 100;
|
||||
@@ -1581,7 +1581,7 @@ public class MapleItemInformationProvider {
|
||||
}
|
||||
|
||||
public Collection<Item> canWearEquipment(MapleCharacter chr, Collection<Item> items) {
|
||||
Inventory inv = chr.getInventory(MapleInventoryType.EQUIPPED);
|
||||
Inventory inv = chr.getInventory(InventoryType.EQUIPPED);
|
||||
if (inv.checked()) {
|
||||
return items;
|
||||
}
|
||||
@@ -1597,8 +1597,8 @@ public class MapleItemInformationProvider {
|
||||
boolean highfivestamp = false;
|
||||
/* Removed because players shouldn't even get this, and gm's should just be gm job.
|
||||
try {
|
||||
for (Pair<Item, MapleInventoryType> ii : ItemFactory.INVENTORY.loadItems(chr.getId(), false)) {
|
||||
if (ii.getRight() == MapleInventoryType.CASH) {
|
||||
for (Pair<Item, InventoryType> ii : ItemFactory.INVENTORY.loadItems(chr.getId(), false)) {
|
||||
if (ii.getRight() == InventoryType.CASH) {
|
||||
if (ii.getLeft().getItemId() == 5590000) {
|
||||
highfivestamp = true;
|
||||
}
|
||||
@@ -1683,8 +1683,8 @@ public class MapleItemInformationProvider {
|
||||
boolean highfivestamp = false;
|
||||
/* Removed check above for message ><
|
||||
try {
|
||||
for (Pair<Item, MapleInventoryType> ii : ItemFactory.INVENTORY.loadItems(chr.getId(), false)) {
|
||||
if (ii.getRight() == MapleInventoryType.CASH) {
|
||||
for (Pair<Item, InventoryType> ii : ItemFactory.INVENTORY.loadItems(chr.getId(), false)) {
|
||||
if (ii.getRight() == InventoryType.CASH) {
|
||||
if (ii.getLeft().getItemId() == 5590000) {
|
||||
highfivestamp = true;
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@ package server;
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.inventory.Inventory;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.ItemFactory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import scripting.event.EventInstanceManager;
|
||||
import scripting.event.EventManager;
|
||||
@@ -139,7 +139,7 @@ public class MapleMarriage extends EventInstanceManager {
|
||||
List<Item> items = new LinkedList<>();
|
||||
|
||||
try {
|
||||
for (Pair<Item, MapleInventoryType> it : ItemFactory.MARRIAGE_GIFTS.loadItems(cid, false)) {
|
||||
for (Pair<Item, InventoryType> it : ItemFactory.MARRIAGE_GIFTS.loadItems(cid, false)) {
|
||||
items.add(it.getLeft());
|
||||
}
|
||||
} catch (SQLException sqle) {
|
||||
@@ -154,7 +154,7 @@ public class MapleMarriage extends EventInstanceManager {
|
||||
}
|
||||
|
||||
public static void saveGiftItemsToDb(MapleClient c, List<Item> giftItems, int cid) {
|
||||
List<Pair<Item, MapleInventoryType>> items = new LinkedList<>();
|
||||
List<Pair<Item, InventoryType>> items = new LinkedList<>();
|
||||
for (Item it : giftItems) {
|
||||
items.add(new Pair<>(it, it.getInventoryType()));
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
package server;
|
||||
|
||||
import client.MapleClient;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.MaplePet;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import constants.inventory.ItemConstants;
|
||||
@@ -113,24 +113,24 @@ public class MapleShop {
|
||||
} else if (item.getPitch() > 0) {
|
||||
int amount = (int)Math.min((float) item.getPitch() * quantity, Integer.MAX_VALUE);
|
||||
|
||||
if (c.getPlayer().getInventory(MapleInventoryType.ETC).countById(4310000) >= amount) {
|
||||
if (c.getPlayer().getInventory(InventoryType.ETC).countById(4310000) >= amount) {
|
||||
if (MapleInventoryManipulator.checkSpace(c, itemId, quantity, "")) {
|
||||
if (!ItemConstants.isRechargeable(itemId)) {
|
||||
MapleInventoryManipulator.addById(c, itemId, quantity, "", -1);
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.ETC, 4310000, amount, false, false);
|
||||
MapleInventoryManipulator.removeById(c, InventoryType.ETC, 4310000, amount, false, false);
|
||||
} else {
|
||||
short slotMax = ii.getSlotMax(c, item.getItemId());
|
||||
quantity = slotMax;
|
||||
MapleInventoryManipulator.addById(c, itemId, quantity, "", -1);
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.ETC, 4310000, amount, false, false);
|
||||
MapleInventoryManipulator.removeById(c, InventoryType.ETC, 4310000, amount, false, false);
|
||||
}
|
||||
c.sendPacket(PacketCreator.shopTransaction((byte) 0));
|
||||
} else
|
||||
c.sendPacket(PacketCreator.shopTransaction((byte) 3));
|
||||
}
|
||||
|
||||
} else if (c.getPlayer().getInventory(MapleInventoryType.CASH).countById(token) != 0) {
|
||||
int amount = c.getPlayer().getInventory(MapleInventoryType.CASH).countById(token);
|
||||
} else if (c.getPlayer().getInventory(InventoryType.CASH).countById(token) != 0) {
|
||||
int amount = c.getPlayer().getInventory(InventoryType.CASH).countById(token);
|
||||
int value = amount * tokenvalue;
|
||||
int cost = item.getPrice() * quantity;
|
||||
if (c.getPlayer().getMeso() + value >= cost) {
|
||||
@@ -186,7 +186,7 @@ public class MapleShop {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void sell(MapleClient c, MapleInventoryType type, short slot, short quantity) {
|
||||
public void sell(MapleClient c, InventoryType type, short slot, short quantity) {
|
||||
if (quantity == 0xFFFF || quantity == 0) {
|
||||
quantity = 1;
|
||||
} else if (quantity < 0) {
|
||||
@@ -211,7 +211,7 @@ public class MapleShop {
|
||||
|
||||
public void recharge(MapleClient c, short slot) {
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
Item item = c.getPlayer().getInventory(MapleInventoryType.USE).getItem(slot);
|
||||
Item item = c.getPlayer().getInventory(InventoryType.USE).getItem(slot);
|
||||
if (item == null || !ItemConstants.isRechargeable(item.getItemId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ package server;
|
||||
|
||||
import client.*;
|
||||
import client.inventory.Inventory;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import client.status.MonsterStatus;
|
||||
import client.status.MonsterStatusEffect;
|
||||
@@ -940,7 +940,7 @@ public class MapleStatEffect {
|
||||
if (isShadowClaw()) {
|
||||
short projectileConsume = this.getBulletConsume(); // noticed by shavit
|
||||
|
||||
Inventory use = applyto.getInventory(MapleInventoryType.USE);
|
||||
Inventory use = applyto.getInventory(InventoryType.USE);
|
||||
use.lockInventory();
|
||||
try {
|
||||
Item projectile = null;
|
||||
@@ -956,7 +956,7 @@ public class MapleStatEffect {
|
||||
if (projectile == null) {
|
||||
return false;
|
||||
} else {
|
||||
MapleInventoryManipulator.removeFromSlot(applyto.getClient(), MapleInventoryType.USE, projectile.getPosition(), projectileConsume, false, true);
|
||||
MapleInventoryManipulator.removeFromSlot(applyto.getClient(), InventoryType.USE, projectile.getPosition(), projectileConsume, false, true);
|
||||
}
|
||||
} finally {
|
||||
use.unlockInventory();
|
||||
@@ -1225,7 +1225,7 @@ public class MapleStatEffect {
|
||||
MapleMount givemount = null;
|
||||
if (isMonsterRiding()) {
|
||||
int ridingMountId = 0;
|
||||
Item mount = applyfrom.getInventory(MapleInventoryType.EQUIPPED).getItem((short) -18);
|
||||
Item mount = applyfrom.getInventory(InventoryType.EQUIPPED).getItem((short) -18);
|
||||
if (mount != null) {
|
||||
ridingMountId = mount.getItemId();
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
package server;
|
||||
|
||||
import client.MapleClient;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.ItemFactory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import constants.game.GameConstants;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
||||
@@ -54,7 +54,7 @@ public class MapleStorage {
|
||||
private int currentNpcid;
|
||||
private int meso;
|
||||
private byte slots;
|
||||
private Map<MapleInventoryType, List<Item>> typeItems = new HashMap<>();
|
||||
private Map<InventoryType, List<Item>> typeItems = new HashMap<>();
|
||||
private List<Item> items = new LinkedList<>();
|
||||
private Lock lock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.STORAGE, true);
|
||||
|
||||
@@ -85,7 +85,7 @@ public class MapleStorage {
|
||||
try (ResultSet rs = ps.executeQuery()) {
|
||||
if (rs.next()) {
|
||||
ret = new MapleStorage(rs.getInt("storageid"), (byte) rs.getInt("slots"), rs.getInt("meso"));
|
||||
for (Pair<Item, MapleInventoryType> item : ItemFactory.STORAGE.loadItems(ret.id, false)) {
|
||||
for (Pair<Item, InventoryType> item : ItemFactory.STORAGE.loadItems(ret.id, false)) {
|
||||
ret.items.add(item.getLeft());
|
||||
}
|
||||
} else {
|
||||
@@ -132,7 +132,7 @@ public class MapleStorage {
|
||||
ps.setInt(3, id);
|
||||
ps.executeUpdate();
|
||||
}
|
||||
List<Pair<Item, MapleInventoryType>> itemsWithType = new ArrayList<>();
|
||||
List<Pair<Item, InventoryType>> itemsWithType = new ArrayList<>();
|
||||
|
||||
List<Item> list = getItems();
|
||||
for (Item item : list) {
|
||||
@@ -159,7 +159,7 @@ public class MapleStorage {
|
||||
try {
|
||||
boolean ret = items.remove(item);
|
||||
|
||||
MapleInventoryType type = item.getInventoryType();
|
||||
InventoryType type = item.getInventoryType();
|
||||
typeItems.put(type, new ArrayList<>(filterItems(type)));
|
||||
|
||||
return ret;
|
||||
@@ -177,7 +177,7 @@ public class MapleStorage {
|
||||
|
||||
items.add(item);
|
||||
|
||||
MapleInventoryType type = item.getInventoryType();
|
||||
InventoryType type = item.getInventoryType();
|
||||
typeItems.put(type, new ArrayList<>(filterItems(type)));
|
||||
|
||||
return true;
|
||||
@@ -195,7 +195,7 @@ public class MapleStorage {
|
||||
}
|
||||
}
|
||||
|
||||
private List<Item> filterItems(MapleInventoryType type) {
|
||||
private List<Item> filterItems(InventoryType type) {
|
||||
List<Item> storageItems = getItems();
|
||||
List<Item> ret = new LinkedList<>();
|
||||
|
||||
@@ -207,7 +207,7 @@ public class MapleStorage {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public byte getSlot(MapleInventoryType type, byte slot) {
|
||||
public byte getSlot(InventoryType type, byte slot) {
|
||||
lock.lock();
|
||||
try {
|
||||
byte ret = 0;
|
||||
@@ -243,7 +243,7 @@ public class MapleStorage {
|
||||
});
|
||||
|
||||
List<Item> storageItems = getItems();
|
||||
for (MapleInventoryType type : MapleInventoryType.values()) {
|
||||
for (InventoryType type : InventoryType.values()) {
|
||||
typeItems.put(type, new ArrayList<>(storageItems));
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ public class MapleStorage {
|
||||
}
|
||||
}
|
||||
|
||||
public void sendStored(MapleClient c, MapleInventoryType type) {
|
||||
public void sendStored(MapleClient c, InventoryType type) {
|
||||
lock.lock();
|
||||
try {
|
||||
c.sendPacket(PacketCreator.storeStorage(slots, type, typeItems.get(type)));
|
||||
@@ -263,7 +263,7 @@ public class MapleStorage {
|
||||
}
|
||||
}
|
||||
|
||||
public void sendTakenOut(MapleClient c, MapleInventoryType type) {
|
||||
public void sendTakenOut(MapleClient c, InventoryType type) {
|
||||
lock.lock();
|
||||
try {
|
||||
c.sendPacket(PacketCreator.takeOutStorage(slots, type, typeItems.get(type)));
|
||||
@@ -279,7 +279,7 @@ public class MapleStorage {
|
||||
msi.mergeItems();
|
||||
items = msi.sortItems();
|
||||
|
||||
for (MapleInventoryType type : MapleInventoryType.values()) {
|
||||
for (InventoryType type : InventoryType.values()) {
|
||||
typeItems.put(type, new ArrayList<>(items));
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ package server;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.inventory.Inventory;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import client.inventory.manipulator.MapleKarmaManipulator;
|
||||
import config.YamlConfig;
|
||||
@@ -246,7 +246,7 @@ public class MapleTrade {
|
||||
}
|
||||
|
||||
private boolean fitsInInventory() {
|
||||
List<Pair<Item, MapleInventoryType>> tradeItems = new LinkedList<>();
|
||||
List<Pair<Item, InventoryType>> tradeItems = new LinkedList<>();
|
||||
for (Item item : exchangeItems) {
|
||||
tradeItems.add(new Pair<>(item, item.getInventoryType()));
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ package server.life;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import config.YamlConfig;
|
||||
import constants.game.GameConstants;
|
||||
import net.server.Server;
|
||||
@@ -451,7 +451,7 @@ public class MaplePlayerNPC extends AbstractMapleMapObject {
|
||||
try (PreparedStatement ps = con.prepareStatement("INSERT INTO playernpcs_equip (npcid, equipid, equippos) VALUES (?, ?, ?)")) {
|
||||
ps.setInt(1, npcId);
|
||||
|
||||
for (Item equip : chr.getInventory(MapleInventoryType.EQUIPPED)) {
|
||||
for (Item equip : chr.getInventory(InventoryType.EQUIPPED)) {
|
||||
int position = Math.abs(equip.getPosition());
|
||||
if ((position < 12 && position > 0) || (position > 100 && position < 112)) {
|
||||
ps.setInt(2, equip.getItemId());
|
||||
|
||||
@@ -20,10 +20,11 @@
|
||||
package server.loot;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
|
||||
|
||||
/**
|
||||
@@ -34,7 +35,7 @@ public class MapleLootInventory {
|
||||
Map<Integer, Integer> items = new HashMap<>(50);
|
||||
|
||||
public MapleLootInventory(MapleCharacter from) {
|
||||
for (MapleInventoryType values : MapleInventoryType.values()) {
|
||||
for (InventoryType values : InventoryType.values()) {
|
||||
|
||||
for(Item it : from.getInventory(values).list()) {
|
||||
Integer itemQty = items.get(it.getItemId());
|
||||
|
||||
@@ -24,9 +24,9 @@ package server.maps;
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.inventory.Inventory;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.ItemFactory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import client.inventory.manipulator.MapleKarmaManipulator;
|
||||
import client.processor.npc.FredrickProcessor;
|
||||
@@ -266,7 +266,7 @@ public class MapleHiredMerchant extends AbstractMapleMapObject {
|
||||
if (quantity < 1 || !pItem.isExist() || pItem.getBundles() < quantity) {
|
||||
c.sendPacket(PacketCreator.enableActions());
|
||||
return;
|
||||
} else if (newItem.getInventoryType().equals(MapleInventoryType.EQUIP) && newItem.getQuantity() > 1) {
|
||||
} else if (newItem.getInventoryType().equals(InventoryType.EQUIP) && newItem.getQuantity() > 1) {
|
||||
c.sendPacket(PacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
@@ -410,7 +410,7 @@ public class MapleHiredMerchant extends AbstractMapleMapObject {
|
||||
if (check(c.getPlayer(), copyItems) && !timeout) {
|
||||
for (MaplePlayerShopItem mpsi : copyItems) {
|
||||
if (mpsi.isExist()) {
|
||||
if (mpsi.getItem().getInventoryType().equals(MapleInventoryType.EQUIP)) {
|
||||
if (mpsi.getItem().getInventoryType().equals(InventoryType.EQUIP)) {
|
||||
MapleInventoryManipulator.addFromDrop(c, mpsi.getItem(), false);
|
||||
} else {
|
||||
MapleInventoryManipulator.addById(c, mpsi.getItem().getItemId(), (short) (mpsi.getBundles() * mpsi.getItem().getQuantity()), mpsi.getItem().getOwner(), -1, mpsi.getItem().getFlag(), mpsi.getItem().getExpiration());
|
||||
@@ -622,7 +622,7 @@ public class MapleHiredMerchant extends AbstractMapleMapObject {
|
||||
}
|
||||
|
||||
public void saveItems(boolean shutdown) throws SQLException {
|
||||
List<Pair<Item, MapleInventoryType>> itemsWithType = new ArrayList<>();
|
||||
List<Pair<Item, InventoryType>> itemsWithType = new ArrayList<>();
|
||||
List<Short> bundles = new ArrayList<>();
|
||||
|
||||
for (MaplePlayerShopItem pItems : getItems()) {
|
||||
@@ -648,7 +648,7 @@ public class MapleHiredMerchant extends AbstractMapleMapObject {
|
||||
}
|
||||
|
||||
private static boolean check(MapleCharacter chr, List<MaplePlayerShopItem> items) {
|
||||
List<Pair<Item, MapleInventoryType>> li = new ArrayList<>();
|
||||
List<Pair<Item, InventoryType>> li = new ArrayList<>();
|
||||
for (MaplePlayerShopItem item : items) {
|
||||
Item it = item.getItem().copy();
|
||||
it.setQuantity((short)(it.getQuantity() * item.getBundles()));
|
||||
|
||||
@@ -26,8 +26,8 @@ import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.autoban.AutobanFactory;
|
||||
import client.inventory.Equip;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.MaplePet;
|
||||
import client.status.MonsterStatus;
|
||||
import client.status.MonsterStatusEffect;
|
||||
@@ -659,7 +659,7 @@ public class MapleMap {
|
||||
spawnMesoDrop(mesos, calcDropPos(pos, mob.getPosition()), mob, chr, false, droptype);
|
||||
}
|
||||
} else {
|
||||
if (ItemConstants.getInventoryType(de.itemId) == MapleInventoryType.EQUIP) {
|
||||
if (ItemConstants.getInventoryType(de.itemId) == InventoryType.EQUIP) {
|
||||
idrop = ii.randomizeStats((Equip) ii.getEquipById(de.itemId));
|
||||
} else {
|
||||
idrop = new Item(de.itemId, (short) 0, (short) (de.Maximum != 1 ? Randomizer.nextInt(de.Maximum - de.Minimum) + de.Minimum : 1));
|
||||
@@ -687,7 +687,7 @@ public class MapleMap {
|
||||
pos.x = mobpos + ((d % 2 == 0) ? (25 * (d + 1) / 2) : -(25 * (d / 2)));
|
||||
}
|
||||
if (de.itemId != 0) {
|
||||
if (ItemConstants.getInventoryType(de.itemId) == MapleInventoryType.EQUIP) {
|
||||
if (ItemConstants.getInventoryType(de.itemId) == InventoryType.EQUIP) {
|
||||
idrop = ii.randomizeStats((Equip) ii.getEquipById(de.itemId));
|
||||
} else {
|
||||
idrop = new Item(de.itemId, (short) 0, (short) (de.Maximum != 1 ? Randomizer.nextInt(de.Maximum - de.Minimum) + de.Minimum : 1));
|
||||
@@ -2189,7 +2189,7 @@ public class MapleMap {
|
||||
final Item drop;
|
||||
int randomedId = integer;
|
||||
|
||||
if (ItemConstants.getInventoryType(randomedId) != MapleInventoryType.EQUIP) {
|
||||
if (ItemConstants.getInventoryType(randomedId) != InventoryType.EQUIP) {
|
||||
drop = new Item(randomedId, (short) 0, (short) (rnd.nextInt(copies) + minCopies));
|
||||
} else {
|
||||
drop = ii.randomizeStats((Equip) ii.getEquipById(randomedId));
|
||||
|
||||
@@ -24,8 +24,8 @@ package server.maps;
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.inventory.Inventory;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import client.inventory.manipulator.MapleKarmaManipulator;
|
||||
import net.packet.Packet;
|
||||
@@ -255,7 +255,7 @@ public class MaplePlayerShop extends AbstractMapleMapObject {
|
||||
if (quantity < 1 || !pItem.isExist() || pItem.getBundles() < quantity) {
|
||||
c.sendPacket(PacketCreator.enableActions());
|
||||
return false;
|
||||
} else if (newItem.getInventoryType().equals(MapleInventoryType.EQUIP) && newItem.getQuantity() > 1) {
|
||||
} else if (newItem.getInventoryType().equals(InventoryType.EQUIP) && newItem.getQuantity() > 1) {
|
||||
c.sendPacket(PacketCreator.enableActions());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ package server.quest.actions;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import constants.inventory.ItemConstants;
|
||||
import provider.MapleData;
|
||||
@@ -130,14 +130,14 @@ public class ItemAction extends MapleQuestAction {
|
||||
for(ItemData iEntry: takeItem) {
|
||||
int itemid = iEntry.getId(), count = iEntry.getCount();
|
||||
|
||||
MapleInventoryType type = ItemConstants.getInventoryType(itemid);
|
||||
InventoryType type = ItemConstants.getInventoryType(itemid);
|
||||
int quantity = count * -1; // Invert
|
||||
if(type.equals(MapleInventoryType.EQUIP)) {
|
||||
if(type.equals(InventoryType.EQUIP)) {
|
||||
if(chr.getInventory(type).countById(itemid) < quantity) {
|
||||
// Not enough in the equip inventoty, so check Equipped...
|
||||
if(chr.getInventory(MapleInventoryType.EQUIPPED).countById(itemid) > quantity) {
|
||||
if(chr.getInventory(InventoryType.EQUIPPED).countById(itemid) > quantity) {
|
||||
// Found it equipped, so change the type to equipped.
|
||||
type = MapleInventoryType.EQUIPPED;
|
||||
type = InventoryType.EQUIPPED;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -156,9 +156,9 @@ public class ItemAction extends MapleQuestAction {
|
||||
|
||||
@Override
|
||||
public boolean check(MapleCharacter chr, Integer extSelection) {
|
||||
List<Pair<Item, MapleInventoryType>> gainList = new LinkedList<>();
|
||||
List<Pair<Item, MapleInventoryType>> selectList = new LinkedList<>();
|
||||
List<Pair<Item, MapleInventoryType>> randomList = new LinkedList<>();
|
||||
List<Pair<Item, InventoryType>> gainList = new LinkedList<>();
|
||||
List<Pair<Item, InventoryType>> selectList = new LinkedList<>();
|
||||
List<Pair<Item, InventoryType>> randomList = new LinkedList<>();
|
||||
|
||||
List<Integer> allSlotUsed = new ArrayList(5);
|
||||
for(byte i = 0; i < 5; i++) allSlotUsed.add(0);
|
||||
@@ -168,7 +168,7 @@ public class ItemAction extends MapleQuestAction {
|
||||
continue;
|
||||
}
|
||||
|
||||
MapleInventoryType type = ItemConstants.getInventoryType(item.getId());
|
||||
InventoryType type = ItemConstants.getInventoryType(item.getId());
|
||||
if(item.getProp() != null) {
|
||||
Item toItem = new Item(item.getId(), (short) 0, (short) item.getCount());
|
||||
|
||||
@@ -189,7 +189,7 @@ public class ItemAction extends MapleQuestAction {
|
||||
|
||||
int freeSlotCount = chr.getInventory(type).freeSlotCountById(item.getId(), quantity);
|
||||
if(freeSlotCount == -1) {
|
||||
if(type.equals(MapleInventoryType.EQUIP) && chr.getInventory(MapleInventoryType.EQUIPPED).countById(item.getId()) > quantity)
|
||||
if(type.equals(InventoryType.EQUIP) && chr.getInventory(InventoryType.EQUIPPED).countById(item.getId()) > quantity)
|
||||
continue;
|
||||
|
||||
announceInventoryLimit(Collections.singletonList(item.getId()), chr);
|
||||
@@ -209,7 +209,7 @@ public class ItemAction extends MapleQuestAction {
|
||||
List<Integer> rndUsed = new ArrayList(5);
|
||||
for(byte i = 0; i < 5; i++) rndUsed.add(allSlotUsed.get(i));
|
||||
|
||||
for(Pair<Item, MapleInventoryType> it: randomList) {
|
||||
for(Pair<Item, InventoryType> it: randomList) {
|
||||
int idx = it.getRight().getType() - 1;
|
||||
|
||||
result = MapleInventoryManipulator.checkSpaceProgressively(c, it.getLeft().getItemId(), it.getLeft().getQuantity(), "", rndUsed.get(idx), false);
|
||||
@@ -223,13 +223,13 @@ public class ItemAction extends MapleQuestAction {
|
||||
}
|
||||
|
||||
if(!selectList.isEmpty()) {
|
||||
Pair<Item, MapleInventoryType> selected = selectList.get(extSelection);
|
||||
Pair<Item, InventoryType> selected = selectList.get(extSelection);
|
||||
gainList.add(selected);
|
||||
}
|
||||
|
||||
if (!canHold(chr, gainList)) {
|
||||
List<Integer> gainItemids = new LinkedList<>();
|
||||
for (Pair<Item, MapleInventoryType> it : gainList) {
|
||||
for (Pair<Item, InventoryType> it : gainList) {
|
||||
gainItemids.add(it.getLeft().getItemId());
|
||||
}
|
||||
|
||||
@@ -250,13 +250,13 @@ public class ItemAction extends MapleQuestAction {
|
||||
chr.dropMessage(1, "Please check if you have enough space in your inventory.");
|
||||
}
|
||||
|
||||
private boolean canHold(MapleCharacter chr, List<Pair<Item, MapleInventoryType>> gainList) {
|
||||
private boolean canHold(MapleCharacter chr, List<Pair<Item, InventoryType>> gainList) {
|
||||
List<Integer> toAddItemids = new LinkedList<>();
|
||||
List<Integer> toAddQuantity = new LinkedList<>();
|
||||
List<Integer> toRemoveItemids = new LinkedList<>();
|
||||
List<Integer> toRemoveQuantity = new LinkedList<>();
|
||||
|
||||
for (Pair<Item, MapleInventoryType> item : gainList) {
|
||||
for (Pair<Item, InventoryType> item : gainList) {
|
||||
Item it = item.getLeft();
|
||||
|
||||
if (it.getQuantity() > 0) {
|
||||
|
||||
@@ -21,18 +21,18 @@
|
||||
*/
|
||||
package server.quest.requirements;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import constants.inventory.ItemConstants;
|
||||
import provider.MapleData;
|
||||
import provider.MapleDataTool;
|
||||
import server.MapleItemInformationProvider;
|
||||
import server.quest.MapleQuest;
|
||||
import server.quest.MapleQuestRequirementType;
|
||||
import client.MapleCharacter;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import constants.inventory.ItemConstants;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -65,23 +65,23 @@ public class ItemRequirement extends MapleQuestRequirement {
|
||||
int countNeeded = items.get(itemId);
|
||||
int count = 0;
|
||||
|
||||
MapleInventoryType iType = ItemConstants.getInventoryType(itemId);
|
||||
InventoryType iType = ItemConstants.getInventoryType(itemId);
|
||||
|
||||
if (iType.equals(MapleInventoryType.UNDEFINED)) {
|
||||
if (iType.equals(InventoryType.UNDEFINED)) {
|
||||
return false;
|
||||
}
|
||||
for (Item item : chr.getInventory(iType).listById(itemId)) {
|
||||
count += item.getQuantity();
|
||||
}
|
||||
//Weird stuff, nexon made some quests only available when wearing gm clothes. This enables us to accept it ><
|
||||
if (iType.equals(MapleInventoryType.EQUIP) && !ItemConstants.isMedal(itemId)) {
|
||||
if (iType.equals(InventoryType.EQUIP) && !ItemConstants.isMedal(itemId)) {
|
||||
if(chr.isGM()) {
|
||||
for (Item item : chr.getInventory(MapleInventoryType.EQUIPPED).listById(itemId)) {
|
||||
for (Item item : chr.getInventory(InventoryType.EQUIPPED).listById(itemId)) {
|
||||
count += item.getQuantity();
|
||||
}
|
||||
} else {
|
||||
if(count < countNeeded) {
|
||||
if(chr.getInventory(MapleInventoryType.EQUIPPED).countById(itemId) + count >= countNeeded) {
|
||||
if(chr.getInventory(InventoryType.EQUIPPED).countById(itemId) + count >= countNeeded) {
|
||||
chr.dropMessage(5, "Unequip the required " + ii.getName(itemId) + " before trying this quest operation.");
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user