using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CursedScraps;
using CursedScraps.Behaviours;
using CursedScraps.Behaviours.Curses;
using CursedScraps.Managers;
using CursedScraps.Values;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using TrickOrTreat.Behaviours;
using TrickOrTreat.Managers;
using TrickOrTreat.NetcodePatcher;
using TrickOrTreat.Patches;
using Unity.Netcode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("TrickOrTreat")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TrickOrTreat")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("aa332fd3-7a30-4c63-9e45-c5d6f0cb377a")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[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 TrickOrTreat
{
internal class Constants
{
public const string LITTLE_GIRL = "Little Girl";
public const string HALLOWEEN_CANDY = "Halloween Candy";
}
[BepInPlugin("Lega.TrickOrTreat", "Trick Or Treat", "1.0.2")]
public class TrickOrTreat : BaseUnityPlugin
{
private const string modGUID = "Lega.TrickOrTreat";
private const string modName = "Trick Or Treat";
private const string modVersion = "1.0.2";
private readonly Harmony harmony = new Harmony("Lega.TrickOrTreat");
private static readonly AssetBundle bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "trickortreat"));
internal static ManualLogSource mls;
public static ConfigFile configFile;
public static List<Sprite> sprites = new List<Sprite>();
public void Awake()
{
mls = Logger.CreateLogSource("TrickOrTreat");
configFile = ((BaseUnityPlugin)this).Config;
ConfigManager.Load();
NetcodePatcher();
LoadItems();
LoadEnemies();
LoadSprites();
harmony.PatchAll(typeof(ObjectCSManagerPatch));
harmony.PatchAll(typeof(PlayerControllerBPatch));
harmony.PatchAll(typeof(BeltBagItemPatch));
harmony.PatchAll(typeof(BeltBagInventoryUIPatch));
}
private static void NetcodePatcher()
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
public static void LoadItems()
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
List<CustomItem> list = new List<CustomItem>();
list.Add(new CustomItem(typeof(HalloweenCandy), bundle.LoadAsset<Item>("Assets/HalloweenCandy/HalloweenCandyItem.asset"), true, ConfigManager.minHalloweenCandy.Value, ConfigManager.maxHalloweenCandy.Value, ConfigManager.halloweenCandyRarity.Value, ConfigManager.halloweenCandyValue.Value));
List<CustomItem> list2 = list;
foreach (CustomItem item in list2)
{
Component obj = item.Item.spawnPrefab.AddComponent(item.Type);
PhysicsProp val = (PhysicsProp)(object)((obj is PhysicsProp) ? obj : null);
((GrabbableObject)val).grabbable = true;
((GrabbableObject)val).grabbableToEnemies = true;
((GrabbableObject)val).itemProperties = item.Item;
if (item.Item.isScrap)
{
((GrabbableObject)val).scrapValue = item.Value;
}
NetworkPrefabs.RegisterNetworkPrefab(item.Item.spawnPrefab);
Utilities.FixMixerGroups(item.Item.spawnPrefab);
Items.RegisterItem(item.Item);
}
CursedScraps.customItems.AddRange(list2);
}
public static void LoadEnemies()
{
EnemyType val = bundle.LoadAsset<EnemyType>("Assets/LittleGirl/LittleGirlEnemy.asset");
NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
Enemies.RegisterEnemy(val, ConfigManager.littleGirlRarity.Value, (LevelTypes)(-1), (TerminalNode)null, (TerminalKeyword)null);
}
public static void LoadSprites()
{
sprites = new List<Sprite>
{
bundle.LoadAsset<Sprite>("Assets/Images/HalloweenCandy1.png"),
bundle.LoadAsset<Sprite>("Assets/Images/HalloweenCandy2.png"),
bundle.LoadAsset<Sprite>("Assets/Images/HalloweenCandy3.png"),
bundle.LoadAsset<Sprite>("Assets/Images/HalloweenCandy4.png"),
bundle.LoadAsset<Sprite>("Assets/Images/HalloweenCandy5.png")
};
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "TrickOrTreat";
public const string PLUGIN_NAME = "TrickOrTreat";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace TrickOrTreat.Patches
{
internal class BeltBagInventoryUIPatch
{
[HarmonyPatch(typeof(BeltBagInventoryUI), "RemoveItemFromUI")]
[HarmonyPrefix]
private static bool PreDropObject(ref BeltBagInventoryUI __instance, int slot)
{
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)__instance.currentBeltBag != (Object)null && slot != -1)
{
if (__instance.currentBeltBag.objectsInBag.Count > slot && (Object)(object)__instance.currentBeltBag.objectsInBag[slot] != (Object)null)
{
GrabbableObject val = __instance.currentBeltBag.objectsInBag[slot];
HalloweenCandy halloweenCandy = val as HalloweenCandy;
if (halloweenCandy != null && halloweenCandy.currentStackedItems > 1 && !__instance.currentBeltBag.tryingAddToBag)
{
halloweenCandy.currentStackedItems--;
__instance.inventorySlotIcons[slot].sprite = ((IEnumerable<Sprite>)TrickOrTreat.sprites).FirstOrDefault((Func<Sprite, bool>)((Sprite s) => ((Object)s).name.Equals($"HalloweenCandy{halloweenCandy.currentStackedItems}")));
halloweenCandy.SpawnObjectServerRpc((int)((GrabbableObject)__instance.currentBeltBag).playerHeldBy.playerClientId);
HUDManager.Instance.SetMouseCursorSprite(HUDManager.Instance.handOpenCursorTex, default(Vector2));
return false;
}
}
}
return true;
}
[HarmonyPatch(typeof(BeltBagInventoryUI), "FillSlots")]
[HarmonyPostfix]
private static void FillSlots(ref BeltBagInventoryUI __instance)
{
for (int i = 0; i < __instance.inventorySlots.Length; i++)
{
if (__instance.currentBeltBag.objectsInBag == null || __instance.currentBeltBag.objectsInBag.Count <= i || (Object)(object)__instance.currentBeltBag.objectsInBag[i] == (Object)null)
{
((Behaviour)__instance.inventorySlotIcons[i]).enabled = false;
continue;
}
GrabbableObject val = __instance.currentBeltBag.objectsInBag[i];
HalloweenCandy halloweenCandy = val as HalloweenCandy;
if (halloweenCandy != null && halloweenCandy.currentStackedItems > 1)
{
((Behaviour)__instance.inventorySlotIcons[i]).enabled = true;
__instance.inventorySlotIcons[i].sprite = ((IEnumerable<Sprite>)TrickOrTreat.sprites).FirstOrDefault((Func<Sprite, bool>)((Sprite s) => ((Object)s).name.Equals($"HalloweenCandy{halloweenCandy.currentStackedItems}")));
}
}
}
}
internal class BeltBagItemPatch
{
[HarmonyPatch(typeof(BeltBagItem), "PutObjectInBagLocalClient")]
[HarmonyPrefix]
private static bool PreGrabObject(ref BeltBagItem __instance, ref GrabbableObject gObject)
{
if (gObject is HalloweenCandy halloweenCandy)
{
for (int i = 0; i < __instance.beltBagUI.inventorySlots.Length; i++)
{
if (__instance.objectsInBag == null || __instance.objectsInBag.Count <= i || (Object)(object)__instance.objectsInBag[i] == (Object)null)
{
((Behaviour)__instance.beltBagUI.inventorySlotIcons[i]).enabled = false;
continue;
}
GrabbableObject val = __instance.objectsInBag[i];
HalloweenCandy halloweenCandyHolded = val as HalloweenCandy;
if (halloweenCandyHolded != null && halloweenCandyHolded.currentStackedItems < 5)
{
halloweenCandyHolded.currentStackedItems++;
((Behaviour)__instance.beltBagUI.inventorySlotIcons[i]).enabled = true;
__instance.beltBagUI.inventorySlotIcons[i].sprite = ((IEnumerable<Sprite>)TrickOrTreat.sprites).FirstOrDefault((Func<Sprite, bool>)((Sprite s) => ((Object)s).name.Equals($"HalloweenCandy{halloweenCandyHolded.currentStackedItems}")));
halloweenCandy.DestroyObjectServerRpc();
RoundManager.PlayRandomClip(__instance.bagAudio, __instance.grabItemInBagSFX, true, 1f, -1, 1000);
((MonoBehaviour)__instance).StartCoroutine(__instance.putObjectInBagAnimation(gObject));
return false;
}
}
}
return true;
}
}
internal class ObjectCSManagerPatch
{
[HarmonyPatch(typeof(ObjectCSManager), "AddNewItems")]
[HarmonyPostfix]
private static void ChangeRarity()
{
SpawnableEnemyWithRarity val = ((IEnumerable<SpawnableEnemyWithRarity>)RoundManager.Instance.currentLevel.Enemies).FirstOrDefault((Func<SpawnableEnemyWithRarity, bool>)((SpawnableEnemyWithRarity e) => e.enemyType.enemyName.Equals("Little Girl")));
if (val != null)
{
int num = Object.FindObjectsOfType<HalloweenCandy>().Count();
val.rarity = ConfigManager.littleGirlRarity.Value + num * ConfigManager.littleGirlRarityIncrement.Value;
}
}
}
internal class PlayerControllerBPatch
{
[HarmonyPatch(typeof(PlayerControllerB), "BeginGrabObject")]
[HarmonyPrefix]
private static bool PreGrabObject(ref PlayerControllerB __instance)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: 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_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
__instance.interactRay = new Ray(((Component)__instance.gameplayCamera).transform.position, ((Component)__instance.gameplayCamera).transform.forward);
if (!Physics.Raycast(__instance.interactRay, ref __instance.hit, __instance.grabDistance, __instance.interactableObjectsMask) || ((Component)((RaycastHit)(ref __instance.hit)).collider).gameObject.layer == 8 || !(((Component)((RaycastHit)(ref __instance.hit)).collider).tag == "PhysicsProp") || __instance.twoHanded || __instance.sinkingValue > 0.73f || Physics.Linecast(((Component)__instance.gameplayCamera).transform.position, ((Component)((RaycastHit)(ref __instance.hit)).collider).transform.position + ((Component)__instance).transform.up * 0.16f, 1073741824, (QueryTriggerInteraction)1))
{
return true;
}
GrabbableObject component = ((Component)((Component)((RaycastHit)(ref __instance.hit)).collider).transform).gameObject.GetComponent<GrabbableObject>();
if ((Object)(object)component != (Object)null && component is HalloweenCandy halloweenCandy)
{
for (int i = 0; i < __instance.ItemSlots.Length; i++)
{
if ((Object)(object)__instance.ItemSlots[i] != (Object)null && __instance.ItemSlots[i] is HalloweenCandy halloweenCandy2 && halloweenCandy2.currentStackedItems < 5)
{
halloweenCandy2.currentStackedItems++;
halloweenCandy.UpdateIcon(i, halloweenCandy2.currentStackedItems);
halloweenCandy.DestroyObjectServerRpc();
return false;
}
}
}
return true;
}
[HarmonyPatch(typeof(PlayerControllerB), "DiscardHeldObject")]
[HarmonyPrefix]
private static bool PreDropObject(ref PlayerControllerB __instance)
{
if (__instance.currentlyHeldObjectServer is HalloweenCandy halloweenCandy && halloweenCandy.currentStackedItems > 1)
{
halloweenCandy.currentStackedItems--;
halloweenCandy.UpdateIcon(__instance.currentItemSlot, halloweenCandy.currentStackedItems);
halloweenCandy.SpawnObjectServerRpc((int)__instance.playerClientId);
return false;
}
return true;
}
}
}
namespace TrickOrTreat.Managers
{
internal class ConfigManager
{
public static ConfigEntry<int> littleGirlRarity;
public static ConfigEntry<int> littleGirlRarityIncrement;
public static ConfigEntry<int> waitingDuration;
public static ConfigEntry<int> halloweenCandyValue;
public static ConfigEntry<int> halloweenCandyRarity;
public static ConfigEntry<int> minHalloweenCandy;
public static ConfigEntry<int> maxHalloweenCandy;
internal static void Load()
{
littleGirlRarity = TrickOrTreat.configFile.Bind<int>("Little Girl", "Rarity", 5, "Little Girl base rarity.");
littleGirlRarityIncrement = TrickOrTreat.configFile.Bind<int>("Little Girl", "Increment rarity", 3, "By how much the Little Girl's chances of spawning are increased for each Halloween Candy spawned?");
waitingDuration = TrickOrTreat.configFile.Bind<int>("Little Girl", "Waiting duration", 10, "Time window during which a player can give a candy to the little girl before she sends her curse.");
halloweenCandyValue = TrickOrTreat.configFile.Bind<int>("Halloween Candy", "Value", 6, "Value of Halloween Candy");
halloweenCandyRarity = TrickOrTreat.configFile.Bind<int>("Halloween Candy", "Rarity", 50, "Halloween Candy spawn rarity.");
minHalloweenCandy = TrickOrTreat.configFile.Bind<int>("Halloween Candy", "Min spawn", 2, "Min Halloween Candy to spawn");
maxHalloweenCandy = TrickOrTreat.configFile.Bind<int>("Halloween Candy", "Max spawn", 6, "Max Halloween Candy to spawn");
}
}
}
namespace TrickOrTreat.Behaviours
{
public class HalloweenCandy : PhysicsProp
{
public int currentStackedItems = 1;
public override void ItemActivate(bool used, bool buttonDown = true)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: 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_0053: 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)
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (!buttonDown || !((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null))
{
return;
}
Collider[] array = Physics.OverlapSphere(((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.position + ((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.forward * 1.5f, 1f, 524288, (QueryTriggerInteraction)2);
Collider[] array2 = array;
foreach (Collider val in array2)
{
EnemyAI val2 = ((Component)val).GetComponent<EnemyAICollisionDetect>()?.mainScript;
if ((Object)(object)val2 != (Object)null && val2 is LittleGirl littleGirl && littleGirl.isWaiting)
{
GiveCandyServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)littleGirl).NetworkObject));
break;
}
}
}
[ServerRpc(RequireOwnership = false)]
private void GiveCandyServerRpc(NetworkObjectReference enemyObject)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: 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_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4119454480u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref enemyObject, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4119454480u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
GiveCandyClientRpc(enemyObject);
}
}
}
[ClientRpc]
private void GiveCandyClientRpc(NetworkObjectReference enemyObject)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: 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_0097: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(817935927u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref enemyObject, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 817935927u, val, (RpcDelivery)0);
}
NetworkObject val3 = default(NetworkObject);
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || !((NetworkObjectReference)(ref enemyObject)).TryGet(ref val3, (NetworkManager)null))
{
return;
}
EnemyAI componentInChildren = ((Component)val3).gameObject.GetComponentInChildren<EnemyAI>();
if ((Object)(object)componentInChildren != (Object)null && componentInChildren is LittleGirl littleGirl)
{
littleGirl.isBaited = true;
if (currentStackedItems > 1)
{
currentStackedItems--;
UpdateIcon(((GrabbableObject)this).playerHeldBy.currentItemSlot, currentStackedItems);
((GrabbableObject)this).playerHeldBy.itemAudio.PlayOneShot(((GrabbableObject)this).itemProperties.dropSFX);
}
else
{
((GrabbableObject)this).DestroyObjectInHand(((GrabbableObject)this).playerHeldBy);
}
}
}
public void UpdateIcon(int slot, int num)
{
HUDManager.Instance.itemSlotIcons[slot].sprite = ((IEnumerable<Sprite>)TrickOrTreat.sprites).FirstOrDefault((Func<Sprite, bool>)((Sprite s) => ((Object)s).name.Equals($"HalloweenCandy{num}")));
}
[ServerRpc(RequireOwnership = false)]
public void DestroyObjectServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1674385760u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1674385760u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
DestroyObjectClientRpc();
}
}
}
[ClientRpc]
public void DestroyObjectClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(505369659u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 505369659u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
((GrabbableObject)this).DestroyObjectInHand(((GrabbableObject)this).playerHeldBy);
}
}
}
[ServerRpc(RequireOwnership = false)]
public void SpawnObjectServerRpc(int playerId)
{
//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)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: 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_00ff: 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)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: 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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2661211596u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, playerId);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2661211596u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>();
Vector3 val3 = ((Component)component.gameplayCamera).transform.position + ((Component)component.gameplayCamera).transform.forward;
RaycastHit val4 = default(RaycastHit);
if (Physics.Raycast(val3, Vector3.down, ref val4, 80f, 268437760, (QueryTriggerInteraction)1))
{
val3 = ((RaycastHit)(ref val4)).point;
}
GrabbableObject val5 = ObjectCSManager.SpawnItem(ref ((GrabbableObject)this).itemProperties.spawnPrefab, ref val3);
SpawnObjectClientRpc(playerId, NetworkObjectReference.op_Implicit(((Component)val5).GetComponent<NetworkObject>()), val3);
}
}
[ClientRpc]
public void SpawnObjectClientRpc(int playerId, NetworkObjectReference obj, Vector3 position)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2402702181u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, playerId);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2402702181u, val, (RpcDelivery)0);
}
NetworkObject val3 = default(NetworkObject);
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref obj)).TryGet(ref val3, (NetworkManager)null))
{
GrabbableObject componentInChildren = ((Component)val3).gameObject.GetComponentInChildren<GrabbableObject>();
((Component)componentInChildren).transform.position = position + Vector3.up;
componentInChildren.startFallingPosition = ((Component)this).transform.position;
PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>();
if (component.isInElevator)
{
((Component)componentInChildren).transform.SetParent(component.playersManager.elevatorTransform, true);
}
if (Object.op_Implicit((Object)(object)((Component)componentInChildren).transform.parent))
{
componentInChildren.startFallingPosition = ((Component)componentInChildren).transform.parent.InverseTransformPoint(componentInChildren.startFallingPosition);
}
componentInChildren.FallToGround(false);
if (Object.op_Implicit((Object)(object)componentInChildren.itemProperties.dropSFX))
{
component.itemAudio.PlayOneShot(componentInChildren.itemProperties.dropSFX);
}
}
}
protected override void __initializeVariables()
{
((PhysicsProp)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_HalloweenCandy()
{
//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
NetworkManager.__rpc_func_table.Add(4119454480u, new RpcReceiveHandler(__rpc_handler_4119454480));
NetworkManager.__rpc_func_table.Add(817935927u, new RpcReceiveHandler(__rpc_handler_817935927));
NetworkManager.__rpc_func_table.Add(1674385760u, new RpcReceiveHandler(__rpc_handler_1674385760));
NetworkManager.__rpc_func_table.Add(505369659u, new RpcReceiveHandler(__rpc_handler_505369659));
NetworkManager.__rpc_func_table.Add(2661211596u, new RpcReceiveHandler(__rpc_handler_2661211596));
NetworkManager.__rpc_func_table.Add(2402702181u, new RpcReceiveHandler(__rpc_handler_2402702181));
}
private static void __rpc_handler_4119454480(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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
NetworkObjectReference enemyObject = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref enemyObject, default(ForNetworkSerializable));
target.__rpc_exec_stage = (__RpcExecStage)1;
((HalloweenCandy)(object)target).GiveCandyServerRpc(enemyObject);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_817935927(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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
NetworkObjectReference enemyObject = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref enemyObject, default(ForNetworkSerializable));
target.__rpc_exec_stage = (__RpcExecStage)2;
((HalloweenCandy)(object)target).GiveCandyClientRpc(enemyObject);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1674385760(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((HalloweenCandy)(object)target).DestroyObjectServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_505369659(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)2;
((HalloweenCandy)(object)target).DestroyObjectClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2661211596(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 playerId = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
target.__rpc_exec_stage = (__RpcExecStage)1;
((HalloweenCandy)(object)target).SpawnObjectServerRpc(playerId);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2402702181(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_005e: 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_0080: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int playerId = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
NetworkObjectReference obj = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
Vector3 position = default(Vector3);
((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
target.__rpc_exec_stage = (__RpcExecStage)2;
((HalloweenCandy)(object)target).SpawnObjectClientRpc(playerId, obj, position);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "HalloweenCandy";
}
}
public class LittleGirl : EnemyAI
{
private enum State
{
WANDERING,
CHASING,
INTERACTING,
FLEEING
}
public static Coroutine interactingCoroutine;
public static Coroutine fleeingCoroutine;
public bool isWaiting;
public bool isBaited;
public Transform TurnCompass;
public AudioClip[] FootstepSounds = Array.Empty<AudioClip>();
public float footstepTimer;
public override void Start()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Start();
base.currentBehaviourStateIndex = 0;
base.creatureAnimator.SetBool("startWalk", true);
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
}
public override void Update()
{
//IL_00a8: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Update();
base.creatureAnimator.SetBool("stunned", base.stunNormalizedTimer > 0f);
if (base.stunNormalizedTimer > 0f)
{
base.agent.speed = 0f;
if ((Object)(object)base.stunnedByPlayer != (Object)null)
{
base.targetPlayer = base.stunnedByPlayer;
((EnemyAI)this).StopSearch(base.currentSearch, true);
((EnemyAI)this).SwitchToBehaviourClientRpc(1);
}
}
else
{
PlayFootstepSound();
int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
if ((Object)(object)base.targetPlayer != (Object)null && (currentBehaviourStateIndex == 1 || currentBehaviourStateIndex == 2))
{
TurnCompass.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position);
((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, TurnCompass.eulerAngles.y, 0f)), 4f * Time.deltaTime);
}
}
}
public void PlayFootstepSound()
{
if (base.currentBehaviourStateIndex != 2)
{
footstepTimer -= Time.deltaTime;
if (FootstepSounds.Length != 0 && footstepTimer <= 0f)
{
base.creatureSFX.PlayOneShot(FootstepSounds[Random.Range(0, FootstepSounds.Length)]);
footstepTimer = 0.6f;
}
}
}
public override void DoAIInterval()
{
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).DoAIInterval();
if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
{
return;
}
switch (base.currentBehaviourStateIndex)
{
case 0:
base.agent.speed = 4f;
if (FoundClosestPlayerInRange(25f, 10f))
{
((EnemyAI)this).StopSearch(base.currentSearch, true);
DoAnimationClientRpc("startRun");
((EnemyAI)this).SwitchToBehaviourClientRpc(1);
}
break;
case 1:
base.agent.speed = 6f;
if (!TargetClosestPlayerInAnyCase() || (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 20f && !((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer).transform.position, 45f, 60, -1f, (Transform)null)))
{
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
DoAnimationClientRpc("startWalk");
((EnemyAI)this).SwitchToBehaviourClientRpc(0);
}
else
{
((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
}
break;
case 2:
base.agent.speed = 0f;
if (interactingCoroutine == null)
{
interactingCoroutine = ((MonoBehaviour)this).StartCoroutine(InteractingWithPlayerCoroutine());
}
break;
case 3:
base.agent.speed = 6f;
if (fleeingCoroutine == null)
{
fleeingCoroutine = ((MonoBehaviour)this).StartCoroutine(FleeingCoroutine());
}
break;
}
}
private bool FoundClosestPlayerInRange(float range, float senseRange)
{
//IL_0049: 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)
((EnemyAI)this).TargetClosestPlayer(1.5f, true, 70f);
if ((Object)(object)base.targetPlayer == (Object)null)
{
((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f);
range = senseRange;
}
if ((Object)(object)base.targetPlayer != (Object)null)
{
return Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < range;
}
return false;
}
private bool TargetClosestPlayerInAnyCase()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
base.mostOptimalDistance = 2000f;
base.targetPlayer = null;
for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
{
base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position);
if (base.tempDist < base.mostOptimalDistance)
{
base.mostOptimalDistance = base.tempDist;
base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i];
}
}
if ((Object)(object)base.targetPlayer == (Object)null)
{
return false;
}
return true;
}
public IEnumerator InteractingWithPlayerCoroutine()
{
BeginInteractingClientRpc("Trick or treat?", "Little Girl", (int)base.targetPlayer.playerClientId);
int timePassed = 0;
while (!isBaited)
{
yield return (object)new WaitForSeconds(1f);
timePassed++;
if (timePassed >= ConfigManager.waitingDuration.Value || Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 20f)
{
isWaiting = false;
List<CurseEffect> eligibleCurses = CurseCSManager.GetEligibleCurseEffects(StartOfRound.Instance.currentLevel.PlanetName);
PlayerCSBehaviour component = ((Component)base.targetPlayer).GetComponent<PlayerCSBehaviour>();
if (component.activeCurses.Count > 0 && component.activeCurses.Count != eligibleCurses.Count)
{
eligibleCurses = eligibleCurses.Except(component.activeCurses).ToList();
}
DoAnimationClientRpc("startCurse");
ScreamClientRpc();
yield return null;
AnimatorStateInfo currentAnimatorStateInfo = base.creatureAnimator.GetCurrentAnimatorStateInfo(0);
yield return (object)new WaitForSeconds(((AnimatorStateInfo)(ref currentAnimatorStateInfo)).length);
if (eligibleCurses.Count > 0)
{
CursedScrapsNetworkManager.Instance.SetPlayerCurseEffectServerRpc((int)base.targetPlayer.playerClientId, eligibleCurses[new Random().Next(eligibleCurses.Count)].CurseName, true);
}
else
{
CursedScrapsNetworkManager.Instance.KillPlayerServerRpc((int)base.targetPlayer.playerClientId, Vector3.zero, true, 0);
}
break;
}
}
DoAnimationClientRpc("startRun");
((EnemyAI)this).SwitchToBehaviourClientRpc(3);
yield return (object)new WaitForSeconds(5f);
EndInteractingClientRpc();
}
[ClientRpc]
public void BeginInteractingClientRpc(string message, string sender, int playerId)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(251677412u, val, (RpcDelivery)0);
bool flag = message != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(message, false);
}
bool flag2 = sender != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
if (flag2)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(sender, false);
}
BytePacker.WriteValueBitPacked(val2, playerId);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 251677412u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
isWaiting = true;
base.enemyType.canBeStunned = false;
if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>())
{
HUDManager.Instance.AddChatMessage(message, sender);
}
}
}
[ClientRpc]
public void ScreamClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(583603153u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 583603153u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
base.creatureVoice.Play();
}
}
}
[ClientRpc]
public void EndInteractingClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1077734210u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1077734210u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
isWaiting = false;
isBaited = false;
base.enemyType.canBeStunned = true;
interactingCoroutine = null;
}
}
}
public IEnumerator FleeingCoroutine()
{
Transform transform = ((Component)this).transform;
if ((Object)(object)base.targetPlayer != (Object)null)
{
transform = ((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)base.targetPlayer).transform.position, false, 0, false, 50, false);
((EnemyAI)this).SetDestinationToPosition(Object.op_Implicit((Object)(object)transform) ? transform.position : ((Component)this).transform.position, true);
base.targetPlayer = null;
yield return (object)new WaitForSeconds(5f);
}
((EnemyAI)this).StartSearch(transform.position, (AISearchRoutine)null);
DoAnimationClientRpc("startWalk");
((EnemyAI)this).SwitchToBehaviourClientRpc(0);
fleeingCoroutine = null;
}
public override void OnCollideWithPlayer(Collider other)
{
PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
if ((Object)(object)val != (Object)null && base.currentBehaviourStateIndex == 1)
{
DoAnimationClientRpc("startIdle");
((EnemyAI)this).SwitchToBehaviourServerRpc(2);
}
}
[ClientRpc]
public void DoAnimationClientRpc(string animationState)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: 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_00ba: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2521819027u, val, (RpcDelivery)0);
bool flag = animationState != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(animationState, false);
}
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2521819027u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
base.creatureAnimator.SetTrigger(animationState);
}
}
protected override void __initializeVariables()
{
((EnemyAI)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_LittleGirl()
{
//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
NetworkManager.__rpc_func_table.Add(251677412u, new RpcReceiveHandler(__rpc_handler_251677412));
NetworkManager.__rpc_func_table.Add(583603153u, new RpcReceiveHandler(__rpc_handler_583603153));
NetworkManager.__rpc_func_table.Add(1077734210u, new RpcReceiveHandler(__rpc_handler_1077734210));
NetworkManager.__rpc_func_table.Add(2521819027u, new RpcReceiveHandler(__rpc_handler_2521819027));
}
private static void __rpc_handler_251677412(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_0067: 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_0093: 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_00c8: 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 message = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref message, false);
}
bool flag2 = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
string sender = null;
if (flag2)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref sender, false);
}
int playerId = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
target.__rpc_exec_stage = (__RpcExecStage)2;
((LittleGirl)(object)target).BeginInteractingClientRpc(message, sender, playerId);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_583603153(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)2;
((LittleGirl)(object)target).ScreamClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1077734210(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)2;
((LittleGirl)(object)target).EndInteractingClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2521819027(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_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: 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 animationState = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref animationState, false);
}
target.__rpc_exec_stage = (__RpcExecStage)2;
((LittleGirl)(object)target).DoAnimationClientRpc(animationState);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "LittleGirl";
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace TrickOrTreat.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}