using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CosmeticBuffs.Patchers;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PEAKLib.Core;
using PEAKLib.Items.UnityEditor;
using Peak.Afflictions;
using Photon.Pun;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[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("CosmeticBuffs")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d46b31bf6f071523ec40654886aaeb1faeee55a3")]
[assembly: AssemblyProduct("CosmeticBuffs")]
[assembly: AssemblyTitle("CosmeticBuffs")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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]
[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;
}
}
}
namespace CosmeticBuffs
{
[BepInPlugin("cosmeticbuffs.stykbug.peak", "Cosmetic Buffs", "0.4.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource? logger;
private static readonly Harmony harmony = new Harmony("com.stykbug.hatbuffs");
public static GameObject? hat;
private bool done = false;
public static GameObject? magicBeanPrefab;
public static GameObject[] bigPotionPrefabs = (GameObject[])(object)new GameObject[3];
public static GameObject[] lilPotionPrefabs = (GameObject[])(object)new GameObject[6];
public static GameObject? vialPrefab;
public static SFX_Instance[]? audClips;
public void Awake()
{
logger = ((BaseUnityPlugin)this).Logger;
PluginConfig.RegisterConfigs(((BaseUnityPlugin)this).Config);
BundleLoader.LoadBundleWithName((BaseUnityPlugin)(object)this, "hatmagicbean.peakbundle", (Action<PeakBundle>)delegate(PeakBundle peakBundle)
{
UnityItemContent val = peakBundle.LoadAsset<UnityItemContent>("HatMagicBean");
magicBeanPrefab = val.ItemPrefab;
peakBundle.Mod.RegisterContent();
});
BundleLoader.LoadBundleWithName((BaseUnityPlugin)(object)this, "smallpotion1.peakbundle", (Action<PeakBundle>)delegate(PeakBundle peakBundle)
{
UnityItemContent val = peakBundle.LoadAsset<UnityItemContent>("SPotion1");
lilPotionPrefabs[0] = val.ItemPrefab;
peakBundle.Mod.RegisterContent();
});
BundleLoader.LoadBundleWithName((BaseUnityPlugin)(object)this, "smallpotion2.peakbundle", (Action<PeakBundle>)delegate(PeakBundle peakBundle)
{
UnityItemContent val = peakBundle.LoadAsset<UnityItemContent>("SPotion2");
lilPotionPrefabs[1] = val.ItemPrefab;
peakBundle.Mod.RegisterContent();
});
BundleLoader.LoadBundleWithName((BaseUnityPlugin)(object)this, "smallpotion3.peakbundle", (Action<PeakBundle>)delegate(PeakBundle peakBundle)
{
UnityItemContent val = peakBundle.LoadAsset<UnityItemContent>("SPotion3");
lilPotionPrefabs[2] = val.ItemPrefab;
peakBundle.Mod.RegisterContent();
});
BundleLoader.LoadBundleWithName((BaseUnityPlugin)(object)this, "smallpotion4.peakbundle", (Action<PeakBundle>)delegate(PeakBundle peakBundle)
{
UnityItemContent val = peakBundle.LoadAsset<UnityItemContent>("SPotion4");
lilPotionPrefabs[3] = val.ItemPrefab;
peakBundle.Mod.RegisterContent();
});
BundleLoader.LoadBundleWithName((BaseUnityPlugin)(object)this, "smallpotion5.peakbundle", (Action<PeakBundle>)delegate(PeakBundle peakBundle)
{
UnityItemContent val = peakBundle.LoadAsset<UnityItemContent>("SPotion5");
lilPotionPrefabs[4] = val.ItemPrefab;
peakBundle.Mod.RegisterContent();
});
BundleLoader.LoadBundleWithName((BaseUnityPlugin)(object)this, "smallpotion6.peakbundle", (Action<PeakBundle>)delegate(PeakBundle peakBundle)
{
UnityItemContent val = peakBundle.LoadAsset<UnityItemContent>("SPotion6");
lilPotionPrefabs[5] = val.ItemPrefab;
peakBundle.Mod.RegisterContent();
});
BundleLoader.LoadBundleWithName((BaseUnityPlugin)(object)this, "largepotion1.peakbundle", (Action<PeakBundle>)delegate(PeakBundle peakBundle)
{
UnityItemContent val = peakBundle.LoadAsset<UnityItemContent>("LPotion1");
bigPotionPrefabs[0] = val.ItemPrefab;
peakBundle.Mod.RegisterContent();
});
BundleLoader.LoadBundleWithName((BaseUnityPlugin)(object)this, "largepotion2.peakbundle", (Action<PeakBundle>)delegate(PeakBundle peakBundle)
{
UnityItemContent val = peakBundle.LoadAsset<UnityItemContent>("LPotion2");
bigPotionPrefabs[1] = val.ItemPrefab;
peakBundle.Mod.RegisterContent();
});
BundleLoader.LoadBundleWithName((BaseUnityPlugin)(object)this, "largepotion3.peakbundle", (Action<PeakBundle>)delegate(PeakBundle peakBundle)
{
UnityItemContent val = peakBundle.LoadAsset<UnityItemContent>("LPotion3");
bigPotionPrefabs[2] = val.ItemPrefab;
peakBundle.Mod.RegisterContent();
});
BundleLoader.LoadBundleWithName((BaseUnityPlugin)(object)this, "stamina_vial.peakbundle", (Action<PeakBundle>)delegate(PeakBundle peakBundle)
{
UnityItemContent val = peakBundle.LoadAsset<UnityItemContent>("Stamina Vial");
vialPrefab = val.ItemPrefab;
peakBundle.Mod.RegisterContent();
});
BundleLoader.LoadBundleWithName((BaseUnityPlugin)(object)this, "audio.peakbundle", (Action<PeakBundle>)delegate(PeakBundle peakBundle)
{
UnityItemContent val = peakBundle.LoadAsset<UnityItemContent>("AUDIO");
audClips = val.ItemPrefab.GetComponent<ItemUseFeedback>().equip;
peakBundle.Mod.RegisterContent();
});
}
public void Update()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_090b: Unknown result type (might be due to invalid IL or missing references)
//IL_0918: Expected O, but got Unknown
//IL_081e: Unknown result type (might be due to invalid IL or missing references)
//IL_082c: Expected O, but got Unknown
//IL_0a5b: Unknown result type (might be due to invalid IL or missing references)
//IL_0a69: Expected O, but got Unknown
//IL_0bca: Unknown result type (might be due to invalid IL or missing references)
//IL_0bd7: Expected O, but got Unknown
//IL_0c11: Unknown result type (might be due to invalid IL or missing references)
//IL_0c1f: Expected O, but got Unknown
//IL_0dcf: Unknown result type (might be due to invalid IL or missing references)
//IL_0ddd: Expected O, but got Unknown
//IL_0b30: Unknown result type (might be due to invalid IL or missing references)
//IL_0b3e: Expected O, but got Unknown
//IL_0f9c: Unknown result type (might be due to invalid IL or missing references)
//IL_0faa: Expected O, but got Unknown
//IL_0ad2: Unknown result type (might be due to invalid IL or missing references)
//IL_0adf: Expected O, but got Unknown
//IL_08ac: Unknown result type (might be due to invalid IL or missing references)
//IL_08b9: Expected O, but got Unknown
//IL_0e45: Unknown result type (might be due to invalid IL or missing references)
//IL_0e53: Expected O, but got Unknown
//IL_0e8d: Unknown result type (might be due to invalid IL or missing references)
//IL_0e9b: Expected O, but got Unknown
//IL_0cac: Unknown result type (might be due to invalid IL or missing references)
//IL_0cba: Expected O, but got Unknown
//IL_0f03: Unknown result type (might be due to invalid IL or missing references)
//IL_0f11: Expected O, but got Unknown
//IL_0f4b: Unknown result type (might be due to invalid IL or missing references)
//IL_0f59: Expected O, but got Unknown
Scene activeScene = SceneManager.GetActiveScene();
string name = ((Scene)(ref activeScene)).name;
if (name.StartsWith("Level_"))
{
if (!((double)RunManager.Instance.TimeSinceRunStarted > 0.5) || done)
{
return;
}
hat = GetHat();
if ((Object)(object)hat != (Object)null)
{
switch (((Object)hat).name)
{
case "Fedora":
hat.AddComponent<FedoraHat>();
done = true;
break;
case "Hat.001":
hat.AddComponent<PropellerHat>();
done = true;
break;
case "StrawHat":
hat.AddComponent<SunHat>();
done = true;
break;
case "AviatorHat":
{
hat.AddComponent<AviatorHat>();
MethodInfo method29 = typeof(CharacterAfflictions).GetMethod("AddStatus", BindingFlags.Instance | BindingFlags.Public);
MethodInfo method30 = typeof(AfflictionPatches).GetMethod("LessColdPatch", BindingFlags.Static | BindingFlags.NonPublic);
harmony.Patch((MethodBase)method29, new HarmonyMethod(method30), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
done = true;
break;
}
case "SailorHat":
hat.AddComponent<SailorHat>();
done = true;
break;
case "MedicHelmet":
hat.AddComponent<MedicHat>();
done = true;
break;
case "Midsummer":
{
hat.AddComponent<FloraRingHat>();
MethodInfo method27 = typeof(InventoryItemUI).GetMethod("UpdateNameText", BindingFlags.Instance | BindingFlags.Public);
MethodInfo method28 = typeof(UIPatches).GetMethod("UpdateNamePatch", BindingFlags.Static | BindingFlags.NonPublic);
harmony.Patch((MethodBase)method27, (HarmonyMethod)null, new HarmonyMethod(method28), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
done = true;
break;
}
case "MushroomHat":
{
hat.AddComponent<MushroomHat>();
MethodInfo method25 = typeof(InventoryItemUI).GetMethod("UpdateNameText", BindingFlags.Instance | BindingFlags.Public);
MethodInfo method26 = typeof(UIPatches).GetMethod("UpdateNamePatch", BindingFlags.Static | BindingFlags.NonPublic);
harmony.Patch((MethodBase)method25, (HarmonyMethod)null, new HarmonyMethod(method26), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
done = true;
break;
}
case "CrabHat":
done = true;
break;
case "CourierHat":
hat.AddComponent<SpeedrunHat>();
done = true;
break;
case "ScoutmasterHat":
hat.AddComponent<ScoutmasterHat>();
done = true;
break;
case "Bandana":
done = true;
break;
case "NinjaHeadband":
hat.AddComponent<NarutoHat>();
done = true;
break;
case "ChefHat":
hat.AddComponent<ChefHat>();
done = true;
break;
case "WizardHat":
hat.AddComponent<WitchHat>();
done = true;
break;
case "WolfEars":
hat.AddComponent<WolfHat>();
done = true;
break;
case "Crown":
hat.AddComponent<CrownHat>();
done = true;
break;
case "Goat":
{
GoatHat goatHat2 = hat.AddComponent<GoatHat>();
goatHat2.dashSpd = 2250f;
goatHat2.AddUse();
done = true;
break;
}
case "DesertHat":
case "StrawSunHat":
{
SunHat sunHat = hat.AddComponent<SunHat>();
sunHat.cap = 0.85f;
MethodInfo method23 = typeof(CharacterAfflictions).GetMethod("AddStatus", BindingFlags.Instance | BindingFlags.Public);
MethodInfo method24 = typeof(AfflictionPatches).GetMethod("LessHeatPatch", BindingFlags.Static | BindingFlags.NonPublic);
harmony.Patch((MethodBase)method23, new HarmonyMethod(method24), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
done = true;
break;
}
case "SunVisorHat":
hat.AddComponent<VisorHat>();
done = true;
break;
case "CowboyHat":
{
hat.AddComponent<CowboyHat>();
MethodInfo method21 = typeof(Item).GetMethod("Interact", BindingFlags.Instance | BindingFlags.Public);
MethodInfo method22 = typeof(ItemPatches).GetMethod("LauncherPatch", BindingFlags.Static | BindingFlags.NonPublic);
harmony.Patch((MethodBase)method21, (HarmonyMethod)null, new HarmonyMethod(method22), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
done = true;
break;
}
case "Ice Hood Blue":
case "Ice Hood Pink":
{
hat.AddComponent<IceClimbHat>();
MethodInfo method19 = typeof(CharacterAfflictions).GetMethod("AddStatus", BindingFlags.Instance | BindingFlags.Public);
MethodInfo method20 = typeof(AfflictionPatches).GetMethod("MoreHeatPatch", BindingFlags.Static | BindingFlags.NonPublic);
harmony.Patch((MethodBase)method19, new HarmonyMethod(method20), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
done = true;
break;
}
case "BBHat":
hat.AddComponent<BingBongHat>();
done = true;
break;
case "Racing Helmet":
hat.AddComponent<RacingHat>();
done = true;
break;
case "SpaceHelmet White":
hat.AddComponent<AstronautHat>();
done = true;
break;
case "PumpkinHead":
{
MethodInfo method15 = typeof(Mob).GetMethod("TargetValid", BindingFlags.Instance | BindingFlags.NonPublic);
MethodInfo method16 = typeof(BotPatches).GetMethod("MobTargetPatch", BindingFlags.Static | BindingFlags.NonPublic);
harmony.Patch((MethodBase)method15, (HarmonyMethod)null, new HarmonyMethod(method16), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
MethodInfo method17 = typeof(MushroomZombie).GetMethod("SetCurrentTarget", BindingFlags.Instance | BindingFlags.NonPublic);
MethodInfo method18 = typeof(BotPatches).GetMethod("ZombieTargetPatch", BindingFlags.Static | BindingFlags.NonPublic);
harmony.Patch((MethodBase)method17, new HarmonyMethod(method18), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
done = true;
break;
}
case "MummyHat":
hat.AddComponent<MummyHat>();
done = true;
break;
case "Antlers":
{
GoatHat goatHat = hat.AddComponent<GoatHat>();
goatHat.dashSpd = 1500f;
goatHat.sprintSpd = 1.15f;
goatHat.walkSpd = 0.925f;
MethodInfo method13 = typeof(CharacterAfflictions).GetMethod("AddStatus", BindingFlags.Instance | BindingFlags.Public);
MethodInfo method14 = typeof(AfflictionPatches).GetMethod("LessInjuryPatch", BindingFlags.Static | BindingFlags.NonPublic);
harmony.Patch((MethodBase)method13, new HarmonyMethod(method14), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
done = true;
break;
}
case "GnomeHat":
done = true;
break;
case "PlagueDoctor":
hat.AddComponent<PlagueDoctorHat>();
done = true;
break;
case "ClimbingHelmet":
hat.AddComponent<ClimbingHat>();
done = true;
break;
case "NumberOne":
hat.AddComponent<DrinkingHat>();
done = true;
break;
case "FlowerHat":
hat.AddComponent<FairyHat>();
done = true;
break;
case "Sprout":
hat.AddComponent<SproutHat>();
done = true;
break;
case "FlapperHat":
hat.AddComponent<WeirdHat>();
done = true;
break;
case "JesterHat":
hat.AddComponent<JesterHat>();
done = true;
break;
case "SleepyGuyHat":
hat.AddComponent<NapCapHat>();
done = true;
break;
case "ArrowHat":
{
hat.AddComponent<ArrowHat>();
MethodInfo method11 = typeof(CharacterAfflictions).GetMethod("AddStatus", BindingFlags.Instance | BindingFlags.Public);
MethodInfo method12 = typeof(AfflictionPatches).GetMethod("NoInjuryPatch", BindingFlags.Static | BindingFlags.NonPublic);
harmony.Patch((MethodBase)method11, new HarmonyMethod(method12), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
done = true;
break;
}
case "LaurelHat":
hat.AddComponent<LaurelHat>();
done = true;
break;
case "KnightHelmet":
{
hat.AddComponent<KnightHat>();
MethodInfo method7 = typeof(CharacterAfflictions).GetMethod("SetStatus", BindingFlags.Instance | BindingFlags.Public);
MethodInfo method8 = typeof(AfflictionPatches).GetMethod("HeavyPatch", BindingFlags.Static | BindingFlags.NonPublic);
harmony.Patch((MethodBase)method7, new HarmonyMethod(method8), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
MethodInfo method9 = typeof(CharacterAfflictions).GetMethod("AddStatus", BindingFlags.Instance | BindingFlags.Public);
MethodInfo method10 = typeof(AfflictionPatches).GetMethod("MuchLessInjuryPatch", BindingFlags.Static | BindingFlags.NonPublic);
harmony.Patch((MethodBase)method9, new HarmonyMethod(method10), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
done = true;
break;
}
case "FrogHat":
hat.AddComponent<FrogHat>();
done = true;
break;
case "GothicHat":
{
hat.AddComponent<GothicHat>();
MethodInfo method3 = typeof(CharacterAfflictions).GetMethod("AddAffliction", BindingFlags.Instance | BindingFlags.Public);
MethodInfo method4 = typeof(AfflictionPatches).GetMethod("NoNumbPatch", BindingFlags.Static | BindingFlags.NonPublic);
harmony.Patch((MethodBase)method3, new HarmonyMethod(method4), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
MethodInfo method5 = typeof(CharacterAfflictions).GetMethod("AddStatus", BindingFlags.Instance | BindingFlags.Public);
MethodInfo method6 = typeof(AfflictionPatches).GetMethod("NumbStatsPatch", BindingFlags.Static | BindingFlags.NonPublic);
harmony.Patch((MethodBase)method5, new HarmonyMethod(method6), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
done = true;
break;
}
case "StarboyHat":
{
MethodInfo method = typeof(CharacterData).GetMethod("SetPetrify", BindingFlags.Instance | BindingFlags.Public);
MethodInfo method2 = typeof(DataPatches).GetMethod("NoPetrifyPatch", BindingFlags.Static | BindingFlags.NonPublic);
harmony.Patch((MethodBase)method, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
done = true;
break;
}
}
}
}
else if (name == "Airport" && done)
{
hat = null;
done = false;
harmony.UnpatchSelf();
}
}
public static GameObject GetHat()
{
Renderer[] playerHats = Character.localCharacter.refs.customization.refs.playerHats;
Renderer[] array = playerHats;
foreach (Renderer val in array)
{
if (((Component)val).gameObject.activeSelf)
{
return ((Component)val).gameObject;
}
}
return ((Component)playerHats[0]).gameObject;
}
}
public static class PluginConfig
{
public static ConfigEntry<KeyCode> keycode;
public static void RegisterConfigs(ConfigFile file)
{
keycode = file.Bind<KeyCode>("General", "Ability Keybind", (KeyCode)122, "The input set to activate a hat's ability.");
}
}
public abstract class HatBase : MonoBehaviour
{
protected static Character localPlayer => Character.localCharacter;
protected static void PlaySound(SFX_Instance sfx)
{
//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_001c: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = localPlayer.refs.hip.transform.position;
sfx.Play(position);
}
}
public abstract class HatAbility : HatBase
{
protected List<float> cd = new List<float>();
protected List<UI_Cooldown> uiCD = new List<UI_Cooldown>();
protected List<bool> oneFrame = new List<bool>();
protected static KeyCode button = PluginConfig.keycode.Value;
private bool once = true;
private bool didAbility = false;
private GameObject campfireIcon = ((Component)((Component)GUIManager.instance).transform.GetChild(0).GetChild(0).GetChild(0)
.GetChild(0)
.GetChild(0)
.GetChild(3)).gameObject;
public int totalAbilities => cd.Count;
protected abstract int cdMax { get; }
private static GameObject? uiOG => ((Component)((Component)GUIManager.instance).transform.GetChild(0).GetChild(4)).gameObject;
public void Start()
{
AddUse();
StartUp();
}
public void Update()
{
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
if (!HatBase.localPlayer.IsGhost)
{
didAbility = false;
for (int i = 0; i < totalAbilities; i++)
{
if (didAbility)
{
continue;
}
if (!once)
{
((Behaviour)uiCD[i].fill).enabled = true;
((Behaviour)uiCD[i].empty).enabled = true;
once = true;
}
if (cd[i] > 0f)
{
uiCD[i].UpdateFill(Math.Max(cd[i], 0f), cdMax);
cd[i] -= (campfireIcon.activeSelf ? (Time.deltaTime * 30f) : Time.deltaTime);
if (oneFrame[i])
{
oneFrame[i] = false;
}
continue;
}
if (!oneFrame[i])
{
ResetCD(i);
oneFrame[i] = true;
}
if (Input.GetKeyDown(button))
{
RunAbility(i);
didAbility = true;
}
}
}
else if (once)
{
once = false;
for (int j = 0; j < totalAbilities; j++)
{
((Behaviour)uiCD[j].fill).enabled = false;
((Behaviour)uiCD[j].empty).enabled = false;
cd[j] = 0f;
}
}
}
public void ResetCD(int which)
{
cd[which] = 0f;
uiCD[which].UpdateFill(0f, cdMax);
HatBase.PlaySound(Plugin.audClips[0]);
}
public virtual void StartUp()
{
}
public abstract void RunAbility(int which);
public UI_Cooldown MakeUI(int num)
{
//IL_0039: 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_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(uiOG);
val.transform.parent = uiOG.transform.parent;
RectTransform component = val.GetComponent<RectTransform>();
component.anchorMax = new Vector2(1f, 1f);
component.anchorMin = new Vector2(1f, 1f);
component.anchoredPosition = new Vector2(-100f, (float)(num * -100));
float num2 = (float)(num - 1) * -0.1f + 1f;
((Transform)component).localScale = new Vector3(num2, num2, num2);
Object.Destroy((Object)(object)val.GetComponent<UI_UseItemProgress>(), 0f);
UI_Cooldown uI_Cooldown = val.AddComponent<UI_Cooldown>();
uI_Cooldown.color = new Color(0.75f, 0.275f, 1f, 1f);
return uI_Cooldown;
}
public void AddUse()
{
cd.Add(0f);
uiCD.Add(MakeUI(totalAbilities));
oneFrame.Add(item: false);
}
}
public class FedoraHat : HatBase
{
public void Start()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
((Component)HatBase.localPlayer).transform.localScale = new Vector3(1.233f, 1.233f, 1.233f);
((Component)((Component)HatBase.localPlayer).transform.GetChild(2)).GetComponent<AudioSource>().pitch = 0.9f;
CharacterAfflictions afflictions = HatBase.localPlayer.refs.afflictions;
afflictions.hungerPerSecond *= 3f;
CharacterMovement movement = HatBase.localPlayer.refs.movement;
movement.movementModifier *= 0.933f;
}
public void Update()
{
if (HatBase.localPlayer.refs.afflictions.currentStatuses[2] > 0f)
{
HatBase.localPlayer.refs.afflictions.currentStatuses[2] = 0f;
}
}
}
public class PropellerHat : HatBase
{
public void Start()
{
HatBase.localPlayer.refs.movement.gravityCurveSpeed = 0.265f;
HatBase.localPlayer.refs.movement.maxGravity = -300f;
}
}
public class SunHat : HatBase
{
public float cap = 0.4f;
public void Update()
{
if (HatBase.localPlayer.refs.afflictions.GetCurrentStatus((STATUSTYPE)8) > cap)
{
HatBase.localPlayer.refs.afflictions.SetStatus((STATUSTYPE)8, cap, true);
}
}
}
public class AviatorHat : HatBase
{
public void Start()
{
HatBase.localPlayer.refs.movement.drag = 0.88f;
HatBase.localPlayer.refs.movement.rocketDrag = 0.98f;
}
}
public class SailorHat : HatBase
{
public void Start()
{
HatBase.localPlayer.data.lastFroggedTime = 2E+09f;
}
public void Update()
{
if (HatBase.localPlayer.data.isInWater)
{
HatBase.localPlayer.refs.movement.movementModifier = 1.65f;
}
else
{
HatBase.localPlayer.refs.movement.movementModifier = 1f;
}
}
}
public class MedicHat : HatAbility
{
protected override int cdMax => 300;
public override void RunAbility(int which)
{
if (HatBase.localPlayer.refs.afflictions.currentStatuses[0] > 0f)
{
HatBase.localPlayer.refs.afflictions.SubtractStatus((STATUSTYPE)0, 0.35f, false, false);
cd[0] = cdMax;
HatBase.PlaySound(Plugin.audClips[1]);
}
}
}
public class FloraRingHat : HatBase
{
public void Start()
{
HatBase.localPlayer.refs.vineClimbing.slideDeceleration = 1f;
CharacterVineClimbing vineClimbing = HatBase.localPlayer.refs.vineClimbing;
vineClimbing.climbSpeed *= 1.25f;
}
}
public class MushroomHat : HatBase
{
private float buffer;
private bool didSFX = false;
public void Update()
{
if (HatBase.localPlayer.data.isCrouching)
{
didSFX = false;
buffer = 0.13f;
}
if (buffer > 0f)
{
HatBase.localPlayer.refs.movement.jumpImpulse = 1100f;
HatBase.localPlayer.refs.movement.jumpStaminaUsage = 0.1f;
buffer -= Time.deltaTime;
}
else
{
HatBase.localPlayer.refs.movement.jumpStaminaUsage = 0.05f;
HatBase.localPlayer.refs.movement.jumpImpulse = 400f;
}
if (buffer > 0f && HatBase.localPlayer.input.jumpIsPressed && !didSFX)
{
GUIManager.instance.ClimbJump();
HatBase.PlaySound(Plugin.audClips[2]);
didSFX = true;
}
}
}
public class SpeedrunHat : HatBase
{
public void Start()
{
CharacterMovement movement = HatBase.localPlayer.refs.movement;
movement.sprintMultiplier *= 1.6f;
CharacterMovement movement2 = HatBase.localPlayer.refs.movement;
movement2.sprintStaminaUsage *= 1.85f;
CharacterClimbing climbing = HatBase.localPlayer.refs.climbing;
climbing.climbSpeed *= 1.75f;
CharacterClimbing climbing2 = HatBase.localPlayer.refs.climbing;
climbing2.maxStaminaUsage *= 1.75f;
CharacterClimbing climbing3 = HatBase.localPlayer.refs.climbing;
climbing3.minStaminaUsage *= 1.75f;
CharacterVineClimbing vineClimbing = HatBase.localPlayer.refs.vineClimbing;
vineClimbing.climbSpeedMod *= 1.75f;
CharacterVineClimbing vineClimbing2 = HatBase.localPlayer.refs.vineClimbing;
vineClimbing2.staminaUsage *= 1.75f;
CharacterRopeHandling ropeHandling = HatBase.localPlayer.refs.ropeHandling;
ropeHandling.climbSpeedMod *= 1.75f;
CharacterRopeHandling ropeHandling2 = HatBase.localPlayer.refs.ropeHandling;
ropeHandling2.staminaUsage *= 1.75f;
}
}
public class ScoutmasterHat : HatAbility
{
protected override int cdMax => 300;
public override void RunAbility(int which)
{
if ((double)HatBase.localPlayer.data.extraStamina < 0.9)
{
HatBase.localPlayer.AddExtraStamina(0.25f);
cd[0] = cdMax;
HatBase.PlaySound(Plugin.audClips[3]);
}
}
}
public class NarutoHat : HatBase
{
public void Start()
{
CharacterMovement movement = HatBase.localPlayer.refs.movement;
movement.sprintMultiplier *= 1.35f;
}
}
public class ChefHat : HatAbility
{
private bool noResetYet = true;
protected override int cdMax => 160;
public override void RunAbility(int which)
{
if ((Object)(object)HatBase.localPlayer.data.currentItem != (Object)null)
{
HatBase.localPlayer.data.currentItem.cooking.FinishCooking();
cd[0] = cdMax;
noResetYet = true;
}
}
public void FixedUpdate()
{
if (noResetYet && cd[0] > 0f && ((Behaviour)GUIManager.instance.heatSVFX).isActiveAndEnabled)
{
ResetCD(0);
noResetYet = false;
}
}
}
public class WitchHat : HatAbility
{
protected override int cdMax => 75;
private Random rng => new Random((int)Time.time);
private Transform hip => HatBase.localPlayer.refs.hip.transform;
public override void RunAbility(int which)
{
//IL_0070: 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_0091: Invalid comparison between Unknown and I4
//IL_010d: 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_0122: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)HatBase.localPlayer.data.currentItem != (Object)null && !(HatBase.localPlayer.data.currentItem is Backpack))
{
PhotonNetwork.Destroy(((Component)HatBase.localPlayer.data.currentItem).gameObject);
HatBase.localPlayer.player.EmptySlot(HatBase.localPlayer.refs.items.currentSelectedSlot, true);
if ((int)HatBase.localPlayer.data.currentItem.itemTags == 1)
{
int num = rng.Next(3);
GameObject val = PhotonNetwork.InstantiateItem(((Object)Plugin.bigPotionPrefabs[num]).name, hip.position + hip.forward, Quaternion.identity);
val.GetComponent<Item>().Interact(HatBase.localPlayer);
}
else
{
int num2 = rng.Next(6);
GameObject val2 = PhotonNetwork.InstantiateItem(((Object)Plugin.lilPotionPrefabs[num2]).name, hip.position + hip.forward, Quaternion.identity);
val2.GetComponent<Item>().Interact(HatBase.localPlayer);
}
GUIManager.instance.curseSVFX.Play(1f, false);
HatBase.PlaySound(Plugin.audClips[4]);
cd[0] = cdMax;
}
}
}
public class WolfHat : HatBase
{
private bool away = false;
public void Start()
{
((MonoBehaviour)this).InvokeRepeating("CheckDistance", 5f, 1f);
}
private void CheckDistance()
{
//IL_003d: 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)
away = false;
foreach (Character allCharacter in Character.AllCharacters)
{
if ((Object)(object)allCharacter != (Object)(object)HatBase.localPlayer && Vector3.Distance(allCharacter.refs.hip.transform.position, HatBase.localPlayer.refs.hip.transform.position) >= 45f)
{
away = true;
}
}
if (away)
{
HatBase.localPlayer.refs.movement.movementForce = 30f;
CharacterClimbing climbing = HatBase.localPlayer.refs.climbing;
climbing.climbSpeed *= 5.35f;
}
else
{
HatBase.localPlayer.refs.movement.movementForce = 25f;
HatBase.localPlayer.refs.climbing.climbSpeed = 4f;
}
}
}
public class CrownHat : HatAbility
{
private Affliction_Invincibility invi = new Affliction_Invincibility
{
isFromMilk = false,
totalTime = 8.5f,
timeElapsed = 0f,
isFromAmulet = false
};
protected override int cdMax => 255;
public override void StartUp()
{
((Affliction)invi).character = ((Component)HatBase.localPlayer).GetComponent<Character>();
}
public override void RunAbility(int which)
{
HatBase.localPlayer.refs.afflictions.AddAffliction(((Affliction)invi).Copy(), false);
HatBase.PlaySound(Plugin.audClips[10]);
cd[0] = cdMax;
}
}
public class GoatHat : HatAbility
{
public float sprintSpd = 1f;
public float walkSpd = 1f;
public float dashSpd = 2000f;
protected override int cdMax => 20;
public override void StartUp()
{
CharacterMovement movement = HatBase.localPlayer.refs.movement;
movement.sprintMultiplier *= sprintSpd;
CharacterMovement movement2 = HatBase.localPlayer.refs.movement;
movement2.movementModifier *= walkSpd;
}
public override void RunAbility(int which)
{
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
if (HatBase.localPlayer.data.isGrounded && HatBase.localPlayer.data.worldMovementInput.x != 0f && HatBase.localPlayer.data.worldMovementInput.z != 0f)
{
HatBase.localPlayer.refs.movement.TryJumpOffVineOrRope();
float x = HatBase.localPlayer.data.worldMovementInput.x;
x *= dashSpd;
float z = HatBase.localPlayer.data.worldMovementInput.z;
z *= dashSpd;
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(x, -250f, z);
HatBase.localPlayer.RPCA_AddForceToBodyPart((BodypartType)0, Vector3.zero, val);
HatBase.PlaySound(Plugin.audClips[5]);
if (cd[which] <= 0f)
{
cd[which] = cdMax;
}
}
}
}
public class VisorHat : HatBase
{
public void Start()
{
CharacterItems items = HatBase.localPlayer.refs.items;
items.throwChargeTime *= 0.67f;
CharacterItems items2 = HatBase.localPlayer.refs.items;
items2.maxThrowForce *= 2f;
CharacterItems items3 = HatBase.localPlayer.refs.items;
items3.minThrowForce *= 2f;
}
public void FixedUpdate()
{
if (HatBase.localPlayer.refs.afflictions.GetCurrentStatus((STATUSTYPE)8) > 0.5f)
{
HatBase.localPlayer.refs.afflictions.SetStatus((STATUSTYPE)8, 0.5f, true);
}
}
}
public class CowboyHat : HatBase
{
public void Start()
{
CharacterRopeHandling ropeHandling = HatBase.localPlayer.refs.ropeHandling;
ropeHandling.staminaUsageUp *= 0.6f;
CharacterRopeHandling ropeHandling2 = HatBase.localPlayer.refs.ropeHandling;
ropeHandling2.climbSpeed *= 1.4f;
}
}
public class IceClimbHat : HatBase
{
public void Start()
{
CharacterAfflictions afflictions = HatBase.localPlayer.refs.afflictions;
afflictions.hotReductionCooldown *= 1.5f;
CharacterAfflictions afflictions2 = HatBase.localPlayer.refs.afflictions;
afflictions2.hotReductionPerSecond *= 0.9f;
}
public void Update()
{
if (HatBase.localPlayer.refs.afflictions.GetCurrentStatus((STATUSTYPE)2) > 0f)
{
HatBase.localPlayer.refs.afflictions.SetStatus((STATUSTYPE)2, 0f, true);
}
}
}
public class BingBongHat : HatBase
{
public void Start()
{
((MonoBehaviour)this).InvokeRepeating("Heal", 5f, 3.5f);
}
public void Heal()
{
if (!Object.op_Implicit((Object)(object)HatBase.localPlayer.data.currentItem) || !(((Object)HatBase.localPlayer.data.currentItem).name == "BingBong(Clone)"))
{
return;
}
bool flag = false;
for (int i = 0; i < 15; i++)
{
if (i != 1 && i != 5 && i != 7 && i != 9 && i != 11 && i != 12 && HatBase.localPlayer.refs.afflictions.currentStatuses[i] > 0f)
{
flag = true;
HatBase.localPlayer.refs.afflictions.currentStatuses[i] = Math.Max(HatBase.localPlayer.refs.afflictions.currentStatuses[i] - 0.0125f, 0f);
}
}
if (flag)
{
HatBase.PlaySound(Plugin.audClips[6]);
}
}
}
public class RacingHat : HatAbility
{
private Affliction_FasterBoi speed = new Affliction_FasterBoi
{
timeElapsed = 0f,
climbDelay = 3f,
drowsyOnEnd = 0.05f,
climbSpeedMod = 0f,
moveSpeedMod = 0f,
totalTime = 5f
};
private int count = 0;
protected override int cdMax => 60;
public override void StartUp()
{
((Affliction)speed).character = HatBase.localPlayer;
}
public override void RunAbility(int which)
{
if (count < 10)
{
count++;
Affliction_FasterBoi obj = speed;
obj.climbSpeedMod += 0.3f;
Affliction_FasterBoi obj2 = speed;
obj2.moveSpeedMod += 0.1f;
switch (count)
{
case 3:
case 4:
case 5:
{
Affliction_FasterBoi obj5 = speed;
obj5.drowsyOnEnd += 0.05f;
break;
}
case 6:
case 7:
case 8:
{
Affliction_FasterBoi obj4 = speed;
obj4.drowsyOnEnd += 0.1f;
break;
}
case 9:
case 10:
{
Affliction_FasterBoi obj3 = speed;
obj3.drowsyOnEnd += 0.2f;
break;
}
}
HatBase.PlaySound(Plugin.audClips[8]);
}
}
public void FixedUpdate()
{
//IL_0014: 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_005f: 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_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Expected O, but got Unknown
if (count > 0 && HatBase.localPlayer.data.worldMovementInput != new Vector3(0f, 0f, 0f))
{
HatBase.localPlayer.refs.afflictions.AddAffliction(((Affliction)speed).Copy(), false);
speed = new Affliction_FasterBoi
{
timeElapsed = 0f,
climbDelay = 3f,
drowsyOnEnd = 0.05f,
climbSpeedMod = 0f,
moveSpeedMod = 0f,
totalTime = 5f
};
count = 0;
cd[0] = cdMax;
}
}
}
public class AstronautHat : HatAbility
{
protected override int cdMax => 300;
public override void StartUp()
{
CharacterBalloons balloons = HatBase.localPlayer.refs.balloons;
balloons.balloonFloatAmount *= 1.1f;
AddUse();
AddUse();
}
public override void RunAbility(int which)
{
HatBase.localPlayer.refs.balloons.TieNewBalloon(new Random((int)Time.time * 100).Next(7));
cd[which] = cdMax;
}
}
public class MummyHat : HatAbility
{
private float redTime = 0f;
private bool AlreadyUsed = false;
protected override int cdMax => 10;
public void FixedUpdate()
{
if (AlreadyUsed)
{
cd[0] = 10f;
}
if (redTime <= 0f && Time.time - HatBase.localPlayer.refs.afflictions.LastAddedIncrementalStatus((STATUSTYPE)5) >= 120f)
{
HatBase.localPlayer.refs.afflictions.SubtractStatus((STATUSTYPE)5, 0.0125f, false, true);
redTime = 2f;
}
if (redTime > 0f)
{
redTime -= Time.deltaTime;
}
}
public override void RunAbility(int which)
{
if (HatBase.localPlayer.data.fullyPassedOut && !HatBase.localPlayer.data.dead && HatBase.localPlayer.refs.afflictions.currentStatuses[5] < 0.5f && !AlreadyUsed)
{
HatBase.localPlayer.refs.afflictions.ClearAllAfflictions();
HatBase.localPlayer.refs.afflictions.ClearAllStatus(true, true);
HatBase.localPlayer.refs.afflictions.AddStatus((STATUSTYPE)5, 0.5f, false, true, true, false, false);
GUIManager.instance.curseSVFX.Play(1f, true);
AlreadyUsed = true;
}
}
}
public class PlagueDoctorHat : HatAbility
{
protected override int cdMax => 180;
private GameObject hip => ((Component)HatBase.localPlayer.refs.hip).gameObject;
public override void RunAbility(int which)
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
if (HatBase.localPlayer.data.fullyConscious && !HatBase.localPlayer.refs.movement.rocketActive && PlayerRaycast(out IInteractible result) && result is CharacterInteractible)
{
((CharacterInteractible)result).character.refs.afflictions.AddStatus((STATUSTYPE)0, 0.175f, true, true, true, false, false);
GameObject val = PhotonNetwork.InstantiateItem(((Object)Plugin.vialPrefab).name, hip.transform.position + hip.transform.forward, Quaternion.identity);
val.GetComponent<Item>().Interact(HatBase.localPlayer);
cd[0] = cdMax;
}
}
private static bool PlayerRaycast(out IInteractible result)
{
//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_0026: 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_003d: 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_0081: Unknown result type (might be due to invalid IL or missing references)
Transform transform = ((Component)MainCamera.instance).transform;
RaycastHit[] array = (RaycastHit[])(object)new RaycastHit[100];
float num = 1000f;
int num2 = Physics.SphereCastNonAlloc(transform.position + transform.forward, 0.5f, transform.forward, array, 2f, LayerMask.op_Implicit(HelperFunctions.GetMask((LayerType)0)), (QueryTriggerInteraction)2);
for (int i = 0; i < num2; i++)
{
RaycastHit val = array[i];
IInteractible componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<IInteractible>();
if (((RaycastHit)(ref val)).distance <= num && componentInParent is CharacterInteractible && (Object)(object)((CharacterInteractible)componentInParent).character != (Object)(object)HatBase.localPlayer)
{
num = ((RaycastHit)(ref val)).distance;
result = componentInParent;
return true;
}
}
result = null;
return false;
}
}
public class ClimbingHat : HatBase
{
public void Start()
{
CharacterClimbing climbing = HatBase.localPlayer.refs.climbing;
climbing.climbSpeed *= 1.1f;
}
public void Update()
{
//IL_0049: 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 (HatBase.localPlayer.data.isClimbing && !HatBase.localPlayer.input.sprintIsPressed)
{
HatBase.localPlayer.refs.climbing.playerSlide = HatBase.localPlayer.refs.climbing.playerSlide / 1.125f;
}
}
}
public class DrinkingHat : HatAbility
{
private Affliction_FasterBoi speed = new Affliction_FasterBoi
{
character = HatBase.localPlayer,
timeElapsed = 0f,
totalTime = 10f,
drowsyOnEnd = 0.3f,
climbSpeedMod = 1.5f,
moveSpeedMod = 0.65f
};
protected override int cdMax => 345;
public override void StartUp()
{
((Affliction)speed).character = HatBase.localPlayer;
AddUse();
}
public override void RunAbility(int which)
{
HatBase.localPlayer.refs.afflictions.AddAffliction(((Affliction)speed).Copy(), false);
HatBase.PlaySound(Plugin.audClips[11]);
cd[which] = cdMax;
}
}
public class FairyHat : HatAbility
{
protected override int cdMax => 80;
public override void RunAbility(int which)
{
HatBase.localPlayer.refs.movement.DoSuperJump(40f, 1.25f, 3, 1.25f);
cd[0] = cdMax;
}
}
public class SproutHat : HatAbility
{
protected override int cdMax => 350;
private GameObject hip => ((Component)HatBase.localPlayer.refs.hip).gameObject;
public override void RunAbility(int which)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
GameObject val = PhotonNetwork.InstantiateItemRoom(((Object)Plugin.magicBeanPrefab).name, hip.transform.position + hip.transform.forward, Quaternion.identity, true);
val.GetComponent<Item>().Interact(HatBase.localPlayer);
cd[0] = cdMax;
}
}
public class WeirdHat : HatBase
{
public void Start()
{
HatBase.localPlayer.refs.afflictions.poisonReductionCooldown = (HatBase.localPlayer.refs.afflictions.sporesReductionCooldown = 7f);
}
}
public class JesterHat : HatAbility
{
protected override int cdMax => 1;
private Random rng => new Random((int)(Time.time * 100f));
public override void RunAbility(int which)
{
if (HatBase.localPlayer.data.fullyConscious)
{
float num = (float)rng.NextDouble();
if ((double)num <= 0.01)
{
HatBase.localPlayer.refs.afflictions.ClearAllStatus(true, true);
}
else if ((double)num <= 0.05)
{
HatBase.localPlayer.refs.afflictions.AddStatus((STATUSTYPE)4, 1f, false, true, true, true, false);
}
else if ((double)num <= 0.25)
{
HatBase.localPlayer.refs.afflictions.AddStatus((STATUSTYPE)4, 0.3f, false, true, true, true, false);
}
else if ((double)num <= 0.4)
{
HatBase.localPlayer.refs.afflictions.SubtractStatus((STATUSTYPE)4, 0.3f, false, false);
}
else if ((double)num <= 0.7)
{
HatBase.localPlayer.data.extraStamina = Math.Max(HatBase.localPlayer.data.extraStamina - 0.3f, 0f);
}
else
{
HatBase.localPlayer.data.extraStamina = Math.Min(HatBase.localPlayer.data.extraStamina + 0.35f, 1f);
}
HatBase.PlaySound(Plugin.audClips[7]);
cd[0] = cdMax;
}
}
}
public class NapCapHat : HatBase
{
public void Update()
{
HatBase.localPlayer.refs.afflictions.currentStatuses[6] = 0.15f;
HatBase.localPlayer.data.currentRagdollControll = 0.1f;
}
}
public class ArrowHat : HatBase
{
private float sinceBleed = 20f;
public void Start()
{
HatBase.localPlayer.refs.afflictions.currentStatuses[12] = 0.1f;
}
public void Update()
{
if (sinceBleed <= 0f)
{
HatBase.localPlayer.refs.afflictions.currentStatuses[0] += 0.025f;
GUIManager.instance.AddStatusFX((STATUSTYPE)0, 0.025f);
HatBase.PlaySound(Plugin.audClips[9]);
sinceBleed = 60f;
}
else
{
sinceBleed -= Time.deltaTime;
}
}
}
public class LaurelHat : HatAbility
{
private Affliction_Invincibility invi = new Affliction_Invincibility
{
isFromMilk = false,
totalTime = 2f,
timeElapsed = 0f,
isFromAmulet = false
};
private Affliction_FasterBoi speed = new Affliction_FasterBoi
{
drowsyOnEnd = 0f,
totalTime = 2f,
timeElapsed = 0f,
climbSpeedMod = 0.5f,
moveSpeedMod = 0.4f,
climbDelay = 3f
};
protected override int cdMax => 200;
public override void StartUp()
{
((Affliction)invi).character = HatBase.localPlayer;
((Affliction)speed).character = HatBase.localPlayer;
AddUse();
}
public override void RunAbility(int which)
{
HatBase.localPlayer.refs.afflictions.AddAffliction(((Affliction)invi).Copy(), false);
HatBase.localPlayer.refs.afflictions.AddAffliction(((Affliction)speed).Copy(), false);
HatBase.PlaySound(Plugin.audClips[10]);
cd[which] = cdMax;
}
}
public class KnightHat : HatBase
{
public void Start()
{
HatBase.localPlayer.refs.afflictions.SetStatus((STATUSTYPE)7, 0f, true);
}
}
public class FrogHat : HatBase
{
public void Start()
{
HatBase.localPlayer.refs.movement.jumpImpulse = 600f;
CharacterMovement movement = HatBase.localPlayer.refs.movement;
movement.jumpStaminaUsageSprinting *= 0.9f;
HatBase.localPlayer.data.lastFroggedTime = 2E+09f;
}
}
public class GothicHat : HatAbility
{
protected override int cdMax => 210;
public override void StartUp()
{
//IL_0038: 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)
Transform child = ((Component)GUIManager.instance).transform.GetChild(0).GetChild(1);
((Graphic)((Component)child.GetChild(1)).GetComponent<Image>()).color = new Color(0.15f, 0.075f, 0.125f, 1f);
((Graphic)((Component)child.GetChild(1)).GetComponent<Image>()).color = new Color(0.35f, 0.215f, 0.35f, 1f);
GUIManager.instance.StartNumb();
}
public override void RunAbility(int which)
{
GUIManager.instance.StopNumb();
((MonoBehaviour)this).Invoke("NumbAgain", 5f);
cd[0] = cdMax;
}
public void NumbAgain()
{
GUIManager.instance.StartNumb();
}
}
public class UI_Cooldown : MonoBehaviour
{
public Image fill;
public Image empty;
public Color color;
public void Start()
{
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
fill = ((Component)((Component)this).transform.GetChild(1)).gameObject.GetComponent<Image>();
empty = ((Component)((Component)this).transform.GetChild(0)).gameObject.GetComponent<Image>();
Image obj = empty;
bool enabled = (((Behaviour)fill).enabled = true);
((Behaviour)obj).enabled = enabled;
fill.fillAmount = 1f;
((Graphic)fill).color = color;
}
public void UpdateFill(float cd, float cdMax)
{
float num = cd / cdMax;
num -= 1f;
num = Mathf.Abs(num);
fill.fillAmount = num;
}
}
}
namespace CosmeticBuffs.Patchers
{
[HarmonyPatch(typeof(CharacterAfflictions))]
internal class AfflictionPatches
{
[HarmonyPatch("AddStatus")]
[HarmonyPrefix]
private static void LessHeatPatch(ref STATUSTYPE statusType, ref float amount)
{
if ((int)statusType == 8)
{
amount /= 2f;
}
}
[HarmonyPatch("AddStatus")]
[HarmonyPrefix]
private static void MoreHeatPatch(ref STATUSTYPE statusType, ref float amount)
{
if ((int)statusType == 8)
{
amount *= 1.5f;
}
}
[HarmonyPatch("AddStatus")]
[HarmonyPrefix]
private static void LessColdPatch(ref STATUSTYPE statusType, ref float amount)
{
if ((int)statusType == 2)
{
amount /= 2f;
}
}
[HarmonyPatch("AddStatus")]
[HarmonyPrefix]
private static void LessInjuryPatch(ref STATUSTYPE statusType, ref float amount)
{
if ((int)statusType == 0)
{
amount /= 1.33f;
}
}
[HarmonyPatch("AddStatus")]
[HarmonyPrefix]
private static void MuchLessInjuryPatch(ref STATUSTYPE statusType, ref float amount)
{
if ((int)statusType == 0)
{
amount /= 2f;
}
if ((int)statusType == 12)
{
amount = 0f;
}
}
[HarmonyPatch("AddStatus")]
[HarmonyPrefix]
private static bool NoInjuryPatch(ref STATUSTYPE statusType, ref float amount)
{
if ((int)statusType == 0)
{
return false;
}
return true;
}
[HarmonyPatch("SetStatus")]
[HarmonyPrefix]
private static void HeavyPatch(ref STATUSTYPE statusType, ref float amount)
{
if ((int)statusType == 7)
{
amount += 0.125f;
}
}
[HarmonyPatch("AddAffliction")]
[HarmonyPrefix]
private static bool NoNumbPatch(ref Affliction affliction)
{
if (affliction is Affliction_Numb)
{
return false;
}
return true;
}
[HarmonyPatch("AddStatus")]
[HarmonyPrefix]
private static bool NumbStatsPatch(ref STATUSTYPE statusType, ref float amount)
{
if ((int)statusType == 0)
{
amount /= 1.5f;
return true;
}
if ((int)statusType == 2)
{
return false;
}
if ((int)statusType == 8)
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(InventoryItemUI))]
internal class UIPatches
{
private static string GetRevealedName(Action_RandomMushroomEffect effect)
{
return MushroomManager.instance.mushroomEffects[effect.mushroomTypeIndex] switch
{
0 => "HYPER SHROOM",
1 => "HASTY SHROOM",
2 => "SLOW-FALL SHROOM",
3 => "GUARDING SHROOM",
4 => "REJUVENATING SHROOM",
5 => "BEANS",
6 => "BLINDNESS SHROOM",
7 => "NAPPING SHROOM",
8 => "OVERGROWN SHROOM",
9 => "NUMBNESS SHROOM",
_ => "SOMETHING WENT HORRIBLY WRONG",
};
}
[HarmonyPatch("UpdateNameText")]
[HarmonyPostfix]
private static void UpdateNamePatch(ref TextMeshProUGUI ___nameText, ref Item ____itemPrefab)
{
Action_RandomMushroomEffect effect = default(Action_RandomMushroomEffect);
if ((Object)(object)____itemPrefab != (Object)null && ((Component)____itemPrefab).gameObject.TryGetComponent<Action_RandomMushroomEffect>(ref effect))
{
((TMP_Text)___nameText).text = GetRevealedName(effect);
}
}
}
[HarmonyPatch(typeof(Item))]
internal class ItemPatches
{
[HarmonyPatch("Interact")]
[HarmonyPostfix]
private static void LauncherPatch(ref ItemComponent[] ___itemComponents)
{
//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)
//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)
ItemComponent[] array = ___itemComponents;
foreach (ItemComponent val in array)
{
if (val is RopeShooter)
{
RopeShooter val2 = (RopeShooter)val;
val2.maxLength += 15f;
}
else if (val is VineShooter)
{
VineShooter val3 = (VineShooter)val;
val3.maxLength += 10f;
}
}
}
}
[HarmonyPatch]
internal class BotPatches
{
[HarmonyPatch(typeof(Mob), "TargetValid")]
[HarmonyPostfix]
private static void MobTargetPatch(ref bool __result, ref Character target)
{
if ((Object)(object)target == (Object)(object)Character.localCharacter)
{
__result = false;
}
else
{
__result = true;
}
}
[HarmonyPatch(typeof(MushroomZombie), "SetCurrentTarget")]
[HarmonyPrefix]
private static bool ZombieTargetPatch(ref Character setCurrentTarget)
{
if ((Object)(object)setCurrentTarget == (Object)(object)Character.localCharacter)
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(CharacterInteractible))]
internal class InteractPatches
{
[HarmonyPatch("CanBeCarried")]
[HarmonyPostfix]
private static void CanCarryPatch(ref bool __result, ref Character ___character)
{
if (((Object)Plugin.GetHat()).name == "GnomeHat" && (Object)(object)Character.localCharacter != (Object)(object)___character)
{
__result = true;
}
else
{
__result = __result;
}
}
}
[HarmonyPatch(typeof(CharacterData))]
internal class DataPatches
{
[HarmonyPatch("SetPetrify")]
[HarmonyPrefix]
private static bool NoPetrifyPatch(ref Character ___character, ref int amount)
{
___character.refs.afflictions.AddStatus((STATUSTYPE)0, (float)(amount / 2), false, true, true, false, false);
return false;
}
}
}