Add RuneType enum and DamageType.ANTISIEGE
RuneType covers the rune_type values in the client cache data (CLASS, DISCIPLINE, RACE, TALENT). ANTISIEGE matches the combat_attack_resist key in the cache data. RuneTemplate.rune_type and combat_attack_resist on both cache templates now use these enums. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0d48080e38
commit
c14231afb9
6 files changed
+31
-11
No files matched your search
@@ -824,6 +824,7 @@ public class mbEnums {
|
||||
ACID,
|
||||
DISEASE,
|
||||
UNKNOWN,
|
||||
ANTISIEGE,
|
||||
// these added for immunities
|
||||
ATTACK,
|
||||
POWERS,
|
||||
@@ -1509,6 +1510,15 @@ public class mbEnums {
|
||||
}
|
||||
}
|
||||
|
||||
// rune_type values from the client cache data (COBJECTS/RUNE)
|
||||
|
||||
public enum RuneType {
|
||||
CLASS,
|
||||
DISCIPLINE,
|
||||
RACE,
|
||||
TALENT
|
||||
}
|
||||
|
||||
public enum ShrineType {
|
||||
|
||||
Aelfborn(1701900, -75506007, true),
|
||||
|
||||
+13
-5
@@ -158,14 +158,22 @@ public class CacheParserUtil {
|
||||
return valueMap;
|
||||
}
|
||||
|
||||
public static LinkedHashMap<String, Float> readFloatMap(JSONObject mapJson) {
|
||||
// {"SLASHING": 0.0, ...} -> enum map
|
||||
|
||||
LinkedHashMap<String, Float> floatMap = new LinkedHashMap<>();
|
||||
public static <E extends Enum<E>> EnumMap<E, Float> readEnumFloatMap(Class<E> enumClass, JSONObject mapJson,
|
||||
int templateId, String fieldName) {
|
||||
|
||||
for (String key : mapJson.keySet())
|
||||
floatMap.put(key, mapJson.getFloat(key));
|
||||
EnumMap<E, Float> enumMap = new EnumMap<>(enumClass);
|
||||
E enumValue;
|
||||
|
||||
return floatMap;
|
||||
for (String key : mapJson.keySet()) {
|
||||
enumValue = readEnum(enumClass, key, templateId, fieldName);
|
||||
|
||||
if (enumValue != null)
|
||||
enumMap.put(enumValue, mapJson.getFloat(key));
|
||||
}
|
||||
|
||||
return enumMap;
|
||||
}
|
||||
|
||||
// Values are read as long and wrapped to int so unsigned 32-bit hashes survive.
|
||||
|
||||
+2
-1
@@ -84,7 +84,8 @@ public class DeedParser {
|
||||
|
||||
deed.combat_health_current = deedJson.getFloat("combat_health_current");
|
||||
deed.combat_health_full = deedJson.getFloat("combat_health_full");
|
||||
deed.combat_attack_resist.putAll(CacheParserUtil.readFloatMap(deedJson.getJSONObject("combat_attack_resist")));
|
||||
deed.combat_attack_resist.putAll(CacheParserUtil.readEnumFloatMap(mbEnums.DamageType.class, deedJson.getJSONObject("combat_attack_resist"),
|
||||
templateId, "combat_attack_resist"));
|
||||
deed.combat_powers = deedJson.getJSONArray("combat_powers");
|
||||
|
||||
// item_
|
||||
|
||||
+3
-2
@@ -100,7 +100,8 @@ public class RuneParser {
|
||||
|
||||
rune.combat_health_current = runeJson.getFloat("combat_health_current");
|
||||
rune.combat_health_full = runeJson.getFloat("combat_health_full");
|
||||
rune.combat_attack_resist.putAll(CacheParserUtil.readFloatMap(runeJson.getJSONObject("combat_attack_resist")));
|
||||
rune.combat_attack_resist.putAll(CacheParserUtil.readEnumFloatMap(mbEnums.DamageType.class, runeJson.getJSONObject("combat_attack_resist"),
|
||||
templateId, "combat_attack_resist"));
|
||||
rune.combat_powers = runeJson.getJSONArray("combat_powers");
|
||||
|
||||
// item_
|
||||
@@ -177,7 +178,7 @@ public class RuneParser {
|
||||
|
||||
// rune_
|
||||
|
||||
rune.rune_type = runeJson.getString("rune_type");
|
||||
rune.rune_type = CacheParserUtil.readEnum(mbEnums.RuneType.class, runeJson.getString("rune_type"), templateId, "rune_type");
|
||||
|
||||
subType = runeJson.get("rune_sub_type");
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public class DeedTemplate {
|
||||
|
||||
public float combat_health_current;
|
||||
public float combat_health_full;
|
||||
public final LinkedHashMap<String, Float> combat_attack_resist = new LinkedHashMap<>();
|
||||
public final EnumMap<mbEnums.DamageType, Float> combat_attack_resist = new EnumMap<>(mbEnums.DamageType.class);
|
||||
public JSONArray combat_powers;
|
||||
|
||||
// item_
|
||||
|
||||
@@ -59,7 +59,7 @@ public class RuneTemplate {
|
||||
|
||||
public float combat_health_current;
|
||||
public float combat_health_full;
|
||||
public final LinkedHashMap<String, Float> combat_attack_resist = new LinkedHashMap<>();
|
||||
public final EnumMap<mbEnums.DamageType, Float> combat_attack_resist = new EnumMap<>(mbEnums.DamageType.class);
|
||||
public JSONArray combat_powers;
|
||||
|
||||
// item_
|
||||
@@ -109,7 +109,7 @@ public class RuneTemplate {
|
||||
|
||||
// rune_
|
||||
|
||||
public String rune_type;
|
||||
public mbEnums.RuneType rune_type;
|
||||
public String rune_sub_type;
|
||||
|
||||
// A handful of runes carry a number instead of a name in rune_sub_type.
|
||||
|
||||
Reference in new issue
Block a user