using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;
using Zorro.Core;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("my.pahsiv.MyCampfireDontLeaveMe")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.2.0")]
[assembly: AssemblyInformationalVersion("0.1.2")]
[assembly: AssemblyProduct("my.pahsiv.MyCampfireDontLeaveMe")]
[assembly: AssemblyTitle("MyCampfireDontLeaveMe")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace MyCampfireDontLeaveMe
{
public static class ColorHelper
{
public const string White = "FFFFFF";
public const string Black = "000000";
public const string Red = "FF0000";
public const string Green = "00FF00";
public const string Blue = "0000FF";
public const string Yellow = "FFFF00";
public const string Purple = "8765CA";
public const string Gray = "808080";
public const string Orange = "FFA500";
public const string Cyan = "00FFFF";
public const string Magenta = "FF00FF";
public const string Pink = "FFC0CB";
public const string Brown = "A52A2A";
public const string Lime = "00FF00";
public const string Teal = "008080";
public const string Navy = "000080";
public const string Maroon = "800000";
public const string Olive = "808000";
public const string Aqua = "00FFFF";
public const string Silver = "C0C0C0";
public const string Gold = "FFD700";
public const string LightRed = "FF6B6B";
public const string LightGreen = "90EE90";
public const string LightBlue = "ADD8E6";
public const string LightGray = "D3D3D3";
public const string LightPink = "FFB6C1";
public const string DarkRed = "8B0000";
public const string DarkGreen = "006400";
public const string DarkBlue = "00008B";
public const string DarkGray = "A9A9A9";
public const string DarkOrange = "FF8C00";
public const string Pahsiv = "3582E7";
}
internal class Patch
{
[HarmonyPatch(typeof(OrbFogHandler), "WaitForFogCatchUp")]
public class OrbFogHandlerPatch
{
private static string logFilePath;
static OrbFogHandlerPatch()
{
logFilePath = Path.Combine(Paths.BepInExRootPath, "WaitForFogCatchUp_Log.txt");
}
[HarmonyPrefix]
public static bool WaitForFogCatchUpPrefix(OrbFogHandler __instance, out IEnumerator __result)
{
__result = WaitForFogCatchUpWithTimeout(__instance);
return false;
}
private static IEnumerator WaitForFogCatchUpWithTimeout(OrbFogHandler instance)
{
if ((Object)(object)instance == (Object)null)
{
yield break;
}
instance.isMoving = true;
float elapsedTime = 0f;
float timeoutDuration = 20f;
float previousSize = instance.currentSize;
float stuckCheckTime = 0f;
while (instance.currentSize > 30f && instance.isMoving && !instance.hasArrived && elapsedTime < timeoutDuration)
{
instance.currentSize = Mathf.Lerp(instance.currentSize, 29.5f, Time.deltaTime);
instance.currentSize = Mathf.MoveTowards(instance.currentSize, 29.5f, Time.deltaTime);
elapsedTime += Time.deltaTime;
stuckCheckTime += Time.deltaTime;
if (stuckCheckTime >= 1f)
{
float num = Mathf.Abs(previousSize - instance.currentSize);
if (num < 0.1f)
{
instance.currentSize = 29.5f;
instance.hasArrived = true;
yield break;
}
previousSize = instance.currentSize;
stuckCheckTime = 0f;
}
yield return null;
}
if (elapsedTime >= timeoutDuration)
{
instance.currentSize = 29.5f;
instance.hasArrived = true;
}
else if (!(instance.currentSize <= 30f) && instance.isMoving)
{
_ = instance.hasArrived;
}
}
}
}
[BepInPlugin("my.pahsiv.MyCampfireDontLeaveMe", "MyCampfireDontLeaveMe", "0.1.2")]
public class Plugin : BaseUnityPlugin
{
public static ConfigEntry<KeyCode> ForceLoad;
private bool inLevel;
private float holdDuration;
private bool isHolding;
private const float REQUIRED_HOLD_TIME = 3f;
public const string Id = "my.pahsiv.MyCampfireDontLeaveMe";
internal static ManualLogSource Log { get; private set; }
public static Plugin Instance { get; private set; }
public static string Name => "MyCampfireDontLeaveMe";
public static string Version => "0.1.2";
private void Update()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: 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_0050: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Invalid comparison between Unknown and I4
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Invalid comparison between Unknown and I4
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Invalid comparison between Unknown and I4
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Invalid comparison between Unknown and I4
//IL_00a4: 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)
if (!inLevel)
{
return;
}
if (Input.GetKeyDown(ForceLoad.Value))
{
if ((Object)(object)Singleton<MapHandler>.Instance == (Object)null)
{
return;
}
Segment currentSegment = Singleton<MapHandler>.Instance.GetCurrentSegment();
BiomeType biome = Singleton<MapHandler>.Instance.segments[Singleton<MapHandler>.Instance.currentSegment].biome;
Utilities.Notification("Current Segment is " + Utilities.AddColor(GetSegmentName(currentSegment), "00FFFF") + "!", "FFFF00");
if ((int)currentSegment == 3 && (int)biome != 8)
{
RespawnChest val = FindFurthestRespawnStatue();
if ((Object)(object)val != (Object)null && ((Component)Camera.main).transform.position.z < ((Component)val).transform.position.z + 240f)
{
Utilities.Notification("Approach the campfire before force loading " + Utilities.AddColor(GetSegmentName((Segment)4), "FFC0CB") + "!", "FFFF00");
return;
}
isHolding = true;
holdDuration = 0f;
Utilities.Notification("Hold for 3 seconds to force load " + Utilities.AddColor(GetSegmentName((Segment)4), "FFC0CB") + ".", "FFFF00");
}
else if ((int)currentSegment == 3 && (int)biome == 8)
{
isHolding = true;
holdDuration = 0f;
Utilities.Notification("Hold for 3 seconds to force load " + Utilities.AddColor(GetSegmentName((Segment)4), "FFC0CB") + ".", "FFFF00");
}
}
if (Input.GetKey(ForceLoad.Value) && isHolding)
{
holdDuration += Time.deltaTime;
if (holdDuration >= 3f)
{
ExecuteForceLoad();
isHolding = false;
}
}
if (Input.GetKeyUp(ForceLoad.Value))
{
isHolding = false;
}
}
private void Awake()
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
Instance = this;
ForceLoad = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "Force Load hotkey", (KeyCode)292, "Press to force load The Kiln / Citadel!");
SceneManager.sceneLoaded += OnSceneLoaded;
Harmony val = new Harmony("my.pahsiv.MyCampfireDontLeaveMe");
val.PatchAll();
Log.LogMessage((object)(" Plugin " + Name + " " + Version + " is loaded!"));
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (((Scene)(ref scene)).name == "Airport")
{
inLevel = false;
}
else if (((Scene)(ref scene)).name.Contains("Level_"))
{
inLevel = true;
}
else if (((Scene)(ref scene)).name.Contains("Title"))
{
inLevel = false;
}
}
private void ExecuteForceLoad()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
if ((int)Singleton<MapHandler>.Instance.GetCurrentSegment() == 3)
{
Utilities.Notification("Forcing " + Utilities.AddColor(GetSegmentName((Segment)4), "FFC0CB") + " to load!", "FFFF00", sound: true);
Shader.SetGlobalFloat("FakeMountainEnabled", 0f);
if (Object.op_Implicit((Object)(object)Singleton<MapHandler>.Instance))
{
Singleton<MapHandler>.Instance.GoToSegment((Segment)4);
}
}
}
public RespawnChest? FindFurthestRespawnStatue()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
RespawnChest val = null;
List<RespawnChest> list = Object.FindObjectsByType<RespawnChest>((FindObjectsSortMode)0).ToList();
foreach (RespawnChest item in list)
{
if ((Object)(object)val == (Object)null)
{
val = item;
}
else if (((Component)item).transform.position.z >= ((Component)val).transform.position.z)
{
val = item;
}
}
return val;
}
public unsafe string GetSegmentName(Segment currnetSegment)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Invalid comparison between Unknown and I4
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Invalid comparison between Unknown and I4
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Invalid comparison between Unknown and I4
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Invalid comparison between Unknown and I4
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Invalid comparison between Unknown and I4
if ((Object)(object)Singleton<MapHandler>.Instance == (Object)null)
{
return "ERROR";
}
BiomeType biome = Singleton<MapHandler>.Instance.segments[Singleton<MapHandler>.Instance.currentSegment].biome;
if ((int)currnetSegment == 3)
{
if ((int)biome == 8)
{
return "Gloom";
}
return ((object)(*(Segment*)(&currnetSegment))/*cast due to .constrained prefix*/).ToString();
}
if ((int)currnetSegment == 4)
{
if ((int)biome == 8)
{
return "The Citadel";
}
return ((object)(*(Segment*)(&currnetSegment))/*cast due to .constrained prefix*/).ToString();
}
if ((int)currnetSegment == 6)
{
return "Nadir";
}
return ((object)(*(BiomeType*)(&biome))/*cast due to .constrained prefix*/).ToString();
}
}
public static class Utilities
{
public static void VerifyPatch(Harmony harmony)
{
IEnumerable<MethodBase> patchedMethods = harmony.GetPatchedMethods();
Plugin.Log.LogMessage((object)$" Total patched methods: {patchedMethods.Count()}");
foreach (MethodBase item in patchedMethods)
{
Plugin.Log.LogMessage((object)(" Patched: " + item.DeclaringType?.Name + "." + item.Name));
}
}
public static void Notification(string message, string color = "FFFFFF", bool sound = false)
{
//IL_0086: 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)
PlayerConnectionLog val = Object.FindFirstObjectByType<PlayerConnectionLog>();
if ((Object)(object)val == (Object)null)
{
return;
}
string text = "<color=#" + color + ">" + message + "</color>";
MethodInfo method = typeof(PlayerConnectionLog).GetMethod("AddMessage", BindingFlags.Instance | BindingFlags.NonPublic);
if (method != null)
{
method.Invoke(val, new object[1] { text });
if ((Object)(object)val.sfxJoin != (Object)null && sound)
{
val.sfxJoin.Play(default(Vector3));
}
}
else
{
Plugin.Log.LogWarning((object)"AddMessage method not found.");
}
}
public static string AddColor(string text, string color)
{
return "<color=#" + color + ">" + text + "</color>";
}
public unsafe static string ConvertKeyCodeToInputPath(KeyCode keyCode)
{
string text = ((object)(*(KeyCode*)(&keyCode))/*cast due to .constrained prefix*/).ToString();
if (text.StartsWith("Keypad"))
{
text = text.Replace("Keypad", "numpad");
}
return "<Keyboard>/" + text.ToLower();
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}