Index: ps/trunk/binaries/data/mods/public/gui/summary/counters.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/summary/counters.js +++ ps/trunk/binaries/data/mods/public/gui/summary/counters.js @@ -320,7 +320,7 @@ return { "percent": playerState.sequences.peakPercentMapControlled[index] }; } -function calculateMiscellaneousTeam(team, index, type) +function calculateMiscellaneousTeam(team, index, type, counters, headings) { if (type == "vegetarianRatio") return calculatePercent(g_TeamHelperData[team].vegetarianFood[index], g_TeamHelperData[team].food[index]); @@ -331,5 +331,16 @@ if (type == "killDeath") return calculateRatio(g_TeamHelperData[team].enemyUnitsKilled[index], g_TeamHelperData[team].unitsLost[index]); + if (type == "bribes") + return summaryArraySum(getPlayerValuesPerTeam(team, index, type, counters, headings)); + return { "percent": g_TeamHelperData[team][type][index] }; } + +function calculateBribes(playerState, index, type) +{ + return { + "succeeded": playerState.sequences.successfulBribes[index], + "failed": playerState.sequences.failedBribes[index] + }; +} Index: ps/trunk/binaries/data/mods/public/gui/summary/layout.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/summary/layout.js +++ ps/trunk/binaries/data/mods/public/gui/summary/layout.js @@ -182,6 +182,16 @@ { "identifier": "vegetarianRatio", "caption": translate("Vegetarian ratio"), "yStart": 16, "width": 100 }, { "identifier": "feminization", "caption": translate("Feminization"), "yStart": 16, "width": 100 }, { "identifier": "killDeath", "caption": translate("Kill / Death ratio"), "yStart": 16, "width": 100 }, + { + "identifier": "bribes", + "caption": sprintf(translate("Bribes\n(%(succeeded)s / %(failed)s)"), + { + "succeeded": getColoredTypeTranslation("succeeded"), + "failed": getColoredTypeTranslation("failed") + }), + "yStart": 16, + "width": 139 + }, { "identifier": "mapExploration", "caption": translate("Map exploration"), "yStart": 16, "width": 100 }, { "identifier": "mapControlPeak", "caption": translate("Map control (peak)"), "yStart": 16, "width": 100 }, { "identifier": "mapControl", "caption": translate("Map control (finish)"), "yStart": 16, "width": 100 } @@ -191,6 +201,7 @@ { "width": 100, "fn": calculateVegetarianRatio, "verticalOffset": 12 }, { "width": 100, "fn": calculateFeminization, "verticalOffset": 12 }, { "width": 100, "fn": calculateKillDeathRatio, "verticalOffset": 12 }, + { "width": 139, "fn": calculateBribes, "verticalOffset": 12 }, { "width": 100, "fn": calculateMapExploration, "verticalOffset": 12 }, { "width": 100, "fn": calculateMapPeakControl, "verticalOffset": 12 }, { "width": 100, "fn": calculateMapFinalControl, "verticalOffset": 12 } Index: ps/trunk/binaries/data/mods/public/gui/summary/summary.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/summary/summary.js +++ ps/trunk/binaries/data/mods/public/gui/summary/summary.js @@ -58,6 +58,11 @@ "caption": translate("Captured"), "postfix": " / " }, + "succeeded": { + "color": g_TypeColors.green, + "caption": translate("Succeeded"), + "postfix": " / " + }, "destroyed": { "color": g_TypeColors.blue, "caption": translate("Destroyed"), @@ -92,6 +97,11 @@ "color": g_TypeColors.red, "caption": translate("Outcome"), "postfix": "\n" + }, + "failed": { + "color": g_TypeColors.red, + "caption": translate("Failed"), + "postfix": "\n" } }; Index: ps/trunk/binaries/data/mods/public/simulation/components/StatisticsTracker.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/StatisticsTracker.js +++ ps/trunk/binaries/data/mods/public/simulation/components/StatisticsTracker.js @@ -145,6 +145,8 @@ this.lootCollected = 0; this.peakPercentMapControlled = 0; this.teamPeakPercentMapControlled = 0; + this.successfulBribes = 0; + this.failedBribes = 0; let cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer); this.updateTimer = cmpTimer.SetInterval( @@ -205,7 +207,9 @@ "percentMapControlled": this.GetPercentMapControlled(), "teamPercentMapControlled": this.GetTeamPercentMapControlled(), "peakPercentMapControlled": this.peakPercentMapControlled, - "teamPeakPercentMapControlled": this.teamPeakPercentMapControlled + "teamPeakPercentMapControlled": this.teamPeakPercentMapControlled, + "successfulBribes": this.successfulBribes, + "failedBribes": this.failedBribes }; }; @@ -462,6 +466,16 @@ this.tradeIncome += amount; }; +StatisticsTracker.prototype.IncreaseSuccessfulBribesCounter = function() +{ + ++this.successfulBribes; +}; + +StatisticsTracker.prototype.IncreaseFailedBribesCounter = function() +{ + ++this.failedBribes; +}; + StatisticsTracker.prototype.GetPercentMapExplored = function() { var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); Index: ps/trunk/binaries/data/mods/public/simulation/components/VisionSharing.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/VisionSharing.js +++ ps/trunk/binaries/data/mods/public/simulation/components/VisionSharing.js @@ -149,6 +149,11 @@ this.Activate(); this.CheckVisionSharings(); + // update statistics for successful bribes + let cmpBribesStatisticsTracker = QueryPlayerIDInterface(player, IID_StatisticsTracker); + if (cmpBribesStatisticsTracker) + cmpBribesStatisticsTracker.IncreaseSuccessfulBribesCounter(); + return this.spyId; }; Index: ps/trunk/binaries/data/mods/public/simulation/components/tests/test_VisionSharing.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/tests/test_VisionSharing.js +++ ps/trunk/binaries/data/mods/public/simulation/components/tests/test_VisionSharing.js @@ -6,6 +6,7 @@ Engine.LoadComponentScript("interfaces/AuraManager.js"); Engine.LoadComponentScript("interfaces/Timer.js"); Engine.LoadComponentScript("interfaces/VisionSharing.js"); +Engine.LoadComponentScript("interfaces/StatisticsTracker.js"); Engine.LoadComponentScript("VisionSharing.js"); const ent = 170; @@ -132,6 +133,10 @@ "GetSpyCostMultiplier": () => 1, "TrySubtractResources": costs => false }); +AddMock(4, IID_StatisticsTracker, { + "IncreaseSuccessfulBribesCounter": () => {}, + "IncreaseFailedBribesCounter": () => {} +}); cmpVisionSharing.AddSpy(4, 25); TS_ASSERT_UNEVAL_EQUALS([...cmpVisionSharing.shared], [1, 2, 5]); TS_ASSERT_UNEVAL_EQUALS([...cmpVisionSharing.spies], [[5, 2], [17, 5]]); Index: ps/trunk/binaries/data/mods/public/simulation/helpers/Commands.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/helpers/Commands.js +++ ps/trunk/binaries/data/mods/public/simulation/helpers/Commands.js @@ -795,6 +795,10 @@ { let template = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager).GetTemplate("special/spy"); IncurBribeCost(template, player, cmd.player, true); + // update statistics for failed bribes + let cmpBribesStatisticsTracker = QueryPlayerIDInterface(player, IID_StatisticsTracker); + if (cmpBribesStatisticsTracker) + cmpBribesStatisticsTracker.IncreaseFailedBribesCounter(); cmpGUIInterface.PushNotification({ "type": "text", "players": [player],