Ticket #3216: t3216_capture_statistics_v11.1.patch

File t3216_capture_statistics_v11.1.patch, 22.4 KB (added by Imarok, 8 years ago)

Ready to commit. But I don' know if I updated the GUIInterface test correctly

  • binaries/data/mods/public/gui/summary/counters.js

     
    1212        g_KilledColor + killed + '[/color]';
    1313}
    1414
     15function formatCaptured(trained, killed, captured, lost)
     16{
     17    return g_TrainedColor + trained + '[/color] / ' +
     18        g_KilledColor + killed + '[/color]\n' +
     19        g_CapturedColor + captured + '[/color] / ' +
     20        g_LostColor + lost + '[/color]\n'
     21}
     22
    1523function formatIncome(income, outcome)
    1624{
    1725    return g_IncomeColor + income + '[/color] / ' +
     
    97105function calculateMilitaryScore(playerState)
    98106{
    99107    return Math.round((playerState.statistics.enemyUnitsKilledValue +
    100         playerState.statistics.enemyBuildingsDestroyedValue) / 10);
     108        playerState.statistics.enemyBuildingsDestroyedValue +
     109        playerState.statistics.buildingsCapturedValue) / 10);
    101110}
    102111
    103112function calculateExplorationScore(playerState)
     
    144153function calculateBuildings(playerState, position)
    145154{
    146155    let type = g_BuildingsTypes[position];
    147 
    148     return formatTrained(
     156    return formatCaptured(
    149157        playerState.statistics.buildingsConstructed[type],
    150         playerState.statistics.buildingsLost[type],
    151         playerState.statistics.enemyBuildingsDestroyed[type]);
     158        playerState.statistics.enemyBuildingsDestroyed[type],
     159        playerState.statistics.buildingsCaptured[type],
     160        playerState.statistics.buildingsLost[type]);
    152161}
    153162
    154 function calculateColorsTeam(counters)
     163function calculateBuildingsTeam(counters)
    155164{
    156165    for (let t in g_Teams)
    157166    {
     
    161170        for (let w in counters)
    162171        {
    163172            let total = {
     173                "constructed" : 0,
     174                "destroyed" : 0,
     175                "captured" : 0,
     176                "lost" : 0
     177            };
     178            for (let p = 0; p < g_Teams[t]; ++p)
     179            {
     180                let caption = Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + p + "][" + w + "]").caption;
     181                // clean [Color=""], [/Color] and white space for make the sum more easy
     182                caption = caption.replace(/\[([\w\' \\\"\/\=]*)\]|[\t\r \f]/g, "");
     183
     184                let splitCaption = caption.split("\n");
     185                let first = splitCaption[0].split("/");
     186                let second = splitCaption[1].split("/");
     187
     188                total.constructed += (+first[0]);
     189                total.destroyed += (+first[1]);
     190                total.captured += (+second[0]);
     191                total.lost += (+second[1]);
     192            }
     193            let teamTotal = formatCaptured(total.constructed,
     194                total.destroyed, total.captured, total.lost);
     195
     196            Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + w + "]").caption = teamTotal;
     197        }
     198    }
     199}
     200
     201function calculateUnitsTeam(counters)
     202{
     203    for (let t in g_Teams)
     204        {
     205        if (t == -1)
     206            continue;
     207
     208        for (let w in counters)
     209        {
     210            let total = {
    164211                "constructed": 0,
    165212                "lost": 0,
    166213                "destroyed": 0
  • binaries/data/mods/public/gui/summary/layout.js

     
    99        ],
    1010        "titleHeadings": [],
    1111        "counters": [
    12             { "width": 100, "fn": calculateEconomyScore },
    13             { "width": 100, "fn": calculateMilitaryScore },
    14             { "width": 100, "fn": calculateExplorationScore },
    15             { "width": 100, "fn": calculateScoreTotal}
     12            { "width": 100, "fn": calculateEconomyScore, "verticalOffset": 12 },
     13            { "width": 100, "fn": calculateMilitaryScore, "verticalOffset": 12 },
     14            { "width": 100, "fn": calculateExplorationScore, "verticalOffset": 12 },
     15            { "width": 100, "fn": calculateScoreTotal, "verticalOffset": 12 }
    1616        ],
    1717        "teamCounterFn": calculateScoreTeam
    1818    },
     
    2929            { "caption": translate("Wonders"), "yStart": 34, "width": 85 }
    3030        ],
    3131        "titleHeadings": [
    32             { "caption": translate("Buildings Statistics (Constructed / Lost / Destroyed)"), "yStart": 16, "width": (85 * 7 + 105) },   // width = 700
     32            {
     33                "caption": sprintf(translate("Buildings Statistics (%(constructed)s / %(destroyed)s / %(captured)s / %(lost)s)"),
     34                            {
     35                                constructed: g_TrainedColor + translate("Constructed") + '[/color]',
     36                                destroyed: g_KilledColor + translate("Destroyed") + '[/color]',
     37                                captured: g_CapturedColor + translate("Captured") + '[/color]',
     38                                lost: g_LostColor + translate("Lost") + '[/color]'
     39                            }),
     40                "yStart": 16,
     41                "width": (85 * 7 + 105)
     42            },  // width = 700
    3343        ],
    3444        "counters": [
    35             { "width": 105, "fn": calculateBuildings },
    36             { "width": 85, "fn": calculateBuildings },
    37             { "width": 85, "fn": calculateBuildings },
    38             { "width": 85, "fn": calculateBuildings },
    39             { "width": 85, "fn": calculateBuildings },
    40             { "width": 85, "fn": calculateBuildings },
    41             { "width": 85, "fn": calculateBuildings },
    42             { "width": 85, "fn": calculateBuildings }
     45            { "width": 105, "fn": calculateBuildings, "verticalOffset": 3 },
     46            { "width": 85, "fn": calculateBuildings, "verticalOffset": 3 },
     47            { "width": 85, "fn": calculateBuildings, "verticalOffset": 3 },
     48            { "width": 85, "fn": calculateBuildings, "verticalOffset": 3 },
     49            { "width": 85, "fn": calculateBuildings, "verticalOffset": 3 },
     50            { "width": 85, "fn": calculateBuildings, "verticalOffset": 3 },
     51            { "width": 85, "fn": calculateBuildings, "verticalOffset": 3 },
     52            { "width": 85, "fn": calculateBuildings, "verticalOffset": 3 }
    4353        ],
    44         "teamCounterFn": calculateColorsTeam
     54        "teamCounterFn": calculateBuildingsTeam
    4555    },
    4656    "units": {
    4757        "headings": [
     
    5666            { "caption": translate("Traders"), "yStart": 34, "width": 100 }
    5767        ],
    5868        "titleHeadings": [
    59             { "caption": translate("Units Statistics (Trained / Lost / Killed)"), "yStart": 16, "width": (100 * 7 + 120) }, // width = 820
     69            {
     70                "caption": sprintf(translate("Units Statistics (%(trained)s / %(lost)s / %(killed)s)"),
     71                            {
     72                                trained: g_TrainedColor + translate("Trained") + '[/color]',
     73                                lost: g_LostColor + translate("Lost") + '[/color]',
     74                                killed: g_KilledColor + translate("Killed") + '[/color]'
     75                            }),
     76                "yStart": 16,
     77                "width": (100 * 7 + 120)
     78            },  // width = 820
    6079        ],
    6180        "counters": [
    62             { "width": 120, "fn": calculateUnits },
    63             { "width": 100, "fn": calculateUnits },
    64             { "width": 100, "fn": calculateUnits },
    65             { "width": 100, "fn": calculateUnits },
    66             { "width": 100, "fn": calculateUnits },
    67             { "width": 100, "fn": calculateUnits },
    68             { "width": 100, "fn": calculateUnits },
    69             { "width": 100, "fn": calculateUnits }
     81            { "width": 120, "fn": calculateUnits, "verticalOffset": 12 },
     82            { "width": 100, "fn": calculateUnits, "verticalOffset": 12 },
     83            { "width": 100, "fn": calculateUnits, "verticalOffset": 12 },
     84            { "width": 100, "fn": calculateUnits, "verticalOffset": 12 },
     85            { "width": 100, "fn": calculateUnits, "verticalOffset": 12 },
     86            { "width": 100, "fn": calculateUnits, "verticalOffset": 12 },
     87            { "width": 100, "fn": calculateUnits, "verticalOffset": 12 },
     88            { "width": 100, "fn": calculateUnits, "verticalOffset": 12 }
    7089        ],
    71         "teamCounterFn": calculateColorsTeam
     90        "teamCounterFn": calculateUnitsTeam
    7291    },
    7392    "resources": {
    7493        "headings": [
     
    7897            { "caption": translate("Stone"), "yStart": 34, "width": 100 },
    7998            { "caption": translate("Metal"), "yStart": 34, "width": 100 },
    8099            { "caption": translate("Total"), "yStart": 34, "width": 110 },
    81             { "caption": translate("Tributes (Sent / Received)"), "yStart": 16, "width": 121 },
     100            {
     101                "caption": sprintf(translate("Tributes \n(%(sent)s / %(received)s)"),
     102                            {
     103                                sent: g_IncomeColor + translate("Sent") + '[/color]',
     104                                received: g_OutcomeColor + translate("Received") + '[/color]'
     105                            }),
     106                "yStart": 16,
     107                "width": 121
     108            },
    82109            { "caption": translate("Treasures collected"), "yStart": 16, "width": 100 },
    83110            { "caption": translate("Loot"), "yStart": 16, "width": 100 }
    84111        ],
    85112        "titleHeadings": [
    86             { "caption": translate("Resource Statistics (Gathered / Used)"), "yStart": 16, "width": (100 * 4 + 110) }, // width = 510
     113            {
     114                "caption": sprintf(translate("Resource Statistics (%(gathered)s / %(used)s)"),
     115                            {
     116                                gathered: g_IncomeColor + translate("Gathered") + '[/color]',
     117                                used: g_OutcomeColor + translate("Used") + '[/color]'
     118                            }),
     119                "yStart": 16,
     120                "width": (100 * 4 + 110)
     121            }, // width = 510
    87122        ],
    88123        "counters": [
    89             { "width": 100, "fn": calculateResources },
    90             { "width": 100, "fn": calculateResources },
    91             { "width": 100, "fn": calculateResources },
    92             { "width": 100, "fn": calculateResources },
    93             { "width": 110, "fn": calculateTotalResources },
    94             { "width": 121, "fn": calculateTributeSent },
    95             { "width": 100, "fn": calculateTreasureCollected },
    96             { "width": 100, "fn": calculateLootCollected }
     124            { "width": 100, "fn": calculateResources, "verticalOffset": 12 },
     125            { "width": 100, "fn": calculateResources, "verticalOffset": 12 },
     126            { "width": 100, "fn": calculateResources, "verticalOffset": 12 },
     127            { "width": 100, "fn": calculateResources, "verticalOffset": 12 },
     128            { "width": 110, "fn": calculateTotalResources, "verticalOffset": 12 },
     129            { "width": 121, "fn": calculateTributeSent, "verticalOffset": 12 },
     130            { "width": 100, "fn": calculateTreasureCollected, "verticalOffset": 12 },
     131            { "width": 100, "fn": calculateLootCollected, "verticalOffset": 12 }
    97132        ],
    98133        "teamCounterFn": calculateResourcesTeam
    99134    },
     
    109144        ],
    110145        "titleHeadings": [],
    111146        "counters": [
    112             { "width": 100, "fn": calculateResourceExchanged },
    113             { "width": 100, "fn": calculateResourceExchanged },
    114             { "width": 100, "fn": calculateResourceExchanged },
    115             { "width": 100, "fn": calculateResourceExchanged },
    116             { "width": 100, "fn": calculateBarterEfficiency },
    117             { "width": 100, "fn": calculateTradeIncome }
     147            { "width": 100, "fn": calculateResourceExchanged, "verticalOffset": 12 },
     148            { "width": 100, "fn": calculateResourceExchanged, "verticalOffset": 12 },
     149            { "width": 100, "fn": calculateResourceExchanged, "verticalOffset": 12 },
     150            { "width": 100, "fn": calculateResourceExchanged, "verticalOffset": 12 },
     151            { "width": 100, "fn": calculateBarterEfficiency, "verticalOffset": 12 },
     152            { "width": 100, "fn": calculateTradeIncome, "verticalOffset": 12 }
    118153        ],
    119154        "teamCounterFn": calculateMarketTeam
    120155    },
     
    132167            { "caption": translate("Map control"), "xOffset": 400, "yStart": 16, "width": 200 }
    133168        ],
    134169        "counters": [
    135             { "width": 100, "fn": calculateVegetarianRatio },
    136             { "width": 100, "fn": calculateFeminization },
    137             { "width": 100, "fn": calculateKillDeathRatio },
    138             { "width": 100, "fn": calculateMapExploration },
    139             { "width": 100, "fn": calculateMapPeakControl },
    140             { "width": 100, "fn": calculateMapFinalControl }
     170            { "width": 100, "fn": calculateVegetarianRatio, "verticalOffset": 12 },
     171            { "width": 100, "fn": calculateFeminization, "verticalOffset": 12 },
     172            { "width": 100, "fn": calculateKillDeathRatio, "verticalOffset": 12 },
     173            { "width": 100, "fn": calculateMapExploration, "verticalOffset": 12 },
     174            { "width": 100, "fn": calculateMapPeakControl, "verticalOffset": 12 },
     175            { "width": 100, "fn": calculateMapFinalControl, "verticalOffset": 12 }
    141176        ],
    142177        "teamCounterFn": calculateMiscellaneous
    143178    }
     
    214249        for (let w in counters)
    215250        {
    216251            counterObject = Engine.GetGUIObjectByName("valueData[" + p + "][" + w + "]");
    217             counterObject.size = left + " 6 " + (left + counters[w].width) + " 100%";
     252            counterObject.size =  left + " " + counters[w].verticalOffset + " " + (left + counters[w].width) + " 100%";
    218253            counterObject.hidden = false;
    219254            left += counters[w].width;
    220255        }
     
    229264            for (let w in counters)
    230265            {
    231266                counterObject = Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + p + "][" + w + "]");
    232                 counterObject.size = left + " 6 " + (left + counters[w].width) + " 100%";
     267                counterObject.size = left + " " + counters[w].verticalOffset + " " + (left + counters[w].width) + " 100%";
    233268                counterObject.hidden = false;
    234269
    235270                if (g_Teams[t])
    236271                {
    237                     let yStart = 30 + g_Teams[t] * (g_PlayerBoxYSize + g_PlayerBoxGap) + 2;
     272                    let yStart = 25 + g_Teams[t] * (g_PlayerBoxYSize + g_PlayerBoxGap) + 3 + counters[w].verticalOffset;
    238273                    counterTotalObject = Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + w + "]");
    239274                    counterTotalObject.size = (left + 20) + " " + yStart + " " + (left + counters[w].width) + " 100%";
    240275                    counterTotalObject.hidden = false;
     
    272307        Engine.GetGUIObjectByName("teamNameHeadingt["+i+"]").caption = "Team "+(i+1);
    273308
    274309        let teamHeading = Engine.GetGUIObjectByName("teamHeadingt["+i+"]");
    275         let yStartTotal = 30 + g_Teams[i] * (g_PlayerBoxYSize + g_PlayerBoxGap) + 2;
    276         teamHeading.size = "50 "+yStartTotal+" 100% "+(yStartTotal+20);
     310        let yStartTotal = 30 + g_Teams[i] * (g_PlayerBoxYSize + g_PlayerBoxGap) + 10;
     311        teamHeading.size = "50 " + yStartTotal + " 100% " + (yStartTotal + 20);
    277312        teamHeading.caption = translate("Team total");
    278313    }
    279314
  • binaries/data/mods/public/gui/summary/summary.js

     
    33// const for filtering long collective headings
    44const g_LongHeadingWidth = 250;
    55
    6 const g_PlayerBoxYSize = 30;
     6const g_PlayerBoxYSize = 40;
    77const g_PlayerBoxGap = 2;
    88const g_PlayerBoxAlpha = " 32";
    99const g_PlayerColorBoxAlpha = " 255";
    10 const g_TeamsBoxYStart = 65;
     10const g_TeamsBoxYStart = 40;
    1111
    1212// Colors used for units and buildings
    1313const g_TrainedColor = '[color="201 255 200"]';
    1414const g_LostColor = '[color="255 213 213"]';
    1515const g_KilledColor = '[color="196 198 255"]';
     16const g_CapturedColor = '[color="255 255 157"]';
    1617
    1718const g_BuildingsTypes = [ "total", "House", "Economic", "Outpost", "Military", "Fortress", "CivCentre", "Wonder" ];
    1819const g_UnitsTypes = [ "total", "Infantry", "Worker", "Cavalry", "Champion", "Hero", "Ship", "Trader" ];
  • binaries/data/mods/public/gui/summary/summary.xml

     
    1414
    1515    <!-- After settings.js, which defines g_Settings and g_MaxPlayers. -->
    1616    <script file="gui/summary/counters.js"/>
     17    <script file="gui/summary/summary.js"/>
    1718    <script file="gui/summary/layout.js"/>
    18     <script file="gui/summary/summary.js"/>
    1919
    2020    <object name="summaryWindow"
    2121        type="image"
     
    123123                    <object size="0 30 100% 100%">
    124124                        <repeat count="8" var="n">
    125125                            <object type="image" name="playerBoxt[i][n]" size="10 0 10 30" hidden="true">
    126                                 <object name="playerColorBoxt[i][n]" type="image" size="10 4 30 24"/>
    127                                 <object name="playerNamet[i][n]" type="text"  size="40 2 208 100%" style="ModernLeftLabelText" />
    128                                 <object name="civIcont[i][n]" type="image" size="208 0 240 32"/>
     126                                <object type="image" sprite="ForegroundBox" size="10 9 34 33">
     127                                    <object name="playerColorBoxt[i][n]" type="image" size="2 2 22 22"/>
     128                                </object>
     129                                <object name="playerNamet[i][n]" type="text"  size="40 2 208 100%" style="ModernLeftLabelText"/>
     130                                <object name="civIcont[i][n]" type="image" size="208 5 240 37" />
    129131                                <repeat var="x" count="8">
    130132                                    <object name="valueDataTeam[i][n][x]" type="text" style="ModernTabLabelText">
    131133                                    </object>
     
    144146            <object type="image" name="noTeamsBox" size="0 65 100% 100%-50" hidden="true">
    145147                <repeat count="8">
    146148                    <object type="image" name="playerBox[n]" size="10 0 10 30" hidden="true">
    147                         <object type="image" sprite="ForegroundBox" size="10 4 34 28">
     149                        <object type="image" sprite="ForegroundBox" size="10 9 34 33">
    148150                            <object name="playerColorBox[n]" type="image" size="2 2 22 22"/>
    149151                        </object>
    150152                        <object name="playerName[n]" type="text"  size="40 2 208 100%" style="ModernLeftLabelText"/>
    151                         <object name="civIcon[n]" type="image" size="208 0 240 32"/>
     153                        <object name="civIcon[n]" type="image" size="208 5 240 37"/>
    152154                        <repeat var="x" count="8">
    153155                            <object name="valueData[n][x]" type="text" style="ModernTabLabelText">
    154156                            </object>
  • binaries/data/mods/public/simulation/components/Capturable.js

     
    151151        if (this.cp[i] >= this.cp[bestPlayer])
    152152            bestPlayer = +i;
    153153
     154    let cmpLostPlayerStatisticsTracker = QueryOwnerInterface(this.entity, IID_StatisticsTracker);
     155    if (cmpLostPlayerStatisticsTracker)
     156        cmpLostPlayerStatisticsTracker.LostEntity(this.entity);
     157
    154158    cmpOwnership.SetOwner(bestPlayer);
     159
     160    let cmpCapturedPlayerStatisticsTracker = QueryOwnerInterface(this.entity, IID_StatisticsTracker);
     161    if (cmpCapturedPlayerStatisticsTracker)
     162        cmpCapturedPlayerStatisticsTracker.CapturedBuilding(this.entity);
    155163};
    156164
    157165Capturable.prototype.GetRegenRate = function()
  • binaries/data/mods/public/simulation/components/StatisticsTracker.js

     
    9393        "total": 0
    9494        };
    9595    this.enemyBuildingsDestroyedValue = 0;
     96    this.buildingsCaptured = {
     97        "House": 0,
     98        "Economic": 0,
     99        "Outpost": 0,
     100        "Military": 0,
     101        "Fortress": 0,
     102        "CivCentre": 0,
     103        "Wonder": 0,
     104        "total": 0
     105    };
     106    this.buildingsCapturedValue = 0;
    96107    // resources
    97108    this.resourcesGathered = {
    98109        "food": 0,
     
    152163        "unitsLostValue": this.unitsLostValue,
    153164        "enemyUnitsKilled": this.enemyUnitsKilled,
    154165        "enemyUnitsKilledValue": this.enemyUnitsKilledValue,
    155         "buildingsConstructed": this.buildingsConstructed,
    156         "buildingsLost": this.buildingsLost,
     166        "buildingsConstructed": this.buildingsConstructed,
     167        "buildingsLost": this.buildingsLost,
    157168        "buildingsLostValue": this.buildingsLostValue,
    158169        "enemyBuildingsDestroyed": this.enemyBuildingsDestroyed,
    159170        "enemyBuildingsDestroyedValue": this.enemyBuildingsDestroyedValue,
     171        "buildingsCaptured": this.buildingsCaptured,
     172        "buildingsCapturedValue": this.buildingsCapturedValue,
    160173        "resourcesGathered": this.resourcesGathered,
    161174        "resourcesUsed": this.resourcesUsed,
    162175        "resourcesSold": this.resourcesSold,
    163         "resourcesBought": this.resourcesBought,
    164         "tributesSent": this.tributesSent,
     176        "resourcesBought": this.resourcesBought,
     177        "tributesSent": this.tributesSent,
    165178        "tributesReceived": this.tributesReceived,
    166179        "tradeIncome": this.tradeIncome,
    167180        "treasuresCollected": this.treasuresCollected,
     
    216229StatisticsTracker.prototype.IncreaseConstructedBuildingsCounter = function(constructedBuilding)
    217230{
    218231    var cmpBuildingEntityIdentity = Engine.QueryInterface(constructedBuilding, IID_Identity);
    219        
     232
    220233    if (!cmpBuildingEntityIdentity)
    221234        return;
    222235
     
    253266            this.CounterIncrement(cmpTargetEntityIdentity, "enemyUnitsKilled", type);
    254267
    255268        this.enemyUnitsKilled.total++;
    256        
     269
    257270        for each (var cost in costs)
    258271            this.enemyUnitsKilledValue += cost;
    259     }   
     272    }
    260273    if (targetIsStructure)
    261274    {
    262275        for each (var type in this.buildingsClasses)
     
    263276            this.CounterIncrement(cmpTargetEntityIdentity, "enemyBuildingsDestroyed", type);
    264277
    265278        this.enemyBuildingsDestroyed.total++;
    266        
     279
    267280        for each (var cost in costs)
    268281            this.enemyBuildingsDestroyedValue += cost;
    269282    }
     
    276289    var costs = cmpCost.GetResourceCosts();
    277290    if (!cmpLostEntityIdentity)
    278291        return;
    279    
     292
    280293    var cmpFoundation = Engine.QueryInterface(lostEntity, IID_Foundation);
    281294    // We want to deal only with real structures, not foundations
    282295    var lostEntityIsStructure = cmpLostEntityIdentity.HasClass("Structure") && cmpFoundation == null;
     
    290303            this.CounterIncrement(cmpLostEntityIdentity, "unitsLost", type);
    291304
    292305        this.unitsLost.total++;
    293        
     306
    294307        for each (var cost in costs)
    295308            this.unitsLostValue += cost;   
    296     }   
     309    }
    297310    if (lostEntityIsStructure)
    298311    {
    299312        for each (var type in this.buildingsClasses)
     
    306319    }
    307320};
    308321
    309 /**
    310  * @param type Generic type of resource (string)
    311  * @param amount Amount of resource, whick should be added (integer)
    312  * @param specificType Specific type of resource (string, optional)
    313  */
     322StatisticsTracker.prototype.CapturedBuilding = function(capturedBuilding)
     323{
     324    let cmpCapturedBuildingIdentity = Engine.QueryInterface(capturedBuilding, IID_Identity);
     325    let cmpCost = Engine.QueryInterface(capturedBuilding, IID_Cost);
     326    if (!cmpCapturedBuildingIdentity || !cmpCost)
     327        return;
     328    let costs = cmpCost.GetResourceCosts();
     329
     330    for (let type of this.buildingsClasses)
     331        this.CounterIncrement(cmpCapturedBuildingIdentity, "buildingsCaptured", type);
     332
     333    this.buildingsCaptured.total++;
     334
     335    for (let i in costs)
     336        this.buildingsCapturedValue += costs[i];
     337};
     338
     339/**
     340 * @param type Generic type of resource (string)
     341 * @param amount Amount of resource, whick should be added (integer)
     342 * @param specificType Specific type of resource (string, optional)
     343 */
    314344StatisticsTracker.prototype.IncreaseResourceGatheredCounter = function(type, amount, specificType)
    315345{
    316346    this.resourcesGathered[type] += amount;
    317    
     347
    318348    if (type == "food" && (specificType == "fruit" || specificType == "grain"))
    319349        this.resourcesGathered.vegetarianFood += amount;
    320350};
  • binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js

     
    126126            "unitsTrained": 10,
    127127            "unitsLost": 9,
    128128            "buildingsConstructed": 5,
     129            "buildingsCaptured": 7,
    129130            "buildingsLost": 4,
    130131            "civCentresBuilt": 1,
    131132            "resourcesGathered": {
     
    208209            "unitsTrained": 10,
    209210            "unitsLost": 9,
    210211            "buildingsConstructed": 5,
     212            "buildingsCaptured": 7,
    211213            "buildingsLost": 4,
    212214            "civCentresBuilt": 1,
    213215            "resourcesGathered": {
     
    362364                unitsTrained: 10,
    363365                unitsLost: 9,
    364366                buildingsConstructed: 5,
     367                buildingsCaptured: 7,
    365368                buildingsLost: 4,
    366369                civCentresBuilt: 1,
    367370                resourcesGathered: {
     
    415418                unitsTrained: 10,
    416419                unitsLost: 9,
    417420                buildingsConstructed: 5,
     421                buildingsCaptured: 7,
    418422                buildingsLost: 4,
    419423                civCentresBuilt: 1,
    420424                resourcesGathered: {