z33kz33k / gladiunits Goto Github PK
View Code? Open in Web Editor NEWDo something with WHK40:Gladius units XMLs
Do something with WHK40:Gladius units XMLs
Traits from 'Traits' .xml files shall be parsed.
Unit/Weapons/Actions etc names displayed in-game are different than the ones used in World/Units/
. The actual mapping of ones to the others can be parsed from Core/Languages/English/Units.xml
This resource holds also in-game descriptions and flavors
Weapons from "Weapons" .xml files shall be parsed
Actions are a bit involved part of "Units" .xml files
Upgrades shall be parsed from 'Upgrades' dir's .xml files
tier
, prerequisites
or has_melee_weapon
on unitsRemember that any Data object is also an Origin one, so there's no use using Union[Data, Origin] anywhere in type hints.
This makes #10 trivial as upgrade required for unit production is specified with the unit in question in Building's produceUnit
action.
It will also enable adding a Building object to Unit object as its attribute, albeit this will probably entail a new Unit class (a BuiltWeapon?) in the same vein as there are CountedWeapons in Units with some added attributes and regular Weapons anywhere else.
In case of nomenclature it would probably be best to:
Weapon
==> BaseWeapon
, CountedWeapon
==> Weapon
Unit
==> BaseUnit
, the new unit with data from Buildings named as Unit
Units from "Units" .xml files need to be parsed
Based on a corresponding Upgrade.
There's a little bug of using asdict()
leading to some problems.
This (as usual) proved to be a completely non-trivial task that involved parsing another type of data (Buildings, #11 ) and looking for unit-producing actions in other units to grok the tier of the produced one.
This one is tricky, because:
Parameter
) be constructed and then re-constructedEffect
and constructing an immutable effect only after dereferencing all parameters it contains - this is bullshit, for one param's refs are not the only ones, for second you cannot arbitrarily make one element of frozen datastructure mutable and call it a day (either all of them are mutable or immutable)Sub-tasks:
To summarize:
Devising a way to mutate a frozen dataclass was harder than expected. I (almost) caved in. But, there is a way and I was almost at it. One can easily manipulate each Python object by accessing its __dict__
property, frozen dataclass or not. I reached this point but stumbled trying to mutate the whole Parsed object top-down, when in reality I can just mutate Parameter objects' __dict___
's at the bottom and reference
attributes at the top.
It's not possible to dereference every category path contained in XMLs, because of circular refs contained therein.
The dereferencing loop stops improving and becomes infinite at 900+ still not resolved objects when trying to dereference everything.
Giving up on reference
property, cuts this number to 49.
Skipped circular refs, thus solving the problem.
Rok's link: https://steamcommunity.com/app/489630/discussions/0/3825284575377782229/#c3827536762637353185
TraitParser
's class space into functions that return them_ReferenceParser
into function that returns a reference Origin objectA declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.