using System;
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 HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
using UnityEngine.Localization;
using Zorro.Core;
using Zorro.Settings;
[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("PeakPyrophobia")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.2")]
[assembly: AssemblyInformationalVersion("1.0.2+ecd4bdb5bbfc25586e252c97dde7645c00a169f3")]
[assembly: AssemblyProduct("PeakPyrophobia")]
[assembly: AssemblyTitle("PeakPyrophobia")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.0")]
[module: UnverifiableCode]
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 PeakPyrophobia
{
internal class Patches
{
public class StoredProperty
{
public string name;
public object value;
}
[HarmonyPatch(typeof(GameHandler), "Awake")]
internal static class GameHandlerAwakePatch
{
public static void Postfix(GameHandler __instance)
{
if (SettingsHandler.Instance == null)
{
return;
}
PyrophobiaSetting setting = __instance.SettingsHandler.GetSetting<PyrophobiaSetting>();
if (setting == null)
{
int num = 14;
List<string> list = new List<string>();
for (int i = 0; i < num; i++)
{
list.Add("Pyrophobia Mode");
}
if (!LocalizedText.mainTable.TryGetValue("PYROPHOBIAMODE", out var _))
{
LocalizedText.mainTable.Add("PYROPHOBIAMODE", list);
}
SettingsHandler.Instance.AddSetting((Setting)(object)new PyrophobiaSetting());
}
}
}
[HarmonyPatch(typeof(Campfire), "Awake")]
internal static class CampfireAwakePatch
{
public static void Postfix(Campfire __instance)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Invalid comparison between Unknown and I4
//IL_0061: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
PyrophobiaSetting setting = SettingsHandler.Instance.GetSetting<PyrophobiaSetting>();
if ((int)((EnumSetting<OffOnMode>)(object)setting).Value == 0)
{
return;
}
Renderer componentInChildren = ((Component)__instance.fireParticles).GetComponentInChildren<Renderer>();
if (!((Object)(object)componentInChildren == (Object)null))
{
if (Plugin.CurrentTheme == Plugin.Theme.BLUE)
{
SetMatColor("_Color", new Color(0f, 1f, 20f, 1f), componentInChildren.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.GREEN)
{
SetMatColor("_Color", new Color(0f, 10f, 0f, 1f), componentInChildren.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.PURPLE)
{
SetMatColor("_Color", new Color(0.5f, 1f, 20f, 1f), componentInChildren.material);
}
SetMatColor("_AlphaRemap", new Color(0f, 1f, 0f, 0f), componentInChildren.material);
SetMatVector("_DepthFadeSmoothstep", Vector4.zero, componentInChildren.material);
SetMatFloat("_Glow", 10f, componentInChildren.material);
SetMatFloat("_BackgroundGlow", 0f, componentInChildren.material);
SetMatFloat("_Opacity", 1f, componentInChildren.material);
SetMatFloat("_Roundness", 10f, componentInChildren.material);
SetMatFloat("_RoundnessExp", 10f, componentInChildren.material);
}
}
}
[HarmonyPatch(typeof(EruptionSpawner), "Start")]
internal static class EruptionSpawnerStartPatch
{
public static void Postfix(EruptionSpawner __instance)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Invalid comparison between Unknown and I4
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_0283: 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_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
PyrophobiaSetting setting = SettingsHandler.Instance.GetSetting<PyrophobiaSetting>();
if ((int)((EnumSetting<OffOnMode>)(object)setting).Value == 0)
{
return;
}
Transform val = __instance.eruption.transform.Find("VFX");
if ((Object)(object)val != (Object)null)
{
Renderer componentInChildren = ((Component)val).GetComponentInChildren<Renderer>();
if ((Object)(object)componentInChildren != (Object)null)
{
if (Plugin.CurrentTheme == Plugin.Theme.BLUE)
{
SetMatColor("_BaseColor", new Color(0f, 0.1011f, 1f, 0.2784f), componentInChildren.material);
SetMatColor("_Color1", new Color(0f, 4.5399f, 47.9373f, 1f), componentInChildren.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.GREEN)
{
SetMatColor("_BaseColor", new Color(0f, 1f, 0f, 0.2784f), componentInChildren.material);
SetMatColor("_Color1", new Color(0f, 47.9373f, 0f, 1f), componentInChildren.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.PURPLE)
{
SetMatColor("_BaseColor", new Color(1f, 0f, 1f, 0.2784f), componentInChildren.material);
SetMatColor("_Color1", new Color(47.9373f, 0f, 47.9373f, 1f), componentInChildren.material);
}
}
}
Transform val2 = __instance.eruption.transform.Find("Particle System");
if ((Object)(object)val2 == (Object)null)
{
return;
}
Renderer componentInChildren2 = ((Component)val2).GetComponentInChildren<Renderer>();
if (!((Object)(object)componentInChildren2 == (Object)null))
{
SetMatColor("_A_Remap", new Color(0f, 0f, 0f, 0f), componentInChildren2.material);
SetMatColor("_C_Remap", new Color(0f, 0f, 0f, 0f), componentInChildren2.material);
SetMatColor("_C_Remap2", new Color(0f, 0f, 0f, 0f), componentInChildren2.material);
if (Plugin.CurrentTheme == Plugin.Theme.BLUE)
{
SetMatColor("_Color2", new Color(0.2275f, 0.6825f, 2.2751f, 0.05f), componentInChildren2.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.GREEN)
{
SetMatColor("_Color2", new Color(0.2275f, 2.2751f, 0.6825f, 0.05f), componentInChildren2.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.PURPLE)
{
SetMatColor("_Color2", new Color(2.2751f, 0.2275f, 2.2751f, 0.05f), componentInChildren2.material);
}
}
}
}
[HarmonyPatch(typeof(GUIManager), "Start")]
internal static class GUIManagerStartPatch
{
public static void Postfix(GUIManager __instance)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Invalid comparison between Unknown and I4
//IL_0064: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
PyrophobiaSetting setting = SettingsHandler.Instance.GetSetting<PyrophobiaSetting>();
if ((int)((EnumSetting<OffOnMode>)(object)setting).Value != 0)
{
SetMatFloat("_ScrollSpeed", 0f, __instance.hotSVFX.renderer.material);
if (Plugin.CurrentTheme == Plugin.Theme.BLUE)
{
SetMatColor("_Color", new Color(0f, 0.475f, 4f, 1f), __instance.hotSVFX.renderer.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.GREEN)
{
SetMatColor("_Color", new Color(0f, 4f, 0f, 1f), __instance.hotSVFX.renderer.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.PURPLE)
{
SetMatColor("_Color", new Color(4f, 0f, 4f, 1f), __instance.hotSVFX.renderer.material);
}
}
}
}
[HarmonyPatch(typeof(Lantern), "Start")]
internal static class LanternStartPatch
{
public static void Postfix(Lantern __instance)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Invalid comparison between Unknown and I4
//IL_0061: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
PyrophobiaSetting setting = SettingsHandler.Instance.GetSetting<PyrophobiaSetting>();
if ((int)((EnumSetting<OffOnMode>)(object)setting).Value == 0)
{
return;
}
Renderer componentInChildren = ((Component)__instance.fireParticle).GetComponentInChildren<Renderer>();
if (!((Object)(object)componentInChildren == (Object)null))
{
if (Plugin.CurrentTheme == Plugin.Theme.BLUE)
{
SetMatColor("_Color", new Color(0f, 1f, 20f, 1f), componentInChildren.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.GREEN)
{
SetMatColor("_Color", new Color(0f, 10f, 0f, 1f), componentInChildren.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.PURPLE)
{
SetMatColor("_Color", new Color(10f, 0f, 10f, 1f), componentInChildren.material);
}
SetMatColor("_AlphaRemap", new Color(0f, 1f, 0f, 0f), componentInChildren.material);
SetMatVector("_DepthFadeSmoothstep", Vector4.zero, componentInChildren.material);
SetMatFloat("_Glow", 10f, componentInChildren.material);
SetMatFloat("_BackgroundGlow", 0f, componentInChildren.material);
SetMatFloat("_Opacity", 1f, componentInChildren.material);
SetMatFloat("_Roundness", 10f, componentInChildren.material);
SetMatFloat("_RoundnessExp", 10f, componentInChildren.material);
}
}
}
[HarmonyPatch(typeof(CharacterAfflictions), "Awake")]
internal static class CharacterAfflictionsAwakePatch
{
public static void Postfix(CharacterAfflictions __instance)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Invalid comparison between Unknown and I4
if (__instance.character.IsLocal)
{
PyrophobiaSetting setting = SettingsHandler.Instance.GetSetting<PyrophobiaSetting>();
if (setting == null || (int)((EnumSetting<OffOnMode>)(object)setting).Value == 0)
{
__instance.injuryFire.settings.pitch = 1f;
}
else
{
__instance.injuryFire.settings.pitch = 5f;
}
}
}
}
[HarmonyPatch(typeof(PlayerTrackParticles), "Start")]
internal static class PlayerTrackParticlesStartPatch
{
public static void Postfix(PlayerTrackParticles __instance)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Invalid comparison between Unknown and I4
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
if (((Object)__instance).name != "Lava ash")
{
return;
}
PyrophobiaSetting setting = SettingsHandler.Instance.GetSetting<PyrophobiaSetting>();
if ((int)((EnumSetting<OffOnMode>)(object)setting).Value == 0)
{
return;
}
Renderer componentInChildren = ((Component)__instance).GetComponentInChildren<Renderer>();
if (!((Object)(object)componentInChildren == (Object)null))
{
if (Plugin.CurrentTheme == Plugin.Theme.BLUE)
{
SetMatColor("_Color", new Color(0.01f, 0.01f, 5f, 1f), componentInChildren.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.GREEN)
{
SetMatColor("_Color", new Color(0f, 1f, 0f, 1f), componentInChildren.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.PURPLE)
{
SetMatColor("_Color", new Color(1f, 0f, 1f, 1f), componentInChildren.material);
}
}
}
}
[HarmonyPatch(typeof(Lava), "Start")]
internal static class LavaStartPatch
{
public static void Postfix(Lava __instance)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Invalid comparison between Unknown and I4
//IL_0060: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0234: Unknown result type (might be due to invalid IL or missing references)
//IL_025e: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
PyrophobiaSetting setting = SettingsHandler.Instance.GetSetting<PyrophobiaSetting>();
if ((int)((EnumSetting<OffOnMode>)(object)setting).Value == 0)
{
return;
}
Renderer componentInChildren = ((Component)__instance).GetComponentInChildren<Renderer>();
if (!((Object)(object)componentInChildren == (Object)null))
{
if (Plugin.CurrentTheme == Plugin.Theme.BLUE)
{
SetMatColor("_EdgeColor", new Color(0f, 3.5503f, 22f, 0f), componentInChildren.material);
SetMatColor("_BaseColor", new Color(0.0214f, 0.3326f, 4.083f, 0.9882f), componentInChildren.material);
SetMatColor("_Color1", new Color(0f, 0f, 1f, 0f), componentInChildren.material);
SetMatColor("_Color21", new Color(0.0107f, 0.0107f, 0.1509f, 0.2549f), componentInChildren.material);
SetMatColor("_Color3", new Color(0f, 0f, 0.434f, 0.4627f), componentInChildren.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.GREEN)
{
SetMatColor("_EdgeColor", new Color(0f, 22f, 0f, 0f), componentInChildren.material);
SetMatColor("_BaseColor", new Color(0f, 4.083f, 0.0214f, 0.9882f), componentInChildren.material);
SetMatColor("_Color1", new Color(0f, 1f, 0f, 0f), componentInChildren.material);
SetMatColor("_Color21", new Color(0.0107f, 0.1509f, 0.0107f, 0.2549f), componentInChildren.material);
SetMatColor("_Color3", new Color(0f, 0.434f, 0.0041f, 0.4627f), componentInChildren.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.PURPLE)
{
SetMatColor("_EdgeColor", new Color(22f, 0f, 22f, 0f), componentInChildren.material);
SetMatColor("_BaseColor", new Color(4.083f, 0f, 4.083f, 0.9882f), componentInChildren.material);
SetMatColor("_Color1", new Color(1f, 0f, 1f, 0f), componentInChildren.material);
SetMatColor("_Color21", new Color(0.1509f, 0.0107f, 0.1509f, 0.2549f), componentInChildren.material);
SetMatColor("_Color3", new Color(0.434f, 0f, 0.434f, 0.4627f), componentInChildren.material);
}
}
}
}
[HarmonyPatch(typeof(SpecialDayZone), "Start")]
internal static class SpecialDayZoneStartPatch
{
public static void Postfix(SpecialDayZone __instance)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Invalid comparison between Unknown and I4
PyrophobiaSetting setting = SettingsHandler.Instance.GetSetting<PyrophobiaSetting>();
if ((int)((EnumSetting<OffOnMode>)(object)setting).Value != 0 && (((Object)__instance).name.Contains("Volcano") || ((Object)__instance).name.Contains("Caldera")))
{
__instance.specialMidColor.r = 0f;
__instance.specialBottomColor.r = 0f;
__instance.specialSunColor.r = 0f;
if (Plugin.CurrentTheme == Plugin.Theme.BLUE)
{
__instance.specialMidColor.b = 1f;
__instance.specialBottomColor.b = 1f;
__instance.specialSunColor.b = 1f;
}
else if (Plugin.CurrentTheme == Plugin.Theme.GREEN)
{
__instance.specialMidColor.g = 1f;
__instance.specialBottomColor.g = 1f;
__instance.specialSunColor.g = 1f;
}
else if (Plugin.CurrentTheme == Plugin.Theme.PURPLE)
{
__instance.specialMidColor.r = 1f;
__instance.specialBottomColor.r = 1f;
__instance.specialSunColor.r = 1f;
__instance.specialMidColor.b = 1f;
__instance.specialBottomColor.b = 1f;
__instance.specialSunColor.b = 1f;
}
}
}
}
[HarmonyPatch(typeof(LavaPost), "Start")]
internal static class LavaPostStartPatch
{
public static void Postfix(LavaPost __instance)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Invalid comparison between Unknown and I4
//IL_005d: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
PyrophobiaSetting setting = SettingsHandler.Instance.GetSetting<PyrophobiaSetting>();
if ((int)((EnumSetting<OffOnMode>)(object)setting).Value == 0)
{
return;
}
Renderer componentInChildren = ((Component)__instance).GetComponentInChildren<Renderer>();
if (!((Object)(object)componentInChildren == (Object)null))
{
if (Plugin.CurrentTheme == Plugin.Theme.BLUE)
{
SetMatColor("_Color", new Color(0f, 0.0749f, 1.498f, 1f), componentInChildren.material);
SetMatColor("_Color2", new Color(0f, 0f, 6f, 1f), componentInChildren.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.GREEN)
{
SetMatColor("_Color", new Color(0f, 1.498f, 0f, 1f), componentInChildren.material);
SetMatColor("_Color2", new Color(0f, 6f, 0f, 1f), componentInChildren.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.PURPLE)
{
SetMatColor("_Color", new Color(1.498f, 0f, 1.498f, 1f), componentInChildren.material);
SetMatColor("_Color2", new Color(6f, 0f, 6f, 1f), componentInChildren.material);
}
}
}
}
[HarmonyPatch(typeof(MapHandler), "InitializeMap")]
internal static class MapHandlerInitializeMapPatch
{
public static void Postfix(MapHandler __instance)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Invalid comparison between Unknown and I4
//IL_0092: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Expected O, but got Unknown
//IL_049b: Unknown result type (might be due to invalid IL or missing references)
//IL_04a2: Expected O, but got Unknown
//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
//IL_0521: Unknown result type (might be due to invalid IL or missing references)
//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
//IL_055c: Unknown result type (might be due to invalid IL or missing references)
//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
//IL_0331: Unknown result type (might be due to invalid IL or missing references)
//IL_0597: Unknown result type (might be due to invalid IL or missing references)
//IL_041d: Unknown result type (might be due to invalid IL or missing references)
PyrophobiaSetting setting = SettingsHandler.Instance.GetSetting<PyrophobiaSetting>();
if ((int)((EnumSetting<OffOnMode>)(object)setting).Value == 0)
{
return;
}
LavaRiver[] array = Object.FindObjectsByType<LavaRiver>((FindObjectsInactive)1, (FindObjectsSortMode)0);
LavaRiver[] array2 = array;
foreach (LavaRiver val in array2)
{
Transform val2 = ((Component)val).transform.Find("SplineMesh");
if ((Object)(object)val2 != (Object)null)
{
Renderer component = ((Component)val2).GetComponent<Renderer>();
if (Plugin.CurrentTheme == Plugin.Theme.BLUE)
{
SetMatColor("_Color2", new Color(0f, 0.1569f, 2.9961f, 1f), component.material);
SetMatColor("_Color3", new Color(0f, 2.1468f, 11.4472f, 1f), component.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.GREEN)
{
SetMatColor("_Color2", new Color(0f, 2.9961f, 0f, 1f), component.material);
SetMatColor("_Color3", new Color(0f, 11.4472f, 0f, 1f), component.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.PURPLE)
{
SetMatColor("_Color2", new Color(2.9961f, 0f, 2.9961f, 1f), component.material);
SetMatColor("_Color3", new Color(11.4472f, 0f, 11.4472f, 1f), component.material);
}
}
}
MapSegment val3 = ((IEnumerable<MapSegment>)Singleton<MapHandler>.Instance.segments).FirstOrDefault((Func<MapSegment, bool>)((MapSegment s) => (int)s.biome == 3 && ((Object)s.dayNightProfile).name.Contains("Volcano")));
if (val3 == null)
{
return;
}
Transform val4 = val3._segmentParent.transform.Find("Middle/Magma");
if ((Object)(object)val4 != (Object)null)
{
foreach (Transform item in ((Component)val4).transform)
{
Transform val5 = item;
if (!((Object)val5).name.Contains("MagmaRock"))
{
continue;
}
Transform val6 = val5.Find("Rock");
if ((Object)(object)val6 != (Object)null)
{
Renderer componentInChildren = ((Component)val6).GetComponentInChildren<Renderer>();
if ((Object)(object)componentInChildren == (Object)null)
{
return;
}
if (Plugin.CurrentTheme == Plugin.Theme.BLUE)
{
SetMatColor("_Color3", new Color(0f, 2.7292f, 22.6274f, 1f), componentInChildren.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.GREEN)
{
SetMatColor("_Color3", new Color(0f, 22.6274f, 0f, 1f), componentInChildren.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.PURPLE)
{
SetMatColor("_Color3", new Color(22.6274f, 0f, 22.6274f, 1f), componentInChildren.material);
}
}
Transform val7 = val5.Find("Sphere");
if ((Object)(object)val7 != (Object)null)
{
Renderer componentInChildren2 = ((Component)val7).GetComponentInChildren<Renderer>();
if ((Object)(object)componentInChildren2 == (Object)null)
{
return;
}
if (Plugin.CurrentTheme == Plugin.Theme.BLUE)
{
SetMatColor("_Color1", new Color(0f, 0.9997f, 10.5561f, 0.251f), componentInChildren2.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.GREEN)
{
SetMatColor("_Color1", new Color(0f, 10.5561f, 0f, 0.251f), componentInChildren2.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.PURPLE)
{
SetMatColor("_Color1", new Color(10.5561f, 0f, 10.5561f, 0.251f), componentInChildren2.material);
}
}
}
}
Transform val8 = val3._segmentParent.transform.Find("Middle/LavaBridges");
if (!((Object)(object)val8 != (Object)null))
{
return;
}
foreach (Transform item2 in ((Component)val8).transform)
{
Transform val9 = item2;
if (!((Object)val9).name.Contains("LavaBridgeHot"))
{
continue;
}
Transform val10 = val9.Find("Cliff");
if ((Object)(object)val10 != (Object)null)
{
Renderer componentInChildren3 = ((Component)val10).GetComponentInChildren<Renderer>();
if ((Object)(object)componentInChildren3 == (Object)null)
{
break;
}
if (Plugin.CurrentTheme == Plugin.Theme.BLUE)
{
SetMatColor("_Color3", new Color(0f, 2.7292f, 22.6274f, 1f), componentInChildren3.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.GREEN)
{
SetMatColor("_Color3", new Color(0f, 22.6274f, 0f, 1f), componentInChildren3.material);
}
else if (Plugin.CurrentTheme == Plugin.Theme.PURPLE)
{
SetMatColor("_Color3", new Color(22.6274f, 0f, 22.6274f, 1f), componentInChildren3.material);
}
}
}
}
}
public static Dictionary<Material, List<StoredProperty>> storedMaterials = new Dictionary<Material, List<StoredProperty>>();
public static void SetMatFloat(string name, float value, Material mat)
{
if (!storedMaterials.ContainsKey(mat))
{
List<StoredProperty> value2 = new List<StoredProperty>
{
new StoredProperty
{
name = name,
value = mat.GetFloat(name)
}
};
storedMaterials.Add(mat, value2);
}
else
{
List<StoredProperty> list = storedMaterials[mat];
StoredProperty storedProperty = list.Find((StoredProperty x) => x.name == name);
if (storedProperty == null)
{
list.Add(new StoredProperty
{
name = name,
value = mat.GetFloat(name)
});
}
}
mat.SetFloat(name, value);
}
public static void SetMatColor(string name, Color value, Material mat)
{
//IL_0040: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
if (!storedMaterials.ContainsKey(mat))
{
List<StoredProperty> value2 = new List<StoredProperty>
{
new StoredProperty
{
name = name,
value = mat.GetColor(name)
}
};
storedMaterials.Add(mat, value2);
}
else
{
List<StoredProperty> list = storedMaterials[mat];
StoredProperty storedProperty = list.Find((StoredProperty x) => x.name == name);
if (storedProperty == null)
{
list.Add(new StoredProperty
{
name = name,
value = mat.GetColor(name)
});
}
}
mat.SetColor(name, value);
}
public static void SetMatVector(string name, Vector4 value, Material mat)
{
//IL_0040: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
if (!storedMaterials.ContainsKey(mat))
{
List<StoredProperty> value2 = new List<StoredProperty>
{
new StoredProperty
{
name = name,
value = mat.GetVector(name)
}
};
storedMaterials.Add(mat, value2);
}
else
{
List<StoredProperty> list = storedMaterials[mat];
StoredProperty storedProperty = list.Find((StoredProperty x) => x.name == name);
if (storedProperty == null)
{
list.Add(new StoredProperty
{
name = name,
value = mat.GetVector(name)
});
}
}
mat.SetVector(name, value);
}
}
[BepInPlugin("com.snosz.peakpyrophobia", "PeakPyrophobia", "1.0.2")]
public class Plugin : BaseUnityPlugin
{
public enum Theme
{
BLUE,
GREEN,
PURPLE
}
public static Plugin Instance;
private static Harmony _harmony;
public ConfigEntry<string> _themeConfig;
public static Theme CurrentTheme;
private void Awake()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Expected O, but got Unknown
Instance = this;
_harmony = new Harmony("com.snosz.peakpyrophobia");
_themeConfig = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Theme", "Blue", new ConfigDescription("Theme to use for pyro related materials when Pyrophobia mode is enabled", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[3] { "Blue", "Green", "Purple" }), Array.Empty<object>()));
switch (_themeConfig.Value)
{
case "Blue":
CurrentTheme = Theme.BLUE;
break;
case "Green":
CurrentTheme = Theme.GREEN;
break;
case "Purple":
CurrentTheme = Theme.PURPLE;
break;
}
_themeConfig.SettingChanged += delegate
{
switch (_themeConfig.Value)
{
case "Blue":
CurrentTheme = Theme.BLUE;
break;
case "Green":
CurrentTheme = Theme.GREEN;
break;
case "Purple":
CurrentTheme = Theme.PURPLE;
break;
}
};
_harmony.PatchAll();
}
public static void RestoreDefaults()
{
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
foreach (KeyValuePair<Material, List<Patches.StoredProperty>> storedMaterial in Patches.storedMaterials)
{
if ((Object)(object)storedMaterial.Key == (Object)null)
{
continue;
}
List<Patches.StoredProperty> value = storedMaterial.Value;
foreach (Patches.StoredProperty item in value)
{
if (item.value.GetType() == typeof(Color))
{
storedMaterial.Key.SetColor(item.name, (Color)item.value);
}
else if (item.value.GetType() == typeof(Vector4))
{
storedMaterial.Key.SetVector(item.name, (Vector4)item.value);
}
else if (item.value.GetType() == typeof(float))
{
storedMaterial.Key.SetFloat(item.name, (float)item.value);
}
}
}
Patches.storedMaterials.Clear();
}
}
public class PyrophobiaSetting : CustomLocalizedOffOnSetting, IExposedSetting, IConditionalSetting
{
public override void ApplyValue()
{
Plugin.RestoreDefaults();
}
protected override OffOnMode GetDefaultValue()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (OffOnMode)0;
}
public override List<LocalizedString> GetLocalizedChoices()
{
return null;
}
public string GetDisplayName()
{
return "PYROPHOBIAMODE";
}
public string GetCategory()
{
return "Accessibility";
}
public bool ShouldShow()
{
return !PhotonNetwork.InRoom;
}
}
}