Rename and clean up MapleInventoryManipulator
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user