using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ChaosMod.Patches;
using ChaosMod.UITexts;
using ChaosMod.Utils;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.UI;
using Zorro.Core;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.github.MysticFlameYT.ChaosMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("com.github.MysticFlameYT.ChaosMod")]
[assembly: AssemblyTitle("ChaosMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
[HarmonyPatch(typeof(Character))]
internal class BugfixSpawnPatch
{
public static bool HasRunThisCycle;
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void TickPatch(Character __instance)
{
//IL_0016: 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)
if (HasRunThisCycle)
{
Character localCharacter = Character.localCharacter;
PhotonNetwork.Instantiate("BugfixOnYou", Vector3.zero, Quaternion.identity, (byte)0, (object[])null).GetComponent<PhotonView>().RPC("AttachBug", (RpcTarget)0, new object[1] { ((MonoBehaviourPun)localCharacter).photonView.ViewID });
}
HasRunThisCycle = false;
}
}
[HarmonyPatch(typeof(Character))]
internal class DayChanger
{
public static bool HasRunThisCycle;
[HarmonyPatch(typeof(DayNightManager), "Update")]
[HarmonyPrefix]
private static void DayPatch(DayNightManager __instance)
{
if (HasRunThisCycle)
{
__instance.timeOfDay = 36f;
__instance.UpdateCycle();
}
HasRunThisCycle = false;
}
}
[HarmonyPatch(typeof(Character))]
internal class Drain
{
public static bool HasRunThisCycle;
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void StamPatch()
{
if (HasRunThisCycle)
{
Character localCharacter = Character.localCharacter;
ApplyDrain(localCharacter);
}
HasRunThisCycle = false;
}
private static async void ApplyDrain(Character c)
{
for (int i = 0; i < 50; i++)
{
c.AddStamina(-0.05f);
await Task.Delay(100);
}
}
}
[HarmonyPatch(typeof(CharacterItems))]
internal class DropAll
{
public static bool HasRunThisCycle;
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void DropPatch(CharacterItems __instance)
{
if (HasRunThisCycle)
{
CharacterItems items = Character.localCharacter.refs.items;
MethodInfo method = typeof(CharacterItems).GetMethod("DropAllItems", BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[1] { typeof(bool) }, null);
method.Invoke(items, new object[1] { true });
}
HasRunThisCycle = false;
}
}
[HarmonyPatch(typeof(Character))]
internal class FakeLose
{
public static bool HasRunThisCycle;
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void FakeWinPatch(Character __instance)
{
if (HasRunThisCycle)
{
GUIManager val = Object.FindFirstObjectByType<GUIManager>();
val.endgame.Lose();
TimeForFake(val);
}
HasRunThisCycle = false;
}
private static async void TimeForFake(GUIManager gui)
{
await Task.Delay(3000);
((Component)gui.endgame.loseGroup).gameObject.SetActive(false);
}
}
[HarmonyPatch(typeof(Character))]
internal class FakeWin
{
public static bool HasRunThisCycle;
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void FakeWinPatch(Character __instance)
{
if (HasRunThisCycle)
{
GUIManager val = Object.FindFirstObjectByType<GUIManager>();
val.endgame.Win();
TimeForFake(val);
}
HasRunThisCycle = false;
}
private static async void TimeForFake(GUIManager gui)
{
await Task.Delay(3000);
((Component)gui.endgame.winGroup).gameObject.SetActive(false);
}
}
[HarmonyPatch(typeof(Character))]
internal class Faster
{
public static float moveSpeedMod = 1f;
public static float climbSpeedMod = 1f;
public static bool HasRunThisCycle;
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void FasterBoiPatch()
{
if (HasRunThisCycle)
{
Character localCharacter = Character.localCharacter;
CharacterMovement movement = localCharacter.refs.movement;
movement.movementModifier += moveSpeedMod;
CharacterClimbing climbing = localCharacter.refs.climbing;
climbing.climbSpeedMod += climbSpeedMod;
CharacterRopeHandling ropeHandling = localCharacter.refs.ropeHandling;
ropeHandling.climbSpeedMod += climbSpeedMod;
CharacterVineClimbing vineClimbing = localCharacter.refs.vineClimbing;
vineClimbing.climbSpeedMod += climbSpeedMod;
GUIManager.instance.StartEnergyDrink();
GUIManager.instance.StartSugarRush();
Stam(localCharacter);
StopEffect(localCharacter);
}
HasRunThisCycle = false;
}
private static async void StopEffect(Character character)
{
await Task.Delay(8000);
CharacterMovement movement = character.refs.movement;
movement.movementModifier -= moveSpeedMod;
CharacterClimbing climbing = character.refs.climbing;
climbing.climbSpeedMod -= climbSpeedMod;
CharacterRopeHandling ropeHandling = character.refs.ropeHandling;
ropeHandling.climbSpeedMod -= climbSpeedMod;
CharacterVineClimbing vineClimbing = character.refs.vineClimbing;
vineClimbing.climbSpeedMod -= climbSpeedMod;
GUIManager.instance.EndEnergyDrink();
GUIManager.instance.EndSugarRush();
}
private static async void Stam(Character character)
{
for (int i = 0; i < 80; i++)
{
character.AddStamina(1f);
await Task.Delay(100);
}
}
}
[HarmonyPatch(typeof(Character))]
internal class FullStam
{
public static bool HasRunThisCycle;
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void StamPatch(Character __instance)
{
if (HasRunThisCycle)
{
Character localCharacter = Character.localCharacter;
localCharacter.AddStamina(1f);
}
HasRunThisCycle = false;
}
}
[HarmonyPatch(typeof(Character))]
internal class LowGrav
{
public static bool HasRunThisCycle;
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void GravPatch()
{
if (HasRunThisCycle)
{
Character localCharacter = Character.localCharacter;
LowGravityEffect(localCharacter);
}
HasRunThisCycle = false;
}
private static async void LowGravityEffect(Character player)
{
float duration = 17f;
float strength = 40f;
MethodInfo forceMethod = typeof(Character).GetMethod("AddForce", BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[3]
{
typeof(Vector3),
typeof(float),
typeof(float)
}, null);
for (int i = 0; (float)i < duration; i++)
{
player.RPCA_Fall(0.1f);
Vector3 antiGravity = new Vector3(0f, strength, 0f);
forceMethod.Invoke(player, new object[3] { antiGravity, 3f, 3f });
strength += 10f;
await Task.Delay(100);
}
}
}
[HarmonyPatch(typeof(Character))]
internal class Morale
{
public static bool HasRunThisCycle;
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void MoralePatch(Character __instance)
{
if (HasRunThisCycle)
{
Character localCharacter = Character.localCharacter;
localCharacter.MoraleBoost(0.3f, 1);
}
HasRunThisCycle = false;
}
}
[HarmonyPatch(typeof(Character))]
internal class NightChanger
{
public static bool HasRunThisCycle;
[HarmonyPatch(typeof(DayNightManager), "Update")]
[HarmonyPrefix]
private static void NightPatch(DayNightManager __instance)
{
if (HasRunThisCycle)
{
__instance.timeOfDay = 24f;
__instance.UpdateCycle();
}
HasRunThisCycle = false;
}
}
[HarmonyPatch(typeof(Character))]
internal class RandomItem
{
public static bool HasRunThisCycle;
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void ItemSpawnerPatch(Character __instance)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
if (HasRunThisCycle)
{
int num = Random.Range(0, 115);
ushort key = (ushort)num;
Item value = new Item();
SingletonAsset<ItemDatabase>.Instance.itemLookup.TryGetValue(key, out value);
string name = ((Object)value).name;
CharacterItems items = Character.localCharacter.refs.items;
MethodInfo method = typeof(CharacterItems).GetMethod("SpawnItemInHand", BindingFlags.Instance | BindingFlags.NonPublic);
method.Invoke(items, new object[1] { name });
}
HasRunThisCycle = false;
}
}
[HarmonyPatch(typeof(Character))]
internal class SpawnDynamite
{
public static bool HasRunThisCycle;
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void DynamitePatch(Character __instance)
{
//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)
//IL_0023: 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_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)
if (HasRunThisCycle)
{
Camera main = Camera.main;
Vector3 position = ((Component)main).transform.position;
Quaternion rotation = ((Component)main).transform.rotation;
PhotonNetwork.Instantiate("0_Items/Dynamite", position, rotation, (byte)0, (object[])null);
}
HasRunThisCycle = false;
}
}
[HarmonyPatch(typeof(Character))]
internal class SpawnTornado
{
public static bool HasRunThisCycle;
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void SpawnerPatch(Character __instance)
{
//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_0035: 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_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: 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)
if (HasRunThisCycle)
{
Character localCharacter = Character.localCharacter;
Camera main = Camera.main;
Vector3 val = ((Component)main).transform.position - ((Component)main).transform.forward * 10f;
Quaternion rotation = ((Component)main).transform.rotation;
GameObject val2 = PhotonNetwork.Instantiate("Tornado", val, rotation, (byte)0, (object[])null);
PhotonView component = val2.GetComponent<PhotonView>();
component.RPC("RPCA_InitTornado", (RpcTarget)0, new object[1] { ((MonoBehaviourPun)localCharacter).photonView.ViewID });
KillTornadoDelayed(val2);
}
HasRunThisCycle = false;
}
private static async void KillTornadoDelayed(GameObject tornadoGO)
{
await Task.Delay(3000);
Tornado tornado = tornadoGO.GetComponent<Tornado>();
typeof(Tornado).GetMethod("RPCA_TornadoDie", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(tornado, null);
}
}
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 ChaosMod
{
[BepInPlugin("com.github.MysticFlameYT.ChaosMod", "ChaosMod", "0.1.0")]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony _harmony = new Harmony("com.github.MysticFlameYT.ChaosMod");
private bool modStarted = false;
public const string Id = "com.github.MysticFlameYT.ChaosMod";
internal static ManualLogSource Log { get; private set; }
public static string Name => "ChaosMod";
public static string Version => "0.1.0";
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
ZConfig.AllConfigs(((BaseUnityPlugin)this).Config);
}
private void Update()
{
if (!modStarted && ((ButtonControl)Keyboard.current.digit0Key).wasPressedThisFrame)
{
_harmony.PatchAll();
RepeatingLogic();
UIText.HasRunThisCycle = true;
UIText.num = -1;
modStarted = true;
}
}
private async void RepeatingLogic()
{
float time = ZConfig.timer.Value;
bool fakeout = ZConfig.fakeout.Value;
Debug.Log((object)"STARTED");
while (true)
{
Random random = new Random();
int num = ((!fakeout) ? random.Next(0, 18) : random.Next(0, 20));
await Task.Delay((int)(time * 1000f));
switch (num)
{
case 0:
StatusEffect.HasRunThisCycle = true;
UIText.HasRunThisCycle = true;
UIText.num = 0;
break;
case 1:
ClearStatus.HasRunThisCycle = true;
UIText.HasRunThisCycle = true;
UIText.num = 1;
break;
case 2:
TieBalloon.HasRunThisCycle = true;
UIText.HasRunThisCycle = true;
UIText.num = 2;
break;
case 3:
BugfixSpawnPatch.HasRunThisCycle = true;
UIText.HasRunThisCycle = true;
UIText.num = 3;
break;
case 4:
PassOut.HasRunThisCycle = true;
UIText.HasRunThisCycle = true;
UIText.num = 4;
break;
case 5:
Morale.HasRunThisCycle = true;
UIText.HasRunThisCycle = true;
UIText.num = 5;
break;
case 6:
RandomItem.HasRunThisCycle = true;
UIText.HasRunThisCycle = true;
UIText.num = 6;
break;
case 7:
SpawnTornado.HasRunThisCycle = true;
UIText.HasRunThisCycle = true;
UIText.num = 7;
break;
case 8:
Push.HasRunThisCycle = true;
UIText.HasRunThisCycle = true;
UIText.num = 8;
break;
case 9:
FullStam.HasRunThisCycle = true;
UIText.HasRunThisCycle = true;
UIText.num = 9;
break;
case 10:
DropAll.HasRunThisCycle = true;
UIText.HasRunThisCycle = true;
UIText.num = 10;
break;
case 11:
SpawnDynamite.HasRunThisCycle = true;
UIText.HasRunThisCycle = true;
UIText.num = 11;
break;
case 12:
Slip.HasRunThisCycle = true;
UIText.HasRunThisCycle = true;
UIText.num = 12;
break;
case 13:
LowGrav.HasRunThisCycle = true;
UIText.HasRunThisCycle = true;
UIText.num = 13;
break;
case 14:
NightChanger.HasRunThisCycle = true;
UIText.HasRunThisCycle = true;
UIText.num = 14;
break;
case 15:
DayChanger.HasRunThisCycle = true;
UIText.HasRunThisCycle = true;
UIText.num = 15;
break;
case 16:
Faster.HasRunThisCycle = true;
UIText.HasRunThisCycle = true;
UIText.num = 18;
break;
case 17:
Drain.HasRunThisCycle = true;
UIText.HasRunThisCycle = true;
UIText.num = 19;
break;
case 18:
FakeWin.HasRunThisCycle = true;
UIText.HasRunThisCycle = true;
UIText.num = 16;
break;
case 19:
FakeLose.HasRunThisCycle = true;
UIText.HasRunThisCycle = true;
UIText.num = 17;
break;
}
}
}
}
}
namespace ChaosMod.Utils
{
public class ZConfig
{
public static ConfigEntry<float> timer;
public static ConfigEntry<bool> fakeout;
public static void AllConfigs(ConfigFile config)
{
timer = config.Bind<float>("General", "Float num", 10f, "How long between random effects.(In Seconds)");
fakeout = config.Bind<bool>("General", "Boolean", true, "Enable FakeWin/FakeLose (Possible Visual Issues)");
}
}
}
namespace ChaosMod.UITexts
{
[HarmonyPatch]
internal class UIText
{
public static GameObject player;
private static GameObject parent;
private static float time = ZConfig.timer.Value;
public static bool HasRunThisCycle;
public static int num;
private static MethodBase TargetMethod()
{
return typeof(GUIManager).GetMethod("LateUpdate", BindingFlags.Instance | BindingFlags.NonPublic);
}
[HarmonyPostfix]
private static void Text()
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected O, but got Unknown
if ((Object)(object)parent == (Object)null)
{
parent = GameObject.Find("GAME/GUIManager/Canvas_HUD");
}
if ((Object)(object)player == (Object)null)
{
player = new GameObject("text obj");
player.transform.SetParent(parent.transform, false);
player.AddComponent<TextMeshProUGUI>();
}
}
private static MethodBase TargetMethod2()
{
return typeof(MainCamera).GetMethod("Update", BindingFlags.Instance | BindingFlags.NonPublic);
}
[HarmonyPostfix]
private static void UpPatch(MainCamera __instance)
{
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_0227: Unknown result type (might be due to invalid IL or missing references)
//IL_024b: Unknown result type (might be due to invalid IL or missing references)
//IL_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_0293: Unknown result type (might be due to invalid IL or missing references)
//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Unknown result type (might be due to invalid IL or missing references)
//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0320: Unknown result type (might be due to invalid IL or missing references)
//IL_0341: Unknown result type (might be due to invalid IL or missing references)
//IL_0362: Unknown result type (might be due to invalid IL or missing references)
if (HasRunThisCycle)
{
TextMeshProUGUI component = player.GetComponent<TextMeshProUGUI>();
((TMP_Text)component).alignment = (TextAlignmentOptions)514;
switch (num)
{
case -1:
((TMP_Text)component).text = "Chaos Mod has started, get ready! :D";
((Graphic)component).color = Color.blue;
ForceOutline(component);
break;
case 0:
((TMP_Text)component).SetText("Random Effect Applied");
((Graphic)component).color = Color.red;
ForceOutline(component);
break;
case 1:
((TMP_Text)component).SetText("All Statuses Cleared");
((Graphic)component).color = Color.green;
ForceOutline(component);
break;
case 2:
((TMP_Text)component).SetText("New Balloon :D");
((Graphic)component).color = Color.green;
ForceOutline(component);
break;
case 3:
((TMP_Text)component).SetText("Lil guy");
((Graphic)component).color = Color.red;
ForceOutline(component);
break;
case 4:
((TMP_Text)component).SetText("Sleepy Time");
((Graphic)component).color = Color.red;
ForceOutline(component);
break;
case 5:
((TMP_Text)component).SetText("Morale Boost");
((Graphic)component).color = Color.green;
ForceOutline(component);
break;
case 6:
((TMP_Text)component).SetText("Spawned Random Item");
((Graphic)component).color = Color.white;
ForceOutline(component);
break;
case 7:
((TMP_Text)component).SetText("Tornado");
((Graphic)component).color = Color.red;
ForceOutline(component);
break;
case 8:
((TMP_Text)component).SetText("Who did that?");
((Graphic)component).color = Color.white;
ForceOutline(component);
break;
case 9:
((TMP_Text)component).SetText("Full Stamina");
((Graphic)component).color = Color.green;
ForceOutline(component);
break;
case 10:
((TMP_Text)component).SetText("No Items For You");
((Graphic)component).color = Color.white;
ForceOutline(component);
break;
case 11:
((TMP_Text)component).SetText("I'd Run");
((Graphic)component).color = Color.red;
ForceOutline(component);
break;
case 12:
((TMP_Text)component).SetText("Floor's a bit wet");
((Graphic)component).color = Color.white;
ForceOutline(component);
break;
case 13:
((TMP_Text)component).SetText("Gravity's rebooting...");
((Graphic)component).color = Color.white;
ForceOutline(component);
break;
case 14:
((TMP_Text)component).SetText("Night Time");
((Graphic)component).color = Color.white;
ForceOutline(component);
break;
case 15:
((TMP_Text)component).SetText("Day Time");
((Graphic)component).color = Color.white;
ForceOutline(component);
break;
case 16:
((TMP_Text)component).SetText("Guess Not...");
((Graphic)component).color = Color.black;
ForceOutline(component);
break;
case 17:
((TMP_Text)component).SetText("Got ya");
((Graphic)component).color = Color.black;
ForceOutline(component);
break;
case 18:
((TMP_Text)component).SetText("Get Going");
((Graphic)component).color = Color.green;
ForceOutline(component);
break;
case 19:
((TMP_Text)component).SetText("Not Feelin So Hot?");
((Graphic)component).color = Color.red;
ForceOutline(component);
break;
}
}
HasRunThisCycle = false;
}
private static void ForceOutline(TextMeshProUGUI tmp)
{
//IL_001b: 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_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Expected O, but got Unknown
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: 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_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
((TMP_Text)tmp).enableAutoSizing = false;
((TMP_Text)tmp).fontSize = 40f;
((Transform)((TMP_Text)tmp).rectTransform).localScale = Vector3.one;
((TMP_Text)tmp).rectTransform.sizeDelta = new Vector2(300f, 20f);
((TMP_Text)tmp).rectTransform.anchoredPosition = new Vector2(-225f, -150f);
((TMP_Text)tmp).rectTransform.pivot = new Vector2(0.5f, 0.5f);
((TMP_Text)tmp).rectTransform.anchorMin = new Vector2(1f, 1f);
((TMP_Text)tmp).rectTransform.anchorMax = new Vector2(1f, 1f);
Shader val = Shader.Find("TextMeshPro/Distance Field");
Material val2 = new Material(val);
val2.CopyPropertiesFromMaterial(((TMP_Text)tmp).fontSharedMaterial);
((TMP_Text)tmp).fontSharedMaterial = val2;
((TMP_Text)tmp).fontMaterial = val2;
((Graphic)tmp).color = new Color(((Graphic)tmp).color.r, ((Graphic)tmp).color.g, ((Graphic)tmp).color.b, 1f);
Color color = ((TMP_Text)tmp).fontMaterial.GetColor("_FaceColor");
color.a = 1f;
((TMP_Text)tmp).fontMaterial.SetColor("_FaceColor", color);
Color color2 = ((TMP_Text)tmp).fontMaterial.GetColor(ShaderUtilities.ID_OutlineColor);
color2.a = 1f;
((TMP_Text)tmp).fontMaterial.SetColor(ShaderUtilities.ID_OutlineColor, color2);
((TMP_Text)tmp).fontMaterial.SetFloat(ShaderUtilities.ID_OutlineWidth, 0.2f);
}
}
}
namespace ChaosMod.Patches
{
[HarmonyPatch(typeof(CharacterAfflictions))]
internal class ClearStatus
{
public static bool HasRunThisCycle;
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void CuredPatch(CharacterAfflictions __instance)
{
if (HasRunThisCycle)
{
CharacterAfflictions afflictions = Character.localCharacter.refs.afflictions;
afflictions.ClearAllStatus(false);
afflictions.RemoveAllThorns();
}
HasRunThisCycle = false;
}
}
[HarmonyPatch(typeof(Character))]
internal class PassOut
{
public static bool HasRunThisCycle;
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void PassOutPatch(Character __instance)
{
if (HasRunThisCycle)
{
Character localCharacter = Character.localCharacter;
localCharacter.PassOutInstantly();
}
HasRunThisCycle = false;
}
}
[HarmonyPatch(typeof(Character))]
internal class Push
{
public static bool HasRunThisCycle;
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void PushPatch(Character __instance)
{
//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)
//IL_0022: 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)
//IL_0031: 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)
if (HasRunThisCycle)
{
Vector3 onUnitSphere = Random.onUnitSphere;
onUnitSphere.y = 0f;
Vector3 val = ((Vector3)(ref onUnitSphere)).normalized * 10f;
float num = 150f;
float num2 = 300f;
Character localCharacter = Character.localCharacter;
MethodInfo method = typeof(Character).GetMethod("AddForce", BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[3]
{
typeof(Vector3),
typeof(float),
typeof(float)
}, null);
method.Invoke(localCharacter, new object[3] { val, num, num2 });
}
HasRunThisCycle = false;
}
}
[HarmonyPatch(typeof(Character))]
internal class Slip
{
public static bool HasRunThisCycle;
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void SlipPatch(Character __instance)
{
if (HasRunThisCycle)
{
Character localCharacter = Character.localCharacter;
TriggerSlip(localCharacter);
}
HasRunThisCycle = false;
}
private static void TriggerSlip(Character player)
{
//IL_0086: 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_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
Rigidbody rig = player.refs.ragdoll.partDict[(BodypartType)16].Rig;
Rigidbody rig2 = player.refs.ragdoll.partDict[(BodypartType)13].Rig;
Rigidbody rig3 = player.refs.ragdoll.partDict[(BodypartType)0].Rig;
Rigidbody rig4 = player.refs.ragdoll.partDict[(BodypartType)4].Rig;
player.RPCA_Fall(2f);
rig.AddForce((player.data.lookDirection_Flat + Vector3.up) * 200f, (ForceMode)1);
rig2.AddForce((player.data.lookDirection_Flat + Vector3.up) * 200f, (ForceMode)1);
rig3.AddForce(Vector3.up * 1500f, (ForceMode)1);
rig4.AddForce(player.data.lookDirection_Flat * -300f, (ForceMode)1);
}
}
[HarmonyPatch(typeof(CharacterAfflictions))]
internal class StatusEffect
{
public static bool HasRunThisCycle;
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void StatusPatch(CharacterAfflictions __instance)
{
if (HasRunThisCycle)
{
int num = Random.Range(0, 7);
CharacterAfflictions afflictions = Character.localCharacter.refs.afflictions;
switch (num)
{
case 0:
afflictions.SetStatus((STATUSTYPE)0, 0.15f);
break;
case 1:
afflictions.SetStatus((STATUSTYPE)2, 0.25f);
break;
case 2:
afflictions.SetStatus((STATUSTYPE)6, 0.25f);
break;
case 3:
afflictions.SetStatus((STATUSTYPE)3, 0.25f);
break;
case 4:
afflictions.SetStatus((STATUSTYPE)8, 0.25f);
break;
case 5:
afflictions.SetStatus((STATUSTYPE)5, 0.05f);
break;
case 6:
afflictions.SetStatus((STATUSTYPE)9, 0.25f);
break;
}
}
HasRunThisCycle = false;
}
}
[HarmonyPatch(typeof(Character))]
internal class TieBalloon
{
public static bool HasRunThisCycle;
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void BallonPatch(CharacterBalloons __instance)
{
if (HasRunThisCycle)
{
CharacterBalloons val = Character.localCharacter?.refs?.balloons;
Material[] balloonColors = val.balloonColors;
int num = Random.Range(0, balloonColors.Length);
val.TieNewBalloon(num);
}
HasRunThisCycle = false;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}