Page MenuHomeWildfire Games

Generalised Attack effects tooltips after D2092/rP22754.
ClosedPublic

Authored by Freagarach on Aug 1 2019, 2:43 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Sep 6, 8:08 PM
Unknown Object (File)
Thu, Sep 5, 6:54 PM
Unknown Object (File)
Thu, Sep 5, 4:40 PM
Unknown Object (File)
Thu, Sep 5, 12:40 AM
Unknown Object (File)
Wed, Sep 4, 3:08 AM
Unknown Object (File)
Tue, Sep 3, 7:58 AM
Unknown Object (File)
Mon, Aug 26, 6:01 AM
Unknown Object (File)
Sun, Aug 25, 8:36 AM
Subscribers
Restricted Owners Package

Details

Reviewers
wraitii
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP22866: Generalise attack tooltips after D2092/rP22754.
Summary

D2092/rP22754 introduced that any attack can have any effect. However, the tooltips not yet support more than one effect for a attack.
This patch aims to fix that. Note that tooltips for StatusEffects were not present before and will not be hereafter, since a more elaborate way of showing those is needed.

Test Plan

Verify that everything works as intended.

Diff Detail

Repository
rP 0 A.D. Public Repository
Branch
/ps/trunk
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 9029
Build 14792: Vulcan BuildJenkins
Build 14791: arc lint + arc unit

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
This revision now requires changes to proceed.Aug 23 2019, 9:23 AM

Thanks for taking a jab at this :)

You're welcome! I'm afraid though that I neither understand it fully nor am convinced yet (probably related). (By the way, if you think: "don't be stupid (no worries, I think that all the time about myself), its easy, let me do it in 5 mins." feel free to commandeer ;) )

These 3 things should have their own tooltip wrapper, not use a common one. Indeed, status effects will look completely different.

Can live with that.

Further, these tooltip functions need to be agnostic from the attack's name / type, since they must apply for death damage, status effects, etc.
Right now we have:

  • attackRateDetails
  • damageTypesToText
  • getAttackTooltip
  • getSplashDamageTooltip

It would make more sense now to have (names indicative)

  • DamageTooltip -> per damage type of <Damage>, gives you the DPS + rate
  • CaptureTooltip
  • StatusEffectsTooltip (which will in turn call the other tooltip helpers)

Why duplicate the attackRateDetails? It is common in all the attack types isn't it?

And then AttackTooltip, calling the other tooltips, with each attack type (which will pre-emptively help with D368)
In general Splash tooltip and Death tooltip should also be trivially composable from the first 3.

So if I understand correctly:

  • AttackTooltip (equally DeathDamage, Splash) calls:
    • attackRateDetails (not for DD and splash)
    • damageTooltip
    • captureTooltip
    • StatusEffectsTooltip; which also calls
      • DamageTooltip
    • rangeTooltip
elexis retitled this revision from Tooltips for D2092/rP22754. to Generalised Attack effects tooltips for D2092/rP22754..Aug 23 2019, 5:58 PM
Freagarach retitled this revision from Generalised Attack effects tooltips for D2092/rP22754. to Generalised Attack effects tooltips after D2092/rP22754..

What about this?
In seperate diffs?

  • Support for DeathDamage tooltip.
  • Status effects tooltips.

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 267| 267| 		return "";
| 268| 268| 
| 269| 269| 	return sprintf(translate("%(damage)s %(damageType)s"), {
| 270|    |-			"damage": template.Capture.toFixed(1),
|    | 270|+		"damage": template.Capture.toFixed(1),
| 271| 271| 			"damageType": unitFont(translateWithContext("damage type", "Capture"))
| 272| 272| 		});
| 273| 273| }
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 268| 268| 
| 269| 269| 	return sprintf(translate("%(damage)s %(damageType)s"), {
| 270| 270| 			"damage": template.Capture.toFixed(1),
| 271|    |-			"damageType": unitFont(translateWithContext("damage type", "Capture"))
|    | 271|+		"damageType": unitFont(translateWithContext("damage type", "Capture"))
| 272| 272| 		});
| 273| 273| }
| 274| 274| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 269| 269| 	return sprintf(translate("%(damage)s %(damageType)s"), {
| 270| 270| 			"damage": template.Capture.toFixed(1),
| 271| 271| 			"damageType": unitFont(translateWithContext("damage type", "Capture"))
| 272|    |-		});
|    | 272|+	});
| 273| 273| }
| 274| 274| 
| 275| 275| function statusEffectsTooltip(template)
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 4.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 304| 304| 			"details": attackRateDetails(template, type)
| 305| 305| 		});
| 306| 306| 		let effects = [captureTooltip(template.attack[type]),
| 307|    |-				damageTooltip(template.attack[type]),
|    | 307|+			damageTooltip(template.attack[type]),
| 308| 308| 				statusEffectsTooltip(template.attack[type])].filter(effect => effect);
| 309| 309| 		let range = rangeTooltip(template.attack[type]);
| 310| 310| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 4.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 305| 305| 		});
| 306| 306| 		let effects = [captureTooltip(template.attack[type]),
| 307| 307| 				damageTooltip(template.attack[type]),
| 308|    |-				statusEffectsTooltip(template.attack[type])].filter(effect => effect);
|    | 308|+			statusEffectsTooltip(template.attack[type])].filter(effect => effect);
| 309| 309| 		let range = rangeTooltip(template.attack[type]);
| 310| 310| 
| 311| 311| 		tooltips.push(sprintf(translate("%(attackLabel)s %(details)s, %(range)s, %(rate)s"), {
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 4.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 331| 331| 			continue;
| 332| 332| 
| 333| 333| 		let effects = [captureTooltip(splash),
| 334|    |-				damageTooltip(splash),
|    | 334|+			damageTooltip(splash),
| 335| 335| 				statusEffectsTooltip(splash)].filter(effect => effect);
| 336| 336| 
| 337| 337| 		let splashDamageTooltip = sprintf(translate("%(label)s: %(effects)s"), {
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 4.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 332| 332| 
| 333| 333| 		let effects = [captureTooltip(splash),
| 334| 334| 				damageTooltip(splash),
| 335|    |-				statusEffectsTooltip(splash)].filter(effect => effect);
|    | 335|+			statusEffectsTooltip(splash)].filter(effect => effect);
| 336| 336| 
| 337| 337| 		let splashDamageTooltip = sprintf(translate("%(label)s: %(effects)s"), {
| 338| 338| 			"label": headerFont(g_SplashDamageTypes[splash.shape]),
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 412| 412| function getRepairTimeTooltip(entState)
| 413| 413| {
| 414| 414| 	return sprintf(translate("%(label)s %(details)s"), {
| 415|    |-			"label": headerFont(translate("Number of repairers:")),
|    | 415|+		"label": headerFont(translate("Number of repairers:")),
| 416| 416| 			"details": entState.repairable.numBuilders
| 417| 417| 		}) + "\n" + (entState.repairable.numBuilders ?
| 418| 418| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 413| 413| {
| 414| 414| 	return sprintf(translate("%(label)s %(details)s"), {
| 415| 415| 			"label": headerFont(translate("Number of repairers:")),
| 416|    |-			"details": entState.repairable.numBuilders
|    | 416|+		"details": entState.repairable.numBuilders
| 417| 417| 		}) + "\n" + (entState.repairable.numBuilders ?
| 418| 418| 		sprintf(translatePlural(
| 419| 419| 			"Add another worker to speed up the repairs by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 414| 414| 	return sprintf(translate("%(label)s %(details)s"), {
| 415| 415| 			"label": headerFont(translate("Number of repairers:")),
| 416| 416| 			"details": entState.repairable.numBuilders
| 417|    |-		}) + "\n" + (entState.repairable.numBuilders ?
|    | 417|+	}) + "\n" + (entState.repairable.numBuilders ?
| 418| 418| 		sprintf(translatePlural(
| 419| 419| 			"Add another worker to speed up the repairs by %(second)s second.",
| 420| 420| 			"Add another worker to speed up the repairs by %(second)s seconds.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 434| 434| function getBuildTimeTooltip(entState)
| 435| 435| {
| 436| 436| 	return sprintf(translate("%(label)s %(details)s"), {
| 437|    |-			"label": headerFont(translate("Number of builders:")),
|    | 437|+		"label": headerFont(translate("Number of builders:")),
| 438| 438| 			"details": entState.foundation.numBuilders
| 439| 439| 		}) + "\n" + (entState.foundation.numBuilders ?
| 440| 440| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 435| 435| {
| 436| 436| 	return sprintf(translate("%(label)s %(details)s"), {
| 437| 437| 			"label": headerFont(translate("Number of builders:")),
| 438|    |-			"details": entState.foundation.numBuilders
|    | 438|+		"details": entState.foundation.numBuilders
| 439| 439| 		}) + "\n" + (entState.foundation.numBuilders ?
| 440| 440| 		sprintf(translatePlural(
| 441| 441| 			"Add another worker to speed up the construction by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 436| 436| 	return sprintf(translate("%(label)s %(details)s"), {
| 437| 437| 			"label": headerFont(translate("Number of builders:")),
| 438| 438| 			"details": entState.foundation.numBuilders
| 439|    |-		}) + "\n" + (entState.foundation.numBuilders ?
|    | 439|+	}) + "\n" + (entState.foundation.numBuilders ?
| 440| 440| 		sprintf(translatePlural(
| 441| 441| 			"Add another worker to speed up the construction by %(second)s second.",
| 442| 442| 			"Add another worker to speed up the construction by %(second)s seconds.",
Executing section cli...

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

That is indeed more what I mean ?
I think you'll agree that it's more flexible.

What I meant about attackRateDetails is that it expects an entity template (and the name of an attack type), which is far more than simply "attack rate" tooltips should need. So I think it needs some changing too to be re-usable for something other than attack types.

Elaborated the attackRateTooltip, however, I could not split it because it would add more duplicity. IMHO This is a decent alternative.

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 273| 273| 		return "";
| 274| 274| 
| 275| 275| 	return sprintf(translate("%(damage)s %(damageType)s"), {
| 276|    |-			"damage": template.Capture.toFixed(1),
|    | 276|+		"damage": template.Capture.toFixed(1),
| 277| 277| 			"damageType": unitFont(translateWithContext("damage type", "Capture"))
| 278| 278| 		});
| 279| 279| }
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 274| 274| 
| 275| 275| 	return sprintf(translate("%(damage)s %(damageType)s"), {
| 276| 276| 			"damage": template.Capture.toFixed(1),
| 277|    |-			"damageType": unitFont(translateWithContext("damage type", "Capture"))
|    | 277|+		"damageType": unitFont(translateWithContext("damage type", "Capture"))
| 278| 278| 		});
| 279| 279| }
| 280| 280| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 275| 275| 	return sprintf(translate("%(damage)s %(damageType)s"), {
| 276| 276| 			"damage": template.Capture.toFixed(1),
| 277| 277| 			"damageType": unitFont(translateWithContext("damage type", "Capture"))
| 278|    |-		});
|    | 278|+	});
| 279| 279| }
| 280| 280| 
| 281| 281| function statusEffectsTooltip(template)
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 422| 422| function getRepairTimeTooltip(entState)
| 423| 423| {
| 424| 424| 	return sprintf(translate("%(label)s %(details)s"), {
| 425|    |-			"label": headerFont(translate("Number of repairers:")),
|    | 425|+		"label": headerFont(translate("Number of repairers:")),
| 426| 426| 			"details": entState.repairable.numBuilders
| 427| 427| 		}) + "\n" + (entState.repairable.numBuilders ?
| 428| 428| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 423| 423| {
| 424| 424| 	return sprintf(translate("%(label)s %(details)s"), {
| 425| 425| 			"label": headerFont(translate("Number of repairers:")),
| 426|    |-			"details": entState.repairable.numBuilders
|    | 426|+		"details": entState.repairable.numBuilders
| 427| 427| 		}) + "\n" + (entState.repairable.numBuilders ?
| 428| 428| 		sprintf(translatePlural(
| 429| 429| 			"Add another worker to speed up the repairs by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 424| 424| 	return sprintf(translate("%(label)s %(details)s"), {
| 425| 425| 			"label": headerFont(translate("Number of repairers:")),
| 426| 426| 			"details": entState.repairable.numBuilders
| 427|    |-		}) + "\n" + (entState.repairable.numBuilders ?
|    | 427|+	}) + "\n" + (entState.repairable.numBuilders ?
| 428| 428| 		sprintf(translatePlural(
| 429| 429| 			"Add another worker to speed up the repairs by %(second)s second.",
| 430| 430| 			"Add another worker to speed up the repairs by %(second)s seconds.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 444| 444| function getBuildTimeTooltip(entState)
| 445| 445| {
| 446| 446| 	return sprintf(translate("%(label)s %(details)s"), {
| 447|    |-			"label": headerFont(translate("Number of builders:")),
|    | 447|+		"label": headerFont(translate("Number of builders:")),
| 448| 448| 			"details": entState.foundation.numBuilders
| 449| 449| 		}) + "\n" + (entState.foundation.numBuilders ?
| 450| 450| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 445| 445| {
| 446| 446| 	return sprintf(translate("%(label)s %(details)s"), {
| 447| 447| 			"label": headerFont(translate("Number of builders:")),
| 448|    |-			"details": entState.foundation.numBuilders
|    | 448|+		"details": entState.foundation.numBuilders
| 449| 449| 		}) + "\n" + (entState.foundation.numBuilders ?
| 450| 450| 		sprintf(translatePlural(
| 451| 451| 			"Add another worker to speed up the construction by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 446| 446| 	return sprintf(translate("%(label)s %(details)s"), {
| 447| 447| 			"label": headerFont(translate("Number of builders:")),
| 448| 448| 			"details": entState.foundation.numBuilders
| 449|    |-		}) + "\n" + (entState.foundation.numBuilders ?
|    | 449|+	}) + "\n" + (entState.foundation.numBuilders ?
| 450| 450| 		sprintf(translatePlural(
| 451| 451| 			"Add another worker to speed up the construction by %(second)s second.",
| 452| 452| 			"Add another worker to speed up the construction by %(second)s seconds.",
Executing section cli...

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

binaries/data/mods/public/gui/common/tooltips.js
333–337

Can be inlined below.

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 273| 273| 		return "";
| 274| 274| 
| 275| 275| 	return sprintf(translate("%(damage)s %(damageType)s"), {
| 276|    |-			"damage": template.Capture.toFixed(1),
|    | 276|+		"damage": template.Capture.toFixed(1),
| 277| 277| 			"damageType": unitFont(translateWithContext("damage type", "Capture"))
| 278| 278| 		});
| 279| 279| }
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 274| 274| 
| 275| 275| 	return sprintf(translate("%(damage)s %(damageType)s"), {
| 276| 276| 			"damage": template.Capture.toFixed(1),
| 277|    |-			"damageType": unitFont(translateWithContext("damage type", "Capture"))
|    | 277|+		"damageType": unitFont(translateWithContext("damage type", "Capture"))
| 278| 278| 		});
| 279| 279| }
| 280| 280| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 275| 275| 	return sprintf(translate("%(damage)s %(damageType)s"), {
| 276| 276| 			"damage": template.Capture.toFixed(1),
| 277| 277| 			"damageType": unitFont(translateWithContext("damage type", "Capture"))
| 278|    |-		});
|    | 278|+	});
| 279| 279| }
| 280| 280| 
| 281| 281| function statusEffectsTooltip(template)
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 420| 420| function getRepairTimeTooltip(entState)
| 421| 421| {
| 422| 422| 	return sprintf(translate("%(label)s %(details)s"), {
| 423|    |-			"label": headerFont(translate("Number of repairers:")),
|    | 423|+		"label": headerFont(translate("Number of repairers:")),
| 424| 424| 			"details": entState.repairable.numBuilders
| 425| 425| 		}) + "\n" + (entState.repairable.numBuilders ?
| 426| 426| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 421| 421| {
| 422| 422| 	return sprintf(translate("%(label)s %(details)s"), {
| 423| 423| 			"label": headerFont(translate("Number of repairers:")),
| 424|    |-			"details": entState.repairable.numBuilders
|    | 424|+		"details": entState.repairable.numBuilders
| 425| 425| 		}) + "\n" + (entState.repairable.numBuilders ?
| 426| 426| 		sprintf(translatePlural(
| 427| 427| 			"Add another worker to speed up the repairs by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 422| 422| 	return sprintf(translate("%(label)s %(details)s"), {
| 423| 423| 			"label": headerFont(translate("Number of repairers:")),
| 424| 424| 			"details": entState.repairable.numBuilders
| 425|    |-		}) + "\n" + (entState.repairable.numBuilders ?
|    | 425|+	}) + "\n" + (entState.repairable.numBuilders ?
| 426| 426| 		sprintf(translatePlural(
| 427| 427| 			"Add another worker to speed up the repairs by %(second)s second.",
| 428| 428| 			"Add another worker to speed up the repairs by %(second)s seconds.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 442| 442| function getBuildTimeTooltip(entState)
| 443| 443| {
| 444| 444| 	return sprintf(translate("%(label)s %(details)s"), {
| 445|    |-			"label": headerFont(translate("Number of builders:")),
|    | 445|+		"label": headerFont(translate("Number of builders:")),
| 446| 446| 			"details": entState.foundation.numBuilders
| 447| 447| 		}) + "\n" + (entState.foundation.numBuilders ?
| 448| 448| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 443| 443| {
| 444| 444| 	return sprintf(translate("%(label)s %(details)s"), {
| 445| 445| 			"label": headerFont(translate("Number of builders:")),
| 446|    |-			"details": entState.foundation.numBuilders
|    | 446|+		"details": entState.foundation.numBuilders
| 447| 447| 		}) + "\n" + (entState.foundation.numBuilders ?
| 448| 448| 		sprintf(translatePlural(
| 449| 449| 			"Add another worker to speed up the construction by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 444| 444| 	return sprintf(translate("%(label)s %(details)s"), {
| 445| 445| 			"label": headerFont(translate("Number of builders:")),
| 446| 446| 			"details": entState.foundation.numBuilders
| 447|    |-		}) + "\n" + (entState.foundation.numBuilders ?
|    | 447|+	}) + "\n" + (entState.foundation.numBuilders ?
| 448| 448| 		sprintf(translatePlural(
| 449| 449| 			"Add another worker to speed up the construction by %(second)s second.",
| 450| 450| 			"Add another worker to speed up the construction by %(second)s seconds.",
Executing section cli...

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

binaries/data/mods/public/gui/common/tooltips.js
305–307

Back to the g_AttackTypes[type] for performance reasons?
This now has removed hardcoding of the attack types.

wraitii requested changes to this revision.Sep 1 2019, 10:09 AM

This looks pretty good. Changes I'd do:

  • rename 'template' to specify what this template is exactly (e.g. entityTemplate, attackTemplate, damageTemplate...)
  • pass derived templates to the damageTooltip, captureTooltip functions
  • skip status effects for this patch
  • the previous code picked 'Rate' for all units, and 'Interval' for structures, but you're actually picking 'Interval' everywhere. Is there a reason for this? I think if anything it should default to Rate, but I also think you could keep the switching code.
binaries/data/mods/public/gui/common/tooltips.js
173

You're losing the Rate / Interval switch here... Not sure it's a huge issue though.

252–253

I'd prefer template to be already template.Damage here.

281

Needs to be changed to 'Give Status' - but actually I'd just remove it in this diff, as I have D2218 in the pipes.

288

I'd prefer you pass template.Damage, ... (see above).

305–307

We do have performance concerns in GUI scripts, but this is likely fast enough.

This revision now requires changes to proceed.Sep 1 2019, 10:09 AM
Freagarach marked 4 inline comments as done.
  • Specify templates.
  • Pass effect templates.
  • Nuke StatusEffects despite it being merely a placeholder (see summary).
  • Inlined SplashShape.
  • Interval -> Rate.
Freagarach added inline comments.
binaries/data/mods/public/gui/common/tooltips.js
173

Yeah, I've renamed to Rate for that makes more sense, I do not think we lose information here (@Nescio?), but I can reintroduce the switch if necessary.

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

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

binaries/data/mods/public/gui/common/tooltips.js
11–20

Removal of these could be seperated, is that desired?

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 267| 267| 		return "";
| 268| 268| 
| 269| 269| 	return sprintf(translate("%(amount)s %(name)s"), {
| 270|    |-			"amount": captureTemplate.toFixed(1),
|    | 270|+		"amount": captureTemplate.toFixed(1),
| 271| 271| 			"name": unitFont(translateWithContext("damage type", "Capture"))
| 272| 272| 		});
| 273| 273| }
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 268| 268| 
| 269| 269| 	return sprintf(translate("%(amount)s %(name)s"), {
| 270| 270| 			"amount": captureTemplate.toFixed(1),
| 271|    |-			"name": unitFont(translateWithContext("damage type", "Capture"))
|    | 271|+		"name": unitFont(translateWithContext("damage type", "Capture"))
| 272| 272| 		});
| 273| 273| }
| 274| 274| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 269| 269| 	return sprintf(translate("%(amount)s %(name)s"), {
| 270| 270| 			"amount": captureTemplate.toFixed(1),
| 271| 271| 			"name": unitFont(translateWithContext("damage type", "Capture"))
| 272|    |-		});
|    | 272|+	});
| 273| 273| }
| 274| 274| 
| 275| 275| function attackEffectsTooltip(attackTypeTemplate)
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 413| 413| function getRepairTimeTooltip(entState)
| 414| 414| {
| 415| 415| 	return sprintf(translate("%(label)s %(details)s"), {
| 416|    |-			"label": headerFont(translate("Number of repairers:")),
|    | 416|+		"label": headerFont(translate("Number of repairers:")),
| 417| 417| 			"details": entState.repairable.numBuilders
| 418| 418| 		}) + "\n" + (entState.repairable.numBuilders ?
| 419| 419| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 414| 414| {
| 415| 415| 	return sprintf(translate("%(label)s %(details)s"), {
| 416| 416| 			"label": headerFont(translate("Number of repairers:")),
| 417|    |-			"details": entState.repairable.numBuilders
|    | 417|+		"details": entState.repairable.numBuilders
| 418| 418| 		}) + "\n" + (entState.repairable.numBuilders ?
| 419| 419| 		sprintf(translatePlural(
| 420| 420| 			"Add another worker to speed up the repairs by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 415| 415| 	return sprintf(translate("%(label)s %(details)s"), {
| 416| 416| 			"label": headerFont(translate("Number of repairers:")),
| 417| 417| 			"details": entState.repairable.numBuilders
| 418|    |-		}) + "\n" + (entState.repairable.numBuilders ?
|    | 418|+	}) + "\n" + (entState.repairable.numBuilders ?
| 419| 419| 		sprintf(translatePlural(
| 420| 420| 			"Add another worker to speed up the repairs by %(second)s second.",
| 421| 421| 			"Add another worker to speed up the repairs by %(second)s seconds.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 435| 435| function getBuildTimeTooltip(entState)
| 436| 436| {
| 437| 437| 	return sprintf(translate("%(label)s %(details)s"), {
| 438|    |-			"label": headerFont(translate("Number of builders:")),
|    | 438|+		"label": headerFont(translate("Number of builders:")),
| 439| 439| 			"details": entState.foundation.numBuilders
| 440| 440| 		}) + "\n" + (entState.foundation.numBuilders ?
| 441| 441| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 436| 436| {
| 437| 437| 	return sprintf(translate("%(label)s %(details)s"), {
| 438| 438| 			"label": headerFont(translate("Number of builders:")),
| 439|    |-			"details": entState.foundation.numBuilders
|    | 439|+		"details": entState.foundation.numBuilders
| 440| 440| 		}) + "\n" + (entState.foundation.numBuilders ?
| 441| 441| 		sprintf(translatePlural(
| 442| 442| 			"Add another worker to speed up the construction by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 437| 437| 	return sprintf(translate("%(label)s %(details)s"), {
| 438| 438| 			"label": headerFont(translate("Number of builders:")),
| 439| 439| 			"details": entState.foundation.numBuilders
| 440|    |-		}) + "\n" + (entState.foundation.numBuilders ?
|    | 440|+	}) + "\n" + (entState.foundation.numBuilders ?
| 441| 441| 		sprintf(translatePlural(
| 442| 442| 			"Add another worker to speed up the construction by %(second)s second.",
| 443| 443| 			"Add another worker to speed up the construction by %(second)s seconds.",
Executing section cli...

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

Stan added inline comments.
binaries/data/mods/public/gui/common/tooltips.js
162

TODO (Full caps I believe) I always wondered if tickets should'nt be created each time and Todos referencing them (But that's another topic)

164

What if repeat time is 0 ?

172

Guess it could be +projectile > 1

310

Could set it to 0 and ignore my comment above maybe

In D2138#93283, @Nescio wrote:

What does rate mean here?

Rate is here the attack rate. Or the rate at which arrows are fired (previously Interval).

Again, what is the rate here? Damage per arrow, arrows per time, damage per time, a speed, something else? If it's just <RepeatTime>, then why not call it time?

In D2138#93315, @Nescio wrote:

Again, what is the rate here? Damage per arrow, arrows per time, damage per time, a speed, something else? If it's just <RepeatTime>, then why not call it time?

Ah, it is the repeatTime for melee and 1-projectile attacks and arrows per repeatTime for multi-projectile attacks.

May I suggest we don't really care for the name as in rP14954 they got switched and no-one objected? The split was introduced in rP14618. Related discussion on IRC.

Freagarach added inline comments.
binaries/data/mods/public/gui/common/tooltips.js
162

I always wondered if tickets should'nt be created each time and Todos referencing them

Agreed, but it is kinda difficult here, as the ticket has no meaning without this patch being committed. And when this patch is committed I can either open a ticket regarding the issue, or create a diff resolving the issue.

164

All hell breaks loose. No really, try it.

Freagarach marked 2 inline comments as done.
  • Rate -> Interval.
  • if (projectiles && projectiles > 1) -> if (projectiles > 1).

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

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

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 267| 267| 		return "";
| 268| 268| 
| 269| 269| 	return sprintf(translate("%(amount)s %(name)s"), {
| 270|    |-			"amount": captureTemplate.toFixed(1),
|    | 270|+		"amount": captureTemplate.toFixed(1),
| 271| 271| 			"name": unitFont(translateWithContext("damage type", "Capture"))
| 272| 272| 		});
| 273| 273| }
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 268| 268| 
| 269| 269| 	return sprintf(translate("%(amount)s %(name)s"), {
| 270| 270| 			"amount": captureTemplate.toFixed(1),
| 271|    |-			"name": unitFont(translateWithContext("damage type", "Capture"))
|    | 271|+		"name": unitFont(translateWithContext("damage type", "Capture"))
| 272| 272| 		});
| 273| 273| }
| 274| 274| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 269| 269| 	return sprintf(translate("%(amount)s %(name)s"), {
| 270| 270| 			"amount": captureTemplate.toFixed(1),
| 271| 271| 			"name": unitFont(translateWithContext("damage type", "Capture"))
| 272|    |-		});
|    | 272|+	});
| 273| 273| }
| 274| 274| 
| 275| 275| function attackEffectsTooltip(attackTypeTemplate)
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 413| 413| function getRepairTimeTooltip(entState)
| 414| 414| {
| 415| 415| 	return sprintf(translate("%(label)s %(details)s"), {
| 416|    |-			"label": headerFont(translate("Number of repairers:")),
|    | 416|+		"label": headerFont(translate("Number of repairers:")),
| 417| 417| 			"details": entState.repairable.numBuilders
| 418| 418| 		}) + "\n" + (entState.repairable.numBuilders ?
| 419| 419| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 414| 414| {
| 415| 415| 	return sprintf(translate("%(label)s %(details)s"), {
| 416| 416| 			"label": headerFont(translate("Number of repairers:")),
| 417|    |-			"details": entState.repairable.numBuilders
|    | 417|+		"details": entState.repairable.numBuilders
| 418| 418| 		}) + "\n" + (entState.repairable.numBuilders ?
| 419| 419| 		sprintf(translatePlural(
| 420| 420| 			"Add another worker to speed up the repairs by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 415| 415| 	return sprintf(translate("%(label)s %(details)s"), {
| 416| 416| 			"label": headerFont(translate("Number of repairers:")),
| 417| 417| 			"details": entState.repairable.numBuilders
| 418|    |-		}) + "\n" + (entState.repairable.numBuilders ?
|    | 418|+	}) + "\n" + (entState.repairable.numBuilders ?
| 419| 419| 		sprintf(translatePlural(
| 420| 420| 			"Add another worker to speed up the repairs by %(second)s second.",
| 421| 421| 			"Add another worker to speed up the repairs by %(second)s seconds.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 435| 435| function getBuildTimeTooltip(entState)
| 436| 436| {
| 437| 437| 	return sprintf(translate("%(label)s %(details)s"), {
| 438|    |-			"label": headerFont(translate("Number of builders:")),
|    | 438|+		"label": headerFont(translate("Number of builders:")),
| 439| 439| 			"details": entState.foundation.numBuilders
| 440| 440| 		}) + "\n" + (entState.foundation.numBuilders ?
| 441| 441| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 436| 436| {
| 437| 437| 	return sprintf(translate("%(label)s %(details)s"), {
| 438| 438| 			"label": headerFont(translate("Number of builders:")),
| 439|    |-			"details": entState.foundation.numBuilders
|    | 439|+		"details": entState.foundation.numBuilders
| 440| 440| 		}) + "\n" + (entState.foundation.numBuilders ?
| 441| 441| 		sprintf(translatePlural(
| 442| 442| 			"Add another worker to speed up the construction by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 437| 437| 	return sprintf(translate("%(label)s %(details)s"), {
| 438| 438| 			"label": headerFont(translate("Number of builders:")),
| 439| 439| 			"details": entState.foundation.numBuilders
| 440|    |-		}) + "\n" + (entState.foundation.numBuilders ?
|    | 440|+	}) + "\n" + (entState.foundation.numBuilders ?
| 441| 441| 		sprintf(translatePlural(
| 442| 442| 			"Add another worker to speed up the construction by %(second)s second.",
| 443| 443| 			"Add another worker to speed up the construction by %(second)s seconds.",
Executing section cli...

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

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

Sure though the best would be to fix it now if it isn't complex :D

164

Ah yeah of course. A 0 repeat time in Timer.js is just a one time timer but here it's different :)

172

If it can be undefined you need to add the '+' to cast it to int ( I see the variable below is undefined) else it might error out/have some weird behavior
(Js also have function for casting to int but they are slow so we just use +variable)

Freagarach added inline comments.
binaries/data/mods/public/gui/common/tooltips.js
162

Well yes, except that I do not think templates have projectile names? They only have projectile actors, which you don't want to show here ;) So that means changing templates, which I think is out of scope (I strayed a bit already).

172

I tested but not got any strange behavior? Still a good change to do, though.

A rate (ratio) implies something per something, e.g.

  • fertility rate is the number of children born per woman
  • incarceration rate is the number of prisoners per 100,000 population
  • interest rate is the money paid over money borrowed

Likewise, 3 arrows per 2 seconds is a rate, but 2 seconds is a time (interval). 0 A.D.'s tooltips are actually incorrect, so perhaps you could solve that:

Screenshot from 2019-09-01 18-07-25.png (1×1 px, 1 MB)

Screenshot from 2019-09-01 18-07-48.png (1×1 px, 1 MB)

binaries/data/mods/public/gui/common/tooltips.js
260–262

Actually the switch is reversed here; it ought to be: if buildingAI then Rate else Interval.

In D2138##inline-43818, @Nescio wrote:

Actually the switch is reversed here; it ought to be: if buildingAI then Rate else Interval.

I noticed ;)

May I suggest we don't really care for the name as in rP14954 they got switched and no-one objected? The split was introduced in rP14618. Related discussion on IRC.

Discussion on IRC today.
So there *is* objection and I will revert to the desired behaviour. Thanks @Nescio!

So there *is* objection and I will revert to the desired behaviour.

It doesn't really matter how you call it internally in the code, as long as it is done consistently. However, for user-facing text strings it's best to be precise. (I actually only noticed 0 A.D. does it wrong today, because of your patch; thank you.)

In D2138#93461, @Nescio wrote:

So there *is* objection and I will revert to the desired behaviour.

It doesn't really matter how you call it internally in the code, as long as it is done consistently. However, for user-facing text strings it's best to be precise. (I actually only noticed 0 A.D. does it wrong today, because of your patch; thank you.)

I removed the whole differentiation between them and used Interval for both ^^.

Freagarach marked 2 inline comments as done.

When multiple projectiles: Rate instead of Interval.

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

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

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

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 163| 163| 
| 164| 164| 	if (+projectiles > 1)
| 165| 165| 	{
| 166|    |-		header = headerFont(translate("Rate:"))
|    | 166|+		header = headerFont(translate("Rate:"));
| 167| 167| 		let projectileString = sprintf(translatePlural("%(projectileCount)s %(projectileName)s", "%(projectileCount)s %(projectileName)s", projectiles), {
| 168| 168| 			"projectileCount": projectiles,
| 169| 169| 			"projectileName": unitFont(translatePlural("arrow", "arrows", projectiles))
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 269| 269| 		return "";
| 270| 270| 
| 271| 271| 	return sprintf(translate("%(amount)s %(name)s"), {
| 272|    |-			"amount": captureTemplate.toFixed(1),
|    | 272|+		"amount": captureTemplate.toFixed(1),
| 273| 273| 			"name": unitFont(translateWithContext("damage type", "Capture"))
| 274| 274| 		});
| 275| 275| }
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 270| 270| 
| 271| 271| 	return sprintf(translate("%(amount)s %(name)s"), {
| 272| 272| 			"amount": captureTemplate.toFixed(1),
| 273|    |-			"name": unitFont(translateWithContext("damage type", "Capture"))
|    | 273|+		"name": unitFont(translateWithContext("damage type", "Capture"))
| 274| 274| 		});
| 275| 275| }
| 276| 276| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 271| 271| 	return sprintf(translate("%(amount)s %(name)s"), {
| 272| 272| 			"amount": captureTemplate.toFixed(1),
| 273| 273| 			"name": unitFont(translateWithContext("damage type", "Capture"))
| 274|    |-		});
|    | 274|+	});
| 275| 275| }
| 276| 276| 
| 277| 277| function attackEffectsTooltip(attackTypeTemplate)
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 415| 415| function getRepairTimeTooltip(entState)
| 416| 416| {
| 417| 417| 	return sprintf(translate("%(label)s %(details)s"), {
| 418|    |-			"label": headerFont(translate("Number of repairers:")),
|    | 418|+		"label": headerFont(translate("Number of repairers:")),
| 419| 419| 			"details": entState.repairable.numBuilders
| 420| 420| 		}) + "\n" + (entState.repairable.numBuilders ?
| 421| 421| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 416| 416| {
| 417| 417| 	return sprintf(translate("%(label)s %(details)s"), {
| 418| 418| 			"label": headerFont(translate("Number of repairers:")),
| 419|    |-			"details": entState.repairable.numBuilders
|    | 419|+		"details": entState.repairable.numBuilders
| 420| 420| 		}) + "\n" + (entState.repairable.numBuilders ?
| 421| 421| 		sprintf(translatePlural(
| 422| 422| 			"Add another worker to speed up the repairs by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 417| 417| 	return sprintf(translate("%(label)s %(details)s"), {
| 418| 418| 			"label": headerFont(translate("Number of repairers:")),
| 419| 419| 			"details": entState.repairable.numBuilders
| 420|    |-		}) + "\n" + (entState.repairable.numBuilders ?
|    | 420|+	}) + "\n" + (entState.repairable.numBuilders ?
| 421| 421| 		sprintf(translatePlural(
| 422| 422| 			"Add another worker to speed up the repairs by %(second)s second.",
| 423| 423| 			"Add another worker to speed up the repairs by %(second)s seconds.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 437| 437| function getBuildTimeTooltip(entState)
| 438| 438| {
| 439| 439| 	return sprintf(translate("%(label)s %(details)s"), {
| 440|    |-			"label": headerFont(translate("Number of builders:")),
|    | 440|+		"label": headerFont(translate("Number of builders:")),
| 441| 441| 			"details": entState.foundation.numBuilders
| 442| 442| 		}) + "\n" + (entState.foundation.numBuilders ?
| 443| 443| 		sprintf(translatePlural(
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 3.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 438| 438| {
| 439| 439| 	return sprintf(translate("%(label)s %(details)s"), {
| 440| 440| 			"label": headerFont(translate("Number of builders:")),
| 441|    |-			"details": entState.foundation.numBuilders
|    | 441|+		"details": entState.foundation.numBuilders
| 442| 442| 		}) + "\n" + (entState.foundation.numBuilders ?
| 443| 443| 		sprintf(translatePlural(
| 444| 444| 			"Add another worker to speed up the construction by %(second)s second.",
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 2.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/common/tooltips.js
| 439| 439| 	return sprintf(translate("%(label)s %(details)s"), {
| 440| 440| 			"label": headerFont(translate("Number of builders:")),
| 441| 441| 			"details": entState.foundation.numBuilders
| 442|    |-		}) + "\n" + (entState.foundation.numBuilders ?
|    | 442|+	}) + "\n" + (entState.foundation.numBuilders ?
| 443| 443| 		sprintf(translatePlural(
| 444| 444| 			"Add another worker to speed up the construction by %(second)s second.",
| 445| 445| 			"Add another worker to speed up the construction by %(second)s seconds.",

binaries/data/mods/public/gui/common/tooltips.js
| 166| »   »   header·=·headerFont(translate("Rate:"))
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
Executing section cli...

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

I think this needs one last change but I'll do it myself before committing as it's fairly straightforward.

Thanks for the patch.

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

pass repeatTime directly here, so that we can use this for status effects.

This revision is now accepted and ready to land.Sep 7 2019, 3:58 PM

Use 'Details' instead of 'Tooltip' for helper functions (previous convention), group them together (range and attack rate were split from attack by armour-related tooltips).

Also fix linter report.

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

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

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

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

Add ':' back, and make session tooltips at most 400 pixels wide so that this fits on one line.

Without the tooltip size change:

Capture d’écran 2019-09-07 à 16.07.59.png (536×986 px, 760 KB)

With:
Capture d’écran 2019-09-07 à 16.30.49.png (462×1 px, 834 KB)

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

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

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

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

This revision was automatically updated to reflect the committed changes.

Thanks for the patch.

Thanks for committing this!