Browse Source

Logic cleanup

combat-2
MagicBot 8 months ago
parent
commit
784767dc4e
  1. 23
      src/engine/objects/ItemTemplate.java

23
src/engine/objects/ItemTemplate.java

@ -530,23 +530,24 @@ public class ItemTemplate {
if (itemManager == null || abstractCharacter == null) if (itemManager == null || abstractCharacter == null)
return false; return false;
if (abstractCharacter.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) { // Early exit for mobiles and NPCS.
// Perhaps not needed now that mobs have skills.
if (!validForSlot(slot, itemManager.getEquipped(), item)) if (EnumSet.of(Enum.GameObjectType.NPC, Enum.GameObjectType.Mob).contains(abstractCharacter.getObjectType()))
return false; return false;
if (!validForSkills(item, abstractCharacter.getSkills())) if (!validForSlot(slot, itemManager.getEquipped(), item))
return false; return false;
if (canCharacterEquip(item, abstractCharacter) == false) if (!validForSkills(item, abstractCharacter.getSkills()))
return false; return false;
//players can't wear 0 value items. if (canCharacterEquip(item, abstractCharacter) == false)
return false;
return item.template.item_value != 0 || Kit.IsNoobGear(item.getItemBase().uuid); //players can't wear 0 value items.
} return item.template.item_value != 0 || Kit.IsNoobGear(item.getItemBase().uuid);
return true; //Mobiles and NPC's don't need to check equip
} }
} }

Loading…
Cancel
Save