Page MenuHomeWildfire Games

Internationalise Damage Types and Status Effects using (optional) JSON files.
ClosedPublic

Authored by wraitii on Sep 29 2019, 10:49 AM.

Details

Reviewers
Freagarach
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP23681: Internationalise Damage Types and Status Effects using (optional) JSON files.
Trac Tickets
#4801
Summary

Follows rP22527, rP22901 and rP23448.
Supersedes D1936.

This internationalises damage types and status effects.
The system is similar to resources.json but the JSON files are only necessary for translation and deduplication.
For damage types, they specify the order and the name but XML-only damage types are allowed for slightly easier modding.
For status effects, they act as 'augmenters' of template definitions, which means re-using the same status effect in several places is now much easier.

See D2296 for the broader question of status effects tooltips.

This lets XML extractors parse a custom context. Precedence is explicated as such:

  • the 'context' attribute of the XML tag.
  • tagAsContext
  • customContext

Future work:

  • consider internationalising icons?
Test Plan

Check that the messages.json change is OK.
Check that the interface for the global scripts is considered acceptable.

Verify that:

  • (the damage type) order is restored.
  • adding a new damage type not specified in a file places it at the back of the list in tooltips.

Event Timeline

wraitii created this revision.Sep 29 2019, 10:49 AM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/866/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/350/display/redirect

There's a few bits of debug code I left which I'll clean up later.

binaries/data/mods/public/globalscripts/DamageTypes.js
33

I forgot here that I want damage types not in the data file to have lowest order, alphabetical.

binaries/data/mods/public/globalscripts/StatusEffects.js
40

needs to be nuked.

binaries/data/mods/public/gui/common/tooltips.js
543

Unrelated to these changes, but I noticed while testing Upgrade that this was required as we can have free upgrades and it fails.

binaries/data/mods/public/simulation/data/template_helpers/damage_types/pierce.json
5

description isn't actually used, should I nuke it?

wraitii updated this revision to Diff 10007.Sep 29 2019, 11:26 AM

Add the proper context, do the cleanup.

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/867/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/351/display/redirect

This combines like 3 diffs?

Freagarach updated this revision to Diff 11492.Mar 17 2020, 2:44 PM
Freagarach retitled this revision from Internationalise damage types and status effects using (optional) JSON files to Internationalise Damage Types and Status Effects using (optional) JSON files..
Freagarach edited the summary of this revision. (Show Details)
Freagarach edited the test plan for this revision. (Show Details)
Freagarach added a reviewer: Restricted Owners Package.
Freagarach updated the Trac tickets for this revision.
  • Rebased.
  • Some other changes.
Owners added a subscriber: Restricted Owners Package.Mar 17 2020, 2:44 PM
Freagarach commandeered this revision.Mar 17 2020, 2:45 PM
Freagarach added a reviewer: wraitii.

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1862/display/redirect

Stan added a subscriber: Stan.Mar 17 2020, 3:05 PM
Stan added inline comments.
binaries/data/mods/public/globalscripts/StatusEffects.js
37

Maybe

if (templateData)
    return Object.assign(this.statusEffectData[code], templateData);

if (this.statusEffectData[code])
    return this.statusEffectData[code];

return {
    "name": code,
    "tooltip": code // Or just ""?
};
Freagarach added inline comments.Mar 17 2020, 3:34 PM
binaries/data/mods/public/globalscripts/StatusEffects.js
37

I think the stored data should take precedence?

wraitii commandeered this revision.May 16 2020, 4:11 PM
wraitii edited reviewers, added: Freagarach; removed: wraitii.
wraitii added inline comments.
binaries/data/mods/public/globalscripts/StatusEffects.js
37

I think template data should take precedence.

wraitii updated this revision to Diff 11878.May 16 2020, 4:12 PM

Fix the status effects not being used (I plan to commit this regardless of D2296).

Let icons be amended too (and in fact other data).

This is a slight simplification of the code.

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2129/display/redirect

wraitii updated this revision to Diff 11891.May 17 2020, 9:27 AM

Fix code, use status effects name everywhere.

Rename to StatusName and StatusTooltip to parse it from XML, give XML extractors the ability to specify contexts explicitly, which seems like it could be useful for unit templates in a broader sense (TagAsContext is annoying here as I would prefer to have the same context for both).

The Theban Pyrobolos is given the 'Burn' status effect, dealing 10 fire damage per second for 10 seconds, as a unit showcase. It is a "demo" unit unused anywhere so that seems fine.

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/724/display/redirect

wraitii edited the summary of this revision. (Show Details)May 17 2020, 9:30 AM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2139/display/redirect

This revision was not accepted when it landed; it landed in state Needs Review.May 20 2020, 7:26 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.