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 Photon.Pun;
using UnityEngine;
using Zorro.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("SurrealMods")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SurrealMods")]
[assembly: AssemblyTitle("SurrealMods")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace SurrealMods;
[BepInPlugin("org.bepinex.plugins.surrealplugin", "SurrealMods", "1.0.0.0")]
public class Plugin : BaseUnityPlugin
{
private string[] monsterNames = new string[12]
{
"Dog", "EyeGuy", "Spider", "Larva", "Bombs", "Knifo", "Zombe", "Jello", "Snatcho", "Slurper",
"Mouth", "Ear"
};
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin SurrealMods is loaded!");
}
private void Update()
{
bool keyDown = Input.GetKeyDown((KeyCode)282);
bool keyDown2 = Input.GetKeyDown((KeyCode)283);
bool keyDown3 = Input.GetKeyDown((KeyCode)284);
bool keyDown4 = Input.GetKeyDown((KeyCode)285);
bool keyDown5 = Input.GetKeyDown((KeyCode)286);
bool keyDown6 = Input.GetKeyDown((KeyCode)287);
bool keyDown7 = Input.GetKeyDown((KeyCode)288);
bool keyDown8 = Input.GetKeyDown((KeyCode)289);
bool keyDown9 = Input.GetKeyDown((KeyCode)290);
if (keyDown && PhotonNetwork.IsMasterClient && !IsOnRestrictedPage())
{
SpawnMonsterUsingReflection("Flicker");
}
if (keyDown2 && PhotonNetwork.IsMasterClient && !IsOnRestrictedPage())
{
SpawnMonsterUsingReflection("Mouthe");
}
if (keyDown3 && PhotonNetwork.IsMasterClient && !IsOnRestrictedPage())
{
SpawnMonsterUsingReflection("Jello");
}
if (keyDown4 && PhotonNetwork.IsMasterClient && !IsOnRestrictedPage())
{
SpawnMonsterUsingReflection("Zombe");
}
if (keyDown5 && PhotonNetwork.IsMasterClient && !IsOnRestrictedPage())
{
SpawnMonsterUsingReflection(monsterNames[Random.Range(0, monsterNames.Length - 1)]);
}
if (keyDown6 && PhotonNetwork.IsMasterClient && !IsOnRestrictedPage())
{
SpawnMonsterUsingReflection("AnglerMimic");
SpawnMonsterUsingReflection("Angler");
}
if (keyDown7 && PhotonNetwork.IsMasterClient && !IsOnRestrictedPage())
{
SpawnMonsterUsingReflection("Slurper");
}
if (keyDown8 && PhotonNetwork.IsMasterClient && !IsOnRestrictedPage())
{
KillPlayer();
}
if (keyDown9 && PhotonNetwork.IsMasterClient && !IsOnRestrictedPage())
{
ResuscitatePlayer();
}
}
private bool IsOnRestrictedPage()
{
UIPageHandler val = Object.FindObjectOfType<UIPageHandler>();
if ((Object)(object)val != (Object)null && (Object)(object)val.currentPage != (Object)null)
{
Type type = ((object)val.currentPage).GetType();
return type == typeof(MainMenuMainPage) || type == typeof(MainMenuHostPage) || type == typeof(MainMenuLoadingPage);
}
return false;
}
private void SpawnMonsterUsingReflection(string monsterName)
{
try
{
Type type = Type.GetType("MonsterSpawner, Assembly-CSharp");
if (type != null)
{
MethodInfo method = type.GetMethod("SpawnMonster", new Type[1] { typeof(string) });
if (method != null)
{
method.Invoke(null, new object[1] { monsterName });
}
else
{
((BaseUnityPlugin)this).Logger.LogError((object)"SpawnMonster method not found!");
}
}
else
{
((BaseUnityPlugin)this).Logger.LogError((object)"MonsterSpawner type not found!");
}
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogError((object)("Error invoking SpawnMonster: " + ex.Message));
}
}
private void KillPlayer()
{
try
{
Type type = Type.GetType("Player, Assembly-CSharp");
if (type != null)
{
MethodInfo method = type.GetMethod("KillLocal");
if (method != null)
{
method.Invoke(null, null);
}
else
{
((BaseUnityPlugin)this).Logger.LogError((object)"KillLocal method not found!");
}
}
else
{
((BaseUnityPlugin)this).Logger.LogError((object)"Player type not found!");
}
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogError((object)("Error invoking KillLocal: " + ex.Message));
}
}
private void ResuscitatePlayer()
{
try
{
Type type = Type.GetType("Player, Assembly-CSharp");
if (type != null)
{
MethodInfo method = type.GetMethod("CallRevive");
if (method != null)
{
method.Invoke(Player.localPlayer, null);
}
else
{
((BaseUnityPlugin)this).Logger.LogError((object)"CallRevive method not found!");
}
}
else
{
((BaseUnityPlugin)this).Logger.LogError((object)"Player type not found!");
}
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogError((object)("Error invoking CallRevive: " + ex.Message));
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "SurrealMods";
public const string PLUGIN_NAME = "SurrealMods";
public const string PLUGIN_VERSION = "1.0.0";
}