forked from 0ad/0ad
Display all auras in the tooltips (even if there are some with an identical name). Patch by s0600204, fixes #3655.
Add an aura tooltip to the construction panel. Remove duplicate tooltip code for the training panel. Eliminate for-each and use the aura ID in GetTemplateDataHelper, since only that is a unique identifier. Change the name from "Hero Aura" to "Garrisoned Capture Aura" for that aura that every hero has. This was SVN commit r17644.
This commit is contained in:
parent
c9a22ec7c3
commit
cd22f9f722
@ -120,9 +120,15 @@ function GetTemplateDataHelper(template, player)
|
||||
if (template.Auras)
|
||||
{
|
||||
ret.auras = {};
|
||||
for each (var aura in template.Auras)
|
||||
for (let auraID in template.Auras)
|
||||
{
|
||||
let aura = template.Auras[auraID];
|
||||
if (aura.AuraName)
|
||||
ret.auras[aura.AuraName] = aura.AuraDescription || null;
|
||||
ret.auras[auraID] = {
|
||||
"name": aura.AuraName,
|
||||
"description": aura.AuraDescription || null
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (template.BuildRestrictions)
|
||||
|
@ -478,9 +478,9 @@ function getAurasTooltip(template)
|
||||
for (let aura in template.auras)
|
||||
txt += '\n' + sprintf(translate("%(auralabel)s %(aurainfo)s"), {
|
||||
"auralabel": g_TooltipTextFormats.header[0] + sprintf(translate("%(auraname)s:"), {
|
||||
"auraname": translate(aura)
|
||||
"auraname": translate(template.auras[aura].name)
|
||||
}) + g_TooltipTextFormats.header[1],
|
||||
"aurainfo": g_TooltipTextFormats.body[0] + translate(template.auras[aura]) + g_TooltipTextFormats.body[1]
|
||||
"aurainfo": g_TooltipTextFormats.body[0] + translate(template.auras[aura].description) + g_TooltipTextFormats.body[1]
|
||||
});
|
||||
return txt;
|
||||
}
|
||||
|
@ -336,6 +336,7 @@ g_SelectionPanels.Construction = {
|
||||
{
|
||||
var tooltip = getEntityNamesFormatted(data.template);
|
||||
tooltip += getVisibleEntityClassesFormatted(data.template);
|
||||
tooltip += getAurasTooltip(data.template);
|
||||
|
||||
if (data.template.tooltip)
|
||||
tooltip += "\n[font=\"sans-13\"]" + data.template.tooltip + "[/font]";
|
||||
@ -1098,16 +1099,7 @@ g_SelectionPanels.Training = {
|
||||
|
||||
tooltip += getEntityNamesFormatted(data.template);
|
||||
tooltip += getVisibleEntityClassesFormatted(data.template);
|
||||
|
||||
if (data.template.auras)
|
||||
{
|
||||
for (var auraName in data.template.auras)
|
||||
{
|
||||
tooltip += "\n[font=\"sans-bold-13\"]" + translate(auraName) + "[/font]";
|
||||
if (data.template.auras[auraName])
|
||||
tooltip += ": " + translate(data.template.auras[auraName]);
|
||||
}
|
||||
}
|
||||
tooltip += getAurasTooltip(data.template);
|
||||
|
||||
if (data.template.tooltip)
|
||||
tooltip += "\n[font=\"sans-13\"]" + data.template.tooltip + "[/font]";
|
||||
|
@ -7,7 +7,7 @@
|
||||
<Modifications>
|
||||
<Capturable.GarrisonRegenRate> <Add>2</Add> </Capturable.GarrisonRegenRate>
|
||||
</Modifications>
|
||||
<AuraName>Hero Aura</AuraName>
|
||||
<AuraName>Garrisoned Capture Aura</AuraName>
|
||||
<AuraDescription>When garrisoned in a structure, the hero gives it a bonus of +2 capture points recovery rate.</AuraDescription>
|
||||
</AuraA>
|
||||
</Auras>
|
||||
|
Loading…
Reference in New Issue
Block a user