Skip to content

Commit

Permalink
Add header descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
xdnw committed May 4, 2024
1 parent 46a54bd commit fbade67
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/main/java/link/locutus/discord/db/Conflict.java
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ public synchronized byte[] getPsonGzip(ConflictManager manager) {

Map<ConflictColumn, Function<DamageStatGroup, Object>> damageHeader = DamageStatGroup.createHeader();
root.put("damage_header", new ObjectArrayList<>(damageHeader.keySet().stream().map(ConflictColumn::getName).toList()));
root.put("header_desc", new ObjectArrayList<>(damageHeader.keySet().stream().map(ConflictColumn::getDescription).toList()));
root.put("header_type", new ObjectArrayList<>(damageHeader.keySet().stream().map(f -> f.isCount() ? 1 : 0).toList()));
root.put("war_web", warsVsAllianceJson());
byte[] compressed = JteUtil.compress(JteUtil.toBinary(root));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ public static Map<ConflictColumn, Function<DamageStatGroup, Object>> createHeade
case NUKE:
continue;
}
map.put(header(type.name().toLowerCase() + "_attacks", "Number of attacks categorized as: " + type.name().toLowerCase(), true), p -> (int) p.attackSubTypes[type.ordinal()]);
map.put(header(type.name().toLowerCase() + "_attacks", type.message, true), p -> (int) p.attackSubTypes[type.ordinal()]);
}
for (SuccessType type : SuccessType.values) {
map.put(header(type.name().toLowerCase() + "_attacks", "Number of attacks where success is " + type.name().toLowerCase(), true), p -> (int) p.successTypes[type.ordinal()]);
}
for (WarType type : WarType.values) {
if (type == WarType.NUCLEAR) continue;
map.put(ranking(type.name().toLowerCase() + "_wars", "Number of wars declared as " + type.name().toLowerCase(), true), p -> (int) p.warTypes[type.ordinal()]);
map.put(ranking(type.name().toLowerCase() + "_wars", "Number of wars declared as " + type.toString().toLowerCase(), true), p -> (int) p.warTypes[type.ordinal()]);
}

return map;
Expand Down

0 comments on commit fbade67

Please sign in to comment.