aoe2techtree icon indicating copy to clipboard operation
aoe2techtree copied to clipboard

Unit Upgrade Cost in data.json

Open denniske opened this issue 4 years ago • 5 comments

Hi, I want to display the upgrade cost and research time in my app. Is it possible to add this to your data file?

I know I can use the description text e.g.

Upgrades: range, attack (University); to Heavy Scorpion 1000F, 1100W (Siege Workshop); more resistant to Monks (Monastery).

But there the research time is missing and I am displaying the range/attack upgrades etc. in another way already.

denniske avatar Aug 31 '20 07:08 denniske

Oh sorry, I thought there was already an answer here.

In order to do that, one would essentially have to map the upgrade techs to the units. That could be semi-automated by looking at the upgrade Effects and which units get upgraded to which, but since for example the upgrade Effect for Champion contains upgrade commands for the whole Militia line, that data would have to get cleaned up afterwards.

HSZemi avatar Nov 20 '20 23:11 HSZemi

Yeah that would be cool. I am parsing the description at the moment which is not optimal: https://github.com/denniske/aoe2companion/blob/master/data/src/helper/units.ts#L2823 (getUnitUpgradeCost)

denniske avatar Nov 23 '20 14:11 denniske

I have seen that you have added unit cost to aoe2techtree and the following seem to have been switched up with huns atheism tech:

demolition ship fire ship

image

image

denniske avatar Nov 24 '21 19:11 denniske

Funny. Demolition Ship and Fire Ship actually have "Trigger Tech ID":21,, which is the unit id of War Galley, not the ID of the War Galley upgrade. I'll have to check if I can deduce such cases automatically or if I have to hardcode something for that case. Thanks for the report!

HSZemi avatar Nov 24 '21 20:11 HSZemi

Hardcoded for now :shrug:

HSZemi avatar Nov 24 '21 23:11 HSZemi