using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
using Zorro.Core.CLI;
[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("UIOpener")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("UIOpener")]
[assembly: AssemblyTitle("UIOpener")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
}
}
}
public class CharacterAfflictionsRPC : MonoBehaviourPunCallbacks
{
private CharacterAfflictions CA => ((Component)this).GetComponent<CharacterAfflictions>();
[PunRPC]
public void RPC_ClearStatus(int statusType)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
STATUSTYPE val = (STATUSTYPE)statusType;
CA.SetStatus(val, 0f);
}
[PunRPC]
public void RPC_AddStatus(int statusType, float amount)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
STATUSTYPE val = (STATUSTYPE)statusType;
CA.AddStatus(val, amount, false);
}
[PunRPC]
public void RPC_ClearCold()
{
CA.SetStatus((STATUSTYPE)2, 0f);
}
[PunRPC]
public void RPC_AddCold(float amt)
{
CA.AddStatus((STATUSTYPE)2, amt, false);
}
[PunRPC]
public void RPC_ClearHunger()
{
CA.SetStatus((STATUSTYPE)1, 0f);
}
[PunRPC]
public void RPC_AddHunger(float amt)
{
CA.AddStatus((STATUSTYPE)1, amt, false);
}
[PunRPC]
public void RPC_ClearPoison()
{
CA.SetStatus((STATUSTYPE)3, 0f);
}
[PunRPC]
public void RPC_AddPoison(float amt)
{
CA.AddStatus((STATUSTYPE)3, amt, false);
}
[PunRPC]
public void RPC_ClearCurse()
{
CA.SetStatus((STATUSTYPE)5, 0f);
}
[PunRPC]
public void RPC_AddCurse(float amt)
{
CA.AddStatus((STATUSTYPE)5, amt, false);
}
[PunRPC]
public void RPC_ClearDrowsy()
{
CA.SetStatus((STATUSTYPE)6, 0f);
}
[PunRPC]
public void RPC_AddDrowsy(float amt)
{
CA.AddStatus((STATUSTYPE)6, amt, false);
}
[PunRPC]
public void RPC_ClearInjury()
{
CA.SetStatus((STATUSTYPE)0, 0f);
}
[PunRPC]
public void RPC_AddInjury(float amt)
{
CA.AddStatus((STATUSTYPE)0, amt, false);
}
[PunRPC]
public void RPC_ClearHot()
{
CA.SetStatus((STATUSTYPE)8, 0f);
}
[PunRPC]
public void RPC_AddHot(float amt)
{
CA.AddStatus((STATUSTYPE)8, amt, false);
}
[PunRPC]
public void RPC_ClearAllStatuses()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: 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)
foreach (STATUSTYPE value in Enum.GetValues(typeof(STATUSTYPE)))
{
CA.SetStatus(value, 0f);
}
}
}
namespace UIOpener
{
public class PlayerCLIParser : CLITypeParser
{
public override object Parse(string raw)
{
string name = raw.Replace("_", " ");
return ((IEnumerable<Player>)PhotonNetwork.PlayerList).FirstOrDefault((Func<Player, bool>)((Player p) => p.NickName.Equals(name, StringComparison.OrdinalIgnoreCase)));
}
public override List<ParameterAutocomplete> FindAutocomplete(string textSoFar)
{
string textSoFar2 = textSoFar;
return (from p in PhotonNetwork.PlayerList
select p.NickName.Replace(" ", "_") into n
where n.StartsWith(textSoFar2, StringComparison.OrdinalIgnoreCase)
select n).Select((Func<string, ParameterAutocomplete>)((string n) => new ParameterAutocomplete(n))).ToList();
}
}
public static class PlayerCommands
{
[ConsoleCommand]
public static void WarpTo(Player target)
{
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
Player target2 = target;
if (target2 == null)
{
Debug.LogWarning((object)"tp: player not found!");
return;
}
Character val = ((IEnumerable<Character>)Character.AllCharacters).FirstOrDefault((Func<Character, bool>)((Character c) => ((object)((MonoBehaviourPun)c).photonView.Owner).Equals((object?)target2)));
if ((Object)(object)val == (Object)null)
{
Debug.LogWarning((object)("tp: no Character for '" + target2.NickName + "'"));
return;
}
Character localCharacter = Character.localCharacter;
if ((Object)(object)localCharacter == (Object)null)
{
Debug.LogWarning((object)"tp: no local character!");
return;
}
((MonoBehaviourPun)localCharacter).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val.Center, true });
Debug.Log((object)("tp: warped to '" + target2.NickName + "'"));
}
[ConsoleCommand]
public static void WarpRandom()
{
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
Character local = Character.localCharacter;
if ((Object)(object)local == (Object)null)
{
Debug.LogWarning((object)"tprandom: no local character!");
return;
}
List<Character> list = Character.AllCharacters.Where((Character c) => (Object)(object)c != (Object)(object)local && !c.data.dead).ToList();
if (list.Count == 0)
{
Debug.LogWarning((object)"tprandom: no valid targets to warp to!");
return;
}
Character val = list[Random.Range(0, list.Count)];
((MonoBehaviourPun)local).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val.Center, true });
Debug.Log((object)("tprandom: warped to '" + val.characterName + "'"));
}
[ConsoleCommand]
public static void TickPlayer(Player target)
{
//IL_0097: 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)
Player target2 = target;
if (target2 == null)
{
Debug.LogWarning((object)"tick: player not found!");
return;
}
if (!PhotonNetwork.IsMasterClient)
{
Debug.LogWarning((object)"Only the MasterClient can spawn a tick.");
return;
}
Character val = ((IEnumerable<Character>)Character.AllCharacters).FirstOrDefault((Func<Character, bool>)((Character c) => ((object)((MonoBehaviourPun)c).photonView.Owner).Equals((object?)target2)));
if ((Object)(object)val == (Object)null)
{
Debug.LogWarning((object)("tick: no Character for '" + target2.NickName + "'"));
return;
}
GameObject val2 = PhotonNetwork.Instantiate("BugfixOnYou", Vector3.zero, Quaternion.identity, (byte)0, (object[])null);
val2.GetComponent<PhotonView>().RPC("AttachBug", (RpcTarget)0, new object[1] { ((MonoBehaviourPun)val).photonView.ViewID });
Debug.Log((object)("tick: spawned on '" + target2.NickName + "'"));
}
}
}
namespace Peak.Mods
{
[BepInPlugin("com.you.InjectZorroConsole", "Inject Zorro Console", "1.0.0")]
[BepInProcess("PEAK.exe")]
public class InjectZorroConsole : BaseUnityPlugin
{
private Type _consoleHandlerType;
private Type _debugUIType;
private object _debugUIHandler;
private bool _consoleReady;
private bool _isShowing = false;
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Inject Zorro Console plugin loaded.");
((MonoBehaviour)this).StartCoroutine(DoInject());
}
private IEnumerator DoInject()
{
for (int i = 0; i < 50; i++)
{
_consoleHandlerType = AppDomain.CurrentDomain.GetAssemblies().SelectMany(delegate(Assembly a)
{
try
{
return a.GetTypes();
}
catch
{
return Array.Empty<Type>();
}
}).FirstOrDefault((Type t) => t.FullName == "Zorro.Core.CLI.ConsoleHandler");
if (_consoleHandlerType != null)
{
break;
}
yield return (object)new WaitForSeconds(0.1f);
}
if (_consoleHandlerType == null)
{
yield break;
}
MethodInfo scanCmds = _consoleHandlerType.GetMethod("ScanForConsoleCommands", BindingFlags.Static | BindingFlags.Public);
MethodInfo scanPars = _consoleHandlerType.GetMethod("ScanForTypeParsers", BindingFlags.Static | BindingFlags.Public);
MethodInfo initMethod = _consoleHandlerType.GetMethod("Initialize", BindingFlags.Static | BindingFlags.Public);
object commands = scanCmds?.Invoke(null, null);
object parsers = scanPars?.Invoke(null, null);
try
{
Type dictType = parsers.GetType();
Type valueType = dictType.GetGenericArguments()[1];
MethodInfo setIndexer = dictType.GetMethod("set_Item", new Type[2]
{
typeof(Type),
valueType
});
Type parserType = AppDomain.CurrentDomain.GetAssemblies().SelectMany(delegate(Assembly a)
{
try
{
return a.GetTypes();
}
catch
{
return Array.Empty<Type>();
}
}).FirstOrDefault((Type t) => t.Name == "PlayerCLIParser");
if (parserType == null)
{
throw new Exception("Could not find PlayerCLIParser in any loaded assembly.");
}
object parserInstance = Activator.CreateInstance(parserType);
Type punPlayerType = typeof(Player);
setIndexer.Invoke(parsers, new object[2] { punPlayerType, parserInstance });
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)$"Failed to inject PlayerCLIParser: {ex}");
}
initMethod?.Invoke(null, new object[2] { commands, parsers });
yield return null;
yield return null;
_debugUIType = _consoleHandlerType.Assembly.GetType("Zorro.Core.CLI.DebugUIHandler");
if (!(_debugUIType == null))
{
_debugUIHandler = ((IEnumerable<MonoBehaviour>)Object.FindObjectsOfType<MonoBehaviour>()).FirstOrDefault((Func<MonoBehaviour, bool>)((MonoBehaviour mb) => ((object)mb).GetType() == _debugUIType));
if (_debugUIHandler != null)
{
_debugUIType.GetMethod("Hide", BindingFlags.Instance | BindingFlags.Public).Invoke(_debugUIHandler, null);
_consoleReady = true;
}
}
}
private void Update()
{
if (_consoleReady && Input.GetKeyDown((KeyCode)282))
{
string name = (_isShowing ? "Hide" : "Show");
MethodInfo method = _debugUIType.GetMethod(name, BindingFlags.Instance | BindingFlags.Public);
method.Invoke(_debugUIHandler, null);
_isShowing = !_isShowing;
}
}
}
public static class WeatherCommands
{
[ConsoleCommand]
public static void ToggleSnowStorm()
{
//IL_0103: 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_0192: Unknown result type (might be due to invalid IL or missing references)
if (!PhotonNetwork.IsMasterClient)
{
Debug.LogWarning((object)"Only the MasterClient can toggle wind.");
return;
}
Type type = AppDomain.CurrentDomain.GetAssemblies().SelectMany(delegate(Assembly a)
{
try
{
return a.GetTypes();
}
catch
{
return Array.Empty<Type>();
}
}).FirstOrDefault((Type t) => t.Name == "WindChillZone");
if (type == null)
{
Debug.LogWarning((object)"WindChillZone type not found.");
return;
}
object obj = type.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public)?.GetValue(null);
if (obj == null)
{
Debug.LogWarning((object)"WindChillZone.Instance is null.");
return;
}
FieldInfo field = type.GetField("windActive", BindingFlags.Instance | BindingFlags.Public);
bool flag = (bool)field.GetValue(obj);
bool flag2 = !flag;
MethodInfo method = type.GetMethod("RandomWindDirection", BindingFlags.Instance | BindingFlags.NonPublic);
Vector3 val = (Vector3)method.Invoke(obj, null);
FieldInfo field2 = type.GetField("view", BindingFlags.Instance | BindingFlags.NonPublic);
object value = field2.GetValue(obj);
MethodInfo method2 = value.GetType().GetMethod("RPC", new Type[3]
{
typeof(string),
typeof(RpcTarget),
typeof(object[])
});
method2.Invoke(value, new object[3]
{
"RPCA_ToggleWind",
(object)(RpcTarget)0,
new object[2] { flag2, val }
});
Debug.Log((object)("wind is now " + (flag2 ? "ON" : "OFF")));
}
}
}