Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/summary/counters.js
Show First 20 Lines • Show All 328 Lines • ▼ Show 20 Lines | return calculateRatio( | ||||||||||
playerState.sequences.unitsLost.total[index]); | playerState.sequences.unitsLost.total[index]); | ||||||||||
} | } | ||||||||||
function calculatePopulationCount(playerState, index) | function calculatePopulationCount(playerState, index) | ||||||||||
{ | { | ||||||||||
return { "population": playerState.sequences.populationCount[index] }; | return { "population": playerState.sequences.populationCount[index] }; | ||||||||||
} | } | ||||||||||
function calculateIdleTime(playerState, index) | |||||||||||
{ | |||||||||||
print(JSON.stringify(Object.keys(playerState.sequences.idleTime))+"\n") | |||||||||||
let idleTime = {}; | |||||||||||
for(let cls of [ | |||||||||||
"citizen", "femaleCitizen", "trader", "fishingBoat", "soldier" | |||||||||||
FreagarachUnsubmitted Not Done Inline Actions
Freagarach: | |||||||||||
]){ | |||||||||||
Not Done Inline Actions
Freagarach: | |||||||||||
Not Done Inline ActionsThe many string concatinations may be slow (and unnecessary), maybe there is a way around that? Freagarach: The many string concatinations may be slow (and unnecessary), maybe there is a way around that? | |||||||||||
idleTime["idleTime_" + cls] = playerState.sequences.idleTime[cls][index]/1000; | |||||||||||
} | |||||||||||
return idleTime; | |||||||||||
} | |||||||||||
function calculateMapExploration(playerState, index) | function calculateMapExploration(playerState, index) | ||||||||||
{ | { | ||||||||||
return { "percent": playerState.sequences.percentMapExplored[index] }; | return { "percent": playerState.sequences.percentMapExplored[index] }; | ||||||||||
} | } | ||||||||||
function calculateMapFinalControl(playerState, index) | function calculateMapFinalControl(playerState, index) | ||||||||||
{ | { | ||||||||||
return { "percent": playerState.sequences.percentMapControlled[index] }; | return { "percent": playerState.sequences.percentMapControlled[index] }; | ||||||||||
Show All 10 Lines | if (type == "vegetarianRatio") | ||||||||||
return calculatePercent(g_TeamHelperData[team].vegetarianFood[index], g_TeamHelperData[team].food[index]); | return calculatePercent(g_TeamHelperData[team].vegetarianFood[index], g_TeamHelperData[team].food[index]); | ||||||||||
if (type == "feminization") | if (type == "feminization") | ||||||||||
return calculatePercent(g_TeamHelperData[team].femaleCitizen[index], g_TeamHelperData[team].worker[index]); | return calculatePercent(g_TeamHelperData[team].femaleCitizen[index], g_TeamHelperData[team].worker[index]); | ||||||||||
if (type == "killDeath") | if (type == "killDeath") | ||||||||||
return calculateRatio(g_TeamHelperData[team].enemyUnitsKilled[index], g_TeamHelperData[team].unitsLost[index]); | return calculateRatio(g_TeamHelperData[team].enemyUnitsKilled[index], g_TeamHelperData[team].unitsLost[index]); | ||||||||||
if (type == "bribes" || type == "population") | if (type == "bribes" || type == "population" || type == "idleTime") | ||||||||||
return summaryArraySum(getPlayerValuesPerTeam(team, index, type, counters, headings)); | return summaryArraySum(getPlayerValuesPerTeam(team, index, type, counters, headings)); | ||||||||||
return { "percent": g_TeamHelperData[team][type][index] }; | return { "percent": g_TeamHelperData[team][type][index] }; | ||||||||||
} | } | ||||||||||
function calculateBribes(playerState, index, type) | function calculateBribes(playerState, index, type) | ||||||||||
{ | { | ||||||||||
return { | return { | ||||||||||
"succeeded": playerState.sequences.successfulBribes[index], | "succeeded": playerState.sequences.successfulBribes[index], | ||||||||||
"failed": playerState.sequences.failedBribes[index] | "failed": playerState.sequences.failedBribes[index] | ||||||||||
}; | }; | ||||||||||
} | } |
Wildfire Games · Phabricator