Decompiled source of LTOWFruitSaloonMod v1.0.0
LTOWFruitSaloonMod.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using InventoryInteractions; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>(); } } [CreateAssetMenu(menuName = "LCFruitSaloonMod/AllAssets", order = 0)] public class AllAssets : ScriptableObject { [Header("GameObjects")] public GameObject managerPrefab; public GameObject settingsUiPrefab; public GameObject saloonPrefab; public GameObject fruitJuicePrefab; [Space(3f)] [Header("AssetsCollection")] public TMP_FontAsset originalFontThin; public TMP_FontAsset originalFontThick; public TMP_FontAsset originalFontScribbly; public TMP_FontAsset originalFontShadowless; public Sprite cactusFruitIcon; public Sprite menuBacker; public Sprite checkmarkSprite; public Sprite crossSprite; } public class Configs { private static ManualLogSource Logger; public static ConfigEntry<bool> enableMatchSettings; public static ConfigEntry<bool> saveMatchSettings; public static ConfigEntry<bool> saloonEnabled; public static ConfigEntry<string> saloonDifficulty; public static ConfigEntry<int> saloonCustomRequirement; public static ConfigEntry<int> saloonHealAmount; public static ConfigEntry<int> saloonDigestionPenalties; public static ConfigEntry<bool> saloonJuiceOverheal; public static ConfigEntry<bool> secretTrunkSpawnable; public static void GetLogger(ManualLogSource PluginLogger) { Logger = PluginLogger; } public Configs(ConfigFile cfg) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown enableMatchSettings = cfg.Bind<bool>("Menu", "Enable Settings Panel", true, "Set whether or not the lobby's Match Settings menu will get an extra Fruit Saloon panel where the saloon's settings can be changed.\nLobby host's values are used."); saveMatchSettings = cfg.Bind<bool>("Menu", "Save Selected Settings", true, "If [Enable Settings Panel] is set to true, set whether your changes made in the in-game Fruit Saloon Match Settings panel will be written to this mod's Config file, so they will not be lost between play sessions."); saloonEnabled = cfg.Bind<bool>("Customization", "Spawn Saloon", true, "Set whether or not a saloon will spawn where Cactus Fruits can be converted into Fruit Juice.\nLobby host's values are used."); saloonDifficulty = cfg.Bind<string>("Customization", "Fruit Required Difficulty", "Medium", "Set the difficulty level of how easy or hard it should be to collect enough Cactus Fruits for one Fruit Juice.\nAcceptable values: Dandylion, Easy, Medium, Hard, Wormfood, Custom\nLobby host's values are used."); saloonCustomRequirement = cfg.Bind<int>("Customization", "Custom Fruit Required", 6, new ConfigDescription("If [Fruit Required Difficulty] is set to Custom, set how many Cactus Fruits need to be collected for one Fruit Juice.\nLobby host's values are used.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 35), Array.Empty<object>())); saloonHealAmount = cfg.Bind<int>("Customization", "Juice Heal Amount", 100, new ConfigDescription("Set how much health one Fruit Juice will heal the pardner who drinks it.\nWill be averaged to the nearest multiple of 5.\nLobby host's values are used.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 400), Array.Empty<object>())); saloonDigestionPenalties = cfg.Bind<int>("Customization", "Juice Digestion Penalties", 2, new ConfigDescription("Set how many Digestion Per Fruit penalties will be applied when drinking one Fruit Juice.\nLobby host's values are used.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 35), Array.Empty<object>())); saloonJuiceOverheal = cfg.Bind<bool>("Customization", "Juice Overhealing", true, "Set whether or not Fruit Juice can heal pardners past their max health.\nLobby host's values are used."); secretTrunkSpawnable = cfg.Bind<bool>("Secret", "Juice in Chests", false, "Hide some Fruit Juices in chests."); } public static void DisplayConfigs() { if (saloonEnabled.Value) { Logger.LogInfo((object)"Config [Spawn Saloon] is set to TRUE. A saloon where Cactus Fruits can be pressed into Fruit Juice will spawn at the far end of town."); } else { Logger.LogInfo((object)"Config [Spawn Saloon] is set to FALSE. No saloon will spawn, and thus Fruit Juice will not be obtainable through the saloon."); } string text = saloonDifficulty.Value.ToLower(); switch (text) { case "dandylion": case "easy": case "medium": case "hard": case "wormfood": case "custom": Logger.LogInfo((object)("Config [Fruit Required Difficulty] received input: " + saloonDifficulty.Value)); break; default: Logger.LogWarning((object)("Config [Fruit Required Difficulty] received invalid input: " + saloonDifficulty.Value + ". Acceptable values: Easy, Medium, Hard, Wormfood, Custom. Resetting to Medium.")); saloonDifficulty.Value = "Medium"; break; } if (text == "custom") { Logger.LogInfo((object)$"Config [Custom Fruit Required] is set to a value of {saloonCustomRequirement.Value}"); } if (saloonHealAmount.Value % 5 != 0) { int num = Plugin.RoundToNearest(saloonHealAmount.Value, 5); Logger.LogDebug((object)$"rounding [Juice Heal Amount] from {saloonHealAmount.Value} to {num}"); saloonHealAmount.Value = num; } Logger.LogInfo((object)$"Config [Juice Heal Amount] is set to a value of {saloonHealAmount.Value}"); Logger.LogInfo((object)$"Config [Juice Digestion Penalties] is set to a value of {saloonDigestionPenalties.Value}"); if (saloonJuiceOverheal.Value) { Logger.LogInfo((object)"Config [Juice Overhealing] is set to TRUE. Fruit Juice will be able to increase pardner's max health if [Juice Heal Amount] surpasses it."); } else { Logger.LogInfo((object)"Config [Juice Overhealing] is set to FALSE. Fruit Juice will never heal pardners past their max health, and cannot be drank at all if pardners are at max health."); } if (enableMatchSettings.Value) { Logger.LogInfo((object)"Config [Enable Settings Panel] is set to TRUE. The lobby's Match Settings menu will gain an additional Fruit Saloon panel on all players joining your lobby."); if (saveMatchSettings.Value) { Logger.LogInfo((object)"Config [Save Selected Settings] is set to TRUE. If you make changes in the Match Setting's Fruit Saloon panel, they will be saved to your local Config file so they can be loaded next time you open the game."); } else { Logger.LogInfo((object)"Config [Save Selected Settings] is set to FALSE. Changes made in the Match Setting's Fruit Saloon panel will not be saved to your Config file."); } } else { Logger.LogInfo((object)"Config [Enable Settings Panel] is set to FALSE. You will not be able to edit Fruit Saloon settings from your in-game lobbies, nor will people joining you be able to make suggestions."); } if (secretTrunkSpawnable.Value) { Logger.LogDebug((object)"Config [Juice in Chests] is set to TRUE. Fruit Juice will be able to spawn in chests scattered around the map."); } } public static void SaveConfigs(FruitSaloonManager __instance) { if (enableMatchSettings.Value && saveMatchSettings.Value) { Logger.LogInfo((object)"Saving Fruit Saloon Match Settings..."); saloonEnabled.Value = __instance.saloonEnabled_SyncVar.Value; string text = "Medium"; text = __instance.difficultyLevel_SyncVar.Value switch { 0 => "Dandylion", 1 => "Easy", 3 => "Hard", 4 => "Wormfood", 5 => "Custom", _ => "Medium", }; saloonDifficulty.Value = text; saloonCustomRequirement.Value = __instance.customRequirement_SyncVar.Value; saloonHealAmount.Value = __instance.juiceHealAmount_SyncVar.Value; saloonDigestionPenalties.Value = __instance.juiceDigestionPenalties_SyncVar.Value; saloonJuiceOverheal.Value = __instance.juiceOverheal_SyncVar.Value; } } } public class FruitJuiceItem : NetworkBehaviour, IHeldObjectUsable { private static ManualLogSource Logger; private bool canOverheal; private int digestionPenalties; public PickUppable pickUpScript; public float fuelMultiplier; public float chompsMultiplier; public static void GetLogger(ManualLogSource PluginLogger) { Logger = PluginLogger; } private void Start() { Logger.LogDebug((object)$"Start() on {this} #{((NetworkBehaviour)this).NetworkObjectId}"); if (Object.op_Implicit((Object)(object)FruitSaloonManager.Singleton)) { FruitSaloonManager.Singleton.SetUpFruitJuiceVariables(this); } } public void SetUpUsingConfigs(int configHealAmount, bool configHealPastMax, int configDigestionPenalties, int fruitRequiredVal) { pickUpScript.sprintJuiceOnConsume = configHealAmount; canOverheal = configHealPastMax; digestionPenalties = configDigestionPenalties; Logger.LogDebug((object)$"{this} #{((NetworkBehaviour)this).NetworkObjectId} // sprintJuiceOnConsume: {pickUpScript.sprintJuiceOnConsume} | canOverheal: {canOverheal} | digestionPenalties: {digestionPenalties}"); pickUpScript.fuelValue = Mathf.Max(1, (int)((float)fruitRequiredVal * fuelMultiplier)); pickUpScript.numberOfChompsToEat = Mathf.Max(1, (int)((float)fruitRequiredVal * chompsMultiplier)); Logger.LogDebug((object)$"{this} #{((NetworkBehaviour)this).NetworkObjectId} // fruitRequiredVal: {fruitRequiredVal} | fuelValue: {pickUpScript.fuelValue} | numberOfChompsToEat: {pickUpScript.numberOfChompsToEat}"); } void IHeldObjectUsable.OnUse(ulong _clientIDWhoUsedIt, bool serverside) { Logger.LogDebug((object)$"OnUse() on {this} #{((NetworkBehaviour)this).NetworkObjectId}"); } void IHeldObjectUsable.Use_LocalOnly() { Logger.LogDebug((object)$"Use_LocalOnly() on {this} #{((NetworkBehaviour)this).NetworkObjectId}"); StartConsumingFruitJuice(); } void IHeldObjectUsable.UseCancelled_Client(ulong _clientIDWhoUsedIt) { Logger.LogDebug((object)$"UseCancelled_Client() on {this} #{((NetworkBehaviour)this).NetworkObjectId}"); } private bool CheckIfCanConsumeItem() { if (!Object.op_Implicit((Object)(object)pickUpScript)) { Logger.LogDebug((object)"A"); return false; } if (!Object.op_Implicit((Object)(object)AudioManager.Singleton)) { Logger.LogDebug((object)"B"); return false; } if (!Object.op_Implicit((Object)(object)NetworkManager.Singleton)) { Logger.LogDebug((object)"C"); return false; } Player component = ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[pickUpScript.playerObjectIDWhoisHoldingUs]).gameObject.GetComponent<Player>(); if (Object.op_Implicit((Object)(object)component) && ((!canOverheal && component.health >= component.maxHealth) || (canOverheal && component.health >= (float)GetMaxPossibleHealth()))) { Logger.LogDebug((object)"D"); return false; } return true; } private void StartConsumingFruitJuice() { //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_016a: Unknown result type (might be due to invalid IL or missing references) if (!CheckIfCanConsumeItem()) { return; } GameObject val = null; if (Object.op_Implicit((Object)(object)NetworkManager.Singleton)) { val = ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[pickUpScript.playerObjectIDWhoisHoldingUs]).gameObject; } if ((Object)(object)val == (Object)null) { Logger.LogError((object)"failed to reach Player object"); return; } Player component = val.GetComponent<Player>(); PlayerGrabber component2 = val.GetComponent<PlayerGrabber>(); if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null) { Logger.LogError((object)"failed to get Player scripts"); return; } Logger.LogInfo((object)$"attempting to consume {this} #{((NetworkBehaviour)this).NetworkObjectId}"); int num = (int)Mathf.Min(pickUpScript.sprintJuiceOnConsume, (float)GetMaxPossibleHealth() - component.maxHealth); Logger.LogDebug((object)$"amountToHeal: {num}"); component.GainHealth((float)num, canOverheal); if (digestionPenalties > 0) { for (int i = 0; i < digestionPenalties; i++) { Logger.LogDebug((object)$"applying digestionPenalty {i + 1}"); component.StoreNewCactusFruit(); } } component2.RequestNetworkInteraction((InventoryInteraction)new UseItem(((NetworkBehaviour)this).NetworkObject, true)); Logger.LogDebug((object)"successfully consumed item on owner, destroying?"); if (Object.op_Implicit((Object)(object)FruitSaloonManager.Singleton)) { FruitSaloonManager.Singleton.MakeNoise(isMiscSound: false, 20, ((Component)component).transform.position); } NetworkActions.Singleton.DestroyPickUpObject_ServerRPC(((NetworkBehaviour)this).NetworkObjectId); } public void OnPickUpValidated() { if (Object.op_Implicit((Object)(object)HudManager.Singleton) && Object.op_Implicit((Object)(object)pickUpScript) && (int)pickUpScript.playerObjectIDWhoisHoldingUs == Plugin.GetLocalPlayerNetworkId()) { Player component = GameManager.Singleton.localPlayerObject.GetComponent<Player>(); if (Object.op_Implicit((Object)(object)component) && ((!canOverheal && component.health < component.maxHealth) || (canOverheal && component.health < (float)GetMaxPossibleHealth()))) { HudManager.Singleton.DisplayNewHeldItemHint("Press X to drink", -1f); } } } private int GetMaxPossibleHealth() { int num = 400; bool flag = false; if (Object.op_Implicit((Object)(object)MatchSettingsManager.Singleton)) { Slider privateField = MatchSettingsManager.Singleton.GetPrivateField<Slider>("pardnerMaxHealth_Custom_Slider"); if (Object.op_Implicit((Object)(object)privateField)) { num = (int)privateField.maxValue * MatchSettingsManager.Singleton.GetPrivateField<int>("pardnerMaxHealth_Custom_Increment"); flag = true; } } Logger.LogDebug((object)$"GetMaxPossibleHealth(): toReturn = {num} (success? {flag})"); return num; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "FruitJuiceItem"; } } public class FruitPressTrigger : MonoBehaviour, IWorldUsable { private static ManualLogSource Logger; [Header("General")] public Transform fruitDeliveryPoint; public Transform spawnJuicePoint; private FruitSaloonManager managerScript; private bool readyToPressJuice; private bool currentlyPressingJuice; [Space(3f)] [Header("Audiovisual")] public Animator juicePressAnimator; public ParticleSystem juicePressParticles; public AudioSource audioSource; public AudioClip[] audioClips; [Space(3f)] [Header("Feedback")] public TextMeshProUGUI progressText; public GameObject checkmarkIcon; [Space] public string hintBringFruit; public string hintCurrentlyPressing; public static void GetLogger(ManualLogSource PluginLogger) { Logger = PluginLogger; } private void Start() { managerScript = Object.FindAnyObjectByType<FruitSaloonManager>(); if (!Object.op_Implicit((Object)(object)managerScript)) { Logger.LogError((object)(((Object)this).name + " failed to find managerScript")); } else { managerScript.LinkNewCactusFruitTrigger(this); } } private bool CanTriggerDeliverFruit() { if (!Object.op_Implicit((Object)(object)managerScript)) { return false; } if (currentlyPressingJuice) { PrintHint(hintCurrentlyPressing, 2); return false; } if (readyToPressJuice) { return false; } return true; } private void OnTriggerEnter(Collider other) { if (!CanTriggerDeliverFruit()) { Logger.LogDebug((object)"A1"); return; } PickUppable componentInParent = ((Component)other).GetComponentInParent<PickUppable>(); if (Object.op_Implicit((Object)(object)componentInParent) && componentInParent.isCactusFruit) { DeliverFruit(componentInParent); } } void IWorldUsable.Use(Player playerUsing) { Logger.LogDebug((object)"CactusFruitTrigger.Use()"); if (readyToPressJuice && !currentlyPressingJuice && Object.op_Implicit((Object)(object)FruitSaloonManager.Singleton)) { FruitSaloonManager.Singleton.StartPressingJuice(); return; } if (!CanTriggerDeliverFruit() || !Object.op_Implicit((Object)(object)playerUsing)) { Logger.LogDebug((object)"B1"); return; } PlayerGrabber component = ((Component)playerUsing).gameObject.GetComponent<PlayerGrabber>(); if (!Object.op_Implicit((Object)(object)component)) { Logger.LogDebug((object)"B2"); return; } GameObject heldObjectGameObject = component.heldObjectGameObject; if (!Object.op_Implicit((Object)(object)heldObjectGameObject)) { PrintHint(hintBringFruit); Logger.LogDebug((object)"B3"); return; } PickUppable componentInParent = heldObjectGameObject.GetComponentInParent<PickUppable>(); if (!Object.op_Implicit((Object)(object)componentInParent) || !componentInParent.isCactusFruit) { PrintHint(hintBringFruit); Logger.LogDebug((object)"B4"); } else { DeliverFruit(componentInParent, component); } } private void PrintHint(string hintToPrint, int timeToPrint = 5) { if (Object.op_Implicit((Object)(object)HudManager.Singleton)) { HudManager.Singleton.DisplayNewHeldItemHint(hintToPrint, (float)timeToPrint); } } private void DeliverFruit(PickUppable pickUpScript, PlayerGrabber deliveredBy = null) { Logger.LogDebug((object)$"{((Object)this).name} delivering {pickUpScript} #{((NetworkBehaviour)pickUpScript).NetworkObjectId}"); if (Object.op_Implicit((Object)(object)deliveredBy)) { RemoveFromInventory(deliveredBy); } if (Object.op_Implicit((Object)(object)managerScript)) { managerScript.CactusFruitDelivered(pickUpScript); } } private void RemoveFromInventory(PlayerGrabber removeFrom) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown Logger.LogDebug((object)$"attempting to remove from {removeFrom}"); removeFrom.RequestNetworkInteraction((InventoryInteraction)new DropHeldItem(Vector3.zero, fruitDeliveryPoint.position, Quaternion.identity)); } public void OnCompletedDelivery() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) readyToPressJuice = true; FruitSaloonManager.Singleton.MakeNoise(isMiscSound: true, 5, ((Component)audioSource).transform.position, sync: false); } public void UpdateProgressText(int newCurrent, int newMax) { ((TMP_Text)progressText).text = $"{newCurrent}/{newMax}"; Logger.LogDebug((object)(((TMP_Text)progressText).text ?? "")); SetCheckmarkActive(newCurrent >= newMax); } public void StartPressingJuiceOnTrigger() { juicePressAnimator.SetBool("PressJuice", true); } public void AnimationSetCurrentlyPressing(string setTo) { currentlyPressingJuice = Plugin.ConvertToBool(setTo); Logger.LogDebug((object)$"currentlyPressingJuice: {currentlyPressingJuice}"); if (currentlyPressingJuice) { checkmarkIcon.SetActive(false); } } public void AnimationPlayParticles() { juicePressParticles.Play(); Logger.LogDebug((object)"AnimationPlayParticles()"); } public void AnimationPlayAudio(int audioToPlay) { int num = Mathf.Clamp(audioToPlay, 0, audioClips.Length - 1); AudioClip val = audioClips[num]; float num2 = 1f; if (Object.op_Implicit((Object)(object)AudioManager.Singleton)) { num2 = AudioManager.Singleton.sfxVolume; } audioSource.PlayOneShot(val, num2); Logger.LogDebug((object)$"AnimationPlayAudio(): playing [{num}] '{((Object)val).name}'"); } public void AnimationFinished() { Logger.LogDebug((object)"AnimationFinished()"); managerScript.PressJuiceAnimationFinish(); juicePressAnimator.SetBool("PressJuice", false); readyToPressJuice = false; } private void SetCheckmarkActive(bool setTo) { checkmarkIcon.SetActive(setTo); ((Component)progressText).gameObject.SetActive(!setTo); } } public class FruitSaloonManager : NetworkBehaviour { private static ManualLogSource Logger; public static FruitSaloonManager Singleton; [Header("Netcode")] public NetworkVariable<bool> saloonEnabled_SyncVar = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<int> fruitRequired_SyncVar = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<int> fruitCurrent_SyncVar = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<int> difficultyLevel_SyncVar = new NetworkVariable<int>(2, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<int> customRequirement_SyncVar = new NetworkVariable<int>(6, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<int> juiceHealAmount_SyncVar = new NetworkVariable<int>(100, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<int> juiceDigestionPenalties_SyncVar = new NetworkVariable<int>(2, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> juiceOverheal_SyncVar = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); [Space(3f)] [Header("Static")] public float saloonTownOffsetMin; public float saloonTownOffsetMax; [Space(3f)] [Header("Runtime")] public float[] fruitDifficultyMultipliers; private FruitPressTrigger triggerObject; private List<int> netIDsDeliveredFruit = new List<int>(); public static void GetLogger(ManualLogSource PluginLogger) { Logger = PluginLogger; } private void Awake() { Logger.LogDebug((object)$"Awake() on {this}"); if (Object.op_Implicit((Object)(object)Singleton)) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { Singleton = this; } } public override void OnNetworkSpawn() { saloonEnabled_SyncVar.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Combine((Delegate?)(object)saloonEnabled_SyncVar.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(SaloonEnabled_OnValueChanged)); fruitCurrent_SyncVar.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)fruitCurrent_SyncVar.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(FruitCurrent_OnValueChanged)); fruitRequired_SyncVar.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)fruitRequired_SyncVar.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(FruitRequired_OnValueChanged)); difficultyLevel_SyncVar.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)difficultyLevel_SyncVar.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(DifficultyLevel_OnValueChanged)); customRequirement_SyncVar.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)customRequirement_SyncVar.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(CustomRequirement_OnValueChanged)); juiceHealAmount_SyncVar.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)juiceHealAmount_SyncVar.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(JuiceHealAmount_OnValueChanged)); juiceDigestionPenalties_SyncVar.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)juiceDigestionPenalties_SyncVar.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(JuiceDigestionPenalties_OnValueChanged)); juiceOverheal_SyncVar.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Combine((Delegate?)(object)juiceOverheal_SyncVar.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(JuiceOverheal_OnValueChanged)); ApplyConfigs(); } public override void OnNetworkDespawn() { saloonEnabled_SyncVar.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Remove((Delegate?)(object)saloonEnabled_SyncVar.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(SaloonEnabled_OnValueChanged)); fruitCurrent_SyncVar.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Remove((Delegate?)(object)fruitCurrent_SyncVar.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(FruitCurrent_OnValueChanged)); fruitRequired_SyncVar.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Remove((Delegate?)(object)fruitRequired_SyncVar.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(FruitRequired_OnValueChanged)); difficultyLevel_SyncVar.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Remove((Delegate?)(object)difficultyLevel_SyncVar.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(DifficultyLevel_OnValueChanged)); customRequirement_SyncVar.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Remove((Delegate?)(object)customRequirement_SyncVar.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(CustomRequirement_OnValueChanged)); juiceHealAmount_SyncVar.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Remove((Delegate?)(object)juiceHealAmount_SyncVar.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(JuiceHealAmount_OnValueChanged)); juiceDigestionPenalties_SyncVar.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Remove((Delegate?)(object)juiceDigestionPenalties_SyncVar.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(JuiceDigestionPenalties_OnValueChanged)); juiceOverheal_SyncVar.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Remove((Delegate?)(object)juiceOverheal_SyncVar.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(JuiceOverheal_OnValueChanged)); } private void ApplyConfigs() { if (((NetworkBehaviour)this).IsServer) { saloonEnabled_SyncVar.Value = Configs.saloonEnabled.Value; int num = 1; num = Configs.saloonDifficulty.Value.ToLower() switch { "dandylion" => 0, "easy" => 1, "hard" => 3, "wormfood" => 4, "custom" => 5, _ => 2, }; difficultyLevel_SyncVar.Value = num; customRequirement_SyncVar.Value = Configs.saloonCustomRequirement.Value; juiceHealAmount_SyncVar.Value = Configs.saloonHealAmount.Value; juiceDigestionPenalties_SyncVar.Value = Configs.saloonDigestionPenalties.Value; juiceOverheal_SyncVar.Value = Configs.saloonJuiceOverheal.Value; } } private void SaloonEnabled_OnValueChanged(bool _oldVal, bool _newVal) { Logger.LogInfo((object)$"SaloonEnabled_OnValueChanged(): {saloonEnabled_SyncVar.Value}"); if (Object.op_Implicit((Object)(object)FruitSaloonMatchSettings.Singleton)) { FruitSaloonMatchSettings.Singleton.OnValueChanged_SaloonEnabled(); } } private void FruitCurrent_OnValueChanged(int _oldVal, int _newVal) { Logger.LogInfo((object)$"FruitCurrent_OnValueChanged(): {fruitCurrent_SyncVar.Value}"); if (Object.op_Implicit((Object)(object)triggerObject)) { triggerObject.UpdateProgressText(fruitCurrent_SyncVar.Value, fruitRequired_SyncVar.Value); } CheckEnoughFruitDelivered(); } private void FruitRequired_OnValueChanged(int _oldVal, int _newVal) { Logger.LogInfo((object)$"FruitRequired_OnValueChanged(): {fruitRequired_SyncVar.Value}"); if (Object.op_Implicit((Object)(object)triggerObject)) { triggerObject.UpdateProgressText(fruitCurrent_SyncVar.Value, fruitRequired_SyncVar.Value); } } private void DifficultyLevel_OnValueChanged(int _oldVal, int _newVal) { Logger.LogInfo((object)$"DifficultyLevel_OnValueChanged(): {difficultyLevel_SyncVar.Value}"); if (Object.op_Implicit((Object)(object)FruitSaloonMatchSettings.Singleton)) { FruitSaloonMatchSettings.Singleton.OnValueChanged_DifficultyLevel(); } } private void CustomRequirement_OnValueChanged(int _oldVal, int _newVal) { Logger.LogInfo((object)$"CustomRequirement_OnValueChanged(): {customRequirement_SyncVar.Value}"); if (Object.op_Implicit((Object)(object)FruitSaloonMatchSettings.Singleton)) { FruitSaloonMatchSettings.Singleton.OnValueChanged_CustomRequirement(); } } private void JuiceHealAmount_OnValueChanged(int _oldVal, int _newVal) { Logger.LogInfo((object)$"JuiceHealAmount_OnValueChanged(): {juiceHealAmount_SyncVar.Value}"); if (Object.op_Implicit((Object)(object)FruitSaloonMatchSettings.Singleton)) { FruitSaloonMatchSettings.Singleton.OnValueChanged_JuiceHealAmount(); } } private void JuiceDigestionPenalties_OnValueChanged(int _oldVal, int _newVal) { Logger.LogInfo((object)$"JuiceDigestionPenalties_OnValueChanged(): {juiceDigestionPenalties_SyncVar.Value}"); if (Object.op_Implicit((Object)(object)FruitSaloonMatchSettings.Singleton)) { FruitSaloonMatchSettings.Singleton.OnValueChanged_JuiceDigestionPenalties(); } } private void JuiceOverheal_OnValueChanged(bool _oldVal, bool _newVal) { Logger.LogInfo((object)$"JuiceOverheal_OnValueChanged(): {juiceOverheal_SyncVar.Value}"); if (Object.op_Implicit((Object)(object)FruitSaloonMatchSettings.Singleton)) { FruitSaloonMatchSettings.Singleton.OnValueChanged_JuiceOverhealEnabled(); } } public void SetUpFruitJuiceVariables(FruitJuiceItem itemScript) { Logger.LogDebug((object)$"SetUpFruitJuiceVariables() for {itemScript} #{((NetworkBehaviour)itemScript).NetworkObjectId}"); itemScript.SetUpUsingConfigs(juiceHealAmount_SyncVar.Value, juiceOverheal_SyncVar.Value, juiceDigestionPenalties_SyncVar.Value, fruitRequired_SyncVar.Value); } public void SetUpSaloonThisRound() { Logger.LogDebug((object)"SetUpSaloonThisRound()"); if (((NetworkBehaviour)this).IsServer) { Configs.SaveConfigs(this); if (saloonEnabled_SyncVar.Value) { Logger.LogDebug((object)"succeeded all checks, moving on!"); SetUpFruitRequired(); SpawnSaloonPrefab(); } else { Logger.LogDebug((object)$"saloonEnabled_SyncVar.Value: {saloonEnabled_SyncVar.Value}"); } } else { Logger.LogDebug((object)$"IsServer: {((NetworkBehaviour)this).IsServer}"); } } public void SetUpFruitRequired(bool calculateWormfoodDifficulty = false) { netIDsDeliveredFruit.Clear(); int num = LobbyManager.Singleton.humanTeam.Count * MatchSettingsManager.Singleton.cactusFruitsPerPardner_Current + MatchSettingsManager.Singleton.cactusFruitsAdditional_Current; int num2 = 5; num2 = ((difficultyLevel_SyncVar.Value == 5) ? customRequirement_SyncVar.Value : ((!calculateWormfoodDifficulty || difficultyLevel_SyncVar.Value != 4) ? ((int)((float)num * fruitDifficultyMultipliers[Mathf.Clamp(difficultyLevel_SyncVar.Value, 0, fruitDifficultyMultipliers.Length - 1)])) : ((int)((float)num * fruitDifficultyMultipliers[Mathf.Clamp(difficultyLevel_SyncVar.Value, 0, fruitDifficultyMultipliers.Length - 1)]) + FindEverySpawnableCactusFruit()))); netIDsDeliveredFruit.Clear(); fruitRequired_SyncVar.Value = Mathf.Max(1, num2); fruitCurrent_SyncVar.Value = 0; Logger.LogDebug((object)$"fruitRequired_SyncVar.Value: {fruitRequired_SyncVar.Value}"); } private int FindEverySpawnableCactusFruit() { int num = 0; Logger.LogDebug((object)$"!!!Starting Wormfood Difficulty FindEverySpawnableCactusFruit()!!! fruitsToCount: {num}"); LootTrunk[] array = Object.FindObjectsByType<LootTrunk>((FindObjectsSortMode)0); Logger.LogDebug((object)$"allLootTrunks.Length = {array.Length}"); foreach (LootTrunk val in array) { if (!Object.op_Implicit((Object)(object)val) || val.lootPrefabs == null || val.lootPrefabs.Count == 0) { continue; } for (int j = 0; j < val.lootPrefabs.Count; j++) { GameObject val2 = val.lootPrefabs[j]; if (Object.op_Implicit((Object)(object)val2) && PrefabAcceptedByFruitPress(val2)) { Logger.LogDebug((object)$"lootTrunk #{((NetworkBehaviour)val).NetworkObjectId} lootPrefab [{j}] {val2} valid"); num++; } } } Diggable[] array2 = Object.FindObjectsByType<Diggable>((FindObjectsSortMode)0); Logger.LogDebug((object)$"allDiggables.Length = {array2.Length}"); foreach (Diggable val3 in array2) { if (Object.op_Implicit((Object)(object)val3)) { GameObject privateField = val3.GetPrivateField<GameObject>("randoPrefab"); if (Object.op_Implicit((Object)(object)privateField) && PrefabAcceptedByFruitPress(privateField)) { Logger.LogDebug((object)$"diggable #{((NetworkBehaviour)val3).NetworkObjectId} randomPrefab {privateField} valid"); num++; } } } int num2 = Mathf.Max(0, num); Logger.LogDebug((object)$"returning {num2}"); return num2; } private bool PrefabAcceptedByFruitPress(GameObject randomPrefab) { if (!Object.op_Implicit((Object)(object)randomPrefab)) { return false; } PickUppable component = randomPrefab.GetComponent<PickUppable>(); if (!Object.op_Implicit((Object)(object)component)) { return false; } if (component.isCactusFruit) { return true; } return false; } public void LinkNewCactusFruitTrigger(FruitPressTrigger newTrigger) { triggerObject = newTrigger; Logger.LogDebug((object)$"{this} received {triggerObject}"); triggerObject.UpdateProgressText(fruitCurrent_SyncVar.Value, fruitRequired_SyncVar.Value); } private void SpawnSaloonPrefab() { if (((NetworkBehaviour)this).IsServer && Object.op_Implicit((Object)(object)Plugin.allAssets.saloonPrefab)) { SetSaloonPrefabSpawnPoint(); } } private void SetSaloonPrefabSpawnPoint() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown Vector3 val = Vector3.zero; Vector3 val2 = Vector3.zero; if (Object.op_Implicit((Object)(object)MapLayoutPrefabLoader.Singleton) && Object.op_Implicit((Object)(object)MapLayoutPrefabLoader.Singleton.activeMapLayout)) { val = MapLayoutPrefabLoader.Singleton.activeMapLayout.town_POS; val2 = MapLayoutPrefabLoader.Singleton.activeMapLayout.town_ROT; GameObject val3 = new GameObject("tempTownObject"); val3.transform.position = val; val3.transform.eulerAngles = val2; float num = Random.Range(saloonTownOffsetMin, saloonTownOffsetMax); Logger.LogDebug((object)$"randomOffset: {num}"); val = val3.transform.TransformPoint(new Vector3(0f, 0f, num)); Object.Destroy((Object)val3); } Logger.LogDebug((object)$"GetPrefabSpawnPoint: {val}"); val.y = GameManager.Singleton.CalculateSurfacedYPosition(val); Logger.LogDebug((object)$"readjusting Y to: {val.y}"); SpawnSaloonPrefab_ServerRPC(val, val2); } [ServerRpc(RequireOwnership = true)] private void SpawnSaloonPrefab_ServerRPC(Vector3 posToSpawn, Vector3 rotToSpawn) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Invalid comparison between Unknown and I4 //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3063810502u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref posToSpawn); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref rotToSpawn); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3063810502u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SpawnSaloonPrefab_ClientRPC(posToSpawn, rotToSpawn); } } [ClientRpc] private void SpawnSaloonPrefab_ClientRPC(Vector3 posToSpawn, Vector3 rotToSpawn) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(817089878u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref posToSpawn); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref rotToSpawn); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 817089878u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Logger.LogDebug((object)$"SPAWNING ON CLIENT AT {posToSpawn}"); CollapsibleBuilding component = Object.Instantiate<GameObject>(Plugin.allAssets.saloonPrefab, posToSpawn, Quaternion.Euler(rotToSpawn)).GetComponent<CollapsibleBuilding>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)MapLayoutPrefabCreator.Singleton) && MapLayoutPrefabCreator.Singleton.spawnedBuildings.Contains(component)) { component.buildingID = MapLayoutPrefabCreator.Singleton.spawnedBuildings.IndexOf(component); Logger.LogDebug((object)$"assigned {component} buildingID {component.buildingID}"); } } } public void CactusFruitDelivered(PickUppable pickUpScript, bool despawnFruit = true) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer) { int item = (int)((NetworkBehaviour)pickUpScript).NetworkObjectId; if (netIDsDeliveredFruit.Contains(item)) { Logger.LogDebug((object)"already delivered this fruit"); return; } netIDsDeliveredFruit.Add(item); NetworkVariable<int> obj = fruitCurrent_SyncVar; int value = obj.Value; obj.Value = value + 1; MakeNoise(isMiscSound: false, 11, ((Component)triggerObject.audioSource).transform.position); NetworkActions.Singleton.DestroyPickUpObject_ServerRPC(((NetworkBehaviour)pickUpScript).NetworkObjectId); Logger.LogDebug((object)$"increased fruitCurrent_SyncVar.Value to {fruitCurrent_SyncVar.Value}"); } } private void CheckEnoughFruitDelivered() { if (fruitCurrent_SyncVar.Value >= fruitRequired_SyncVar.Value) { Logger.LogDebug((object)"completed delivery"); triggerObject.OnCompletedDelivery(); } } public void StartPressingJuice(bool sync = true) { StartPressingJuiceLocal(); if (sync) { int localPlayerNetworkId = Plugin.GetLocalPlayerNetworkId(); Logger.LogDebug((object)$"player [{localPlayerNetworkId}] sending StartPressingJuice_ServerRPC()"); StartPressingJuice_ServerRPC(localPlayerNetworkId); } } [ServerRpc(RequireOwnership = false)] private void StartPressingJuice_ServerRPC(int localPlayerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1980941994u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, localPlayerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1980941994u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { StartPressingJuice_ClientRPC(localPlayerId); } } } [ClientRpc] private void StartPressingJuice_ClientRPC(int localPlayerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2294309545u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, localPlayerId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2294309545u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && localPlayerId != Plugin.GetLocalPlayerNetworkId()) { StartPressingJuiceLocal(); } } } private void StartPressingJuiceLocal() { Logger.LogInfo((object)"STARTING JUICE PRESS!!!"); triggerObject.StartPressingJuiceOnTrigger(); } public void PressJuiceAnimationFinish() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer) { Object.Instantiate<GameObject>(Plugin.allAssets.fruitJuicePrefab, triggerObject.spawnJuicePoint.position, Quaternion.identity).GetComponent<NetworkObject>().Spawn(false); fruitCurrent_SyncVar.Value = 0; netIDsDeliveredFruit.Clear(); } } public void MakeNoise(bool isMiscSound, int noiseIndex, Vector3 atPos, bool sync = true) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) MakeNoiseLocal(isMiscSound, noiseIndex, atPos); if (sync) { MakeNoise_ServerRPC(isMiscSound, noiseIndex, atPos, Plugin.GetLocalPlayerNetworkId()); } } [ServerRpc(RequireOwnership = false)] private void MakeNoise_ServerRPC(bool isMiscSound, int noiseIndex, Vector3 atPos, int localPlayerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2010075430u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isMiscSound, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, noiseIndex); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref atPos); BytePacker.WriteValueBitPacked(val2, localPlayerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2010075430u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { MakeNoise_ClientRPC(isMiscSound, noiseIndex, atPos, localPlayerId); } } } [ClientRpc] private void MakeNoise_ClientRPC(bool isMiscSound, int noiseIndex, Vector3 atPos, int localPlayerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1153422901u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isMiscSound, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, noiseIndex); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref atPos); BytePacker.WriteValueBitPacked(val2, localPlayerId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1153422901u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && localPlayerId != Plugin.GetLocalPlayerNetworkId()) { MakeNoiseLocal(isMiscSound, noiseIndex, atPos); } } } private void MakeNoiseLocal(bool isMiscSound, int noiseIndex, Vector3 atPos) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)AudioManager.Singleton)) { if (isMiscSound) { triggerObject.audioSource.PlayOneShot(AudioManager.Singleton.miscSounds[noiseIndex], AudioManager.Singleton.sfxVolume); } else { Object.Instantiate<GameObject>(AudioManager.Singleton.audioOneShots[noiseIndex], atPos, Quaternion.identity); } } } public void RequestEnablingSettingsPanel(int localClientId) { Logger.LogDebug((object)$"CLIENT requesting EnableSettingsPanel with clientId: [{localClientId}]"); EnableSettingsPanel_ServerRPC(localClientId); } [ServerRpc(RequireOwnership = false)] private void EnableSettingsPanel_ServerRPC(int requestByClientId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2873686349u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, requestByClientId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2873686349u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Logger.LogDebug((object)$"SERVER receiving request for EnableSettingsPanel with clientId: [{requestByClientId}]"); EnableSettingsPanel_ClientRPC(requestByClientId, Configs.enableMatchSettings.Value); } } } [ClientRpc] private void EnableSettingsPanel_ClientRPC(int requestByClientId, bool hostEnabled) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2049727498u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, requestByClientId); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref hostEnabled, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2049727498u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } if (Object.op_Implicit((Object)(object)NetworkManager.Singleton)) { if (requestByClientId == (int)NetworkManager.Singleton.LocalClientId) { Logger.LogDebug((object)$"CLIENT successfully received EnableSettingsPanel_ClientRPC(): hostEnabled? {hostEnabled}"); if (hostEnabled) { SpawnMatchSettingsPanel(); } } else { Logger.LogDebug((object)"EnableSettingsPanel_ClientRPC(): called by different client"); } } else { Logger.LogError((object)"failed to get NetworkManager.Singleton to determine client to spawn host settings"); } } private void SpawnMatchSettingsPanel() { GameObject val = null; if (Object.op_Implicit((Object)(object)HudManager.Singleton)) { val = HudManager.Singleton.GetPrivateField<GameObject>("matchSettingsPanel"); } GameObject val2 = null; val2 = ((!Object.op_Implicit((Object)(object)val)) ? GameObject.Find("Match Options Panel") : val); if (!Object.op_Implicit((Object)(object)val2)) { Logger.LogError((object)"Failed to find Match Settings Panel to parent Fruit Saloon Match Settings Group to!"); return; } GameObject val3 = Object.Instantiate<GameObject>(Plugin.allAssets.settingsUiPrefab, val2.transform); Logger.LogDebug((object)$"spawned {val3} on {val3.transform.parent}!"); } public void CallEventFeedPopUp(string text) { if (!Object.op_Implicit((Object)(object)NetworkManager.Singleton)) { Logger.LogError((object)"CallEventFeedPopUp(): NetworkManager somehow null"); return; } ulong localClientId = NetworkManager.Singleton.LocalClientId; string text2 = "<color=#56DEFF>"; if (Object.op_Implicit((Object)(object)EventFeedManager.Singleton)) { string privateField = EventFeedManager.Singleton.GetPrivateField<string>("textColor_Pardner"); if (!string.IsNullOrEmpty(privateField)) { text2 = privateField; } } string text3 = text2 + "[playerName]</color> suggests " + text; Logger.LogDebug((object)$"client [{(int)localClientId}] sending CallEventFeedPopUp with text {text3}"); CallEventFeedPopUp_ServerRPC(text3, NetworkManager.Singleton.LocalClientId); } [ServerRpc(RequireOwnership = false)] private void CallEventFeedPopUp_ServerRPC(string text, ulong clientId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2194175676u, val, (RpcDelivery)0); bool flag = text != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(text, false); } BytePacker.WriteValueBitPacked(val2, clientId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2194175676u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { text = text.Replace("[playerName]", Plugin.GetPlayerName(clientId)); Logger.LogInfo((object)("Attempting to display event pop-up with text: '" + text + "'")); byte[] bytes = Encoding.UTF8.GetBytes(text); EventFeedManager.Singleton.AddANewEventFeedPopUp_ServerRPC(bytes, (byte)0); } } protected override void __initializeVariables() { if (saloonEnabled_SyncVar == null) { throw new Exception("FruitSaloonManager.saloonEnabled_SyncVar cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)saloonEnabled_SyncVar).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)saloonEnabled_SyncVar, "saloonEnabled_SyncVar"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)saloonEnabled_SyncVar); if (fruitRequired_SyncVar == null) { throw new Exception("FruitSaloonManager.fruitRequired_SyncVar cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)fruitRequired_SyncVar).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)fruitRequired_SyncVar, "fruitRequired_SyncVar"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)fruitRequired_SyncVar); if (fruitCurrent_SyncVar == null) { throw new Exception("FruitSaloonManager.fruitCurrent_SyncVar cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)fruitCurrent_SyncVar).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)fruitCurrent_SyncVar, "fruitCurrent_SyncVar"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)fruitCurrent_SyncVar); if (difficultyLevel_SyncVar == null) { throw new Exception("FruitSaloonManager.difficultyLevel_SyncVar cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)difficultyLevel_SyncVar).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)difficultyLevel_SyncVar, "difficultyLevel_SyncVar"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)difficultyLevel_SyncVar); if (customRequirement_SyncVar == null) { throw new Exception("FruitSaloonManager.customRequirement_SyncVar cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)customRequirement_SyncVar).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)customRequirement_SyncVar, "customRequirement_SyncVar"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)customRequirement_SyncVar); if (juiceHealAmount_SyncVar == null) { throw new Exception("FruitSaloonManager.juiceHealAmount_SyncVar cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)juiceHealAmount_SyncVar).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)juiceHealAmount_SyncVar, "juiceHealAmount_SyncVar"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)juiceHealAmount_SyncVar); if (juiceDigestionPenalties_SyncVar == null) { throw new Exception("FruitSaloonManager.juiceDigestionPenalties_SyncVar cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)juiceDigestionPenalties_SyncVar).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)juiceDigestionPenalties_SyncVar, "juiceDigestionPenalties_SyncVar"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)juiceDigestionPenalties_SyncVar); if (juiceOverheal_SyncVar == null) { throw new Exception("FruitSaloonManager.juiceOverheal_SyncVar cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)juiceOverheal_SyncVar).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)juiceOverheal_SyncVar, "juiceOverheal_SyncVar"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)juiceOverheal_SyncVar); ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_FruitSaloonManager() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3063810502u, new RpcReceiveHandler(__rpc_handler_3063810502)); NetworkManager.__rpc_func_table.Add(817089878u, new RpcReceiveHandler(__rpc_handler_817089878)); NetworkManager.__rpc_func_table.Add(1980941994u, new RpcReceiveHandler(__rpc_handler_1980941994)); NetworkManager.__rpc_func_table.Add(2294309545u, new RpcReceiveHandler(__rpc_handler_2294309545)); NetworkManager.__rpc_func_table.Add(2010075430u, new RpcReceiveHandler(__rpc_handler_2010075430)); NetworkManager.__rpc_func_table.Add(1153422901u, new RpcReceiveHandler(__rpc_handler_1153422901)); NetworkManager.__rpc_func_table.Add(2873686349u, new RpcReceiveHandler(__rpc_handler_2873686349)); NetworkManager.__rpc_func_table.Add(2049727498u, new RpcReceiveHandler(__rpc_handler_2049727498)); NetworkManager.__rpc_func_table.Add(2194175676u, new RpcReceiveHandler(__rpc_handler_2194175676)); } private static void __rpc_handler_3063810502(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { Vector3 posToSpawn = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref posToSpawn); Vector3 rotToSpawn = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref rotToSpawn); target.__rpc_exec_stage = (__RpcExecStage)1; ((FruitSaloonManager)(object)target).SpawnSaloonPrefab_ServerRPC(posToSpawn, rotToSpawn); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_817089878(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 posToSpawn = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref posToSpawn); Vector3 rotToSpawn = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref rotToSpawn); target.__rpc_exec_stage = (__RpcExecStage)2; ((FruitSaloonManager)(object)target).SpawnSaloonPrefab_ClientRPC(posToSpawn, rotToSpawn); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1980941994(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int localPlayerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref localPlayerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((FruitSaloonManager)(object)target).StartPressingJuice_ServerRPC(localPlayerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2294309545(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int localPlayerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref localPlayerId); target.__rpc_exec_stage = (__RpcExecStage)2; ((FruitSaloonManager)(object)target).StartPressingJuice_ClientRPC(localPlayerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2010075430(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool isMiscSound = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isMiscSound, default(ForPrimitives)); int noiseIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref noiseIndex); Vector3 atPos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref atPos); int localPlayerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref localPlayerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((FruitSaloonManager)(object)target).MakeNoise_ServerRPC(isMiscSound, noiseIndex, atPos, localPlayerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1153422901(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool isMiscSound = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isMiscSound, default(ForPrimitives)); int noiseIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref noiseIndex); Vector3 atPos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref atPos); int localPlayerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref localPlayerId); target.__rpc_exec_stage = (__RpcExecStage)2; ((FruitSaloonManager)(object)target).MakeNoise_ClientRPC(isMiscSound, noiseIndex, atPos, localPlayerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2873686349(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int requestByClientId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref requestByClientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((FruitSaloonManager)(object)target).EnableSettingsPanel_ServerRPC(requestByClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2049727498(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int requestByClientId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref requestByClientId); bool hostEnabled = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref hostEnabled, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((FruitSaloonManager)(object)target).EnableSettingsPanel_ClientRPC(requestByClientId, hostEnabled); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2194175676(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string text = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref text, false); } ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((FruitSaloonManager)(object)target).CallEventFeedPopUp_ServerRPC(text, clientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "FruitSaloonManager"; } } public class FruitSaloonMatchSettings : MonoBehaviour { private static ManualLogSource Logger; public static FruitSaloonMatchSettings Singleton; [Header("NETCODE")] public bool appliedOnNetworkSpawn; public int waitForXFramesAfterSpawn; [Space(3f)] [Header("VISUALS")] public TextMeshProUGUI[] arrowsToRecolor; public Color arrowColorServer; public Color arrowColorClient; [Space] public int valueOffsetServer; public int valueOffsetClient; [Space(3f)] [Header("COMPONENTS")] [Header("Saloon Enabled")] public GameObject saloonEnabledCheckmark; [Header("Difficulty Level")] public TextMeshProUGUI difficultyLevelPresetsValuePrint; public Slider difficultyLevelSlider; public GameObject difficultyLevelSliderContainer; public TextMeshProUGUI difficultyLevelSliderValuePrint; [Header("Juice Heal Amount")] public Slider juiceHealAmountSlider; public TextMeshProUGUI juiceHealAmountValuePrint; public GameObject juiceHealAmountClientButtons; public int juiceHealAmountSliderSteps; [Header("Juice Digestion Penalties")] public Slider juiceDigestionPenaltiesSlider; public TextMeshProUGUI juiceDigestionPenaltiesValuePrint; public GameObject juiceDigestionPenaltiesClientButtons; [Header("Juice Overheal Enabled")] public GameObject juiceOverhealEnabledCheckmark; public static void GetLogger(ManualLogSource PluginLogger) { Logger = PluginLogger; } private void Awake() { Logger.LogDebug((object)$"Awake() on {this}"); if (Object.op_Implicit((Object)(object)Singleton)) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { Singleton = this; } } private void Start() { if (!appliedOnNetworkSpawn) { ((MonoBehaviour)this).StartCoroutine(WaitForManagerNetworkSpawn()); } } private IEnumerator WaitForManagerNetworkSpawn() { Logger.LogDebug((object)"starting coroutine to wait for network spawn"); yield return (object)new WaitUntil((Func<bool>)(() => Object.op_Implicit((Object)(object)FruitSaloonManager.Singleton) && ((NetworkBehaviour)FruitSaloonManager.Singleton).IsSpawned)); Logger.LogDebug((object)$"network spawned, applying configs after {waitForXFramesAfterSpawn} frames"); if (waitForXFramesAfterSpawn > 0) { for (int i = 0; i < waitForXFramesAfterSpawn; i++) { yield return null; } } OnFruitSaloonManagerNetworkSpawn(); } public void OnFruitSaloonManagerNetworkSpawn() { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: 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) Logger.LogDebug((object)"OnFruitSaloonManagerNetworkSpawn()"); ((Selectable)difficultyLevelSlider).interactable = ((NetworkBehaviour)FruitSaloonManager.Singleton).IsServer; difficultyLevelSlider.value = FruitSaloonManager.Singleton.customRequirement_SyncVar.Value; ((Selectable)juiceHealAmountSlider).interactable = ((NetworkBehaviour)FruitSaloonManager.Singleton).IsServer; juiceHealAmountSlider.value = FruitSaloonManager.Singleton.juiceHealAmount_SyncVar.Value / juiceHealAmountSliderSteps; juiceHealAmountClientButtons.SetActive(!((NetworkBehaviour)FruitSaloonManager.Singleton).IsServer); ((TMP_Text)juiceHealAmountValuePrint).transform.localPosition = new Vector3((float)(juiceHealAmountClientButtons.activeSelf ? valueOffsetClient : valueOffsetServer), ((TMP_Text)juiceHealAmountValuePrint).transform.localPosition.y, ((TMP_Text)juiceHealAmountValuePrint).transform.localPosition.z); juiceDigestionPenaltiesSlider.value = FruitSaloonManager.Singleton.juiceDigestionPenalties_SyncVar.Value; juiceDigestionPenaltiesClientButtons.SetActive(!((NetworkBehaviour)FruitSaloonManager.Singleton).IsServer); ((TMP_Text)juiceDigestionPenaltiesValuePrint).transform.localPosition = new Vector3((float)(juiceDigestionPenaltiesClientButtons.activeSelf ? valueOffsetClient : valueOffsetServer), ((TMP_Text)juiceDigestionPenaltiesValuePrint).transform.localPosition.y, ((TMP_Text)juiceDigestionPenaltiesValuePrint).transform.localPosition.z); for (int i = 0; i < arrowsToRecolor.Length; i++) { TextMeshProUGUI val = arrowsToRecolor[i]; if (Object.op_Implicit((Object)(object)val)) { ((Graphic)val).color = (((NetworkBehaviour)FruitSaloonManager.Singleton).IsServer ? arrowColorServer : arrowColorClient); } } appliedOnNetworkSpawn = true; UpdateAllValueChangedDisplays(); } public void ButtonClicked_SaloonEnabled() { if (((NetworkBehaviour)FruitSaloonManager.Singleton).IsServer) { FruitSaloonManager.Singleton.saloonEnabled_SyncVar.Value = !FruitSaloonManager.Singleton.saloonEnabled_SyncVar.Value; CallUnreadyPlayersOnSettingsChange(); return; } string text = "Enabling"; if (FruitSaloonManager.Singleton.saloonEnabled_SyncVar.Value) { text = "Disabling"; } CallEventFeedPopUp(text + " the Fruit Saloon."); } public void ButtonClicked_DifficultyLevelPresets(bool increase) { if (((NetworkBehaviour)FruitSaloonManager.Singleton).IsServer) { if (increase) { FruitSaloonManager.Singleton.difficultyLevel_SyncVar.Value = Mathf.Clamp(FruitSaloonManager.Singleton.difficultyLevel_SyncVar.Value + 1, 0, FruitSaloonManager.Singleton.fruitDifficultyMultipliers.Length); } else { FruitSaloonManager.Singleton.difficultyLevel_SyncVar.Value = Mathf.Clamp(FruitSaloonManager.Singleton.difficultyLevel_SyncVar.Value - 1, 0, FruitSaloonManager.Singleton.fruitDifficultyMultipliers.Length); } CallUnreadyPlayersOnSettingsChange(); return; } string text = "Increasing"; if (!increase) { text = "Decreasing"; } switch (FruitSaloonManager.Singleton.difficultyLevel_SyncVar.Value) { case 0: if (increase) { CallEventFeedPopUp(text + " the Fruit Required Difficulty."); } break; case 1: CallEventFeedPopUp(text + " the Fruit Required Difficulty."); break; default: CallEventFeedPopUp(text + " the Fruit Required Difficulty."); break; case 3: CallEventFeedPopUp(text + " the Fruit Required Difficulty."); break; case 4: if (increase) { CallEventFeedPopUp("Custom setting the Fruit Required."); } else { CallEventFeedPopUp(text + " the Fruit Required Difficulty."); } break; case 5: if ((increase && (float)FruitSaloonManager.Singleton.customRequirement_SyncVar.Value < difficultyLevelSlider.maxValue) || (!increase && (float)FruitSaloonManager.Singleton.customRequirement_SyncVar.Value > difficultyLevelSlider.minValue)) { CallEventFeedPopUp(text + " the Custom Fruit Required."); } break; } } public void SliderMoved_CustomRequirement() { if (((NetworkBehaviour)FruitSaloonManager.Singleton).IsServer) { FruitSaloonManager.Singleton.customRequirement_SyncVar.Value = (int)difficultyLevelSlider.value; CallUnreadyPlayersOnSettingsChange(); } } public void ButtonClicked_JuiceHealAmount(bool increase) { if (((NetworkBehaviour)FruitSaloonManager.Singleton).IsServer) { Logger.LogWarning((object)"ButtonClicked_JuiceHealAmount(): HOST should not see these buttons, only the slider!"); return; } string text = "Increasing"; if (!increase) { text = "Decreasing"; } if ((increase && (float)FruitSaloonManager.Singleton.juiceHealAmount_SyncVar.Value < juiceHealAmountSlider.maxValue * (float)juiceHealAmountSliderSteps) || (!increase && (float)FruitSaloonManager.Singleton.juiceHealAmount_SyncVar.Value > juiceHealAmountSlider.minValue * (float)juiceHealAmountSliderSteps)) { CallEventFeedPopUp(text + " the Juice Heal Amount."); } } public void SliderMoved_JuiceHealAmount() { if (((NetworkBehaviour)FruitSaloonManager.Singleton).IsServer) { FruitSaloonManager.Singleton.juiceHealAmount_SyncVar.Value = (int)juiceHealAmountSlider.value * juiceHealAmountSliderSteps; CallUnreadyPlayersOnSettingsChange(); } } public void ButtonClicked_JuiceDigestionPenalties(bool increase) { if (((NetworkBehaviour)FruitSaloonManager.Singleton).IsServer) { Logger.LogWarning((object)"ButtonClicked_JuiceDigestionPenalties(): HOST should not see these buttons, only the slider!"); return; } string text = "Increasing"; if (!increase) { text = "Decreasing"; } if ((increase && (float)FruitSaloonManager.Singleton.juiceDigestionPenalties_SyncVar.Value < juiceDigestionPenaltiesSlider.maxValue) || (!increase && (float)FruitSaloonManager.Singleton.juiceDigestionPenalties_SyncVar.Value > juiceDigestionPenaltiesSlider.minValue)) { CallEventFeedPopUp(text + " the Juice Digestion Penalties."); } } public void SliderMoved_JuiceDigestionPenalties() { if (((NetworkBehaviour)FruitSaloonManager.Singleton).IsServer) { FruitSaloonManager.Singleton.juiceDigestionPenalties_SyncVar.Value = (int)juiceDigestionPenaltiesSlider.value; CallUnreadyPlayersOnSettingsChange(); } } public void ButtonClicked_JuiceOverhealEnabled() { if (((NetworkBehaviour)FruitSaloonManager.Singleton).IsServer) { FruitSaloonManager.Singleton.juiceOverheal_SyncVar.Value = !FruitSaloonManager.Singleton.juiceOverheal_SyncVar.Value; CallUnreadyPlayersOnSettingsChange(); return; } string text = "Enabling"; if (FruitSaloonManager.Singleton.juiceOverheal_SyncVar.Value) { text = "Disabling"; } CallEventFeedPopUp(text + " the Juice Overhealing."); } private void UpdateAllValueChangedDisplays() { OnValueChanged_SaloonEnabled(); OnValueChanged_DifficultyLevel(); OnValueChanged_CustomRequirement(); OnValueChanged_JuiceHealAmount(); OnValueChanged_JuiceDigestionPenalties(); OnValueChanged_JuiceOverhealEnabled(); } public void OnValueChanged_SaloonEnabled() { saloonEnabledCheckmark.SetActive(FruitSaloonManager.Singleton.saloonEnabled_SyncVar.Value); } public void OnValueChanged_DifficultyLevel() { switch (FruitSaloonManager.Singleton.difficultyLevel_SyncVar.Value) { case 0: ((TMP_Text)difficultyLevelPresetsValuePrint).text = "Dandylion"; difficultyLevelSliderContainer.SetActive(false); break; case 1: ((TMP_Text)difficultyLevelPresetsValuePrint).text = "Easy"; difficultyLevelSliderContainer.SetActive(false); break; default: ((TMP_Text)difficultyLevelPresetsValuePrint).text = "Medium"; difficultyLevelSliderContainer.SetActive(false); break; case 3: ((TMP_Text)difficultyLevelPresetsValuePrint).text = "Hard"; difficultyLevelSliderContainer.SetActive(false); break; case 4: ((TMP_Text)difficultyLevelPresetsValuePrint).text = "Wormfood"; difficultyLevelSliderContainer.SetActive(false); break; case 5: ((TMP_Text)difficultyLevelPresetsValuePrint).text = "Custom"; difficultyLevelSliderContainer.SetActive(true); break; } } public void OnValueChanged_CustomRequirement() { if (!((NetworkBehaviour)FruitSaloonManager.Singleton).IsServer) { difficultyLevelSlider.value = FruitSaloonManager.Singleton.customRequirement_SyncVar.Value; } ((TMP_Text)difficultyLevelSliderValuePrint).text = difficultyLevelSlider.value.ToString(); } public void OnValueChanged_JuiceHealAmount() { if (!((NetworkBehaviour)FruitSaloonManager.Singleton).IsServer) { juiceHealAmountSlider.value = FruitSaloonManager.Singleton.juiceHealAmount_SyncVar.Value / juiceHealAmountSliderSteps; } ((TMP_Text)juiceHealAmountValuePrint).text = (juiceHealAmountSlider.value * (float)juiceHealAmountSliderSteps).ToString(); } public void OnValueChanged_JuiceDigestionPenalties() { if (!((NetworkBehaviour)FruitSaloonManager.Singleton).IsServer) { juiceDigestionPenaltiesSlider.value = FruitSaloonManager.Singleton.juiceDigestionPenalties_SyncVar.Value; } ((TMP_Text)juiceDigestionPenaltiesValuePrint).text = juiceDigestionPenaltiesSlider.value.ToString(); } public void OnValueChanged_JuiceOverhealEnabled() { juiceOverhealEnabledCheckmark.SetActive(FruitSaloonManager.Singleton.juiceOverheal_SyncVar.Value); } private void CallEventFeedPopUp(string text) { if (text.Length >= 256) { Logger.LogError((object)("given text (" + text + ") too long, please shorten")); } else if (!Object.op_Implicit((Object)(object)EventFeedManager.Singleton) || !Object.op_Implicit((Object)(object)FruitSaloonManager.Singleton)) { Logger.LogWarning((object)$"tried printing message without EventFeedManager ({!Object.op_Implicit((Object)(object)EventFeedManager.Singleton)}) or FruitSaloonManager ({!Object.op_Implicit((Object)(object)FruitSaloonManager.Singleton)})!"); } else if (Object.op_Implicit((Object)(object)MatchSettingsManager.Singleton) && MatchSettingsManager.Singleton.areSuggestionsBlocked) { EventFeedManager.Singleton.AddANewEventFeedPopUp((EventFeedEventType)13, 0uL, 0uL, true, (byte)0); } else { FruitSaloonManager.Singleton.CallEventFeedPopUp(text); } } private void CallUnreadyPlayersOnSettingsChange() { if (Object.op_Implicit((Object)(object)MatchSettingsManager.Singleton)) { MatchSettingsManager.Singleton.settingsChanged_UnreadyAllPlayersInNextUpdate = true; } } } public class HarmonyPatches { [HarmonyPatch(typeof(NetworkManager), "SetSingleton")] public class NetworkManagerSetSingletonPatch { [HarmonyPostfix] public static void RegisterPrefabsToNetwork() { if ((Object)(object)NetworkManager.Singleton == (Object)null) { Logger.LogError((object)"NetworkManager.Singleton null, cannot add network prefabs"); return; } Logger.LogDebug((object)$"SetSingleton(), on {((Component)NetworkManager.Singleton).gameObject}"); GameObject[] array = Plugin.assetBundle.LoadAllAssets<GameObject>(); foreach (GameObject val in array) { if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.GetComponentInChildren<NetworkObject>())) { NetworkManager.Singleton.AddNetworkPrefab(val); Logger.LogDebug((object)$"registered network prefab {val}"); } } } } [HarmonyPatch(typeof(GameManager))] public class FruitSaloonGameManagerPatch { [HarmonyPostfix] [HarmonyPatch("OnNetworkSpawn")] public static void OnNetworkSpawnPostfix(GameManager __instance) { Logger.LogDebug((object)"GameManager.OnNetworkSpawn()"); if (!Object.op_Implicit((Object)(object)__instance) || !Object.op_Implicit((Object)(object)((Component)__instance).gameObject) || !((NetworkBehaviour)__instance).IsServer) { Logger.LogDebug((object)$"failed to find GameManager (instance null? {(Object)(object)__instance == (Object)null})"); } else { Object.Instantiate<GameObject>(Plugin.allAssets.managerPrefab, ((Component)__instance).gameObject.transform).GetComponent<NetworkObject>().Spawn(false); } } } [HarmonyPatch(typeof(MapLayoutPrefabLoader))] public class FruitSaloonMapLayoutPrefabLoaderPatch { [HarmonyPostfix] [HarmonyPatch("ChangeMapLoadState")] public static void ChangeMapLoadStatePostfix(int _stateIndex) { if (_stateIndex == 3) { RuntimePropSpawner.CollectAndApplyPropsToSpawn(); FruitSaloonManager fruitSaloonManager = Object.FindAnyObjectByType<FruitSaloonManager>(); if ((Object)(object)fruitSaloonManager != (Object)null) { fruitSaloonManager.SetUpSaloonThisRound(); } } } } [HarmonyPatch(typeof(LobbyManager))] public class FruitSaloonLobbyManagerPatch { [HarmonyPostfix] [HarmonyPatch("SpawnPlayersAndStartGame")] public static void SpawnPlayersAndStartGamePostfix(LobbyManager __instance) { if (Object.op_Implicit((Object)(object)__instance) && ((NetworkBehaviour)__instance).IsServer && Object.op_Implicit((Object)(object)FruitSaloonManager.Singleton)) { Logger.LogDebug((object)$"IsServer = {((NetworkBehaviour)FruitSaloonManager.Singleton).IsServer} // saloonEnabled = {FruitSaloonManager.Singleton.saloonEnabled_SyncVar.Value} // difficultyLevel = {FruitSaloonManager.Singleton.difficultyLevel_SyncVar.Value}"); if (((NetworkBehaviour)FruitSaloonManager.Singleton).IsServer && FruitSaloonManager.Singleton.saloonEnabled_SyncVar.Value && FruitSaloonManager.Singleton.difficultyLevel_SyncVar.Value == 4) { Logger.LogDebug((object)$"intercepting SpawnPlayersAndStartGame and difficulty {FruitSaloonManager.Singleton.difficultyLevel_SyncVar.Value} to recalculate fruit"); FruitSaloonManager.Singleton.SetUpFruitRequired(calculateWormfoodDifficulty: true); } } } } [HarmonyPatch(typeof(HudManager))] public class FruitSaloonHudManagerPatch { [HarmonyPostfix] [HarmonyPatch("Start")] public static void StartPostfix(HudManager __instance) { if (!Object.op_Implicit((Object)(object)__instance)) { return; } Logger.LogDebug((object)"HudManager.Start()"); if (!Object.op_Implicit((Object)(object)Plugin.allAssets.originalFontThin) && Object.op_Implicit((Object)(object)__instance.needAtLeastOneWormPlayer_Text)) { TextMeshProUGUI component = __instance.needAtLeastOneWormPlayer_Text.GetComponent<TextMeshProUGUI>(); if (Object.op_Implicit((Object)(object)component)) { Plugin.allAssets.originalFontThin = ((TMP_Text)component).font; Logger.LogDebug((object)$"got font (thin): {Plugin.allAssets.originalFontThin}"); } } if (!Object.op_Implicit((Object)(object)Plugin.allAssets.originalFontThick) && Object.op_Implicit((Object)(object)__instance.matchSettings_MapTheme_DisplayText) && Object.op_Implicit((Object)(object)__instance.matchSettings_MapTheme_DisplayText.transform.parent)) { Transform val = __instance.matchSettings_MapTheme_DisplayText.transform.parent.Find("Map Theme Header"); if (Object.op_Implicit((Object)(object)val)) { TextMeshProUGUI component2 = ((Component)val).gameObject.GetComponent<TextMeshProUGUI>(); if (Object.op_Implicit((Object)(object)component2)) { Plugin.allAssets.originalFontThick = ((TMP_Text)component2).font; Logger.LogDebug((object)$"got font (thick): {Plugin.allAssets.originalFontThick}"); } } } if (!Object.op_Implicit((Object)(object)Plugin.allAssets.originalFontScribbly) && Object.op_Implicit((Object)(object)__instance.matchSettings_TimeUntilSundown_DifficultyText)) { Plugin.allAssets.originalFontScribbly = __instance.matchSettings_TimeUntilSundown_DifficultyText.font; Logger.LogDebug((object)$"got font (scribbly): {Plugin.allAssets.originalFontScribbly}"); } if (!Object.op_Implicit((Object)(object)Plugin.allAssets.originalFontShadowless) && Object.op_Implicit((Object)(object)__instance.matchSettings_MaxPardnerHealth_DifficultyText)) { Transform parent = __instance.matchSettings_MaxPardnerHealth_DifficultyText.transform.parent; object obj; if (parent == null) { obj = null; } else { Transform parent2 = parent.parent; obj = ((parent2 != null) ? parent2.Find("Pardner Settings Header") : null); } Transform val2 = (Transform)obj; if (Object.op_Implicit((Object)(object)val2)) { TextMeshProUGUI component3 = ((Component)val2).GetComponent<TextMeshProUGUI>(); if (Object.op_Implicit((Object)(object)component3)) { Plugin.allAssets.originalFontShadowless = ((TMP_Text)component3).font; Logger.LogDebug((object)$"got font (shadowless): {Plugin.allAssets.originalFontShadowless}"); } } } Image[] privateField = __instance.GetPrivateField<Image[]>("cactusFruitHudIcons"); if (!Object.op_Implicit((Object)(object)Plugin.allAssets.cactusFruitIcon) && privateField != null && privateField.Length != 0 && Object.op_Implicit((Object)(object)privateField[0]) && Object.op_Implicit((Object)(object)privateField[0].sprite)) { Plugin.allAssets.cactusFruitIcon = privateField[0].sprite; Logger.LogDebug((object)$"got sprite (fruit): {Plugin.allAssets.cactusFruitIcon}"); } GameObject privateField2 = __instance.GetPrivateField<GameObject>("matchSettingsPanel"); if (!Object.op_Implicit((Object)(object)Plugin.allAssets.menuBacker) && Object.op_Implicit((Object)(object)privateField2)) { Transform val3 = privateField2.transform.Find("Pardner Group"); if (Object.op_Implicit((Object)(object)val3)) { Transform val4 = val3.Find("Backer"); if (Object.op_Implicit((Object)(object)val4)) { Image component4 = ((Component)val4).GetComponent<Image>(); if (Object.op_Implicit((Object)(object)component4)) { Plugin.allAssets.menuBacker = component4.sprite; Logger.LogDebug((object)$"got sprite (menu): {Plugin.allAssets.menuBacker}"); } } } } if (!Object.op_Implicit((Object)(object)Plugin.allAssets.checkmarkSprite) && Object.op_Implicit((Object)(object)privateField2)) { Transform val5 = privateField2.transform.Find("Objectives Group"); if (Object.op_Implicit((Object)(object)val5)) { Transform val6 = val5.Find("Allow Objective: Train Fuel"); if (Object.op_Implicit((Object)(object)val6)) { Transform val7 = val6.Find("Toggle Button (ITS A BUTTON, Toggles are dumb)"); if (Object.op_Implicit((Object)(object)val7)) { Transform val8 = val7.Find("Checkmark"); if (Object.op_Implicit((Object)(object)val8)) { Image component5 = ((Component)val8).GetComponent<Image>(); if (Object.op_Implicit((Object)(object)component5)) { Plugin.allAssets.checkmarkSprite = component5.sprite; Logger.LogDebug((object)$"got sprite (checkmark): {Plugin.allAssets.checkmarkSprite}"); } } } } } } if (!Object.op_Implicit((Object)(object)Plugin.allAssets.crossSprite) && Object.op_Implicit((Object)(object)privateField2)) { Transform obj2 = privateField2.transform.Find("Game Rules Group"); object obj3; if (obj2 == null) { obj3 = null; } else { Transform obj4 = obj2.Find("Digestion Time"); if (obj4 == null) { obj3 = null; } else { Transform obj5 = obj4.Find("Digestion Time Slider"); if (obj5 == null) { obj3 = null; } else { Transform obj6 = obj5.Find("Custom Slider"); if (obj6 == null) { obj3 = null; } else { Transform obj7 = obj6.Find("Handle Slide Area"); if (obj7 == null) { obj3 = null; } else { Transform obj8 = obj7.Find("Handle"); obj3 = ((obj8 != null) ? ((Component)obj8).GetComponent<Image>() : null); } } } } } Image val9 = (Image)obj3; if (Object.op_Implicit((Object)(object)val9)) { Plugin.allAssets.crossSprite = val9.sprite; Logger.LogDebug((object)$"got sprite (cross): {Plugin.allAssets.crossSprite}"); } } if (Object.op_Implicit((Object)(object)FruitSaloonManager.Singleton) && Object.op_Implicit((Object)(object)NetworkManager.Singleton)) { FruitSaloonManager.Singleton.RequestEnablingSettingsPanel((int)NetworkManager.Singleton.LocalClientId); } } } [HarmonyPatch(typeof(LocTableHelpers))] public class FruitSaloonLocTableHelpersPatch { [HarmonyPostfix] [HarmonyPatch("GetStringFromTable")] public static void GetStringFromTablePostfix(string _locTableKey, ref string __result) { if (_locTableKey == "Fruit Juice") { __result = _locTableKey; } } } [HarmonyPatch(typeof(LootManager))] public class FruitSaloonLootManagerPatch { [HarmonyPostfix] [HarmonyPatch("Awake")] public static void AwakePostfix(LootManager __instance) { if (Object.op_Implicit((Object)(object)__instance) && Configs.secretTrunkSpawnable.Value) { __instance.standardEquipmentPrefabs.Add(Plugin.allAssets.fruitJuicePrefab); Logger.LogDebug((object)$"locally added prefab {Plugin.allAssets.fruitJuicePrefab} to chest loot at index {__instance.standardEquipmentPrefabs.Count - 1}"); } } } private static ManualLogSource Logger; public static void GetLogger(ManualLogSource PluginLogger) { Logger = PluginLogger; } } public class OnPickUpDisplayHint : MonoBehaviour { public GameObject passOnto; public void OnPickUpValidated() { if (Object.op_Implicit((Object)(object)passOnto) && Object.op_Implicit((Object)(object)HudManager.Singleton)) { passOnto.SendMessage("OnPickUpValidated", (SendMessageOptions)1); } } } [BepInPlugin("local.SimonTendo.LTOWFruitSaloonMod", "LTOWFruitSaloonMod", "1.0.0")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; public static AssetBundle assetBundle; public static AllAssets allAssets; public static Configs MyConfig { get; internal set; } private void Awake() { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)