Ticket #4061: 4061.diff

File 4061.diff, 1.6 KB (added by fatherbushido, 8 years ago)
  • binaries/data/mods/public/gui/common/tooltips.js

    function attackRateDetails(entState, typ  
    5757        "time": time,
    5858        "second": g_TooltipTextFormats.unit[0] + translatePlural("second", "seconds", time) + g_TooltipTextFormats.unit[1]
    5959    });
    6060
    6161    // or multiple arrows shot by BuildingAI
    62     if (!entState.buildingAI)
     62    if (!entState.buildingAI || type != "Ranged")
    6363        return timeString;
    6464
    6565    let arrows = entState.buildingAI.arrowCount;
    6666    let arrowString = sprintf(translatePlural("%(arrowcount)s %(arrow)s", "%(arrowcount)s %(arrow)s", arrows), {
    6767        "arrowcount": arrows,
    function getAttackTooltip(template)  
    160160{
    161161    let attacks = [];
    162162    if (!template.attack)
    163163        return "";
    164164
    165     let rateLabel = g_TooltipTextFormats.header[0] + (template.buildingAI ? translate("Interval:") : translate("Rate:")) + g_TooltipTextFormats.header[1];
    166 
    167165    for (let type in template.attack)
    168166    {
    169167        if (type == "Slaughter")
    170168            continue; // Slaughter is not a real attack, so do not show it.
    171169        if (type == "Charge")
    172170            continue; // Charging isn't implemented yet and shouldn't be displayed.
    173171
     172        let rateLabel = g_TooltipTextFormats.header[0]
     173        if (template.buildingAI && type == "Ranged")
     174            rateLabel += translate("Interval:")
     175        else
     176            rateLabel += translate("Rate:")
     177        rateLabel += g_TooltipTextFormats.header[1];
     178
    174179        let rate = sprintf(translate("%(label)s %(details)s"), {
    175180            "label": rateLabel,
    176181            "details": attackRateDetails(template, type)
    177182        });
    178183