Decompiled source of RandomEvents v0.1.14
plugins/com.github.Wesmania.RandomEvents.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Peak.Afflictions; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.Networking; using UnityEngine.UI; using Zorro.ControllerSupport; using Zorro.Core; using Zorro.Settings; using pworld.Scripts.Extensions; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("com.github.Wesmania.RandomEvents")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.14.0")] [assembly: AssemblyInformationalVersion("0.1.14+e060b157aaabf0a1d849fed69eb0d601944ebbf2")] [assembly: AssemblyProduct("com.github.Wesmania.RandomEvents")] [assembly: AssemblyTitle("RandomEvents")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.14.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 BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace RandomEvents { public class EventsConfig { public ConfigEntry<int> EventCount; public EventsConfig(ConfigFile c) { EventCount = c.Bind<int>("Config", "EventCount", 2, "How many events should be selected per biome."); } } internal static class Stuff { private static string? new_events; public static void NewEvents(bool is_first, OurBiome biome) { if (Messages.IsMaster()) { new_events = Plugin.pick_events.PickNewEvents(is_first, biome, Plugin.config.EventCount.Value); if (new_events != null) { Plugin.m.SendEvent(MessageType.STOP_EVENTS, "", (ReceiverGroup)1, reliable: true); Plugin.m.SendEvent(MessageType.NEW_EVENTS, new_events, (ReceiverGroup)1, reliable: true); } } } public static void ResendEvent(Player target) { if (Messages.IsMaster() && new_events != null) { Plugin.m.SendEventTo(MessageType.STOP_EVENTS, "", new int[1] { target.ActorNumber }, reliable: true); Plugin.m.SendEventTo(MessageType.NEW_EVENTS, new_events, new int[1] { target.ActorNumber }, reliable: true); } } } [HarmonyPatch(typeof(AirportCheckInKiosk), "LoadIslandMaster")] public static class ChangeMapPatch1 { public static void Postfix(AirportCheckInKiosk __instance, int ascent) { Stuff.NewEvents(is_first: true, OurBiome.Shore); } } [HarmonyPatch(typeof(Campfire))] public static class ChangeMapPatch2 { [HarmonyPostfix] [HarmonyPatch("Light_Rpc")] public static void LightPostfix(Campfire __instance) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0025: 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) MapHandler instance = Singleton<MapHandler>.Instance; if (!((Object)(object)instance == (Object)null)) { Segment advanceToSegment = __instance.advanceToSegment; BiomeType biome = instance.segments[advanceToSegment].biome; OurBiome biome2 = BiomeConv.FromSegmentBiome(advanceToSegment, biome); Stuff.NewEvents(is_first: false, biome2); } } } internal class ShowPluginInfo { public static void Show() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) SoulmateTextPatch.setter?.ShowCard(new List<NiceText>(1) { new NiceText { c = Color.white, s = "Random events version 0.1.14 loaded." } }, 10f); } } public class EventInterface { private List<NiceText> start_texts = new List<NiceText>(); public bool is_first; public List<AllEvents> activeEvents = new List<AllEvents>(); public void AddEnableLine(NiceText line) { start_texts.Add(line); } public void AddEnableLine(string line) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) AddEnableLine(new NiceText { s = line, c = Color.white }); } public void RunInterface(float delay) { SoulmateTextPatch.setter?.ShowCard(start_texts, delay); start_texts.Clear(); } public List<AllEvents> ActiveEvents() { return activeEvents; } } public enum OurBiome { Shore, Tropics, Roots, Alpine, Mesa, Caldera, Kiln, Peak } public struct IEventFactory { public Func<OurBiome, IEvent> New; public Func<JObject, IEvent> FromJson; } public enum AllEvents { GREAT_MAGICIAN = 1, EMISSIONS, CURSE_DAMAGE, FREE_BALLOON, NO_SCUTTLING, SUPER_RESCUE_HOOKS, DOOM_MODE, FROSTBITE, BOUNCY, ALL_SHROOMS, RAMADAN, PUNCH, MEGABOOST, NON_AMBITURNER, GRAB_PINGS, BEES, HEAVY_DUTY, HUGS, PLAYER_ROPE } public static class BiomeConv { public static OurBiome FromSegmentBiome(Segment s, BiomeType b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected I4, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 switch ((int)s) { case 3: return OurBiome.Caldera; case 4: return OurBiome.Kiln; case 5: return OurBiome.Peak; case 1: if ((int)b == 7) { return OurBiome.Roots; } return OurBiome.Tropics; case 2: if ((int)b == 2) { return OurBiome.Alpine; } return OurBiome.Mesa; default: return OurBiome.Shore; } } } public interface IEvent { static Dictionary<AllEvents, IEventFactory> all_events = new Dictionary<AllEvents, IEventFactory> { { AllEvents.GREAT_MAGICIAN, GreatMagicianEvent.factory() }, { AllEvents.EMISSIONS, HeatEmissionEvent.factory() }, { AllEvents.CURSE_DAMAGE, CurseDamageEvent.factory() }, { AllEvents.FREE_BALLOON, FreeBalloonEvent.factory() }, { AllEvents.NO_SCUTTLING, NoScuttlingEvent.factory() }, { AllEvents.SUPER_RESCUE_HOOKS, SuperRescueHookEvent.factory() }, { AllEvents.DOOM_MODE, DoomModeEvent.factory() }, { AllEvents.FROSTBITE, FrostbiteEvent.factory() }, { AllEvents.BOUNCY, BouncyEvent.factory() }, { AllEvents.ALL_SHROOMS, AllShroomsEvent.factory() }, { AllEvents.RAMADAN, RamadanEvent.factory() }, { AllEvents.PUNCH, SlapEvent.factory() }, { AllEvents.MEGABOOST, MegaboostEvent.factory() }, { AllEvents.NON_AMBITURNER, NonAmbiturnerEvent.factory() }, { AllEvents.GRAB_PINGS, GrabPingsEvent.factory() }, { AllEvents.BEES, BeesEvent.factory() }, { AllEvents.HEAVY_DUTY, HeavyDutyEvent.factory() }, { AllEvents.HUGS, HugsEvent.factory() }, { AllEvents.PLAYER_ROPE, PlayerRopeEvent.factory() } }; JObject to_json(); void Enable(EventInterface eintf); void LateEnable(EventInterface eintf) { } void Disable(EventInterface eintf); HashSet<OurBiome> ZoneLimit() { return new HashSet<OurBiome>(); } HashSet<AllEvents> ExcludeEvents() { return new HashSet<AllEvents>(); } } public struct EnableMessage { public Dictionary<AllEvents, JObject> events; public bool is_first; } public class LateEventCaller : MonoBehaviour { public void LoadEvents(List<IEvent> events, EventInterface eintf, float delay) { ((MonoBehaviour)this).StartCoroutine(DoLoadEvents(events, eintf, delay)); } private IEnumerator DoLoadEvents(List<IEvent> events, EventInterface eintf, float delay) { yield return (object)new WaitForSeconds(delay); foreach (IEvent @event in events) { @event.LateEnable(eintf); } } public void PhotonDestroyDelayed(GameObject o, float d) { ((MonoBehaviour)this).StartCoroutine(DoPhotonDestroyDelayed(o, d)); } private IEnumerator DoPhotonDestroyDelayed(GameObject o, float d) { yield return (object)new WaitForSeconds(d); PhotonNetwork.Destroy(o); } } public class PickEvents { private List<IEvent> events = new List<IEvent>(); private List<AllEvents> previous_biome_events = new List<AllEvents>(); public bool is_first = true; private static bool first_event_received; private AllEvents? OverrideEvent() { return null; } public string? PickNewEvents(bool is_first, OurBiome biome, int event_count) { if (!Messages.IsMaster()) { return null; } if (!is_first && !first_event_received) { return null; } List<AllEvents> list = Enum.GetValues(typeof(AllEvents)).Cast<AllEvents>().ToList(); AllEvents? allEvents = OverrideEvent(); if (allEvents.HasValue) { list[0] = allEvents.Value; event_count = 1; } List<(AllEvents, IEvent)> list2 = (from e in list select (e, IEvent.all_events[e].New(biome)) into e where e.e.ZoneLimit().Count == 0 || e.e.ZoneLimit().Contains(biome) select e).ToList(); if (!allEvents.HasValue) { ExtCollections.Shuffle<(AllEvents, IEvent)>((IList<(AllEvents, IEvent)>)list2); List<(AllEvents, IEvent)> list3 = list2.Where<(AllEvents, IEvent)>(((AllEvents id, IEvent e) e) => previous_biome_events.Contains(e.id)).ToList(); List<(AllEvents, IEvent)> list4 = list2.Where<(AllEvents, IEvent)>(((AllEvents id, IEvent e) e) => !previous_biome_events.Contains(e.id)).ToList(); List<(AllEvents, IEvent)> list5 = list4; List<(AllEvents, IEvent)> list6 = list3; List<(AllEvents, IEvent)> list7 = new List<(AllEvents, IEvent)>(list5.Count + list6.Count); list7.AddRange(list5); list7.AddRange(list6); list2 = list7; } HashSet<AllEvents> excludes = new HashSet<AllEvents>(); HashSet<AllEvents> already_selected = new HashSet<AllEvents>(); List<(AllEvents, IEvent)> source = list2.Where<(AllEvents, IEvent)>(delegate((AllEvents id, IEvent e) e) { if (excludes.Contains(e.id)) { return false; } HashSet<AllEvents> hashSet = e.e.ExcludeEvents(); if (!hashSet.Any()) { already_selected.Add(e.id); return true; } if (hashSet.Intersect(already_selected).Count() > 0) { return false; } excludes.UnionWith(hashSet); already_selected.Add(e.id); return true; }).ToList(); Dictionary<AllEvents, JObject> dictionary = (from e in source.Take(Math.Min(event_count, list2.Count())) select (e.id, e.e.to_json())).ToDictionary<(AllEvents, JObject), AllEvents, JObject>(((AllEvents id, JObject json) e) => e.id, ((AllEvents id, JObject json) e) => e.json); EnableMessage enableMessage = default(EnableMessage); enableMessage.events = dictionary; enableMessage.is_first = is_first; EnableMessage enableMessage2 = enableMessage; return JsonConvert.SerializeObject((object)enableMessage2); } public void UnloadEvents(EventInterface eintf) { foreach (IEvent @event in events) { @event.Disable(eintf); } events = new List<IEvent>(); } public void LoadNewEvents(string s, EventInterface eintf) { EnableMessage enableMessage = JsonConvert.DeserializeObject<EnableMessage>(s); if (enableMessage.is_first) { first_event_received = true; } is_first = enableMessage.is_first; eintf.is_first = is_first; events = enableMessage.events.Select<KeyValuePair<AllEvents, JObject>, IEvent>((KeyValuePair<AllEvents, JObject> kv) => IEvent.all_events[kv.Key].FromJson(kv.Value)).ToList(); eintf.activeEvents = enableMessage.events.Keys.ToList(); previous_biome_events = eintf.activeEvents; foreach (IEvent @event in events) { @event.Enable(eintf); } GlobalBehaviours.late_events.LoadEvents(events, eintf, is_first ? 15f : 0f); } } public class AllShroomsGlobals { public static bool enabled = false; public static bool in_check = false; private static List<string> prefab_names = new List<string>(5) { "Shroomberry_Red", "Shroomberry_Yellow", "Shroomberry_Green", "Shroomberry_Blue", "Shroomberry_Purple" }; private static List<GameObject>? shroom_objs = null; private static List<GameObject> get_shroom_objs() { if (shroom_objs == null) { shroom_objs = prefab_names.Select(delegate(string name) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown GameObject val = new GameObject(); ((Object)val).name = name; return val; }).ToList(); } return shroom_objs; } public static List<GameObject> getShrooms(int count, bool canRepeat) { List<GameObject> source = get_shroom_objs(); List<GameObject> list = source.ToList(); List<GameObject> list2 = new List<GameObject>(); for (int i = 0; i < count; i++) { GameObject item = Util.RandomSelection<GameObject>((IEnumerable<GameObject>)list, (Func<GameObject, int>)((GameObject _) => 1)); list2.Add(item); if (!canRepeat) { if (list.Count <= 1) { list = source.ToList(); } list.Remove(item); } } return list2; } } [HarmonyPatch(typeof(SpawnList), "GetSpawns")] public class AllShroomSpawnPatch { private static bool Prefix(SpawnList __instance, int count, bool canRepeat, ref List<GameObject> __result) { if (AllShroomsGlobals.enabled && AllShroomsGlobals.in_check) { __result = AllShroomsGlobals.getShrooms(count, canRepeat); return false; } return true; } } [HarmonyPatch(typeof(LootData), "GetRandomItem")] public class AllShroomsLootPatch { public static bool Prefix(SpawnPool spawnPool, ref GameObject __result) { if (AllShroomsGlobals.enabled && AllShroomsGlobals.in_check) { List<GameObject> shrooms = AllShroomsGlobals.getShrooms(1, canRepeat: true); __result = shrooms[0]; return false; } return true; } } [HarmonyPatch(typeof(GroundPlaceSpawner), "SpawnItems")] public class AllShroomsGroundHook { private static void Prefix(GroundPlaceSpawner __instance, List<Transform> spawnSpots) { AllShroomsGlobals.in_check = true; } private static void Postfix(GroundPlaceSpawner __instance, List<Transform> spawnSpots) { AllShroomsGlobals.in_check = false; } } [HarmonyPatch(typeof(BerryBush), "SpawnItems")] public class AllShroomsBerryBushHook { private static void Prefix(BerryBush __instance, List<Transform> spawnSpots) { AllShroomsGlobals.in_check = true; } private static void Postfix(BerryBush __instance, List<Transform> spawnSpots) { AllShroomsGlobals.in_check = false; } } [HarmonyPatch(typeof(BerryVine), "SpawnItems")] public class AllShroomsBerryVineHook { private static void Prefix(BerryVine __instance, List<Transform> spawnSpots) { AllShroomsGlobals.in_check = true; } private static void Postfix(BerryVine __instance, List<Transform> spawnSpots) { AllShroomsGlobals.in_check = false; } } public class AllShroomsEvent : IEvent { public void Disable(EventInterface eintf) { AllShroomsGlobals.enabled = false; } public void Enable(EventInterface eintf) { eintf.AddEnableLine("All natural food is shroomberries."); AllShroomsGlobals.enabled = true; } public JObject to_json() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new JObject(); } public static IEventFactory factory() { IEventFactory result = default(IEventFactory); result.New = (OurBiome _) => new AllShroomsEvent(); result.FromJson = (JObject _) => new AllShroomsEvent(); return result; } public HashSet<OurBiome> ZoneLimit() { return new HashSet<OurBiome> { OurBiome.Shore, OurBiome.Tropics, OurBiome.Roots, OurBiome.Alpine, OurBiome.Mesa }; } } internal class BeeSwarmData { public static bool enabled = false; private static HashSet<string> AllBugles = new HashSet<string> { "Bugle", "Bugle_Magic", "Bugle_Scoutmaster Variant" }; public static readonly string SwarmName = "BeeSwarm"; private static readonly string bugle_name = "Bugle"; private static readonly ushort bugle_id = 15; public static GameObject MakeSuperBees(Character c) { //IL_0006: 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) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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) return PhotonNetwork.Instantiate(SwarmName, c.Center + 15f * Vector3.up, Quaternion.identity, (byte)0, new object[1] { "Random Events" }); } public static void DestroyBees() { BeeSwarm[] array = Object.FindObjectsByType<BeeSwarm>((FindObjectsSortMode)0); BeeSwarm[] array2 = array; BeeSwarm[] array3 = array2; foreach (BeeSwarm val in array3) { if (((MonoBehaviourPun)val).photonView.IsMine) { PhotonNetwork.Destroy(((Component)val).gameObject); } } } public static void GiveBugle(Character c) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown ItemInstanceData d = new ItemInstanceData(Guid.NewGuid()); GiveItem.Do(c, bugle_id, bugle_name, d); } public static bool TootsBugle(Character c) { Item currentItem = c.data.currentItem; string item = AllBans.stripName(((Object)currentItem).name); if (!AllBugles.Contains(item)) { return false; } return currentItem.isUsingPrimary; } public static bool Speaks(Character c) { AnimatedMouth component = ((Component)c).GetComponent<AnimatedMouth>(); if ((Object)(object)component == (Object)null) { return false; } return component.isSpeaking; } } [HarmonyPatch(typeof(PhotonNetwork), "NetworkInstantiate", new Type[] { typeof(InstantiateParameters), typeof(bool), typeof(bool) })] public static class SuperSwarmMaker { public static void Postfix(InstantiateParameters parameters, bool roomObject, bool instantiateEvent, ref GameObject __result) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (parameters.prefabName != BeeSwarmData.SwarmName || parameters.data == null || parameters.data.Length == 0) { return; } string text = (string)parameters.data[0]; if (text != null && !(text != "Random Events")) { BeeSwarm component = __result.GetComponent<BeeSwarm>(); component.deAggroDistance = 10000f; component.hiveAggroDistance = 10000f; component.beesAngry = true; component.beehiveDangerTick = 3600f; component.beesDispersalTime = 3600f; component.movementForceAngry *= 0.65f; if (((MonoBehaviourPun)component).photonView.IsMine) { component.currentAggroCharacter = Character.localCharacter; } } } } [HarmonyPatch(typeof(BeeSwarm), "Update")] public static class BeePush { private static float sum; private static void Postfix(BeeSwarm __instance) { //IL_0037: 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_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_0050: 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_0077: 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) //IL_007e: 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) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_00b4: 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_018a: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_0118: 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_011f: 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) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) if (!BeeSwarmData.enabled || !((MonoBehaviourPun)__instance).photonView.IsMine) { return; } Vector3? val = null; Vector3 val2; foreach (Character allCharacter in Character.AllCharacters) { Vector3 center = allCharacter.Center; Vector3 position = ((Component)__instance).gameObject.transform.position; float num = Vector3.Distance(center, position); if (!(num > 30f) && BeeSwarmData.TootsBugle(allCharacter)) { Vector3 normalized = ((Vector3)(ref allCharacter.data.lookDirection)).normalized; val2 = Vector3.Cross(normalized, position - center); float magnitude = ((Vector3)(ref val2)).magnitude; if (num < 10f || magnitude < 5f) { val2 = position - center; val = ((Vector3)(ref val2)).normalized; break; } } } if (!val.HasValue) { foreach (Character allCharacter2 in Character.AllCharacters) { Vector3 center2 = allCharacter2.Center; Vector3 position2 = ((Component)__instance).gameObject.transform.position; float num2 = Vector3.Distance(center2, position2); if (!(num2 > 7f) && BeeSwarmData.Speaks(allCharacter2)) { val2 = position2 - center2; val = ((Vector3)(ref val2)).normalized * 0.8f; break; } } } if (val.HasValue) { __instance.rb.AddForce(val.Value * (450f * Time.fixedDeltaTime), (ForceMode)5); } Campfire currentCampfire = MapHandler.CurrentCampfire; if ((Object)(object)currentCampfire != (Object)null) { Vector3 position3 = ((Component)currentCampfire).gameObject.transform.position; val2 = Character.localCharacter.Center - position3; if (((Vector3)(ref val2)).magnitude < 20f) { __instance.deAggroDistance = 0f; __instance.hiveAggroDistance = 0f; __instance.beesAngry = false; __instance.beehiveDangerTick = 0f; __instance.beesDispersalTime = 0f; } } sum += Time.deltaTime; if (sum > 1f) { sum = 0f; val2 = Character.localCharacter.Center - ((Component)__instance).gameObject.transform.position; float magnitude2 = ((Vector3)(ref val2)).magnitude; if (magnitude2 > 50f) { __instance.movementForceAngry = 2f; } else { __instance.movementForceAngry = 0.65f; } } } } public class BeesEvent : IEvent { public void Disable(EventInterface eintf) { BeeSwarmData.enabled = false; BeeSwarmData.DestroyBees(); } public static IEnumerator DelayedBees() { yield return (object)new WaitForSeconds(15f); BeeSwarmData.MakeSuperBees(Character.localCharacter); } public void Enable(EventInterface eintf) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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) eintf.AddEnableLine(new NiceText { s = "Bees.", c = Color.yellow * 0.8f }); eintf.AddEnableLine("(Hint: bees dislike noise.)"); } public void LateEnable(EventInterface eintf) { BeeSwarmData.enabled = true; BeeSwarmData.GiveBugle(Character.localCharacter); LateEventCaller? late_events = GlobalBehaviours.late_events; if (late_events != null) { ((MonoBehaviour)late_events).StartCoroutine(DelayedBees()); } } public JObject to_json() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new JObject(); } public static IEventFactory factory() { IEventFactory result = default(IEventFactory); result.New = (OurBiome _) => new BeesEvent(); result.FromJson = (JObject _) => new BeesEvent(); return result; } public HashSet<OurBiome> ZoneLimit() { return new HashSet<OurBiome> { OurBiome.Shore, OurBiome.Tropics, OurBiome.Roots, OurBiome.Alpine, OurBiome.Mesa, OurBiome.Caldera }; } } [HarmonyPatch(typeof(CharacterMovement), "Land")] public class CharacterLandPatch { public static bool enabled; private static bool nested; private static void Postfix(CharacterMovement __instance, PlayerGroundSample bestSample) { //IL_00a0: 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_00c3: Unknown result type (might be due to invalid IL or missing references) if (!enabled || nested) { return; } Character character = __instance.character; if (!(character.data.sinceGrounded <= 0.5f)) { nested = true; float knockback = 5000f; Parasol val = default(Parasol); if (Object.op_Implicit((Object)(object)character.data.currentItem) && ((Component)character.data.currentItem).TryGetComponent<Parasol>(ref val) && val.isOpen) { knockback = 1000f; } if (character.data.fallSeconds > 0f || character.refs.afflictions.shouldPassOut) { knockback = 0f; } character.AddStamina(0.2f); Vector3 normal = bestSample.normal; SmoothBounce smoothBounce = ((Component)__instance).GetComponent<SmoothBounce>() ?? ((Component)__instance).gameObject.AddComponent<SmoothBounce>(); ((MonoBehaviour)smoothBounce).StartCoroutine(smoothBounce.BounceRoutine(knockback, character, normal)); nested = false; } } } public class SmoothBounce : MonoBehaviour { public IEnumerator BounceRoutine(float knockback, Character character, Vector3 kb) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) float t = 0f; while (t < 1f) { if (character.data.GetTargetRagdollControll() != 0f) { character.AddForce(kb * knockback * (1f - t) * Time.fixedDeltaTime, 1f, 1f); } character.data.sinceGrounded = Mathf.Clamp(character.data.sinceGrounded, 0f, 0.5f); t += Time.fixedDeltaTime; yield return (object)new WaitForFixedUpdate(); } } } public class BouncyEvent : IEvent { public void Disable(EventInterface eintf) { CharacterLandPatch.enabled = false; } public void Enable(EventInterface eintf) { CharacterLandPatch.enabled = true; eintf.AddEnableLine("All scouts are bouncy."); } public JObject to_json() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new JObject(); } public static IEventFactory factory() { IEventFactory result = default(IEventFactory); result.New = (OurBiome _) => new BouncyEvent(); result.FromJson = (JObject _) => new BouncyEvent(); return result; } } public static class Extensions { private static HashSet<STATUSTYPE> NonCursables = new HashSet<STATUSTYPE> { (STATUSTYPE)7, (STATUSTYPE)9, (STATUSTYPE)1, (STATUSTYPE)5, (STATUSTYPE)11 }; public static bool isCursable(this STATUSTYPE t) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0024: Unknown result type (might be due to invalid IL or missing references) if ((int)t == 2 && DayNightManager.instance.isDay != 1f && Ascents.currentAscent >= 5) { return false; } return !NonCursables.Contains(t); } } [HarmonyPatch(typeof(CharacterAfflictions))] public class SharedDamagePatch { public static bool enabled = false; private static float multiplier = 0.05f; private static float too_much_curse = 0.5f; [HarmonyPrefix] [HarmonyPatch("SetStatus", new Type[] { typeof(STATUSTYPE), typeof(float), typeof(bool) })] public static void SetStatusPrefix(CharacterAfflictions __instance, ref STATUSTYPE statusType, ref float amount, bool pushStatus) { if (!enabled || !statusType.isCursable()) { return; } float currentStatus = __instance.GetCurrentStatus(statusType); if (!(currentStatus > amount)) { float num = (amount - currentStatus) * multiplier; float num2 = __instance.GetCurrentStatus((STATUSTYPE)5) + num; if (!(num2 > too_much_curse)) { statusType = (STATUSTYPE)5; amount = num2; } } } [HarmonyPrefix] [HarmonyPatch("AddStatus", new Type[] { typeof(STATUSTYPE), typeof(float), typeof(bool), typeof(bool), typeof(bool) })] public static void AddStatusPrefix(CharacterAfflictions __instance, ref STATUSTYPE statusType, ref float amount, bool fromRPC, ref bool playEffects, bool notify) { if (!enabled || !statusType.isCursable() || amount < 0f) { return; } float num = __instance.GetCurrentStatus((STATUSTYPE)5) + amount * multiplier; if (!(num > too_much_curse)) { statusType = (STATUSTYPE)5; amount *= multiplier; if ((double)amount < 0.025) { playEffects = false; } } } [HarmonyPrefix] [HarmonyPatch("SubtractStatus", new Type[] { typeof(STATUSTYPE), typeof(float), typeof(bool), typeof(bool) })] public static void SubtractStatusPrefix(CharacterAfflictions __instance, ref STATUSTYPE statusType, ref float amount, bool fromRPC, bool decreasedNaturally) { if (enabled && statusType.isCursable() && !(amount > 0f)) { float num = __instance.GetCurrentStatus((STATUSTYPE)5) - amount * multiplier; if (!(num > too_much_curse)) { statusType = (STATUSTYPE)5; amount *= multiplier; } } } } public class CurseDamageEvent : IEvent { public void Disable(EventInterface eintf) { SharedDamagePatch.enabled = false; } public void Enable(EventInterface eintf) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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) eintf.AddEnableLine(new NiceText { s = "All damage is reduced by 95%.", c = Color.green }); eintf.AddEnableLine(new NiceText { s = "All damage is curse damage.", c = Color.red }); if (Ascents.currentAscent >= 5) { eintf.AddEnableLine(new NiceText { s = "(Cold nights are exempt.)", c = Color.cyan }); } SharedDamagePatch.enabled = true; } public JObject to_json() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new JObject(); } public static IEventFactory factory() { IEventFactory result = default(IEventFactory); result.New = (OurBiome _) => new CurseDamageEvent(); result.FromJson = (JObject _) => new CurseDamageEvent(); return result; } public HashSet<AllEvents> Conflicts() { return new HashSet<AllEvents> { AllEvents.FROSTBITE, AllEvents.EMISSIONS }; } } [HarmonyPatch(typeof(CharacterMovement), "GetMovementForce")] public class MovementSpeedPatch { public static bool doom_mode; private static void Postfix(CharacterMovement __instance, ref float __result) { if (doom_mode) { __result *= 2.5f; } } } [HarmonyPatch(typeof(CharacterMovement), "TryToJump")] public class JumpPatch { public static bool doom_mode; private static bool Prefix(CharacterMovement __instance) { bool? flag = __instance.character.refs?.afflictions.isWebbed; if (flag.HasValue && flag.Value) { return true; } return !doom_mode; } } public class DoomMusic : MonoBehaviour { private AudioClip? e1m1; private GameObject? musicObj; public void Start() { ((MonoBehaviour)this).StartCoroutine(GetMusic()); } private IEnumerator GetMusic() { string text = "file://" + Application.dataPath + "/../BepInEx/plugins/RandomEvents_e1m1.mp3"; UnityWebRequest e1m1r = UnityWebRequestMultimedia.GetAudioClip(text, (AudioType)13); try { yield return e1m1r.SendWebRequest(); if ((int)e1m1r.result == 1) { e1m1 = DownloadHandlerAudioClip.GetContent(e1m1r); } else { Plugin.Log.LogError((object)"No doom music!"); } } finally { ((IDisposable)e1m1r)?.Dispose(); } } public void TriggerMusic() { ((MonoBehaviour)this).StartCoroutine(DoTriggerMusic()); } private IEnumerator DoTriggerMusic() { yield return (object)new WaitForSeconds(15f); if ((Object)(object)e1m1 != (Object)null) { if ((Object)(object)musicObj != (Object)null) { Object.Destroy((Object)(object)musicObj); } musicObj = new GameObject("RandomEventsDoomModeMusic"); AudioSource val = musicObj.AddComponent<AudioSource>(); val.clip = e1m1; val.volume = 0.5f; val.Play(); } } } public class DoomModeEvent : IEvent { public void Disable(EventInterface eintf) { MovementSpeedPatch.doom_mode = false; JumpPatch.doom_mode = false; } public void Enable(EventInterface eintf) { eintf.AddEnableLine("DOOM mode!"); MovementSpeedPatch.doom_mode = true; JumpPatch.doom_mode = true; GlobalBehaviours.doom_music?.TriggerMusic(); } public JObject to_json() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new JObject(); } public static IEventFactory factory() { IEventFactory result = default(IEventFactory); result.New = (OurBiome _) => new DoomModeEvent(); result.FromJson = (JObject _) => new DoomModeEvent(); return result; } } [HarmonyPatch(typeof(TiedBalloon))] public class TiedBalloonPatch { private static TiedBalloon? my_balloon; [HarmonyPrefix] [HarmonyPatch("Pop")] private static bool PopPrefix(TiedBalloon __instance) { if (__instance == my_balloon) { __instance.popHeight += 100f; __instance.popTime += 100f; return false; } return true; } public static void AddPermaBalloonToMe() { //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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)my_balloon != (Object)null) { return; } Character localCharacter = Character.localCharacter; if (!((Object)(object)localCharacter == (Object)null)) { Character val = localCharacter; CharacterBalloons balloons = val.refs.balloons; SFX_Instance[] balloonTie = balloons.balloonTie; int num = Random.Range(0, balloons.balloonColors.Length); my_balloon = PhotonNetwork.Instantiate("TiedBalloon", val.Center, Quaternion.identity, (byte)0, (object[])null).GetComponent<TiedBalloon>(); my_balloon.Init(balloons, val.Center.y, num); for (int i = 0; i < balloonTie.Length; i++) { balloonTie[i].Play(val.Center); } } } public static void RemovePermaBalloonFromMe() { if (!((Object)(object)my_balloon == (Object)null)) { TiedBalloon val = my_balloon; my_balloon = null; val.Pop(); } } } public class FreeBalloonEvent : IEvent { public void Disable(EventInterface eintf) { TiedBalloonPatch.RemovePermaBalloonFromMe(); } public void Enable(EventInterface eintf) { eintf.AddEnableLine("Everyone gets a free balloon :)"); } public void LateEnable(EventInterface eintf) { TiedBalloonPatch.AddPermaBalloonToMe(); } public JObject to_json() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new JObject(); } public static IEventFactory factory() { IEventFactory result = default(IEventFactory); result.New = (OurBiome _) => new FreeBalloonEvent(); result.FromJson = (JObject _) => new FreeBalloonEvent(); return result; } } [HarmonyPatch(typeof(CharacterAfflictions))] public class FrostbitePatch { public static FrostbitePatch instance = new FrostbitePatch(); public bool enabled; public STATUSTYPE kind = (STATUSTYPE)2; private float lastTick = Time.time; private static float cold_threshold = 0.5f; private static float burn_threshold = 0.35f; private float threshold { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)kind == 2) { return cold_threshold; } return burn_threshold; } } private float damageChance() { float time = Time.time; float num = lastTick; return Math.Min(time - num, 2f) * 0.15f; } [HarmonyPrefix] [HarmonyPatch("SubtractStatus", new Type[] { typeof(STATUSTYPE), typeof(float), typeof(bool), typeof(bool) })] public static void SubtractStatusPrefix(CharacterAfflictions __instance, STATUSTYPE statusType, float amount, bool fromRPC, bool decreasedNaturally, out float __state) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!instance.enabled) { __state = -1f; } else { __state = __instance.GetCurrentStatus(instance.kind); } } [HarmonyPostfix] [HarmonyPatch("SubtractStatus", new Type[] { typeof(STATUSTYPE), typeof(float), typeof(bool), typeof(bool) })] public static void SubtractStatusPostfix(CharacterAfflictions __instance, STATUSTYPE statusType, float amount, bool fromRPC, bool decreasedNaturally, float __state) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (__state == -1f) { return; } float currentStatus = __instance.GetCurrentStatus(instance.kind); if (currentStatus < instance.threshold) { return; } float num = __state - __instance.GetCurrentStatus(instance.kind); if (!(num < 0.0249f) && !(num > 0.0251f)) { if (Random.Range(0f, 1f) <= instance.damageChance()) { __instance.AddStatus((STATUSTYPE)0, 0.025f, false, false, true); } instance.lastTick = Time.time; } } [HarmonyPrefix] [HarmonyPatch("AddStatus", new Type[] { typeof(STATUSTYPE), typeof(float), typeof(bool), typeof(bool), typeof(bool) })] public static void AddStatusPrefix(CharacterAfflictions __instance, ref STATUSTYPE statusType, ref float amount, bool fromRPC, ref bool playEffects, bool notify) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between I4 and Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (instance.enabled && (int)statusType == (int)instance.kind) { float currentStatus = __instance.GetCurrentStatus(instance.kind); if (currentStatus < instance.threshold && currentStatus + amount >= instance.threshold) { instance.lastTick = Time.time; } } } } public enum FrostbiteType { FROSTBITE, BURNS } public class FrostbiteEvent : IEvent { private FrostbiteType f; private FrostbiteEvent(FrostbiteType _f) { f = _f; } public HashSet<OurBiome> ZoneLimit() { return new HashSet<OurBiome> { OurBiome.Alpine, OurBiome.Mesa, OurBiome.Caldera, OurBiome.Kiln }; } private FrostbiteEvent(OurBiome b) { f = ((b != OurBiome.Alpine) ? FrostbiteType.BURNS : FrostbiteType.FROSTBITE); } private static (string, string, Color) Fstr(FrostbiteType f) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (f == FrostbiteType.FROSTBITE) { return ("Cold", "frostbite", Color.cyan); } return ("Heat", "burns", Color.red); } private static STATUSTYPE ToStatType(FrostbiteType f) { return (STATUSTYPE)(f switch { FrostbiteType.FROSTBITE => 2, _ => 8, }); } public void Disable(EventInterface eintf) { FrostbitePatch.instance.enabled = false; } public void Enable(EventInterface eintf) { //IL_000b: 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) //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_005d: 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) FrostbitePatch.instance.kind = ToStatType(f); FrostbitePatch.instance.enabled = true; var (text, text2, c) = Fstr(f); eintf.AddEnableLine(new NiceText { s = text + " might cause " + text2 + ".", c = c }); } public static IEventFactory factory() { IEventFactory result = default(IEventFactory); result.New = (OurBiome b) => new FrostbiteEvent(b); result.FromJson = delegate(JObject o) { FrostbiteType valueOrDefault = (FrostbiteType)((int?)o.GetValue("f")).GetValueOrDefault(9); return new FrostbiteEvent(valueOrDefault); }; return result; } public JObject to_json() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown JObject val = new JObject(); val.Add("f", JToken.op_Implicit((int)f)); return val; } } internal class GrabPingsData { public static bool enabled; } [HarmonyPatch(typeof(PointPinger), "ReceivePoint_Rpc")] internal class PingGrabber { public static readonly string FakePitonName = "0_Items/PickAxeHammered_Shitty"; private static Dictionary<int, GameObject> FakePitons = new Dictionary<int, GameObject>(); private static void Postfix(PointPinger __instance, Vector3 point, Vector3 hitNormal) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_002e: 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) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (GrabPingsData.enabled && PhotonNetwork.IsMasterClient) { Vector3 val = hitNormal; GameObject val2 = PhotonNetwork.Instantiate(FakePitonName, point + ((Vector3)(ref val)).normalized * 0.3f, Quaternion.LookRotation(-hitNormal, Vector3.up), (byte)0, new object[1] { "Random Events" }); int ownerActorNr = ((MonoBehaviourPun)__instance.character).photonView.OwnerActorNr; if (FakePitons.ContainsKey(ownerActorNr)) { FakePitons.Remove(ownerActorNr, out GameObject value); PhotonNetwork.Destroy(value); } FakePitons.Add(ownerActorNr, val2); GlobalBehaviours.late_events?.PhotonDestroyDelayed(val2, 1f); } } } [HarmonyPatch(typeof(PhotonNetwork), "NetworkInstantiate", new Type[] { typeof(InstantiateParameters), typeof(bool), typeof(bool) })] public static class PickaxeHider { public static void Postfix(InstantiateParameters parameters, bool roomObject, bool instantiateEvent, ref GameObject __result) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (!(parameters.prefabName != PingGrabber.FakePitonName) && parameters.data != null && parameters.data.Length != 0) { string text = (string)parameters.data[0]; if (text != null && !(text != "Random Events")) { __result.transform.localScale = new Vector3(0f, 0f, 0f); } } } } [HarmonyPatch(typeof(ClimbHandle), "GetName")] public static class PickaxeLabel { public static void Postfix(ClimbHandle __instance, ref string __result) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (__instance.isPickaxe && ((Component)__instance).gameObject.transform.localScale == new Vector3(0f, 0f, 0f)) { __result = "Hand"; } } } public class GrabPingsEvent : IEvent { public void Disable(EventInterface eintf) { GrabPingsData.enabled = false; } public void Enable(EventInterface eintf) { GrabPingsData.enabled = true; eintf.AddEnableLine("You can grab onto scout pings."); } public JObject to_json() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new JObject(); } public static IEventFactory factory() { IEventFactory result = default(IEventFactory); result.New = (OurBiome _) => new GrabPingsEvent(); result.FromJson = (JObject _) => new GrabPingsEvent(); return result; } } public class RescaleData { public bool scale_after_creation; public float scale_multi; public float? weight_multi; public Action<Item>? enable; public Action<Item>? disable; } public class HeavyDutyData { public static bool enabled = false; public static Dictionary<string, RescaleData> RescaleItems = new Dictionary<string, RescaleData> { { "Anti-Rope Spool", new RescaleData { scale_after_creation = true, scale_multi = 1.5f, weight_multi = 1.5f, enable = delegate(Item i) { RopeSpool component12 = ((Component)i).GetComponent<RopeSpool>(); component12.RopeFuel *= 2f; component12.ropeStartFuel *= 2f; }, disable = delegate(Item i) { RopeSpool component11 = ((Component)i).GetComponent<RopeSpool>(); component11.RopeFuel /= 2f; component11.ropeStartFuel /= 2f; } } }, { "BounceShroom", new RescaleData { scale_after_creation = true, scale_multi = 2f, weight_multi = 1.5f } }, { "BounceShroomSpawn", new RescaleData { scale_after_creation = false, scale_multi = 2f } }, { "ChainShooter", new RescaleData { scale_after_creation = true, scale_multi = 2f, weight_multi = 2f, enable = delegate(Item i) { VineShooter component10 = ((Component)i).GetComponent<VineShooter>(); component10.maxLength *= 2f; }, disable = delegate(Item i) { VineShooter component9 = ((Component)i).GetComponent<VineShooter>(); component9.maxLength /= 2f; } } }, { "CloudFungus", new RescaleData { scale_after_creation = true, scale_multi = 2f, weight_multi = 2f } }, { "CloudFungusPlaced", new RescaleData { scale_after_creation = false, scale_multi = 2.5f } }, { "MagicBean", new RescaleData { scale_after_creation = true, scale_multi = 3f, weight_multi = 2.5f, enable = delegate(Item i) { MagicBean component8 = ((Component)i).GetComponent<MagicBean>(); component8.plantPrefab.maxLength = 40f; component8.plantPrefab.maxWidth = 3f; }, disable = delegate(Item i) { MagicBean component7 = ((Component)i).GetComponent<MagicBean>(); component7.plantPrefab.maxLength = 20f; component7.plantPrefab.maxWidth = 1.5f; } } }, { "RopeShooter", new RescaleData { scale_after_creation = true, scale_multi = 2f, weight_multi = 2.5f, enable = delegate(Item i) { RopeShooter component6 = ((Component)i).GetComponent<RopeShooter>(); component6.length *= 2f; component6.maxLength *= 2f; }, disable = delegate(Item i) { RopeShooter component5 = ((Component)i).GetComponent<RopeShooter>(); component5.length /= 2f; component5.maxLength /= 2f; } } }, { "RopeAnchorForRopeShooter", new RescaleData { scale_after_creation = false, scale_multi = 2f } }, { "RopeShooterAnti", new RescaleData { scale_after_creation = true, scale_multi = 2f, weight_multi = 2.5f, enable = delegate(Item i) { RopeShooter component4 = ((Component)i).GetComponent<RopeShooter>(); component4.length *= 2f; component4.maxLength *= 2f; }, disable = delegate(Item i) { RopeShooter component3 = ((Component)i).GetComponent<RopeShooter>(); component3.length /= 2f; component3.maxLength /= 2f; } } }, { "RopeAnchorForRopeShooterAnti", new RescaleData { scale_after_creation = false, scale_multi = 2f } }, { "RopeSpool", new RescaleData { scale_after_creation = true, scale_multi = 1.5f, weight_multi = 1.5f, enable = delegate(Item i) { RopeSpool component2 = ((Component)i).GetComponent<RopeSpool>(); component2.RopeFuel *= 2f; component2.ropeStartFuel *= 2f; }, disable = delegate(Item i) { RopeSpool component = ((Component)i).GetComponent<RopeSpool>(); component.RopeFuel /= 2f; component.ropeStartFuel /= 2f; } } }, { "ScoutCannonItem", new RescaleData { scale_after_creation = true, scale_multi = 1.5f, weight_multi = 1.5f } }, { "ScoutCannon_Placed", new RescaleData { scale_after_creation = true, scale_multi = 1.5f } }, { "ShelfShroom", new RescaleData { scale_after_creation = true, scale_multi = 1.5f, weight_multi = 2f } }, { "ShelfShroomSpawn", new RescaleData { scale_after_creation = false, scale_multi = 3f } } }; public static RescaleData? GetScale(Item i) { string key = AllBans.stripName(((Object)i).name); if (!RescaleItems.ContainsKey(key)) { return null; } return RescaleItems[key]; } public static RescaleData? GetScale(GameObject i) { string key = AllBans.stripName(((Object)i).name); if (!RescaleItems.ContainsKey(key)) { return null; } return RescaleItems[key]; } public static void enable() { //IL_0040: 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) Item[] array = Object.FindObjectsByType<Item>((FindObjectsSortMode)0); Item[] array2 = array; Item[] array3 = array2; foreach (Item val in array3) { string text = AllBans.stripName(((Object)val).name); RescaleData scale = GetScale(val); if (scale != null) { if (scale.scale_after_creation) { Transform transform = ((Component)val).transform; transform.localScale *= scale.scale_multi; } scale.enable?.Invoke(val); } } } public static void disable() { //IL_0040: 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) Item[] array = Object.FindObjectsByType<Item>((FindObjectsSortMode)0); Item[] array2 = array; Item[] array3 = array2; foreach (Item val in array3) { string text = AllBans.stripName(((Object)val).name); RescaleData scale = GetScale(val); if (scale != null) { if (scale.scale_after_creation) { Transform transform = ((Component)val).transform; transform.localScale /= scale.scale_multi; } scale.disable?.Invoke(val); } } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPatch(typeof(Item), "CarryWeight")] public static class HeavierItems { private static void Postfix(Item __instance, ref int __result) { if (HeavyDutyData.enabled) { RescaleData scale = HeavyDutyData.GetScale(__instance); if (scale != null && scale.weight_multi.HasValue) { __result = (int)Math.Floor((float)__result * scale.weight_multi.Value); } } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPatch(typeof(Rope), "MaxSegments")] public static class LongerRopeLimit { private static bool Prefix(Rope __instance, ref int __result) { if (!HeavyDutyData.enabled) { return true; } __result = 60; return false; } } [HarmonyPatch(typeof(RopeBoneVisualizer), "LateUpdate")] public static class LongRopeFix { public static void Prefix(RopeBoneVisualizer __instance) { bool flag = __instance.rope.Segments > 40f; bool flag2 = __instance.bones.Count > 50; if (flag && !flag2) { List<Transform> list = new List<Transform>(); foreach (Transform bone in __instance.bones) { list.Add(bone); list.Add(bone); } __instance.bones = list; } if (!flag && flag2) { List<Transform> list2 = new List<Transform>(); for (int i = 0; i < __instance.bones.Count; i += 2) { list2.Add(__instance.bones[i]); } __instance.bones = list2; } } } [HarmonyPatch(typeof(PhotonNetwork), "NetworkInstantiate", new Type[] { typeof(InstantiateParameters), typeof(bool), typeof(bool) })] public static class HeavyDutyMaker { public static void Postfix(InstantiateParameters parameters, bool roomObject, bool instantiateEvent, ref GameObject __result) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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) if (HeavyDutyData.enabled) { RescaleData scale = HeavyDutyData.GetScale(__result); if (scale != null) { Transform transform = __result.transform; transform.localScale *= scale.scale_multi; scale.enable?.Invoke(__result.GetComponent<Item>()); } } } } [HarmonyPatch(typeof(Item), "SetState")] public static class HandScaleFix { private static void Postfix(Item __instance, ItemState setState, Character character) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (__instance.forceScale && HeavyDutyData.enabled) { RescaleData scale = HeavyDutyData.GetScale(__instance); if (scale != null) { Transform transform = ((Component)__instance).transform; transform.localScale *= scale.scale_multi; } } } } [HarmonyPatch(typeof(ScoutCannon), "FixedUpdate")] public static class ScoutCannonHack { private static void Prefix(ScoutCannon __instance) { if (HeavyDutyData.enabled) { __instance.launchForce = 3500f; } else { __instance.launchForce = 2000f; } } } public class HeavyDutyEvent : IEvent { public void Disable(EventInterface eintf) { HeavyDutyData.disable(); HeavyDutyData.enabled = false; Character.localCharacter.refs.afflictions.UpdateWeight(); } public void Enable(EventInterface eintf) { //IL_0031: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) HeavyDutyData.enable(); HeavyDutyData.enabled = true; Character.localCharacter.refs.afflictions.UpdateWeight(); eintf.AddEnableLine(new NiceText { s = "Climbing gear is heavy-duty.", c = Color.green }); eintf.AddEnableLine(new NiceText { s = "Climbing gear is heavy.", c = Color.red }); } public JObject to_json() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new JObject(); } public static IEventFactory factory() { IEventFactory result = default(IEventFactory); result.New = (OurBiome _) => new HeavyDutyEvent(); result.FromJson = (JObject _) => new HeavyDutyEvent(); return result; } public HashSet<AllEvents> ExcludeEvents() { return new HashSet<AllEvents> { AllEvents.MEGABOOST }; } } public static class HugsData { public static bool enabled; public static bool IsHugging(Character hugger, Character huggee) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_0084: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00a0: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Distance(hugger.Center, huggee.Center) > 3f) { return false; } if ((double)Vector3.Distance(hugger.Center, huggee.Center) < 0.1) { return false; } Vector3 position = ((Component)hugger.GetBodypart((BodypartType)2)).transform.position; Vector3 position2 = ((Component)hugger.GetBodypart((BodypartType)7)).transform.position; Vector3 position3 = ((Component)hugger.GetBodypart((BodypartType)10)).transform.position; Vector3 position4 = ((Component)huggee.GetBodypart((BodypartType)2)).transform.position; float item = Vector3.Angle(position - position4, position2 - position4); float item2 = Vector3.Angle(position - position4, position3 - position4); List<float> source = new List<float>(2) { item, item2 }; if (source.All((float a) => a >= 70f)) { return source.Any((float a) => a >= 85f); } return false; } } [HarmonyPatch(typeof(CharacterHeatEmission), "Update")] public static class HugsPatch { public static void Postfix(CharacterHeatEmission __instance) { if (__instance.counter == 0f && HugsData.enabled && __instance.character.IsLocal) { Character i = Character.localCharacter; if (Character.AllCharacters.Any((Character c) => HugsData.IsHugging(c, i) || HugsData.IsHugging(i, c))) { i.AddExtraStamina(0.05f); } else { i.AddExtraStamina(-0.01f); } } } } public class HugsEvent : IEvent { public void Disable(EventInterface eintf) { HugsData.enabled = false; } public void Enable(EventInterface eintf) { //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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) HugsData.enabled = true; eintf.AddEnableLine(new NiceText { c = Color.red, s = "Extra stamina keeps draining." }); eintf.AddEnableLine(new NiceText { c = new Color(1f, 0.41015625f, 45f / 64f), s = "Hugs restore extra stamina." }); } public JObject to_json() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new JObject(); } public static IEventFactory factory() { IEventFactory result = default(IEventFactory); result.New = (OurBiome _) => new HugsEvent(); result.FromJson = (JObject _) => new HugsEvent(); return result; } } public static class MegaboostData { public static bool enabled = false; private static readonly ushort rope_id = 65; private static readonly string rope_name = "RopeSpool"; public static void GiveEveryoneRope() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown foreach (Character allCharacter in Character.AllCharacters) { Player player = allCharacter.player; ItemInstanceData val = new ItemInstanceData(Guid.NewGuid()); FloatItemData val2 = val.RegisterNewEntry<FloatItemData>((DataEntryKey)10); val2.Value = 120f; GiveItem.Do(allCharacter, rope_id, rope_name, val); } } } [HarmonyPatch(typeof(CharacterMovement), "JumpRpc")] internal class MegaboostJumpPatch { private static IEnumerator resetJump(CharacterMovement __instance, float __state) { yield return (object)new WaitForSeconds(0.5f); __instance.jumpImpulse = __state; } private static void Prefix(CharacterMovement __instance, bool isPalJump, out float __state) { __state = __instance.jumpImpulse; if (MegaboostData.enabled && isPalJump) { if (__instance.character.data.GetTargetRagdollControll() < 0.9f) { __instance.jumpImpulse *= 1.5f; } else { __instance.jumpImpulse *= 3f; } ((MonoBehaviour)__instance).StartCoroutine(resetJump(__instance, __state)); } } } internal class MegaboostRopeOnly : ItemBan { private static HashSet<string> BannedItems = new HashSet<string> { "BounceShroom", "ChainShooter", "ClimbingSpike", "CloudFungus", "MagicBean", "RescueHook", "RopeShooter", "RopeShooterAnti", "ScoutCannonItem", "ShelfShroom" }; public static MegaboostRopeOnly? instance = null; public override bool BanPrimary(Item i, string name) { return BannedItems.Contains(name); } public override bool BanSecondary(Item i, string name) { return BannedItems.Contains(name); } } public class MegaboostEvent : IEvent { public void Disable(EventInterface eintf) { MegaboostData.enabled = false; MegaboostRopeOnly.instance?.Dispose(); MegaboostRopeOnly.instance = null; } public void Enable(EventInterface eintf) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) eintf.AddEnableLine("You can boost scouts much higher."); eintf.AddEnableLine("Free rope."); eintf.AddEnableLine(new NiceText { c = Color.red, s = "No other climbing tools allowed." }); MegaboostData.enabled = true; MegaboostRopeOnly.instance = new MegaboostRopeOnly(); AllBans.RegisterBan(MegaboostRopeOnly.instance); } public void LateEnable(EventInterface eintf) { if (Messages.IsMaster()) { MegaboostData.GiveEveryoneRope(); } } public JObject to_json() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new JObject(); } public static IEventFactory factory() { IEventFactory result = default(IEventFactory); result.New = (OurBiome _) => new MegaboostEvent(); result.FromJson = (JObject _) => new MegaboostEvent(); return result; } public HashSet<AllEvents> ExcludeEvents() { return new HashSet<AllEvents> { AllEvents.SUPER_RESCUE_HOOKS }; } } [HarmonyPatch(typeof(CharacterMovement), "CameraLook")] internal class NonAmbiturner { public static bool enabled; public static bool right; private static bool Prefix(CharacterMovement __instance) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) if (!enabled) { return true; } Character character = __instance.character; float num = (((int)InputHandler.GetCurrentUsedInputScheme() == 0) ? ((FloatSetting)__instance.mouseSensSetting).Value : ((FloatSetting)__instance.controllerSensSetting).Value); float num2 = character.input.lookInput.x * num * (float)(((int)((EnumSetting<OffOnMode>)(object)__instance.invertXSetting).Value == 0) ? 1 : (-1)); if ((right && num2 < 0f) || (!right && num2 > 0f)) { num2 *= 0.04f; } character.data.lookValues.x += num2; character.data.lookValues.y += character.input.lookInput.y * num * (float)(((int)((EnumSetting<OffOnMode>)(object)__instance.invertYSetting).Value == 0) ? 1 : (-1)); character.data.lookValues.y = Mathf.Clamp(character.data.lookValues.y, -85f, 85f); character.RecalculateLookDirections(); return false; } } public class NonAmbiturnerEvent : IEvent { public void Disable(EventInterface eintf) { NonAmbiturner.enabled = false; } public void Enable(EventInterface eintf) { eintf.AddEnableLine("Scouts are no longer ambiturners."); NonAmbiturner.enabled = true; NonAmbiturner.right = Random.value >= 0.5f; } public JObject to_json() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new JObject(); } public static IEventFactory factory() { IEventFactory result = default(IEventFactory); result.New = (OurBiome _) => new NonAmbiturnerEvent(); result.FromJson = (JObject _) => new NonAmbiturnerEvent(); return result; } } [HarmonyPatch(typeof(CharacterClimbing), "StartClimbRpc")] public class CharacterClimbingPatch { public static bool allow_scuttling = true; private static bool Prefix(CharacterClimbing __instance, Vector3 climbPos, Vector3 climbNormal) { //IL_001e: 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_0020: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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) //IL_0044: 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_004a: 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) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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) //IL_007d: Unknown result type (might be due to invalid IL or missing references) float num = 0f; if (__instance.character.data.hasClimbedSinceGrounded) { Vector3 val = __instance.GetVisualClimberPos(climbPos, climbNormal) - (__instance.character.Center + Vector3.up * 0.5f); val = Vector3.ProjectOnPlane(val * 1.5f, climbNormal); float num2 = ((Vector3)(ref val)).magnitude; float num3 = (allow_scuttling ? 0f : ((0f - num2) / 1.3f)); if (Vector3.Dot(val, Vector3.up) < num3) { num2 = 0f; } num2 = Mathf.Max(num2, 0.1f); __instance.character.UseStamina(0.15f * num2, true); if (__instance.character.OutOfStamina()) { num += (0f - num2) * __instance.outOfStamAttachSlide; } } if (__instance.character.data.avarageVelocity.y < 0f) { num += __instance.character.data.avarageVelocity.y * 1.5f; } __instance.character.OutOfStamina(); __instance.playerSlide = new Vector2(__instance.playerSlide.x, num); __instance.character.data.climbPos = climbPos; __instance.character.data.climbNormal = climbNormal; __instance.character.data.hasClimbedSinceGrounded = true; __instance.character.data.isClimbing = true; __instance.character.data.isGrounded = false; __instance.character.data.sinceStartClimb = 0f; __instance.character.OnStartClimb(); return false; } } public class NoScuttlingEvent : IEvent { public void Disable(EventInterface eintf) { CharacterClimbingPatch.allow_scuttling = true; } public void Enable(EventInterface eintf) { eintf.AddEnableLine("No scuttling!"); CharacterClimbingPatch.allow_scuttling = false; } public JObject to_json() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new JObject(); } public static IEventFactory factory() { IEventFactory result = default(IEventFactory); result.New = (OurBiome _) => new NoScuttlingEvent(); result.FromJson = (JObject _) => new NoScuttlingEvent(); return result; } } internal class PlayerRopeData { public static bool enabled; private static GameObject? rope; public static void enable() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) enabled = true; Character localCharacter = Character.localCharacter; rope = PhotonNetwork.Instantiate("RopeAnchorForRopeShooter", localCharacter.Center, Quaternion.identity, (byte)0, new object[2] { "Random Events", ((MonoBehaviourPun)localCharacter).photonView.OwnerActorNr }); RopeAnchorWithRope component = rope.GetComponent<RopeAnchorWithRope>(); component.SpawnRope(); } public static void disable() { enabled = false; if ((Object)(object)rope != (Object)null) { RopeAnchorWithRope component = rope.GetComponent<RopeAnchorWithRope>(); PhotonNetwork.Destroy(component.ropeInstance); PhotonNetwork.Destroy(rope); rope = null; } } } public class PlayerRopeAddedInfo : MonoBehaviour { public int actor = -1; } [HarmonyPatch(typeof(PhotonNetwork), "NetworkInstantiate", new Type[] { typeof(InstantiateParameters), typeof(bool), typeof(bool) })] public static class PersonalRopeMaker { public static void Postfix(InstantiateParameters parameters, bool roomObject, bool instantiateEvent, ref GameObject __result) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0030: 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_00cc: Unknown result type (might be due to invalid IL or missing references) string text = AllBans.stripName(((Object)__result).name); if (text != "RopeAnchorForRopeShooter" || parameters.data == null || parameters.data.Length == 0) { return; } string text2 = (string)parameters.data[0]; if (text2 == null || text2 != "Random Events") { return; } int num = (int)parameters.data[1]; RopeAnchorWithRope component = __result.GetComponent<RopeAnchorWithRope>(); component.ropeSegmentLength = 12f; foreach (Character allCharacter in Character.AllCharacters) { if (((MonoBehaviourPun)allCharacter).photonView.OwnerActorNr == num) { ((Component)component.anchor).gameObject.transform.parent = ((Component)allCharacter.GetBodypart((BodypartType)2)).transform; ((Component)component.anchor).gameObject.transform.localScale = Vector3.zero; PlayerRopeAddedInfo playerRopeAddedInfo = ((Component)component.anchor).gameObject.AddComponent<PlayerRopeAddedInfo>(); playerRopeAddedInfo.actor = num; break; } } } } [HarmonyPatch(typeof(Rope), "AttachToAnchor_Rpc")] public static class RopeAnchorer { public static void Postfix(Rope __instance, PhotonView anchorView, float ropeLength) { if (!((MonoBehaviourPun)__instance).photonView.IsMine) { return; } RopeAnchor attachedToAnchor = __instance.attachedToAnchor; PlayerRopeAddedInfo playerRopeAddedInfo = ((attachedToAnchor != null) ? ((Component)attachedToAnchor).GetComponent<PlayerRopeAddedInfo>() : null); if ((Object)(object)playerRopeAddedInfo == (Object)null) { return; } Character val = null; foreach (Character allCharacter in Character.AllCharacters) { if (((MonoBehaviourPun)allCharacter).photonView.OwnerActorNr == playerRopeAddedInfo.actor) { val = allCharacter; } } if (!((Object)(object)val == (Object)null)) { List<Transform> ropeSegments = __instance.GetRopeSegments(); if (ropeSegments.Count == 0) { __instance.AddSegment(); ropeSegments = __instance.GetRopeSegments(); } RopeSegment component = ((Component)ropeSegments[0]).GetComponent<RopeSegment>(); ConfigurableJoint component2 = ((Component)component).gameObject.GetComponent<ConfigurableJoint>(); if (!((Object)(object)component2 == (Object)null)) { ((Joint)component2).connectedBody = val.GetBodypartRig((BodypartType)2); } } } } [HarmonyPatch(typeof(CharacterClimbing), "Update")] public static class RopeStaminaDrain { public static void Prefix(CharacterClimbing __instance) { if (__instance.view.IsMine && PlayerRopeData.enabled && __instance.character.data.isRopeClimbing) { __instance.character.UseStamina(0.05f * Time.deltaTime, true); } } } public class PlayerRopeEvent : IEvent { public void Disable(EventInterface eintf) { PlayerRopeData.disable(); } public void Enable(EventInterface eintf) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) eintf.AddEnableLine("Every scout ties a rope around his waist."); eintf.AddEnableLine(new NiceText { c = Color.red, s = "Holding on to rope is more tiring." }); } public void LateEnable(EventInterface eintf) { PlayerRopeData.enable(); } public JObject to_json() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new JObject(); } public static IEventFactory factory() { IEventFactory result = default(IEventFactory); result.New = (OurBiome _) => new PlayerRopeEvent(); result.FromJson = (JObject _) => new PlayerRopeEvent(); return result; } } [HarmonyPatch(typeof(RopeSyncer), "ShouldSendData")] public class AlwaysSyncPersonalRope { public static void Postfix(RopeSyncer __instance, ref bool __result) { if (PlayerRopeData.enabled) { Rope rope = __instance.rope; RopeAnchor attachedToAnchor = rope.attachedToAnchor; PlayerRopeAddedInfo playerRopeAddedInfo = ((attachedToAnchor != null) ? ((Component)attachedToAnchor).GetComponent<PlayerRopeAddedInfo>() : null); if (!((Object)(object)playerRopeAddedInfo == (Object)null)) { __result = !rope.creatorLeft; __instance.updateVisualizerManually = false; } } } } internal static class SlapInfo { public static bool enabled; public static bool is_doom; private static bool DrankEnergol(Character c) { return c.refs.afflictions.afflictionList.Any((Affliction x) => (int)x.GetAfflictionType() == 2); } public static void SlapPlayer(Character slapper, Character slappee) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: 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_0145: Unknown result type (might be due to invalid IL or missing references) if (!(slapper.data.sinceGrabFriend < 0.2f)) { if (slappee.IsStuck() && slappee.IsLocal) { slappee.UnStick(); } CharacterAfflictions afflictions = slappee.refs.afflictions; afflictions.SubtractStatus((STATUSTYPE)11, 1f, false, false); STATUSTYPE[] array = new STATUSTYPE[5]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); STATUSTYPE[] array2 = (STATUSTYPE[])(object)array; foreach (STATUSTYPE val in array2) { afflictions.SubtractStatus(val, 0.075f, false, false); } bool flag = (double)Random.value < 0.1666; float num = 4000f; float num2 = 0.1f; float num3 = 0f; if (flag) { num *= 2f; num2 *= 5f; num3 += 0.025f; } if (DrankEnergol(slapper)) { num *= 4f; num2 += 2f; num3 *= 4f; } if (is_doom) { num *= 2f; } if (num3 > 0f) { afflictions.AddStatus((STATUSTYPE)0, num3, false, true, true); } slappee.Fall(num2, 0f); Vector3 val2 = slapper.refs.animationLookTransform.TransformDirection(new Vector3(-1f, 0.5f, 1f)); slappee.GetBodypart((BodypartType)4).AddForce(val2 * num, (ForceMode)0); slapper.data.sinceGrabFriend = 0f; } } public static IEnumerator SlapPlayerLater(Character puncher, Character punchee, float delay) { yield return (object)new WaitForSeconds(delay); SlapPlayer(puncher, punchee); } } [HarmonyPatch(typeof(Bodypart), "Animate")] internal class SlapSpeedPatch { private static void Prefix(Bodypart __instance, ref float force, ref float torque) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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) if (SlapInfo.enabled) { Character character = __instance.character; Dictionary<BodypartType, float> dictionary = new Dictionary<BodypartType, float> { { (BodypartType)2, 2f }, { (BodypartType)10, 3f }, { (BodypartType)8, 10f }, { (BodypartType)9, 10f }, { (BodypartType)26, 10f } }; if (character.data.isReaching && character.data.sincePressReach < 0.5f && dictionary.ContainsKey(__instance.partType)) { force *= dictionary[__instance.partType]; torque *= dictionary[__instance.partType]; } } } } [HarmonyPatch(typeof(CharacterAnimations), "ConfigureIK")] internal class SlapLocationPatch { private static void Postfix(CharacterAnimations __instance) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0078: 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_0082: Unknown result type (might be due to invalid IL or missing references) if (SlapInfo.enabled) { Character character = __instance.character; Vector3 reachHandPos = __instance.ReachHandPos; if (!((Object)(object)character.refs.IKHandTargetLeft == (Object)null) && !Object.op_Implicit((Object)(object)character.data.currentItem) && __instance.ReachIK()) { character.refs.IKHandTargetRight.position = character.refs.animationHeadTransform.position + character.refs.animationLookTransform.TransformDirection(new Vector3(-1f, 1f, 1f)); } } } } [HarmonyPatch(typeof(Character), "UpdateVariablesFixed")] internal class SlapReset { private static void Prefix(Character __instance, out float __state) { __state = __instance.data.sincePressReach; } private static void Postfix(Character __instance, float __state) { if (SlapInfo.enabled && __state < 0.7f) { __instance.data.sincePressReach = __state + Time.fixedDeltaTime; } } } [HarmonyPatch(typeof(CharacterGrabbing), "Reach")] internal class SlapAction { private static bool Prefix(CharacterGrabbing __instance) { if (!SlapInfo.enabled) { return true; } Character character = __instance.character; Action<Character> action = delegate(Character allCharacter) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Distance(character.Center, allCharacter.Center); if (!(num > 3f) && !(num < 0.1f) && !(Vector3.Angle(character.data.lookDirection, allCharacter.Center - character.Center) > 60f) && allCharacter.refs.view.IsMine) { ((MonoBehaviour)character).StartCoroutine(SlapInfo.SlapPlayerLater(character, allCharacter, 0.2f)); } }; foreach (Character allCharacter in Character.AllCharacters) { action(allCharacter); } foreach (Character allBotCharacter in Character.AllBotCharacters) { action(allBotCharacter); } return false; } } public class SlapEvent : IEvent { public void Disable(EventInterface eintf) { SlapInfo.enabled = false; SlapInfo.is_doom = false; } public void Enable(EventInterface eintf) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) eintf.AddEnableLine(new NiceText { c = Color.red, s = "You can't grab scouts." }); eintf.AddEnableLine("You can slap scouts. Slapped scouts get their shit together."); SlapInfo.enabled = true; SlapInfo.is_doom = eintf.ActiveEvents().Contains(AllEvents.DOOM_MODE); } public JObject to_json() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new JObject(); } public static IEventFactory factory() { IEventFactory result = default(IEventFactory); result.New = (OurBiome _) => new SlapEvent(); result.FromJson = (JObject _) => new SlapEvent(); return result; } } internal class Ramadan : ItemBan { public static bool enabled = false; public static Ramadan? instance = null; private static HashSet<string> HaramItems = new HashSet<string> { "Airline Food", "Antidote", "Apple Berry Green", "Apple Berry Red", "Apple Berry Yellow", "Berrynana Blue", "Berrynana Brown", "Berrynana Pink", "Berrynana Yellow", "Bugfix", "Clusterberry Black", "Clusterberry Red", "Clusterberry Yellow", "Clusterberry_UNUSED", "Cure-All", "Egg", "EggTurkey", "Energy Drink", "Fortified Milk", "Glizzy", "Granola Bar", "HealingDart Variant", "Item_Coconut_half", "Item_Honeycomb", "Kingberry Green", "Kingberry Purple", "Kingberry Yellow", "Lollipop", "Mandrake", "Mandrake_Hidden", "Marshmallow", "MedicinalRoot", "Mushroom Chubby", "Mushroom Cluster", "Mushroom Cluster Poison", "Mushroom Glow", "Mushroom Lace", "Mushroom Lace Poison", "Mushroom Normie", "Mushroom Normie Poison", "Napberry", "PandorasBox", "Pepper Berry", "Prickleberry_Gold", "Prickleberry_Red", "Scorpion", "ScoutCookies", "Shroomberry_Blue", "Shroomberry_Green", "Shroomberry_Purple", "Shroomberry_Red", "Shroomberry_Yellow", "Sports Drink", "TrailMix", "Winterberry Orange", "Winterberry Yellow" }; private static bool BreaksFast(string item) { return HaramItems.Contains(item); } private static bool IsDay() { return DayNightManager.instance.isDay == 1f; } public static bool IsHaram(string item) { if (enabled && IsDay()) { return BreaksFast(item); } return false; } public static bool CanBreakFast() { Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null) { return false; } if (localCharacter.refs.afflictions.shouldPassOut) { return true; } if (localCharacter.refs.afflictions.GetCurrentStatus((STATUSTYPE)1) > 0.7f) { return true; } return false; } public override bool BanPrimary(Item i, string name) { if (IsHaram(name)) { return !CanBreakFast(); } return false; } public override bool BanSecondary(Item i, string name) { return IsHaram(name); } } public class RamadanDelay : MonoBehaviour { public void DelayedEnableRamadan() { ((MonoBehaviour)this).StartCoroutine(DoDelayedEnableRamadan()); static IEnumerator DoDelayedEnableRamadan() { yield return (object)new WaitForSeconds(15f); Ramadan.enabled = true; Ramadan.instance = new Ramadan(); AllBans.RegisterBan(Ramadan.instance); } } } public class RamadanEvent : IEvent { public void Disable(EventInterface eintf) { Ramadan.enabled = false; Ramadan.instance?.Dispose(); Ramadan.instance = null; } public void Enable(EventInterface eintf) { GlobalBehaviours.ramadan?.DelayedEnableRamadan(); eintf.AddEnableLine("It is Ramadan and all scouts are Muslim."); } public JObject to_json() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new JObject(); } public static IEventFactory factory() { IEventFactory result = default(IEventFactory); result.New = (OurBiome _) => new RamadanEvent(); result.FromJson = (JObject _) => new RamadanEvent(); return result; } public HashSet<OurBiome> ZoneLimit() { return new HashSet<OurBiome> { OurBiome.Shore, OurBiome.Tropics, OurBiome.Roots, OurBiome.Alpine, OurBiome.Mesa }; } } public enum EmissionType { HEAT, COLD, ENERGY } public class PlayerEmission { public EmissionType emitting_e; private static Dictionary<Color, EmissionType>? colors = null; private static Dictionary<SkinColor, EmissionType> s2e = new Dictionary<SkinColor, EmissionType> { { SkinColor.RED, EmissionType.HEAT }, { SkinColor.ORANGE, EmissionType.HEAT }, { SkinColor.PINK, EmissionType.HEAT }, { SkinColor.BLUE, EmissionType.COLD }, { SkinColor.PURPLE, EmissionType.COLD }, { SkinColor.CYAN, EmissionType.COLD }, { SkinColor.GREEN, EmissionType.ENERGY }, { SkinColor.LIME, EmissionType.ENERGY }, { SkinColor.YELLOW, EmissionType.ENERGY } }; public PlayerEmission(EmissionType _e) { emitting_e = _e; } private Dictionary<Color, EmissionType> GetColors() { if (colors == null) { colors = Singleton<Customization>.Instance.skins.Select((CustomizationOption x, int i) => (x.color, s2e[(SkinColor)i])).ToDictionary<(Color, EmissionType), Color, EmissionType>(((Color color, EmissionType) x) => x.color, ((Color color, EmissionType) x) => x.Item2); } return colors; } public EmissionType? CheckEmit(Character emitter, Character emittee) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) Dictionary<Color, EmissionType> dictionary = GetColors(); Color playerColor = emitter.refs.customization.PlayerColor; if (!dictionary.ContainsKey(playerColor)) { return null; } EmissionType emissionType = dictionary[playerColor]; playerColor = emittee.refs.customization.PlayerColor; if (!dictionary.ContainsKey(playerColor)) { return null; } EmissionType emissionType2 = dictionary[playerColor]; if (emissionType != emitting_e) { return null; } if (emissionType == emissionType2) { return null; } return emissionType; } } [HarmonyPatch(typeof(CharacterHeatEmission))] public static class HeatEmissionsPatch { public static PlayerEmission? activeEmission; [HarmonyPostfix] [HarmonyPatch("Update")] public static void UpdatePostfix(CharacterHeatEmission __instance) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (__instance.counter != 0f || activeEmission == null) { return; } Character character = __instance.character; foreach (Character allCharacter in Character.AllCharacters) { if (Vector3.Distance(((Component)__instance).transform.position, allCharacter.Center) < __instance.radius) { Character emittee = allCharacter; EmissionType? emissionType = activeEmission?.CheckEmit(character, emittee); if (!emissionType.HasValue) { break; } switch (emissionType) { case EmissionType.HEAT: allCharacter.refs.afflictions.AddStatus((STATUSTYPE)8, __instance.heatAmount, false, true, true); break; case EmissionType.COLD: allCharacter.refs.afflictions.AddStatus((STATUSTYPE)2, __instance.heatAmount * 2f, false, true, true); break; case EmissionType.ENERGY: allCharacter.AddExtraStamina(0f - __instance.heatAmount); break; } } } } } public class HeatEmissionEvent : IEvent { private PlayerEmission e; public HeatEmissionEvent(EmissionType et) { e = new PlayerEmission(et); } public HeatEmissionEvent() { EmissionType emissionType = (EmissionType)Random.Range(0, 3); e = new PlayerEmission(emissionType); } public void Disable(EventInterface eintf) { HeatEmissionsPatch.activeEmission = null; } public void Enable(EventInterface eintf) { //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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) string s = ""; Color c = Color.white; switch (e.emitting_e) { case EmissionType.HEAT: s = "Reddish scouts are hot."; c = Color.red; break; case EmissionType.COLD: s = "Blueish scouts are cold."; c = Color.blue; break; case EmissionType.ENERGY: s = "Greenish scouts eat your energy."; c = Color.green; break; } eintf.AddEnableLine(new NiceText { s = s, c = c }); HeatEmissionsPatch.activeEmission = e; } public JObject to_json() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown JObject val = new JObject(); val.Add("et", JToken.op_Implicit((int)e.emitting_e)); return val; } public static IEventFactory factory() { IEventFactory result = default(IEventFactory); result.New = (OurBiome _) => new HeatEmissionEvent(); result.FromJson = delegate(JObject o) { EmissionType valueOrDefault = (EmissionType)((int?)o.GetValue("et")).GetValueOrDefault(0); return new HeatEmissionEvent(valueOrDefault); }; return result; } } internal enum SkinColor { RED,