forked from MagicBane/Server
Parsing power actions.
This commit is contained in:
@@ -70,6 +70,8 @@ public class ItemTemplate {
|
|||||||
public EnumSet<Enum.DisciplineType> item_disc_res = EnumSet.noneOf(Enum.DisciplineType.class);
|
public EnumSet<Enum.DisciplineType> item_disc_res = EnumSet.noneOf(Enum.DisciplineType.class);
|
||||||
public int item_level_req;
|
public int item_level_req;
|
||||||
public Enum.SexType item_sex_req;
|
public Enum.SexType item_sex_req;
|
||||||
|
public HashMap<String, Pair<Integer, Integer>> item_user_power_action = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
public ItemTemplate(JSONObject jsonObject) {
|
public ItemTemplate(JSONObject jsonObject) {
|
||||||
|
|
||||||
@@ -258,6 +260,15 @@ public class ItemTemplate {
|
|||||||
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");
|
||||||
|
|
||||||
|
for (Object o : powerActions) {
|
||||||
|
JSONObject powerActionEntry = (JSONObject) o;
|
||||||
|
String power = (String) powerActionEntry.get("power");
|
||||||
|
JSONArray args = (JSONArray) powerActionEntry.get("arguments");
|
||||||
|
Pair<Integer, Integer> arguments = new Pair<>(((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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user