Renamed class to not conflict with the java.lang version.

This commit is contained in:
2024-04-05 07:59:44 -04:00
parent dd84615ca1
commit c1ee6f5b52
388 changed files with 1807 additions and 1779 deletions
+33 -33
View File
@@ -9,12 +9,12 @@
package engine.objects;
import engine.Enum;
import engine.Enum.*;
import engine.exception.SerializationException;
import engine.gameManager.ConfigManager;
import engine.gameManager.DbManager;
import engine.gameManager.PowersManager;
import engine.mbEnums;
import engine.mbEnums.*;
import engine.net.ByteBufferReader;
import engine.net.ByteBufferWriter;
import engine.net.Dispatch;
@@ -41,15 +41,15 @@ public class Item extends AbstractWorldObject {
private static ConcurrentHashMap<String, Integer> enchantValues = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
private final ConcurrentHashMap<AbstractEffectModifier, Float> bonuses = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
private final ArrayList<String> effectNames = new ArrayList<>();
public Enum.ItemContainerType containerType;
public mbEnums.ItemContainerType containerType;
public ReentrantLock lootLock = new ReentrantLock();
public int ownerID; //may be character, account, npc, mob
public float drop_chance;
public EnumSet<Enum.ItemFlags> flags = EnumSet.noneOf(ItemFlags.class);
public EnumSet<mbEnums.ItemFlags> flags = EnumSet.noneOf(ItemFlags.class);
public int numberOfItems;
public float combat_health_current;
public int chargesRemaining;
public Enum.EquipSlotType equipSlot;
public mbEnums.EquipSlotType equipSlot;
private boolean canDestroy;
private boolean isRandom = false;
public int value;
@@ -105,19 +105,19 @@ public class Item extends AbstractWorldObject {
switch (container) {
case "inventory":
this.containerType = Enum.ItemContainerType.INVENTORY;
this.containerType = mbEnums.ItemContainerType.INVENTORY;
break;
case "bank":
this.containerType = Enum.ItemContainerType.BANK;
this.containerType = mbEnums.ItemContainerType.BANK;
break;
case "vault":
this.containerType = Enum.ItemContainerType.VAULT;
this.containerType = mbEnums.ItemContainerType.VAULT;
break;
case "equip":
this.containerType = Enum.ItemContainerType.EQUIPPED;
this.containerType = mbEnums.ItemContainerType.EQUIPPED;
break;
case "forge":
this.containerType = Enum.ItemContainerType.FORGE;
this.containerType = mbEnums.ItemContainerType.FORGE;
break;
case "warehouse":
this.containerType = ItemContainerType.WAREHOUSE;
@@ -160,7 +160,7 @@ public class Item extends AbstractWorldObject {
if (flagString.isEmpty() == false)
for (String itemFlag : flagString.split(";"))
this.flags.add(Enum.ItemFlags.valueOf(itemFlag));
this.flags.add(mbEnums.ItemFlags.valueOf(itemFlag));
this.dateToUpgrade = rs.getLong("dateToUpgrade");
this.value = rs.getInt("value");
@@ -530,16 +530,16 @@ public class Item extends AbstractWorldObject {
return (Item) DbManager.getFromCache(GameObjectType.Item, id);
}
public static Item newGoldItem(AbstractWorldObject awo, Enum.ItemContainerType containerType) {
public static Item newGoldItem(AbstractWorldObject awo, mbEnums.ItemContainerType containerType) {
return newGoldItem(awo, containerType, true);
}
//used for vault!
public static Item newGoldItem(int accountID, Enum.ItemContainerType containerType) {
public static Item newGoldItem(int accountID, mbEnums.ItemContainerType containerType) {
return newGoldItem(accountID, containerType, true);
}
private static Item newGoldItem(int accountID, Enum.ItemContainerType containerType, boolean persist) {
private static Item newGoldItem(int accountID, mbEnums.ItemContainerType containerType, boolean persist) {
int ownerID;
OwnerType ownerType;
@@ -565,7 +565,7 @@ public class Item extends AbstractWorldObject {
return newGold;
}
private static Item newGoldItem(AbstractWorldObject awo, Enum.ItemContainerType containerType, boolean persist) {
private static Item newGoldItem(AbstractWorldObject awo, mbEnums.ItemContainerType containerType, boolean persist) {
int ownerID;
OwnerType ownerType;
@@ -573,7 +573,7 @@ public class Item extends AbstractWorldObject {
if (awo.getObjectType().equals(GameObjectType.Mob))
return null;
if (containerType == Enum.ItemContainerType.VAULT) {
if (containerType == mbEnums.ItemContainerType.VAULT) {
if (!(awo.getObjectType().equals(GameObjectType.PlayerCharacter))) {
Logger.error("AWO is not a PlayerCharacter");
return null;
@@ -748,19 +748,19 @@ public class Item extends AbstractWorldObject {
this.ownerID = 0;
this.ownerType = null;
this.containerType = Enum.ItemContainerType.NONE;
this.containerType = mbEnums.ItemContainerType.NONE;
this.equipSlot = EquipSlotType.NONE;
}
protected void validateItemContainer() {
if (this.containerType == Enum.ItemContainerType.NONE)
if (this.containerType == mbEnums.ItemContainerType.NONE)
if (this.ownerID != 0)
// Item has an owner, just somehow the flags got messed up.
// Default to bank.
// TODO NEED LOG EVENT HERE.
this.containerType = Enum.ItemContainerType.BANK;
this.containerType = mbEnums.ItemContainerType.BANK;
else
// This item is on the ground. Nothing to worry about.
this.zeroItem();
@@ -811,7 +811,7 @@ public class Item extends AbstractWorldObject {
this.zeroItem();
this.ownerID = npc.getObjectUUID();
this.ownerType = OwnerType.Npc;
this.containerType = Enum.ItemContainerType.INVENTORY;
this.containerType = mbEnums.ItemContainerType.INVENTORY;
this.equipSlot = EquipSlotType.NONE;
return true;
}
@@ -829,7 +829,7 @@ public class Item extends AbstractWorldObject {
this.zeroItem();
this.ownerID = 0;
this.ownerType = null;
this.containerType = Enum.ItemContainerType.INVENTORY;
this.containerType = mbEnums.ItemContainerType.INVENTORY;
this.equipSlot = EquipSlotType.NONE;
return true;
}
@@ -847,7 +847,7 @@ public class Item extends AbstractWorldObject {
this.zeroItem();
this.ownerID = pc.getObjectUUID();
this.ownerType = OwnerType.PlayerCharacter;
this.containerType = Enum.ItemContainerType.BANK;
this.containerType = mbEnums.ItemContainerType.BANK;
this.equipSlot = EquipSlotType.NONE;
return true;
}
@@ -865,7 +865,7 @@ public class Item extends AbstractWorldObject {
this.zeroItem();
this.ownerID = npc.getObjectUUID();
this.ownerType = OwnerType.Npc;
this.containerType = Enum.ItemContainerType.BANK;
this.containerType = mbEnums.ItemContainerType.BANK;
this.equipSlot = EquipSlotType.NONE;
return true;
}
@@ -883,12 +883,12 @@ public class Item extends AbstractWorldObject {
this.zeroItem();
this.ownerID = a.getObjectUUID();
this.ownerType = OwnerType.Account;
this.containerType = Enum.ItemContainerType.VAULT;
this.containerType = mbEnums.ItemContainerType.VAULT;
this.equipSlot = EquipSlotType.NONE;
return true;
}
protected synchronized boolean equipItem(PlayerCharacter pc, Enum.EquipSlotType slot) {
protected synchronized boolean equipItem(PlayerCharacter pc, mbEnums.EquipSlotType slot) {
if (!DbManager.ItemQueries.UPDATE_OWNER(this,
pc.getObjectUUID(), //tableID
@@ -902,26 +902,26 @@ public class Item extends AbstractWorldObject {
this.zeroItem();
this.ownerID = pc.getObjectUUID();
this.ownerType = OwnerType.PlayerCharacter;
this.containerType = Enum.ItemContainerType.EQUIPPED;
this.containerType = mbEnums.ItemContainerType.EQUIPPED;
this.equipSlot = slot;
return true;
}
protected synchronized boolean equipItem(NPC npc, Enum.EquipSlotType slot) {
protected synchronized boolean equipItem(NPC npc, mbEnums.EquipSlotType slot) {
this.zeroItem();
this.ownerID = npc.getObjectUUID();
this.ownerType = OwnerType.Npc;
this.containerType = Enum.ItemContainerType.EQUIPPED;
this.containerType = mbEnums.ItemContainerType.EQUIPPED;
this.equipSlot = slot;
return true;
}
protected synchronized boolean equipItem(Mob mobile, Enum.EquipSlotType slot) {
protected synchronized boolean equipItem(Mob mobile, mbEnums.EquipSlotType slot) {
this.zeroItem();
this.ownerID = mobile.getObjectUUID();
this.ownerType = OwnerType.Mob;
this.containerType = Enum.ItemContainerType.EQUIPPED;
this.containerType = mbEnums.ItemContainerType.EQUIPPED;
this.equipSlot = slot;
return true;
}
@@ -930,7 +930,7 @@ public class Item extends AbstractWorldObject {
EffectsBase effect;
if (ConfigManager.serverType.equals(Enum.ServerType.LOGINSERVER))
if (ConfigManager.serverType.equals(mbEnums.ServerType.LOGINSERVER))
return;
@@ -1062,7 +1062,7 @@ public class Item extends AbstractWorldObject {
DeleteItemMsg deleteItemMsg = new DeleteItemMsg(this.getObjectType().ordinal(), this.getObjectUUID());
charItemMan.cleanupDupe(this);
Dispatch dispatch = Dispatch.borrow(pc, deleteItemMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
return false;
}
@@ -1085,7 +1085,7 @@ public class Item extends AbstractWorldObject {
DeleteItemMsg deleteItemMsg = new DeleteItemMsg(this.getObjectType().ordinal(), this.getObjectUUID());
charItemMan.cleanupDupe(this);
Dispatch dispatch = Dispatch.borrow(pc, deleteItemMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
DispatchMessage.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.SECONDARY);
return false;
}
return true;