public StatsUpdateList PullSurvivorStats(StatsUpdateList iList, bool iGatherFromAllPlayers) { iList.Clear(); RunReport runReport = RunReport.Generate(Run.instance, GameResultType.Unknown); List <RunReport.PlayerInfo> playerInfoList = new List <RunReport.PlayerInfo> { }; DateTime now = DateTime.Now; TimeSpan delta = now - timeStart; for (int i = 0; i < runReport.playerInfoCount; i++) { if ((iGatherFromAllPlayers) || (runReport.GetPlayerInfo(i).isLocalPlayer)) { RunReport.PlayerInfo playerInfo = runReport.GetPlayerInfo(i); ulong totalDamageDealt = playerInfo.statSheet.GetStatValueULong(StatDef.totalDamageDealt) + playerInfo.statSheet.GetStatValueULong(StatDef.totalMinionDamageDealt); // The server doesn't have access to playerInfo.networkUser.userName, playerInfo.name, or playerInfo.networkUser.GetNetworkPlayerName().GetResolvedName(); string nameIdentifier = playerInfo.bodyName; StatsUpdate update = new StatsUpdate(i + 1, nameIdentifier, delta, totalDamageDealt, playerInfo.statSheet.GetStatValueULong(StatDef.totalKills)); iList.Add(update); } } return(iList); }
public string GetCharacterStats() { if (CachedCharacterBody == null) { return(string.Empty); } StringBuilder sb = new StringBuilder(); for (int i = 0; i < CachedStatsToDisplay.Length; i++) { object stat = typeof(CharacterBody).GetProperty(CachedStatsToDisplay[i], BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance).GetValue(CachedCharacterBody); sb.AppendLine($"{CachedStatsToDisplayNames[i]}: {stat}"); } RunReport runReport = RunReport.Generate(Run.instance, GameResultType.Unknown); for (int i = 0; i < runReport.playerInfoCount; i++) { RunReport.PlayerInfo playerInfo = runReport.GetPlayerInfo(i); if (playerInfo.isLocalPlayer) { sb.AppendLine($"Kills: {playerInfo.statSheet.GetStatValueULong(StatDef.totalKills)}"); sb.AppendLine($"Damage Dealt: {playerInfo.statSheet.GetStatValueULong(StatDef.totalDamageDealt)}"); sb.AppendLine($"Gold Collected: {playerInfo.statSheet.GetStatValueULong(StatDef.goldCollected)}"); sb.AppendLine($"Stages Completed: {playerInfo.statSheet.GetStatValueULong(StatDef.totalStagesCompleted)}"); break; } } return(sb.ToString()); }
// Token: 0x060021A8 RID: 8616 RVA: 0x0009E640 File Offset: 0x0009C840 public void SetDisplayData(GameEndReportPanelController.DisplayData newDisplayData) { if (this.displayData.Equals(newDisplayData)) { return; } this.displayData = newDisplayData; if (this.resultLabel) { GameResultType gameResultType = GameResultType.Unknown; if (this.displayData.runReport != null) { gameResultType = this.displayData.runReport.gameResultType; } string token; if (gameResultType != GameResultType.Lost) { if (gameResultType != GameResultType.Won) { token = "GAME_RESULT_UNKNOWN"; } else { token = "GAME_RESULT_WON"; } } else { token = "GAME_RESULT_LOST"; } this.resultLabel.text = Language.GetString(token); } RunReport runReport = this.displayData.runReport; RunReport.PlayerInfo playerInfo = (runReport != null) ? runReport.GetPlayerInfoSafe(this.displayData.playerIndex) : null; this.SetPlayerInfo(playerInfo); RunReport runReport2 = this.displayData.runReport; int num = (runReport2 != null) ? runReport2.playerInfoCount : 0; this.playerNavigationController.gameObject.SetActive(num > 1); this.playerNavigationController.SetDisplayData(new CarouselNavigationController.DisplayData(num, this.displayData.playerIndex)); ReadOnlyCollection <MPButton> elements = this.playerNavigationController.buttonAllocator.elements; for (int i = 0; i < elements.Count; i++) { MPButton mpbutton = elements[i]; RunReport.PlayerInfo playerInfo2 = this.displayData.runReport.GetPlayerInfo(i); CharacterBody bodyPrefabBodyComponent = BodyCatalog.GetBodyPrefabBodyComponent(playerInfo2.bodyIndex); Texture texture = bodyPrefabBodyComponent ? bodyPrefabBodyComponent.portraitIcon : null; mpbutton.GetComponentInChildren <RawImage>().texture = texture; mpbutton.GetComponent <TooltipProvider>().SetContent(TooltipProvider.GetPlayerNameTooltipContent(playerInfo2.name)); } this.selectedPlayerEffectRoot.transform.SetParent(this.playerNavigationController.buttonAllocator.elements[this.displayData.playerIndex].transform); this.selectedPlayerEffectRoot.gameObject.SetActive(false); this.selectedPlayerEffectRoot.gameObject.SetActive(true); this.selectedPlayerEffectRoot.offsetMin = Vector2.zero; this.selectedPlayerEffectRoot.offsetMax = Vector2.zero; this.selectedPlayerEffectRoot.localScale = Vector3.one; }
public string GetCharacterStats() { if (CachedCharacterBody == null) { return(string.Empty); } StringBuilder sb = new StringBuilder(); for (int i = 0; i < CachedCharacterBodyStats.Length; i++) { object stat = typeof(CharacterBody).GetProperty(CachedCharacterBodyStats[i], BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance).GetValue(CachedCharacterBody); sb.AppendLine($"{CachedCharacterBodyStatsNames[i]}: {stat}"); } RunReport runReport = RunReport.Generate(Run.instance, GameResultType.Unknown); RunReport.PlayerInfo playerInfo = null; for (int i = 0; i < runReport.playerInfoCount; i++) { if (runReport.GetPlayerInfo(i).isLocalPlayer) { playerInfo = runReport.GetPlayerInfo(i); break; } } if (playerInfo != null) { for (int i = 0; i < CachedStatSheetStats.Length; i++) { StatDef statDef = (StatDef)typeof(StatDef).GetField(CachedStatSheetStats[i], BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static).GetValue(null); sb.AppendLine($"{CachedStatSheetStatsNames[i]}: {playerInfo.statSheet.GetStatDisplayValue(statDef)}"); } } return(sb.ToString()); }
public void Awake() { On.RoR2.CharacterBody.OnSprintStart += (orig, self) => { RunReport runReport = RunReport.Generate(Run.instance, GameResultType.Unknown); RunReport.PlayerInfo playerInfo = null; if (runReport.GetPlayerInfo(0).isLocalPlayer) { playerInfo = runReport.GetPlayerInfo(0); Chat.AddMessage("Got player indo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); } if (playerInfo != null) { StatDef statDef = (StatDef)typeof(StatDef).GetField("totalDamageDealt").GetValue(null); sb2.AppendLine($"Damage dealt : {playerInfo.statSheet.GetStatDisplayValue(statDef)}"); } Chat.AddMessage("Yo!"); Chat.AddMessage("Damage Done : " + sb2.ToString()); orig(self); }; }
// Token: 0x060021AA RID: 8618 RVA: 0x0009E870 File Offset: 0x0009CA70 private void SetPlayerInfo([CanBeNull] RunReport.PlayerInfo playerInfo) { ulong num = 0UL; if (playerInfo != null) { StatSheet statSheet = playerInfo.statSheet; this.AllocateStatStrips(this.statsToDisplay.Length); for (int i = 0; i < this.statsToDisplay.Length; i++) { string text = this.statsToDisplay[i]; StatDef statDef = StatDef.Find(text); if (statDef == null) { Debug.LogWarningFormat("GameEndReportPanelController.SetStatSheet: Could not find stat def \"{0}\".", new object[] { text }); } else { this.AssignStatToStrip(statSheet, statDef, this.statStrips[i]); num += statSheet.GetStatPointValue(statDef); } } int unlockableCount = statSheet.GetUnlockableCount(); int num2 = 0; for (int j = 0; j < unlockableCount; j++) { if (!statSheet.GetUnlockable(j).hidden) { num2++; } } this.AllocateUnlockStrips(num2); int num3 = 0; for (int k = 0; k < unlockableCount; k++) { UnlockableDef unlockable = statSheet.GetUnlockable(k); if (!unlockable.hidden) { this.AssignUnlockToStrip(unlockable, this.unlockStrips[num3]); num3++; } } if (this.itemInventoryDisplay) { this.itemInventoryDisplay.SetItems(playerInfo.itemAcquisitionOrder, playerInfo.itemAcquisitionOrder.Length, playerInfo.itemStacks); this.itemInventoryDisplay.UpdateDisplay(); } } else { this.AllocateStatStrips(0); this.AllocateUnlockStrips(0); if (this.itemInventoryDisplay) { this.itemInventoryDisplay.ResetItems(); } } string @string = Language.GetString("STAT_POINTS_FORMAT"); this.totalPointsLabel.text = string.Format(@string, num); GameObject gameObject = null; if (playerInfo != null) { gameObject = BodyCatalog.GetBodyPrefab(playerInfo.bodyIndex); } string arg = ""; Texture texture = null; if (gameObject) { texture = gameObject.GetComponent <CharacterBody>().portraitIcon; arg = Language.GetString(gameObject.GetComponent <CharacterBody>().baseNameToken); } string string2 = Language.GetString("STAT_CLASS_NAME_FORMAT"); this.playerBodyLabel.text = string.Format(string2, arg); this.playerBodyPortraitImage.texture = texture; GameObject gameObject2 = null; if (playerInfo != null) { gameObject2 = BodyCatalog.GetBodyPrefab(playerInfo.killerBodyIndex); } string arg2 = ""; Texture texture2 = null; if (gameObject2) { texture2 = gameObject2.GetComponent <CharacterBody>().portraitIcon; arg2 = Language.GetString(gameObject2.GetComponent <CharacterBody>().baseNameToken); } string string3 = Language.GetString("STAT_KILLER_NAME_FORMAT"); this.killerBodyLabel.text = string.Format(string3, arg2); this.killerBodyPortraitImage.texture = texture2; this.killerPanelObject.SetActive(gameObject2); }