Rename and clean up MapleInventoryType
This commit is contained in:
@@ -303,17 +303,17 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
useCS = false;
|
||||
|
||||
setStance(0);
|
||||
inventory = new Inventory[MapleInventoryType.values().length];
|
||||
inventory = new Inventory[InventoryType.values().length];
|
||||
savedLocations = new SavedLocation[SavedLocationType.values().length];
|
||||
|
||||
for (MapleInventoryType type : MapleInventoryType.values()) {
|
||||
for (InventoryType type : InventoryType.values()) {
|
||||
byte b = 24;
|
||||
if (type == MapleInventoryType.CASH) {
|
||||
if (type == InventoryType.CASH) {
|
||||
b = 96;
|
||||
}
|
||||
inventory[type.ordinal()] = new Inventory(this, type, (byte) b);
|
||||
}
|
||||
inventory[MapleInventoryType.CANHOLD.ordinal()] = new InventoryProof(this);
|
||||
inventory[InventoryType.CANHOLD.ordinal()] = new InventoryProof(this);
|
||||
|
||||
for (int i = 0; i < SavedLocationType.values().length; i++) {
|
||||
savedLocations[i] = null;
|
||||
@@ -374,10 +374,10 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
ret.accountid = c.getAccID();
|
||||
ret.buddylist = new BuddyList(20);
|
||||
ret.maplemount = null;
|
||||
ret.getInventory(MapleInventoryType.EQUIP).setSlotLimit(24);
|
||||
ret.getInventory(MapleInventoryType.USE).setSlotLimit(24);
|
||||
ret.getInventory(MapleInventoryType.SETUP).setSlotLimit(24);
|
||||
ret.getInventory(MapleInventoryType.ETC).setSlotLimit(24);
|
||||
ret.getInventory(InventoryType.EQUIP).setSlotLimit(24);
|
||||
ret.getInventory(InventoryType.USE).setSlotLimit(24);
|
||||
ret.getInventory(InventoryType.SETUP).setSlotLimit(24);
|
||||
ret.getInventory(InventoryType.ETC).setSlotLimit(24);
|
||||
|
||||
// Select a keybinding method
|
||||
int[] selectedKey;
|
||||
@@ -714,7 +714,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
|
||||
public int calculateMaxBaseDamage(int watk) {
|
||||
int maxbasedamage;
|
||||
Item weapon_item = getInventory(MapleInventoryType.EQUIPPED).getItem((short) -11);
|
||||
Item weapon_item = getInventory(InventoryType.EQUIPPED).getItem((short) -11);
|
||||
if (weapon_item != null) {
|
||||
maxbasedamage = calculateMaxBaseDamage(watk, ii.getWeaponType(weapon_item.getItemId()));
|
||||
} else {
|
||||
@@ -814,7 +814,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
|
||||
public String getMedalText() {
|
||||
String medal = "";
|
||||
final Item medalItem = getInventory(MapleInventoryType.EQUIPPED).getItem((short) -49);
|
||||
final Item medalItem = getInventory(InventoryType.EQUIPPED).getItem((short) -49);
|
||||
if (medalItem != null) {
|
||||
medal = "<" + ii.getName(medalItem.getItemId()) + "> ";
|
||||
}
|
||||
@@ -905,7 +905,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
for(MapleInventoryType invType : MapleInventoryType.values()) {
|
||||
for(InventoryType invType : InventoryType.values()) {
|
||||
Inventory inv = this.getInventory(invType);
|
||||
|
||||
inv.lockInventory();
|
||||
@@ -1278,7 +1278,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
|
||||
public void changeMapBanish(int mapid, String portal, String msg) {
|
||||
if(YamlConfig.config.server.USE_SPIKES_AVOID_BANISH) {
|
||||
for(Item it: this.getInventory(MapleInventoryType.EQUIPPED).list()) {
|
||||
for(Item it: this.getInventory(InventoryType.EQUIPPED).list()) {
|
||||
if((it.getFlag() & ItemConstants.SPIKES) == ItemConstants.SPIKES) {
|
||||
return;
|
||||
}
|
||||
@@ -1455,7 +1455,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
effLock.unlock();
|
||||
}
|
||||
|
||||
for(Item it: this.getInventory(MapleInventoryType.EQUIPPED).list()) {
|
||||
for(Item it: this.getInventory(InventoryType.EQUIPPED).list()) {
|
||||
if((it.getFlag() & ItemConstants.COLD) == ItemConstants.COLD && ((returnMapid == 211000000 && thisMapid != 200082300) || returnMapid == 193000000)) {
|
||||
return true; //protection from cold
|
||||
}
|
||||
@@ -2762,7 +2762,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
|
||||
private void doHurtHp() {
|
||||
if (!(this.getInventory(MapleInventoryType.EQUIPPED).findById(getMap().getHPDecProtect()) != null || buffMapProtection())) {
|
||||
if (!(this.getInventory(InventoryType.EQUIPPED).findById(getMap().getHPDecProtect()) != null || buffMapProtection())) {
|
||||
addHP(-getMap().getHPDec());
|
||||
lastHpDec = Server.getInstance().getCurrentTime();
|
||||
}
|
||||
@@ -5096,7 +5096,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
return initialSpawnPoint;
|
||||
}
|
||||
|
||||
public Inventory getInventory(MapleInventoryType type) {
|
||||
public Inventory getInventory(InventoryType type) {
|
||||
return inventory[type.ordinal()];
|
||||
}
|
||||
|
||||
@@ -5106,11 +5106,11 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
|
||||
public boolean haveItemWithId(int itemid, boolean checkEquipped) {
|
||||
return (inventory[ItemConstants.getInventoryType(itemid).ordinal()].findById(itemid) != null)
|
||||
|| (checkEquipped && inventory[MapleInventoryType.EQUIPPED.ordinal()].findById(itemid) != null);
|
||||
|| (checkEquipped && inventory[InventoryType.EQUIPPED.ordinal()].findById(itemid) != null);
|
||||
}
|
||||
|
||||
public boolean haveItemEquipped(int itemid) {
|
||||
return (inventory[MapleInventoryType.EQUIPPED.ordinal()].findById(itemid) != null);
|
||||
return (inventory[InventoryType.EQUIPPED.ordinal()].findById(itemid) != null);
|
||||
}
|
||||
|
||||
public boolean haveWeddingRing() {
|
||||
@@ -5128,7 +5128,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
public int getItemQuantity(int itemid, boolean checkEquipped) {
|
||||
int count = inventory[ItemConstants.getInventoryType(itemid).ordinal()].countById(itemid);
|
||||
if (checkEquipped) {
|
||||
count += inventory[MapleInventoryType.EQUIPPED.ordinal()].countById(itemid);
|
||||
count += inventory[InventoryType.EQUIPPED.ordinal()].countById(itemid);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
@@ -5136,7 +5136,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
public int getCleanItemQuantity(int itemid, boolean checkEquipped) {
|
||||
int count = inventory[ItemConstants.getInventoryType(itemid).ordinal()].countNotOwnedById(itemid);
|
||||
if (checkEquipped) {
|
||||
count += inventory[MapleInventoryType.EQUIPPED.ordinal()].countNotOwnedById(itemid);
|
||||
count += inventory[InventoryType.EQUIPPED.ordinal()].countNotOwnedById(itemid);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
@@ -6030,7 +6030,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
|
||||
public boolean hasEmptySlot(byte invType) {
|
||||
return getInventory(MapleInventoryType.getByType(invType)).getNextFreeSlot() > -1;
|
||||
return getInventory(InventoryType.getByType(invType)).getNextFreeSlot() > -1;
|
||||
}
|
||||
|
||||
public void increaseGuildCapacity() {
|
||||
@@ -6648,7 +6648,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
private void setCouponRates() {
|
||||
List<Integer> couponEffects;
|
||||
|
||||
Collection<Item> cashItems = this.getInventory(MapleInventoryType.CASH).list();
|
||||
Collection<Item> cashItems = this.getInventory(InventoryType.CASH).list();
|
||||
chrLock.lock();
|
||||
try {
|
||||
setActiveCoupons(cashItems);
|
||||
@@ -6667,7 +6667,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
|
||||
public void updateCouponRates() {
|
||||
Inventory cashInv = this.getInventory(MapleInventoryType.CASH);
|
||||
Inventory cashInv = this.getInventory(InventoryType.CASH);
|
||||
if (cashInv == null) return;
|
||||
|
||||
effLock.lock();
|
||||
@@ -6872,7 +6872,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
ret.jobRankMove = rs.getInt("jobRankMove");
|
||||
|
||||
if(equipped != null) { // players can have no equipped items at all, ofc
|
||||
Inventory inv = ret.inventory[MapleInventoryType.EQUIPPED.ordinal()];
|
||||
Inventory inv = ret.inventory[InventoryType.EQUIPPED.ordinal()];
|
||||
for (Item item : equipped) {
|
||||
inv.addItemFromDB(item);
|
||||
}
|
||||
@@ -6915,7 +6915,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
ret.mapid = this.getMapId();
|
||||
ret.initialSpawnPoint = this.getInitialSpawnpoint();
|
||||
|
||||
ret.inventory[MapleInventoryType.EQUIPPED.ordinal()] = this.getInventory(MapleInventoryType.EQUIPPED);
|
||||
ret.inventory[InventoryType.EQUIPPED.ordinal()] = this.getInventory(InventoryType.EQUIPPED);
|
||||
|
||||
ret.setGMLevel(this.gmLevel());
|
||||
ret.world = this.getWorld();
|
||||
@@ -7030,13 +7030,13 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
|
||||
wserv = Server.getInstance().getWorld(ret.world);
|
||||
|
||||
ret.getInventory(MapleInventoryType.EQUIP).setSlotLimit(rs.getByte("equipslots"));
|
||||
ret.getInventory(MapleInventoryType.USE).setSlotLimit(rs.getByte("useslots"));
|
||||
ret.getInventory(MapleInventoryType.SETUP).setSlotLimit(rs.getByte("setupslots"));
|
||||
ret.getInventory(MapleInventoryType.ETC).setSlotLimit(rs.getByte("etcslots"));
|
||||
ret.getInventory(InventoryType.EQUIP).setSlotLimit(rs.getByte("equipslots"));
|
||||
ret.getInventory(InventoryType.USE).setSlotLimit(rs.getByte("useslots"));
|
||||
ret.getInventory(InventoryType.SETUP).setSlotLimit(rs.getByte("setupslots"));
|
||||
ret.getInventory(InventoryType.ETC).setSlotLimit(rs.getByte("etcslots"));
|
||||
|
||||
short sandboxCheck = 0x0;
|
||||
for (Pair<Item, MapleInventoryType> item : ItemFactory.INVENTORY.loadItems(ret.id, !channelserver)) {
|
||||
for (Pair<Item, InventoryType> item : ItemFactory.INVENTORY.loadItems(ret.id, !channelserver)) {
|
||||
sandboxCheck |= item.getLeft().getFlag();
|
||||
|
||||
ret.getInventory(item.getRight()).addItemFromDB(item.getLeft());
|
||||
@@ -7049,12 +7049,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
continue;
|
||||
}
|
||||
|
||||
MapleInventoryType mit = item.getRight();
|
||||
if (mit.equals(MapleInventoryType.EQUIP) || mit.equals(MapleInventoryType.EQUIPPED)) {
|
||||
InventoryType mit = item.getRight();
|
||||
if (mit.equals(InventoryType.EQUIP) || mit.equals(InventoryType.EQUIPPED)) {
|
||||
Equip equip = (Equip) item.getLeft();
|
||||
if (equip.getRingId() > -1) {
|
||||
MapleRing ring = MapleRing.loadFromDb(equip.getRingId());
|
||||
if (item.getRight().equals(MapleInventoryType.EQUIPPED)) {
|
||||
if (item.getRight().equals(InventoryType.EQUIPPED)) {
|
||||
ring.equip();
|
||||
}
|
||||
|
||||
@@ -7416,8 +7416,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
|
||||
final int mountid = ret.getJobType() * 10000000 + 1004;
|
||||
if (ret.getInventory(MapleInventoryType.EQUIPPED).getItem((short) -18) != null) {
|
||||
ret.maplemount = new MapleMount(ret, ret.getInventory(MapleInventoryType.EQUIPPED).getItem((short) -18).getItemId(), mountid);
|
||||
if (ret.getInventory(InventoryType.EQUIPPED).getItem((short) -18) != null) {
|
||||
ret.maplemount = new MapleMount(ret, ret.getInventory(InventoryType.EQUIPPED).getItem((short) -18).getItemId(), mountid);
|
||||
} else {
|
||||
ret.maplemount = new MapleMount(ret, 0, mountid);
|
||||
}
|
||||
@@ -7704,7 +7704,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
//equipspeed = 0;
|
||||
//equipjump = 0;
|
||||
|
||||
for (Item item : getInventory(MapleInventoryType.EQUIPPED)) {
|
||||
for (Item item : getInventory(InventoryType.EQUIPPED)) {
|
||||
Equip equip = (Equip) item;
|
||||
equipmaxhp += equip.getHp();
|
||||
equipmaxmp += equip.getMp();
|
||||
@@ -7822,7 +7822,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
|
||||
if (job.isA(MapleJob.THIEF) || job.isA(MapleJob.BOWMAN) || job.isA(MapleJob.PIRATE) || job.isA(MapleJob.NIGHTWALKER1) || job.isA(MapleJob.WINDARCHER1)) {
|
||||
Item weapon_item = getInventory(MapleInventoryType.EQUIPPED).getItem((short) -11);
|
||||
Item weapon_item = getInventory(InventoryType.EQUIPPED).getItem((short) -11);
|
||||
if (weapon_item != null) {
|
||||
MapleWeaponType weapon = ii.getWeaponType(weapon_item.getItemId());
|
||||
boolean bow = weapon == MapleWeaponType.BOW;
|
||||
@@ -7831,7 +7831,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
boolean gun = weapon == MapleWeaponType.GUN;
|
||||
if (bow || crossbow || claw || gun) {
|
||||
// Also calc stars into this.
|
||||
Inventory inv = getInventory(MapleInventoryType.USE);
|
||||
Inventory inv = getInventory(InventoryType.USE);
|
||||
for (short i = 1; i <= inv.getSlotLimit(); i++) {
|
||||
Item item = inv.getItem(i);
|
||||
if (item != null) {
|
||||
@@ -8176,8 +8176,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
this.changeSkillLevel(skill, skEntry.getRight().byteValue(), skill.getMaxLevel(), -1);
|
||||
}
|
||||
|
||||
List<Pair<Item, MapleInventoryType>> itemsWithType = recipe.getStartingItems();
|
||||
for (Pair<Item, MapleInventoryType> itEntry : itemsWithType) {
|
||||
List<Pair<Item, InventoryType>> itemsWithType = recipe.getStartingItems();
|
||||
for (Pair<Item, InventoryType> itEntry : itemsWithType) {
|
||||
this.getInventory(itEntry.getRight()).addItem(itEntry.getLeft());
|
||||
}
|
||||
|
||||
@@ -8556,7 +8556,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
psMacro.executeBatch();
|
||||
}
|
||||
|
||||
List<Pair<Item, MapleInventoryType>> itemsWithType = new ArrayList<>();
|
||||
List<Pair<Item, InventoryType>> itemsWithType = new ArrayList<>();
|
||||
for (Inventory iv : inventory) {
|
||||
for (Item item : iv.list()) {
|
||||
itemsWithType.add(new Pair<>(item, iv.getType()));
|
||||
@@ -9112,7 +9112,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
int autohpItemid = autohpPot.getAction();
|
||||
float autohpAlert = this.getAutopotHpAlert();
|
||||
if (((float) this.getHp()) / this.getCurrentMaxHp() <= autohpAlert) { // try within user settings... thanks Lame, Optimist, Stealth2800
|
||||
Item autohpItem = this.getInventory(MapleInventoryType.USE).findById(autohpItemid);
|
||||
Item autohpItem = this.getInventory(InventoryType.USE).findById(autohpItemid);
|
||||
if (autohpItem != null) {
|
||||
this.setAutopotHpAlert(0.9f * autohpAlert);
|
||||
PetAutopotProcessor.runAutopotAction(client, autohpItem.getPosition(), autohpItemid);
|
||||
@@ -9127,7 +9127,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
int autompItemid = autompPot.getAction();
|
||||
float autompAlert = this.getAutopotMpAlert();
|
||||
if (((float) this.getMp()) / this.getCurrentMaxMp() <= autompAlert) {
|
||||
Item autompItem = this.getInventory(MapleInventoryType.USE).findById(autompItemid);
|
||||
Item autompItem = this.getInventory(InventoryType.USE).findById(autompItemid);
|
||||
if (autompItem != null) {
|
||||
this.setAutopotMpAlert(0.9f * autompAlert); // autoMP would stick to using pots at every depletion in some cases... thanks Rohenn
|
||||
PetAutopotProcessor.runAutopotAction(client, autompItem.getPosition(), autompItemid);
|
||||
@@ -9139,7 +9139,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setInventory(MapleInventoryType type, Inventory inv) {
|
||||
public void setInventory(InventoryType type, Inventory inv) {
|
||||
inventory[type.ordinal()] = inv;
|
||||
}
|
||||
|
||||
@@ -9285,7 +9285,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
|
||||
public byte getSlots(int type) {
|
||||
return type == MapleInventoryType.CASH.getType() ? 96 : inventory[type].getSlotLimit();
|
||||
return type == InventoryType.CASH.getType() ? 96 : inventory[type].getSlotLimit();
|
||||
}
|
||||
|
||||
public boolean canGainSlots(int type, int slots) {
|
||||
@@ -9327,7 +9327,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
|
||||
public int sellAllItemsFromName(byte invTypeId, String name) {
|
||||
//player decides from which inventory items should be sold.
|
||||
MapleInventoryType type = MapleInventoryType.getByType(invTypeId);
|
||||
InventoryType type = InventoryType.getByType(invTypeId);
|
||||
|
||||
Inventory inv = getInventory(type);
|
||||
inv.lockInventory();
|
||||
@@ -9343,7 +9343,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
}
|
||||
|
||||
public int sellAllItemsFromPosition(MapleItemInformationProvider ii, MapleInventoryType type, short pos) {
|
||||
public int sellAllItemsFromPosition(MapleItemInformationProvider ii, InventoryType type, short pos) {
|
||||
int mesoGain = 0;
|
||||
|
||||
Inventory inv = getInventory(type);
|
||||
@@ -9362,7 +9362,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
return(mesoGain);
|
||||
}
|
||||
|
||||
private int standaloneSell(MapleClient c, MapleItemInformationProvider ii, MapleInventoryType type, short slot, short quantity) {
|
||||
private int standaloneSell(MapleClient c, MapleItemInformationProvider ii, InventoryType type, short slot, short quantity) {
|
||||
if (quantity == 0xFFFF || quantity == 0) {
|
||||
quantity = 1;
|
||||
}
|
||||
@@ -9419,7 +9419,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
private List<Equip> getUpgradeableEquipped() {
|
||||
List<Equip> list = new LinkedList<>();
|
||||
|
||||
for (Item item : getInventory(MapleInventoryType.EQUIPPED)) {
|
||||
for (Item item : getInventory(InventoryType.EQUIPPED)) {
|
||||
if (ii.isUpgradeable(item.getItemId())) {
|
||||
list.add((Equip) item);
|
||||
}
|
||||
@@ -9441,7 +9441,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
|
||||
public boolean mergeAllItemsFromName(String name) {
|
||||
MapleInventoryType type = MapleInventoryType.EQUIP;
|
||||
InventoryType type = InventoryType.EQUIP;
|
||||
|
||||
Inventory inv = getInventory(type);
|
||||
inv.lockInventory();
|
||||
@@ -9518,18 +9518,18 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
|
||||
public void mergeAllItemsFromPosition(Map<StatUpgrade, Float> statups, short pos) {
|
||||
Inventory inv = getInventory(MapleInventoryType.EQUIP);
|
||||
Inventory inv = getInventory(InventoryType.EQUIP);
|
||||
inv.lockInventory();
|
||||
try {
|
||||
for(short i = pos; i <= inv.getSlotLimit(); i++) {
|
||||
standaloneMerge(statups, getClient(), MapleInventoryType.EQUIP, i, inv.getItem(i));
|
||||
standaloneMerge(statups, getClient(), InventoryType.EQUIP, i, inv.getItem(i));
|
||||
}
|
||||
} finally {
|
||||
inv.unlockInventory();
|
||||
}
|
||||
}
|
||||
|
||||
private void standaloneMerge(Map<StatUpgrade, Float> statups, MapleClient c, MapleInventoryType type, short slot, Item item) {
|
||||
private void standaloneMerge(Map<StatUpgrade, Float> statups, MapleClient c, InventoryType type, short slot, Item item) {
|
||||
short quantity;
|
||||
if (item == null || (quantity = item.getQuantity()) < 1 || ii.isCash(item.getItemId()) || !ii.isUpgradeable(item.getItemId()) || hasMergeFlag(item)){
|
||||
return;
|
||||
@@ -9623,7 +9623,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
nextWarningTime = curTime + (60 * 1000); // show underlevel info again after 1 minute
|
||||
|
||||
String medal = "";
|
||||
Item medalItem = mapOwner.getInventory(MapleInventoryType.EQUIPPED).getItem((short) -49);
|
||||
Item medalItem = mapOwner.getInventory(InventoryType.EQUIPPED).getItem((short) -49);
|
||||
if (medalItem != null) {
|
||||
medal = "<" + ii.getName(medalItem.getItemId()) + "> ";
|
||||
}
|
||||
@@ -9722,7 +9722,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
} else {
|
||||
pet.setFullness(newFullness);
|
||||
pet.saveToDb();
|
||||
Item petz = getInventory(MapleInventoryType.CASH).getItem(pet.getPosition());
|
||||
Item petz = getInventory(InventoryType.CASH).getItem(pet.getPosition());
|
||||
if (petz != null) {
|
||||
forceUpdateItem(petz);
|
||||
}
|
||||
@@ -10365,7 +10365,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
|
||||
private Collection<Item> getUpgradeableEquipList() {
|
||||
Collection<Item> fullList = getInventory(MapleInventoryType.EQUIPPED).list();
|
||||
Collection<Item> fullList = getInventory(InventoryType.EQUIPPED).list();
|
||||
if (YamlConfig.config.server.USE_EQUIPMNT_LVLUP_CASH) {
|
||||
return fullList;
|
||||
}
|
||||
@@ -10401,7 +10401,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
public void showAllEquipFeatures() {
|
||||
String showMsg = "";
|
||||
|
||||
for (Item item : getInventory(MapleInventoryType.EQUIPPED).list()) {
|
||||
for (Item item : getInventory(InventoryType.EQUIPPED).list()) {
|
||||
Equip nEquip = (Equip) item;
|
||||
String itemName = ii.getName(nEquip.getItemId());
|
||||
if (itemName == null) {
|
||||
|
||||
@@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package client;
|
||||
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.InventoryType;
|
||||
import config.YamlConfig;
|
||||
import constants.game.GameConstants;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
@@ -1491,7 +1491,7 @@ public class MapleClient extends ChannelInboundHandlerAdapter {
|
||||
//Cancelling magicdoor? Nope
|
||||
//Cancelling mounts? Noty
|
||||
|
||||
player.getInventory(MapleInventoryType.EQUIPPED).checked(false); //test
|
||||
player.getInventory(InventoryType.EQUIPPED).checked(false); //test
|
||||
player.getMap().removePlayer(player);
|
||||
player.clearBanishPlayerData();
|
||||
player.getClient().getChannelServer().removePlayer(player);
|
||||
|
||||
@@ -26,8 +26,8 @@ package client.command.commands.gm2;
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.command.Command;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
|
||||
public class ClearSlotCommand extends Command {
|
||||
@@ -46,79 +46,79 @@ public class ClearSlotCommand extends Command {
|
||||
switch (type) {
|
||||
case "all":
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem((byte) i);
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.EQUIP).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.EQUIP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.EQUIP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(MapleInventoryType.USE).getItem((byte) i);
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.USE).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, (byte) i, tempItem.getQuantity(), false, false);
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.USE, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(MapleInventoryType.ETC).getItem((byte) i);
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.ETC).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.ETC, (byte) i, tempItem.getQuantity(), false, false);
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.ETC, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(MapleInventoryType.SETUP).getItem((byte) i);
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.SETUP).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.SETUP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.SETUP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(MapleInventoryType.CASH).getItem((byte) i);
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.CASH).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.CASH, (byte) i, tempItem.getQuantity(), false, false);
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.CASH, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("All Slots Cleared.");
|
||||
break;
|
||||
case "equip":
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem((byte) i);
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.EQUIP).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.EQUIP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.EQUIP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("Equipment Slot Cleared.");
|
||||
break;
|
||||
case "use":
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(MapleInventoryType.USE).getItem((byte) i);
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.USE).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, (byte) i, tempItem.getQuantity(), false, false);
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.USE, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("Use Slot Cleared.");
|
||||
break;
|
||||
case "setup":
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(MapleInventoryType.SETUP).getItem((byte) i);
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.SETUP).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.SETUP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.SETUP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("Set-Up Slot Cleared.");
|
||||
break;
|
||||
case "etc":
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(MapleInventoryType.ETC).getItem((byte) i);
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.ETC).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.ETC, (byte) i, tempItem.getQuantity(), false, false);
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.ETC, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("ETC Slot Cleared.");
|
||||
break;
|
||||
case "cash":
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(MapleInventoryType.CASH).getItem((byte) i);
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.CASH).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.CASH, (byte) i, tempItem.getQuantity(), false, false);
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.CASH, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("Cash Slot Cleared.");
|
||||
break;
|
||||
|
||||
@@ -26,8 +26,8 @@ package client.command.commands.gm2;
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.command.Command;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.MaplePet;
|
||||
import config.YamlConfig;
|
||||
import constants.inventory.ItemConstants;
|
||||
@@ -94,7 +94,7 @@ public class ItemDropCommand extends Command {
|
||||
}
|
||||
|
||||
Item toDrop;
|
||||
if (ItemConstants.getInventoryType(itemId) == MapleInventoryType.EQUIP) {
|
||||
if (ItemConstants.getInventoryType(itemId) == InventoryType.EQUIP) {
|
||||
toDrop = ii.getEquipById(itemId);
|
||||
} else {
|
||||
toDrop = new Item(itemId, (short) 0, quantity);
|
||||
|
||||
@@ -26,8 +26,8 @@ package client.command.commands.gm2;
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.command.Command;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import constants.inventory.ItemConstants;
|
||||
import server.MapleItemInformationProvider;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class RechargeCommand extends Command {
|
||||
public void execute(MapleClient c, String[] params) {
|
||||
MapleCharacter player = c.getPlayer();
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
for (Item torecharge : c.getPlayer().getInventory(MapleInventoryType.USE).list()) {
|
||||
for (Item torecharge : c.getPlayer().getInventory(InventoryType.USE).list()) {
|
||||
if (ItemConstants.isThrowingStar(torecharge.getItemId())){
|
||||
torecharge.setQuantity(ii.getSlotMax(c, torecharge.getItemId()));
|
||||
c.getPlayer().forceUpdateItem(torecharge);
|
||||
|
||||
@@ -27,8 +27,8 @@ import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.command.Command;
|
||||
import client.inventory.Equip;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import constants.inventory.ItemConstants;
|
||||
import server.MapleItemInformationProvider;
|
||||
@@ -57,8 +57,8 @@ public class ProItemCommand extends Command {
|
||||
short stat = (short) Math.max(0, Short.parseShort(params[1]));
|
||||
short spdjmp = params.length >= 3 ? (short) Math.max(0, Short.parseShort(params[2])) : 0;
|
||||
|
||||
MapleInventoryType type = ItemConstants.getInventoryType(itemid);
|
||||
if (type.equals(MapleInventoryType.EQUIP)) {
|
||||
InventoryType type = ItemConstants.getInventoryType(itemid);
|
||||
if (type.equals(InventoryType.EQUIP)) {
|
||||
Item it = ii.getEquipById(itemid);
|
||||
it.setOwner(player.getName());
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import client.MapleClient;
|
||||
import client.command.Command;
|
||||
import client.inventory.Equip;
|
||||
import client.inventory.Inventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.InventoryType;
|
||||
import constants.inventory.ItemConstants;
|
||||
|
||||
public class SetEqStatCommand extends Command {
|
||||
@@ -46,7 +46,7 @@ public class SetEqStatCommand extends Command {
|
||||
|
||||
short newStat = (short) Math.max(0, Integer.parseInt(params[0]));
|
||||
short newSpdJmp = params.length >= 2 ? (short) Integer.parseInt(params[1]) : 0;
|
||||
Inventory equip = player.getInventory(MapleInventoryType.EQUIP);
|
||||
Inventory equip = player.getInventory(InventoryType.EQUIP);
|
||||
|
||||
for (byte i = 1; i <= equip.getSlotLimit(); i++) {
|
||||
try {
|
||||
|
||||
@@ -23,8 +23,8 @@ import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.MapleSkinColor;
|
||||
import client.inventory.Inventory;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import config.YamlConfig;
|
||||
import net.server.Server;
|
||||
import server.MapleItemInformationProvider;
|
||||
@@ -58,7 +58,7 @@ public abstract class CharacterFactory {
|
||||
newchar.setJob(recipe.getJob());
|
||||
newchar.setMapId(recipe.getMap());
|
||||
|
||||
Inventory equipped = newchar.getInventory(MapleInventoryType.EQUIPPED);
|
||||
Inventory equipped = newchar.getInventory(InventoryType.EQUIPPED);
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
|
||||
int top = recipe.getTop(), bottom = recipe.getBottom(), shoes = recipe.getShoes(), weapon = recipe.getWeapon();
|
||||
|
||||
@@ -21,15 +21,16 @@ package client.creator;
|
||||
|
||||
import client.MapleJob;
|
||||
import client.Skill;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import config.YamlConfig;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import tools.Pair;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import tools.Pair;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -44,8 +45,8 @@ public class CharacterFactoryRecipe {
|
||||
private int meso = 0;
|
||||
private List<Pair<Skill, Integer>> skills = new LinkedList<>();
|
||||
|
||||
private List<Pair<Item, MapleInventoryType>> itemsWithType = new LinkedList<>();
|
||||
private Map<MapleInventoryType, AtomicInteger> runningTypePosition = new LinkedHashMap<>();
|
||||
private List<Pair<Item, InventoryType>> itemsWithType = new LinkedList<>();
|
||||
private Map<InventoryType, AtomicInteger> runningTypePosition = new LinkedHashMap<>();
|
||||
|
||||
public CharacterFactoryRecipe(MapleJob job, int level, int map, int top, int bottom, int shoes, int weapon) {
|
||||
this.job = job;
|
||||
@@ -107,10 +108,10 @@ public class CharacterFactoryRecipe {
|
||||
}
|
||||
|
||||
public void addStartingEquipment(Item eqpItem) {
|
||||
itemsWithType.add(new Pair<>(eqpItem, MapleInventoryType.EQUIP));
|
||||
itemsWithType.add(new Pair<>(eqpItem, InventoryType.EQUIP));
|
||||
}
|
||||
|
||||
public void addStartingItem(int itemid, int quantity, MapleInventoryType itemType) {
|
||||
public void addStartingItem(int itemid, int quantity, InventoryType itemType) {
|
||||
AtomicInteger p = runningTypePosition.get(itemType);
|
||||
if(p == null) {
|
||||
p = new AtomicInteger(0);
|
||||
@@ -188,7 +189,7 @@ public class CharacterFactoryRecipe {
|
||||
return skills;
|
||||
}
|
||||
|
||||
public List<Pair<Item, MapleInventoryType>> getStartingItems() {
|
||||
public List<Pair<Item, InventoryType>> getStartingItems() {
|
||||
return itemsWithType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import client.MapleClient;
|
||||
import client.MapleJob;
|
||||
import client.creator.CharacterFactory;
|
||||
import client.creator.CharacterFactoryRecipe;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.InventoryType;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -33,11 +33,11 @@ public class BeginnerCreator extends CharacterFactory {
|
||||
|
||||
private static CharacterFactoryRecipe createRecipe(MapleJob job, int level, int map, int top, int bottom, int shoes, int weapon) {
|
||||
CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon);
|
||||
giveItem(recipe, 4161001, 1, MapleInventoryType.ETC);
|
||||
giveItem(recipe, 4161001, 1, InventoryType.ETC);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, MapleInventoryType itemType) {
|
||||
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
|
||||
recipe.addStartingItem(itemid, quantity, itemType);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import client.MapleClient;
|
||||
import client.MapleJob;
|
||||
import client.creator.CharacterFactory;
|
||||
import client.creator.CharacterFactoryRecipe;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.InventoryType;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -33,11 +33,11 @@ public class LegendCreator extends CharacterFactory {
|
||||
|
||||
private static CharacterFactoryRecipe createRecipe(MapleJob job, int level, int map, int top, int bottom, int shoes, int weapon) {
|
||||
CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon);
|
||||
giveItem(recipe, 4161048, 1, MapleInventoryType.ETC);
|
||||
giveItem(recipe, 4161048, 1, InventoryType.ETC);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, MapleInventoryType itemType) {
|
||||
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
|
||||
recipe.addStartingItem(itemid, quantity, itemType);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import client.MapleClient;
|
||||
import client.MapleJob;
|
||||
import client.creator.CharacterFactory;
|
||||
import client.creator.CharacterFactoryRecipe;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.InventoryType;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -33,11 +33,11 @@ public class NoblesseCreator extends CharacterFactory {
|
||||
|
||||
private static CharacterFactoryRecipe createRecipe(MapleJob job, int level, int map, int top, int bottom, int shoes, int weapon) {
|
||||
CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon);
|
||||
giveItem(recipe, 4161047, 1, MapleInventoryType.ETC);
|
||||
giveItem(recipe, 4161047, 1, InventoryType.ETC);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, MapleInventoryType itemType) {
|
||||
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
|
||||
recipe.addStartingItem(itemid, quantity, itemType);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ import client.MapleClient;
|
||||
import client.MapleJob;
|
||||
import client.creator.CharacterFactory;
|
||||
import client.creator.CharacterFactoryRecipe;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import server.MapleItemInformationProvider;
|
||||
|
||||
/**
|
||||
@@ -53,9 +53,9 @@ public class BowmanCreator extends CharacterFactory {
|
||||
giveEquipment(recipe, ii, weapons[i]);
|
||||
}
|
||||
|
||||
giveItem(recipe, 2000002, 100, MapleInventoryType.USE);
|
||||
giveItem(recipe, 2000003, 100, MapleInventoryType.USE);
|
||||
giveItem(recipe, 3010000, 1, MapleInventoryType.SETUP);
|
||||
giveItem(recipe, 2000002, 100, InventoryType.USE);
|
||||
giveItem(recipe, 2000003, 100, InventoryType.USE);
|
||||
giveItem(recipe, 3010000, 1, InventoryType.SETUP);
|
||||
|
||||
return recipe;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public class BowmanCreator extends CharacterFactory {
|
||||
recipe.addStartingEquipment(nEquip);
|
||||
}
|
||||
|
||||
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, MapleInventoryType itemType) {
|
||||
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
|
||||
recipe.addStartingItem(itemid, quantity, itemType);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ import client.Skill;
|
||||
import client.SkillFactory;
|
||||
import client.creator.CharacterFactory;
|
||||
import client.creator.CharacterFactoryRecipe;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import constants.skills.Magician;
|
||||
import server.MapleItemInformationProvider;
|
||||
|
||||
@@ -61,9 +61,9 @@ public class MagicianCreator extends CharacterFactory {
|
||||
giveEquipment(recipe, ii, weapons[i]);
|
||||
}
|
||||
|
||||
giveItem(recipe, 2000001, 100, MapleInventoryType.USE);
|
||||
giveItem(recipe, 2000006, 100, MapleInventoryType.USE);
|
||||
giveItem(recipe, 3010000, 1, MapleInventoryType.SETUP);
|
||||
giveItem(recipe, 2000001, 100, InventoryType.USE);
|
||||
giveItem(recipe, 2000006, 100, InventoryType.USE);
|
||||
giveItem(recipe, 3010000, 1, InventoryType.SETUP);
|
||||
|
||||
if(improveSp > 0) {
|
||||
improveSp += 5;
|
||||
@@ -88,7 +88,7 @@ public class MagicianCreator extends CharacterFactory {
|
||||
recipe.addStartingEquipment(nEquip);
|
||||
}
|
||||
|
||||
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, MapleInventoryType itemType) {
|
||||
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
|
||||
recipe.addStartingItem(itemid, quantity, itemType);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ import client.MapleClient;
|
||||
import client.MapleJob;
|
||||
import client.creator.CharacterFactory;
|
||||
import client.creator.CharacterFactoryRecipe;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import server.MapleItemInformationProvider;
|
||||
|
||||
/**
|
||||
@@ -55,11 +55,11 @@ public class PirateCreator extends CharacterFactory {
|
||||
giveEquipment(recipe, ii, weapons[i]);
|
||||
}
|
||||
|
||||
giveItem(recipe, 2330000, 800, MapleInventoryType.USE);
|
||||
giveItem(recipe, 2330000, 800, InventoryType.USE);
|
||||
|
||||
giveItem(recipe, 2000002, 100, MapleInventoryType.USE);
|
||||
giveItem(recipe, 2000003, 100, MapleInventoryType.USE);
|
||||
giveItem(recipe, 3010000, 1, MapleInventoryType.SETUP);
|
||||
giveItem(recipe, 2000002, 100, InventoryType.USE);
|
||||
giveItem(recipe, 2000003, 100, InventoryType.USE);
|
||||
giveItem(recipe, 3010000, 1, InventoryType.SETUP);
|
||||
|
||||
return recipe;
|
||||
}
|
||||
@@ -69,7 +69,7 @@ public class PirateCreator extends CharacterFactory {
|
||||
recipe.addStartingEquipment(nEquip);
|
||||
}
|
||||
|
||||
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, MapleInventoryType itemType) {
|
||||
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
|
||||
recipe.addStartingItem(itemid, quantity, itemType);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ import client.MapleClient;
|
||||
import client.MapleJob;
|
||||
import client.creator.CharacterFactory;
|
||||
import client.creator.CharacterFactoryRecipe;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import server.MapleItemInformationProvider;
|
||||
|
||||
/**
|
||||
@@ -53,11 +53,11 @@ public class ThiefCreator extends CharacterFactory {
|
||||
giveEquipment(recipe, ii, weapons[i]);
|
||||
}
|
||||
|
||||
giveItem(recipe, 2070000, 500, MapleInventoryType.USE);
|
||||
giveItem(recipe, 2070000, 500, InventoryType.USE);
|
||||
|
||||
giveItem(recipe, 2000002, 100, MapleInventoryType.USE);
|
||||
giveItem(recipe, 2000003, 100, MapleInventoryType.USE);
|
||||
giveItem(recipe, 3010000, 1, MapleInventoryType.SETUP);
|
||||
giveItem(recipe, 2000002, 100, InventoryType.USE);
|
||||
giveItem(recipe, 2000003, 100, InventoryType.USE);
|
||||
giveItem(recipe, 3010000, 1, InventoryType.SETUP);
|
||||
|
||||
return recipe;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public class ThiefCreator extends CharacterFactory {
|
||||
recipe.addStartingEquipment(nEquip);
|
||||
}
|
||||
|
||||
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, MapleInventoryType itemType) {
|
||||
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
|
||||
recipe.addStartingItem(itemid, quantity, itemType);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ import client.Skill;
|
||||
import client.SkillFactory;
|
||||
import client.creator.CharacterFactory;
|
||||
import client.creator.CharacterFactoryRecipe;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import constants.skills.Warrior;
|
||||
import server.MapleItemInformationProvider;
|
||||
|
||||
@@ -76,9 +76,9 @@ public class WarriorCreator extends CharacterFactory {
|
||||
}
|
||||
}
|
||||
|
||||
giveItem(recipe, 2000002, 100, MapleInventoryType.USE);
|
||||
giveItem(recipe, 2000003, 100, MapleInventoryType.USE);
|
||||
giveItem(recipe, 3010000, 1, MapleInventoryType.SETUP);
|
||||
giveItem(recipe, 2000002, 100, InventoryType.USE);
|
||||
giveItem(recipe, 2000003, 100, InventoryType.USE);
|
||||
giveItem(recipe, 3010000, 1, InventoryType.SETUP);
|
||||
|
||||
return recipe;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ public class WarriorCreator extends CharacterFactory {
|
||||
recipe.addStartingEquipment(nEquip);
|
||||
}
|
||||
|
||||
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, MapleInventoryType itemType) {
|
||||
private static void giveItem(CharacterFactoryRecipe recipe, int itemid, int quantity, InventoryType itemType) {
|
||||
recipe.addStartingItem(itemid, quantity, itemType);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,14 +41,14 @@ import java.util.concurrent.locks.Lock;
|
||||
*/
|
||||
public class Inventory implements Iterable<Item> {
|
||||
protected final Map<Short, Item> inventory;
|
||||
protected final MapleInventoryType type;
|
||||
protected final InventoryType type;
|
||||
protected final Lock lock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.INVENTORY, true);
|
||||
|
||||
protected MapleCharacter owner;
|
||||
protected byte slotLimit;
|
||||
protected boolean checked = false;
|
||||
|
||||
public Inventory(MapleCharacter mc, MapleInventoryType type, byte slotLimit) {
|
||||
public Inventory(MapleCharacter mc, InventoryType type, byte slotLimit) {
|
||||
this.owner = mc;
|
||||
this.inventory = new LinkedHashMap<>();
|
||||
this.type = type;
|
||||
@@ -56,11 +56,11 @@ public class Inventory implements Iterable<Item> {
|
||||
}
|
||||
|
||||
public boolean isExtendableInventory() { // not sure about cash, basing this on the previous one.
|
||||
return !(type.equals(MapleInventoryType.UNDEFINED) || type.equals(MapleInventoryType.EQUIPPED) || type.equals(MapleInventoryType.CASH));
|
||||
return !(type.equals(InventoryType.UNDEFINED) || type.equals(InventoryType.EQUIPPED) || type.equals(InventoryType.CASH));
|
||||
}
|
||||
|
||||
public boolean isEquipInventory() {
|
||||
return type.equals(MapleInventoryType.EQUIP) || type.equals(MapleInventoryType.EQUIPPED);
|
||||
return type.equals(InventoryType.EQUIP) || type.equals(InventoryType.EQUIPPED);
|
||||
}
|
||||
|
||||
public byte getSlotLimit() {
|
||||
@@ -223,7 +223,7 @@ public class Inventory implements Iterable<Item> {
|
||||
}
|
||||
|
||||
public void addItemFromDB(Item item) {
|
||||
if (item.getPosition() < 0 && !type.equals(MapleInventoryType.EQUIPPED)) {
|
||||
if (item.getPosition() < 0 && !type.equals(InventoryType.EQUIPPED)) {
|
||||
return;
|
||||
}
|
||||
addSlotFromDB(item.getPosition(), item);
|
||||
@@ -246,7 +246,7 @@ public class Inventory implements Iterable<Item> {
|
||||
inventory.put(dSlot, source);
|
||||
inventory.remove(sSlot);
|
||||
} else if (target.getItemId() == source.getItemId() && !ItemConstants.isRechargeable(source.getItemId()) && isSameOwner(source, target)) {
|
||||
if (type.getType() == MapleInventoryType.EQUIP.getType() || type.getType() == MapleInventoryType.CASH.getType()) {
|
||||
if (type.getType() == InventoryType.EQUIP.getType() || type.getType() == InventoryType.CASH.getType()) {
|
||||
swap(target, source);
|
||||
} else if (source.getQuantity() + target.getQuantity() > slotMax) {
|
||||
short rest = (short) ((source.getQuantity() + target.getQuantity()) - slotMax);
|
||||
@@ -420,11 +420,11 @@ public class Inventory implements Iterable<Item> {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean checkItemRestricted(List<Pair<Item, MapleInventoryType>> items) {
|
||||
private static boolean checkItemRestricted(List<Pair<Item, InventoryType>> items) {
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
|
||||
// thanks Shavit for noticing set creation that would be only effective in rare situations
|
||||
for (Pair<Item, MapleInventoryType> p : items) {
|
||||
for (Pair<Item, InventoryType> p : items) {
|
||||
int itemid = p.getLeft().getItemId();
|
||||
if (ii.isPickupRestricted(itemid) && p.getLeft().getQuantity() > 1) {
|
||||
return false;
|
||||
@@ -439,7 +439,7 @@ public class Inventory implements Iterable<Item> {
|
||||
}
|
||||
|
||||
public static boolean checkSpot(MapleCharacter chr, List<Item> items) {
|
||||
List<Pair<Item, MapleInventoryType>> listItems = new LinkedList<>();
|
||||
List<Pair<Item, InventoryType>> listItems = new LinkedList<>();
|
||||
for (Item item : items) {
|
||||
listItems.add(new Pair<>(item, item.getInventoryType()));
|
||||
}
|
||||
@@ -447,12 +447,12 @@ public class Inventory implements Iterable<Item> {
|
||||
return checkSpotsAndOwnership(chr, listItems);
|
||||
}
|
||||
|
||||
public static boolean checkSpots(MapleCharacter chr, List<Pair<Item, MapleInventoryType>> items) {
|
||||
public static boolean checkSpots(MapleCharacter chr, List<Pair<Item, InventoryType>> items) {
|
||||
return checkSpots(chr, items, false);
|
||||
}
|
||||
|
||||
public static boolean checkSpots(MapleCharacter chr, List<Pair<Item, MapleInventoryType>> items, boolean useProofInv) {
|
||||
int invTypesSize = MapleInventoryType.values().length;
|
||||
public static boolean checkSpots(MapleCharacter chr, List<Pair<Item, InventoryType>> items, boolean useProofInv) {
|
||||
int invTypesSize = InventoryType.values().length;
|
||||
List<Integer> zeroedList = new ArrayList<>(invTypesSize);
|
||||
for (byte i = 0; i < invTypesSize; i++) {
|
||||
zeroedList.add(0);
|
||||
@@ -461,7 +461,7 @@ public class Inventory implements Iterable<Item> {
|
||||
return checkSpots(chr, items, zeroedList, useProofInv);
|
||||
}
|
||||
|
||||
public static boolean checkSpots(MapleCharacter chr, List<Pair<Item, MapleInventoryType>> items, List<Integer> typesSlotsUsed, boolean useProofInv) {
|
||||
public static boolean checkSpots(MapleCharacter chr, List<Pair<Item, InventoryType>> items, List<Integer> typesSlotsUsed, boolean useProofInv) {
|
||||
// assumption: no "UNDEFINED" or "EQUIPPED" items shall be tested here, all counts are >= 0.
|
||||
|
||||
if (!checkItemRestricted(items)) {
|
||||
@@ -471,7 +471,7 @@ public class Inventory implements Iterable<Item> {
|
||||
Map<Integer, List<Integer>> rcvItems = new LinkedHashMap<>();
|
||||
Map<Integer, Byte> rcvTypes = new LinkedHashMap<>();
|
||||
|
||||
for (Pair<Item, MapleInventoryType> item : items) {
|
||||
for (Pair<Item, InventoryType> item : items) {
|
||||
Integer itemId = item.left.getItemId();
|
||||
List<Integer> qty = rcvItems.get(itemId);
|
||||
|
||||
@@ -528,11 +528,11 @@ public class Inventory implements Iterable<Item> {
|
||||
return (itemId.longValue() << 32L) + fnvHash32(owner);
|
||||
}
|
||||
|
||||
public static boolean checkSpotsAndOwnership(MapleCharacter chr, List<Pair<Item, MapleInventoryType>> items) {
|
||||
public static boolean checkSpotsAndOwnership(MapleCharacter chr, List<Pair<Item, InventoryType>> items) {
|
||||
return checkSpotsAndOwnership(chr, items, false);
|
||||
}
|
||||
|
||||
public static boolean checkSpotsAndOwnership(MapleCharacter chr, List<Pair<Item, MapleInventoryType>> items, boolean useProofInv) {
|
||||
public static boolean checkSpotsAndOwnership(MapleCharacter chr, List<Pair<Item, InventoryType>> items, boolean useProofInv) {
|
||||
List<Integer> zeroedList = new ArrayList<>(5);
|
||||
for (byte i = 0; i < 5; i++) {
|
||||
zeroedList.add(0);
|
||||
@@ -541,7 +541,7 @@ public class Inventory implements Iterable<Item> {
|
||||
return checkSpotsAndOwnership(chr, items, zeroedList, useProofInv);
|
||||
}
|
||||
|
||||
public static boolean checkSpotsAndOwnership(MapleCharacter chr, List<Pair<Item, MapleInventoryType>> items, List<Integer> typesSlotsUsed, boolean useProofInv) {
|
||||
public static boolean checkSpotsAndOwnership(MapleCharacter chr, List<Pair<Item, InventoryType>> items, List<Integer> typesSlotsUsed, boolean useProofInv) {
|
||||
//assumption: no "UNDEFINED" or "EQUIPPED" items shall be tested here, all counts are >= 0 and item list to be checked is a legal one.
|
||||
|
||||
if (!checkItemRestricted(items)) {
|
||||
@@ -552,7 +552,7 @@ public class Inventory implements Iterable<Item> {
|
||||
Map<Long, Byte> rcvTypes = new LinkedHashMap<>();
|
||||
Map<Long, String> rcvOwners = new LinkedHashMap<>();
|
||||
|
||||
for (Pair<Item, MapleInventoryType> item : items) {
|
||||
for (Pair<Item, InventoryType> item : items) {
|
||||
Long itemHash = hashKey(item.left.getItemId(), item.left.getOwner());
|
||||
List<Integer> qty = rcvItems.get(itemHash);
|
||||
|
||||
@@ -597,7 +597,7 @@ public class Inventory implements Iterable<Item> {
|
||||
return true;
|
||||
}
|
||||
|
||||
public MapleInventoryType getType() {
|
||||
public InventoryType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -610,7 +610,7 @@ public class Inventory implements Iterable<Item> {
|
||||
boolean isRing = false;
|
||||
Equip equip = null;
|
||||
for (Item item : list()) {
|
||||
if (item.getInventoryType().equals(MapleInventoryType.EQUIP)) {
|
||||
if (item.getInventoryType().equals(InventoryType.EQUIP)) {
|
||||
equip = (Equip) item;
|
||||
isRing = equip.getRingId() > -1;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import client.MapleCharacter;
|
||||
public class InventoryProof extends Inventory {
|
||||
|
||||
public InventoryProof(MapleCharacter mc) {
|
||||
super(mc, MapleInventoryType.CANHOLD, (byte) 0);
|
||||
super(mc, InventoryType.CANHOLD, (byte) 0);
|
||||
}
|
||||
|
||||
public void cloneContents(Inventory inv) {
|
||||
|
||||
@@ -24,7 +24,7 @@ package client.inventory;
|
||||
/**
|
||||
* @author Matze
|
||||
*/
|
||||
public enum MapleInventoryType {
|
||||
public enum InventoryType {
|
||||
UNDEFINED(0),
|
||||
EQUIP(1),
|
||||
USE(2),
|
||||
@@ -33,9 +33,10 @@ public enum MapleInventoryType {
|
||||
CASH(5),
|
||||
CANHOLD(6), //Proof-guard for inserting after removal checks
|
||||
EQUIPPED(-1); //Seems nexon screwed something when removing an item T_T
|
||||
|
||||
final byte type;
|
||||
|
||||
private MapleInventoryType(int type) {
|
||||
InventoryType(int type) {
|
||||
this.type = (byte) type;
|
||||
}
|
||||
|
||||
@@ -47,8 +48,8 @@ public enum MapleInventoryType {
|
||||
return (short) (2 << type);
|
||||
}
|
||||
|
||||
public static MapleInventoryType getByType(byte type) {
|
||||
for (MapleInventoryType l : MapleInventoryType.values()) {
|
||||
public static InventoryType getByType(byte type) {
|
||||
for (InventoryType l : InventoryType.values()) {
|
||||
if (l.getType() == type) {
|
||||
return l;
|
||||
}
|
||||
@@ -56,18 +57,14 @@ public enum MapleInventoryType {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static MapleInventoryType getByWZName(String name) {
|
||||
if (name.equals("Install")) {
|
||||
return SETUP;
|
||||
} else if (name.equals("Consume")) {
|
||||
return USE;
|
||||
} else if (name.equals("Etc")) {
|
||||
return ETC;
|
||||
} else if (name.equals("Cash")) {
|
||||
return CASH;
|
||||
} else if (name.equals("Pet")) {
|
||||
return CASH;
|
||||
}
|
||||
return UNDEFINED;
|
||||
public static InventoryType getByWZName(String name) {
|
||||
return switch (name) {
|
||||
case "Install" -> SETUP;
|
||||
case "Consume" -> USE;
|
||||
case "Etc" -> ETC;
|
||||
case "Cash" -> CASH;
|
||||
case "Pet" -> CASH;
|
||||
default -> UNDEFINED;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -21,13 +21,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package client.inventory;
|
||||
|
||||
import client.inventory.manipulator.MapleKarmaManipulator;
|
||||
import constants.inventory.ItemConstants;
|
||||
import server.MapleItemInformationProvider;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import client.inventory.manipulator.MapleKarmaManipulator;
|
||||
import server.MapleItemInformationProvider;
|
||||
|
||||
public class Item implements Comparable<Item> {
|
||||
|
||||
@@ -104,7 +105,7 @@ public class Item implements Comparable<Item> {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public MapleInventoryType getInventoryType() {
|
||||
public InventoryType getInventoryType() {
|
||||
return ItemConstants.getInventoryType(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,16 +66,16 @@ public enum ItemFactory {
|
||||
return value;
|
||||
}
|
||||
|
||||
public List<Pair<Item, MapleInventoryType>> loadItems(int id, boolean login) throws SQLException {
|
||||
public List<Pair<Item, InventoryType>> loadItems(int id, boolean login) throws SQLException {
|
||||
if(value != 6) return loadItemsCommon(id, login);
|
||||
else return loadItemsMerchant(id, login);
|
||||
}
|
||||
|
||||
public void saveItems(List<Pair<Item, MapleInventoryType>> items, int id, Connection con) throws SQLException {
|
||||
public void saveItems(List<Pair<Item, InventoryType>> items, int id, Connection con) throws SQLException {
|
||||
saveItems(items, null, id, con);
|
||||
}
|
||||
|
||||
public void saveItems(List<Pair<Item, MapleInventoryType>> items, List<Short> bundlesList, int id, Connection con) throws SQLException {
|
||||
public void saveItems(List<Pair<Item, InventoryType>> items, List<Short> bundlesList, int id, Connection con) throws SQLException {
|
||||
// thanks Arufonsu, MedicOP, BHB for pointing a "synchronized" bottleneck here
|
||||
|
||||
if(value != 6) saveItemsCommon(items, id, con);
|
||||
@@ -126,7 +126,7 @@ public enum ItemFactory {
|
||||
query.append("WHERE accountterm.`");
|
||||
query.append(isAccount ? "accountid" : "characterid");
|
||||
query.append("` = ?");
|
||||
query.append(login ? " AND `inventorytype` = " + MapleInventoryType.EQUIPPED.getType() : "");
|
||||
query.append(login ? " AND `inventorytype` = " + InventoryType.EQUIPPED.getType() : "");
|
||||
|
||||
try (Connection con = DatabaseConnection.getConnection()) {
|
||||
try (PreparedStatement ps = con.prepareStatement(query.toString())) {
|
||||
@@ -144,8 +144,8 @@ public enum ItemFactory {
|
||||
return items;
|
||||
}
|
||||
|
||||
private List<Pair<Item, MapleInventoryType>> loadItemsCommon(int id, boolean login) throws SQLException {
|
||||
List<Pair<Item, MapleInventoryType>> items = new ArrayList<>();
|
||||
private List<Pair<Item, InventoryType>> loadItemsCommon(int id, boolean login) throws SQLException {
|
||||
List<Pair<Item, InventoryType>> items = new ArrayList<>();
|
||||
|
||||
try (Connection con = DatabaseConnection.getConnection()) {
|
||||
StringBuilder query = new StringBuilder();
|
||||
@@ -153,7 +153,7 @@ public enum ItemFactory {
|
||||
query.append(account ? "accountid" : "characterid").append("` = ?");
|
||||
|
||||
if (login) {
|
||||
query.append(" AND `inventorytype` = ").append(MapleInventoryType.EQUIPPED.getType());
|
||||
query.append(" AND `inventorytype` = ").append(InventoryType.EQUIPPED.getType());
|
||||
}
|
||||
|
||||
try (PreparedStatement ps = con.prepareStatement(query.toString())) {
|
||||
@@ -162,9 +162,9 @@ public enum ItemFactory {
|
||||
|
||||
try (ResultSet rs = ps.executeQuery()) {
|
||||
while (rs.next()) {
|
||||
MapleInventoryType mit = MapleInventoryType.getByType(rs.getByte("inventorytype"));
|
||||
InventoryType mit = InventoryType.getByType(rs.getByte("inventorytype"));
|
||||
|
||||
if (mit.equals(MapleInventoryType.EQUIP) || mit.equals(MapleInventoryType.EQUIPPED)) {
|
||||
if (mit.equals(InventoryType.EQUIP) || mit.equals(InventoryType.EQUIPPED)) {
|
||||
items.add(new Pair<>(loadEquipFromResultSet(rs), mit));
|
||||
} else {
|
||||
int petid = rs.getInt("petid");
|
||||
@@ -186,7 +186,7 @@ public enum ItemFactory {
|
||||
return items;
|
||||
}
|
||||
|
||||
private void saveItemsCommon(List<Pair<Item, MapleInventoryType>> items, int id, Connection con) throws SQLException {
|
||||
private void saveItemsCommon(List<Pair<Item, InventoryType>> items, int id, Connection con) throws SQLException {
|
||||
Lock lock = locks[id % lockCount];
|
||||
lock.lock();
|
||||
try {
|
||||
@@ -202,9 +202,9 @@ public enum ItemFactory {
|
||||
|
||||
try (PreparedStatement psItem = con.prepareStatement("INSERT INTO `inventoryitems` VALUES (DEFAULT, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS)) {
|
||||
if (!items.isEmpty()) {
|
||||
for (Pair<Item, MapleInventoryType> pair : items) {
|
||||
for (Pair<Item, InventoryType> pair : items) {
|
||||
Item item = pair.getLeft();
|
||||
MapleInventoryType mit = pair.getRight();
|
||||
InventoryType mit = pair.getRight();
|
||||
psItem.setInt(1, value);
|
||||
psItem.setString(2, account ? null : String.valueOf(id));
|
||||
psItem.setString(3, account ? String.valueOf(id) : null);
|
||||
@@ -219,7 +219,7 @@ public enum ItemFactory {
|
||||
psItem.setString(12, item.getGiftFrom());
|
||||
psItem.executeUpdate();
|
||||
|
||||
if (mit.equals(MapleInventoryType.EQUIP) || mit.equals(MapleInventoryType.EQUIPPED)) {
|
||||
if (mit.equals(InventoryType.EQUIP) || mit.equals(InventoryType.EQUIPPED)) {
|
||||
try (PreparedStatement psEquip = con.prepareStatement("INSERT INTO `inventoryequipment` VALUES (DEFAULT, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) {
|
||||
try (ResultSet rs = psItem.getGeneratedKeys()) {
|
||||
if (!rs.next()) {
|
||||
@@ -263,8 +263,8 @@ public enum ItemFactory {
|
||||
}
|
||||
}
|
||||
|
||||
private List<Pair<Item, MapleInventoryType>> loadItemsMerchant(int id, boolean login) throws SQLException {
|
||||
List<Pair<Item, MapleInventoryType>> items = new ArrayList<>();
|
||||
private List<Pair<Item, InventoryType>> loadItemsMerchant(int id, boolean login) throws SQLException {
|
||||
List<Pair<Item, InventoryType>> items = new ArrayList<>();
|
||||
|
||||
try (Connection con = DatabaseConnection.getConnection()) {
|
||||
StringBuilder query = new StringBuilder();
|
||||
@@ -272,7 +272,7 @@ public enum ItemFactory {
|
||||
query.append(account ? "accountid" : "characterid").append("` = ?");
|
||||
|
||||
if (login) {
|
||||
query.append(" AND `inventorytype` = ").append(MapleInventoryType.EQUIPPED.getType());
|
||||
query.append(" AND `inventorytype` = ").append(InventoryType.EQUIPPED.getType());
|
||||
}
|
||||
|
||||
try (PreparedStatement ps = con.prepareStatement(query.toString())) {
|
||||
@@ -292,9 +292,9 @@ public enum ItemFactory {
|
||||
}
|
||||
}
|
||||
|
||||
MapleInventoryType mit = MapleInventoryType.getByType(rs.getByte("inventorytype"));
|
||||
InventoryType mit = InventoryType.getByType(rs.getByte("inventorytype"));
|
||||
|
||||
if (mit.equals(MapleInventoryType.EQUIP) || mit.equals(MapleInventoryType.EQUIPPED)) {
|
||||
if (mit.equals(InventoryType.EQUIP) || mit.equals(InventoryType.EQUIPPED)) {
|
||||
items.add(new Pair<>(loadEquipFromResultSet(rs), mit));
|
||||
} else {
|
||||
if (bundles > 0) {
|
||||
@@ -318,7 +318,7 @@ public enum ItemFactory {
|
||||
return items;
|
||||
}
|
||||
|
||||
private void saveItemsMerchant(List<Pair<Item, MapleInventoryType>> items, List<Short> bundlesList, int id, Connection con) throws SQLException {
|
||||
private void saveItemsMerchant(List<Pair<Item, InventoryType>> items, List<Short> bundlesList, int id, Connection con) throws SQLException {
|
||||
Lock lock = locks[id % lockCount];
|
||||
lock.lock();
|
||||
try {
|
||||
@@ -338,10 +338,10 @@ public enum ItemFactory {
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
for (Pair<Item, MapleInventoryType> pair : items) {
|
||||
for (Pair<Item, InventoryType> pair : items) {
|
||||
final Item item = pair.getLeft();
|
||||
final Short bundles = bundlesList.get(i);
|
||||
final MapleInventoryType mit = pair.getRight();
|
||||
final InventoryType mit = pair.getRight();
|
||||
i++;
|
||||
|
||||
final int genKey;
|
||||
@@ -379,7 +379,7 @@ public enum ItemFactory {
|
||||
}
|
||||
|
||||
// Equipment
|
||||
if (mit.equals(MapleInventoryType.EQUIP) || mit.equals(MapleInventoryType.EQUIPPED)) {
|
||||
if (mit.equals(InventoryType.EQUIP) || mit.equals(InventoryType.EQUIPPED)) {
|
||||
try (PreparedStatement ps = con.prepareStatement("INSERT INTO `inventoryequipment` VALUES (DEFAULT, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) {
|
||||
ps.setInt(1, genKey);
|
||||
|
||||
|
||||
@@ -223,7 +223,7 @@ public class MaplePet extends Item {
|
||||
owner.getMap().broadcastMessage(PacketCreator.petFoodResponse(owner.getId(), slot, enjoyed, false));
|
||||
saveToDb();
|
||||
|
||||
Item petz = owner.getInventory(MapleInventoryType.CASH).getItem(getPosition());
|
||||
Item petz = owner.getInventory(InventoryType.CASH).getItem(getPosition());
|
||||
if (petz != null)
|
||||
owner.forceUpdateItem(petz);
|
||||
}
|
||||
@@ -284,7 +284,7 @@ public class MaplePet extends Item {
|
||||
this.petFlag |= flag.getValue();
|
||||
saveToDb();
|
||||
|
||||
Item petz = owner.getInventory(MapleInventoryType.CASH).getItem(getPosition());
|
||||
Item petz = owner.getInventory(InventoryType.CASH).getItem(getPosition());
|
||||
if (petz != null)
|
||||
owner.forceUpdateItem(petz);
|
||||
}
|
||||
@@ -293,7 +293,7 @@ public class MaplePet extends Item {
|
||||
this.petFlag &= 0xFFFFFFFF ^ flag.getValue();
|
||||
saveToDb();
|
||||
|
||||
Item petz = owner.getInventory(MapleInventoryType.CASH).getItem(getPosition());
|
||||
Item petz = owner.getInventory(InventoryType.CASH).getItem(getPosition());
|
||||
if (petz != null)
|
||||
owner.forceUpdateItem(petz);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class MapleInventoryManipulator {
|
||||
|
||||
public static boolean addById(MapleClient c, int itemId, short quantity, String owner, int petid, short flag, long expiration) {
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
MapleInventoryType type = ItemConstants.getInventoryType(itemId);
|
||||
InventoryType type = ItemConstants.getInventoryType(itemId);
|
||||
|
||||
Inventory inv = chr.getInventory(type);
|
||||
inv.lockInventory();
|
||||
@@ -75,9 +75,9 @@ public class MapleInventoryManipulator {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean addByIdInternal(MapleClient c, MapleCharacter chr, MapleInventoryType type, Inventory inv, int itemId, short quantity, String owner, int petid, short flag, long expiration) {
|
||||
private static boolean addByIdInternal(MapleClient c, MapleCharacter chr, InventoryType type, Inventory inv, int itemId, short quantity, String owner, int petid, short flag, long expiration) {
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
if (!type.equals(MapleInventoryType.EQUIP)) {
|
||||
if (!type.equals(InventoryType.EQUIP)) {
|
||||
short slotMax = ii.getSlotMax(c, itemId);
|
||||
List<Item> existing = inv.listById(itemId);
|
||||
if (!ItemConstants.isRechargeable(itemId) && petid == -1) {
|
||||
@@ -167,7 +167,7 @@ public class MapleInventoryManipulator {
|
||||
|
||||
public static boolean addFromDrop(MapleClient c, Item item, boolean show, int petId) {
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
MapleInventoryType type = item.getInventoryType();
|
||||
InventoryType type = item.getInventoryType();
|
||||
|
||||
Inventory inv = chr.getInventory(type);
|
||||
inv.lockInventory();
|
||||
@@ -178,7 +178,7 @@ public class MapleInventoryManipulator {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean addFromDropInternal(MapleClient c, MapleCharacter chr, MapleInventoryType type, Inventory inv, Item item, boolean show, int petId) {
|
||||
private static boolean addFromDropInternal(MapleClient c, MapleCharacter chr, InventoryType type, Inventory inv, Item item, boolean show, int petId) {
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
int itemid = item.getItemId();
|
||||
if (ii.isPickupRestricted(itemid) && chr.haveItemWithId(itemid, true)) {
|
||||
@@ -188,7 +188,7 @@ public class MapleInventoryManipulator {
|
||||
}
|
||||
short quantity = item.getQuantity();
|
||||
|
||||
if (!type.equals(MapleInventoryType.EQUIP)) {
|
||||
if (!type.equals(InventoryType.EQUIP)) {
|
||||
short slotMax = ii.getSlotMax(c, itemid);
|
||||
List<Item> existing = inv.listById(itemid);
|
||||
if (!ItemConstants.isRechargeable(itemid) && petId == -1) {
|
||||
@@ -274,19 +274,19 @@ public class MapleInventoryManipulator {
|
||||
|
||||
public static boolean checkSpace(MapleClient c, int itemid, int quantity, String owner) {
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
MapleInventoryType type = ItemConstants.getInventoryType(itemid);
|
||||
InventoryType type = ItemConstants.getInventoryType(itemid);
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
Inventory inv = chr.getInventory(type);
|
||||
|
||||
if (ii.isPickupRestricted(itemid)) {
|
||||
if (haveItemWithId(inv, itemid)) {
|
||||
return false;
|
||||
} else if (ItemConstants.isEquipment(itemid) && haveItemWithId(chr.getInventory(MapleInventoryType.EQUIPPED), itemid)) {
|
||||
} else if (ItemConstants.isEquipment(itemid) && haveItemWithId(chr.getInventory(InventoryType.EQUIPPED), itemid)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!type.equals(MapleInventoryType.EQUIP)) {
|
||||
if (!type.equals(InventoryType.EQUIP)) {
|
||||
short slotMax = ii.getSlotMax(c, itemid);
|
||||
List<Item> existing = inv.listById(itemid);
|
||||
|
||||
@@ -329,19 +329,19 @@ public class MapleInventoryManipulator {
|
||||
int returnValue;
|
||||
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
MapleInventoryType type = !useProofInv ? ItemConstants.getInventoryType(itemid) : MapleInventoryType.CANHOLD;
|
||||
InventoryType type = !useProofInv ? ItemConstants.getInventoryType(itemid) : InventoryType.CANHOLD;
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
Inventory inv = chr.getInventory(type);
|
||||
|
||||
if (ii.isPickupRestricted(itemid)) {
|
||||
if (haveItemWithId(inv, itemid)) {
|
||||
return 0;
|
||||
} else if (ItemConstants.isEquipment(itemid) && haveItemWithId(chr.getInventory(MapleInventoryType.EQUIPPED), itemid)) {
|
||||
} else if (ItemConstants.isEquipment(itemid) && haveItemWithId(chr.getInventory(InventoryType.EQUIPPED), itemid)) {
|
||||
return 0; // thanks Captain & Aika & Vcoc for pointing out inventory checkup on player trades missing out one-of-a-kind items.
|
||||
}
|
||||
}
|
||||
|
||||
if (!type.equals(MapleInventoryType.EQUIP)) {
|
||||
if (!type.equals(InventoryType.EQUIP)) {
|
||||
short slotMax = ii.getSlotMax(c, itemid);
|
||||
final int numSlotsNeeded;
|
||||
|
||||
@@ -383,17 +383,17 @@ public class MapleInventoryManipulator {
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public static void removeFromSlot(MapleClient c, MapleInventoryType type, short slot, short quantity, boolean fromDrop) {
|
||||
public static void removeFromSlot(MapleClient c, InventoryType type, short slot, short quantity, boolean fromDrop) {
|
||||
removeFromSlot(c, type, slot, quantity, fromDrop, false);
|
||||
}
|
||||
|
||||
public static void removeFromSlot(MapleClient c, MapleInventoryType type, short slot, short quantity, boolean fromDrop, boolean consume) {
|
||||
public static void removeFromSlot(MapleClient c, InventoryType type, short slot, short quantity, boolean fromDrop, boolean consume) {
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
Inventory inv = chr.getInventory(type);
|
||||
Item item = inv.getItem(slot);
|
||||
boolean allowZero = consume && ItemConstants.isRechargeable(item.getItemId());
|
||||
|
||||
if(type == MapleInventoryType.EQUIPPED) {
|
||||
if(type == InventoryType.EQUIPPED) {
|
||||
inv.lockInventory();
|
||||
try {
|
||||
chr.unequippedItem((Equip) item);
|
||||
@@ -413,14 +413,14 @@ public class MapleInventoryManipulator {
|
||||
}
|
||||
|
||||
inv.removeItem(slot, quantity, allowZero);
|
||||
if(type != MapleInventoryType.CANHOLD) {
|
||||
if(type != InventoryType.CANHOLD) {
|
||||
announceModifyInventory(c, item, fromDrop, allowZero);
|
||||
}
|
||||
|
||||
// thanks Robin Schulz for noticing pet issues when moving pets out of inventory
|
||||
} else {
|
||||
inv.removeItem(slot, quantity, allowZero);
|
||||
if(type != MapleInventoryType.CANHOLD) {
|
||||
if(type != InventoryType.CANHOLD) {
|
||||
announceModifyInventory(c, item, fromDrop, allowZero);
|
||||
}
|
||||
}
|
||||
@@ -435,13 +435,13 @@ public class MapleInventoryManipulator {
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeById(MapleClient c, MapleInventoryType type, int itemId, int quantity, boolean fromDrop, boolean consume) {
|
||||
public static void removeById(MapleClient c, InventoryType type, int itemId, int quantity, boolean fromDrop, boolean consume) {
|
||||
int removeQuantity = quantity;
|
||||
Inventory inv = c.getPlayer().getInventory(type);
|
||||
int slotLimit = type == MapleInventoryType.EQUIPPED ? 128 : inv.getSlotLimit();
|
||||
int slotLimit = type == InventoryType.EQUIPPED ? 128 : inv.getSlotLimit();
|
||||
|
||||
for (short i = 0; i <= slotLimit; i++) {
|
||||
Item item = inv.getItem((short) (type == MapleInventoryType.EQUIPPED ? -i : i));
|
||||
Item item = inv.getItem((short) (type == InventoryType.EQUIPPED ? -i : i));
|
||||
if (item != null) {
|
||||
if (item.getItemId() == itemId || item.getCashId() == itemId) {
|
||||
if (removeQuantity <= item.getQuantity()) {
|
||||
@@ -455,7 +455,7 @@ public class MapleInventoryManipulator {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (removeQuantity > 0 && type != MapleInventoryType.CANHOLD) {
|
||||
if (removeQuantity > 0 && type != InventoryType.CANHOLD) {
|
||||
throw new RuntimeException("[Hack] Not enough items available of Item:" + itemId + ", Quantity (After Quantity/Over Current Quantity): " + (quantity - removeQuantity) + "/" + quantity);
|
||||
}
|
||||
}
|
||||
@@ -464,7 +464,7 @@ public class MapleInventoryManipulator {
|
||||
return source.getOwner().equals(target.getOwner());
|
||||
}
|
||||
|
||||
public static void move(MapleClient c, MapleInventoryType type, short src, short dst) {
|
||||
public static void move(MapleClient c, InventoryType type, short src, short dst) {
|
||||
Inventory inv = c.getPlayer().getInventory(type);
|
||||
|
||||
if (src < 0 || dst < 0) {
|
||||
@@ -487,7 +487,7 @@ public class MapleInventoryManipulator {
|
||||
short slotMax = ii.getSlotMax(c, source.getItemId());
|
||||
inv.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.isRechargeable(source.getItemId()) && isSameOwner(source, initialTarget)) {
|
||||
if (!(type.equals(InventoryType.EQUIP) || type.equals(InventoryType.CASH)) && initialTarget != null && initialTarget.getItemId() == source.getItemId() && !ItemConstants.isRechargeable(source.getItemId()) && isSameOwner(source, initialTarget)) {
|
||||
if ((olddstQ + oldsrcQ) > slotMax) {
|
||||
mods.add(new ModifyInventory(1, source));
|
||||
mods.add(new ModifyInventory(1, initialTarget));
|
||||
@@ -505,8 +505,8 @@ public class MapleInventoryManipulator {
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
Inventory eqpInv = chr.getInventory(MapleInventoryType.EQUIP);
|
||||
Inventory eqpdInv = chr.getInventory(MapleInventoryType.EQUIPPED);
|
||||
Inventory eqpInv = chr.getInventory(InventoryType.EQUIP);
|
||||
Inventory eqpdInv = chr.getInventory(InventoryType.EQUIPPED);
|
||||
|
||||
Equip source = (Equip) eqpInv.getItem(src);
|
||||
if (source == null || !ii.canWearEquipment(chr, source, dst)) {
|
||||
@@ -620,8 +620,8 @@ public class MapleInventoryManipulator {
|
||||
|
||||
public static void unequip(MapleClient c, short src, short dst) {
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
Inventory eqpInv = chr.getInventory(MapleInventoryType.EQUIP);
|
||||
Inventory eqpdInv = chr.getInventory(MapleInventoryType.EQUIPPED);
|
||||
Inventory eqpInv = chr.getInventory(InventoryType.EQUIP);
|
||||
Inventory eqpdInv = chr.getInventory(InventoryType.EQUIPPED);
|
||||
|
||||
Equip source = (Equip) eqpdInv.getItem(src);
|
||||
Equip target = (Equip) eqpInv.getItem(dst);
|
||||
@@ -679,9 +679,9 @@ public class MapleInventoryManipulator {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void drop(MapleClient c, MapleInventoryType type, short src, short quantity) {
|
||||
public static void drop(MapleClient c, InventoryType type, short src, short quantity) {
|
||||
if (src < 0) {
|
||||
type = MapleInventoryType.EQUIPPED;
|
||||
type = InventoryType.EQUIPPED;
|
||||
}
|
||||
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
@@ -730,7 +730,7 @@ public class MapleInventoryManipulator {
|
||||
map.spawnItemDrop(chr, chr, target, dropPos, true, true);
|
||||
}
|
||||
} else {
|
||||
if (type == MapleInventoryType.EQUIPPED) {
|
||||
if (type == InventoryType.EQUIPPED) {
|
||||
inv.lockInventory();
|
||||
try {
|
||||
chr.unequippedItem((Equip) source);
|
||||
|
||||
@@ -22,8 +22,8 @@ package client.processor.action;
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.inventory.Equip;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import config.YamlConfig;
|
||||
import constants.game.GameConstants;
|
||||
@@ -75,7 +75,7 @@ public class MakerProcessor {
|
||||
p.readInt(); // 1... probably inventory type
|
||||
pos = p.readInt();
|
||||
|
||||
Item it = c.getPlayer().getInventory(MapleInventoryType.EQUIP).getItem((short) pos);
|
||||
Item it = c.getPlayer().getInventory(InventoryType.EQUIP).getItem((short) pos);
|
||||
if(it != null && it.getItemId() == toCreate) {
|
||||
toDisassemble = toCreate;
|
||||
|
||||
@@ -182,7 +182,7 @@ public class MakerProcessor {
|
||||
|
||||
default:
|
||||
if(toDisassemble != -1) {
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.EQUIP, (short) pos, (short) 1, false);
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.EQUIP, (short) pos, (short) 1, false);
|
||||
} else {
|
||||
for (Pair<Integer, Integer> pair : recipe.getReqItems()) {
|
||||
c.getAbstractPlayerInteraction().gainItem(pair.getLeft(), (short) -pair.getRight(), false);
|
||||
|
||||
@@ -24,8 +24,8 @@ package client.processor.action;
|
||||
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 config.YamlConfig;
|
||||
import server.MapleItemInformationProvider;
|
||||
@@ -55,7 +55,7 @@ public class PetAutopotProcessor {
|
||||
|
||||
private boolean cursorOnNextAvailablePot(MapleCharacter chr) {
|
||||
if(toUseList == null) {
|
||||
toUseList = chr.getInventory(MapleInventoryType.USE).linkedListById(itemId);
|
||||
toUseList = chr.getInventory(InventoryType.USE).linkedListById(itemId);
|
||||
}
|
||||
|
||||
toUse = null;
|
||||
@@ -96,7 +96,7 @@ public class PetAutopotProcessor {
|
||||
curHp = chr.getHp();
|
||||
curMp = chr.getMp();
|
||||
|
||||
Inventory useInv = chr.getInventory(MapleInventoryType.USE);
|
||||
Inventory useInv = chr.getInventory(InventoryType.USE);
|
||||
useInv.lockInventory();
|
||||
try {
|
||||
toUse = useInv.getItem(slot);
|
||||
@@ -150,7 +150,7 @@ public class PetAutopotProcessor {
|
||||
|
||||
while (true) {
|
||||
short qtyToUse = (short) Math.min(qtyCount, toUse.getQuantity());
|
||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, slot, qtyToUse, false);
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.USE, slot, qtyToUse, false);
|
||||
|
||||
curHp += (incHp * qtyToUse);
|
||||
curMp += (incMp * qtyToUse);
|
||||
|
||||
@@ -22,7 +22,7 @@ package client.processor.action;
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.SkillFactory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.MaplePet;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import provider.MapleDataProvider;
|
||||
@@ -44,7 +44,7 @@ public class SpawnPetProcessor {
|
||||
if (c.tryacquireClient()) {
|
||||
try {
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
MaplePet pet = chr.getInventory(MapleInventoryType.CASH).getItem(slot).getPet();
|
||||
MaplePet pet = chr.getInventory(InventoryType.CASH).getItem(slot).getPet();
|
||||
if (pet == null) return;
|
||||
|
||||
int petid = pet.getItemId();
|
||||
@@ -60,8 +60,8 @@ public class SpawnPetProcessor {
|
||||
if (petId == -1) {
|
||||
return;
|
||||
}
|
||||
long expiration = chr.getInventory(MapleInventoryType.CASH).getItem(slot).getExpiration();
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.CASH, petid, (short) 1, false, false);
|
||||
long expiration = chr.getInventory(InventoryType.CASH).getItem(slot).getExpiration();
|
||||
MapleInventoryManipulator.removeById(c, InventoryType.CASH, petid, (short) 1, false, false);
|
||||
MapleInventoryManipulator.addById(c, evolveid, (short) 1, null, petId, expiration);
|
||||
|
||||
c.sendPacket(PacketCreator.enableActions());
|
||||
|
||||
@@ -27,9 +27,9 @@ import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.autoban.AutobanFactory;
|
||||
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 config.YamlConfig;
|
||||
@@ -146,7 +146,7 @@ public class DueyProcessor {
|
||||
try {
|
||||
int packageId = rs.getInt("PackageId");
|
||||
|
||||
List<Pair<Item, MapleInventoryType>> dueyItems = ItemFactory.DUEY.loadItems(packageId, false);
|
||||
List<Pair<Item, InventoryType>> dueyItems = ItemFactory.DUEY.loadItems(packageId, false);
|
||||
DueyPackage dueypack;
|
||||
|
||||
if (!dueyItems.isEmpty()) { // in a duey package there's only one item
|
||||
@@ -226,7 +226,7 @@ public class DueyProcessor {
|
||||
}
|
||||
|
||||
private static boolean insertPackageItem(int packageId, Item item) {
|
||||
Pair<Item, MapleInventoryType> dueyItem = new Pair<>(item, MapleInventoryType.getByType(item.getItemType()));
|
||||
Pair<Item, InventoryType> dueyItem = new Pair<>(item, InventoryType.getByType(item.getItemType()));
|
||||
try (Connection con = DatabaseConnection.getConnection()) {
|
||||
ItemFactory.DUEY.saveItems(Collections.singletonList(dueyItem), packageId, con);
|
||||
return true;
|
||||
@@ -241,7 +241,7 @@ public class DueyProcessor {
|
||||
if (invTypeId > 0) {
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
|
||||
MapleInventoryType invType = MapleInventoryType.getByType(invTypeId);
|
||||
InventoryType invType = InventoryType.getByType(invTypeId);
|
||||
Inventory inv = c.getPlayer().getInventory(invType);
|
||||
|
||||
Item item;
|
||||
@@ -324,7 +324,7 @@ public class DueyProcessor {
|
||||
}
|
||||
|
||||
if (quick) {
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.CASH, 5330000, (short) 1, false, false);
|
||||
MapleInventoryManipulator.removeById(c, InventoryType.CASH, 5330000, (short) 1, false, false);
|
||||
}
|
||||
|
||||
int packageId = createPackage(sendMesos, sendMessage, c.getPlayer().getName(), recipientCid, quick);
|
||||
|
||||
@@ -26,9 +26,9 @@ package client.processor.npc;
|
||||
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 net.server.Server;
|
||||
import net.server.world.World;
|
||||
@@ -52,10 +52,10 @@ public class FredrickProcessor {
|
||||
|
||||
private static int[] dailyReminders = new int[]{2, 5, 10, 15, 30, 60, 90, Integer.MAX_VALUE};
|
||||
|
||||
private static byte canRetrieveFromFredrick(MapleCharacter chr, List<Pair<Item, MapleInventoryType>> items) {
|
||||
private static byte canRetrieveFromFredrick(MapleCharacter chr, List<Pair<Item, InventoryType>> items) {
|
||||
if (!Inventory.checkSpotsAndOwnership(chr, items)) {
|
||||
List<Integer> itemids = new LinkedList<>();
|
||||
for (Pair<Item, MapleInventoryType> it : items) {
|
||||
for (Pair<Item, InventoryType> it : items) {
|
||||
itemids.add(it.getLeft().getItemId());
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ public class FredrickProcessor {
|
||||
try {
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
|
||||
List<Pair<Item, MapleInventoryType>> items;
|
||||
List<Pair<Item, InventoryType>> items;
|
||||
try {
|
||||
items = ItemFactory.MERCHANT.loadItems(chr.getId(), false);
|
||||
|
||||
@@ -287,7 +287,7 @@ public class FredrickProcessor {
|
||||
if(merchant != null)
|
||||
merchant.clearItems();
|
||||
|
||||
for (Pair<Item, MapleInventoryType> it : items) {
|
||||
for (Pair<Item, InventoryType> it : items) {
|
||||
Item item = it.getLeft();
|
||||
MapleInventoryManipulator.addFromDrop(chr.getClient(), item, false);
|
||||
String itemName = MapleItemInformationProvider.getInstance().getName(item.getItemId());
|
||||
|
||||
@@ -25,8 +25,8 @@ import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.autoban.AutobanFactory;
|
||||
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;
|
||||
@@ -67,7 +67,7 @@ public class StorageProcessor {
|
||||
c.disconnect(true, false);
|
||||
return;
|
||||
}
|
||||
slot = storage.getSlot(MapleInventoryType.getByType(type), slot);
|
||||
slot = storage.getSlot(InventoryType.getByType(type), slot);
|
||||
Item item = storage.getItem(slot);
|
||||
if (item != null) {
|
||||
if (ii.isPickupRestricted(item.getItemId()) && chr.haveItemWithId(item.getItemId(), true)) {
|
||||
@@ -106,7 +106,7 @@ public class StorageProcessor {
|
||||
short slot = p.readShort();
|
||||
int itemId = p.readInt();
|
||||
short quantity = p.readShort();
|
||||
MapleInventoryType invType = ItemConstants.getInventoryType(itemId);
|
||||
InventoryType invType = ItemConstants.getInventoryType(itemId);
|
||||
Inventory inv = chr.getInventory(invType);
|
||||
if (slot < 1 || slot > inv.getSlotLimit()) { //player inv starts at one
|
||||
AutobanFactory.PACKET_EDIT.alert(c.getPlayer(), c.getPlayer().getName() + " tried to packet edit with storage.");
|
||||
|
||||
@@ -26,8 +26,8 @@ package client.processor.stat;
|
||||
import client.*;
|
||||
import client.autoban.AutobanFactory;
|
||||
import client.inventory.Equip;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import config.YamlConfig;
|
||||
import constants.skills.*;
|
||||
import net.packet.InPacket;
|
||||
@@ -49,7 +49,7 @@ public class AssignAPProcessor {
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
if (chr.getRemainingAp() < 1) return;
|
||||
|
||||
Collection<Item> equippedC = chr.getInventory(MapleInventoryType.EQUIPPED).list();
|
||||
Collection<Item> equippedC = chr.getInventory(InventoryType.EQUIPPED).list();
|
||||
|
||||
c.lockClient();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user