using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using PostLevelSummaryPlus.Helpers;
using PostLevelSummaryPlus.Models;
using PostLevelSummaryPlus.Patches;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using WebSocketSharp;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("ChunkinFlubber")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("PostLevelSummaryPlus")]
[assembly: AssemblyTitle("PostLevelSummaryPlus")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace PostLevelSummaryPlus
{
[BepInPlugin("ChunkinFlubber.PostLevelSummaryPlus", "PostLevelSummaryPlus", "1.1")]
public class PostLevelSummaryPlus : BaseUnityPlugin
{
public LevelValues Level = new LevelValues();
public GameObject TextInstance;
public TextMeshProUGUI ValueText;
public PhotonView MasterPhotonView;
internal static PostLevelSummaryPlus Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
private void Awake()
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_0049: Expected O, but got Unknown
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
if (Harmony == null)
{
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony val2 = val;
Harmony = val;
}
Harmony.PatchAll(typeof(LevelGeneratorPatches));
Harmony.PatchAll(typeof(PhysGrabObjectImpactDetectorPatches));
Harmony.PatchAll(typeof(RoundDirectorPatches));
Harmony.PatchAll(typeof(ExtractionPointPatches));
Harmony.PatchAll(typeof(PlayerAvatarPatches));
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
internal void Unpatch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
public void ResetValues()
{
if (!((Object)(object)Instance == (Object)null))
{
Instance.Level.Clear();
}
}
public void ReceivePostLevelSummary(string text)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)Instance == (Object)null))
{
RectTransform component = Instance.TextInstance.GetComponent<RectTransform>();
component.pivot = new Vector2(1f, 1f);
component.anchoredPosition = new Vector2(1f, -1f);
component.anchorMin = new Vector2(0f, 0f);
component.anchorMax = new Vector2(1f, 0f);
component.sizeDelta = new Vector2(0f, 0f);
component.offsetMax = new Vector2(0f, 225f);
component.offsetMin = new Vector2(0f, 225f);
((TMP_Text)Instance.ValueText).lineSpacing = -50f;
((TMP_Text)Instance.ValueText).SetText(text, true);
Instance.TextInstance.SetActive(true);
Logger.LogDebug((object)("Received Post Level Summary: " + text));
}
}
public void RemovePostLevelSummary()
{
if (!((Object)(object)Instance == (Object)null))
{
Logger.LogDebug((object)"Removing Post Level Summary Text");
((TMP_Text)Instance.ValueText).SetText("", true);
Instance.TextInstance.SetActive(false);
}
}
public static void LevelGenerationDone()
{
if ((Object)(object)Instance == (Object)null || !SemiFunc.IsMasterClientOrSingleplayer())
{
return;
}
Logger.LogDebug((object)("Done generating new level " + ((Object)RunManager.instance.levelCurrent).name));
bool flag = SemiFunc.RunIsShop();
if (flag)
{
UI.Update();
Instance.TextInstance.SetActive(true);
}
else if (SemiFunc.RunIsLevel() || SemiFunc.RunIsArena())
{
Instance.ResetValues();
Instance.TextInstance.SetActive(false);
}
Instance.Level.TotalItems = ValuableDirector.instance.valuableList.Count;
ValuableDirector.instance.valuableList.ForEach(delegate(ValuableObject valuable)
{
Instance.Level.TotalValue += valuable.dollarValueCurrent;
});
Logger.LogDebug((object)$"Items {Instance.Level.TotalItems} with total value {Instance.Level.TotalValue}!");
if ((Object)(object)Instance.MasterPhotonView != (Object)null)
{
if (flag)
{
Logger.LogDebug((object)"Sending summary text");
Instance.MasterPhotonView.RPC("ReceivePostLevelSummaryRPC", (RpcTarget)1, new object[1] { ((TMP_Text)Instance.ValueText).text });
}
else
{
Logger.LogDebug((object)"Sending remove summary");
Instance.MasterPhotonView.RPC("RemovePostLevelSummaryRPC", (RpcTarget)1, Array.Empty<object>());
}
}
}
internal static void RequestPostLevelSummary(Player requestor)
{
if (!((Object)(object)Instance == (Object)null) && !((Object)(object)Instance.MasterPhotonView == (Object)null) && PhotonNetwork.IsMasterClient && PhotonNetwork.IsConnectedAndReady)
{
Logger.LogDebug((object)"Received client request for summary");
if (!SemiFunc.RunIsShop() && PhotonNetwork.IsMasterClient && PhotonNetwork.IsConnectedAndReady)
{
Logger.LogDebug((object)"Sending remove summary");
Instance.MasterPhotonView.RPC("RemovePostLevelSummaryRPC", requestor, Array.Empty<object>());
}
else if (SemiFunc.RunIsShop())
{
Logger.LogDebug((object)"Sending summary text");
Instance.MasterPhotonView.RPC("ReceivePostLevelSummaryRPC", requestor, new object[1] { ((TMP_Text)Instance.ValueText).text });
}
}
}
}
public class PostLevelSummaryPlayerAttachment : MonoBehaviour
{
[PunRPC]
public void ReceivePostLevelSummaryRPC(string summary)
{
PostLevelSummaryPlus.Instance.ReceivePostLevelSummary(summary);
}
[PunRPC]
public void RemovePostLevelSummaryRPC()
{
PostLevelSummaryPlus.Instance.RemovePostLevelSummary();
}
[PunRPC]
public void RequestPostLevelSummaryRPC(PhotonMessageInfo info)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
PostLevelSummaryPlus.RequestPostLevelSummary(info.Sender);
}
}
public static class UI
{
public static void Init()
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)PostLevelSummaryPlus.Instance == (Object)null))
{
GameObject val = GameObject.Find("Game Hud");
GameObject val2 = GameObject.Find("Tax Haul");
TMP_FontAsset font = val2.GetComponent<TMP_Text>().font;
PostLevelSummaryPlus.Instance.TextInstance = new GameObject();
PostLevelSummaryPlus.Instance.TextInstance.SetActive(false);
((Object)PostLevelSummaryPlus.Instance.TextInstance).name = "Summary HUD";
PostLevelSummaryPlus.Instance.TextInstance.AddComponent<TextMeshProUGUI>();
PostLevelSummaryPlus.Instance.ValueText = PostLevelSummaryPlus.Instance.TextInstance.GetComponent<TextMeshProUGUI>();
((TMP_Text)PostLevelSummaryPlus.Instance.ValueText).font = font;
((Graphic)PostLevelSummaryPlus.Instance.ValueText).color = Color.op_Implicit(new Vector4(0.7882f, 0.9137f, 0.902f, 1f));
((TMP_Text)PostLevelSummaryPlus.Instance.ValueText).fontSize = 18f;
((TMP_Text)PostLevelSummaryPlus.Instance.ValueText).enableWordWrapping = false;
((TMP_Text)PostLevelSummaryPlus.Instance.ValueText).alignment = (TextAlignmentOptions)2052;
((TMP_Text)PostLevelSummaryPlus.Instance.ValueText).horizontalAlignment = (HorizontalAlignmentOptions)4;
((TMP_Text)PostLevelSummaryPlus.Instance.ValueText).verticalAlignment = (VerticalAlignmentOptions)2048;
PostLevelSummaryPlus.Instance.TextInstance.transform.SetParent(val.transform, false);
RectTransform component = PostLevelSummaryPlus.Instance.TextInstance.GetComponent<RectTransform>();
component.pivot = new Vector2(1f, 1f);
component.anchoredPosition = new Vector2(1f, -1f);
component.anchorMin = new Vector2(0f, 0f);
component.anchorMax = new Vector2(1f, 0f);
component.sizeDelta = new Vector2(0f, 0f);
component.offsetMax = new Vector2(0f, 225f);
component.offsetMin = new Vector2(0f, 225f);
PostLevelSummaryPlus.Logger.LogDebug((object)"HUD generated");
}
}
public static void Update()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)PostLevelSummaryPlus.Instance == (Object)null)
{
return;
}
RectTransform component = PostLevelSummaryPlus.Instance.TextInstance.GetComponent<RectTransform>();
component.pivot = new Vector2(1f, 1f);
component.anchoredPosition = new Vector2(1f, -1f);
component.anchorMin = new Vector2(0f, 0f);
component.anchorMax = new Vector2(1f, 0f);
component.sizeDelta = new Vector2(0f, 0f);
component.offsetMax = new Vector2(0f, 225f);
component.offsetMin = new Vector2(0f, 225f);
((TMP_Text)PostLevelSummaryPlus.Instance.ValueText).lineSpacing = -50f;
string text = "";
string text2 = "";
float num = 0f;
int num2 = 0;
foreach (PlayerStats playerStats in PostLevelSummaryPlus.Instance.Level.PlayerStatsList)
{
if (playerStats.ValueLost > num)
{
num = playerStats.ValueLost;
text = playerStats.PlayerName;
}
if (playerStats.ItemsBroken > num2)
{
num2 = playerStats.ItemsBroken;
text2 = playerStats.PlayerName;
}
}
((TMP_Text)PostLevelSummaryPlus.Instance.ValueText).SetText(string.Format("\r\n Session Totals:\r\n Extracted ${0}\r\n Lost ${1}\r\n Broken Items {2}\r\n\r\n Level Totals:\r\n Extracted ${3} out of ${4}\r\n {5} items out of {6}\r\n Lost ${7}\r\n {8} {9} broken ({10} hits)\r\n\r\n Congratulations {11}\r\n Congratulations {12}\r\n ", NumberFormatter.FormatToK(PostLevelSummaryPlus.Instance.Level.SessionExtractedValue), NumberFormatter.FormatToK(PostLevelSummaryPlus.Instance.Level.SessionTotalValueLost), PostLevelSummaryPlus.Instance.Level.SessionItemsBroken, NumberFormatter.FormatToK(PostLevelSummaryPlus.Instance.Level.ExtractedValue), NumberFormatter.FormatToK(PostLevelSummaryPlus.Instance.Level.TotalValue), PostLevelSummaryPlus.Instance.Level.ExtractedItems, PostLevelSummaryPlus.Instance.Level.TotalItems, NumberFormatter.FormatToK(PostLevelSummaryPlus.Instance.Level.TotalValueLost), PostLevelSummaryPlus.Instance.Level.ItemsBroken, "item" + ((PostLevelSummaryPlus.Instance.Level.ItemsBroken == 1) ? "" : "s"), PostLevelSummaryPlus.Instance.Level.ItemsHit, string.Format(Ext.IsNullOrEmpty(text2) ? "for not breaking anything!" : $"to {text2} for breaking the most items ({num2})!"), string.Format(Ext.IsNullOrEmpty(text) ? "for not losing any value!" : $"to {text} for losing the most value ({num})!")), true);
}
}
}
namespace PostLevelSummaryPlus.Patches
{
[HarmonyPatch(typeof(ExtractionPoint))]
internal class ExtractionPointPatches
{
[HarmonyPostfix]
[HarmonyPatch("ExtractionPointSurplusRPC")]
public static void StateCompletePostfix(ExtractionPoint __instance)
{
if (SemiFunc.RunIsLevel() && (Object)(object)PostLevelSummaryPlus.Instance != (Object)null)
{
PostLevelSummaryPlus.Instance.Level.Extracted(__instance);
}
}
}
[HarmonyPatch(typeof(LevelGenerator))]
internal class LevelGeneratorPatches
{
[HarmonyPostfix]
[HarmonyPatch("GenerateDone")]
public static void GenerateDonePostfix()
{
PostLevelSummaryPlus.LevelGenerationDone();
}
}
[HarmonyPatch(typeof(PhysGrabObjectImpactDetector))]
internal class PhysGrabObjectImpactDetectorPatches
{
[HarmonyPostfix]
[HarmonyPatch("BreakRPC")]
private static void BreakPost(PhysGrabObjectImpactDetector? __instance, float valueLost, Vector3 _contactPoint, int breakLevel)
{
ValuableObject val = ((__instance != null) ? ((Component)__instance).GetComponent<ValuableObject>() : null);
if (!((Object)(object)val == (Object)null) && !((Object)(object)PostLevelSummaryPlus.Instance == (Object)null))
{
PostLevelSummaryPlus.Instance.Level.CheckValueChange(val, valueLost);
}
}
}
[HarmonyPatch(typeof(PlayerAvatar), "Awake")]
public class PlayerAvatarPatches
{
private static void Postfix(PlayerAvatar __instance)
{
if (!SemiFunc.IsMasterClientOrSingleplayer() && !PhotonNetwork.IsConnectedAndReady)
{
return;
}
PostLevelSummaryPlayerAttachment component = ((Component)__instance).GetComponent<PostLevelSummaryPlayerAttachment>();
PhotonView component2 = ((Component)__instance).GetComponent<PhotonView>();
if ((Object)(object)component == (Object)null)
{
((Component)__instance).gameObject.AddComponent<PostLevelSummaryPlayerAttachment>();
if ((Object)(object)component2 != (Object)null && component2.IsMine)
{
component2.RPC("RequestPostLevelSummaryRPC", (RpcTarget)2, Array.Empty<object>());
}
PostLevelSummaryPlus.Logger.LogDebug((object)("Added PLSAttachment component to PlayerAvatar: " + ((Object)__instance).name));
}
if ((Object)(object)component2 != (Object)null && component2.IsMine && PhotonNetwork.IsMasterClient)
{
PostLevelSummaryPlus.Instance.MasterPhotonView = component2;
PostLevelSummaryPlus.Logger.LogDebug((object)("Set MasterPhotonView for local PlayerAvatar: " + ((Object)__instance).name));
}
}
}
[HarmonyPatch(typeof(MenuManager))]
internal class RoundDirectorPatches
{
[HarmonyPostfix]
[HarmonyPatch(typeof(MenuManager), "Awake")]
public static void Awake()
{
if (!((Object)(object)PostLevelSummaryPlus.Instance == (Object)null))
{
if ((Object)(object)PostLevelSummaryPlus.Instance.TextInstance == (Object)null)
{
UI.Init();
}
UI.Update();
}
}
}
}
namespace PostLevelSummaryPlus.Models
{
public class LevelValues
{
public int TotalItems;
public float TotalValue;
public readonly List<PlayerStats> PlayerStatsList = new List<PlayerStats>();
public int ItemsHit;
public float TotalValueLost;
public int ItemsBroken;
public float ExtractedValue;
public int ExtractedItems;
public float SessionExtractedValue;
public float SessionTotalValueLost;
public int SessionItemsBroken;
public void Clear()
{
PostLevelSummaryPlus.Logger.LogDebug((object)"Clearing level values!");
TotalItems = 0;
TotalValue = 0f;
PlayerStatsList.Clear();
ItemsHit = 0;
TotalValueLost = 0f;
ItemsBroken = 0;
ExtractedValue = 0f;
ExtractedItems = 0;
}
public void CheckValueChange(ValuableObject val, float valueLost)
{
if (valueLost <= 0f)
{
return;
}
PostLevelSummaryPlus.Logger.LogDebug((object)$"{((Object)val).name} lost {valueLost} value!");
ItemsHit++;
TotalValueLost += valueLost;
SessionTotalValueLost += valueLost;
PhysGrabObject grabObject = ((Component)val).GetComponent<PhysGrabObject>();
if ((Object)(object)grabObject != (Object)null)
{
if (grabObject.playerGrabbing.Count > 0)
{
float num = valueLost / (float)grabObject.playerGrabbing.Count;
foreach (PhysGrabber physGrabber in grabObject.playerGrabbing)
{
PlayerStats playerStats = PlayerStatsList.Find((PlayerStats player) => player.PlayerName == physGrabber.playerAvatar.playerName);
if (playerStats == null)
{
playerStats = new PlayerStats(physGrabber.playerAvatar.playerName);
PlayerStatsList.Add(playerStats);
}
playerStats.ValueLost += num;
}
}
else if ((Object)(object)grabObject.lastPlayerGrabbing != (Object)null)
{
PlayerStats playerStats2 = PlayerStatsList.Find((PlayerStats player) => player.PlayerName == grabObject.lastPlayerGrabbing.playerName);
if (playerStats2 == null)
{
playerStats2 = new PlayerStats(grabObject.lastPlayerGrabbing.playerName);
PlayerStatsList.Add(playerStats2);
}
playerStats2.ValueLost += valueLost;
}
}
if (valueLost >= val.dollarValueCurrent)
{
ItemBroken(val);
}
}
private void ItemBroken(ValuableObject val)
{
PostLevelSummaryPlus.Logger.LogDebug((object)("Broken " + ((Object)val).name + "!"));
ItemsBroken++;
SessionItemsBroken++;
PhysGrabObject grabObject = ((Component)val).GetComponent<PhysGrabObject>();
if (!((Object)(object)grabObject != (Object)null))
{
return;
}
if (grabObject.playerGrabbing.Count > 0)
{
foreach (PhysGrabber physGrabber in grabObject.playerGrabbing)
{
PlayerStats playerStats = PlayerStatsList.Find((PlayerStats player) => player.PlayerName == physGrabber.playerAvatar.playerName);
if (playerStats == null)
{
playerStats = new PlayerStats(physGrabber.playerAvatar.playerName);
PlayerStatsList.Add(playerStats);
}
playerStats.ItemsBroken++;
}
return;
}
if ((Object)(object)grabObject.lastPlayerGrabbing != (Object)null)
{
PlayerStats playerStats2 = PlayerStatsList.Find((PlayerStats player) => player.PlayerName == grabObject.lastPlayerGrabbing.playerName);
if (playerStats2 == null)
{
playerStats2 = new PlayerStats(grabObject.lastPlayerGrabbing.playerName);
PlayerStatsList.Add(playerStats2);
}
playerStats2.ItemsBroken++;
}
}
public void Extracted(ExtractionPoint extract)
{
PostLevelSummaryPlus.Logger.LogDebug((object)$"Haul of {extract.haulCurrent} extracted!");
PostLevelSummaryPlus.Logger.LogDebug((object)$"{extract.amountOfValuables} extracted!");
ExtractedValue += extract.haulCurrent;
ExtractedItems += extract.amountOfValuables;
SessionExtractedValue += extract.haulCurrent;
}
}
public class PlayerStats
{
public string PlayerName { get; set; }
public float ValueLost { get; set; }
public int ItemsBroken { get; set; }
public PlayerStats(string playerName)
{
PlayerName = playerName;
ValueLost = 0f;
ItemsBroken = 0;
}
}
public struct PostLevelSummaryEventData
{
public string Text;
public bool ShouldShowText;
public PostLevelSummaryEventData(string text, bool shouldShowText)
{
Text = text;
ShouldShowText = shouldShowText;
}
}
}
namespace PostLevelSummaryPlus.Helpers
{
public static class NumberFormatter
{
public static string FormatToK(float value)
{
if (value >= 1000f)
{
return $"{value / 1000f:0.#}k";
}
return value.ToString("0");
}
}
}