Ticket #3561: t3561_fix_summary_screen_meh_WIP_v0.1.patch
File t3561_fix_summary_screen_meh_WIP_v0.1.patch, 5.9 KB (added by , 9 years ago) |
---|
-
binaries/data/mods/public/gui/summary/counters.js
function calculateMarketTeam(counters) 241 241 total.i += (+splitCaption[0]); 242 242 total.o += (+splitCaption[1]); 243 243 } 244 244 } 245 245 246 if (w >= 4) 247 teamTotal = total.i +(w == 4 ? "%" : ""); 246 if (w == 4) 247 // average barter efficiency 248 teamTotal = (total.i / g_Teams[t]) + "%"; 249 else if (w > 4) 250 // trade income 251 teamTotal = total.i; 248 252 else 253 // resources exchanges 249 254 teamTotal = INCOME_COLOR + '+' + total.i + '[/color] ' + OUTCOME_COLOR + '-' + total.o + '[/color]'; 250 255 251 256 Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + w + "]").caption = teamTotal; 252 257 } 253 258 } … … function calculateVegetarianRatio(player 265 270 teamMiscHelperData[playerState.team][position].food += playerState.statistics.resourcesGathered.food; 266 271 teamMiscHelperData[playerState.team][position].vegetarianFood += playerState.statistics.resourcesGathered.vegetarianFood; 267 272 return Math.floor((playerState.statistics.resourcesGathered.vegetarianFood / playerState.statistics.resourcesGathered.food) * 100) + "%"; 268 273 } 269 274 else 270 return 0 + "%";275 return "-"; 271 276 } 272 277 273 278 function calculateFeminization(playerState, position) 274 279 { 275 280 if (!teamMiscHelperData[playerState.team]) … … function calculateFeminization(playerSta 282 287 teamMiscHelperData[playerState.team][position].Female = playerState.statistics.unitsTrained.Female; 283 288 teamMiscHelperData[playerState.team][position].Worker = playerState.statistics.unitsTrained.Worker; 284 289 return Math.floor((playerState.statistics.unitsTrained.Female / playerState.statistics.unitsTrained.Worker) * 100) + "%"; 285 290 } 286 291 else 287 return 0 + "%";292 return "-"; 288 293 } 289 294 290 295 function calculateKillDeathRatio(playerState, position) 291 296 { 292 297 if (!teamMiscHelperData[playerState.team]) … … function calculateKillDeathRatio(playerS 295 300 teamMiscHelperData[playerState.team][position] = {"enemyUnitsKilled": 0, "unitsLost": 0}; 296 301 297 302 teamMiscHelperData[playerState.team][position].enemyUnitsKilled = playerState.statistics.enemyUnitsKilled.total; 298 303 teamMiscHelperData[playerState.team][position].unitsLost = playerState.statistics.unitsLost.total; 299 304 300 if (!playerState.statistics.enemyUnitsKilled.total) 301 return DEFAULT_DECIMAL; 302 if (!playerState.statistics.unitsLost.total) // and enemyUnitsKilled.total > 0 303 return INFINITE_SYMBOL; // infinity symbol 305 if (!playerState.statistics.unitsLost.total) 306 return "-" 304 307 305 308 return Math.round((playerState.statistics.enemyUnitsKilled.total / playerState.statistics.unitsLost.total)*100)/100; 306 309 } 307 310 308 311 function calculateMapExploration(playerState, position) 309 312 { 310 313 if (!teamMiscHelperData[playerState.team]) 311 314 teamMiscHelperData[playerState.team] = []; 312 315 313 teamMiscHelperData[playerState.team][position] = playerState.statistics. teamPercentMapExplored;316 teamMiscHelperData[playerState.team][position] = playerState.statistics.percentMapExplored; 314 317 return playerState.statistics.percentMapExplored + "%"; 315 318 } 316 319 317 320 function calculateMapFinalControl(playerState, position) 318 321 { … … function calculateMiscellaneous(counters 339 342 if (t == -1) 340 343 continue; 341 344 342 345 for (var w in counters) 343 346 { 344 var teamTotal = "undefined"; 345 346 if (w == 0) 347 teamTotal = (teamMiscHelperData[t][w].food == 0 ? "0" : Math.floor((teamMiscHelperData[t][w].vegetarianFood / teamMiscHelperData[t][w].food) * 100)) + "%"; 348 else if (w == 1) 349 teamTotal = (teamMiscHelperData[t][w].Worker == 0 ? "0" : Math.floor((teamMiscHelperData[t][w].Female / teamMiscHelperData[t][w].Worker) * 100)) + "%"; 350 else if (w == 2) 347 var teamTotal = 0; 348 for (var p = 0; p < g_Teams[t]; ++p) 351 349 { 352 if (!teamMiscHelperData[t][w].enemyUnitsKilled) 353 teamTotal = DEFAULT_DECIMAL; 354 else if (!teamMiscHelperData[t][w].unitsLost) // and enemyUnitsKilled.total > 0 355 teamTotal = INFINITE_SYMBOL; // infinity symbol 356 else 357 teamTotal = Math.round((teamMiscHelperData[t][w].enemyUnitsKilled / teamMiscHelperData[t][w].unitsLost)*100)/100; 350 if (w == 0 && teamMiscHelperData[t][w].food) 351 // vegetarian ratio 352 teamTotal += Math.floor(teamMiscHelperData[t][w].vegetarianFood / teamMiscHelperData[t][w].food * 100); 353 else if (w == 1 && teamMiscHelperData[t][w].Worker) 354 // feminization 355 teamTotal += Math.floor(teamMiscHelperData[t][w].Female / teamMiscHelperData[t][w].Worker * 100); 356 else if (w == 2 && teamMiscHelperData[t][w].unitsLost) 357 // kill death ratio 358 teamTotal += Math.round((teamMiscHelperData[t][w].enemyUnitsKilled / teamMiscHelperData[t][w].unitsLost)*100)/100; 359 else if (w >= 3) 360 // map exploration, map control at peak, at finish 361 teamTotal += +teamMiscHelperData[t][w]; 358 362 } 359 else if (w >= 3) 360 teamTotal = teamMiscHelperData[t][w] + "%"; 361 362 Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + w + "]").caption = teamTotal; 363 // compute average 364 teamTotal ; 365 366 if (w==2) 367 teamTotal 368 Engine.GetGUIObjectByName("valueDataTeam[" + t + "][" + w + "]").caption = Math.round(teamTotal / g_Teams[t]) + (w != 2 ? "%" : ""); 363 369 } 364 370 } 365 371 } -
binaries/data/mods/public/gui/summary/summary.js
const RESOURCES_TYPES = [ "food", "wood" 23 23 24 24 // Colors used for gathered and traded resources 25 25 const INCOME_COLOR = '[color="201 255 200"]'; 26 26 const OUTCOME_COLOR = '[color="255 213 213"]'; 27 27 28 const DEFAULT_DECIMAL = "0.00";29 const INFINITE_SYMBOL = "\u221E";30 28 // Load data 31 29 var g_CivData = loadCivData(); 32 30 var g_Teams = []; 33 31 // TODO set g_PlayerCount as playerCounters.length 34 32 var g_PlayerCount = 0;