Ticket #4033: siege-units-summary.3.patch
File siege-units-summary.3.patch, 14.0 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/gui/credits/texts/programming.json
122 122 {"nick": "MarkT", "name": "Mark Thompson"}, 123 123 {"nick": "Markus"}, 124 124 {"nick": "Matei", "name": "Matei Zaharia"}, 125 {"nick": "Mate-86", "name": "Mate Kovacs"}, 125 126 {"nick": "MattDoerksen", "name": "Matt Doerksen"}, 126 127 {"nick": "mattlott", "name": "Matt Lott"}, 127 128 {"nick": "maveric", "name": "Anton Protko"}, -
binaries/data/mods/public/gui/session/session.js
1143 1143 "Cavalry", 1144 1144 "Champion", 1145 1145 "Hero", 1146 "Siege", 1146 1147 "Ship", 1147 1148 "Trader" 1148 1149 ]; -
binaries/data/mods/public/gui/summary/counters.js
5 5 g_TeamHelperData = []; 6 6 } 7 7 8 function formatTrained(trained, lost, killed)8 function formatTrained(trained, killed, lost) 9 9 { 10 10 return g_TrainedColor + trained + '[/color] / ' + 11 g_ LostColor + lost+ '[/color] / ' +12 g_ KilledColor + killed+ '[/color]';11 g_KilledColor + killed + '[/color] / ' + 12 g_LostColor + lost + '[/color]'; 13 13 } 14 14 15 15 function formatCaptured(constructed, destroyed, captured, lost) … … 20 20 g_LostColor + lost + '[/color]\n'; 21 21 } 22 22 23 function formatCapturedUnit(trained, killed, captured, lost) 24 { 25 return g_TrainedColor + trained + '[/color] / ' + 26 g_KilledColor + killed + '[/color] / ' + 27 g_CapturedColor + captured + '[/color] / ' + 28 g_LostColor + lost + '[/color]'; 29 } 30 23 31 function formatIncome(income, outcome) 24 32 { 25 33 return g_IncomeColor + income + '[/color] / ' + … … 217 225 218 226 for (let w in counters) 219 227 { 220 let total = { 221 "constructed": 0, 222 "lost": 0, 223 "destroyed": 0 228 let total = 229 { 230 "trained": 0, 231 "killed": 0, 232 "captured" : 0, 233 "lost": 0 224 234 }; 225 235 236 226 237 for (let p = 0; p < g_Teams[t]; ++p) 227 238 { 228 239 let splitCaption = cleanGUICaption(t, p, w).split("/"); 229 230 total.constructed += +splitCaption[0]; 231 total.lost += +splitCaption[1]; 232 total.destroyed += +splitCaption[2]; 240 241 total.trained += +splitCaption[0]; 242 total.killed += +splitCaption[1]; 243 244 if (w == 0 || w == 6) 245 { 246 total.captured += +splitCaption[2]; 247 total.lost += +splitCaption[3]; 248 } 249 else 250 total.lost += +splitCaption[2]; 233 251 } 234 235 Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + w + "]").caption = 236 formatTrained(total.constructed, total.lost, total.destroyed); 252 253 let formattedCaption = ""; 254 255 if (w == 0 || w == 6) 256 formattedCaption = formatCapturedUnit(total.trained, total.killed, total.captured, total.lost); 257 else 258 formattedCaption = formatTrained(total.trained, total.killed, total.lost); 259 260 Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + w + "]").caption = formattedCaption; 237 261 } 238 262 } 239 263 } 240 264 265 function calculateUnitsWithCaptured(playerState, position) 266 { 267 let type = g_UnitsTypes[position]; 268 269 return formatCapturedUnit( 270 playerState.statistics.unitsTrained[type], 271 playerState.statistics.enemyUnitsKilled[type], 272 playerState.statistics.unitsCaptured[type], 273 playerState.statistics.unitsLost[type]); 274 } 275 241 276 function calculateUnits(playerState, position) 242 277 { 243 278 let type = g_UnitsTypes[position]; … … 244 279 245 280 return formatTrained( 246 281 playerState.statistics.unitsTrained[type], 247 playerState.statistics. unitsLost[type],248 playerState.statistics. enemyUnitsKilled[type]);282 playerState.statistics.enemyUnitsKilled[type], 283 playerState.statistics.unitsLost[type]); 249 284 } 250 285 251 286 function calculateResources(playerState, position) -
binaries/data/mods/public/gui/summary/layout.js
56 56 "units": { 57 57 "headings": [ 58 58 { "caption": translate("Player name"), "yStart": 26, "width": 200 }, 59 { "caption": translate("Total"), "yStart": 34, "width": 120 }, 60 { "caption": translate("Infantry"), "yStart": 34, "width": 100 }, 61 { "caption": translate("Worker"), "yStart": 34, "width": 100 }, 62 { "caption": translate("Cavalry"), "yStart": 34, "width": 100 }, 63 { "caption": translate("Champion"), "yStart": 34, "width": 100 }, 64 { "caption": translate("Heroes"), "yStart": 34, "width": 100 }, 65 { "caption": translate("Navy"), "yStart": 34, "width": 100 }, 66 { "caption": translate("Traders"), "yStart": 34, "width": 100 } 59 { "caption": translate("Total"), "yStart": 34, "width": 105 }, 60 { "caption": translate("Infantry"), "yStart": 34, "width": 85 }, 61 { "caption": translate("Worker"), "yStart": 34, "width": 85 }, 62 { "caption": translate("Cavalry"), "yStart": 34, "width": 85 }, 63 { "caption": translate("Champion"), "yStart": 34, "width": 85 }, 64 { "caption": translate("Heroes"), "yStart": 34, "width": 85 }, 65 { "caption": translate("Siege"), "yStart": 34, "width": 95 }, 66 { "caption": translate("Navy"), "yStart": 34, "width": 85 }, 67 { "caption": translate("Traders"), "yStart": 34, "width": 85 } 67 68 ], 68 69 "titleHeadings": [ 69 70 { 70 "caption": sprintf(translate("Units Statistics (%(trained)s / %( lost)s / %(killed)s)"),71 "caption": sprintf(translate("Units Statistics (%(trained)s / %(killed)s / %(captured)s / %(lost)s)"), 71 72 { 72 73 "trained": g_TrainedColor + translate("Trained") + '[/color]', 73 "lost": g_LostColor + translate("Lost") + '[/color]', 74 "killed": g_KilledColor + translate("Killed") + '[/color]' 74 "killed": g_KilledColor + translate("Killed") + '[/color]', 75 "captured": g_CapturedColor + translate("Captured") + '[/color]', 76 "lost": g_LostColor + translate("Lost") + '[/color]' 75 77 }), 76 78 "yStart": 16, 77 79 "width": (100 * 7 + 120) … … 78 80 }, // width = 820 79 81 ], 80 82 "counters": [ 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 } 83 { "width": 105, "fn": calculateUnitsWithCaptured, "verticalOffset": 12 }, 84 { "width": 85, "fn": calculateUnits, "verticalOffset": 12 }, 85 { "width": 85, "fn": calculateUnits, "verticalOffset": 12 }, 86 { "width": 85, "fn": calculateUnits, "verticalOffset": 12 }, 87 { "width": 85, "fn": calculateUnits, "verticalOffset": 12 }, 88 { "width": 85, "fn": calculateUnits, "verticalOffset": 12 }, 89 { "width": 105, "fn": calculateUnitsWithCaptured, "verticalOffset": 12 }, 90 { "width": 85, "fn": calculateUnits, "verticalOffset": 12 }, 91 { "width": 85, "fn": calculateUnits, "verticalOffset": 12 } 89 92 ], 90 93 "teamCounterFn": calculateUnitsTeam 91 94 }, -
binaries/data/mods/public/gui/summary/summary.js
1 const g_MaxHeadingTitle= 8;1 const g_MaxHeadingTitle= 9; 2 2 3 3 // const for filtering long collective headings 4 4 const g_LongHeadingWidth = 250; … … 16 16 const g_CapturedColor = '[color="255 255 157"]'; 17 17 18 18 const g_BuildingsTypes = [ "total", "House", "Economic", "Outpost", "Military", "Fortress", "CivCentre", "Wonder" ]; 19 const g_UnitsTypes = [ "total", "Infantry", "Worker", "Cavalry", "Champion", "Hero", "S hip", "Trader" ];19 const g_UnitsTypes = [ "total", "Infantry", "Worker", "Cavalry", "Champion", "Hero", "Siege", "Ship", "Trader" ]; 20 20 const g_ResourcesTypes = [ "food", "wood", "stone", "metal" ]; 21 21 22 22 // Colors used for gathered and traded resources -
binaries/data/mods/public/gui/summary/summary.xml
103 103 <object name="playerNameHeading" type="text" style="ModernLeftTabLabelText"> 104 104 <translatableAttribute id="caption">Player name</translatableAttribute> 105 105 </object> 106 <repeat var="x" count=" 8">106 <repeat var="x" count="9"> 107 107 <object name="titleHeading[x]" type="text" style="ModernTabLabelText"> 108 108 </object> 109 109 </repeat> 110 <repeat var="x" count=" 8">110 <repeat var="x" count="9"> 111 111 <object name="Heading[x]" type="text" style="ModernTabLabelText"> 112 112 </object> 113 113 </repeat> … … 124 124 </object> 125 125 <object name="playerNamet[i][n]" type="text" size="40 2 208 100%" style="ModernLeftLabelText"/> 126 126 <object name="civIcont[i][n]" type="image" size="208 5 240 37" /> 127 <repeat var="x" count=" 8">127 <repeat var="x" count="9"> 128 128 <object name="valueDataTeam[i][n][x]" type="text" style="ModernTabLabelText"> 129 129 </object> 130 130 </repeat> … … 132 132 </repeat> 133 133 </object> 134 134 <object name="teamHeadingt[i]" type="text" style="ModernLeftTabLabelText"/> 135 <repeat var="x" count=" 8">135 <repeat var="x" count="9"> 136 136 <object name="valueDataTeam[i][x]" type="text" style="ModernTabLabelText"> 137 137 </object> 138 138 </repeat> … … 147 147 </object> 148 148 <object name="playerName[n]" type="text" size="40 2 208 100%" style="ModernLeftLabelText"/> 149 149 <object name="civIcon[n]" type="image" size="208 5 240 37"/> 150 <repeat var="x" count=" 8">150 <repeat var="x" count="9"> 151 151 <object name="valueData[n][x]" type="text" style="ModernTabLabelText"> 152 152 </object> 153 153 </repeat> -
binaries/data/mods/public/simulation/components/Capturable.js
159 159 160 160 let cmpCapturedPlayerStatisticsTracker = QueryOwnerInterface(this.entity, IID_StatisticsTracker); 161 161 if (cmpCapturedPlayerStatisticsTracker) 162 cmpCapturedPlayerStatisticsTracker.Captured Building(this.entity);162 cmpCapturedPlayerStatisticsTracker.CapturedEntity(this.entity); 163 163 }; 164 164 165 165 Capturable.prototype.GetRegenRate = function() -
binaries/data/mods/public/simulation/components/StatisticsTracker.js
12 12 "Cavalry", 13 13 "Champion", 14 14 "Hero", 15 "Siege", 15 16 "Ship", 16 17 "Trader" 17 18 ]; … … 22 23 "Cavalry": 0, 23 24 "Champion": 0, 24 25 "Hero": 0, 26 "Siege": 0, 25 27 "Ship": 0, 26 28 "Trader": 0, 27 29 "total": 0 … … 33 35 "Cavalry": 0, 34 36 "Champion": 0, 35 37 "Hero": 0, 38 "Siege": 0, 36 39 "Ship": 0, 37 40 "Trader": 0, 38 41 "total": 0 … … 45 48 "Cavalry": 0, 46 49 "Champion": 0, 47 50 "Hero": 0, 51 "Siege": 0, 48 52 "Ship": 0, 49 53 "Trader": 0, 50 54 "total": 0 51 55 }; 52 56 this.enemyUnitsKilledValue = 0; 57 this.unitsCaptured = { 58 "Infantry": 0, 59 "Worker": 0, 60 "Female": 0, 61 "Cavalry": 0, 62 "Champion": 0, 63 "Hero": 0, 64 "Siege": 0, 65 "Ship": 0, 66 "Trader": 0, 67 "total": 0 68 }; 69 this.unitsCapturedValue = 0; 53 70 54 71 this.buildingsClasses = [ 55 72 "House", … … 163 180 "unitsLostValue": this.unitsLostValue, 164 181 "enemyUnitsKilled": this.enemyUnitsKilled, 165 182 "enemyUnitsKilledValue": this.enemyUnitsKilledValue, 183 "unitsCaptured": this.unitsCaptured, 184 "unitsCapturedValue": this.unitsCapturedValue, 166 185 "buildingsConstructed": this.buildingsConstructed, 167 186 "buildingsLost": this.buildingsLost, 168 187 "buildingsLostValue": this.buildingsLostValue, … … 308 327 } 309 328 }; 310 329 311 StatisticsTracker.prototype.Captured Building = function(capturedBuilding)330 StatisticsTracker.prototype.CapturedEntity = function(capturedEntity) 312 331 { 313 let cmpCaptured BuildingIdentity = Engine.QueryInterface(capturedBuilding, IID_Identity);314 if (!cmpCaptured BuildingIdentity)332 let cmpCapturedEntityIdentity = Engine.QueryInterface(capturedEntity, IID_Identity); 333 if (!cmpCapturedEntityIdentity) 315 334 return; 316 335 317 for (let type of this.buildingsClasses) 318 this.CounterIncrement(cmpCapturedBuildingIdentity, "buildingsCaptured", type); 336 if (cmpCapturedEntityIdentity.HasClass("Unit")) 337 { 338 for (let type of this.unitsClasses) 339 this.CounterIncrement(cmpCapturedEntityIdentity, "unitsCaptured", type); 319 340 320 ++this.buildingsCaptured.total;341 ++this.unitsCaptured.total; 321 342 322 let cmpCost = Engine.QueryInterface(capturedBuilding, IID_Cost);323 if (!cmpCost)324 return;343 let cmpCost = Engine.QueryInterface(capturedEntity, IID_Cost); 344 if (!cmpCost) 345 return; 325 346 326 let costs = cmpCost.GetResourceCosts(); 327 for (let type in costs) 328 this.buildingsCapturedValue += costs[type]; 347 let costs = cmpCost.GetResourceCosts(); 348 for (let type in costs) 349 this.unitsCapturedValue += costs[type]; 350 } 351 352 if (cmpCapturedEntityIdentity.HasClass("Structure")) 353 { 354 for (let type of this.buildingsClasses) 355 this.CounterIncrement(cmpCapturedEntityIdentity, "buildingsCaptured", type); 356 357 ++this.buildingsCaptured.total; 358 359 let cmpCost = Engine.QueryInterface(capturedEntity, IID_Cost); 360 if (!cmpCost) 361 return; 362 363 let costs = cmpCost.GetResourceCosts(); 364 for (let type in costs) 365 this.buildingsCapturedValue += costs[type]; 366 } 329 367 }; 330 368 331 369 /**