Refactor item_type

This commit is contained in:
2024-03-10 13:34:24 -04:00
parent 87290baa52
commit df5c607375
24 changed files with 137 additions and 203 deletions
+4 -4
View File
@@ -51,7 +51,7 @@ public enum CombatManager {
// if you carry something in the offhand thats a weapon you get to swing it
if (weaponOff != null)
if (weaponOff.getItemBase().getType().equals(ItemType.WEAPON))
if (weaponOff.template.item_type.equals(ItemType.WEAPON))
swingOffhand = true;
// if you carry nothing in either hand you get to swing your offhand
@@ -320,7 +320,7 @@ public enum CombatManager {
else {
ItemBase ib = weapon.getItemBase();
if (ib == null || !ib.getType().equals(ItemType.WEAPON))
if (ib == null || !weapon.template.item_type.equals(ItemType.WEAPON))
isWeapon = false;
else
wb = ib;
@@ -338,7 +338,7 @@ public enum CombatManager {
if (weaponOff != null) {
ItemBase ib = weaponOff.getItemBase();
if (ib == null || !ib.getType().equals(ItemType.WEAPON))
if (ib == null || !weaponOff.template.item_type.equals(ItemType.WEAPON))
hasNoWeapon = true;
else
return 1; //no need to attack with this hand
@@ -904,7 +904,7 @@ public enum CombatManager {
if (ib == null)
return false;
if (ib.getType().equals(ItemType.WEAPON) == false)
if (item.template.item_type.equals(ItemType.WEAPON) == false)
return false;
return ib.getRange() > MBServerStatics.RANGED_WEAPON_RANGE;
+1 -3
View File
@@ -175,14 +175,12 @@ public enum LootManager {
if (itemUUID == 0)
return null;
if (ItemBase.getItemBase(itemUUID).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) {
if (ItemTemplate.itemTemplates.get(itemUUID).item_type.equals(Enum.ItemType.RESOURCE)) {
int amount = ThreadLocalRandom.current().nextInt(tableRow.minSpawn, tableRow.maxSpawn + 1);
return new MobLoot(mob, ItemBase.getItemBase(itemUUID), amount, false);
}
outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false);
Enum.ItemType outType = outItem.getItemBase().getType();
if(selectedRow.pModTable != 0){
try {
+3 -3
View File
@@ -2502,12 +2502,12 @@ public enum PowersManager {
if (pb.targetItem())
return true;
// TODO add these checks later
else if (pb.targetArmor() && item.getItemBase().getType().equals(ItemType.ARMOR))
else if (pb.targetArmor() && item.template.item_type.equals(ItemType.ARMOR))
return true;
else if (pb.targetJewelry() && item.getItemBase().getType().equals(ItemType.JEWELRY))
else if (pb.targetJewelry() && item.template.item_type.equals(ItemType.JEWELRY))
return true;
else
return pb.targetWeapon() && item.getItemBase().getType().equals(ItemType.WEAPON);
return pb.targetWeapon() && item.template.item_type.equals(ItemType.WEAPON);
} // How did we get here? all valid targets have been covered
else
return false;