|
|
@ -78,11 +78,12 @@ public class ItemTemplate { |
|
|
|
|
|
|
|
|
|
|
|
obj_name = (String) jsonObject.get("obj_name"); |
|
|
|
obj_name = (String) jsonObject.get("obj_name"); |
|
|
|
|
|
|
|
|
|
|
|
// Reading floats from an array
|
|
|
|
// Reading floats from an array (note always check for empty arrays)
|
|
|
|
|
|
|
|
|
|
|
|
JSONArray scaleData = (JSONArray) jsonObject.get("obj_scale"); |
|
|
|
JSONArray scaleData = (JSONArray) jsonObject.get("obj_scale"); |
|
|
|
obj_scale = new Vector3fImmutable(((Double) scaleData.get(0)).floatValue(), ((Double) scaleData.get(1)).floatValue(), |
|
|
|
if (scaleData.isEmpty() == false) |
|
|
|
((Double) scaleData.get(2)).floatValue()); |
|
|
|
obj_scale = new Vector3fImmutable(((Double) scaleData.get(0)).floatValue(), ((Double) scaleData.get(1)).floatValue(), |
|
|
|
|
|
|
|
((Double) scaleData.get(2)).floatValue()); |
|
|
|
|
|
|
|
|
|
|
|
// Reading an integer value
|
|
|
|
// Reading an integer value
|
|
|
|
|
|
|
|
|
|
|
@ -131,10 +132,10 @@ public class ItemTemplate { |
|
|
|
item_render_object_female = ((Long) jsonObject.get("item_render_object_female")).intValue(); |
|
|
|
item_render_object_female = ((Long) jsonObject.get("item_render_object_female")).intValue(); |
|
|
|
item_health_full = ((Double) jsonObject.get("item_health_full")).floatValue(); |
|
|
|
item_health_full = ((Double) jsonObject.get("item_health_full")).floatValue(); |
|
|
|
|
|
|
|
|
|
|
|
Object skills_used = jsonObject.get("item_skill_used"); |
|
|
|
Object skill_used = jsonObject.get("item_skill_used"); |
|
|
|
|
|
|
|
|
|
|
|
if (skills_used instanceof String) { |
|
|
|
if (skill_used instanceof String) { |
|
|
|
String skilString = (String) skills_used; |
|
|
|
String skilString = (String) skill_used; |
|
|
|
skilString = skilString.replaceAll("\\s", ""); |
|
|
|
skilString = skilString.replaceAll("\\s", ""); |
|
|
|
skilString = skilString.replaceAll(",", ""); |
|
|
|
skilString = skilString.replaceAll(",", ""); |
|
|
|
item_skill_used.add(Enum.CharacterSkills.valueOf(skilString)); |
|
|
|
item_skill_used.add(Enum.CharacterSkills.valueOf(skilString)); |
|
|
@ -171,14 +172,15 @@ public class ItemTemplate { |
|
|
|
|
|
|
|
|
|
|
|
JSONArray weapon_damage = (JSONArray) item_weapon.get("weapon_damage"); |
|
|
|
JSONArray weapon_damage = (JSONArray) item_weapon.get("weapon_damage"); |
|
|
|
|
|
|
|
|
|
|
|
for (Object o : weapon_damage) { |
|
|
|
if (weapon_damage.isEmpty() == false) |
|
|
|
JSONObject damage_entry = (JSONObject) o; |
|
|
|
for (Object o : weapon_damage) { |
|
|
|
Enum.SourceType sourceType = Enum.SourceType.valueOf(((String) damage_entry.get("damage_type")).toUpperCase()); |
|
|
|
JSONObject damage_entry = (JSONObject) o; |
|
|
|
int min = ((Long) damage_entry.get("damage_min")).intValue(); |
|
|
|
Enum.SourceType sourceType = Enum.SourceType.valueOf(((String) damage_entry.get("damage_type")).toUpperCase()); |
|
|
|
int max = ((Long) damage_entry.get("damage_max")).intValue(); |
|
|
|
int min = ((Long) damage_entry.get("damage_min")).intValue(); |
|
|
|
int[] minMax = {min, max}; |
|
|
|
int max = ((Long) damage_entry.get("damage_max")).intValue(); |
|
|
|
item_weapon_damage.put(sourceType, minMax); |
|
|
|
int[] minMax = {min, max}; |
|
|
|
} |
|
|
|
item_weapon_damage.put(sourceType, minMax); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
JSONArray itemflags = (JSONArray) jsonObject.get("item_flags"); |
|
|
|
JSONArray itemflags = (JSONArray) jsonObject.get("item_flags"); |
|
|
@ -200,73 +202,78 @@ public class ItemTemplate { |
|
|
|
|
|
|
|
|
|
|
|
JSONArray skill_required = (JSONArray) jsonObject.get("item_skill_req"); |
|
|
|
JSONArray skill_required = (JSONArray) jsonObject.get("item_skill_req"); |
|
|
|
|
|
|
|
|
|
|
|
for (Object o : skill_required) { |
|
|
|
if (skill_required.isEmpty() == false) |
|
|
|
JSONObject skill_req = (JSONObject) o; |
|
|
|
for (Object o : skill_required) { |
|
|
|
String skill_type = (String) skill_req.get("skill_type"); |
|
|
|
JSONObject skill_req = (JSONObject) o; |
|
|
|
skill_type = skill_type.replaceAll("\\s", ""); |
|
|
|
String skill_type = (String) skill_req.get("skill_type"); |
|
|
|
skill_type = skill_type.replaceAll(",", ""); |
|
|
|
skill_type = skill_type.replaceAll("\\s", ""); |
|
|
|
int skill_level = ((Long) skill_req.get("skill_level")).intValue(); |
|
|
|
skill_type = skill_type.replaceAll(",", ""); |
|
|
|
item_skill_required.put(Enum.CharacterSkills.valueOf(skill_type), skill_level); |
|
|
|
int skill_level = ((Long) skill_req.get("skill_level")).intValue(); |
|
|
|
} |
|
|
|
item_skill_required.put(Enum.CharacterSkills.valueOf(skill_type), skill_level); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
JSONObject race_required = (JSONObject) jsonObject.get("item_race_req"); |
|
|
|
JSONObject race_required = (JSONObject) jsonObject.get("item_race_req"); |
|
|
|
boolean restrict = ((Boolean) race_required.get("restrict")); |
|
|
|
boolean restrict = ((Boolean) race_required.get("restrict")); |
|
|
|
JSONArray races = (JSONArray) race_required.get("races"); |
|
|
|
JSONArray races = (JSONArray) race_required.get("races"); |
|
|
|
|
|
|
|
|
|
|
|
for (Object o : races) { |
|
|
|
if (races.isEmpty() == false) |
|
|
|
String race = (String) o; |
|
|
|
for (Object o : races) { |
|
|
|
race = race.replaceAll("\\s", ""); |
|
|
|
String race = (String) o; |
|
|
|
race = race.replaceAll(",", ""); |
|
|
|
race = race.replaceAll("\\s", ""); |
|
|
|
race = race.replaceAll("-", ""); |
|
|
|
race = race.replaceAll(",", ""); |
|
|
|
|
|
|
|
race = race.replaceAll("-", ""); |
|
|
|
if (restrict) |
|
|
|
|
|
|
|
item_race_res.add(Enum.MonsterType.valueOf(race)); |
|
|
|
if (restrict) |
|
|
|
else |
|
|
|
item_race_res.add(Enum.MonsterType.valueOf(race)); |
|
|
|
item_race_req.add(Enum.MonsterType.valueOf(race)); |
|
|
|
else |
|
|
|
} |
|
|
|
item_race_req.add(Enum.MonsterType.valueOf(race)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
JSONObject class_required = (JSONObject) jsonObject.get("item_class_req"); |
|
|
|
JSONObject class_required = (JSONObject) jsonObject.get("item_class_req"); |
|
|
|
restrict = ((Boolean) class_required.get("restrict")); |
|
|
|
restrict = ((Boolean) class_required.get("restrict")); |
|
|
|
JSONArray classes = (JSONArray) class_required.get("classes"); |
|
|
|
JSONArray classes = (JSONArray) class_required.get("classes"); |
|
|
|
|
|
|
|
|
|
|
|
for (Object o : classes) { |
|
|
|
if (classes.isEmpty() == false) |
|
|
|
String classEntry = (String) o; |
|
|
|
for (Object o : classes) { |
|
|
|
classEntry = classEntry.replaceAll("\\s", ""); |
|
|
|
String classEntry = (String) o; |
|
|
|
classEntry = classEntry.replaceAll(",", ""); |
|
|
|
classEntry = classEntry.replaceAll("\\s", ""); |
|
|
|
|
|
|
|
classEntry = classEntry.replaceAll(",", ""); |
|
|
|
|
|
|
|
|
|
|
|
if (restrict) |
|
|
|
if (restrict) |
|
|
|
item_class_res.add(Enum.ClassType.valueOf(classEntry)); |
|
|
|
item_class_res.add(Enum.ClassType.valueOf(classEntry)); |
|
|
|
else |
|
|
|
else |
|
|
|
item_class_req.add(Enum.ClassType.valueOf(classEntry)); |
|
|
|
item_class_req.add(Enum.ClassType.valueOf(classEntry)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
JSONObject disc_required = (JSONObject) jsonObject.get("item_disc_req"); |
|
|
|
JSONObject disc_required = (JSONObject) jsonObject.get("item_disc_req"); |
|
|
|
restrict = ((Boolean) disc_required.get("restrict")); |
|
|
|
restrict = ((Boolean) disc_required.get("restrict")); |
|
|
|
JSONArray discs = (JSONArray) disc_required.get("discs"); |
|
|
|
JSONArray discs = (JSONArray) disc_required.get("discs"); |
|
|
|
|
|
|
|
|
|
|
|
for (Object o : discs) { |
|
|
|
if (discs.isEmpty() == false) |
|
|
|
String disc = (String) o; |
|
|
|
for (Object o : discs) { |
|
|
|
disc = disc.replaceAll("\\s", ""); |
|
|
|
String disc = (String) o; |
|
|
|
disc = disc.replaceAll(",", ""); |
|
|
|
disc = disc.replaceAll("\\s", ""); |
|
|
|
|
|
|
|
disc = disc.replaceAll(",", ""); |
|
|
|
|
|
|
|
|
|
|
|
if (restrict) |
|
|
|
if (restrict) |
|
|
|
item_disc_res.add(Enum.DisciplineType.valueOf(disc)); |
|
|
|
item_disc_res.add(Enum.DisciplineType.valueOf(disc)); |
|
|
|
else |
|
|
|
else |
|
|
|
item_disc_req.add(Enum.DisciplineType.valueOf(disc)); |
|
|
|
item_disc_req.add(Enum.DisciplineType.valueOf(disc)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
item_level_req = ((Long) jsonObject.get("item_level_req")).intValue(); |
|
|
|
item_level_req = ((Long) jsonObject.get("item_level_req")).intValue(); |
|
|
|
item_sex_req = Enum.SexType.valueOf((String) jsonObject.get("item_sex_req")); |
|
|
|
item_sex_req = Enum.SexType.valueOf((String) jsonObject.get("item_sex_req")); |
|
|
|
|
|
|
|
|
|
|
|
JSONArray powerActions = (JSONArray) jsonObject.get("item_user_power_action"); |
|
|
|
JSONArray powerActions = (JSONArray) jsonObject.get("item_user_power_action"); |
|
|
|
|
|
|
|
|
|
|
|
for (Object o : powerActions) { |
|
|
|
if (powerActions.isEmpty() == false) |
|
|
|
JSONObject powerActionEntry = (JSONObject) o; |
|
|
|
for (Object o : powerActions) { |
|
|
|
String power = (String) powerActionEntry.get("power"); |
|
|
|
JSONObject powerActionEntry = (JSONObject) o; |
|
|
|
JSONArray args = (JSONArray) powerActionEntry.get("arguments"); |
|
|
|
String power = (String) powerActionEntry.get("power"); |
|
|
|
int[] arguments = {((Long) args.get(0)).intValue(), ((Long) args.get(1)).intValue()}; |
|
|
|
JSONArray args = (JSONArray) powerActionEntry.get("arguments"); |
|
|
|
item_user_power_action.put(power, arguments); |
|
|
|
int[] arguments = {((Long) args.get(0)).intValue(), ((Long) args.get(1)).intValue()}; |
|
|
|
} |
|
|
|
item_user_power_action.put(power, arguments); |
|
|
|
|
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
Logger.error(e); |
|
|
|
Logger.error(e); |
|
|
|
} |
|
|
|
} |
|
|
|