Rename and clean up MapleInventoryManipulator

This commit is contained in:
P0nk
2021-09-09 20:55:07 +02:00
parent 7c61df6887
commit b2cbb65c6a
47 changed files with 292 additions and 287 deletions

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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();
}

View File

@@ -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.");
}

View File

@@ -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");

View File

@@ -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;
}

View File

@@ -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;
}
}

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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() + ")");
}

View File

@@ -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;

View File

@@ -25,7 +25,7 @@ import client.MapleCharacter;
import client.MapleClient;
import client.inventory.Inventory;
import client.inventory.InventoryType;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.inventory.manipulator.InventoryManipulator;
import net.AbstractPacketHandler;
import net.packet.InPacket;
import server.MapleItemInformationProvider;
@@ -65,7 +65,7 @@ public final class AdminCommandHandler extends AbstractPacketHandler {
Inventory in = c.getPlayer().getInventory(InventoryType.getByType(type));
for (short i = 1; i <= in.getSlotLimit(); i++) { //TODO What is the point of this loop?
if (in.getItem(i) != null) {
MapleInventoryManipulator.removeFromSlot(c, InventoryType.getByType(type), i, in.getItem(i).getQuantity(), false);
InventoryManipulator.removeFromSlot(c, InventoryType.getByType(type), i, in.getItem(i).getQuantity(), false);
}
return;
}

View File

@@ -28,7 +28,7 @@ import client.inventory.Equip;
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 constants.inventory.ItemConstants;
import net.AbstractPacketHandler;
@@ -361,7 +361,7 @@ public final class CashOperationHandler extends AbstractPacketHandler {
if (chr.getMeso() >= itemPrice) {
if (chr.canHold(itemId)) {
chr.gainMeso(-itemPrice, false);
MapleInventoryManipulator.addById(c, itemId, (short) 1, "", -1);
InventoryManipulator.addById(c, itemId, (short) 1, "", -1);
c.sendPacket(PacketCreator.showBoughtQuestItem(itemId));
}
}

View File

@@ -24,7 +24,7 @@ package net.server.channel.handlers;
import client.MapleCharacter;
import client.MapleClient;
import client.inventory.InventoryType;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.inventory.manipulator.InventoryManipulator;
import net.AbstractPacketHandler;
import net.packet.InPacket;
import server.MapleTrade;
@@ -94,7 +94,7 @@ public final class ChangeMapHandler extends AbstractPacketHandler {
if (wheel && chr.haveItemWithId(5510000, false)) {
// thanks lucasziron (lziron) for showing revivePlayer() triggering by Wheel
MapleInventoryManipulator.removeById(c, InventoryType.CASH, 5510000, 1, true, false);
InventoryManipulator.removeById(c, InventoryType.CASH, 5510000, 1, true, false);
chr.sendPacket(PacketCreator.showWheelsLeft(chr.getItemQuantity(5510000, false)));
chr.updateHp(50);

View File

@@ -26,7 +26,7 @@ package net.server.channel.handlers;
import client.MapleCharacter;
import client.MapleClient;
import client.inventory.Item;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.inventory.manipulator.InventoryManipulator;
import net.AbstractPacketHandler;
import net.packet.InPacket;
import net.server.Server;
@@ -244,7 +244,7 @@ public final class CouponCodeHandler extends AbstractPacketHandler {
cs.addToInventory(it);
cashItems.add(it);
} else {
MapleInventoryManipulator.addById(c, item, qty, "", -1);
InventoryManipulator.addById(c, item, qty, "", -1);
items.add(new Pair<>((int) qty, item));
}
break;

View File

@@ -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 net.AbstractPacketHandler;
import net.packet.InPacket;
@@ -73,7 +73,7 @@ public final class InventoryMergeHandler extends AbstractPacketHandler {
if(dstItem.getItemId() != srcItem.getItemId()) continue;
if(dstItem.getQuantity() == ii.getSlotMax(c, inventory.getItem(dst).getItemId())) break;
MapleInventoryManipulator.move(c, inventoryType, src, dst);
InventoryManipulator.move(c, inventoryType, src, dst);
}
}
@@ -94,7 +94,7 @@ public final class InventoryMergeHandler extends AbstractPacketHandler {
}
}
if (itemSlot > 0) {
MapleInventoryManipulator.move(c, inventoryType, itemSlot, freeSlot);
InventoryManipulator.move(c, inventoryType, itemSlot, freeSlot);
} else {
sorted = true;
}

View File

@@ -23,7 +23,7 @@ package net.server.channel.handlers;
import client.MapleClient;
import client.inventory.InventoryType;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.inventory.manipulator.InventoryManipulator;
import net.AbstractPacketHandler;
import net.packet.InPacket;
import tools.PacketCreator;
@@ -47,13 +47,13 @@ public final class ItemMoveHandler extends AbstractPacketHandler {
short quantity = p.readShort();
if (src < 0 && action > 0) {
MapleInventoryManipulator.unequip(c, src, action);
InventoryManipulator.unequip(c, src, action);
} else if (action < 0) {
MapleInventoryManipulator.equip(c, src, action);
InventoryManipulator.equip(c, src, action);
} else if (action == 0) {
MapleInventoryManipulator.drop(c, type, src, quantity);
InventoryManipulator.drop(c, type, src, quantity);
} else {
MapleInventoryManipulator.move(c, type, src, action);
InventoryManipulator.move(c, type, src, action);
}
if (c.getPlayer().getMap().getHPDec() > 0) c.getPlayer().resetHpDecreaseTask();

View File

@@ -24,7 +24,7 @@ package net.server.channel.handlers;
import client.MapleClient;
import client.inventory.InventoryType;
import client.inventory.Item;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.inventory.manipulator.InventoryManipulator;
import constants.inventory.ItemConstants;
import net.AbstractPacketHandler;
import net.packet.InPacket;
@@ -53,7 +53,7 @@ public final class ItemRewardHandler extends AbstractPacketHandler {
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
Pair<Integer, List<RewardItem>> rewards = ii.getItemReward(itemId);
for (RewardItem reward : rewards.getRight()) {
if (!MapleInventoryManipulator.checkSpace(c, reward.itemid, reward.quantity, "")) {
if (!InventoryManipulator.checkSpace(c, reward.itemid, reward.quantity, "")) {
c.sendPacket(PacketCreator.getShowInventoryFull());
break;
}
@@ -63,11 +63,11 @@ public final class ItemRewardHandler extends AbstractPacketHandler {
if (reward.period != -1) {
item.setExpiration(currentServerTime() + (reward.period * 60 * 60 * 10));
}
MapleInventoryManipulator.addFromDrop(c, item, false);
InventoryManipulator.addFromDrop(c, item, false);
} else {
MapleInventoryManipulator.addById(c, reward.itemid, reward.quantity, "", -1);
InventoryManipulator.addById(c, reward.itemid, reward.quantity, "", -1);
}
MapleInventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, false, false);
InventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, false, false);
if (reward.worldmsg != null) {
String msg = reward.worldmsg;
msg.replaceAll("/name", c.getPlayer().getName());

View File

@@ -26,7 +26,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 constants.inventory.ItemConstants;
import net.AbstractPacketHandler;
import net.packet.InPacket;
@@ -213,7 +213,7 @@ public final class MTSHandler extends AbstractPacketHandler {
}
ps.executeUpdate();
ps.close();
MapleInventoryManipulator.removeFromSlot(c, invType, slot, quantity, false);
InventoryManipulator.removeFromSlot(c, invType, slot, quantity, false);
con.close();
} catch (SQLException e) {
@@ -343,7 +343,7 @@ public final class MTSHandler extends AbstractPacketHandler {
pse.setInt(2, c.getPlayer().getId());
pse.executeUpdate();
}
MapleInventoryManipulator.addFromDrop(c, i, false);
InventoryManipulator.addFromDrop(c, i, false);
c.enableCSActions();
c.sendPacket(getCart(c.getPlayer().getId()));
c.sendPacket(getMTS(c.getPlayer().getCurrentTab(), c.getPlayer().getCurrentType(), c.getPlayer().getCurrentPage()));

View File

@@ -28,7 +28,7 @@ import client.inventory.Inventory;
import client.inventory.InventoryType;
import client.inventory.Item;
import client.inventory.Pet;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.inventory.manipulator.InventoryManipulator;
import net.AbstractPacketHandler;
import net.packet.InPacket;
import net.server.Server;
@@ -80,7 +80,7 @@ public final class PetFoodHandler extends AbstractPacketHandler {
}
pet.gainClosenessFullness(chr, (pet.getFullness() <= 75) ? 1 : 0, 30, 1); // 25+ "emptyness" to get +1 closeness
MapleInventoryManipulator.removeFromSlot(c, InventoryType.USE, pos, (short) 1, false);
InventoryManipulator.removeFromSlot(c, InventoryType.USE, pos, (short) 1, false);
} finally {
useInv.unlockInventory();
}

View File

@@ -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.game.GameConstants;
@@ -363,7 +363,7 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
if (shop != null && shop.isOwner(chr)) {
if(YamlConfig.config.server.USE_ERASE_PERMIT_ON_OPENSHOP) {
try {
MapleInventoryManipulator.removeById(c, InventoryType.CASH, shop.getItemId(), 1, true, false);
InventoryManipulator.removeById(c, InventoryType.CASH, shop.getItemId(), 1, true, false);
} catch(RuntimeException re) {} // fella does not have a player shop permit...
}
@@ -537,7 +537,7 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
tradeItem.setPosition(targetSlot);
if (trade.addItem(tradeItem)) {
MapleInventoryManipulator.removeFromSlot(c, ivType, item.getPosition(), quantity, true);
InventoryManipulator.removeFromSlot(c, ivType, item.getPosition(), quantity, true);
trade.getChr().sendPacket(PacketCreator.getTradeItemAdd((byte) 0, tradeItem));
if (trade.getPartner() != null) {
@@ -609,9 +609,9 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
}
if (ItemConstants.isRechargeable(ivItem.getItemId())) {
MapleInventoryManipulator.removeFromSlot(c, ivType, slot, ivItem.getQuantity(), true);
InventoryManipulator.removeFromSlot(c, ivType, slot, ivItem.getQuantity(), true);
} else {
MapleInventoryManipulator.removeFromSlot(c, ivType, slot, (short) (bundles * perBundle), true);
InventoryManipulator.removeFromSlot(c, ivType, slot, (short) (bundles * perBundle), true);
}
c.sendPacket(PacketCreator.getPlayerShopItemUpdate(shop));
@@ -627,9 +627,9 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
}
if (ItemConstants.isRechargeable(ivItem.getItemId())) {
MapleInventoryManipulator.removeFromSlot(c, ivType, slot, ivItem.getQuantity(), true);
InventoryManipulator.removeFromSlot(c, ivType, slot, ivItem.getQuantity(), true);
} else {
MapleInventoryManipulator.removeFromSlot(c, ivType, slot, (short) (bundles * perBundle), true);
InventoryManipulator.removeFromSlot(c, ivType, slot, (short) (bundles * perBundle), true);
}
c.sendPacket(PacketCreator.updateHiredMerchant(merchant, chr));

View File

@@ -5,7 +5,7 @@ import client.MapleClient;
import client.MapleQuestStatus;
import client.inventory.Inventory;
import client.inventory.InventoryType;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.inventory.manipulator.InventoryManipulator;
import net.AbstractPacketHandler;
import net.packet.InPacket;
import server.MapleItemInformationProvider;
@@ -55,7 +55,7 @@ public class RaiseIncExpHandler extends AbstractPacketHandler {
return;
}
MapleInventoryManipulator.removeFromSlot(c, InventoryType.getByType(inventorytype), slot, (short) 1, false, true);
InventoryManipulator.removeFromSlot(c, InventoryType.getByType(inventorytype), slot, (short) 1, false, true);
} finally {
inv.unlockInventory();
}

View File

@@ -26,7 +26,7 @@ import client.inventory.Inventory;
import client.inventory.InventoryType;
import client.inventory.Item;
import client.inventory.WeaponType;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.inventory.manipulator.InventoryManipulator;
import config.YamlConfig;
import constants.game.GameConstants;
import constants.inventory.ItemConstants;
@@ -167,7 +167,7 @@ public final class RangedAttackHandler extends AbstractDealDamageHandler {
}
if(slot < 0) System.out.println("<ERROR> Projectile to use was unable to be found.");
else MapleInventoryManipulator.removeFromSlot(c, InventoryType.USE, slot, bulletConsume, false, true);
else InventoryManipulator.removeFromSlot(c, InventoryType.USE, slot, bulletConsume, false, true);
}
}

View File

@@ -27,7 +27,7 @@ import client.MapleRing;
import client.inventory.Equip;
import client.inventory.InventoryType;
import client.inventory.Item;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.inventory.manipulator.InventoryManipulator;
import client.processor.npc.DueyProcessor;
import net.AbstractPacketHandler;
import net.packet.InPacket;
@@ -116,11 +116,11 @@ public final class RingActionHandler extends AbstractPacketHandler {
source.dropMessage(1, "You may only propose to a " + (source.getGender() == 1 ? "male" : "female") + "!");
source.sendPacket(WeddingPackets.OnMarriageResult((byte) 0));
return;
} else if (!MapleInventoryManipulator.checkSpace(c, newBoxId, 1, "")) {
} else if (!InventoryManipulator.checkSpace(c, newBoxId, 1, "")) {
source.dropMessage(5, "You don't have a ETC slot available right now!");
source.sendPacket(WeddingPackets.OnMarriageResult((byte) 0));
return;
} else if (!MapleInventoryManipulator.checkSpace(target.getClient(), newBoxId + 1, 1, "")) {
} else if (!InventoryManipulator.checkSpace(target.getClient(), newBoxId + 1, 1, "")) {
source.dropMessage(5, "The girl you proposed doesn't have a ETC slot available right now.");
source.sendPacket(WeddingPackets.OnMarriageResult((byte) 0));
return;
@@ -230,7 +230,7 @@ public final class RingActionHandler extends AbstractPacketHandler {
int partnerMarriageitemid = marriageitemid + ((chr.getGender() == 0) ? 1 : -1);
if(partner.haveItem(partnerMarriageitemid)) {
MapleInventoryManipulator.removeById(partner.getClient(), InventoryType.ETC, partnerMarriageitemid, (short) 1, false, false);
InventoryManipulator.removeById(partner.getClient(), InventoryType.ETC, partnerMarriageitemid, (short) 1, false, false);
}
//partner.sendPacket(Wedding.OnMarriageResult((byte) 0)); ok, how to gracefully unengage someone without the need to cc?
@@ -240,7 +240,7 @@ public final class RingActionHandler extends AbstractPacketHandler {
}
if(chr.haveItem(marriageitemid)) {
MapleInventoryManipulator.removeById(chr.getClient(), InventoryType.ETC, marriageitemid, (short) 1, false, false);
InventoryManipulator.removeById(chr.getClient(), InventoryType.ETC, marriageitemid, (short) 1, false, false);
}
chr.dropMessage(5, "You have successfully break the engagement with " + MapleCharacter.getNameById(partnerid) + ".");
@@ -279,14 +279,14 @@ public final class RingActionHandler extends AbstractPacketHandler {
Equip ringEqp = (Equip) ringObj;
ringEqp.setRingId(rings.getLeft());
player.addMarriageRing(MapleRing.loadFromDb(rings.getLeft()));
MapleInventoryManipulator.addFromDrop(player.getClient(), ringEqp, false, -1);
InventoryManipulator.addFromDrop(player.getClient(), ringEqp, false, -1);
player.broadcastMarriageMessage();
ringObj = ii.getEquipById(marriageRingId);
ringEqp = (Equip) ringObj;
ringEqp.setRingId(rings.getRight());
partner.addMarriageRing(MapleRing.loadFromDb(rings.getRight()));
MapleInventoryManipulator.addFromDrop(partner.getClient(), ringEqp, false, -1);
InventoryManipulator.addFromDrop(partner.getClient(), ringEqp, false, -1);
partner.broadcastMarriageMessage();
}
@@ -327,13 +327,13 @@ public final class RingActionHandler extends AbstractPacketHandler {
if (accepted) {
final int newItemId = getBoxId(itemid);
if (!MapleInventoryManipulator.checkSpace(c, newItemId, 1, "") || !MapleInventoryManipulator.checkSpace(source.getClient(), newItemId, 1, "")) {
if (!InventoryManipulator.checkSpace(c, newItemId, 1, "") || !InventoryManipulator.checkSpace(source.getClient(), newItemId, 1, "")) {
target.sendPacket(PacketCreator.enableActions());
return;
}
try {
MapleInventoryManipulator.removeById(source.getClient(), InventoryType.USE, itemid, 1, false, false);
InventoryManipulator.removeById(source.getClient(), InventoryType.USE, itemid, 1, false, false);
int marriageId = c.getWorldServer().createRelationship(source.getId(), target.getId());
source.setPartnerId(target.getId()); // engage them (new marriageitemid, partnerid for both)
@@ -342,8 +342,8 @@ public final class RingActionHandler extends AbstractPacketHandler {
source.setMarriageItemId(newItemId);
target.setMarriageItemId(newItemId + 1);
MapleInventoryManipulator.addById(source.getClient(), newItemId, (short) 1);
MapleInventoryManipulator.addById(c, (newItemId + 1), (short) 1);
InventoryManipulator.addById(source.getClient(), newItemId, (short) 1);
InventoryManipulator.addById(c, (newItemId + 1), (short) 1);
source.sendPacket(WeddingPackets.OnMarriageResult(marriageId, source, false));
target.sendPacket(WeddingPackets.OnMarriageResult(marriageId, source, false));
@@ -405,7 +405,7 @@ public final class RingActionHandler extends AbstractPacketHandler {
long expiration = cserv.getWeddingTicketExpireTime(resStatus + 1);
MapleCharacter guestChr = c.getWorldServer().getPlayerStorage().getCharacterById(guest);
if(guestChr != null && MapleInventoryManipulator.checkSpace(guestChr.getClient(), newItemId, 1, "") && MapleInventoryManipulator.addById(guestChr.getClient(), newItemId, (short) 1, expiration)) {
if(guestChr != null && InventoryManipulator.checkSpace(guestChr.getClient(), newItemId, 1, "") && InventoryManipulator.addById(guestChr.getClient(), newItemId, (short) 1, expiration)) {
guestChr.dropMessage(6, "[Wedding] You've been invited to " + groom + " and " + bride + "'s Wedding!");
} else {
if(guestChr != null && guestChr.isLoggedinWorld()) {

View File

@@ -27,7 +27,7 @@ import client.Skill;
import client.SkillFactory;
import client.inventory.*;
import client.inventory.Equip.ScrollResult;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.inventory.manipulator.InventoryManipulator;
import constants.inventory.ItemConstants;
import net.AbstractPacketHandler;
import net.packet.InPacket;
@@ -128,10 +128,10 @@ public final class ScrollHandler extends AbstractPacketHandler {
return;
}
MapleInventoryManipulator.removeFromSlot(c, InventoryType.USE, wscroll.getPosition(), (short) 1, false, false);
InventoryManipulator.removeFromSlot(c, InventoryType.USE, wscroll.getPosition(), (short) 1, false, false);
}
MapleInventoryManipulator.removeFromSlot(c, InventoryType.USE, scroll.getPosition(), (short) 1, false);
InventoryManipulator.removeFromSlot(c, InventoryType.USE, scroll.getPosition(), (short) 1, false);
} finally {
useInventory.unlockInventory();
}

View File

@@ -28,7 +28,7 @@ import client.SkillFactory;
import client.inventory.Inventory;
import client.inventory.InventoryType;
import client.inventory.Item;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.inventory.manipulator.InventoryManipulator;
import net.AbstractPacketHandler;
import net.packet.InPacket;
import server.MapleItemInformationProvider;
@@ -76,7 +76,7 @@ public final class SkillBookHandler extends AbstractPacketHandler {
return;
}
MapleInventoryManipulator.removeFromSlot(c, InventoryType.USE, slot, (short) 1, false);
InventoryManipulator.removeFromSlot(c, InventoryType.USE, slot, (short) 1, false);
} finally {
inv.unlockInventory();
}

View File

@@ -25,7 +25,7 @@ import client.*;
import client.inventory.Inventory;
import client.inventory.InventoryType;
import client.inventory.Item;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.inventory.manipulator.InventoryManipulator;
import client.status.MonsterStatus;
import client.status.MonsterStatusEffect;
import config.YamlConfig;
@@ -109,7 +109,7 @@ public final class TakeDamageHandler extends AbstractPacketHandler {
inv.lockInventory();
try {
qty = Math.min(chr.countItem(loseItem.getId()), dropCount);
MapleInventoryManipulator.removeById(c, type, loseItem.getId(), qty, false, false);
InventoryManipulator.removeById(c, type, loseItem.getId(), qty, false, false);
} finally {
inv.unlockInventory();
}

View File

@@ -25,7 +25,7 @@ import client.*;
import client.creator.veteran.*;
import client.inventory.*;
import client.inventory.Equip.ScrollResult;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.inventory.manipulator.InventoryManipulator;
import client.inventory.manipulator.MapleKarmaManipulator;
import client.processor.npc.DueyProcessor;
import client.processor.stat.AssignAPProcessor;
@@ -132,7 +132,7 @@ public final class UseCashItemHandler extends AbstractPacketHandler {
}
if (!success) {
MapleInventoryManipulator.addById(c, itemId, (short) 1);
InventoryManipulator.addById(c, itemId, (short) 1);
c.sendPacket(PacketCreator.enableActions());
}
} else if (itemType == 505) { // AP/SP reset
@@ -243,7 +243,7 @@ public final class UseCashItemHandler extends AbstractPacketHandler {
return;
}
if (getIncubatedItem(c, itemId)) {
MapleInventoryManipulator.removeFromSlot(c, InventoryType.getByType(inventory2), slot2, (short) 1, false);
InventoryManipulator.removeFromSlot(c, InventoryType.getByType(inventory2), slot2, (short) 1, false);
remove(c, position, itemId);
}
return;
@@ -570,7 +570,7 @@ public final class UseCashItemHandler extends AbstractPacketHandler {
c.sendPacket(PacketCreator.sendVegaScroll(scrolled.getLevel() > curlevel ? 0x41 : 0x43));
//opcodes 0x42, 0x44: "this item cannot be used"; 0x39, 0x45: crashes
MapleInventoryManipulator.removeFromSlot(c, InventoryType.USE, uSlot, (short) 1, false);
InventoryManipulator.removeFromSlot(c, InventoryType.USE, uSlot, (short) 1, false);
remove(c, position, itemId);
final MapleClient client = c;
@@ -612,7 +612,7 @@ public final class UseCashItemHandler extends AbstractPacketHandler {
}
}
MapleInventoryManipulator.removeFromSlot(c, InventoryType.CASH, position, (short) 1, true, false);
InventoryManipulator.removeFromSlot(c, InventoryType.CASH, position, (short) 1, true, false);
} finally {
cashInv.unlockInventory();
}
@@ -630,7 +630,7 @@ public final class UseCashItemHandler extends AbstractPacketHandler {
if (c.getPlayer().getInventory(InventoryType.getByType((byte) (id / 1000000))).isFull()) {
return false;
}
MapleInventoryManipulator.addById(c, id, (short) amount);
InventoryManipulator.addById(c, id, (short) amount);
return true;
}
}

View File

@@ -25,7 +25,7 @@ import client.MapleCharacter;
import client.MapleClient;
import client.autoban.AutobanManager;
import client.inventory.InventoryType;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.inventory.manipulator.InventoryManipulator;
import constants.inventory.ItemConstants;
import net.AbstractPacketHandler;
import net.packet.InPacket;
@@ -61,8 +61,8 @@ public final class UseCatchItemHandler extends AbstractPacketHandler {
if (mob.getId() == 9300101) {
chr.getMap().broadcastMessage(PacketCreator.catchMonster(monsterid, itemId, (byte) 1));
mob.getMap().killMonster(mob, null, false);
MapleInventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true);
MapleInventoryManipulator.addById(c, 1902000, (short) 1, "", -1);
InventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true);
InventoryManipulator.addById(c, 1902000, (short) 1, "", -1);
}
c.sendPacket(PacketCreator.enableActions());
break;
@@ -72,8 +72,8 @@ public final class UseCatchItemHandler extends AbstractPacketHandler {
if (mob.getHp() < ((mob.getMaxHp() / 10) * 4)) {
chr.getMap().broadcastMessage(PacketCreator.catchMonster(monsterid, itemId, (byte) 1));
mob.getMap().killMonster(mob, null, false);
MapleInventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true);
MapleInventoryManipulator.addById(c, 4031830, (short) 1, "", -1);
InventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true);
InventoryManipulator.addById(c, 4031830, (short) 1, "", -1);
} else {
abm.spam(10);
c.sendPacket(PacketCreator.catchMessage(0));
@@ -90,8 +90,8 @@ public final class UseCatchItemHandler extends AbstractPacketHandler {
if (Math.random() < 0.5) { // 50% chance
chr.getMap().broadcastMessage(PacketCreator.catchMonster(monsterid, itemId, (byte) 1));
mob.getMap().killMonster(mob, null, false);
MapleInventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true);
MapleInventoryManipulator.addById(c, 4031868, (short) 1, "", -1);
InventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true);
InventoryManipulator.addById(c, 4031868, (short) 1, "", -1);
} else {
chr.getMap().broadcastMessage(PacketCreator.catchMonster(monsterid, itemId, (byte) 0));
}
@@ -112,8 +112,8 @@ public final class UseCatchItemHandler extends AbstractPacketHandler {
if (mob.getHp() < ((mob.getMaxHp() / 10) * 4)) {
chr.getMap().broadcastMessage(PacketCreator.catchMonster(monsterid, itemId, (byte) 1));
mob.getMap().killMonster(mob, null, false);
MapleInventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true);
MapleInventoryManipulator.addById(c, 4031887, (short) 1, "", -1);
InventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true);
InventoryManipulator.addById(c, 4031887, (short) 1, "", -1);
} else {
c.sendPacket(PacketCreator.catchMessage(0));
}
@@ -125,8 +125,8 @@ public final class UseCatchItemHandler extends AbstractPacketHandler {
if (mob.getHp() < ((mob.getMaxHp() / 10) * 3)) {
chr.getMap().broadcastMessage(PacketCreator.catchMonster(monsterid, itemId, (byte) 1));
mob.getMap().killMonster(mob, null, false);
MapleInventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true);
MapleInventoryManipulator.addById(c, 2109001, (short) 1, "", -1);
InventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true);
InventoryManipulator.addById(c, 2109001, (short) 1, "", -1);
} else {
c.sendPacket(PacketCreator.catchMessage(0));
}
@@ -138,8 +138,8 @@ public final class UseCatchItemHandler extends AbstractPacketHandler {
if (mob.getHp() < ((mob.getMaxHp() / 10) * 3)) {
chr.getMap().broadcastMessage(PacketCreator.catchMonster(monsterid, itemId, (byte) 1));
mob.getMap().killMonster(mob, null, false);
MapleInventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true);
MapleInventoryManipulator.addById(c, 2109002, (short) 1, "", -1);
InventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true);
InventoryManipulator.addById(c, 2109002, (short) 1, "", -1);
} else {
c.sendPacket(PacketCreator.catchMessage(0));
}
@@ -151,8 +151,8 @@ public final class UseCatchItemHandler extends AbstractPacketHandler {
if (mob.getHp() < ((mob.getMaxHp() / 10) * 3)) {
chr.getMap().broadcastMessage(PacketCreator.catchMonster(monsterid, itemId, (byte) 1));
mob.getMap().killMonster(mob, null, false);
MapleInventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true);
MapleInventoryManipulator.addById(c, 2109003, (short) 1, "", -1);
InventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true);
InventoryManipulator.addById(c, 2109003, (short) 1, "", -1);
} else {
c.sendPacket(PacketCreator.catchMessage(0));
}
@@ -164,8 +164,8 @@ public final class UseCatchItemHandler extends AbstractPacketHandler {
if (mob.getHp() < ((mob.getMaxHp() / 10) * 4)) {
chr.getMap().broadcastMessage(PacketCreator.catchMonster(monsterid, itemId, (byte) 1));
mob.getMap().killMonster(mob, null, false);
MapleInventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true);
MapleInventoryManipulator.addById(c, 4001169, (short) 1, "", -1);
InventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true);
InventoryManipulator.addById(c, 4001169, (short) 1, "", -1);
} else {
c.sendPacket(PacketCreator.catchMessage(0));
}
@@ -178,8 +178,8 @@ public final class UseCatchItemHandler extends AbstractPacketHandler {
abm.spam(10);
chr.getMap().broadcastMessage(PacketCreator.catchMonster(monsterid, itemId, (byte) 1));
mob.getMap().killMonster(mob, null, false);
MapleInventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true);
MapleInventoryManipulator.addById(c, 2022323, (short) 1, "", -1);
InventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true);
InventoryManipulator.addById(c, 2022323, (short) 1, "", -1);
} else {
chr.message("You cannot use the Fishing Net yet.");
}
@@ -201,8 +201,8 @@ public final class UseCatchItemHandler extends AbstractPacketHandler {
if (mobHp != 0 && mob.getHp() < ((mob.getMaxHp() / 100) * mobHp)) {
chr.getMap().broadcastMessage(PacketCreator.catchMonster(monsterid, itemId, (byte) 1));
mob.getMap().killMonster(mob, null, false);
MapleInventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true);
MapleInventoryManipulator.addById(c, itemGanho, (short) 1, "", -1);
InventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true);
InventoryManipulator.addById(c, itemGanho, (short) 1, "", -1);
} else if (mob.getId() != 9500336) {
if (mobHp != 0) {
abm.spam(10);

View File

@@ -26,7 +26,7 @@ import client.MapleClient;
import client.MapleDisease;
import client.inventory.InventoryType;
import client.inventory.Item;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.inventory.manipulator.InventoryManipulator;
import config.YamlConfig;
import constants.inventory.ItemConstants;
import net.AbstractPacketHandler;
@@ -107,7 +107,7 @@ public final class UseItemHandler extends AbstractPacketHandler {
}
private void remove(MapleClient c, short slot) {
MapleInventoryManipulator.removeFromSlot(c, InventoryType.USE, slot, (short) 1, false);
InventoryManipulator.removeFromSlot(c, InventoryType.USE, slot, (short) 1, false);
c.sendPacket(PacketCreator.enableActions());
}
}

View File

@@ -27,7 +27,7 @@ import client.MapleMount;
import client.inventory.Inventory;
import client.inventory.InventoryType;
import client.inventory.Item;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.inventory.manipulator.InventoryManipulator;
import constants.game.ExpTable;
import net.AbstractPacketHandler;
import net.packet.InPacket;
@@ -73,7 +73,7 @@ public final class UseMountFoodHandler extends AbstractPacketHandler {
mountLevelup = levelup;
}
MapleInventoryManipulator.removeById(c, InventoryType.USE, itemid, 1, true, false);
InventoryManipulator.removeById(c, InventoryType.USE, itemid, 1, true, false);
}
} finally {
useInv.unlockInventory();

View File

@@ -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 net.AbstractPacketHandler;
import net.packet.InPacket;
import server.MapleItemInformationProvider;
@@ -66,7 +66,7 @@ public final class UseSolomonHandler extends AbstractPacketHandler {
return;
}
chr.addGachaExp((int) gachaexp);
MapleInventoryManipulator.removeFromSlot(c, InventoryType.USE, slot, (short) 1, false);
InventoryManipulator.removeFromSlot(c, InventoryType.USE, slot, (short) 1, false);
} finally {
inv.unlockInventory();
}

View File

@@ -24,7 +24,7 @@ package net.server.channel.handlers;
import client.MapleClient;
import client.inventory.InventoryType;
import client.inventory.Item;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.inventory.manipulator.InventoryManipulator;
import net.AbstractPacketHandler;
import net.packet.InPacket;
import server.MapleItemInformationProvider;
@@ -50,7 +50,7 @@ public final class UseSummonBagHandler extends AbstractPacketHandler {
int itemId = p.readInt();
Item toUse = c.getPlayer().getInventory(InventoryType.USE).getItem(slot);
if (toUse != null && toUse.getQuantity() > 0 && toUse.getItemId() == itemId) {
MapleInventoryManipulator.removeFromSlot(c, InventoryType.USE, slot, (short) 1, false);
InventoryManipulator.removeFromSlot(c, InventoryType.USE, slot, (short) 1, false);
int[][] toSpawn = MapleItemInformationProvider.getInstance().getSummonMobs(itemId);
for (int[] toSpawnChild : toSpawn) {
if (Randomizer.nextInt(100) < toSpawnChild[1]) {

View File

@@ -12,7 +12,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 client.inventory.manipulator.MapleKarmaManipulator;
import config.YamlConfig;
import constants.inventory.ItemConstants;
@@ -69,7 +69,7 @@ public final class WeddingHandler extends AbstractPacketHandler {
newItem = item.copy();
marriage.addGiftItem(groomWishlist, newItem);
MapleInventoryManipulator.removeFromSlot(c, type, slot, quantity, false, false);
InventoryManipulator.removeFromSlot(c, type, slot, quantity, false, false);
MapleKarmaManipulator.toggleKarmaFlagToUntradeable(newItem);
marriage.setIntProperty(groomWishlistProp, giftCount + 1);
@@ -115,7 +115,7 @@ public final class WeddingHandler extends AbstractPacketHandler {
marriage.removeGiftItem(groomWishlist, item);
marriage.saveGiftItemsToDb(c, groomWishlist, chr.getId());
MapleInventoryManipulator.addFromDrop(c, item, true);
InventoryManipulator.addFromDrop(c, item, true);
c.sendPacket(WeddingPackets.onWeddingGiftResult((byte) 0xF, marriage.getWishlistItems(groomWishlist), marriage.getGiftItems(c, groomWishlist)));
} else {
@@ -135,7 +135,7 @@ public final class WeddingHandler extends AbstractPacketHandler {
items.remove(itemPos);
MapleMarriage.saveGiftItemsToDb(c, items, chr.getId());
MapleInventoryManipulator.addFromDrop(c, item, true);
InventoryManipulator.addFromDrop(c, item, true);
c.sendPacket(WeddingPackets.onWeddingGiftResult((byte) 0xF, Collections.singletonList(""), items));
} else {
c.getPlayer().dropMessage(1, "Free a slot on your inventory before collecting this item.");

View File

@@ -24,7 +24,7 @@ package scripting;
import client.*;
import client.MapleCharacter.DelayedQuestUpdate;
import client.inventory.*;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.inventory.manipulator.InventoryManipulator;
import config.YamlConfig;
import constants.game.GameConstants;
import constants.inventory.ItemConstants;
@@ -297,7 +297,7 @@ public class AbstractPlayerInteraction {
prfInv.cloneContents(inv);
for(Pair<Integer, Integer> p : toRemove) {
MapleInventoryManipulator.removeById(c, InventoryType.CANHOLD, p.getLeft(), p.getRight(), false, false);
InventoryManipulator.removeById(c, InventoryType.CANHOLD, p.getLeft(), p.getRight(), false, false);
}
List<Pair<Item, InventoryType>> addItems = prepareProofInventoryItems(toAdd);
@@ -532,7 +532,7 @@ public class AbstractPlayerInteraction {
chr.getClient().getWorldServer().registerPetHunger(chr, chr.getPetIndex(evolved));
*/
MapleInventoryManipulator.removeFromSlot(c, InventoryType.CASH, target.getPosition(), (short) 1, false);
InventoryManipulator.removeFromSlot(c, InventoryType.CASH, target.getPosition(), (short) 1, false);
return evolved;
}
@@ -588,7 +588,7 @@ public class AbstractPlayerInteraction {
evolved.saveToDb();
}
//MapleInventoryManipulator.addById(c, id, (short) 1, null, petId, expires == -1 ? -1 : System.currentTimeMillis() + expires);
//InventoryManipulator.addById(c, id, (short) 1, null, petId, expires == -1 ? -1 : System.currentTimeMillis() + expires);
}
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
@@ -618,21 +618,21 @@ public class AbstractPlayerInteraction {
item.setExpiration(System.currentTimeMillis() + expires);
}
if (!MapleInventoryManipulator.checkSpace(c, id, quantity, "")) {
if (!InventoryManipulator.checkSpace(c, id, quantity, "")) {
c.getPlayer().dropMessage(1, "Your inventory is full. Please remove an item from your " + ItemConstants.getInventoryType(id).name() + " inventory.");
return null;
}
if (ItemConstants.getInventoryType(id) == InventoryType.EQUIP) {
if (randomStats) {
MapleInventoryManipulator.addFromDrop(c, ii.randomizeStats((Equip) item), false, petId);
InventoryManipulator.addFromDrop(c, ii.randomizeStats((Equip) item), false, petId);
} else {
MapleInventoryManipulator.addFromDrop(c, item, false, petId);
InventoryManipulator.addFromDrop(c, item, false, petId);
}
} else {
MapleInventoryManipulator.addFromDrop(c, item, false, petId);
InventoryManipulator.addFromDrop(c, item, false, petId);
}
} else {
MapleInventoryManipulator.removeById(c, ItemConstants.getInventoryType(id), id, -quantity, true, false);
InventoryManipulator.removeById(c, ItemConstants.getInventoryType(id), id, -quantity, true, false);
}
if (showMessage) {
c.sendPacket(PacketCreator.getShowItemGain(id, quantity, true));
@@ -750,9 +750,9 @@ public class AbstractPlayerInteraction {
for (MapleCharacter chr : party) {
MapleClient cl = chr.getClient();
if (quantity >= 0) {
MapleInventoryManipulator.addById(cl, id, quantity);
InventoryManipulator.addById(cl, id, quantity);
} else {
MapleInventoryManipulator.removeById(cl, ItemConstants.getInventoryType(id), id, -quantity, true, false);
InventoryManipulator.removeById(cl, ItemConstants.getInventoryType(id), id, -quantity, true, false);
}
cl.sendPacket(PacketCreator.getShowItemGain(id, quantity, true));
}
@@ -846,7 +846,7 @@ public class AbstractPlayerInteraction {
Inventory iv = chr.getInventory(type);
int possesed = iv.countById(id);
if (possesed > 0) {
MapleInventoryManipulator.removeById(c, ItemConstants.getInventoryType(id), id, possesed, true, false);
InventoryManipulator.removeById(c, ItemConstants.getInventoryType(id), id, possesed, true, false);
chr.sendPacket(PacketCreator.getShowItemGain(id, (short) -possesed, true));
}
}
@@ -860,13 +860,13 @@ public class AbstractPlayerInteraction {
InventoryType invType = ItemConstants.getInventoryType(id);
int possessed = cl.getPlayer().getInventory(invType).countById(id);
if (possessed > 0) {
MapleInventoryManipulator.removeById(cl, ItemConstants.getInventoryType(id), id, possessed, true, false);
InventoryManipulator.removeById(cl, ItemConstants.getInventoryType(id), id, possessed, true, false);
cl.sendPacket(PacketCreator.getShowItemGain(id, (short) -possessed, true));
}
if(invType == InventoryType.EQUIP) {
if(cl.getPlayer().getInventory(InventoryType.EQUIPPED).countById(id) > 0) {
MapleInventoryManipulator.removeById(cl, InventoryType.EQUIPPED, id, 1, true, false);
InventoryManipulator.removeById(cl, InventoryType.EQUIPPED, id, 1, true, false);
cl.sendPacket(PacketCreator.getShowItemGain(id, (short) -1, true));
}
}
@@ -932,13 +932,13 @@ public class AbstractPlayerInteraction {
public void removeEquipFromSlot(short slot) {
Item tempItem = c.getPlayer().getInventory(InventoryType.EQUIPPED).getItem(slot);
MapleInventoryManipulator.removeFromSlot(c, InventoryType.EQUIPPED, slot, tempItem.getQuantity(), false, false);
InventoryManipulator.removeFromSlot(c, InventoryType.EQUIPPED, slot, tempItem.getQuantity(), false, false);
}
public void gainAndEquip(int itemid, short slot) {
final Item old = c.getPlayer().getInventory(InventoryType.EQUIPPED).getItem(slot);
if (old != null) {
MapleInventoryManipulator.removeFromSlot(c, InventoryType.EQUIPPED, slot, old.getQuantity(), false, false);
InventoryManipulator.removeFromSlot(c, InventoryType.EQUIPPED, slot, old.getQuantity(), false, false);
}
final Item newItem = MapleItemInformationProvider.getInstance().getEquipById(itemid);
newItem.setPosition(slot);

View File

@@ -25,7 +25,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 scripting.event.EventInstanceManager;
import scripting.event.EventManager;
import tools.DatabaseConnection;
@@ -126,7 +126,7 @@ public class MapleMarriage extends EventInstanceManager {
}
for (Item item : gifts) {
MapleInventoryManipulator.addFromDrop(chr.getClient(), item, false);
InventoryManipulator.addFromDrop(chr.getClient(), item, false);
}
return true;

View File

@@ -25,7 +25,7 @@ import client.MapleClient;
import client.inventory.InventoryType;
import client.inventory.Item;
import client.inventory.Pet;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.inventory.manipulator.InventoryManipulator;
import constants.inventory.ItemConstants;
import tools.DatabaseConnection;
import tools.PacketCreator;
@@ -93,14 +93,14 @@ public class MapleShop {
if (item.getPrice() > 0) {
int amount = (int)Math.min((float) item.getPrice() * quantity, Integer.MAX_VALUE);
if (c.getPlayer().getMeso() >= amount) {
if (MapleInventoryManipulator.checkSpace(c, itemId, quantity, "")) {
if (InventoryManipulator.checkSpace(c, itemId, quantity, "")) {
if (!ItemConstants.isRechargeable(itemId)) { //Pets can't be bought from shops
MapleInventoryManipulator.addById(c, itemId, quantity, "", -1);
InventoryManipulator.addById(c, itemId, quantity, "", -1);
c.getPlayer().gainMeso(-amount, false);
} else {
short slotMax = ii.getSlotMax(c, item.getItemId());
quantity = slotMax;
MapleInventoryManipulator.addById(c, itemId, quantity, "", -1);
InventoryManipulator.addById(c, itemId, quantity, "", -1);
c.getPlayer().gainMeso(-item.getPrice(), false);
}
c.sendPacket(PacketCreator.shopTransaction((byte) 0));
@@ -114,15 +114,15 @@ public class MapleShop {
int amount = (int)Math.min((float) item.getPitch() * quantity, Integer.MAX_VALUE);
if (c.getPlayer().getInventory(InventoryType.ETC).countById(4310000) >= amount) {
if (MapleInventoryManipulator.checkSpace(c, itemId, quantity, "")) {
if (InventoryManipulator.checkSpace(c, itemId, quantity, "")) {
if (!ItemConstants.isRechargeable(itemId)) {
MapleInventoryManipulator.addById(c, itemId, quantity, "", -1);
MapleInventoryManipulator.removeById(c, InventoryType.ETC, 4310000, amount, false, false);
InventoryManipulator.addById(c, itemId, quantity, "", -1);
InventoryManipulator.removeById(c, InventoryType.ETC, 4310000, amount, false, false);
} else {
short slotMax = ii.getSlotMax(c, item.getItemId());
quantity = slotMax;
MapleInventoryManipulator.addById(c, itemId, quantity, "", -1);
MapleInventoryManipulator.removeById(c, InventoryType.ETC, 4310000, amount, false, false);
InventoryManipulator.addById(c, itemId, quantity, "", -1);
InventoryManipulator.removeById(c, InventoryType.ETC, 4310000, amount, false, false);
}
c.sendPacket(PacketCreator.shopTransaction((byte) 0));
} else
@@ -136,12 +136,12 @@ public class MapleShop {
if (c.getPlayer().getMeso() + value >= cost) {
int cardreduce = value - cost;
int diff = cardreduce + c.getPlayer().getMeso();
if (MapleInventoryManipulator.checkSpace(c, itemId, quantity, "")) {
if (InventoryManipulator.checkSpace(c, itemId, quantity, "")) {
if (ItemConstants.isPet(itemId)) {
int petid = Pet.createPet(itemId);
MapleInventoryManipulator.addById(c, itemId, quantity, "", petid, -1);
InventoryManipulator.addById(c, itemId, quantity, "", petid, -1);
} else {
MapleInventoryManipulator.addById(c, itemId, quantity, "", -1, -1);
InventoryManipulator.addById(c, itemId, quantity, "", -1, -1);
}
c.getPlayer().gainMeso(diff, false);
} else {
@@ -196,7 +196,7 @@ public class MapleShop {
Item item = c.getPlayer().getInventory(type).getItem(slot);
if(canSell(item, quantity)) {
quantity = getSellingQuantity(item, quantity);
MapleInventoryManipulator.removeFromSlot(c, type, (byte) slot, quantity, false);
InventoryManipulator.removeFromSlot(c, type, (byte) slot, quantity, false);
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
int recvMesos = ii.getPrice(item.getItemId(), quantity);

View File

@@ -25,7 +25,7 @@ import client.*;
import client.inventory.Inventory;
import client.inventory.InventoryType;
import client.inventory.Item;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.inventory.manipulator.InventoryManipulator;
import client.status.MonsterStatus;
import client.status.MonsterStatusEffect;
import config.YamlConfig;
@@ -879,7 +879,7 @@ public class MapleStatEffect {
applyto.sendPacket(PacketCreator.enableActions());
return false;
}
MapleInventoryManipulator.removeById(applyto.getClient(), ItemConstants.getInventoryType(itemCon), itemCon, itemConNo, false, true);
InventoryManipulator.removeById(applyto.getClient(), ItemConstants.getInventoryType(itemCon), itemCon, itemConNo, false, true);
}
} else {
if (isResurrection()) {
@@ -956,7 +956,7 @@ public class MapleStatEffect {
if (projectile == null) {
return false;
} else {
MapleInventoryManipulator.removeFromSlot(applyto.getClient(), InventoryType.USE, projectile.getPosition(), projectileConsume, false, true);
InventoryManipulator.removeFromSlot(applyto.getClient(), InventoryType.USE, projectile.getPosition(), projectileConsume, false, true);
}
} finally {
use.unlockInventory();
@@ -1014,7 +1014,7 @@ public class MapleStatEffect {
door.getTarget().spawnDoor(door.getAreaDoor());
door.getTown().spawnDoor(door.getTownDoor());
} else {
MapleInventoryManipulator.addFromDrop(applyto.getClient(), new Item(4006000, (short) 0, (short) 1), false);
InventoryManipulator.addFromDrop(applyto.getClient(), new Item(4006000, (short) 0, (short) 1), false);
if (door.getOwnerId() == -3) {
applyto.dropMessage(5, "Mystic Door cannot be cast far from a spawn point. Nearest one is at " + door.getDoorStatus().getRight() + "pts " + door.getDoorStatus().getLeft());

View File

@@ -25,7 +25,7 @@ import client.MapleCharacter;
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.game.GameConstants;
@@ -120,7 +120,7 @@ public class MapleTrade {
for (Item item : exchangeItems) {
MapleKarmaManipulator.toggleKarmaFlagToUntradeable(item);
MapleInventoryManipulator.addFromDrop(chr.getClient(), item, show);
InventoryManipulator.addFromDrop(chr.getClient(), item, show);
}
if (exchangeMeso > 0) {
@@ -150,7 +150,7 @@ public class MapleTrade {
boolean show = YamlConfig.config.server.USE_DEBUG;
for (Item item : items) {
MapleInventoryManipulator.addFromDrop(chr.getClient(), item, show);
InventoryManipulator.addFromDrop(chr.getClient(), item, show);
}
if (meso > 0) {
chr.gainMeso(meso, show, true, show);

View File

@@ -27,7 +27,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 client.processor.npc.FredrickProcessor;
import config.YamlConfig;
@@ -226,7 +226,7 @@ public class MapleHiredMerchant extends AbstractMapleMapObject {
return;
}
MapleInventoryManipulator.addFromDrop(chr.getClient(), iitem, true);
InventoryManipulator.addFromDrop(chr.getClient(), iitem, true);
}
removeFromSlot(slot);
@@ -240,7 +240,7 @@ public class MapleHiredMerchant extends AbstractMapleMapObject {
}
private static boolean canBuy(MapleClient c, Item newItem) { // thanks xiaokelvin (Conrad) for noticing a leaked test code here
return MapleInventoryManipulator.checkSpace(c, newItem.getItemId(), newItem.getQuantity(), newItem.getOwner()) && MapleInventoryManipulator.addFromDrop(c, newItem, false);
return InventoryManipulator.checkSpace(c, newItem.getItemId(), newItem.getQuantity(), newItem.getOwner()) && InventoryManipulator.addFromDrop(c, newItem, false);
}
private int getQuantityLeft(int itemid) {
@@ -411,9 +411,9 @@ public class MapleHiredMerchant extends AbstractMapleMapObject {
for (MaplePlayerShopItem mpsi : copyItems) {
if (mpsi.isExist()) {
if (mpsi.getItem().getInventoryType().equals(InventoryType.EQUIP)) {
MapleInventoryManipulator.addFromDrop(c, mpsi.getItem(), false);
InventoryManipulator.addFromDrop(c, mpsi.getItem(), false);
} else {
MapleInventoryManipulator.addById(c, mpsi.getItem().getItemId(), (short) (mpsi.getBundles() * mpsi.getItem().getQuantity()), mpsi.getItem().getOwner(), -1, mpsi.getItem().getFlag(), mpsi.getItem().getExpiration());
InventoryManipulator.addById(c, mpsi.getItem().getItemId(), (short) (mpsi.getBundles() * mpsi.getItem().getQuantity()), mpsi.getItem().getOwner(), -1, mpsi.getItem().getFlag(), mpsi.getItem().getExpiration());
}
}
}

View File

@@ -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 client.inventory.manipulator.MapleKarmaManipulator;
import net.packet.Packet;
import net.server.audit.locks.MonitoredLockType;
@@ -213,7 +213,7 @@ public class MaplePlayerShop extends AbstractMapleMapObject {
}
private static boolean canBuy(MapleClient c, Item newItem) {
return MapleInventoryManipulator.checkSpace(c, newItem.getItemId(), newItem.getQuantity(), newItem.getOwner()) && MapleInventoryManipulator.addFromDrop(c, newItem, false);
return InventoryManipulator.checkSpace(c, newItem.getItemId(), newItem.getQuantity(), newItem.getOwner()) && InventoryManipulator.addFromDrop(c, newItem, false);
}
public void takeItemBack(int slot, MapleCharacter chr) {
@@ -230,7 +230,7 @@ public class MaplePlayerShop extends AbstractMapleMapObject {
return;
}
MapleInventoryManipulator.addFromDrop(chr.getClient(), iitem, true);
InventoryManipulator.addFromDrop(chr.getClient(), iitem, true);
}
removeFromSlot(slot);

View File

@@ -2,7 +2,7 @@ package server.minigame;
import client.MapleClient;
import client.inventory.Item;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.inventory.manipulator.InventoryManipulator;
import tools.PacketCreator;
import tools.Randomizer;
@@ -72,7 +72,7 @@ public class MapleRockPaperScissor{
public final void reward(final MapleClient c){
if(win){
MapleInventoryManipulator.addFromDrop(c, new Item(4031332 + round, (short) 0, (short) 1), true);
InventoryManipulator.addFromDrop(c, new Item(4031332 + round, (short) 0, (short) 1), true);
}
c.getPlayer().setRPS(null);
}

View File

@@ -25,7 +25,7 @@ import client.MapleCharacter;
import client.MapleClient;
import client.inventory.InventoryType;
import client.inventory.Item;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.inventory.manipulator.InventoryManipulator;
import constants.inventory.ItemConstants;
import provider.MapleData;
import provider.MapleDataTool;
@@ -142,14 +142,14 @@ public class ItemAction extends MapleQuestAction {
}
}
MapleInventoryManipulator.removeById(chr.getClient(), type, itemid, quantity, true, false);
InventoryManipulator.removeById(chr.getClient(), type, itemid, quantity, true, false);
chr.sendPacket(PacketCreator.getShowItemGain(itemid, (short) count, true));
}
for(ItemData iEntry: giveItem) {
int itemid = iEntry.getId(), count = iEntry.getCount(), period = iEntry.getPeriod(); // thanks Vcoc for noticing quest milestone item not getting removed from inventory after a while
MapleInventoryManipulator.addById(chr.getClient(), itemid, (short) count, "", -1, period > 0 ? (System.currentTimeMillis() + period * 60 * 1000) : -1);
InventoryManipulator.addById(chr.getClient(), itemid, (short) count, "", -1, period > 0 ? (System.currentTimeMillis() + period * 60 * 1000) : -1);
chr.sendPacket(PacketCreator.getShowItemGain(itemid, (short) count, true));
}
}
@@ -212,7 +212,7 @@ public class ItemAction extends MapleQuestAction {
for(Pair<Item, InventoryType> it: randomList) {
int idx = it.getRight().getType() - 1;
result = MapleInventoryManipulator.checkSpaceProgressively(c, it.getLeft().getItemId(), it.getLeft().getQuantity(), "", rndUsed.get(idx), false);
result = InventoryManipulator.checkSpaceProgressively(c, it.getLeft().getItemId(), it.getLeft().getQuantity(), "", rndUsed.get(idx), false);
if(result % 2 == 0) {
announceInventoryLimit(Collections.singletonList(it.getLeft().getItemId()), chr);
return false;
@@ -307,7 +307,7 @@ public class ItemAction extends MapleQuestAction {
return false;
}
MapleInventoryManipulator.addById(chr.getClient(), item.getId(), (short) missingQty);
InventoryManipulator.addById(chr.getClient(), item.getId(), (short) missingQty);
FilePrinter.print(FilePrinter.QUEST_RESTORE_ITEM, chr + " obtained " + itemid + " qty. " + missingQty + " from quest " + questID);
}
return true;