Rename and clean up MapleInventory
This commit is contained in:
@@ -23,7 +23,7 @@ package net.server.channel.handlers;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.inventory.MapleInventory;
|
||||
import client.inventory.Inventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import net.AbstractPacketHandler;
|
||||
@@ -62,7 +62,7 @@ public final class AdminCommandHandler extends AbstractPacketHandler {
|
||||
break;
|
||||
case 0x01: { // /d (inv)
|
||||
byte type = p.readByte();
|
||||
MapleInventory in = c.getPlayer().getInventory(MapleInventoryType.getByType(type));
|
||||
Inventory in = c.getPlayer().getInventory(MapleInventoryType.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, MapleInventoryType.getByType(type), i, in.getItem(i).getQuantity(), false);
|
||||
|
||||
@@ -25,8 +25,8 @@ import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.MapleRing;
|
||||
import client.inventory.Equip;
|
||||
import client.inventory.Inventory;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import config.YamlConfig;
|
||||
@@ -280,7 +280,7 @@ public final class CashOperationHandler extends AbstractPacketHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
MapleInventory mi = chr.getInventory(MapleInventoryType.getByType(invType));
|
||||
Inventory mi = chr.getInventory(MapleInventoryType.getByType(invType));
|
||||
Item item = mi.findByCashId(cashId);
|
||||
if (item == null) {
|
||||
c.enableCSActions();
|
||||
|
||||
@@ -23,8 +23,8 @@ package net.server.channel.handlers;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.inventory.Inventory;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import config.YamlConfig;
|
||||
@@ -54,7 +54,7 @@ public final class InventoryMergeHandler extends AbstractPacketHandler {
|
||||
}
|
||||
|
||||
MapleInventoryType inventoryType = MapleInventoryType.getByType(invType);
|
||||
MapleInventory inventory = c.getPlayer().getInventory(inventoryType);
|
||||
Inventory inventory = c.getPlayer().getInventory(inventoryType);
|
||||
inventory.lockInventory();
|
||||
try {
|
||||
//------------------- RonanLana's SLOT MERGER -----------------
|
||||
|
||||
@@ -280,7 +280,7 @@ public final class InventorySortHandler extends AbstractPacketHandler {
|
||||
ArrayList<Item> itemarray = new ArrayList<>();
|
||||
List<ModifyInventory> mods = new ArrayList<>();
|
||||
|
||||
MapleInventory inventory = chr.getInventory(MapleInventoryType.getByType(invType));
|
||||
Inventory inventory = chr.getInventory(MapleInventoryType.getByType(invType));
|
||||
inventory.lockInventory();
|
||||
try {
|
||||
for (short i = 1; i <= inventory.getSlotLimit(); i++) {
|
||||
|
||||
@@ -24,8 +24,8 @@ package net.server.channel.handlers;
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.autoban.AutobanManager;
|
||||
import client.inventory.Inventory;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.MaplePet;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
@@ -71,7 +71,7 @@ public final class PetFoodHandler extends AbstractPacketHandler {
|
||||
|
||||
if (c.tryacquireClient()) {
|
||||
try {
|
||||
MapleInventory useInv = chr.getInventory(MapleInventoryType.USE);
|
||||
Inventory useInv = chr.getInventory(MapleInventoryType.USE);
|
||||
useInv.lockInventory();
|
||||
try {
|
||||
Item use = useInv.getItem(pos);
|
||||
|
||||
@@ -24,8 +24,8 @@ package net.server.channel.handlers;
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.autoban.AutobanFactory;
|
||||
import client.inventory.Inventory;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import client.inventory.manipulator.MapleKarmaManipulator;
|
||||
@@ -518,7 +518,7 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
|
||||
}
|
||||
}
|
||||
|
||||
MapleInventory inv = chr.getInventory(ivType);
|
||||
Inventory inv = chr.getInventory(ivType);
|
||||
inv.lockInventory();
|
||||
try {
|
||||
Item checkItem = chr.getInventory(ivType).getItem(pos);
|
||||
|
||||
@@ -314,7 +314,7 @@ public final class PlayerLoggedinHandler extends AbstractPacketHandler {
|
||||
player.updatePartyMemberHP();
|
||||
}
|
||||
|
||||
MapleInventory eqpInv = player.getInventory(MapleInventoryType.EQUIPPED);
|
||||
Inventory eqpInv = player.getInventory(MapleInventoryType.EQUIPPED);
|
||||
eqpInv.lockInventory();
|
||||
try {
|
||||
for (Item it : eqpInv.list()) {
|
||||
|
||||
@@ -3,7 +3,7 @@ package net.server.channel.handlers;
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.MapleQuestStatus;
|
||||
import client.inventory.MapleInventory;
|
||||
import client.inventory.Inventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import net.AbstractPacketHandler;
|
||||
@@ -47,7 +47,7 @@ public class RaiseIncExpHandler extends AbstractPacketHandler {
|
||||
}
|
||||
|
||||
int consId;
|
||||
MapleInventory inv = chr.getInventory(MapleInventoryType.getByType(inventorytype));
|
||||
Inventory inv = chr.getInventory(MapleInventoryType.getByType(inventorytype));
|
||||
inv.lockInventory();
|
||||
try {
|
||||
consId = inv.getItem(slot).getItemId();
|
||||
|
||||
@@ -22,8 +22,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package net.server.channel.handlers;
|
||||
|
||||
import client.*;
|
||||
import client.inventory.Inventory;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.MapleWeaponType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
@@ -123,7 +123,7 @@ public final class RangedAttackHandler extends AbstractDealDamageHandler {
|
||||
if (hasShadowPartner) {
|
||||
bulletCount *= 2;
|
||||
}
|
||||
MapleInventory inv = chr.getInventory(MapleInventoryType.USE);
|
||||
Inventory inv = chr.getInventory(MapleInventoryType.USE);
|
||||
for (short i = 1; i <= inv.getSlotLimit(); i++) {
|
||||
Item item = inv.getItem(i);
|
||||
if (item != null) {
|
||||
@@ -174,7 +174,7 @@ public final class RangedAttackHandler extends AbstractDealDamageHandler {
|
||||
if (projectile != 0 || soulArrow || attack.skill == 11101004 || attack.skill == 15111007 || attack.skill == 14101006 || attack.skill == 4111004 || attack.skill == 13101005) {
|
||||
int visProjectile = projectile; //visible projectile sent to players
|
||||
if (ItemConstants.isThrowingStar(projectile)) {
|
||||
MapleInventory cash = chr.getInventory(MapleInventoryType.CASH);
|
||||
Inventory cash = chr.getInventory(MapleInventoryType.CASH);
|
||||
for (int i = 1; i <= cash.getSlotLimit(); i++) { // impose order...
|
||||
Item item = cash.getItem((short) i);
|
||||
if (item != null) {
|
||||
|
||||
@@ -68,7 +68,7 @@ public final class ScrollHandler extends AbstractPacketHandler {
|
||||
}
|
||||
byte oldLevel = toScroll.getLevel();
|
||||
byte oldSlots = toScroll.getUpgradeSlots();
|
||||
MapleInventory useInventory = chr.getInventory(MapleInventoryType.USE);
|
||||
Inventory useInventory = chr.getInventory(MapleInventoryType.USE);
|
||||
Item scroll = useInventory.getItem(slot);
|
||||
Item wscroll = null;
|
||||
|
||||
@@ -141,7 +141,7 @@ public final class ScrollHandler extends AbstractPacketHandler {
|
||||
if(!ItemConstants.isWeddingRing(toScroll.getItemId())) {
|
||||
mods.add(new ModifyInventory(3, toScroll));
|
||||
if (dst < 0) {
|
||||
MapleInventory inv = chr.getInventory(MapleInventoryType.EQUIPPED);
|
||||
Inventory inv = chr.getInventory(MapleInventoryType.EQUIPPED);
|
||||
|
||||
inv.lockInventory();
|
||||
try {
|
||||
@@ -151,7 +151,7 @@ public final class ScrollHandler extends AbstractPacketHandler {
|
||||
inv.unlockInventory();
|
||||
}
|
||||
} else {
|
||||
MapleInventory inv = chr.getInventory(MapleInventoryType.EQUIP);
|
||||
Inventory inv = chr.getInventory(MapleInventoryType.EQUIP);
|
||||
|
||||
inv.lockInventory();
|
||||
try {
|
||||
|
||||
@@ -25,8 +25,8 @@ import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.Skill;
|
||||
import client.SkillFactory;
|
||||
import client.inventory.Inventory;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import net.AbstractPacketHandler;
|
||||
@@ -56,7 +56,7 @@ public final class SkillBookHandler extends AbstractPacketHandler {
|
||||
MapleCharacter player = c.getPlayer();
|
||||
if (c.tryacquireClient()) {
|
||||
try {
|
||||
MapleInventory inv = c.getPlayer().getInventory(MapleInventoryType.USE);
|
||||
Inventory inv = c.getPlayer().getInventory(MapleInventoryType.USE);
|
||||
Item toUse = inv.getItem(slot);
|
||||
if (toUse == null || toUse.getItemId() != itemId) {
|
||||
return;
|
||||
|
||||
@@ -22,8 +22,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package net.server.channel.handlers;
|
||||
|
||||
import client.*;
|
||||
import client.inventory.Inventory;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import client.status.MonsterStatus;
|
||||
@@ -105,7 +105,7 @@ public final class TakeDamageHandler extends AbstractPacketHandler {
|
||||
if (dropCount > 0) {
|
||||
int qty;
|
||||
|
||||
MapleInventory inv = chr.getInventory(type);
|
||||
Inventory inv = chr.getInventory(type);
|
||||
inv.lockInventory();
|
||||
try {
|
||||
qty = Math.min(chr.countItem(loseItem.getId()), dropCount);
|
||||
|
||||
@@ -68,7 +68,7 @@ public final class UseCashItemHandler extends AbstractPacketHandler {
|
||||
int itemId = p.readInt();
|
||||
int itemType = itemId / 10000;
|
||||
|
||||
MapleInventory cashInv = player.getInventory(MapleInventoryType.CASH);
|
||||
Inventory cashInv = player.getInventory(MapleInventoryType.CASH);
|
||||
Item toUse = cashInv.getItem(position);
|
||||
if (toUse == null || toUse.getItemId() != itemId) {
|
||||
toUse = cashInv.findById(itemId);
|
||||
@@ -601,7 +601,7 @@ public final class UseCashItemHandler extends AbstractPacketHandler {
|
||||
}
|
||||
|
||||
private static void remove(MapleClient c, short position, int itemid) {
|
||||
MapleInventory cashInv = c.getPlayer().getInventory(MapleInventoryType.CASH);
|
||||
Inventory cashInv = c.getPlayer().getInventory(MapleInventoryType.CASH);
|
||||
cashInv.lockInventory();
|
||||
try {
|
||||
Item it = cashInv.getItem(position);
|
||||
|
||||
@@ -24,8 +24,8 @@ package net.server.channel.handlers;
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.MapleMount;
|
||||
import client.inventory.Inventory;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import constants.game.ExpTable;
|
||||
@@ -46,7 +46,7 @@ public final class UseMountFoodHandler extends AbstractPacketHandler {
|
||||
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
MapleMount mount = chr.getMount();
|
||||
MapleInventory useInv = chr.getInventory(MapleInventoryType.USE);
|
||||
Inventory useInv = chr.getInventory(MapleInventoryType.USE);
|
||||
|
||||
if (c.tryacquireClient()) {
|
||||
try {
|
||||
|
||||
@@ -23,8 +23,8 @@ package net.server.channel.handlers;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.inventory.Inventory;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import net.AbstractPacketHandler;
|
||||
@@ -50,7 +50,7 @@ public final class UseSolomonHandler extends AbstractPacketHandler {
|
||||
if (c.tryacquireClient()) {
|
||||
try {
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
MapleInventory inv = chr.getInventory(MapleInventoryType.USE);
|
||||
Inventory inv = chr.getInventory(MapleInventoryType.USE);
|
||||
inv.lockInventory();
|
||||
try {
|
||||
Item slotItem = inv.getItem(slot);
|
||||
|
||||
@@ -9,8 +9,8 @@ package net.server.channel.handlers;
|
||||
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.inventory.Inventory;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import client.inventory.manipulator.MapleKarmaManipulator;
|
||||
@@ -57,7 +57,7 @@ public final class WeddingHandler extends AbstractPacketHandler {
|
||||
MapleCharacter spouse = marriage.getPlayerById(cid);
|
||||
if (spouse != null) {
|
||||
MapleInventoryType type = ItemConstants.getInventoryType(itemid);
|
||||
MapleInventory chrInv = chr.getInventory(type);
|
||||
Inventory chrInv = chr.getInventory(type);
|
||||
|
||||
Item newItem = null;
|
||||
chrInv.lockInventory();
|
||||
@@ -111,7 +111,7 @@ public final class WeddingHandler extends AbstractPacketHandler {
|
||||
if (groomWishlist != null) {
|
||||
Item item = marriage.getGiftItem(c, groomWishlist, itemPos);
|
||||
if (item != null) {
|
||||
if (MapleInventory.checkSpot(chr, item)) {
|
||||
if (Inventory.checkSpot(chr, item)) {
|
||||
marriage.removeGiftItem(groomWishlist, item);
|
||||
marriage.saveGiftItemsToDb(c, groomWishlist, chr.getId());
|
||||
|
||||
@@ -131,7 +131,7 @@ public final class WeddingHandler extends AbstractPacketHandler {
|
||||
List<Item> items = c.getAbstractPlayerInteraction().getUnclaimedMarriageGifts();
|
||||
try {
|
||||
Item item = items.get(itemPos);
|
||||
if (MapleInventory.checkSpot(chr, item)) {
|
||||
if (Inventory.checkSpot(chr, item)) {
|
||||
items.remove(itemPos);
|
||||
MapleMarriage.saveGiftItemsToDb(c, items, chr.getId());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user