Rename and clean up MapleInventoryManipulator
This commit is contained in:
@@ -27,7 +27,7 @@ import client.creator.CharacterFactoryRecipe;
|
||||
import client.inventory.*;
|
||||
import client.inventory.Equip.StatUpgrade;
|
||||
import client.inventory.manipulator.CashIdGenerator;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import client.inventory.manipulator.InventoryManipulator;
|
||||
import client.keybind.MapleKeyBinding;
|
||||
import client.keybind.MapleQuickslotBinding;
|
||||
import client.newyear.NewYearCardRecord;
|
||||
@@ -911,8 +911,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
inv.lockInventory();
|
||||
try {
|
||||
for(Item item : new ArrayList<>(inv.list())) {
|
||||
if(MapleInventoryManipulator.isSandboxItem(item)) {
|
||||
MapleInventoryManipulator.removeFromSlot(client, invType, item.getPosition(), item.getQuantity(), false);
|
||||
if(InventoryManipulator.isSandboxItem(item)) {
|
||||
InventoryManipulator.removeFromSlot(client, invType, item.getPosition(), item.getQuantity(), false);
|
||||
dropMessage(5, "[" + ii.getName(item.getItemId()) + "] has passed its trial conditions and will be removed from your inventory.");
|
||||
}
|
||||
}
|
||||
@@ -1948,7 +1948,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
|
||||
Item mItem = mapitem.getItem();
|
||||
boolean hasSpaceInventory = true;
|
||||
if (mapitem.getItemId() == 4031865 || mapitem.getItemId() == 4031866 || mapitem.getMeso() > 0 || ii.isConsumeOnPickup(mapitem.getItemId()) || (hasSpaceInventory = MapleInventoryManipulator.checkSpace(client, mapitem.getItemId(), mItem.getQuantity(), mItem.getOwner()))) {
|
||||
if (mapitem.getItemId() == 4031865 || mapitem.getItemId() == 4031866 || mapitem.getMeso() > 0 || ii.isConsumeOnPickup(mapitem.getItemId()) || (hasSpaceInventory = InventoryManipulator.checkSpace(client, mapitem.getItemId(), mItem.getQuantity(), mItem.getOwner()))) {
|
||||
int mapId = this.getMapId();
|
||||
|
||||
if ((mapId > 209000000 && mapId < 209000016) || (mapId >= 990000500 && mapId <= 990000502)) {//happyville trees and guild PQ
|
||||
@@ -1974,7 +1974,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
showHint("You have earned #e#b" + nxGain + " NX#k#n. (" + this.getCashShop().getCash(1) + " NX)", 300);
|
||||
|
||||
this.getMap().pickItemDrop(pickupPacket, mapitem);
|
||||
} else if (MapleInventoryManipulator.addFromDrop(client, mItem, true)) {
|
||||
} else if (InventoryManipulator.addFromDrop(client, mItem, true)) {
|
||||
this.getMap().pickItemDrop(pickupPacket, mapitem);
|
||||
} else {
|
||||
sendPacket(PacketCreator.enableActions());
|
||||
@@ -2011,7 +2011,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
if (info != null && info.runOnPickup()) {
|
||||
itemScript = info;
|
||||
} else {
|
||||
if (!MapleInventoryManipulator.addFromDrop(client, mItem, true)) {
|
||||
if (!InventoryManipulator.addFromDrop(client, mItem, true)) {
|
||||
sendPacket(PacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
@@ -2023,7 +2023,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
|
||||
showHint("You have earned #e#b" + nxGain + " NX#k#n. (" + this.getCashShop().getCash(1) + " NX)", 300);
|
||||
} else if (applyConsumeOnPickup(mItem.getItemId())) {
|
||||
} else if (MapleInventoryManipulator.addFromDrop(client, mItem, true)) {
|
||||
} else if (InventoryManipulator.addFromDrop(client, mItem, true)) {
|
||||
if (mItem.getItemId() == 4031868) {
|
||||
updateAriantScore();
|
||||
}
|
||||
@@ -2980,7 +2980,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
|
||||
if(!toberemove.isEmpty()) {
|
||||
for (Item item : toberemove) {
|
||||
MapleInventoryManipulator.removeFromSlot(client, inv.getType(), item.getPosition(), item.getQuantity(), true);
|
||||
InventoryManipulator.removeFromSlot(client, inv.getType(), item.getPosition(), item.getQuantity(), true);
|
||||
}
|
||||
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
@@ -2994,7 +2994,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
}
|
||||
for (Integer itemid : toadd) {
|
||||
MapleInventoryManipulator.addById(client, itemid, (short) 1);
|
||||
InventoryManipulator.addById(client, itemid, (short) 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5547,9 +5547,9 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
if (mpsi.getBundles() >= 2) {
|
||||
Item iItem = mpsi.getItem().copy();
|
||||
iItem.setQuantity((short) (mpsi.getBundles() * iItem.getQuantity()));
|
||||
MapleInventoryManipulator.addFromDrop(this.getClient(), iItem, false);
|
||||
InventoryManipulator.addFromDrop(this.getClient(), iItem, false);
|
||||
} else if (mpsi.isExist()) {
|
||||
MapleInventoryManipulator.addFromDrop(this.getClient(), mpsi.getItem(), true);
|
||||
InventoryManipulator.addFromDrop(this.getClient(), mpsi.getItem(), true);
|
||||
}
|
||||
}
|
||||
mps.closeShop();
|
||||
@@ -6474,8 +6474,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
|
||||
if (YamlConfig.config.server.USE_PERFECT_PITCH && level >= 30) {
|
||||
//milestones?
|
||||
if (MapleInventoryManipulator.checkSpace(client, 4310000, (short) 1, "")) {
|
||||
MapleInventoryManipulator.addById(client, 4310000, (short) 1, "", -1);
|
||||
if (InventoryManipulator.checkSpace(client, 4310000, (short) 1, "")) {
|
||||
InventoryManipulator.addById(client, 4310000, (short) 1, "", -1);
|
||||
}
|
||||
} else if (level == 10) {
|
||||
Runnable r = new Runnable() {
|
||||
@@ -7571,7 +7571,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
if (possesed > 0 && !GameConstants.isDojo(getMapId())) {
|
||||
message("You have used a safety charm, so your EXP points have not been decreased.");
|
||||
MapleInventoryManipulator.removeById(client, ItemConstants.getInventoryType(charmID[i]), charmID[i], 1, true, false);
|
||||
InventoryManipulator.removeById(client, ItemConstants.getInventoryType(charmID[i]), charmID[i], 1, true, false);
|
||||
usedSafetyCharm = true;
|
||||
} else if (getJob() != MapleJob.BEGINNER) { //Hmm...
|
||||
if (!FieldLimit.NO_EXP_DECREASE.check(getMap().getFieldLimit())) { // thanks Conrad for noticing missing FieldLimit check
|
||||
@@ -9391,7 +9391,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
|
||||
if (quantity <= iQuant && iQuant > 0) {
|
||||
MapleInventoryManipulator.removeFromSlot(c, type, (byte) slot, quantity, false);
|
||||
InventoryManipulator.removeFromSlot(c, type, (byte) slot, quantity, false);
|
||||
int recvMesos = ii.getPrice(itemid, quantity);
|
||||
if (recvMesos > 0) {
|
||||
gainMeso(recvMesos, false);
|
||||
@@ -9558,7 +9558,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
statups.put(s.getKey(), newVal);
|
||||
}
|
||||
|
||||
MapleInventoryManipulator.removeFromSlot(c, type, (byte) slot, quantity, false);
|
||||
InventoryManipulator.removeFromSlot(c, type, (byte) slot, quantity, false);
|
||||
}
|
||||
|
||||
public void setShop(MapleShop shop) {
|
||||
|
||||
@@ -28,7 +28,7 @@ import client.MapleClient;
|
||||
import client.command.Command;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import client.inventory.manipulator.InventoryManipulator;
|
||||
|
||||
public class ClearSlotCommand extends Command {
|
||||
{
|
||||
@@ -49,31 +49,31 @@ public class ClearSlotCommand extends Command {
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.EQUIP).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.EQUIP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
InventoryManipulator.removeFromSlot(c, InventoryType.EQUIP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.USE).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.USE, (byte) i, tempItem.getQuantity(), false, false);
|
||||
InventoryManipulator.removeFromSlot(c, InventoryType.USE, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.ETC).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.ETC, (byte) i, tempItem.getQuantity(), false, false);
|
||||
InventoryManipulator.removeFromSlot(c, InventoryType.ETC, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.SETUP).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.SETUP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
InventoryManipulator.removeFromSlot(c, InventoryType.SETUP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
for (int i = 0; i < 101; i++) {
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.CASH).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.CASH, (byte) i, tempItem.getQuantity(), false, false);
|
||||
InventoryManipulator.removeFromSlot(c, InventoryType.CASH, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("All Slots Cleared.");
|
||||
break;
|
||||
@@ -82,7 +82,7 @@ public class ClearSlotCommand extends Command {
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.EQUIP).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.EQUIP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
InventoryManipulator.removeFromSlot(c, InventoryType.EQUIP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("Equipment Slot Cleared.");
|
||||
break;
|
||||
@@ -91,7 +91,7 @@ public class ClearSlotCommand extends Command {
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.USE).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.USE, (byte) i, tempItem.getQuantity(), false, false);
|
||||
InventoryManipulator.removeFromSlot(c, InventoryType.USE, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("Use Slot Cleared.");
|
||||
break;
|
||||
@@ -100,7 +100,7 @@ public class ClearSlotCommand extends Command {
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.SETUP).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.SETUP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
InventoryManipulator.removeFromSlot(c, InventoryType.SETUP, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("Set-Up Slot Cleared.");
|
||||
break;
|
||||
@@ -109,7 +109,7 @@ public class ClearSlotCommand extends Command {
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.ETC).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.ETC, (byte) i, tempItem.getQuantity(), false, false);
|
||||
InventoryManipulator.removeFromSlot(c, InventoryType.ETC, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("ETC Slot Cleared.");
|
||||
break;
|
||||
@@ -118,7 +118,7 @@ public class ClearSlotCommand extends Command {
|
||||
Item tempItem = c.getPlayer().getInventory(InventoryType.CASH).getItem((byte) i);
|
||||
if (tempItem == null)
|
||||
continue;
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.CASH, (byte) i, tempItem.getQuantity(), false, false);
|
||||
InventoryManipulator.removeFromSlot(c, InventoryType.CASH, (byte) i, tempItem.getQuantity(), false, false);
|
||||
}
|
||||
player.yellowMessage("Cash Slot Cleared.");
|
||||
break;
|
||||
|
||||
@@ -27,7 +27,7 @@ import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.command.Command;
|
||||
import client.inventory.Pet;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import client.inventory.manipulator.InventoryManipulator;
|
||||
import config.YamlConfig;
|
||||
import constants.inventory.ItemConstants;
|
||||
import server.MapleItemInformationProvider;
|
||||
@@ -69,7 +69,7 @@ public class ItemCommand extends Command {
|
||||
long expiration = System.currentTimeMillis() + (days * 24 * 60 * 60 * 1000);
|
||||
int petid = Pet.createPet(itemId);
|
||||
|
||||
MapleInventoryManipulator.addById(c, itemId, quantity, player.getName(), petid, expiration);
|
||||
InventoryManipulator.addById(c, itemId, quantity, player.getName(), petid, expiration);
|
||||
return;
|
||||
} else {
|
||||
player.yellowMessage("Pet Syntax: !item <itemid> <expiration>");
|
||||
@@ -83,6 +83,6 @@ public class ItemCommand extends Command {
|
||||
flag |= ItemConstants.UNTRADEABLE;
|
||||
}
|
||||
|
||||
MapleInventoryManipulator.addById(c, itemId, quantity, player.getName(), -1, flag, -1);
|
||||
InventoryManipulator.addById(c, itemId, quantity, player.getName(), -1, flag, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.command.Command;
|
||||
import client.inventory.Pet;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import client.inventory.manipulator.InventoryManipulator;
|
||||
import server.maps.MapleMapItem;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
@@ -63,8 +63,8 @@ public class ForceVacCommand extends Command {
|
||||
if (petId == -1) {
|
||||
continue;
|
||||
}
|
||||
MapleInventoryManipulator.addById(c, mapItem.getItem().getItemId(), mapItem.getItem().getQuantity(), null, petId);
|
||||
} else if (MapleInventoryManipulator.addFromDrop(c, mapItem.getItem(), true)) {
|
||||
InventoryManipulator.addById(c, mapItem.getItem().getItemId(), mapItem.getItem().getQuantity(), null, petId);
|
||||
} else if (InventoryManipulator.addFromDrop(c, mapItem.getItem(), true)) {
|
||||
if (mapItem.getItemId() == 4031868) {
|
||||
player.updateAriantScore();
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import client.command.Command;
|
||||
import client.inventory.Equip;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import client.inventory.manipulator.InventoryManipulator;
|
||||
import constants.inventory.ItemConstants;
|
||||
import server.MapleItemInformationProvider;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class ProItemCommand extends Command {
|
||||
it.setOwner(player.getName());
|
||||
|
||||
hardsetItemStats((Equip) it, stat, spdjmp);
|
||||
MapleInventoryManipulator.addFromDrop(c, it);
|
||||
InventoryManipulator.addFromDrop(c, it);
|
||||
} else {
|
||||
player.dropMessage(6, "Make sure it's an equippable item.");
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ package client.inventory;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import client.inventory.manipulator.InventoryManipulator;
|
||||
import constants.inventory.ItemConstants;
|
||||
import net.server.audit.locks.MonitoredLockType;
|
||||
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
|
||||
@@ -497,7 +497,7 @@ public class Inventory implements Iterable<Item> {
|
||||
for (Integer itValue : it.getValue()) {
|
||||
int usedSlots = typesSlotsUsed.get(itemType);
|
||||
|
||||
int result = MapleInventoryManipulator.checkSpaceProgressively(c, it.getKey(), itValue, "", usedSlots, useProofInv);
|
||||
int result = InventoryManipulator.checkSpaceProgressively(c, it.getKey(), itValue, "", usedSlots, useProofInv);
|
||||
boolean hasSpace = ((result % 2) != 0);
|
||||
|
||||
if (!hasSpace) {
|
||||
@@ -583,7 +583,7 @@ public class Inventory implements Iterable<Item> {
|
||||
|
||||
//System.out.print("inserting " + itemId.intValue() + " with type " + itemType + " qty " + it.getValue() + " owner '" + rcvOwners.get(it.getKey()) + "' current usedSlots:");
|
||||
//for(Integer i : typesSlotsUsed) System.out.print(" " + i);
|
||||
int result = MapleInventoryManipulator.checkSpaceProgressively(c, itemId, itValue, rcvOwners.get(it.getKey()), usedSlots, useProofInv);
|
||||
int result = InventoryManipulator.checkSpaceProgressively(c, itemId, itValue, rcvOwners.get(it.getKey()), usedSlots, useProofInv);
|
||||
boolean hasSpace = ((result % 2) != 0);
|
||||
//System.out.print(" -> hasSpace: " + hasSpace + " RESULT : " + result + "\n");
|
||||
|
||||
|
||||
@@ -40,11 +40,10 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Matze
|
||||
* @author Ronan - improved check space feature and removed redundant object calls
|
||||
*/
|
||||
public class MapleInventoryManipulator {
|
||||
public class InventoryManipulator {
|
||||
|
||||
public static boolean addById(MapleClient c, int itemId, short quantity) {
|
||||
return addById(c, itemId, quantity, null, -1, -1);
|
||||
@@ -65,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();
|
||||
InventoryType type = ItemConstants.getInventoryType(itemId);
|
||||
|
||||
|
||||
Inventory inv = chr.getInventory(type);
|
||||
inv.lockInventory();
|
||||
try {
|
||||
@@ -74,7 +73,7 @@ public class MapleInventoryManipulator {
|
||||
inv.unlockInventory();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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(InventoryType.EQUIP)) {
|
||||
@@ -117,7 +116,9 @@ public class MapleInventoryManipulator {
|
||||
nItem.setOwner(owner);
|
||||
}
|
||||
c.sendPacket(PacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(0, nItem))));
|
||||
if(sandboxItem) chr.setHasSandboxItem();
|
||||
if (sandboxItem) {
|
||||
chr.setHasSandboxItem();
|
||||
}
|
||||
} else {
|
||||
c.sendPacket(PacketCreator.enableActions());
|
||||
return false;
|
||||
@@ -134,7 +135,9 @@ public class MapleInventoryManipulator {
|
||||
return false;
|
||||
}
|
||||
c.sendPacket(PacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(0, nItem))));
|
||||
if(MapleInventoryManipulator.isSandboxItem(nItem)) chr.setHasSandboxItem();
|
||||
if (InventoryManipulator.isSandboxItem(nItem)) {
|
||||
chr.setHasSandboxItem();
|
||||
}
|
||||
}
|
||||
} else if (quantity == 1) {
|
||||
Item nEquip = ii.getEquipById(itemId);
|
||||
@@ -150,17 +153,19 @@ public class MapleInventoryManipulator {
|
||||
return false;
|
||||
}
|
||||
c.sendPacket(PacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(0, nEquip))));
|
||||
if(MapleInventoryManipulator.isSandboxItem(nEquip)) chr.setHasSandboxItem();
|
||||
if (InventoryManipulator.isSandboxItem(nEquip)) {
|
||||
chr.setHasSandboxItem();
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("Trying to create equip with non-one quantity");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static boolean addFromDrop(MapleClient c, Item item) {
|
||||
return addFromDrop(c, item, true);
|
||||
}
|
||||
|
||||
|
||||
public static boolean addFromDrop(MapleClient c, Item item, boolean show) {
|
||||
return addFromDrop(c, item, show, item.getPetId());
|
||||
}
|
||||
@@ -168,7 +173,7 @@ public class MapleInventoryManipulator {
|
||||
public static boolean addFromDrop(MapleClient c, Item item, boolean show, int petId) {
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
InventoryType type = item.getInventoryType();
|
||||
|
||||
|
||||
Inventory inv = chr.getInventory(type);
|
||||
inv.lockInventory();
|
||||
try {
|
||||
@@ -177,7 +182,7 @@ public class MapleInventoryManipulator {
|
||||
inv.unlockInventory();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
@@ -227,7 +232,9 @@ public class MapleInventoryManipulator {
|
||||
nItem.setPosition(newSlot);
|
||||
item.setPosition(newSlot);
|
||||
c.sendPacket(PacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(0, nItem))));
|
||||
if (MapleInventoryManipulator.isSandboxItem(nItem)) chr.setHasSandboxItem();
|
||||
if (InventoryManipulator.isSandboxItem(nItem)) {
|
||||
chr.setHasSandboxItem();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Item nItem = new Item(itemid, (short) 0, quantity, petId);
|
||||
@@ -243,7 +250,9 @@ public class MapleInventoryManipulator {
|
||||
nItem.setPosition(newSlot);
|
||||
item.setPosition(newSlot);
|
||||
c.sendPacket(PacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(0, nItem))));
|
||||
if (MapleInventoryManipulator.isSandboxItem(nItem)) chr.setHasSandboxItem();
|
||||
if (InventoryManipulator.isSandboxItem(nItem)) {
|
||||
chr.setHasSandboxItem();
|
||||
}
|
||||
c.sendPacket(PacketCreator.enableActions());
|
||||
}
|
||||
} else if (quantity == 1) {
|
||||
@@ -255,7 +264,9 @@ public class MapleInventoryManipulator {
|
||||
}
|
||||
item.setPosition(newSlot);
|
||||
c.sendPacket(PacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(0, item))));
|
||||
if (MapleInventoryManipulator.isSandboxItem(item)) chr.setHasSandboxItem();
|
||||
if (InventoryManipulator.isSandboxItem(item)) {
|
||||
chr.setHasSandboxItem();
|
||||
}
|
||||
} else {
|
||||
FilePrinter.printError(FilePrinter.ITEM, "Tried to pickup Equip id " + itemid + " containing more than 1 quantity --> " + quantity);
|
||||
c.sendPacket(PacketCreator.getInventoryFull());
|
||||
@@ -267,17 +278,17 @@ public class MapleInventoryManipulator {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private static boolean haveItemWithId(Inventory inv, int itemid) {
|
||||
return inv.findById(itemid) != null;
|
||||
}
|
||||
|
||||
|
||||
public static boolean checkSpace(MapleClient c, int itemid, int quantity, String owner) {
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
InventoryType type = ItemConstants.getInventoryType(itemid);
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
Inventory inv = chr.getInventory(type);
|
||||
|
||||
|
||||
if (ii.isPickupRestricted(itemid)) {
|
||||
if (haveItemWithId(inv, itemid)) {
|
||||
return false;
|
||||
@@ -285,11 +296,11 @@ public class MapleInventoryManipulator {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!type.equals(InventoryType.EQUIP)) {
|
||||
short slotMax = ii.getSlotMax(c, itemid);
|
||||
List<Item> existing = inv.listById(itemid);
|
||||
|
||||
|
||||
final int numSlotsNeeded;
|
||||
if (ItemConstants.isRechargeable(itemid)) {
|
||||
numSlotsNeeded = 1;
|
||||
@@ -307,14 +318,14 @@ public class MapleInventoryManipulator {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (slotMax > 0) {
|
||||
numSlotsNeeded = (int) (Math.ceil(((double) quantity) / slotMax));
|
||||
} else {
|
||||
numSlotsNeeded = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return !inv.isFull(numSlotsNeeded - 1);
|
||||
} else {
|
||||
return !inv.isFull();
|
||||
@@ -325,14 +336,14 @@ public class MapleInventoryManipulator {
|
||||
// return value --> bit0: if has space for this one;
|
||||
// value after: new slots filled;
|
||||
// assumption: equipments always have slotMax == 1.
|
||||
|
||||
|
||||
int returnValue;
|
||||
|
||||
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
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;
|
||||
@@ -340,16 +351,16 @@ public class MapleInventoryManipulator {
|
||||
return 0; // thanks Captain & Aika & Vcoc for pointing out inventory checkup on player trades missing out one-of-a-kind items.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!type.equals(InventoryType.EQUIP)) {
|
||||
short slotMax = ii.getSlotMax(c, itemid);
|
||||
final int numSlotsNeeded;
|
||||
|
||||
|
||||
if (ItemConstants.isRechargeable(itemid)) {
|
||||
numSlotsNeeded = 1;
|
||||
} else {
|
||||
List<Item> existing = inv.listById(itemid);
|
||||
|
||||
|
||||
if (existing.size() > 0) // first update all existing slots to slotMax
|
||||
{
|
||||
for (Item eItem : existing) {
|
||||
@@ -363,14 +374,14 @@ public class MapleInventoryManipulator {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (slotMax > 0) {
|
||||
numSlotsNeeded = (int) (Math.ceil(((double) quantity) / slotMax));
|
||||
} else {
|
||||
numSlotsNeeded = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
returnValue = ((numSlotsNeeded + usedSlots) << 1);
|
||||
returnValue += (numSlotsNeeded == 0 || !inv.isFullAfterSomeItems(numSlotsNeeded - 1, usedSlots)) ? 1 : 0;
|
||||
//System.out.print(" needed " + numSlotsNeeded + " used " + usedSlots + " rval " + returnValue);
|
||||
@@ -379,7 +390,7 @@ public class MapleInventoryManipulator {
|
||||
returnValue += (!inv.isFullAfterSomeItems(0, usedSlots)) ? 1 : 0;
|
||||
//System.out.print(" eqpneeded " + 1 + " used " + usedSlots + " rval " + returnValue);
|
||||
}
|
||||
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@@ -392,8 +403,8 @@ public class MapleInventoryManipulator {
|
||||
Inventory inv = chr.getInventory(type);
|
||||
Item item = inv.getItem(slot);
|
||||
boolean allowZero = consume && ItemConstants.isRechargeable(item.getItemId());
|
||||
|
||||
if(type == InventoryType.EQUIPPED) {
|
||||
|
||||
if (type == InventoryType.EQUIPPED) {
|
||||
inv.lockInventory();
|
||||
try {
|
||||
chr.unequippedItem((Equip) item);
|
||||
@@ -401,32 +412,32 @@ public class MapleInventoryManipulator {
|
||||
} finally {
|
||||
inv.unlockInventory();
|
||||
}
|
||||
|
||||
|
||||
announceModifyInventory(c, item, fromDrop, allowZero);
|
||||
} else {
|
||||
int petid = item.getPetId();
|
||||
if (petid > -1) { // thanks Vcoc for finding a d/c issue with equipped pets and pets remaining on DB here
|
||||
int petIdx = chr.getPetIndex(petid);
|
||||
if(petIdx > -1) {
|
||||
if (petIdx > -1) {
|
||||
Pet pet = chr.getPet(petIdx);
|
||||
chr.unequipPet(pet, true);
|
||||
}
|
||||
|
||||
|
||||
inv.removeItem(slot, quantity, allowZero);
|
||||
if(type != InventoryType.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 != InventoryType.CANHOLD) {
|
||||
if (type != InventoryType.CANHOLD) {
|
||||
announceModifyInventory(c, item, fromDrop, allowZero);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void announceModifyInventory(MapleClient c, Item item, boolean fromDrop, boolean allowZero) {
|
||||
if (item.getQuantity() == 0 && !allowZero) {
|
||||
c.sendPacket(PacketCreator.modifyInventory(fromDrop, Collections.singletonList(new ModifyInventory(3, item))));
|
||||
@@ -438,8 +449,8 @@ public class MapleInventoryManipulator {
|
||||
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 == InventoryType.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 == InventoryType.EQUIPPED ? -i : i));
|
||||
if (item != null) {
|
||||
@@ -463,14 +474,14 @@ public class MapleInventoryManipulator {
|
||||
private static boolean isSameOwner(Item source, Item target) {
|
||||
return source.getOwner().equals(target.getOwner());
|
||||
}
|
||||
|
||||
|
||||
public static void move(MapleClient c, InventoryType type, short src, short dst) {
|
||||
Inventory inv = c.getPlayer().getInventory(type);
|
||||
|
||||
|
||||
if (src < 0 || dst < 0) {
|
||||
return;
|
||||
}
|
||||
if(dst > inv.getSlotLimit()) {
|
||||
if (dst > inv.getSlotLimit()) {
|
||||
return;
|
||||
}
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
@@ -503,11 +514,11 @@ public class MapleInventoryManipulator {
|
||||
|
||||
public static void equip(MapleClient c, short src, short dst) {
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
|
||||
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
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)) {
|
||||
c.sendPacket(PacketCreator.enableActions());
|
||||
@@ -520,7 +531,7 @@ public class MapleInventoryManipulator {
|
||||
short flag = source.getFlag(); // thanks BHB for noticing flags missing after equipping these
|
||||
flag |= ItemConstants.UNTRADEABLE;
|
||||
source.setFlag(flag);
|
||||
|
||||
|
||||
itemChanged = true;
|
||||
}
|
||||
if (dst == -6) { // unequip the overall
|
||||
@@ -569,11 +580,11 @@ public class MapleInventoryManipulator {
|
||||
chr.getMount().setItemId(source.getItemId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//1112413, 1112414, 1112405 (Lilin's Ring)
|
||||
source = (Equip) eqpInv.getItem(src);
|
||||
eqpInv.removeSlot(src);
|
||||
|
||||
|
||||
Equip target;
|
||||
eqpdInv.lockInventory();
|
||||
try {
|
||||
@@ -591,9 +602,9 @@ public class MapleInventoryManipulator {
|
||||
mods.add(new ModifyInventory(3, source));
|
||||
mods.add(new ModifyInventory(0, source.copy()));//to prevent crashes
|
||||
}
|
||||
|
||||
|
||||
source.setPosition(dst);
|
||||
|
||||
|
||||
eqpdInv.lockInventory();
|
||||
try {
|
||||
if (source.getRingId() > -1) {
|
||||
@@ -604,7 +615,7 @@ public class MapleInventoryManipulator {
|
||||
} finally {
|
||||
eqpdInv.unlockInventory();
|
||||
}
|
||||
|
||||
|
||||
if (target != null) {
|
||||
target.setPosition(src);
|
||||
eqpInv.addItemFromDB(target);
|
||||
@@ -612,7 +623,7 @@ public class MapleInventoryManipulator {
|
||||
if (chr.getBuffedValue(MapleBuffStat.BOOSTER) != null && ItemConstants.isWeapon(source.getItemId())) {
|
||||
chr.cancelBuffStats(MapleBuffStat.BOOSTER);
|
||||
}
|
||||
|
||||
|
||||
mods.add(new ModifyInventory(2, source, src));
|
||||
c.sendPacket(PacketCreator.modifyInventory(true, mods));
|
||||
chr.equipChanged();
|
||||
@@ -622,7 +633,7 @@ public class MapleInventoryManipulator {
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
Inventory eqpInv = chr.getInventory(InventoryType.EQUIP);
|
||||
Inventory eqpdInv = chr.getInventory(InventoryType.EQUIPPED);
|
||||
|
||||
|
||||
Equip source = (Equip) eqpdInv.getItem(src);
|
||||
Equip target = (Equip) eqpInv.getItem(dst);
|
||||
if (dst < 0) {
|
||||
@@ -635,7 +646,7 @@ public class MapleInventoryManipulator {
|
||||
c.sendPacket(PacketCreator.getInventoryFull());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
eqpdInv.lockInventory();
|
||||
try {
|
||||
if (source.getRingId() > -1) {
|
||||
@@ -646,7 +657,7 @@ public class MapleInventoryManipulator {
|
||||
} finally {
|
||||
eqpdInv.unlockInventory();
|
||||
}
|
||||
|
||||
|
||||
if (target != null) {
|
||||
eqpInv.removeSlot(dst);
|
||||
}
|
||||
@@ -659,7 +670,7 @@ public class MapleInventoryManipulator {
|
||||
c.sendPacket(PacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(2, source, src))));
|
||||
chr.equipChanged();
|
||||
}
|
||||
|
||||
|
||||
private static boolean isDisappearingItemDrop(Item it) {
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
if (ii.isDropRestricted(it.getItemId())) {
|
||||
@@ -667,55 +678,49 @@ public class MapleInventoryManipulator {
|
||||
} else if (ii.isCash(it.getItemId())) {
|
||||
if (YamlConfig.config.server.USE_ENFORCE_UNMERCHABLE_CASH) { // thanks Ari for noticing cash drops not available server-side
|
||||
return true;
|
||||
} else if (ItemConstants.isPet(it.getItemId()) && YamlConfig.config.server.USE_ENFORCE_UNMERCHABLE_PET) {
|
||||
return true;
|
||||
}
|
||||
} else return ItemConstants.isPet(it.getItemId()) && YamlConfig.config.server.USE_ENFORCE_UNMERCHABLE_PET;
|
||||
} else if (isDroppedItemRestricted(it)) {
|
||||
return true;
|
||||
} else if (ItemConstants.isWeddingRing(it.getItemId())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
} else return ItemConstants.isWeddingRing(it.getItemId());
|
||||
}
|
||||
|
||||
public static void drop(MapleClient c, InventoryType type, short src, short quantity) {
|
||||
if (src < 0) {
|
||||
type = InventoryType.EQUIPPED;
|
||||
}
|
||||
|
||||
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
Inventory inv = chr.getInventory(type);
|
||||
Item source = inv.getItem(src);
|
||||
|
||||
if (chr.getTrade() != null || chr.getMiniGame() != null || source == null) { //Only check needed would prob be merchants (to see if the player is in one)
|
||||
return;
|
||||
return;
|
||||
}
|
||||
int itemId = source.getItemId();
|
||||
|
||||
|
||||
MapleMap map = chr.getMap();
|
||||
if ((!ItemConstants.isRechargeable(itemId) && source.getQuantity() < quantity) || quantity < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int petid = source.getPetId();
|
||||
if (petid > -1) {
|
||||
int petIdx = chr.getPetIndex(petid);
|
||||
if(petIdx > -1) {
|
||||
if (petIdx > -1) {
|
||||
Pet pet = chr.getPet(petIdx);
|
||||
chr.unequipPet(pet, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Point dropPos = new Point(chr.getPosition());
|
||||
if (quantity < source.getQuantity() && !ItemConstants.isRechargeable(itemId)) {
|
||||
Item target = source.copy();
|
||||
target.setQuantity(quantity);
|
||||
source.setQuantity((short) (source.getQuantity() - quantity));
|
||||
c.sendPacket(PacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(1, source))));
|
||||
|
||||
|
||||
if (ItemConstants.isNewYearCardEtc(itemId)) {
|
||||
if(itemId == 4300000) {
|
||||
if (itemId == 4300000) {
|
||||
NewYearCardRecord.removeAllNewYearCard(true, chr);
|
||||
c.getAbstractPlayerInteraction().removeAll(4300000);
|
||||
} else {
|
||||
@@ -723,7 +728,7 @@ public class MapleInventoryManipulator {
|
||||
c.getAbstractPlayerInteraction().removeAll(4301000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isDisappearingItemDrop(target)) {
|
||||
map.disappearingItemDrop(chr, chr, target, dropPos);
|
||||
} else {
|
||||
@@ -741,7 +746,7 @@ public class MapleInventoryManipulator {
|
||||
} else {
|
||||
inv.removeSlot(src);
|
||||
}
|
||||
|
||||
|
||||
c.sendPacket(PacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(3, source))));
|
||||
if (src < 0) {
|
||||
chr.equipChanged();
|
||||
@@ -754,14 +759,14 @@ public class MapleInventoryManipulator {
|
||||
c.getAbstractPlayerInteraction().removeAll(4301000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isDisappearingItemDrop(source)) {
|
||||
map.disappearingItemDrop(chr, chr, source, dropPos);
|
||||
} else {
|
||||
map.spawnItemDrop(chr, chr, source, dropPos, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int quantityNow = chr.getItemQuantity(itemId, false);
|
||||
if (itemId == chr.getItemEffect()) {
|
||||
if (quantityNow <= 0) {
|
||||
@@ -780,7 +785,7 @@ public class MapleInventoryManipulator {
|
||||
private static boolean isDroppedItemRestricted(Item it) {
|
||||
return YamlConfig.config.server.USE_ERASE_UNTRADEABLE_DROP && it.isUntradeable();
|
||||
}
|
||||
|
||||
|
||||
public static boolean isSandboxItem(Item it) {
|
||||
return (it.getFlag() & ItemConstants.SANDBOX) == ItemConstants.SANDBOX;
|
||||
}
|
||||
@@ -24,7 +24,7 @@ import client.MapleClient;
|
||||
import client.inventory.Equip;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import client.inventory.manipulator.InventoryManipulator;
|
||||
import config.YamlConfig;
|
||||
import constants.game.GameConstants;
|
||||
import constants.inventory.ItemConstants;
|
||||
@@ -182,7 +182,7 @@ public class MakerProcessor {
|
||||
|
||||
default:
|
||||
if(toDisassemble != -1) {
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.EQUIP, (short) pos, (short) 1, false);
|
||||
InventoryManipulator.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);
|
||||
@@ -436,7 +436,7 @@ public class MakerProcessor {
|
||||
eqp = ii.randomizeUpgradeStats(eqp);
|
||||
}
|
||||
|
||||
MapleInventoryManipulator.addFromDrop(c, item, false, -1);
|
||||
InventoryManipulator.addFromDrop(c, item, false, -1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import client.MapleClient;
|
||||
import client.inventory.Inventory;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import client.inventory.manipulator.InventoryManipulator;
|
||||
import config.YamlConfig;
|
||||
import server.MapleItemInformationProvider;
|
||||
import server.MapleStatEffect;
|
||||
@@ -150,7 +150,7 @@ public class PetAutopotProcessor {
|
||||
|
||||
while (true) {
|
||||
short qtyToUse = (short) Math.min(qtyCount, toUse.getQuantity());
|
||||
MapleInventoryManipulator.removeFromSlot(c, InventoryType.USE, slot, qtyToUse, false);
|
||||
InventoryManipulator.removeFromSlot(c, InventoryType.USE, slot, qtyToUse, false);
|
||||
|
||||
curHp += (incHp * qtyToUse);
|
||||
curMp += (incMp * qtyToUse);
|
||||
|
||||
@@ -24,7 +24,7 @@ import client.MapleClient;
|
||||
import client.SkillFactory;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Pet;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import client.inventory.manipulator.InventoryManipulator;
|
||||
import provider.MapleDataProvider;
|
||||
import provider.MapleDataProviderFactory;
|
||||
import provider.MapleDataTool;
|
||||
@@ -61,8 +61,8 @@ public class SpawnPetProcessor {
|
||||
return;
|
||||
}
|
||||
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);
|
||||
InventoryManipulator.removeById(c, InventoryType.CASH, petid, (short) 1, false, false);
|
||||
InventoryManipulator.addById(c, evolveid, (short) 1, null, petId, expiration);
|
||||
|
||||
c.sendPacket(PacketCreator.enableActions());
|
||||
return;
|
||||
|
||||
@@ -30,7 +30,7 @@ import client.inventory.Inventory;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.ItemFactory;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import client.inventory.manipulator.InventoryManipulator;
|
||||
import client.inventory.manipulator.MapleKarmaManipulator;
|
||||
import config.YamlConfig;
|
||||
import constants.inventory.ItemConstants;
|
||||
@@ -254,9 +254,9 @@ public class DueyProcessor {
|
||||
}
|
||||
|
||||
if (ItemConstants.isRechargeable(item.getItemId())) {
|
||||
MapleInventoryManipulator.removeFromSlot(c, invType, itemPos, item.getQuantity(), true);
|
||||
InventoryManipulator.removeFromSlot(c, invType, itemPos, item.getQuantity(), true);
|
||||
} else {
|
||||
MapleInventoryManipulator.removeFromSlot(c, invType, itemPos, amount, true, false);
|
||||
InventoryManipulator.removeFromSlot(c, invType, itemPos, amount, true, false);
|
||||
}
|
||||
|
||||
item = item.copy();
|
||||
@@ -324,7 +324,7 @@ public class DueyProcessor {
|
||||
}
|
||||
|
||||
if (quick) {
|
||||
MapleInventoryManipulator.removeById(c, InventoryType.CASH, 5330000, (short) 1, false, false);
|
||||
InventoryManipulator.removeById(c, InventoryType.CASH, 5330000, (short) 1, false, false);
|
||||
}
|
||||
|
||||
int packageId = createPackage(sendMesos, sendMessage, c.getPlayer().getName(), recipientCid, quick);
|
||||
@@ -409,7 +409,7 @@ public class DueyProcessor {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MapleInventoryManipulator.checkSpace(c, dpItem.getItemId(), dpItem.getQuantity(), dpItem.getOwner())) {
|
||||
if (!InventoryManipulator.checkSpace(c, dpItem.getItemId(), dpItem.getQuantity(), dpItem.getOwner())) {
|
||||
int itemid = dpItem.getItemId();
|
||||
if (MapleItemInformationProvider.getInstance().isPickupRestricted(itemid) && c.getPlayer().getInventory(ItemConstants.getInventoryType(itemid)).findById(itemid) != null) {
|
||||
c.sendPacket(PacketCreator.sendDueyMSG(Actions.TOCLIENT_RECV_RECEIVER_WITH_UNIQUE.getCode()));
|
||||
@@ -419,7 +419,7 @@ public class DueyProcessor {
|
||||
|
||||
return;
|
||||
} else {
|
||||
MapleInventoryManipulator.addFromDrop(c, dpItem, false);
|
||||
InventoryManipulator.addFromDrop(c, dpItem, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import client.inventory.Inventory;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.ItemFactory;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import client.inventory.manipulator.InventoryManipulator;
|
||||
import net.server.Server;
|
||||
import net.server.world.World;
|
||||
import server.MapleItemInformationProvider;
|
||||
@@ -289,7 +289,7 @@ public class FredrickProcessor {
|
||||
|
||||
for (Pair<Item, InventoryType> it : items) {
|
||||
Item item = it.getLeft();
|
||||
MapleInventoryManipulator.addFromDrop(chr.getClient(), item, false);
|
||||
InventoryManipulator.addFromDrop(chr.getClient(), item, false);
|
||||
String itemName = MapleItemInformationProvider.getInstance().getName(item.getItemId());
|
||||
FilePrinter.print(FilePrinter.FREDRICK + chr.getName() + ".txt", chr.getName() + " gained " + item.getQuantity() + " " + itemName + " (" + item.getItemId() + ")");
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import client.autoban.AutobanFactory;
|
||||
import client.inventory.Inventory;
|
||||
import client.inventory.InventoryType;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import client.inventory.manipulator.InventoryManipulator;
|
||||
import client.inventory.manipulator.MapleKarmaManipulator;
|
||||
import config.YamlConfig;
|
||||
import constants.inventory.ItemConstants;
|
||||
@@ -83,12 +83,12 @@ public class StorageProcessor {
|
||||
chr.gainMeso(-takeoutFee, false);
|
||||
}
|
||||
|
||||
if (MapleInventoryManipulator.checkSpace(c, item.getItemId(), item.getQuantity(), item.getOwner())) {
|
||||
if (InventoryManipulator.checkSpace(c, item.getItemId(), item.getQuantity(), item.getOwner())) {
|
||||
if (storage.takeOut(item)) {
|
||||
chr.setUsedStorage();
|
||||
|
||||
MapleKarmaManipulator.toggleKarmaFlagToUntradeable(item);
|
||||
MapleInventoryManipulator.addFromDrop(c, item, false);
|
||||
InventoryManipulator.addFromDrop(c, item, false);
|
||||
|
||||
String itemName = ii.getName(item.getItemId());
|
||||
FilePrinter.print(FilePrinter.STORAGE + c.getAccountName() + ".txt", c.getPlayer().getName() + " took out " + item.getQuantity() + " " + itemName + " (" + item.getItemId() + ")");
|
||||
@@ -142,7 +142,7 @@ public class StorageProcessor {
|
||||
quantity = item.getQuantity();
|
||||
}
|
||||
|
||||
MapleInventoryManipulator.removeFromSlot(c, invType, slot, quantity, false);
|
||||
InventoryManipulator.removeFromSlot(c, invType, slot, quantity, false);
|
||||
} else {
|
||||
c.sendPacket(PacketCreator.enableActions());
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user