Feat: account data parsing + static data refactor (v4.0)#283
Feat: account data parsing + static data refactor (v4.0)#283doluk merged 110 commits intomathsman5133:masterfrom ClashKingInc:master
Conversation
MagicTheDev
commented
Nov 28, 2025
- revamps static data to be cleaner & easier to work with
- switches to using dynamically generated ids like March Update - Army Recipes & New Troops/Achievements #269
- adds army recipe support
- adds army account parsing support
- adds/refactors classes for static data items
feat: add _raw_data attribute
doluk
left a comment
There was a problem hiding this comment.
review of the code, no testing.
Some minor changes for the calculation of upgrade/training times mostly
There was a problem hiding this comment.
I am not sure I like having a massive json with basically independent subjsons structures over the previous multiple jsons. This makes reviewing changes a lot harder
There was a problem hiding this comment.
I didn't find it harder to compare changes + just one file to check 👀
Honestly can see both ways but one file has conveniences
| # keep the raw CSV files | ||
| self.KEEP_CSV = False | ||
| # keep the raw JSON files | ||
| self.KEEP_JSON = False |
There was a problem hiding this comment.
Those options should be at least accessible via kwargs in the constructor, in my opinion
|
|
||
| self.TARGETS = [] | ||
| self.supported_languages: list[str] = [] | ||
| self.USED_TIDS = set() |
There was a problem hiding this comment.
this should probably be marked as internal. or not even be a traditional set in the first place and instead be a property and calculated on the fly, when accessed?
| "level": int(level), | ||
| "hitpoints": level_data.get("Hitpoints"), | ||
| "dps": level_data.get("DPS"), | ||
|
|
There was a problem hiding this comment.
do we have the data to add here an ability property?
| elif is_super_troop: #for super troops use the original troop's lab level' | ||
| original_troop = self.full_troop_data.get(super_troop_data["Original"]) | ||
| required_lab_level = original_troop.get(level).get("LaboratoryLevel") | ||
| required_townhall = max_townhall_converter[required_lab_level] |
There was a problem hiding this comment.
do we have the data to add an ability property? so for example super minions range shots are accessible
There was a problem hiding this comment.
Abilities (even if there) are a tricky thing, I did add to heroes buttt the structure for those is far from consistent & I just leave them as raw JSON. Maybe an ability class needs to be made one day that can handle lm the different portal ability types (dps , heal, spawner, aura, etc)
| @@ -261,19 +263,24 @@ def __init__( | |||
| self.load_game_data = load_game_data | |||
There was a problem hiding this comment.
this has no function anymore or?
|
|
||
| class VillageType(ExtendedEnum): | ||
| home = "home" | ||
| builder_base = "builderBase" |
There was a problem hiding this comment.
Yes, but it isn't used in the static data and before we didn't have an enum for it - the only place currently that could use it is achievements which we can update to use + clanCapital
coc/enums.py
Outdated
| "Most Valuable Clanmate", | ||
| ] | ||
|
|
||
| UNRANKED_LEAGUE_DATA = { |
There was a problem hiding this comment.
shouldn't this go into the constants?
There was a problem hiding this comment.
Technically yes, but check generate_constants in the static updater and let me know what you think then
Removed Gender enum documentation from enums.rst