-
Notifications
You must be signed in to change notification settings - Fork 45
Feat: account data parsing + static data refactor (v4.0) #283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
review of the code, no testing.
Some minor changes for the calculation of upgrade/training times mostly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
| self.realtime = realtime | ||
| self.raw_attribute = raw_attribute | ||
| self.correct_tags = correct_tags | ||
| self.load_game_data = load_game_data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has no function anymore or?
|
|
||
| class VillageType(ExtendedEnum): | ||
| home = "home" | ||
| builder_base = "builderBase" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't there also capital?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this go into the constants?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
doluk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking good to me