forked from MagicBane/Server
Parsing grants
This commit is contained in:
@@ -71,6 +71,9 @@ public class ItemTemplate {
|
||||
public Enum.SexType item_sex_req;
|
||||
public HashMap<String, int[]> item_user_power_action = new HashMap<>();
|
||||
|
||||
public static HashMap<String, Integer> item_power_grant = new HashMap<>();
|
||||
|
||||
|
||||
public ItemTemplate(JSONObject jsonObject) {
|
||||
|
||||
try {
|
||||
@@ -274,6 +277,16 @@ public class ItemTemplate {
|
||||
int[] arguments = {((Long) args.get(0)).intValue(), ((Long) args.get(1)).intValue()};
|
||||
item_user_power_action.put(power, arguments);
|
||||
}
|
||||
|
||||
JSONArray powerGrants = (JSONArray) jsonObject.get("item_power_grant");
|
||||
for (Object o : powerGrants) {
|
||||
JSONObject powerGrantEntry = (JSONObject) o;
|
||||
String power_type = (String) powerGrantEntry.get("power_type");
|
||||
int power_value = ((Long) powerGrantEntry.get("power_value")).intValue();
|
||||
item_power_grant.put(power_type, power_value);
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user