Ticket #3216: 3216.2.patch

File 3216.2.patch, 7.2 KB (added by maveric, 9 years ago)
  • binaries/data/mods/public/gui/summary/counters.js

     
    2727function calculateMilitaryScore(playerState, position)
    2828{
    2929    return Math.round((playerState.statistics.enemyUnitsKilledValue +
    30         playerState.statistics.enemyBuildingsDestroyedValue) / 10);
     30        playerState.statistics.enemyBuildingsDestroyedValue +
     31        playerState.statistics.buildingsCapturedValue) / 10);
    3132}
    3233
    3334function calculateExplorationScore(playerState, position)
     
    6566    var type = BUILDINGS_TYPES[position];
    6667    return TRAINED_COLOR + playerState.statistics.buildingsConstructed[type] + '[/color] / ' +
    6768    LOST_COLOR + playerState.statistics.buildingsLost[type] + '[/color] / ' +
    68     KILLED_COLOR + playerState.statistics.enemyBuildingsDestroyed[type] + '[/color]';
     69    KILLED_COLOR + playerState.statistics.enemyBuildingsDestroyed[type] + '[/color] / ' +
     70    CAPTURED_COLOR + playerState.statistics.buildingsCaptured[type] + '[/color]';
    6971}
    7072
    7173function calculateColorsTeam(counters)
  • binaries/data/mods/public/gui/summary/layout.js

     
    2020        "headings": [   // headings on buildings panel
    2121            { "caption": translate("Player name"), "yStart": 26, "width": 200 },
    2222            { "caption": translate("Total"), "yStart": 34, "width": 105 },
    23             { "caption": translate("Houses"), "yStart": 34, "width": 85 },
    24             { "caption": translate("Economic"), "yStart": 34, "width": 85 },
    25             { "caption": translate("Outposts"), "yStart": 34, "width": 85 },
    26             { "caption": translate("Military"), "yStart": 34, "width": 85 },
    27             { "caption": translate("Fortresses"), "yStart": 34, "width": 85 },
    28             { "caption": translate("Civ centers"), "yStart": 34, "width": 85 },
    29             { "caption": translate("Wonders"), "yStart": 34, "width": 85 }
     23            { "caption": translate("Houses"), "yStart": 34, "width": 95 },
     24            { "caption": translate("Economic"), "yStart": 34, "width": 95 },
     25            { "caption": translate("Outposts"), "yStart": 34, "width": 95 },
     26            { "caption": translate("Military"), "yStart": 34, "width": 95 },
     27            { "caption": translate("Fortresses"), "yStart": 34, "width": 95 },
     28            { "caption": translate("Civ centers"), "yStart": 34, "width": 95 },
     29            { "caption": translate("Wonders"), "yStart": 34, "width": 95 }
    3030        ],
    3131        "titleHeadings": [
    32             { "caption": translate("Buildings Statistics (Constructed / Lost / Destroyed)"), "yStart": 16, "width": (85 * 7 + 105) },   // width = 735
     32            { "caption": translate("Buildings Statistics (Constructed / Lost / Destroyed / Captured)"), "yStart": 16, "width": (95 * 7 + 105) },    // width = 735
    3333        ],
    3434        "counters": [   // counters on buildings panel
    3535            {"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}
     36            {"width": 95, "fn": calculateBuildings},
     37            {"width": 95, "fn": calculateBuildings},
     38            {"width": 95, "fn": calculateBuildings},
     39            {"width": 95, "fn": calculateBuildings},
     40            {"width": 95, "fn": calculateBuildings},
     41            {"width": 95, "fn": calculateBuildings},
     42            {"width": 95, "fn": calculateBuildings}
    4343        ],
    4444        "teamCounterFn": calculateColorsTeam
    4545    },
  • binaries/data/mods/public/gui/summary/summary.js

     
    1919const TRAINED_COLOR = '[color="201 255 200"]';
    2020const LOST_COLOR = '[color="255 213 213"]';
    2121const KILLED_COLOR = '[color="196 198 255"]';
     22const CAPTURED_COLOR = '[color="75 45 215"]';
    2223
    2324const BUILDINGS_TYPES = [ "total", "House", "Economic", "Outpost", "Military", "Fortress", "CivCentre", "Wonder" ];
    2425const UNITS_TYPES = [ "total", "Infantry", "Worker", "Cavalry", "Champion", "Hero", "Ship" ];
  • binaries/data/mods/public/simulation/components/Capturable.js

     
    103103    for (let i in this.cp)
    104104        if (this.cp[i] >= this.cp[bestPlayer])
    105105            bestPlayer = +i;
    106 
     106   
     107    var cmpLostPlayerStatisticsTracker = QueryOwnerInterface(this.entity, IID_StatisticsTracker);
     108    if (cmpLostPlayerStatisticsTracker)
     109        cmpLostPlayerStatisticsTracker.LostEntity(this.entity);
     110   
    107111    cmpOwnership.SetOwner(bestPlayer);
     112   
     113    var cmpCapturedPlayerStatisticsTracker = QueryOwnerInterface(this.entity, IID_StatisticsTracker);
     114    if (cmpCapturedPlayerStatisticsTracker)
     115        cmpCapturedPlayerStatisticsTracker.CapturedBuilding(this.entity);
    108116
    109117    return takenCp;
    110118};
  • binaries/data/mods/public/simulation/components/StatisticsTracker.js

     
    7676        "CivCentre": 0,
    7777        "Wonder": 0,
    7878        "total": 0
    79         };
     79    };
    8080    this.buildingsLostValue = 0;
    8181    this.enemyBuildingsDestroyed = {
    8282        "House": 0,
     
    8787        "CivCentre": 0,
    8888        "Wonder": 0,
    8989        "total": 0
    90         };
    91     this.enemyBuildingsDestroyedValue = 0;
     90    };
     91    this.enemyBuildingsDestroyedValue = 0;
     92    this.buildingsCaptured = {
     93        "House": 0,
     94        "Economic": 0,
     95        "Outpost": 0,
     96        "Military": 0,
     97        "Fortress": 0,
     98        "CivCentre": 0,
     99        "Wonder": 0,
     100        "total": 0
     101    };
     102    this.buildingsCapturedValue = 0;
    92103    // resources
    93104    this.resourcesGathered = {
    94105        "food": 0,
     
    149160        "buildingsLost": this.buildingsLost,
    150161        "buildingsLostValue": this.buildingsLostValue,
    151162        "enemyBuildingsDestroyed": this.enemyBuildingsDestroyed,
    152         "enemyBuildingsDestroyedValue": this.enemyBuildingsDestroyedValue,
     163        "enemyBuildingsDestroyedValue": this.enemyBuildingsDestroyedValue,
     164        "buildingsCaptured": this.buildingsCaptured,
     165        "buildingsCapturedValue": this.buildingsCapturedValue,
    153166        "resourcesGathered": this.resourcesGathered,
    154167        "resourcesUsed": this.resourcesUsed,
    155168        "resourcesSold": this.resourcesSold,
     
    292305        for each (var cost in costs)
    293306            this.buildingsLostValue += cost;
    294307    }
     308};
     309
     310StatisticsTracker.prototype.CapturedBuilding = function(capturedBuilding)
     311{
     312    var cmpCapturedBuildingIdentity = Engine.QueryInterface(capturedBuilding, IID_Identity);
     313    var cmpCost = Engine.QueryInterface(capturedBuilding, IID_Cost);
     314    var costs = cmpCost.GetResourceCosts();
     315
     316    for each (var type in this.buildingsClasses)
     317        this.CounterIncrement(cmpCapturedBuildingIdentity, "buildingsCaptured", type);
     318   
     319    this.buildingsCaptured.total++;
     320   
     321    for each (var cost in costs)
     322        this.buildingsCapturedValue += cost;
    295323};
    296324
    297325/**