Browse Source

File reformat.

combat-2
MagicBot 9 months ago
parent
commit
d46b2dc298
  1. 155
      src/engine/objects/ItemBase.java

155
src/engine/objects/ItemBase.java

@ -34,59 +34,58 @@ public class ItemBase { @@ -34,59 +34,58 @@ public class ItemBase {
public static HashMap<Integer, ItemBase> _itemBaseByUUID = new HashMap<>();
public static HashMap<engine.Enum.ItemType, HashSet<ItemBase>> ItemBaseTypeMap = new HashMap<>();
// Internal cache
private static HashMap<Integer, Integer> itemHashIDMap = new HashMap<>();
private static HashMap<String, Integer> _IDsByNames = new HashMap<>();
private static ArrayList<ItemBase> _resourceList = new ArrayList<>();
private static final HashMap<Integer, Integer> itemHashIDMap = new HashMap<>();
private static final HashMap<String, Integer> _IDsByNames = new HashMap<>();
private static final ArrayList<ItemBase> _resourceList = new ArrayList<>();
private final int uuid;
private final String name;
private float durability;
private int value;
private short weight;
private short color;
private ItemType type;
//requirements/restrictions
public EnumSet<Enum.MonsterType> restrictedRaces;
public EnumSet<Enum.MonsterType> requiredRaces;
public EnumSet<Enum.ClassType> restrictedClasses;
public EnumSet<Enum.ClassType> requiredClasses;
public EnumSet<Enum.DisciplineType> requiredDiscs;
public EnumSet<Enum.DisciplineType> restrictedDiscs;
private final float durability;
private final int value;
private final short weight;
private final short color;
private final ItemType type;
private int vendorType;
private int modTable;
private int useID;
private final int modTable;
private final int useID;
private int hashID;
private byte useAmount;
private final byte useAmount;
// Armor and weapon related values
private int equipFlag;
private int restrictFlag;
private String skillRequired;
private short percentRequired;
private float slashResist;
private float crushResist;
private float pierceResist;
private float blockMod;
private short defense;
private float dexPenalty;
private float speed;
private float range;
private short minDamage;
private short maxDamage;
private String mastery;
private engine.Enum.DamageType damageType;
private boolean twoHanded;
private final int equipFlag;
private final int restrictFlag;
private final String skillRequired;
private final short percentRequired;
private final float slashResist;
private final float crushResist;
private final float pierceResist;
private final float blockMod;
private final short defense;
private final float dexPenalty;
private final float speed;
private final float range;
private final short minDamage;
private final short maxDamage;
private final String mastery;
private final engine.Enum.DamageType damageType;
private final boolean twoHanded;
private boolean isConsumable;
private boolean isStackable;
private int numCharges;
private final int numCharges;
// Item stat modifiers
private HashMap<Integer, Integer> bakedInStats = new HashMap<>();
private HashMap<Integer, Integer> usedStats = new HashMap<>();
private float parryBonus;
private boolean isStrBased;
private final HashMap<Integer, Integer> bakedInStats = new HashMap<>();
private final HashMap<Integer, Integer> usedStats = new HashMap<>();
private final float parryBonus;
private final boolean isStrBased;
private ArrayList<Integer> animations = new ArrayList<>();
private ArrayList<Integer> offHandAnimations = new ArrayList<>();
private boolean autoID = false;
//requirements/restrictions
public EnumSet<Enum.MonsterType> restrictedRaces;
public EnumSet<Enum.MonsterType> requiredRaces;
public EnumSet<Enum.ClassType> restrictedClasses;
public EnumSet<Enum.ClassType> requiredClasses;
public EnumSet<Enum.DisciplineType> requiredDiscs;
public EnumSet<Enum.DisciplineType> restrictedDiscs;
/**
* ResultSet Constructor
*/
@ -324,11 +323,8 @@ public class ItemBase { @@ -324,11 +323,8 @@ public class ItemBase {
public boolean isDiscRune() {
int ID = uuid;
if (ID > 2499 && ID < 3050) { //class, discipline runes
return true;
} else {
return false;
}
//class, discipline runes
return ID > 2499 && ID < 3050;
}
public boolean isGlass() {
@ -486,7 +482,7 @@ public class ItemBase { @@ -486,7 +482,7 @@ public class ItemBase {
if (!validForSkills(abstractCharacter.getSkills()))
return false;
if(this.canCharacterEquip(abstractCharacter) == false)
if (this.canCharacterEquip(abstractCharacter) == false)
return false;
return item.getItemBase().value != 0 || Kit.IsNoobGear(item.getItemBase().uuid);
@ -496,6 +492,7 @@ public class ItemBase { @@ -496,6 +492,7 @@ public class ItemBase {
return true; //Mobiles and NPC's don't need to check equip
}
public int getValidSlot() {
int slotValue = 0;
@ -772,19 +769,19 @@ public class ItemBase { @@ -772,19 +769,19 @@ public class ItemBase {
}
public boolean isThrowing() {
return this.mastery.equals("Throwing") ? true : false;
return this.mastery.equals("Throwing");
}
public boolean isStaff() {
return this.mastery.equals("Staff") ? true : false;
return this.mastery.equals("Staff");
}
public boolean isScepter() {
return this.mastery.equals("Benediction") ? true : false;
return this.mastery.equals("Benediction");
}
public boolean isArchery() {
return this.mastery.equals("Archery") ? true : false;
return this.mastery.equals("Archery");
}
public boolean isMelee() {
@ -935,66 +932,66 @@ public class ItemBase { @@ -935,66 +932,66 @@ public class ItemBase {
this.autoID = autoID;
}
public boolean isArmor(){
public boolean isArmor() {
if(this.isHeavyArmor())
if (this.isHeavyArmor())
return true;
if(this.isMediumArmor())
if (this.isMediumArmor())
return true;
if(this.isLightArmor())
if (this.isLightArmor())
return true;
if(this.isClothArmor())
return true;
return false;
return this.isClothArmor();
}
public Boolean canCharacterEquip(AbstractCharacter character){
return ValidRace(character.absRace) && ValidClass(character.absBaseClass,character.absPromotionClass) && ValidDiscipline(character.absDisciplines);
public Boolean canCharacterEquip(AbstractCharacter character) {
return ValidRace(character.absRace) && ValidClass(character.absBaseClass, character.absPromotionClass) && ValidDiscipline(character.absDisciplines);
}
public Boolean ValidRace(Enum.MonsterType race){
if(this.requiredRaces.isEmpty() && this.restrictedRaces.isEmpty())
return true;
public Boolean ValidRace(Enum.MonsterType race) {
if(this.requiredRaces.isEmpty() == false && race.elementOf(this.requiredRaces) == true)
if (this.requiredRaces.isEmpty() && this.restrictedRaces.isEmpty())
return true;
if(this.restrictedRaces.isEmpty() == false && race.elementOf(this.restrictedRaces) == false)
if (this.requiredRaces.isEmpty() == false && race.elementOf(this.requiredRaces) == true)
return true;
return false;
return this.restrictedRaces.isEmpty() == false && race.elementOf(this.restrictedRaces) == false;
}
public Boolean ValidClass(Enum.ClassType base,Enum.ClassType profession){
public Boolean ValidClass(Enum.ClassType base, Enum.ClassType profession) {
boolean requiredEmpty = this.requiredClasses == null || this.requiredClasses.isEmpty();
boolean restrictedEmpty = this.restrictedClasses == null || this.restrictedClasses.isEmpty();
if(requiredEmpty && restrictedEmpty)
if (requiredEmpty && restrictedEmpty)
return true;
if(this.requiredClasses != null && this.requiredClasses.isEmpty() == false)
if(this.requiredClasses.contains(base) || this.requiredClasses.contains(profession))
if (this.requiredClasses != null && this.requiredClasses.isEmpty() == false)
if (this.requiredClasses.contains(base) || this.requiredClasses.contains(profession))
return true;
if(this.restrictedClasses != null && this.restrictedClasses.isEmpty() == false)
if(this.restrictedClasses.contains(base) == false && this.restrictedClasses.contains(profession) == false)
return true;
if (this.restrictedClasses != null && this.restrictedClasses.isEmpty() == false)
return this.restrictedClasses.contains(base) == false && this.restrictedClasses.contains(profession) == false;
return false;
}
public Boolean ValidDiscipline(EnumSet<Enum.DisciplineType> discs){
public Boolean ValidDiscipline(EnumSet<Enum.DisciplineType> discs) {
boolean requiredEmpty = this.requiredDiscs == null || this.requiredDiscs.isEmpty();
boolean restrictedEmpty = this.restrictedDiscs == null || this.restrictedDiscs.isEmpty();
if(requiredEmpty && restrictedEmpty)
if (requiredEmpty && restrictedEmpty)
return true;
for(Enum.DisciplineType disc : discs){
if(this.requiredDiscs.isEmpty() == false && this.requiredDiscs.contains(disc))
for (Enum.DisciplineType disc : discs) {
if (this.requiredDiscs.isEmpty() == false && this.requiredDiscs.contains(disc))
return true;
if(this.restrictedDiscs.isEmpty() == false && this.restrictedDiscs.contains(disc))
if (this.restrictedDiscs.isEmpty() == false && this.restrictedDiscs.contains(disc))
return false;
}
return false;

Loading…
Cancel
Save