SiegeEngineers / aoe2techtree

Age of Empires II Tech Tree

Home Page:https://aoe2techtree.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] Wonder does not show stats

Augusto-Barth opened this issue · comments

The wonder doesn't seem to get it's metadata right
Screenshot_3

If it helps with anything, i've made this awfulness, that althogh works, looks horrible:

         if (meta !== undefined) {
            text = text.replace(/‹cost›/, "Cost: " + cost(meta.Cost));
            let stats = []
            if (text.match(/‹hp›/)) {
                stats.push("HP: " + meta.HP);
                text = text.replace(/‹hp›/, "HP: " + meta.HP);
            }
            if (text.match(/‹attack›/)) {
                stats.push("Attack: " + meta.Attack);
                text = text.replace(/‹attack›/, "Attack: " + meta.Attack);
            }
            if (text.match(/‹(A|a)rmor›/)) {
                stats.push("Armor: " + meta.MeleeArmor);
                text = text.replace(/‹(A|a)rmor›/, "Armor: " + meta.MeleeArmor);
            }
            if (text.match(/‹(P|p)iercearmor›/)) {
                stats.push("Pierce armor: " + meta.PierceArmor);
                text = text.replace(/‹(P|p)iercearmor›/, "Pierce armor: " + meta.PierceArmor);
            }
            if (text.match(/‹garrison›/)) {
                stats.push("Garrison: " + meta.GarrisonCapacity);
                text = text.replace(/‹garrison›/, "Garrison: " + meta.GarrisonCapacity);
            }
            if (text.match(/‹range›/)) {
                stats.push("Range: " + meta.Range);
                text = text.replace(/‹range›/, "Range: " + meta.Range);
            }

Good luck and I hope you don't get annoyed at that many bug reports haha

A wonder does not list upgrades, so the replacement here fails.

@lalitpatel would you mind having a look at this?

@HSZemi I was going through this page. It seems Wonders do get affected by upgrades like Town Watch, Masonry etc. Dose it mean that the data in the data.json file is incorrect for Wonders?

That depends on your definition of "incorrect". I would say the "correct" text is the one from the game files, hence the data in data.json seems to be correct for Wonders. But sadly, that text is inconsistent with the other texts in that it does not contain information about upgrades.

The issue has been resolved with #53 🎉
Thank you for the bug report @AugustoXDBR