|
|
@ -17,7 +17,6 @@ import org.pmw.tinylog.Logger; |
|
|
|
import java.util.EnumSet; |
|
|
|
import java.util.EnumSet; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class ItemTemplate { |
|
|
|
public class ItemTemplate { |
|
|
|
|
|
|
|
|
|
|
|
// Global template lookup
|
|
|
|
// Global template lookup
|
|
|
@ -52,6 +51,9 @@ public class ItemTemplate { |
|
|
|
public EnumSet<Enum.ItemUseFlags> item_use_flags = EnumSet.noneOf(Enum.ItemUseFlags.class); |
|
|
|
public EnumSet<Enum.ItemUseFlags> item_use_flags = EnumSet.noneOf(Enum.ItemUseFlags.class); |
|
|
|
public int item_initial_charges; |
|
|
|
public int item_initial_charges; |
|
|
|
public HashMap<Enum.CharacterSkills, Integer> item_skill_required = new HashMap<>(); |
|
|
|
public HashMap<Enum.CharacterSkills, Integer> item_skill_required = new HashMap<>(); |
|
|
|
|
|
|
|
public EnumSet<Enum.RaceType> item_race_req = EnumSet.noneOf(Enum.RaceType.class); |
|
|
|
|
|
|
|
public EnumSet<Enum.RaceType> item_race_res = EnumSet.noneOf(Enum.RaceType.class); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ItemTemplate(JSONObject jsonObject) { |
|
|
|
public ItemTemplate(JSONObject jsonObject) { |
|
|
|
|
|
|
|
|
|
|
@ -168,6 +170,22 @@ public class ItemTemplate { |
|
|
|
int skill_level = ((Long) skill_req.get("skill_level")).intValue(); |
|
|
|
int skill_level = ((Long) skill_req.get("skill_level")).intValue(); |
|
|
|
item_skill_required.put(Enum.CharacterSkills.valueOf(skill_type), skill_level); |
|
|
|
item_skill_required.put(Enum.CharacterSkills.valueOf(skill_type), skill_level); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject race_required = (JSONObject) jsonObject.get("item_race_req"); |
|
|
|
|
|
|
|
boolean restrict = ((Boolean) race_required.get("restrict")); |
|
|
|
|
|
|
|
JSONArray races = (JSONArray) race_required.get("races"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Object o : races) { |
|
|
|
|
|
|
|
String race = (String) o; |
|
|
|
|
|
|
|
race = race.replaceAll("\\s", ""); |
|
|
|
|
|
|
|
race = race.replaceAll(",", ""); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (restrict) |
|
|
|
|
|
|
|
item_race_res.add(Enum.RaceType.valueOf(race)); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
item_race_req.add(Enum.RaceType.valueOf(race)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
Logger.error(e); |
|
|
|
Logger.error(e); |
|
|
|
} |
|
|
|
} |
|
|
|