Ticket #686: summary_screen_counters.patch

File summary_screen_counters.patch, 51.3 KB (added by Bajter, 10 years ago)

This patch applies changes to layout and adds counters to the summary screen. The changes are further described on the forums here: http://www.wildfiregames.com/forum/index.php?showtopic=17914#entry280413

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

     
    11// Max player slots for any map (should read from config)
    22const MAX_SLOTS = 8;
    33
    4 var panelNames = [ 'scorePanel', 'unitsBuildingsPanel', 'conquestPanel', 'resourcesPanel', 'marketPanel' ];
    5 var panelButtonNames = [ 'scorePanelButton', 'unitsBuildingsPanelButton', 'conquestPanelButton', 'resourcesPanelButton', 'marketPanelButton' ];
     4var panelNames = [ 'scorePanel', 'buildingsPanel', 'unitsPanel', 'conquestPanel', 'resourcesPanel', 'marketPanel', 'miscPanel' ];
     5var panelButtonNames = [ 'scorePanelButton', 'buildingsPanelButton', 'unitsPanelButton', 'conquestPanelButton', 'resourcesPanelButton', 'marketPanelButton', 'miscPanelButton' ];
    66
    77/**
    88 * Select active panel
     
    3636
    3737function init(data)
    3838{
     39    // colours used for units and buildings
     40    const TRAINED_COLOR = '[color="201 255 200"]';
     41    const LOST_COLOR = '[color="255 213 213"]';
     42    const KILLED_COLOR = '[color="196 198 255"]';
     43
     44    // colours used for gathered and traded resources
     45    const SOLD_COLOR = '[color="201 255 200"]';
     46    const BOUGHT_COLOR = '[color="255 213 213"]';
     47   
     48    function captionUnits(type)
     49    {
     50        return TRAINED_COLOR + playerState.statistics.unitsTrained[type] + "[/color] / "
     51            + LOST_COLOR + playerState.statistics.unitsLost[type] + "[/color] / "
     52            + KILLED_COLOR + playerState.statistics.enemyUnitsKilled[type] + "[/color]";
     53    }
     54   
     55    function captionBuildings(type)
     56    {
     57        return TRAINED_COLOR + playerState.statistics.buildingsConstructed[type] + "[/color] / "
     58            + LOST_COLOR + playerState.statistics.buildingsLost[type] + "[/color] / "
     59            + KILLED_COLOR + playerState.statistics.enemyBuildingsDestroyed[type] + "[/color]";
     60    }
     61   
     62    function captionResourcesGathered(type)
     63    {
     64        return SOLD_COLOR + playerState.statistics.resourcesGathered[type] + "[/color] / "
     65            + BOUGHT_COLOR + (playerState.statistics.resourcesUsed[type] - playerState.statistics.resourcesSold[type]) + "[/color]";
     66    }
     67   
     68    function captionResourcesExchanged(type)
     69    {
     70        return SOLD_COLOR + '+' + playerState.statistics.resourcesBought[type] + '[/color] '
     71            + BOUGHT_COLOR + '-' + playerState.statistics.resourcesSold[type] + '[/color]';
     72    }
     73   
    3974    var civData = loadCivData();
    4075    var mapSize = "Scenario";
    4176
     
    86121    var playerNameHeadingWidth = 200;
    87122    // Special cased to make the (Sent / Received) part fit
    88123    var tributesWidth = 121;
     124    // Special cased to make the (total buildings) part fit
     125    var totalBuildingsWidth = 105;
     126    // Special cased to make the (total units) part fit
     127    var totalUnitsWidth = 120;
     128    // Special cased to make the (total gathered resources) part fit
     129    var totalGatheredWidth = 110;
    89130    getGUIObjectByName("playerName0Heading").size = left + " 26 " + (left + playerNameHeadingWidth) + " 100%"; left += playerNameHeadingWidth;
    90131    getGUIObjectByName("economyScoreHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
    91132    getGUIObjectByName("militaryScoreHeading").size = left +  " 16 " + (left + width) + " 100%"; left += width;
     
    93134    getGUIObjectByName("totalScoreHeading").size = left +  " 16 " + (left + width) + " 100%"; left += width;
    94135   
    95136    left = 50;
     137    width = 85;
    96138    getGUIObjectByName("playerName1Heading").size = left + " 26 " + (left + playerNameHeadingWidth) + " 100%"; left += playerNameHeadingWidth;
    97     getGUIObjectByName("unitsTrainedHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
    98     getGUIObjectByName("unitsLostHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
    99     getGUIObjectByName("enemyUnitsKilledHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
    100     getGUIObjectByName("buildingsConstructedHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
    101     getGUIObjectByName("buildingsLostHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
    102     getGUIObjectByName("enemyBuildingsDestroyedHeading").size = left + " 6 " + (left + width) + " 100%"; left += width;
     139    getGUIObjectByName("buildingsHeading").size = left + " 16 " + (left + width * 6 + totalBuildingsWidth) + " 100%";
     140    getGUIObjectByName("totalBuildingsHeading").size = left + " 34 " + (left + totalBuildingsWidth) + " 100%"; left += totalBuildingsWidth;
     141    getGUIObjectByName("houseBuildingsHeading").size = left + " 34 " + (left + width) + " 100%"; left += width;
     142    getGUIObjectByName("economicBuildingsHeading").size = left + " 34 " + (left + width) + " 100%"; left += width;
     143    getGUIObjectByName("outpostBuildingsHeading").size = left + " 34 " + (left + width) + " 100%"; left += width;
     144    getGUIObjectByName("militaryBuildingsHeading").size = left + " 34 " + (left + width) + " 100%"; left += width;
     145    getGUIObjectByName("fortressBuildingsHeading").size = left + " 34 " + (left + width) + " 100%"; left += width;
     146    getGUIObjectByName("specialBuildingsHeading").size = left + " 34 " + (left + width) + " 100%"; left += width;
     147    getGUIObjectByName("wonderBuildingsHeading").size = left + " 34 " + (left + width) + " 100%"; left += width;
     148   
    103149
    104150    left = 50;
     151    width = 100;
    105152    getGUIObjectByName("playerName2Heading").size = left + " 26 " + (left + playerNameHeadingWidth) + " 100%"; left += playerNameHeadingWidth;
     153    getGUIObjectByName("unitsHeading").size = left + " 16 " + (left + width * 6 + totalUnitsWidth) + " 100%";
     154    getGUIObjectByName("totalUnitsHeading").size = left + " 34 " + (left + totalUnitsWidth) + " 100%"; left += totalUnitsWidth;
     155    getGUIObjectByName("infantryUnitsHeading").size = left + " 34 " + (left + width) + " 100%"; left += width;
     156    getGUIObjectByName("workerUnitsHeading").size = left + " 34 " + (left + width) + " 100%"; left += width;
     157    getGUIObjectByName("cavalryUnitsHeading").size = left + " 34 " + (left + width) + " 100%"; left += width;
     158    getGUIObjectByName("championUnitsHeading").size = left + " 34 " + (left + width) + " 100%"; left += width;
     159    getGUIObjectByName("heroesUnitsHeading").size = left + " 34 " + (left + width) + " 100%"; left += width;
     160    getGUIObjectByName("navyUnitsHeading").size = left + " 34 " + (left + width) + " 100%"; left += width;
     161
     162    left = 50;
     163    width = 100;
     164    getGUIObjectByName("playerName3Heading").size = left + " 26 " + (left + playerNameHeadingWidth) + " 100%"; left += playerNameHeadingWidth;
    106165    getGUIObjectByName("civCentresBuiltHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
    107166    getGUIObjectByName("enemyCivCentresDestroyedHeading").size = left +  " 6 " + (left + width) + " 100%"; left += width;
    108     getGUIObjectByName("mapExplorationHeading").size = left +  " 6 " + (left + width) + " 100%"; left += width;
     167    getGUIObjectByName("mapExplorationHeading").size = left +  " 16 " + (left + width) + " 100%"; left += width;
    109168
    110169    left = 50;
    111     getGUIObjectByName("playerName3Heading").size = left + " 26 " + (left + playerNameHeadingWidth) + " 100%"; left += playerNameHeadingWidth;
    112     getGUIObjectByName("resourceHeading").size = left + " 16 " + (left + width * 4) + " 100%";
     170    width = 100;
     171    getGUIObjectByName("playerName4Heading").size = left + " 26 " + (left + playerNameHeadingWidth) + " 100%"; left += playerNameHeadingWidth;
     172    getGUIObjectByName("resourceHeading").size = left + " 16 " + (left + width * 4 + totalGatheredWidth) + " 100%";
    113173    getGUIObjectByName("foodGatheredHeading").size = left + " 34 " + (left + width) + " 100%"; left += width;
    114174    getGUIObjectByName("woodGatheredHeading").size = left + " 34 " + (left + width) + " 100%"; left += width;
    115175    getGUIObjectByName("stoneGatheredHeading").size = left + " 34 " + (left + width) + " 100%"; left += width;
    116176    getGUIObjectByName("metalGatheredHeading").size = left + " 34 " + (left + width) + " 100%"; left += width;
    117     getGUIObjectByName("vegetarianRatioHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
     177    getGUIObjectByName("totalGatheredHeading").size = left + " 34 " + (left + totalGatheredWidth) + " 100%"; left += totalGatheredWidth;
    118178    getGUIObjectByName("treasuresCollectedHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
    119179    getGUIObjectByName("resourcesTributedHeading").size = left + " 16 " + (left + tributesWidth) + " 100%"; left += tributesWidth;
    120180
    121181    left = 50;
    122     getGUIObjectByName("playerName4Heading").size = left + " 26 " + (left + playerNameHeadingWidth) + " 100%"; left += playerNameHeadingWidth;
     182    width = 100;
     183    getGUIObjectByName("playerName5Heading").size = left + " 26 " + (left + playerNameHeadingWidth) + " 100%"; left += playerNameHeadingWidth;
    123184    getGUIObjectByName("exchangedFoodHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
    124185    getGUIObjectByName("exchangedWoodHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
    125186    getGUIObjectByName("exchangedStoneHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
     
    126187    getGUIObjectByName("exchangedMetalHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
    127188    getGUIObjectByName("barterEfficiencyHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
    128189    getGUIObjectByName("tradeIncomeHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
    129 
     190   
     191    left = 50;
     192    width = 100;
     193    getGUIObjectByName("playerName6Heading").size = left + " 26 " + (left + playerNameHeadingWidth) + " 100%"; left += playerNameHeadingWidth;
     194    getGUIObjectByName("vegetarianRatioHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
     195    getGUIObjectByName("feminisationHeading").size = left + " 26 " + (left + width) + " 100%"; left += width;
     196    getGUIObjectByName("killDeathRatioHeading").size = left + " 16 " + (left + width) + " 100%"; left += width;
     197   
     198   
    130199    // Show counters
    131200    for (var i = 0; i < MAX_SLOTS; ++i)
    132201    {
     
    160229            var militaryScore = getGUIObjectByName("militaryScore["+i+"]");
    161230            var explorationScore = getGUIObjectByName("explorationScore["+i+"]");
    162231            var totalScore = getGUIObjectByName("totalScore["+i+"]");
     232           
     233            var totalBuildings = getGUIObjectByName("totalBuildings["+i+"]");
     234            var houseBuildings = getGUIObjectByName("houseBuildings["+i+"]");
     235            var economicBuildings = getGUIObjectByName("economicBuildings["+i+"]");
     236            var outpostBuildings = getGUIObjectByName("outpostBuildings["+i+"]");
     237            var militaryBuildings = getGUIObjectByName("militaryBuildings["+i+"]");
     238            var fortressBuildings = getGUIObjectByName("fortressBuildings["+i+"]");
     239            var specialBuildings = getGUIObjectByName("specialBuildings["+i+"]");
     240            var wonderBuildings = getGUIObjectByName("wonderBuildings["+i+"]");
    163241
    164             var unitsTrained = getGUIObjectByName("unitsTrained["+i+"]");
    165             var unitsLost = getGUIObjectByName("unitsLost["+i+"]");
    166             var enemyUnitsKilled = getGUIObjectByName("enemyUnitsKilled["+i+"]");
    167             var buildingsConstructed = getGUIObjectByName("buildingsConstructed["+i+"]");
    168             var buildingsLost = getGUIObjectByName("buildingsLost["+i+"]");
    169             var enemyBuildingsDestroyed = getGUIObjectByName("enemyBuildingsDestroyed["+i+"]");
     242            var totalUnits = getGUIObjectByName("totalUnits["+i+"]");
     243            var infantryUnits = getGUIObjectByName("infantryUnits["+i+"]");
     244            var workerUnits = getGUIObjectByName("workerUnits["+i+"]");
     245            var cavalryUnits = getGUIObjectByName("cavalryUnits["+i+"]");
     246            var championUnits = getGUIObjectByName("championUnits["+i+"]");
     247            var heroesUnits = getGUIObjectByName("heroesUnits["+i+"]");
     248            var navyUnits = getGUIObjectByName("navyUnits["+i+"]");
    170249
    171250            var civCentresBuilt = getGUIObjectByName("civCentresBuilt["+i+"]");
    172251            var enemyCivCentresDestroyed = getGUIObjectByName("enemyCivCentresDestroyed["+i+"]");
     
    176255            var woodGathered = getGUIObjectByName("woodGathered["+i+"]");
    177256            var stoneGathered = getGUIObjectByName("stoneGathered["+i+"]");
    178257            var metalGathered = getGUIObjectByName("metalGathered["+i+"]");
    179             var vegetarianRatio = getGUIObjectByName("vegetarianRatio["+i+"]");
     258            var totalGathered = getGUIObjectByName("totalGathered["+i+"]");
    180259            var treasuresCollected = getGUIObjectByName("treasuresCollected["+i+"]");
    181260            var resourcesTributed = getGUIObjectByName("resourcesTributed["+i+"]");
    182261
     
    186265            var exchangedMetal = getGUIObjectByName("exchangedMetal["+i+"]");
    187266            var barterEfficiency = getGUIObjectByName("barterEfficiency["+i+"]");
    188267            var tradeIncome = getGUIObjectByName("tradeIncome["+i+"]");
     268           
     269            var vegetarianRatio = getGUIObjectByName("vegetarianRatio["+i+"]");
     270            var feminisationRatio = getGUIObjectByName("feminisation["+i+"]");
     271            var killDeathRatio = getGUIObjectByName("killDeathRatio["+i+"]");
    189272
    190273            // align counters
    191274
     
    200283            getGUIObjectByName("playerBox0["+i+"]").size = size;
    201284           
    202285            left = 240;
    203             unitsTrained.size = left + " 2 " + (left + width) + " 100%"; left += width;
    204             unitsLost.size = left + " 2 " + (left + width) + " 100%"; left += width;
    205             enemyUnitsKilled.size = left + " 2 " + (left + width) + " 100%"; left += width;
    206             buildingsConstructed.size = left + " 2 " + (left + width) + " 100%"; left += width;
    207             buildingsLost.size = left + " 2 " + (left + width) + " 100%"; left += width;
    208             enemyBuildingsDestroyed.size = left + " 2 " + (left + width) + " 100%"; left += width;
     286            width = 85;
     287            totalBuildings.size = left + " 2 " + (left + width + 20) + " 100%"; left += width + 20;
     288            houseBuildings.size = left + " 2 " + (left + width) + " 100%"; left += width;
     289            economicBuildings.size = left + " 2 " + (left + width) + " 100%"; left += width;
     290            outpostBuildings.size = left + " 2 " + (left + width) + " 100%"; left += width;
     291            militaryBuildings.size = left + " 2 " + (left + width) + " 100%"; left += width;
     292            fortressBuildings.size = left + " 2 " + (left + width) + " 100%"; left += width;
     293            specialBuildings.size = left + " 2 " + (left + width) + " 100%"; left += width;
     294            wonderBuildings.size = left + " 2 " + (left + width) + " 100%"; left += width;
    209295            size = getGUIObjectByName("playerBox1["+i+"]").size;
    210296            size.right = left + 10;
    211297            getGUIObjectByName("playerBox1["+i+"]").size = size;
     298           
     299            left = 240;
     300            width = 100;
     301            totalUnits.size = left + " 2 " + (left + width + 20) + " 100%"; left += width + 20;
     302            infantryUnits.size = left + " 2 " + (left + width) + " 100%"; left += width;
     303            workerUnits.size = left + " 2 " + (left + width) + " 100%"; left += width;
     304            cavalryUnits.size = left + " 2 " + (left + width) + " 100%"; left += width;
     305            championUnits.size = left + " 2 " + (left + width) + " 100%"; left += width;
     306            heroesUnits.size = left + " 2 " + (left + width) + " 100%"; left += width;
     307            navyUnits.size = left + " 2 " + (left + width) + " 100%"; left += width;
     308            size = getGUIObjectByName("playerBox2["+i+"]").size;
     309            size.right = left + 10;
     310            getGUIObjectByName("playerBox2["+i+"]").size = size;
    212311
    213312            left = 240;
     313            width = 100;
    214314            civCentresBuilt.size = left + " 2 " + (left + width) + " 100%"; left += width;
    215315            enemyCivCentresDestroyed.size = left + " 2 " + (left + width) + " 100%"; left += width;
    216316            mapExploration.size = left + " 2 " + (left + width) + " 100%"; left += width;
    217             size = getGUIObjectByName("playerBox2["+i+"]").size;
     317            size = getGUIObjectByName("playerBox3["+i+"]").size;
    218318            size.right = left + 10;
    219             getGUIObjectByName("playerBox2["+i+"]").size = size;
     319            getGUIObjectByName("playerBox3["+i+"]").size = size;
    220320
    221321            left = 240;
     322            width = 100;
    222323            foodGathered.size = left + " 2 " + (left + width) + " 100%"; left += width;
    223324            woodGathered.size = left + " 2 " + (left + width) + " 100%"; left += width;
    224325            stoneGathered.size = left + " 2 " + (left + width) + " 100%"; left += width;
    225326            metalGathered.size = left + " 2 " + (left + width) + " 100%"; left += width;
    226             vegetarianRatio.size = left + " 2 " + (left + width) + " 100%"; left += width;
     327            totalGathered.size = left + " 2 " + (left + width + 10) + " 100%"; left += width + 10;
    227328            treasuresCollected.size = left + " 2 " + (left + width) + " 100%"; left += width;
    228329            resourcesTributed.size = left + " 2 " + (left + tributesWidth) + " 100%"; left += tributesWidth;
    229             size = getGUIObjectByName("playerBox3["+i+"]").size;
     330            size = getGUIObjectByName("playerBox4["+i+"]").size;
    230331            size.right = left + 10;
    231             getGUIObjectByName("playerBox3["+i+"]").size = size;
     332            getGUIObjectByName("playerBox4["+i+"]").size = size;
    232333
    233334            left = 240;
     335            width = 100;
    234336            exchangedFood.size = left + " 2 " + (left + width) + " 100%"; left += width;
    235337            exchangedWood.size = left + " 2 " + (left + width) + " 100%"; left += width;
    236338            exchangedStone.size = left + " 2 " + (left + width) + " 100%"; left += width;
     
    237339            exchangedMetal.size = left + " 2 " + (left + width) + " 100%"; left += width;
    238340            barterEfficiency.size = left + " 2 " + (left + width) + " 100%"; left += width;
    239341            tradeIncome.size = left + " 2 " + (left + width) + " 100%"; left += width;
    240             size = getGUIObjectByName("playerBox4["+i+"]").size;
     342            size = getGUIObjectByName("playerBox5["+i+"]").size;
    241343            size.right = left + 10;
    242             getGUIObjectByName("playerBox4["+i+"]").size = size;
     344            getGUIObjectByName("playerBox5["+i+"]").size = size;
     345           
     346            left = 240;
     347            width = 100;
     348            size = getGUIObjectByName("playerBox6["+i+"]").size;
     349            vegetarianRatio.size = left + " 2 " + (left + width) + " 100%"; left += width;
     350            feminisationRatio.size = left + " 2 " + (left + width) + " 100%"; left += width;
     351            killDeathRatio.size = left + " 2 " + (left + width) + " 100%"; left += width;
     352            size.right = left + 10;
     353            getGUIObjectByName("playerBox6["+i+"]").size = size;
    243354
    244355            // display counters
    245             economyScore.caption = Math.round((playerState.statistics.resourcesGathered.food + playerState.statistics.resourcesGathered.wood +
    246                 playerState.statistics.resourcesGathered.stone + playerState.statistics.resourcesGathered.metal) / 10);
     356            economyScore.caption = Math.round(playerState.statistics.resourcesGathered.total / 10);
    247357            militaryScore.caption = Math.round((playerState.statistics.enemyUnitsKilledValue + playerState.statistics.enemyBuildingsDestroyedValue) / 10);
    248358            explorationScore.caption = playerState.statistics.percentMapExplored * 10;
    249359            totalScore.caption = Number(economyScore.caption) + Number(militaryScore.caption) + Number(explorationScore.caption);
    250            
    251             unitsTrained.caption = playerState.statistics.unitsTrained;
    252             unitsLost.caption = playerState.statistics.unitsLost;
    253             enemyUnitsKilled.caption = playerState.statistics.enemyUnitsKilled;
    254             buildingsConstructed.caption = playerState.statistics.buildingsConstructed;
    255             buildingsLost.caption = playerState.statistics.buildingsLost;
    256             enemyBuildingsDestroyed.caption = playerState.statistics.enemyBuildingsDestroyed;
    257360
     361            totalBuildings.caption = captionBuildings("total");
     362            houseBuildings.caption = captionBuildings("House");
     363            economicBuildings.caption = captionBuildings("Economic");
     364            outpostBuildings.caption = captionBuildings("Outpost");
     365            militaryBuildings.caption = captionBuildings("Military");
     366            fortressBuildings.caption = captionBuildings("Fortress");
     367            specialBuildings.caption = captionBuildings("SpecialBuilding");
     368            wonderBuildings.caption = captionBuildings("Wonder");
     369
     370            totalUnits.caption = captionUnits("total");
     371            infantryUnits.caption = captionUnits("Infantry");
     372            workerUnits.caption = captionUnits("Worker");
     373            cavalryUnits.caption = captionUnits("Cavalry");
     374            championUnits.caption = captionUnits("Champion");
     375            heroesUnits.caption = captionUnits("Hero");
     376            navyUnits.caption = captionUnits("Ship");
     377
    258378            civCentresBuilt.caption = playerState.statistics.civCentresBuilt;
    259379            enemyCivCentresDestroyed.caption = playerState.statistics.enemyCivCentresDestroyed;
    260380            mapExploration.caption = playerState.statistics.percentMapExplored + "%";
    261381
    262             const SOLD_COLOR = '[color="201 255 200"]';
    263             const BOUGHT_COLOR = '[color="255 213 213"]';
    264             foodGathered.caption = SOLD_COLOR + playerState.statistics.resourcesGathered.food + "[/color] / " +
    265                 BOUGHT_COLOR + (playerState.statistics.resourcesUsed.food - playerState.statistics.resourcesSold.food) + "[/color]";
    266             woodGathered.caption = SOLD_COLOR + playerState.statistics.resourcesGathered.wood + "[/color] / " +
    267                 BOUGHT_COLOR + (playerState.statistics.resourcesUsed.wood - playerState.statistics.resourcesSold.wood) + "[/color]";
    268             stoneGathered.caption = SOLD_COLOR + playerState.statistics.resourcesGathered.stone + "[/color] / " +
    269                 BOUGHT_COLOR + (playerState.statistics.resourcesUsed.stone - playerState.statistics.resourcesSold.stone) + "[/color]";
    270             metalGathered.caption = SOLD_COLOR + playerState.statistics.resourcesGathered.metal + "[/color] / " +
    271                 BOUGHT_COLOR + (playerState.statistics.resourcesUsed.metal - playerState.statistics.resourcesSold.metal) + "[/color]";
    272             vegetarianRatio.caption = Math.floor(playerState.statistics.resourcesGathered.food > 0 ?
    273                 (playerState.statistics.resourcesGathered.vegetarianFood / playerState.statistics.resourcesGathered.food) * 100 : 0) + "%";
     382            foodGathered.caption = captionResourcesGathered("food");
     383            woodGathered.caption = captionResourcesGathered("wood");
     384            stoneGathered.caption = captionResourcesGathered("stone");
     385            metalGathered.caption = captionResourcesGathered("metal");
     386            totalGathered.caption = captionResourcesGathered("total");
    274387            treasuresCollected.caption = playerState.statistics.treasuresCollected;
    275388            resourcesTributed.caption = SOLD_COLOR + playerState.statistics.tributesSent + "[/color] / " +
    276389                BOUGHT_COLOR + playerState.statistics.tributesReceived + "[/color]";
    277390
    278             exchangedFood.caption = SOLD_COLOR + '+' + playerState.statistics.resourcesBought.food
    279                 + '[/color] ' + BOUGHT_COLOR + '-' + playerState.statistics.resourcesSold.food + '[/color]';
    280             exchangedWood.caption = SOLD_COLOR + '+' + playerState.statistics.resourcesBought.wood
    281                 + '[/color] ' + BOUGHT_COLOR + '-' + playerState.statistics.resourcesSold.wood + '[/color]';
    282             exchangedStone.caption = SOLD_COLOR + '+' + playerState.statistics.resourcesBought.stone
    283                 + '[/color] ' + BOUGHT_COLOR + '-' + playerState.statistics.resourcesSold.stone + '[/color]';
    284             exchangedMetal.caption = SOLD_COLOR + '+' + playerState.statistics.resourcesBought.metal
    285                 + '[/color] ' + BOUGHT_COLOR + '-' + playerState.statistics.resourcesSold.metal + '[/color]';
     391            exchangedFood.caption = captionResourcesExchanged("food");
     392            exchangedWood.caption = captionResourcesExchanged("wood");
     393            exchangedStone.caption = captionResourcesExchanged("stone");
     394            exchangedMetal.caption = captionResourcesExchanged("metal");
    286395            var totalBought = 0;
    287396            for each (var boughtAmount in playerState.statistics.resourcesBought)
    288397                totalBought += boughtAmount;
     
    291400                totalSold += soldAmount;
    292401            barterEfficiency.caption = Math.floor(totalSold > 0 ? (totalBought / totalSold) * 100 : 0) + "%";
    293402            tradeIncome.caption = playerState.statistics.tradeIncome;
     403                       
     404            vegetarianRatio.caption = Math.floor(playerState.statistics.resourcesGathered.food > 0 ?
     405                (playerState.statistics.resourcesGathered.vegetarianFood / playerState.statistics.resourcesGathered.food) * 100 : 0) + "%";
     406            feminisationRatio.caption = playerState.statistics.feminisation + "%";
     407            killDeathRatio.caption = Math.round((playerState.statistics.enemyUnitsKilled.total > 0 ?
     408                (playerState.statistics.enemyUnitsKilled.total / playerState.statistics.unitsLost.total) : 0)*100)/100;
    294409        }
    295410        else
    296411        {
  • binaries/data/mods/public/gui/summary/summary.xml

     
    5757        <object name="tabDividerLeft" type="image" sprite="TabSpacer" size="172 120 174 122"/>
    5858        <object name="tabDividerRight" type="image" sprite="TabSpacer" size="328 120 330 122"/>
    5959
    60         <object name="scorePanelButton" type="button" sprite="ForegroundTab" size="20 95 170 120">
     60        <object name="scorePanelButton" type="button" sprite="ForegroundTab" size="20 82 136 120">
    6161            <action on="Press">selectPanel(0);</action>
    6262            <object type="text" style="TitleText" ghost="true">Score</object>
    6363        </object>
    6464       
    65         <object name="unitsBuildingsPanelButton" type="button" sprite="BackgroundTab" size="176 95 326 120">
     65        <object name="buildingsPanelButton" type="button" sprite="BackgroundTab" size="142 82 260 120">
    6666            <action on="Press">selectPanel(1);</action>
    67             <object type="text" style="TitleText" ghost="true">Units/buildings</object>
     67            <object type="text" style="TitleText" ghost="true">Buildings</object>
    6868        </object>
    6969
    70         <object name="conquestPanelButton" type="button" sprite="BackgroundTab" size="332 95 480 120">
     70        <object name="unitsPanelButton" type="button" sprite="BackgroundTab" size="266 82 384 120">
    7171            <action on="Press">selectPanel(2);</action>
     72            <object type="text" style="TitleText" ghost="true">Units</object>
     73        </object>
     74
     75        <object name="conquestPanelButton" type="button" sprite="BackgroundTab" size="390 82 508 120">
     76            <action on="Press">selectPanel(3);</action>
    7277            <object type="text" style="TitleText" ghost="true">Conquest</object>
    7378        </object>
    7479
    75         <object name="resourcesPanelButton" type="button" sprite="BackgroundTab" size="486 95 636 120">
    76             <action on="Press">selectPanel(3);</action>
     80        <object name="resourcesPanelButton" type="button" sprite="BackgroundTab" size="514 82 632 120">
     81            <action on="Press">selectPanel(4);</action>
    7782            <object type="text" style="TitleText" ghost="true">Resources</object>
    7883        </object>
    7984
    80         <object name="marketPanelButton" type="button" sprite="BackgroundTab" size="642 95 792 120">
    81             <action on="Press">selectPanel(4);</action>
     85        <object name="marketPanelButton" type="button" sprite="BackgroundTab" size="638 82 756 120">
     86            <action on="Press">selectPanel(5);</action>
    8287            <object type="text" style="TitleText" ghost="true">Market</object>
    8388        </object>
    84 
     89       
     90        <object name="miscPanelButton" type="button" sprite="BackgroundTab" size="762 82 880 120">
     91            <action on="Press">selectPanel(6);</action>
     92            <object type="text" style="TitleText" ghost="true">Miscellaneous</object>
     93        </object>
     94       
    8595        <object name="scorePanel" type="image" sprite="ForegroundBody" size="20 120 100%-20 100%-58">
    8696
    8797            <object size="0 0 100% 100%-50">
     
    117127            </object>
    118128
    119129        </object>
    120         <object name="unitsBuildingsPanel" type="image" sprite="ForegroundBody" size="20 120 100%-20 100%-58" hidden="true">
     130        <object name="buildingsPanel" type="image" sprite="ForegroundBody" size="20 120 100%-20 100%-58" hidden="true">
    121131
    122132            <object size="0 0 100% 100%-50">
    123133                <object name="playerName1Heading" type="text" style="LeftTabLabelText">
    124134                    Player name
    125135                </object>
    126                 <object name="unitsTrainedHeading" type="text" style="CenteredTabLabelText">
    127                     Units&#10;trained
     136                <object name="buildingsHeading" type="text" style="CenteredTabLabelText">
     137                    Buildings Statistics (Constructed / Lost / Destroyed)
    128138                </object>
    129                 <object name="unitsLostHeading" type="text" style="CenteredTabLabelText">
    130                     Units&#10;lost
     139                <object name="totalBuildingsHeading" type="text" style="CenteredTabLabelText">
     140                    Total
    131141                </object>
    132                 <object name="enemyUnitsKilledHeading" type="text" style="CenteredTabLabelText">
    133                     Enemy units&#10;killed
     142                <object name="houseBuildingsHeading" type="text" style="CenteredTabLabelText">
     143                    Houses
    134144                </object>
    135                 <object name="buildingsConstructedHeading" type="text" style="CenteredTabLabelText">
    136                     Buildings&#10;constructed
     145                <object name="economicBuildingsHeading" type="text" style="CenteredTabLabelText">
     146                    Economic
    137147                </object>
    138                 <object name="buildingsLostHeading" type="text" style="CenteredTabLabelText">
    139                     Buildings&#10;lost
     148                <object name="outpostBuildingsHeading" type="text" style="CenteredTabLabelText">
     149                    Outposts
    140150                </object>
    141                 <object name="enemyBuildingsDestroyedHeading" type="text" style="CenteredTabLabelText">
    142                     Enemy&#10;buildings&#10;destroyed
     151                <object name="militaryBuildingsHeading" type="text" style="CenteredTabLabelText">
     152                    Military
    143153                </object>
     154                <object name="fortressBuildingsHeading" type="text" style="CenteredTabLabelText">
     155                    Fortresses
     156                </object>
     157                <object name="specialBuildingsHeading" type="text" style="CenteredTabLabelText">
     158                    Special
     159                </object>
     160                <object name="wonderBuildingsHeading" type="text" style="CenteredTabLabelText">
     161                    Wonders
     162                </object>
     163
    144164            </object>
    145165
    146166            <object size="0 65 100% 100%-50">
    147167                <repeat count="8">
    148168                    <object type="image" name="playerBox1[n]" size="10 0 10 30" hidden="true">
    149                         <object name="playerColourBox1[n]"          type="image" size="10 4 30 24" />
    150                         <object name="playerName1[n]"               type="text" style="LeftLabelText" size="40 2 208 100%" />
    151                         <object name="civIcon1[n]"                  type="image" size="208 0 240 32" tooltip_style="sessionToolTip"/>
    152                         <object name="unitsTrained[n]"              type="text" style="CenteredLabelText"/>
    153                         <object name="unitsLost[n]"                 type="text" style="CenteredLabelText"/>
    154                         <object name="enemyUnitsKilled[n]"          type="text" style="CenteredLabelText"/>
    155                         <object name="buildingsConstructed[n]"      type="text" style="CenteredLabelText"/>
    156                         <object name="buildingsLost[n]"             type="text" style="CenteredLabelText"/>
    157                         <object name="enemyBuildingsDestroyed[n]"       type="text" style="CenteredLabelText"/>
     169                        <object name="playerColourBox1[n]"      type="image" size="10 4 30 24" />
     170                        <object name="playerName1[n]"           type="text"  style="LeftLabelText" size="40 2 208 100%" />
     171                        <object name="civIcon1[n]"              type="image" size="208 0 240 32" tooltip_style="sessionToolTip"/>
     172                        <object name="totalBuildings[n]"        type="text" style="CenteredLabelText"/>
     173                        <object name="houseBuildings[n]"            type="text" style="CenteredLabelText"/>
     174                        <object name="economicBuildings[n]"         type="text" style="CenteredLabelText"/>
     175                        <object name="outpostBuildings[n]"          type="text" style="CenteredLabelText"/>
     176                        <object name="militaryBuildings[n]"         type="text" style="CenteredLabelText"/>
     177                        <object name="fortressBuildings[n]"         type="text" style="CenteredLabelText"/>
     178                        <object name="specialBuildings[n]"          type="text" style="CenteredLabelText"/>
     179                        <object name="wonderBuildings[n]"           type="text" style="CenteredLabelText"/>
    158180                    </object>
    159181                </repeat>
    160182            </object>
    161183
    162184        </object>
    163         <object name="conquestPanel" type="image" sprite="ForegroundBody" size="20 120 100%-20 100%-58" hidden="true">
     185       
     186        <object name="unitsPanel" type="image" sprite="ForegroundBody" size="20 120 100%-20 100%-58" hidden="true">
    164187
    165188            <object size="0 0 100% 100%-50">
    166189                <object name="playerName2Heading" type="text" style="LeftTabLabelText">
    167190                    Player name
    168191                </object>
     192                <object name="unitsHeading" type="text" style="CenteredTabLabelText">
     193                    Units Statistics (Trained / Lost / Killed)
     194                </object>
     195                <object name="totalUnitsHeading" type="text" style="CenteredTabLabelText">
     196                    Total
     197                </object>
     198                <object name="infantryUnitsHeading" type="text" style="CenteredTabLabelText">
     199                    Infantry
     200                </object>
     201                <object name="workerUnitsHeading" type="text" style="CenteredTabLabelText">
     202                    Worker
     203                </object>
     204                <object name="cavalryUnitsHeading" type="text" style="CenteredTabLabelText">
     205                    Cavalry
     206                </object>
     207                <object name="championUnitsHeading" type="text" style="CenteredTabLabelText">
     208                    Champion
     209                </object>
     210                <object name="heroesUnitsHeading" type="text" style="CenteredTabLabelText">
     211                    Heroes
     212                </object>
     213                <object name="navyUnitsHeading" type="text" style="CenteredTabLabelText">
     214                    Navy
     215                </object>
     216            </object>
     217
     218            <object size="0 65 100% 100%-50">
     219                <repeat count="8">
     220                    <object type="image" name="playerBox2[n]" size="10 0 10 30" hidden="true">
     221                        <object name="playerColourBox2[n]"      type="image" size="10 4 30 24" />
     222                        <object name="playerName2[n]"           type="text"  style="LeftLabelText" size="40 2 208 100%" />
     223                        <object name="civIcon2[n]"              type="image" size="208 0 240 32" tooltip_style="sessionToolTip"/>
     224                        <object name="totalUnits[n]"            type="text" style="CenteredLabelText"/>
     225                        <object name="infantryUnits[n]"         type="text" style="CenteredLabelText"/>
     226                        <object name="workerUnits[n]"           type="text" style="CenteredLabelText"/>
     227                        <object name="cavalryUnits[n]"          type="text" style="CenteredLabelText"/>
     228                        <object name="championUnits[n]"         type="text" style="CenteredLabelText"/>
     229                        <object name="heroesUnits[n]"           type="text" style="CenteredLabelText"/>
     230                        <object name="navyUnits[n]"             type="text" style="CenteredLabelText"/>
     231                    </object>
     232                </repeat>
     233            </object>
     234
     235        </object>
     236        <object name="conquestPanel" type="image" sprite="ForegroundBody" size="20 120 100%-20 100%-58" hidden="true">
     237
     238            <object size="0 0 100% 100%-50">
     239                <object name="playerName3Heading" type="text" style="LeftTabLabelText">
     240                    Player name
     241                </object>
    169242                <object name="civCentresBuiltHeading" type="text" style="CenteredTabLabelText">
    170243                    Civ centres&#10;built
    171244                </object>
     
    179252
    180253            <object size="0 65 100% 100%-50">
    181254                <repeat count="8">
    182                     <object type="image" name="playerBox2[n]" size="10 0 10 30" hidden="true">
    183                         <object name="playerColourBox2[n]"          type="image" size="10 4 30 24" />
    184                         <object name="playerName2[n]"               type="text"  style="LeftLabelText" size="40 2 208 100%" />
    185                         <object name="civIcon2[n]"                  type="image" size="208 0 240 32" tooltip_style="sessionToolTip"/>
     255                    <object type="image" name="playerBox3[n]" size="10 0 10 30" hidden="true">
     256                        <object name="playerColourBox3[n]"          type="image" size="10 4 30 24" />
     257                        <object name="playerName3[n]"               type="text"  style="LeftLabelText" size="40 2 208 100%" />
     258                        <object name="civIcon3[n]"                  type="image" size="208 0 240 32" tooltip_style="sessionToolTip"/>
    186259                        <object name="civCentresBuilt[n]"           type="text" style="CenteredLabelText"/>
    187260                        <object name="enemyCivCentresDestroyed[n]"  type="text" style="CenteredLabelText"/>
    188261                        <object name="mapExploration[n]"        type="text" style="CenteredLabelText"/>
     
    194267        <object name="resourcesPanel" type="image" sprite="ForegroundBody" size="20 120 100%-20 100%-58" hidden="true">
    195268
    196269            <object size="0 0 100% 100%-50">
    197                 <object name="playerName3Heading" type="text" style="LeftTabLabelText">
     270                <object name="playerName4Heading" type="text" style="LeftTabLabelText">
    198271                    Player name
    199272                </object>
    200273                <object name="resourceHeading" type="text" style="CenteredTabLabelText">
     
    212285                <object name="metalGatheredHeading" type="text" style="CenteredTabLabelText">
    213286                    Metal
    214287                </object>
    215                 <object name="vegetarianRatioHeading" type="text" style="CenteredTabLabelText">
    216                     Vegetarian&#10;ratio
     288                <object name="totalGatheredHeading" type="text" style="CenteredTabLabelText">
     289                    Total
    217290                </object>
    218291                <object name="treasuresCollectedHeading" type="text" style="CenteredTabLabelText">
    219292                    Treasures&#10;collected
     
    225298
    226299            <object size="0 65 100% 100%-50">
    227300                <repeat count="8">
    228                     <object type="image" name="playerBox3[n]" size="10 0 10 30" hidden="true">
    229                         <object name="playerColourBox3[n]"      type="image" size="10 4 30 24" />
    230                         <object name="playerName3[n]"           type="text"  style="LeftLabelText" size="40 2 208 100%" />
    231                         <object name="civIcon3[n]"              type="image" size="208 0 240 32" tooltip_style="sessionToolTip"/>
     301                    <object type="image" name="playerBox4[n]" size="10 0 10 30" hidden="true">
     302                        <object name="playerColourBox4[n]"      type="image" size="10 4 30 24" />
     303                        <object name="playerName4[n]"           type="text"  style="LeftLabelText" size="40 2 208 100%" />
     304                        <object name="civIcon4[n]"              type="image" size="208 0 240 32" tooltip_style="sessionToolTip"/>
    232305                        <object name="foodGathered[n]"          type="text" style="CenteredLabelText"/>
    233306                        <object name="woodGathered[n]"          type="text" style="CenteredLabelText"/>
    234307                        <object name="stoneGathered[n]"         type="text" style="CenteredLabelText" />
    235308                        <object name="metalGathered[n]"         type="text" style="CenteredLabelText"/>
    236                         <object name="vegetarianRatio[n]"       type="text" style="CenteredLabelText"/>
     309                        <object name="totalGathered[n]"         type="text" style="CenteredLabelText"/>
    237310                        <object name="treasuresCollected[n]"        type="text" style="CenteredLabelText"/>
    238311                        <object name="resourcesTributed[n]"     type="text" style="CenteredLabelText"/>
    239312                    </object>
     
    244317        <object name="marketPanel" type="image" sprite="ForegroundBody" size="20 120 100%-20 100%-58" hidden="true">
    245318
    246319            <object size="0 0 100% 100%-50">
    247                 <object name="playerName4Heading" type="text" style="LeftTabLabelText">
     320                <object name="playerName5Heading" type="text" style="LeftTabLabelText">
    248321                    Player name
    249322                </object>
    250323                <object name="exchangedFoodHeading" type="text" style="CenteredTabLabelText">
     
    269342
    270343            <object size="0 65 100% 100%-50">
    271344                <repeat count="8">
    272                     <object type="image" name="playerBox4[n]" size="10 0 10 30" hidden="true">
    273                         <object name="playerColourBox4[n]"      type="image" size="10 4 30 24" />
    274                         <object name="playerName4[n]"           type="text"  style="LeftLabelText" size="40 2 208 100%" />
    275                         <object name="civIcon4[n]"              type="image" size="208 0 240 32" tooltip_style="sessionToolTip"/>
     345                    <object type="image" name="playerBox5[n]" size="10 0 10 30" hidden="true">
     346                        <object name="playerColourBox5[n]"      type="image" size="10 4 30 24" />
     347                        <object name="playerName5[n]"           type="text"  style="LeftLabelText" size="40 2 208 100%" />
     348                        <object name="civIcon5[n]"              type="image" size="208 0 240 32" tooltip_style="sessionToolTip"/>
    276349                        <object name="exchangedFood[n]"         type="text" style="CenteredLabelText"/>
    277350                        <object name="exchangedWood[n]"         type="text" style="CenteredLabelText"/>
    278351                        <object name="exchangedStone[n]"         type="text" style="CenteredLabelText"/>
     
    285358
    286359        </object>
    287360
     361        <object name="miscPanel" type="image" sprite="ForegroundBody" size="20 120 100%-20 100%-58" hidden="true">
     362
     363            <object size="0 0 100% 100%-50">
     364                <object name="playerName6Heading" type="text" style="LeftTabLabelText">
     365                    Player name
     366                </object>
     367                <object name="vegetarianRatioHeading" type="text" style="CenteredTabLabelText">
     368                    Vegetarian&#10;ratio
     369                </object>
     370                <object name="feminisationHeading" type="text" style="CenteredTabLabelText">
     371                    Feminisation
     372                </object>
     373                <object name="killDeathRatioHeading" type="text" style="CenteredTabLabelText">
     374                    Kill / Death&#10;ratio
     375                </object>
     376            </object>
     377
     378            <object size="0 65 100% 100%-50">
     379                <repeat count="8">
     380                    <object type="image" name="playerBox6[n]" size="10 0 10 30" hidden="true">
     381                        <object name="playerColourBox6[n]"      type="image" size="10 4 30 24" />
     382                        <object name="playerName6[n]"           type="text"  style="LeftLabelText" size="40 2 208 100%" />
     383                        <object name="civIcon6[n]"              type="image" size="208 0 240 32" tooltip_style="sessionToolTip"/>
     384                        <object name="vegetarianRatio[n]"   type="text" style="CenteredLabelText"/>
     385                        <object name="feminisation[n]"      type="text" style="CenteredLabelText"/>
     386                        <object name="killDeathRatio[n]"    type="text" style="CenteredLabelText"/>
     387                    </object>   
     388                </repeat>
     389            </object>
     390
     391        </object>
     392       
    288393        <object type="button" style="StoneButton" size="100%-164 100%-52 100%-24 100%-24">
    289394            Continue
    290395            <action on="Press"><![CDATA[
  • binaries/data/mods/public/simulation/components/Foundation.js

     
    312312        // ----------------------------------------------------------------------
    313313       
    314314        var cmpPlayerStatisticsTracker = QueryOwnerInterface(this.entity, IID_StatisticsTracker);
    315         cmpPlayerStatisticsTracker.IncreaseConstructedBuildingsCounter();
     315        cmpPlayerStatisticsTracker.IncreaseConstructedBuildingsCounter(building);
    316316
    317317        var cmpIdentity = Engine.QueryInterface(building, IID_Identity);
    318318        if (cmpIdentity.GetClassesList().indexOf("CivCentre") != -1)
  • binaries/data/mods/public/simulation/components/ProductionQueue.js

     
    516516        }
    517517
    518518        var cmpPlayerStatisticsTracker = QueryOwnerInterface(this.entity, IID_StatisticsTracker);
    519         cmpPlayerStatisticsTracker.IncreaseTrainedUnitsCounter();
     519        cmpPlayerStatisticsTracker.IncreaseTrainedUnitsCounter(ent);
    520520
    521521        // Play a sound, but only for the first in the batch (to avoid nasty phasing effects)
    522522        if (createdEnts.length == 0)
  • binaries/data/mods/public/simulation/components/StatisticsTracker.js

     
    66StatisticsTracker.prototype.Init = function()
    77{
    88    // units
    9     this.unitsTrained = 0;
    10     this.unitsLost = 0;
     9    this.unitsTrained = {
     10            "Infantry": 0,
     11            "Worker": 0,
     12            "Female": 0,
     13            "Cavalry": 0,
     14            "Champion": 0,
     15            "Hero": 0,
     16            "Ship": 0,
     17            "total": 0
     18    };
     19    this.unitsLost = {
     20            "Infantry": 0,
     21            "Worker": 0,
     22            "Female": 0,
     23            "Cavalry": 0,
     24            "Champion": 0,
     25            "Hero": 0,
     26            "Ship": 0,
     27            "total": 0
     28    };
    1129    this.unitsLostValue = 0;
    12     this.enemyUnitsKilled = 0;
     30    this.enemyUnitsKilled = {
     31            "Infantry": 0,
     32            "Worker": 0,
     33            "Female": 0,
     34            "Cavalry": 0,
     35            "Champion": 0,
     36            "Hero": 0,
     37            "Ship": 0,
     38            "total": 0
     39    };
    1340    this.enemyUnitsKilledValue = 0;
    14     //buildings
    15     this.buildingsConstructed = 0;
    16     this.buildingsLost = 0;
     41    //buildings     
     42    this.buildingsConstructed = {
     43        "House": 0,
     44        "Economic": 0,
     45        "Outpost": 0,
     46        "Military": 0,
     47        "Fortress": 0,
     48        "SpecialBuilding": 0,
     49        "Wonder": 0,
     50        "total": 0 
     51    };
     52    this.buildingsLost = {
     53        "House": 0,
     54        "Economic": 0,
     55        "Outpost": 0,
     56        "Military": 0,
     57        "Fortress": 0,
     58        "SpecialBuilding": 0,
     59        "Wonder": 0,
     60        "total": 0
     61        };
    1762    this.buildingsLostValue = 0;
    18     this.enemyBuildingsDestroyed = 0;
     63    this.enemyBuildingsDestroyed = {
     64        "House": 0,
     65        "Economic": 0,
     66        "Outpost": 0,
     67        "Military": 0,
     68        "Fortress": 0,
     69        "SpecialBuilding": 0,
     70        "Wonder": 0,
     71        "total": 0
     72        };
    1973    this.enemyBuildingsDestroyedValue = 0;
    2074    // civ centres
    2175    this.civCentresBuilt = 0;
     
    2276    this.enemyCivCentresDestroyed = 0;
    2377    // resources
    2478    this.resourcesGathered = {
     79            "total": 0,
    2580            "food": 0,
    2681            "wood": 0,
    2782            "metal": 0,
     
    2984            "vegetarianFood": 0
    3085    };
    3186    this.resourcesUsed = {
     87            "total": 0,
    3288            "food": 0,
    3389            "wood": 0,
    3490            "metal": 0,
     
    3591            "stone": 0
    3692    };
    3793    this.resourcesSold = {
     94            "total": 0,
    3895            "food": 0,
    3996            "wood": 0,
    4097            "metal": 0,
     
    4198            "stone": 0
    4299    };
    43100    this.resourcesBought = {
     101            "total": 0,
    44102            "food": 0,
    45103            "wood": 0,
    46104            "metal": 0,
     
    75133        "tributesReceived": this.tributesReceived,
    76134        "tradeIncome": this.tradeIncome,
    77135        "treasuresCollected": this.treasuresCollected,
    78         "percentMapExplored": this.GetPercentMapExplored()
     136        "percentMapExplored": this.GetPercentMapExplored(),
     137        "feminisation": this.GetFeminisation()
    79138    };
    80139};
    81140
    82 StatisticsTracker.prototype.IncreaseTrainedUnitsCounter = function()
     141/**
     142 *Increments counter associated with certain entity/counter and type of given entity.
     143 *@param entity Variable containing a class by which the unit is being identified
     144 *@param counter The name of the counter to increment(e.g. "unitsTrained")
     145 *@param type The type of the counter (e.g. "workers")
     146 */
     147StatisticsTracker.prototype.CounterIncrement = function(entity, counter, type)
    83148{
    84     return this.unitsTrained++;
     149    var classes = entity.GetClassesList();
     150   
     151    if (classes)
     152        if (classes.indexOf(type) != -1)
     153            this[counter][type]++;
    85154};
    86155
    87 StatisticsTracker.prototype.IncreaseConstructedBuildingsCounter = function()
     156/**
     157 * Counts the total number of units trained as well as an individual count for
     158 * each unit type. Based on templates.
     159 * @param trainedUnit The unit that has been trained
     160 */
     161StatisticsTracker.prototype.IncreaseTrainedUnitsCounter = function(trainedUnit)
    88162{
    89     return this.buildingsConstructed++;
     163    var cmpUnitEntityIdentity = Engine.QueryInterface(trainedUnit, IID_Identity);
     164
     165    if (cmpUnitEntityIdentity)
     166    {
     167        this.CounterIncrement(cmpUnitEntityIdentity, "unitsTrained", "Infantry");
     168        this.CounterIncrement(cmpUnitEntityIdentity, "unitsTrained", "Worker");
     169        this.CounterIncrement(cmpUnitEntityIdentity, "unitsTrained", "Female");
     170        this.CounterIncrement(cmpUnitEntityIdentity, "unitsTrained", "Cavalry");
     171        this.CounterIncrement(cmpUnitEntityIdentity, "unitsTrained", "Champion");
     172        this.CounterIncrement(cmpUnitEntityIdentity, "unitsTrained", "Hero");
     173        this.CounterIncrement(cmpUnitEntityIdentity, "unitsTrained", "Ship");
     174        this.unitsTrained.total++;
     175    }
    90176};
    91177
     178StatisticsTracker.prototype.GetFeminisation = function()
     179{
     180    return Math.floor(this.unitsTrained.Female > 0 ? (this.unitsTrained.Female / this.unitsTrained.Worker) * 100 : 0)
     181};
     182
     183
     184/**
     185 * Counts the total number of buildings constructed as well as an individual count for
     186 * each building type. Based on templates.
     187 * @param constructedBuilding The building that has been constructed
     188 */
     189StatisticsTracker.prototype.IncreaseConstructedBuildingsCounter = function(constructedBuilding)
     190{
     191    var cmpBuildingEntityIdentity = Engine.QueryInterface(constructedBuilding, IID_Identity);
     192       
     193    if (cmpBuildingEntityIdentity)
     194    {
     195        this.CounterIncrement(cmpBuildingEntityIdentity, "buildingsConstructed", "House");
     196        this.CounterIncrement(cmpBuildingEntityIdentity, "buildingsConstructed", "Economic");
     197        this.CounterIncrement(cmpBuildingEntityIdentity, "buildingsConstructed", "Outpost");
     198        this.CounterIncrement(cmpBuildingEntityIdentity, "buildingsConstructed", "Military");
     199        this.CounterIncrement(cmpBuildingEntityIdentity, "buildingsConstructed", "Fortress");
     200        this.CounterIncrement(cmpBuildingEntityIdentity, "buildingsConstructed", "SpecialBuilding");
     201        this.CounterIncrement(cmpBuildingEntityIdentity, "buildingsConstructed", "Wonder");
     202        this.buildingsConstructed.total++;
     203    }
     204};
     205
    92206StatisticsTracker.prototype.IncreaseBuiltCivCentresCounter = function()
    93207{
    94208    return this.civCentresBuilt++;
    95209};
    96210
     211
    97212StatisticsTracker.prototype.KilledEntity = function(targetEntity)
    98213{
    99214    var cmpTargetEntityIdentity = Engine.QueryInterface(targetEntity, IID_Identity);
     
    116231        {
    117232            if (targetIsUnit)
    118233            {
    119                 this.enemyUnitsKilled++;
     234                this.CounterIncrement(cmpTargetEntityIdentity, "enemyUnitsKilled", "Infantry");
     235                this.CounterIncrement(cmpTargetEntityIdentity, "enemyUnitsKilled", "Worker");
     236                this.CounterIncrement(cmpTargetEntityIdentity, "enemyUnitsKilled", "Female");
     237                this.CounterIncrement(cmpTargetEntityIdentity, "enemyUnitsKilled", "Cavalry");
     238                this.CounterIncrement(cmpTargetEntityIdentity, "enemyUnitsKilled", "Champion");
     239                this.CounterIncrement(cmpTargetEntityIdentity, "enemyUnitsKilled", "Hero");
     240                this.CounterIncrement(cmpTargetEntityIdentity, "enemyUnitsKilled", "Ship");
     241                this.enemyUnitsKilled.total++;
     242               
    120243                for (var r in costs)
    121244                {
    122245                    this.enemyUnitsKilledValue += costs[r];
     
    124247            }   
    125248            if (targetIsStructure)
    126249            {
    127                 this.enemyBuildingsDestroyed++;
     250                this.CounterIncrement(cmpTargetEntityIdentity, "enemyBuildingsDestroyed", "House");
     251                this.CounterIncrement(cmpTargetEntityIdentity, "enemyBuildingsDestroyed", "Economic");
     252                this.CounterIncrement(cmpTargetEntityIdentity, "enemyBuildingsDestroyed", "Outpost");
     253                this.CounterIncrement(cmpTargetEntityIdentity, "enemyBuildingsDestroyed", "Military");
     254                this.CounterIncrement(cmpTargetEntityIdentity, "enemyBuildingsDestroyed", "Fortress");
     255                this.CounterIncrement(cmpTargetEntityIdentity, "enemyBuildingsDestroyed", "SpecialBuilding");
     256                this.CounterIncrement(cmpTargetEntityIdentity, "enemyBuildingsDestroyed", "Wonder");
     257                this.enemyBuildingsDestroyed.total++;
     258               
    128259                for (var r in costs)
    129260                {
    130261                    this.enemyBuildingsDestroyedValue += costs[r];
     
    152283
    153284        if (lostEntityIsUnit)
    154285        {
    155             this.unitsLost++;
     286            this.CounterIncrement(cmpLostEntityIdentity, "unitsLost", "Infantry");
     287            this.CounterIncrement(cmpLostEntityIdentity, "unitsLost", "Worker");
     288            this.CounterIncrement(cmpLostEntityIdentity, "unitsLost", "Female");
     289            this.CounterIncrement(cmpLostEntityIdentity, "unitsLost", "Cavalry");
     290            this.CounterIncrement(cmpLostEntityIdentity, "unitsLost", "Champion");
     291            this.CounterIncrement(cmpLostEntityIdentity, "unitsLost", "Hero");
     292            this.CounterIncrement(cmpLostEntityIdentity, "unitsLost", "Ship");
     293            this.unitsLost.total++;
     294           
    156295            for (var r in costs)
    157296            {
    158297                this.unitsLostValue += costs[r];
     
    160299        }   
    161300        if (lostEntityIsStructure)
    162301        {
    163             this.buildingsLost++;
     302            this.CounterIncrement(cmpLostEntityIdentity, "buildingsLost", "House");
     303            this.CounterIncrement(cmpLostEntityIdentity, "buildingsLost", "Economic");
     304            this.CounterIncrement(cmpLostEntityIdentity, "buildingsLost", "Outpost");
     305            this.CounterIncrement(cmpLostEntityIdentity, "buildingsLost", "Military");
     306            this.CounterIncrement(cmpLostEntityIdentity, "buildingsLost", "Fortress");
     307            this.CounterIncrement(cmpLostEntityIdentity, "buildingsLost", "SpecialBuilding");
     308            this.CounterIncrement(cmpLostEntityIdentity, "buildingsLost", "Wonder");
     309            this.buildingsLost.total++;
     310           
    164311            for (var r in costs)
    165312            {
    166313                this.buildingsLostValue += costs[r];
     
    177324StatisticsTracker.prototype.IncreaseResourceGatheredCounter = function(type, amount, specificType)
    178325{
    179326    this.resourcesGathered[type] += amount;
     327    this.resourcesGathered.total += amount;
    180328   
    181329    if (type == "food" && (specificType == "fruit" || specificType == "grain"))
    182330        this.resourcesGathered["vegetarianFood"] += amount;
     
    189337StatisticsTracker.prototype.IncreaseResourceUsedCounter = function(type, amount)
    190338{
    191339    this.resourcesUsed[type] += amount;
     340    this.resourcesUsed.total += amount;
    192341};
    193342
    194343StatisticsTracker.prototype.IncreaseTreasuresCollectedCounter = function()
     
    199348StatisticsTracker.prototype.IncreaseResourcesSoldCounter = function(type, amount)
    200349{
    201350    this.resourcesSold[type] += amount;
    202 }
     351    this.resourcesSold.total += amount;
     352};
    203353
    204354StatisticsTracker.prototype.IncreaseResourcesBoughtCounter = function(type, amount)
    205355{
    206356    this.resourcesBought[type] += amount;
    207 }
     357    this.resourcesBought.total += amount;
     358};
    208359
    209360StatisticsTracker.prototype.IncreaseTributesSentCounter = function(amount)
    210361{
    211362    this.tributesSent += amount;
    212 }
     363};
    213364
    214365StatisticsTracker.prototype.IncreaseTributesReceivedCounter = function(amount)
    215366{
    216367    this.tributesReceived += amount;
    217 }
     368};
    218369
    219370StatisticsTracker.prototype.IncreaseTradeIncomeCounter = function(amount)
    220371{
    221372    this.tradeIncome += amount;
    222 }
     373};
    223374
    224375StatisticsTracker.prototype.GetPercentMapExplored = function()
    225376{