Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/common/tooltips.js
Show First 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | function getCurrentHealthTooltip(entState, label) | ||||
return sprintf(translate("%(healthLabel)s %(current)s / %(max)s"), { | return sprintf(translate("%(healthLabel)s %(current)s / %(max)s"), { | ||||
"healthLabel": headerFont(label || translate("Health:")), | "healthLabel": headerFont(label || translate("Health:")), | ||||
"current": Math.round(entState.hitpoints), | "current": Math.round(entState.hitpoints), | ||||
"max": Math.round(entState.maxHitpoints) | "max": Math.round(entState.maxHitpoints) | ||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Converts an armor level into the actual reduction percentage | * Converts an resistance level into the actual reduction percentage | ||||
*/ | */ | ||||
function armorLevelToPercentageString(level) | function resistanceLevelToPercentageString(level) | ||||
{ | { | ||||
return sprintf(translate("%(percentage)s%%"), { | return sprintf(translate("%(percentage)s%%"), { | ||||
"percentage": (100 - Math.round(Math.pow(0.9, level) * 100)) | "percentage": (100 - Math.round(Math.pow(0.9, level) * 100)) | ||||
}); | }); | ||||
} | } | ||||
function getArmorTooltip(template) | function getResistanceTooltip(template) | ||||
Freagarach: Really improvable,,, | |||||
{ | { | ||||
if (!template.armour) | if (!template.resistance) | ||||
return ""; | return ""; | ||||
let tooltips = []; | |||||
return sprintf(translate("%(label)s %(details)s"), { | if (template.resistance.Damage) | ||||
Done Inline ActionsNot sure if we really need this variable, used a couple of times, meh bb: Not sure if we really need this variable, used a couple of times, meh | |||||
"label": headerFont(translate("Armor:")), | tooltips.push(sprintf(translate("%(label)s %(details)s"), { | ||||
"label": headerFont(translate("Damage Resistance:")), | |||||
"details": | "details": | ||||
Object.keys(template.armour).map( | Object.keys(template.resistance.Damage).map( | ||||
dmgType => sprintf(translate("%(damage)s %(damageType)s %(armorPercentage)s"), { | dmgType => sprintf(translate("%(damage)s %(damageType)s %(resistancePercentage)s"), { | ||||
"damage": template.armour[dmgType].toFixed(1), | "damage": template.resistance.Damage[dmgType].toFixed(1), | ||||
"damageType": unitFont(translateWithContext("damage type", dmgType)), | "damageType": unitFont(translateWithContext("damage type", dmgType)), | ||||
"armorPercentage": | "resistancePercentage": | ||||
'[font="sans-10"]' + | '[font="sans-10"]' + | ||||
Done Inline ActionsIIRC all other tooltips have the : in headerfont and translation too. bb: IIRC all other tooltips have the `:` in headerfont and translation too. | |||||
sprintf(translate("(%(armorPercentage)s)"), { | sprintf(translate("(%(resistancePercentage)s)"), { | ||||
"armorPercentage": armorLevelToPercentageString(template.armour[dmgType]) | "resistancePercentage": resistanceLevelToPercentageString(template.resistance.Damage[dmgType]) | ||||
}) + '[/font]' | }) + '[/font]' | ||||
}) | }) | ||||
).join(commaFont(translate(", "))) | ).join(commaFont(translate(", "))) | ||||
}); | })); | ||||
if (template.resistance.Capture) | |||||
tooltips.push(sprintf(translate("%(label)s %(details)s"), { | |||||
"label": headerFont(translate("Capture Resistance:")), | |||||
"details": | |||||
sprintf(translate("%(damage)s %(damageType)s %(resistancePercentage)s"), { | |||||
"damage": template.resistance.Capture.toFixed(1), | |||||
"damageType": unitFont(translateWithContext("damage type", "Capture")), | |||||
"resistancePercentage": | |||||
'[font="sans-10"]' + | |||||
sprintf(translate("(%(resistancePercentage)s)"), { | |||||
"resistancePercentage": resistanceLevelToPercentageString(template.resistance.Capture) | |||||
}) + '[/font]' | |||||
}) | |||||
Done Inline Actionsshouldn't we just pass template.Damage to this function? Same below bb: shouldn't we just pass template.Damage to this function? Same below | |||||
})); | |||||
if (template.resistance.StatusEffects) | |||||
tooltips.push(sprintf(translate("%(label)s %(details)s"), { | |||||
"label": headerFont(translate("Status Effects Resistance:")), | |||||
"details": "ToDo." | |||||
Done Inline Actionswill it display to do in the interface ? Stan: will it display to do in the interface ? | |||||
Done Inline ActionsOnly if someone adds a statusEffect resistance. Freagarach: Only if someone adds a statusEffect resistance. | |||||
//sprintf(translate("%(damage)s %(damageType)s %(resistancePercentage)s"), { | |||||
// "damage": template.resistance.Capture.toFixed(1), | |||||
// "damageType": unitFont(translateWithContext("damage type", "Capture")), | |||||
// "resistancePercentage": | |||||
// '[font="sans-10"]' + | |||||
// sprintf(translate("(%(resistancePercentage)s)"), { | |||||
// "resistancePercentage": resistanceLevelToPercentageString(template.resistance.Capture) | |||||
// }) + '[/font]' | |||||
//}) | |||||
})); | |||||
return tooltips.join("\n"); | |||||
} | } | ||||
function attackRateDetails(interval, projectiles) | function attackRateDetails(interval, projectiles) | ||||
{ | { | ||||
if (!interval) | if (!interval) | ||||
return ""; | return ""; | ||||
if (projectiles === 0) | if (projectiles === 0) | ||||
▲ Show 20 Lines • Show All 701 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Really improvable,,,