using System;
using System.Diagnostics;
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 Photon.Pun;
using TMPro;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.github.Marttico.FogSpeed")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.2.1.0")]
[assembly: AssemblyInformationalVersion("0.2.1+ff9f07ffd6763f709b1d1a248c6b493d6432beca")]
[assembly: AssemblyProduct("com.github.Marttico.FogSpeed")]
[assembly: AssemblyTitle("FogSpeed")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.2.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
[BepInPlugin("marttico.fogspeed", "FogSpeed", "0.2.1")]
public class FogSpeedPlugin : BaseUnityPlugin
{
[HarmonyPatch(typeof(VersionString), "Update")]
private static class VersionStringPatch
{
private static void Postfix(VersionString __instance)
{
if (PhotonNetwork.InRoom && (Object)(object)orbfoghandler != (Object)null)
{
float speed = orbfoghandler.speed;
string text = ((speed != 0f) ? $"\nFog speed: {speed:F2}" : "\nFog speed paused");
TextMeshProUGUI text2 = __instance.m_text;
((TMP_Text)text2).text = ((TMP_Text)text2).text + text;
}
}
}
internal static ManualLogSource Log;
private ConfigEntry<float> defaultFogSpeed;
private static ConfigEntry<bool> hotkeysEnabled;
private ConfigEntry<KeyCode> increaseFogSpdKey;
private ConfigEntry<KeyCode> pauseFogKey;
private ConfigEntry<KeyCode> decreaseFogSpdKey;
private ConfigEntry<KeyCode> negateFogSpdKey;
private ConfigEntry<KeyCode> advanceFogKey;
private ConfigEntry<KeyCode> resetFogSpdKey;
private float fogSpeed = 0.3f;
private bool isPaused;
private PhotonView photonView;
private FogSpeedSyncHandler syncHandler;
private float retrycounter;
public static OrbFogHandler? orbfoghandler;
private void registerPhotonView()
{
photonView = ((Component)orbfoghandler).GetComponent<PhotonView>();
if ((Object)(object)photonView == (Object)null)
{
Log.LogError((object)"PhotonView is null on OrbFogHandler!");
return;
}
syncHandler = ((Component)orbfoghandler).gameObject.AddComponent<FogSpeedSyncHandler>();
syncHandler.fogHandler = orbfoghandler;
PhotonNetwork.AddCallbackTarget((object)this);
}
private void Awake()
{
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
defaultFogSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("General", "DefaultFogSpeed", 0.3f, "Default speed multiplier for the fog effect.");
advanceFogKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "AdvanceFogKey", (KeyCode)105, "Default key to advance fog.");
decreaseFogSpdKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "DecreaseFogSpeedKey", (KeyCode)106, "Default key to decrease fog speed multiplier.");
pauseFogKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "PauseFogKey", (KeyCode)107, "Default key to pause or resume fog progression.");
increaseFogSpdKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "IncreaseFogSpeedKey", (KeyCode)108, "Default key to increase fog speed multiplier.");
negateFogSpdKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "NegateFogSpeedKey", (KeyCode)111, "Default key to negate fog speed.");
resetFogSpdKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "ResetFogSpeedKey", (KeyCode)117, "Reset fog speed.");
hotkeysEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableHotkeys", true, "Check this if you want to enable hotkeys");
fogSpeed = defaultFogSpeed.Value;
Harmony val = new Harmony("marttico.fogspeed");
val.PatchAll();
Log.LogInfo((object)"FogSpeedPlugin Loaded.");
}
private void sendFogSpeed()
{
fogSpeed = Mathf.Max(-50f, fogSpeed);
fogSpeed = Mathf.Min(50f, fogSpeed);
if (isPaused)
{
photonView.RPC("RPCA_SyncFogSpeed", (RpcTarget)0, new object[1] { 0f });
}
else
{
photonView.RPC("RPCA_SyncFogSpeed", (RpcTarget)0, new object[1] { fogSpeed });
}
}
private void Update()
{
//IL_0010: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
if (PhotonNetwork.IsMasterClient)
{
if (Input.GetKeyDown(decreaseFogSpdKey.Value) && hotkeysEnabled.Value)
{
fogSpeed /= 1.5f;
Log.LogInfo((object)$"Fog speed decreased to {fogSpeed}");
sendFogSpeed();
}
if (Input.GetKeyDown(pauseFogKey.Value) && hotkeysEnabled.Value)
{
isPaused = !isPaused;
Log.LogInfo((object)"Fog paused or resumed");
sendFogSpeed();
}
if (Input.GetKeyDown(increaseFogSpdKey.Value) && hotkeysEnabled.Value)
{
fogSpeed *= 1.5f;
Log.LogInfo((object)$"Fog speed increased to {fogSpeed}");
sendFogSpeed();
}
if (Input.GetKeyDown(negateFogSpdKey.Value) && hotkeysEnabled.Value)
{
fogSpeed *= -1f;
Log.LogInfo((object)$"Fog speed inverted to {fogSpeed}");
sendFogSpeed();
}
if (Input.GetKeyDown(resetFogSpdKey.Value) && hotkeysEnabled.Value)
{
fogSpeed = 0.3f;
Log.LogInfo((object)$"Fog speed reset to {fogSpeed}");
sendFogSpeed();
}
if (Input.GetKeyDown(advanceFogKey.Value) && !orbfoghandler.isMoving && PhotonNetwork.IsMasterClient && hotkeysEnabled.Value)
{
photonView.RPC("StartMovingRPC", (RpcTarget)0, Array.Empty<object>());
Log.LogInfo((object)"Fog has been advanced");
sendFogSpeed();
}
}
retrycounter += Time.deltaTime;
if ((Object)(object)orbfoghandler == (Object)null && retrycounter > 5f)
{
retrycounter = 0f;
orbfoghandler = Object.FindAnyObjectByType<OrbFogHandler>();
if ((Object)(object)orbfoghandler != (Object)null)
{
registerPhotonView();
}
else
{
Log.LogInfo((object)"OrbFogHandler not found, retrying in 5 seconds!");
}
}
}
}
public class FogSpeedSyncHandler : MonoBehaviourPun
{
public OrbFogHandler fogHandler;
[PunRPC]
public void RPCA_SyncFogSpeed(float spd)
{
if ((Object)(object)fogHandler != (Object)null)
{
FogSpeedPlugin.Log.LogInfo((object)$"[RPC] Synced fog speed: {spd}");
fogHandler.speed = spd;
}
else
{
FogSpeedPlugin.Log.LogWarning((object)"FogHandler was null during RPC.");
}
}
}
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 System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}