Browse Source

Unused Junk removal

combat-2
MagicBot 8 months ago
parent
commit
ea38c3bef7
  1. 76
      src/engine/objects/CharacterItemManager.java

76
src/engine/objects/CharacterItemManager.java

@ -20,7 +20,6 @@ import engine.math.Vector3fImmutable;
import engine.net.Dispatch; import engine.net.Dispatch;
import engine.net.DispatchMessage; import engine.net.DispatchMessage;
import engine.net.client.ClientConnection; import engine.net.client.ClientConnection;
import engine.net.client.ClientMessagePump;
import engine.net.client.msg.*; import engine.net.client.msg.*;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
@ -35,9 +34,6 @@ import static engine.net.client.msg.ErrorPopupMsg.sendErrorPopup;
public class CharacterItemManager { public class CharacterItemManager {
private static final byte inventoryVer = (byte) 0;
private static final byte bankVer = (byte) 0;
private static final byte vaultVer = (byte) 0;
private final AbstractCharacter absCharacter; private final AbstractCharacter absCharacter;
// Mapping of all the items associated with this Manager // Mapping of all the items associated with this Manager
private final ConcurrentHashMap<Integer, Integer> itemIDtoType = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW); private final ConcurrentHashMap<Integer, Integer> itemIDtoType = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
@ -63,58 +59,12 @@ public class CharacterItemManager {
private HashSet<Integer> trading; private HashSet<Integer> trading;
private int goldTradingAmount; private int goldTradingAmount;
private int tradeID = 0; private int tradeID = 0;
/*
* Item Manager Version data
*/
private byte equipVer = (byte) 0;
public CharacterItemManager(AbstractCharacter ac) { public CharacterItemManager(AbstractCharacter ac) {
super(); super();
this.absCharacter = ac; this.absCharacter = ac;
} }
public static byte getInventoryVer() {
return inventoryVer;
}
public static byte getBankVer() {
return bankVer;
}
public static byte getVaultVer() {
return vaultVer;
}
public static void takeFromNPC(NPC npc, PlayerCharacter pc, Item take, ClientMessagePump clientMessagePump) {
ItemBase ib = take.getItemBase();
ItemTemplate template = take.template;
if (template == null)
return;
CharacterItemManager itemMan = pc.charItemManager;
if (itemMan == null)
return;
CharacterItemManager npcCim = npc.charItemManager;
if (npcCim == null)
return;
if (!npcCim.inventoryContains(take))
return;
if (!itemMan.hasRoomInventory(template.item_wt))
return;
if (take != null) {
itemMan.buyFromNPC(take, npc);
itemMan.updateInventory();
}
}
public void load() { public void load() {
loadForGeneric(); loadForGeneric();
@ -122,7 +72,6 @@ public class CharacterItemManager {
loadForPlayerCharacter(); loadForPlayerCharacter();
else if (this.absCharacter.getObjectType().equals(GameObjectType.NPC)) else if (this.absCharacter.getObjectType().equals(GameObjectType.NPC))
loadForNPC(); loadForNPC();
} }
public void loadGoldItems() { public void loadGoldItems() {
@ -2008,27 +1957,6 @@ public class CharacterItemManager {
updateInventory(this.getInventory(), false); updateInventory(this.getInventory(), false);
} }
public synchronized void purgeInventory() {
if (!this.absCharacter.getObjectType().equals(GameObjectType.PlayerCharacter))
return;
if (this.goldInventory != null)
if (this.getGoldInventory().getNumOfItems() > 0) {
if (DbManager.ItemQueries.UPDATE_GOLD(this.goldInventory, 0)) {
this.goldInventory.setNumOfItems(0);
}
}
if (this.inventory.size() > 0)
DbManager.ItemQueries.ORPHAN_INVENTORY(this.inventory);
// clear the inventory.
this.inventory.clear();
//re-calculate inventory weight
calculateInventoryWeight();
}
/** /**
* Note that this method returns a <b>copy</b> of the internally stored * Note that this method returns a <b>copy</b> of the internally stored
* list. * list.
@ -2135,10 +2063,6 @@ public class CharacterItemManager {
return this.vaultWeight; return this.vaultWeight;
} }
public int getTradingForWeight() {
return calculateTradingForWeight();
}
public int getTradingWeight() { public int getTradingWeight() {
int weight = 0; int weight = 0;

Loading…
Cancel
Save