#define DEBUG
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Logging;
using ControlCompany.Core;
using ControlCompany.Core.Enemy;
using ControlCompany.Core.UI;
using ControlCompanyAddons.Additions;
using ControlCompanyAddons.Helpers;
using ControlCompanyAddons.Input;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TestAccount666.ControlCompanyAddons")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Additions that ControlCompany won't add, or hasn't added, yet")]
[assembly: AssemblyFileVersion("2.0.1.0")]
[assembly: AssemblyInformationalVersion("2.0.1+848c9367e2960430c4c0bf1a11435e95cb11659e")]
[assembly: AssemblyProduct("ControlCompanyAddons")]
[assembly: AssemblyTitle("TestAccount666.ControlCompanyAddons")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace ControlCompanyAddons
{
[BepInPlugin("TestAccount666.ControlCompanyAddons", "ControlCompanyAddons", "2.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class ControlCompanyAddons : BaseUnityPlugin
{
internal static InputKeys inputKeys;
public static ControlCompanyAddons Instance { get; private set; }
internal static ManualLogSource Logger { get; private set; }
internal static Harmony? Harmony { get; set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
inputKeys = new InputKeys();
InputHandler.Initialize();
Patch();
PlayerEsp.LoadMaterial();
Logger.LogInfo((object)"TestAccount666.ControlCompanyAddons v2.0.1 has loaded!");
}
internal static void Patch()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
if (Harmony == null)
{
Harmony = new Harmony("TestAccount666.ControlCompanyAddons");
}
Logger.LogDebug((object)"Patching...");
Harmony.PatchAll();
Logger.LogDebug((object)"Finished patching!");
}
internal static void Unpatch()
{
Logger.LogDebug((object)"Unpatching...");
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
Logger.LogDebug((object)"Finished unpatching!");
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
public static class PlayerEsp
{
private static AssetBundle _assetBundle;
private static GameObject _playerEspPrefab;
internal static void LoadMaterial()
{
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
Debug.Assert(directoryName != null, "assemblyLocation != null");
_assetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "controlcompanyaddons"));
_playerEspPrefab = _assetBundle.LoadAsset<GameObject>("Assets/LethalCompany/Mods/ControlCompanyAddons/PlayerESP.prefab");
}
internal static void UnApplyEsp(PlayerControllerB playerControllerB)
{
Transform val = ((Component)playerControllerB).transform.Find("ScavengerModel");
if ((Object)(object)val == (Object)null)
{
ControlCompanyAddons.Logger.LogFatal((object)"Couldn't find scavenger model!");
return;
}
Transform val2 = val.Find("PlayerESP(Clone)");
if (!((Object)(object)val2 == (Object)null))
{
Object.Destroy((Object)(object)((Component)val2).gameObject);
}
}
internal static void ApplyEsp(PlayerControllerB playerControllerB)
{
Transform val = ((Component)playerControllerB).transform.Find("ScavengerModel");
if ((Object)(object)val == (Object)null)
{
ControlCompanyAddons.Logger.LogFatal((object)"Couldn't find scavenger model!");
return;
}
UnApplyEsp(playerControllerB);
Object.Instantiate<GameObject>(_playerEspPrefab, val, false);
}
}
public static class UnixTime
{
public static long GetCurrentTime()
{
return (long)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "TestAccount666.ControlCompanyAddons";
public const string PLUGIN_NAME = "ControlCompanyAddons";
public const string PLUGIN_VERSION = "2.0.1";
}
}
namespace ControlCompanyAddons.Patches
{
[HarmonyPatch(typeof(ControlCenter))]
public class ControlCenterPatch
{
[HarmonyPatch("SpawnControllableEnemy")]
[HarmonyPostfix]
public static void AddDataHelper(EnemyController __result)
{
GameObject enemyGameObject = __result.enemyGameObject;
if (!((Object)(object)enemyGameObject == (Object)null))
{
enemyGameObject.AddComponent<DataHelper>();
}
}
}
}
namespace ControlCompanyAddons.Patches.UI
{
[HarmonyPatch(typeof(UIManager))]
public static class UIManagerPatch
{
private static readonly Regex _DirtyKeyRegex1 = new Regex(".*<.*>/", RegexOptions.Compiled);
private static readonly Regex _DirtyKeyRegex2 = new Regex("\\[.*\\]", RegexOptions.Compiled);
private static string _keyToPress = "";
private static long _nextUpdate = 0L;
[HarmonyPatch("RenderEnemyControls")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> InsertEnemyControls(IEnumerable<CodeInstruction> instructions)
{
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Expected O, but got Unknown
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Expected O, but got Unknown
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Expected O, but got Unknown
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Expected O, but got Unknown
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Expected O, but got Unknown
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Expected O, but got Unknown
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Expected O, but got Unknown
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Expected O, but got Unknown
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Expected O, but got Unknown
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Expected O, but got Unknown
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Expected O, but got Unknown
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: Expected O, but got Unknown
List<CodeInstruction> list = new List<CodeInstruction>();
list.AddRange(instructions);
List<CodeInstruction> list2 = list;
bool flag = false;
List<string> list3 = new List<string>(12)
{
"ldloc.2 NULL [Label2]", "newobj void ControlCompany.Core.UI.UIInstruction::.ctor()", "dup NULL", "ldarg.s 4", "callvirt void ControlCompany.Core.UI.UIInstruction::set_InputKey(string value)", "nop NULL", "dup NULL", "ldstr \"Exit\"", "callvirt void ControlCompany.Core.UI.UIInstruction::set_ActionText(string value)", "nop NULL",
"callvirt virtual void System.Collections.Generic.List<ControlCompany.Core.UI.UIInstruction>::Add(ControlCompany.Core.UI.UIInstruction item)", "nop NULL"
};
int num = 0;
for (int i = 0; i < list2.Count; i++)
{
CodeInstruction val = list2[i];
string value = list3[num];
num = (((object)val).ToString().Equals(value) ? (num + 1) : 0);
if (num >= list3.Count)
{
flag = true;
MethodInfo methodInfo = AccessTools.DeclaredMethod(typeof(UIManagerPatch), "GetInputKey", (Type[])null, (Type[])null);
list2.InsertRange(i + 1, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[12]
{
new CodeInstruction(OpCodes.Ldloc_2, (object)null),
new CodeInstruction(OpCodes.Newobj, (object)typeof(UIInstruction).GetConstructor(Type.EmptyTypes)),
new CodeInstruction(OpCodes.Dup, (object)null),
new CodeInstruction(OpCodes.Call, (object)methodInfo),
new CodeInstruction(OpCodes.Callvirt, (object)typeof(UIInstruction).GetProperty("InputKey", BindingFlags.Instance | BindingFlags.Public)?.SetMethod),
new CodeInstruction(OpCodes.Nop, (object)null),
new CodeInstruction(OpCodes.Dup, (object)null),
new CodeInstruction(OpCodes.Ldstr, (object)"Release Control"),
new CodeInstruction(OpCodes.Callvirt, (object)typeof(UIInstruction).GetProperty("ActionText", BindingFlags.Instance | BindingFlags.Public)?.SetMethod),
new CodeInstruction(OpCodes.Nop, (object)null),
new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.DeclaredMethod(typeof(List<UIInstruction>), "Add", (Type[])null, (Type[])null)),
new CodeInstruction(OpCodes.Nop, (object)null)
}));
break;
}
}
if (!flag)
{
throw new ArgumentException("Unable to locate the correct position to insert the new code for rendering the release prompt.");
}
return list2;
}
private static string GetInputKey()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
long currentTime = UnixTime.GetCurrentTime();
if (currentTime < _nextUpdate)
{
return _keyToPress;
}
InputBinding val = ControlCompanyAddons.inputKeys.ReleaseControlKey.bindings[0];
string input = ((object)(InputBinding)(ref val)).ToString().ToUpper();
input = _DirtyKeyRegex1.Replace(input, "");
return _keyToPress = _DirtyKeyRegex2.Replace(input, "");
}
}
}
namespace ControlCompanyAddons.Patches.Controller
{
[HarmonyPatch(typeof(HoardingBugEnemyController))]
public class HoardingBugEnemyControllerPatch
{
[HarmonyPatch("GetPrimarySkillName")]
[HarmonyPrefix]
public static bool SetPrimarySkillName(HoardingBugEnemyController __instance, ref string __result)
{
HoarderBugAI hoarderBugAI = __instance.hoarderBugAI;
if ((Object)(object)hoarderBugAI == (Object)null)
{
return true;
}
if (hoarderBugAI.heldItem != null)
{
return true;
}
DataHelper dataHelper = ((Component)hoarderBugAI).GetComponent<DataHelper>() ?? ((Component)hoarderBugAI).gameObject.AddComponent<DataHelper>();
if (!dataHelper.HasData("IsAttacking"))
{
dataHelper.SetData("IsAttacking", false);
}
bool flag = (bool)dataHelper.GetData("IsAttacking");
__result = (flag ? "Stop Attacking" : "Start Attacking");
return false;
}
[HarmonyPatch("UsePrimarySkillAction")]
[HarmonyPrefix]
public static bool UsePrimarySkillAction(HoardingBugEnemyController __instance)
{
if (((EnemyController)__instance).isAIControlled)
{
return true;
}
HoarderBugAI hoarderBugAI = __instance.hoarderBugAI;
if ((Object)(object)hoarderBugAI == (Object)null)
{
return true;
}
if (hoarderBugAI.heldItem != null)
{
return true;
}
DataHelper dataHelper = ((Component)hoarderBugAI).GetComponent<DataHelper>() ?? ((Component)hoarderBugAI).gameObject.AddComponent<DataHelper>();
if (!dataHelper.HasData("IsAttacking"))
{
dataHelper.SetData("IsAttacking", false);
}
bool flag = (bool)dataHelper.GetData("IsAttacking");
flag = !flag;
HoardingBugAdditions.HandleAttackLogic(flag);
dataHelper.SetData("IsAttacking", flag);
return false;
}
}
[HarmonyPatch(typeof(EnemyController))]
public class HoardingBugControllerDestroyPatch
{
[HarmonyPatch("DestroyAndCleanUp")]
[HarmonyPrefix]
public static void DestroyAndCleanUp(EnemyController __instance)
{
if (__instance is HoardingBugEnemyController)
{
HoardingBugAdditions.HandleAttackLogic(isAttacking: false);
}
}
}
[HarmonyPatch(typeof(EnemyController))]
public class MouthDogPrimarySkillPatch
{
[HarmonyPatch("GetPrimarySkillName")]
[HarmonyPrefix]
public static bool SetPrimarySkillName(EnemyController __instance, ref string __result)
{
MouthDogEnemyController val = (MouthDogEnemyController)(object)((__instance is MouthDogEnemyController) ? __instance : null);
if (val == null)
{
return true;
}
MouthDogAI mouthDogAI = val.mouthDogAI;
if ((Object)(object)mouthDogAI == (Object)null)
{
return true;
}
DataHelper dataHelper = ((Component)mouthDogAI).GetComponent<DataHelper>() ?? ((Component)mouthDogAI).gameObject.AddComponent<DataHelper>();
if (!dataHelper.HasData("WasAngered"))
{
dataHelper.SetData("WasAngered", false);
}
bool flag = (bool)dataHelper.GetData("WasAngered");
__result = (flag ? "Calm Down" : "Investigate");
return false;
}
[HarmonyPatch("UsePrimarySkillAction")]
[HarmonyPrefix]
public static bool UsePrimarySkillAction(EnemyController __instance)
{
MouthDogEnemyController val = (MouthDogEnemyController)(object)((__instance is MouthDogEnemyController) ? __instance : null);
if (val == null)
{
return true;
}
if (((EnemyController)val).isAIControlled)
{
return true;
}
MouthDogAI mouthDogAI = val.mouthDogAI;
if ((Object)(object)mouthDogAI == (Object)null)
{
return true;
}
DataHelper dataHelper = ((Component)mouthDogAI).GetComponent<DataHelper>() ?? ((Component)mouthDogAI).gameObject.AddComponent<DataHelper>();
if (!dataHelper.HasData("HasScreamed"))
{
dataHelper.SetData("HasScreamed", false);
}
if (!dataHelper.HasData("WasAngered"))
{
dataHelper.SetData("WasAngered", false);
}
bool flag = (bool)dataHelper.GetData("WasAngered");
flag = !flag;
MouthDogAdditions.HandleAngerState(mouthDogAI, flag);
dataHelper.SetData("HasScreamed", false);
dataHelper.SetData("WasAngered", flag);
return false;
}
}
[HarmonyPatch(typeof(MouthDogEnemyController))]
public class MouthDogSecondarySkillPatch
{
[HarmonyPatch("GetSecondarySkillName")]
[HarmonyPrefix]
public static bool SetSecondarySkillName(MouthDogEnemyController __instance, ref string __result)
{
MouthDogAI mouthDogAI = __instance.mouthDogAI;
if ((Object)(object)mouthDogAI == (Object)null)
{
return true;
}
DataHelper dataHelper = ((Component)mouthDogAI).GetComponent<DataHelper>() ?? ((Component)mouthDogAI).gameObject.AddComponent<DataHelper>();
if (!dataHelper.HasData("HasScreamed"))
{
dataHelper.SetData("HasScreamed", false);
}
if (!dataHelper.HasData("WasAngered"))
{
dataHelper.SetData("WasAngered", false);
}
bool flag = (bool)dataHelper.GetData("HasScreamed");
bool flag2 = (bool)dataHelper.GetData("WasAngered");
__result = (flag ? "Lunge" : "Scream");
return false;
}
[HarmonyPatch("UseSecondarySkillAction")]
[HarmonyPrefix]
public static bool UseSecondarySkillAction(MouthDogEnemyController __instance)
{
if (((EnemyController)__instance).isAIControlled)
{
return true;
}
MouthDogAI mouthDogAI = __instance.mouthDogAI;
if ((Object)(object)mouthDogAI == (Object)null)
{
return true;
}
DataHelper dataHelper = ((Component)mouthDogAI).GetComponent<DataHelper>() ?? ((Component)mouthDogAI).gameObject.AddComponent<DataHelper>();
if (!dataHelper.HasData("HasScreamed"))
{
dataHelper.SetData("HasScreamed", false);
}
if (!dataHelper.HasData("WasAngered"))
{
dataHelper.SetData("WasAngered", false);
}
bool flag = (bool)dataHelper.GetData("HasScreamed");
bool flag2 = (bool)dataHelper.GetData("WasAngered");
flag = !flag;
if (!flag)
{
flag2 = true;
}
MouthDogAdditions.HandleScreamOrLunge(mouthDogAI, flag);
dataHelper.SetData("HasScreamed", flag);
dataHelper.SetData("WasAngered", flag2);
return false;
}
}
}
namespace ControlCompanyAddons.Patches.AI
{
[HarmonyPatch(typeof(EnemyAI))]
public static class HoarderBugAIPatch
{
[HarmonyPatch("SwitchToBehaviourServerRpc")]
[HarmonyPrefix]
public static void SwitchToBehaviourServerRpcPrefix(EnemyAI __instance, ref int stateIndex)
{
SwitchToBehaviourStateHandler((Component)(object)__instance, ref stateIndex);
}
[HarmonyPatch("SwitchToBehaviourState")]
[HarmonyPrefix]
public static void SwitchToBehaviourStatePrefix(EnemyAI __instance, ref int stateIndex)
{
SwitchToBehaviourStateHandler((Component)(object)__instance, ref stateIndex);
}
[HarmonyPatch("SwitchToBehaviourStateOnLocalClient")]
[HarmonyPrefix]
public static void SwitchToBehaviourStateOnLocalClientPrefix(EnemyAI __instance, ref int stateIndex)
{
SwitchToBehaviourStateHandler((Component)(object)__instance, ref stateIndex);
}
private static void SwitchToBehaviourStateHandler(Component enemyAI, ref int stateIndex)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Invalid comparison between Unknown and I4
if (!(enemyAI is HoarderBugAI) || (int)ControlCenter.Instance.currentMode != 2)
{
return;
}
EnemyController currentControlledEnemy = ControlCenter.Instance.currentControlledEnemy;
if (!((Object)(object)currentControlledEnemy == (Object)null) && !currentControlledEnemy.isAIControlled)
{
DataHelper component = enemyAI.GetComponent<DataHelper>();
if (!((Object)(object)component == (Object)null) && component.HasData("IsAttacking") && !(bool)component.GetData("IsAttacking") && stateIndex == 2)
{
stateIndex = 0;
}
}
}
}
}
namespace ControlCompanyAddons.Input
{
internal static class InputHandler
{
internal static bool espEnabled;
internal static void Initialize()
{
ControlCompanyAddons.inputKeys.ReleaseControlKey.performed += OnEnemyReleaseKey;
ControlCompanyAddons.inputKeys.ToggleEspKey.performed += OnToggleEspKey;
}
private static void OnToggleEspKey(CallbackContext callbackContext)
{
if (!((CallbackContext)(ref callbackContext)).performed || (Object)(object)StartOfRound.Instance == (Object)null || !((NetworkBehaviour)StartOfRound.Instance).IsHost)
{
return;
}
espEnabled = !espEnabled;
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
foreach (PlayerControllerB val in allPlayerScripts)
{
if (!((Object)(object)val == (Object)null))
{
if (espEnabled)
{
PlayerEsp.ApplyEsp(val);
}
else
{
PlayerEsp.UnApplyEsp(val);
}
}
}
}
private static void OnEnemyReleaseKey(CallbackContext callbackContext)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Invalid comparison between Unknown and I4
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
if (!((CallbackContext)(ref callbackContext)).performed)
{
return;
}
ControlCenter instance = ControlCenter.Instance;
if ((int)instance.currentMode == 2)
{
EnemyController currentControlledEnemy = instance.currentControlledEnemy;
Debug.Assert((Object)(object)currentControlledEnemy != (Object)null, "enemyController != null");
GameObject enemyGameObject = currentControlledEnemy.enemyGameObject;
Debug.Assert((Object)(object)enemyGameObject != (Object)null, "currentControlledEnemy != null");
Vector3 position = enemyGameObject.transform.position;
instance.EnableGhost(true, position);
instance.ghostController.EnableLight(instance.isGhostIndoors);
currentControlledEnemy.EnableAIControl(true);
MonoBehaviour val = (MonoBehaviour)(object)currentControlledEnemy;
if ((Object)(object)val != (Object)null)
{
Object.Destroy((Object)(object)((Component)val).gameObject);
}
instance.currentMode = (Mode)1;
}
}
}
public class InputKeys : LcInputActions
{
[InputAction(/*Could not decode attribute arguments.*/)]
public InputAction ReleaseControlKey { get; set; }
[InputAction(/*Could not decode attribute arguments.*/)]
public InputAction ToggleEspKey { get; set; }
}
}
namespace ControlCompanyAddons.Helpers
{
public class DataHelper : MonoBehaviour
{
private readonly Dictionary<string, object> _dataDictionary = new Dictionary<string, object>();
public bool HasData(string key)
{
return _dataDictionary.ContainsKey(key);
}
public object GetData(string key)
{
return _dataDictionary.GetValueOrDefault(key);
}
public void SetData(string key, object data)
{
_dataDictionary.Remove(key);
_dataDictionary.Add(key, data);
}
}
}
namespace ControlCompanyAddons.Additions
{
public static class HoardingBugAdditions
{
private static readonly List<HoarderBugItem> _FakeStolenItems = new List<HoarderBugItem>();
public static void HandleAttackLogic(bool isAttacking)
{
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Expected O, but got Unknown
if (!isAttacking)
{
HoarderBugItem[] array = _FakeStolenItems.ToArray();
foreach (HoarderBugItem item in array)
{
_FakeStolenItems.Remove(item);
HoarderBugAI.HoarderBugItems.Remove(item);
}
return;
}
PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts;
foreach (PlayerControllerB val in allPlayerScripts)
{
if (!val.isPlayerControlled || val.isPlayerDead)
{
continue;
}
GrabbableObject[] itemSlots = val.ItemSlots;
foreach (GrabbableObject val2 in itemSlots)
{
if (val2 != null)
{
HoarderBugItem item2 = new HoarderBugItem(val2, (HoarderBugItemStatus)1, new Vector3(2000f, 2000f, 2000f));
_FakeStolenItems.Add(item2);
HoarderBugAI.HoarderBugItems.Add(item2);
}
}
}
}
}
public static class MouthDogAdditions
{
public static void HandleScreamOrLunge(MouthDogAI mouthDogAI, bool hasScreamed)
{
((EnemyAI)mouthDogAI).SwitchToBehaviourClientRpc(hasScreamed ? 2 : 3);
}
public static void HandleAngerState(MouthDogAI mouthDogAI, bool wasAngered)
{
((EnemyAI)mouthDogAI).SwitchToBehaviourClientRpc(wasAngered ? 1 : 0);
}
}
}
internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
int ICollection.Count => _items.Length;
bool ICollection.IsSynchronized => false;
object ICollection.SyncRoot => this;
object IList.this[int index]
{
get
{
return _items[index];
}
set
{
throw new NotSupportedException();
}
}
bool IList.IsFixedSize => true;
bool IList.IsReadOnly => true;
int IReadOnlyCollection<T>.Count => _items.Length;
T IReadOnlyList<T>.this[int index] => _items[index];
int ICollection<T>.Count => _items.Length;
bool ICollection<T>.IsReadOnly => true;
T IList<T>.this[int index]
{
get
{
return _items[index];
}
set
{
throw new NotSupportedException();
}
}
public <>z__ReadOnlyArray(T[] items)
{
_items = items;
}
IEnumerator IEnumerable.GetEnumerator()
{
return ((IEnumerable)_items).GetEnumerator();
}
void ICollection.CopyTo(Array array, int index)
{
((ICollection)_items).CopyTo(array, index);
}
int IList.Add(object value)
{
throw new NotSupportedException();
}
void IList.Clear()
{
throw new NotSupportedException();
}
bool IList.Contains(object value)
{
return ((IList)_items).Contains(value);
}
int IList.IndexOf(object value)
{
return ((IList)_items).IndexOf(value);
}
void IList.Insert(int index, object value)
{
throw new NotSupportedException();
}
void IList.Remove(object value)
{
throw new NotSupportedException();
}
void IList.RemoveAt(int index)
{
throw new NotSupportedException();
}
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
return ((IEnumerable<T>)_items).GetEnumerator();
}
void ICollection<T>.Add(T item)
{
throw new NotSupportedException();
}
void ICollection<T>.Clear()
{
throw new NotSupportedException();
}
bool ICollection<T>.Contains(T item)
{
return ((ICollection<T>)_items).Contains(item);
}
void ICollection<T>.CopyTo(T[] array, int arrayIndex)
{
((ICollection<T>)_items).CopyTo(array, arrayIndex);
}
bool ICollection<T>.Remove(T item)
{
throw new NotSupportedException();
}
int IList<T>.IndexOf(T item)
{
return ((IList<T>)_items).IndexOf(item);
}
void IList<T>.Insert(int index, T item)
{
throw new NotSupportedException();
}
void IList<T>.RemoveAt(int index)
{
throw new NotSupportedException();
}
}