|
|
@ -9,6 +9,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
package engine.objects; |
|
|
|
package engine.objects; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import engine.Enum; |
|
|
|
import engine.Enum.DamageType; |
|
|
|
import engine.Enum.DamageType; |
|
|
|
import engine.Enum.GameObjectType; |
|
|
|
import engine.Enum.GameObjectType; |
|
|
|
import engine.Enum.ItemType; |
|
|
|
import engine.Enum.ItemType; |
|
|
@ -77,6 +78,15 @@ public class ItemBase { |
|
|
|
private ArrayList<Integer> offHandAnimations = new ArrayList<>(); |
|
|
|
private ArrayList<Integer> offHandAnimations = new ArrayList<>(); |
|
|
|
private boolean autoID = false; |
|
|
|
private boolean autoID = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//requirements/restrictions
|
|
|
|
|
|
|
|
public ArrayList<Enum.MonsterType> restrictedRaces; |
|
|
|
|
|
|
|
public ArrayList<Enum.MonsterType> requiredRaces; |
|
|
|
|
|
|
|
public ArrayList<Enum.PromoteType> restrictedClasses; |
|
|
|
|
|
|
|
public ArrayList<Enum.PromoteType> requiredClasses; |
|
|
|
|
|
|
|
public ArrayList<Integer> requiredDiscs; |
|
|
|
|
|
|
|
public ArrayList<Integer> restrictedDiscs; |
|
|
|
|
|
|
|
public Enum.SexType requiredSex; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* ResultSet Constructor |
|
|
|
* ResultSet Constructor |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -212,6 +222,7 @@ public class ItemBase { |
|
|
|
|
|
|
|
|
|
|
|
public static void loadAllItemBases() { |
|
|
|
public static void loadAllItemBases() { |
|
|
|
DbManager.ItemBaseQueries.LOAD_ALL_ITEMBASES(); |
|
|
|
DbManager.ItemBaseQueries.LOAD_ALL_ITEMBASES(); |
|
|
|
|
|
|
|
DbManager.ItemBaseQueries.LOAD_ALL_ITEM_REQUIREMENTS(); |
|
|
|
AnniverseryGifts.add(971000); |
|
|
|
AnniverseryGifts.add(971000); |
|
|
|
AnniverseryGifts.add(971001); |
|
|
|
AnniverseryGifts.add(971001); |
|
|
|
AnniverseryGifts.add(971002); |
|
|
|
AnniverseryGifts.add(971002); |
|
|
@ -468,6 +479,15 @@ public class ItemBase { |
|
|
|
if (!validForSkills(abstractCharacter.getSkills())) |
|
|
|
if (!validForSkills(abstractCharacter.getSkills())) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!validRace(item.getItemBase(), abstractCharacter)) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!validClass(item.getItemBase(), abstractCharacter)) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!validDisc(item.getItemBase(), abstractCharacter)) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
return item.getItemBase().value != 0 || Kit.IsNoobGear(item.getItemBase().uuid); |
|
|
|
return item.getItemBase().value != 0 || Kit.IsNoobGear(item.getItemBase().uuid); |
|
|
|
//players can't wear 0 value items.
|
|
|
|
//players can't wear 0 value items.
|
|
|
|
|
|
|
|
|
|
|
@ -476,6 +496,33 @@ public class ItemBase { |
|
|
|
return true; //Mobiles and NPC's don't need to check equip
|
|
|
|
return true; //Mobiles and NPC's don't need to check equip
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static boolean validRace(ItemBase ib, AbstractCharacter absChar){ |
|
|
|
|
|
|
|
if(ib.requiredRaces == null || ib.requiredRaces.isEmpty()) |
|
|
|
|
|
|
|
if(ib.restrictedRaces == null || ib.restrictedRaces.isEmpty()) |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ib.requiredRaces.contains(absChar.absRace) && !ib.restrictedRaces.contains(absChar.absRace); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public static boolean validClass(ItemBase ib, AbstractCharacter absChar){ |
|
|
|
|
|
|
|
if(ib.requiredClasses == null || ib.requiredClasses.isEmpty()) |
|
|
|
|
|
|
|
if(ib.restrictedClasses == null || ib.restrictedClasses.isEmpty()) |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ib.requiredClasses.contains(absChar.absClass) && !ib.restrictedClasses.contains(absChar.absClass); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static boolean validDisc(ItemBase ib, AbstractCharacter absChar){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(ib.requiredDiscs == null || ib.requiredDiscs.isEmpty()) |
|
|
|
|
|
|
|
if(ib.restrictedDiscs == null || ib.restrictedDiscs.isEmpty()) |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(CharacterRune rune : absChar.runes) |
|
|
|
|
|
|
|
if(ib.requiredDiscs.contains(rune.getRuneBaseID()) == true && ib.restrictedDiscs.contains(rune.getRuneBaseID()) == false) |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
public int getValidSlot() { |
|
|
|
public int getValidSlot() { |
|
|
|
int slotValue = 0; |
|
|
|
int slotValue = 0; |
|
|
|
|
|
|
|
|
|
|
@ -931,4 +978,43 @@ public class ItemBase { |
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void LoadRequirements(String racesRequired, String racesRestricted, String classesRequired, String classesRestricted, String discsRequired, String discsRestricted){ |
|
|
|
|
|
|
|
this.requiredRaces = new ArrayList<>(); |
|
|
|
|
|
|
|
this.restrictedRaces = new ArrayList<>(); |
|
|
|
|
|
|
|
this.requiredClasses = new ArrayList<>(); |
|
|
|
|
|
|
|
this.restrictedClasses = new ArrayList<>(); |
|
|
|
|
|
|
|
this.requiredDiscs = new ArrayList<>(); |
|
|
|
|
|
|
|
this.restrictedDiscs = new ArrayList<>(); |
|
|
|
|
|
|
|
if(racesRequired != null){ |
|
|
|
|
|
|
|
for(String entry : racesRequired.split(";")){ |
|
|
|
|
|
|
|
requiredRaces.add(Enum.MonsterType.valueOf(entry)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(racesRestricted != null){ |
|
|
|
|
|
|
|
for(String entry : racesRestricted.split(";")){ |
|
|
|
|
|
|
|
restrictedRaces.add(Enum.MonsterType.valueOf(entry)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(classesRequired != null){ |
|
|
|
|
|
|
|
for(String entry : classesRequired.split(";")){ |
|
|
|
|
|
|
|
requiredClasses.add(Enum.PromoteType.valueOf(entry)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(classesRestricted != null){ |
|
|
|
|
|
|
|
for(String entry : classesRestricted.split(";")){ |
|
|
|
|
|
|
|
restrictedClasses.add(Enum.PromoteType.valueOf(entry)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(discsRequired != null){ |
|
|
|
|
|
|
|
for(String entry : discsRequired.split(";")){ |
|
|
|
|
|
|
|
//TODO find way to load disc runebaseID from name
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(discsRestricted != null){ |
|
|
|
|
|
|
|
for(String entry : discsRestricted.split(";")) { |
|
|
|
|
|
|
|
//TODO find way to load disc runebaseID from name
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|