Decompiled source of Polyhydra Games Valheim Mod v0.0.1

PolyhydraGames.Valheim.Plugin.dll

Decompiled 11 hours ago
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 System.Text;
using BepInEx;
using HarmonyLib;
using Jotunn.Managers;
using Microsoft.CodeAnalysis;
using PolyhydraGames.Valheim.Plugin.Commands;
using PolyhydraGames.Valheim.Plugin.Extensions;
using PolyhydraGames.Valheim.Plugin.Models;
using Splatform;
using UnityEngine;
using UnityEngine.Networking;
using ValheimRcon;
using ValheimRcon.Commands;

[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.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("PolyhydraGames.Valheim.Plugin")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+6980f3302cbbf3e43a99af22f6ece9271e745afd")]
[assembly: AssemblyProduct("PolyhydraGames.Valheim.Plugin")]
[assembly: AssemblyTitle("PolyhydraGames.Valheim.Plugin")]
[assembly: AssemblyVersion("1.0.0.0")]
[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;
		}
	}
	public class IsExternalInit
	{
	}
	public class AudioHelper : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <PlayAudioFromUrl>d__0 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public string url;

			public Vector3 position;

			public AudioHelper <>4__this;

			private UnityWebRequest <www>5__1;

			private AudioClip <clip>5__2;

			private GameObject <audioObject>5__3;

			private AudioSource <audioSource>5__4;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <PlayAudioFromUrl>d__0(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<www>5__1 = null;
				<clip>5__2 = null;
				<audioObject>5__3 = null;
				<audioSource>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0074: Invalid comparison between Unknown and I4
				//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c1: Expected O, but got Unknown
				//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<www>5__1 = UnityWebRequestMultimedia.GetAudioClip(url, (AudioType)20);
						<>1__state = -3;
						<>2__current = <www>5__1.SendWebRequest();
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -3;
						if ((int)<www>5__1.result != 1)
						{
							Debug.LogWarning((object)("Failed to download audio: " + <www>5__1.error));
						}
						else
						{
							<clip>5__2 = DownloadHandlerAudioClip.GetContent(<www>5__1);
							<audioObject>5__3 = new GameObject("TempAudio");
							<audioObject>5__3.transform.position = position;
							<audioSource>5__4 = <audioObject>5__3.AddComponent<AudioSource>();
							<audioSource>5__4.clip = <clip>5__2;
							<audioSource>5__4.spatialBlend = 1f;
							<audioSource>5__4.Play();
							Object.Destroy((Object)(object)<audioObject>5__3, <clip>5__2.length);
							<clip>5__2 = null;
							<audioObject>5__3 = null;
							<audioSource>5__4 = null;
						}
						<>m__Finally1();
						<www>5__1 = null;
						return false;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<www>5__1 != null)
				{
					((IDisposable)<www>5__1).Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[IteratorStateMachine(typeof(<PlayAudioFromUrl>d__0))]
		public IEnumerator PlayAudioFromUrl(string url, Vector3 position)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <PlayAudioFromUrl>d__0(0)
			{
				<>4__this = this,
				url = url,
				position = position
			};
		}
	}
}
namespace PolyhydraGames.Valheim.Plugin
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.polyhydragames.rcon", "Poly Valheim Rcon", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string Guid = "com.polyhydragames.rcon";

		public const string Name = "Poly Valheim Rcon";

		public const string Version = "1.0.0";

		private void Awake()
		{
			RconCommandsUtil.RegisterAllCommands(Assembly.GetExecutingAssembly());
		}
	}
}
namespace PolyhydraGames.Valheim.Plugin.Models
{
	public record PlayerWrapperType(ZNetPeer Peer, ZDO Zdo)
	{
		public ZRpc RPC => Peer.m_rpc;

		public long ZDOID => Peer.m_uid;

		public string Name => Peer.m_playerName;

		public ZDOID PlayerId => Peer.m_characterID;

		public string Info => PlayerUtils.GetPlayerInfo(Peer);

		public Vector3 RefPosition => Peer.GetRefPos();

		public string SocketEndpoint
		{
			get
			{
				ISocket socket = Peer.m_socket;
				return (socket != null) ? socket.GetEndPointString() : null;
			}
		}

		public ZDOID ZdoUid => Zdo.m_uid;

		public Vector3 WorldPosition => Zdo.GetPosition();

		public Quaternion Rotation => Zdo.GetRotation();

		public long UnderlyingUid => Zdo.GetLong(ZDOVars.s_playerID, 0L);

		public long Owner => Zdo.GetOwner();

		public void PeerInvoke(string method, params object[] args)
		{
			RPC.Invoke(method, args);
		}

		public override string ToString()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			return $"{Name} [{ZDOID}] at {RefPosition}";
		}

		[CompilerGenerated]
		protected virtual bool PrintMembers(StringBuilder builder)
		{
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: 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_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			RuntimeHelpers.EnsureSufficientExecutionStack();
			builder.Append("Peer = ");
			builder.Append(Peer);
			builder.Append(", Zdo = ");
			builder.Append(Zdo);
			builder.Append(", RPC = ");
			builder.Append(RPC);
			builder.Append(", ZDOID = ");
			builder.Append(ZDOID.ToString());
			builder.Append(", Name = ");
			builder.Append((object?)Name);
			builder.Append(", PlayerId = ");
			ZDOID val = PlayerId;
			builder.Append(((object)(ZDOID)(ref val)).ToString());
			builder.Append(", Info = ");
			builder.Append((object?)Info);
			builder.Append(", RefPosition = ");
			Vector3 val2 = RefPosition;
			builder.Append(((object)(Vector3)(ref val2)).ToString());
			builder.Append(", SocketEndpoint = ");
			builder.Append((object?)SocketEndpoint);
			builder.Append(", ZdoUid = ");
			val = ZdoUid;
			builder.Append(((object)(ZDOID)(ref val)).ToString());
			builder.Append(", WorldPosition = ");
			val2 = WorldPosition;
			builder.Append(((object)(Vector3)(ref val2)).ToString());
			builder.Append(", Rotation = ");
			Quaternion rotation = Rotation;
			builder.Append(((object)(Quaternion)(ref rotation)).ToString());
			builder.Append(", UnderlyingUid = ");
			builder.Append(UnderlyingUid.ToString());
			builder.Append(", Owner = ");
			builder.Append(Owner.ToString());
			return true;
		}
	}
}
namespace PolyhydraGames.Valheim.Plugin.Extensions
{
	public enum RpcCommand
	{
		SetGuardianPower,
		UseGuardianPower,
		PeerInfo,
		NetTime,
		ServerHandshake,
		ClientHandshake,
		ServerSyncedPlayerData,
		Disconnect,
		Error,
		Kick,
		Kicked,
		Ban,
		Unban,
		AdminList,
		Save,
		SavePlayerProfile,
		PlayerList,
		PrintBanned,
		RemoteCommand,
		RemotePrint,
		SpawnObject,
		DestroyZDO,
		RequestZDO,
		ZDOData,
		RoutedRPC,
		SetTrigger,
		Heal,
		Damage,
		Stagger,
		UseStamina,
		OnDeath,
		OnTargeted,
		FlashShield,
		AddStatusEffect,
		Controls,
		ReleaseControl,
		RequestControl,
		RequestRespons,
		ChatMessage,
		TeleportPlayer,
		Say,
		DropItem,
		DropItemByName,
		RequestOwn,
		SetPose,
		SetVisualItem,
		OpenRespons,
		RequestStack,
		StackResponse,
		RequestOpen,
		RequestTakeAll,
		TakeAllRespons,
		AddFuel,
		AddItem,
		RemoveDoneItem,
		SetSlotVisual,
		AddFuelAmount,
		SetFuelAmount,
		ToggleOn,
		Pickup,
		RequestPickup,
		UseDoor,
		Repair,
		Remove,
		HealthChanged,
		UpdateMaterial,
		SetAreaHealth,
		SetEvent,
		BossSpawnInitiated,
		RemoveBossSpawnInventoryItems,
		SpawnBoss,
		SetTamed,
		ResetCloth,
		FreezeFrame,
		OnHit,
		Attach,
		TeleportTo,
		StaggerCreature,
		OnEat,
		TryEat,
		EatConfirmation,
		Nibble,
		Step,
		Wakeup,
		Grow,
		Shake,
		Command,
		UnSummon,
		SetName,
		Forward,
		Backward,
		Rudder,
		Stop,
		AddSaddle,
		RemoveSaddle,
		SetSaddle,
		RequestControlShip,
		ReleaseControlShip,
		SetGlobalKey,
		RemoveGlobalKey,
		GlobalKeys,
		LocationIcons,
		AddNoise
	}
	public static class RpcCommandMap
	{
		public static readonly Dictionary<RpcCommand, string> Names = new Dictionary<RpcCommand, string>
		{
			{
				RpcCommand.SetGuardianPower,
				"RPC_SetGuardianPower"
			},
			{
				RpcCommand.UseGuardianPower,
				"RPC_UseGuardianPower"
			},
			{
				RpcCommand.PeerInfo,
				"RPC_PeerInfo"
			},
			{
				RpcCommand.NetTime,
				"RPC_NetTime"
			},
			{
				RpcCommand.ServerHandshake,
				"RPC_ServerHandshake"
			},
			{
				RpcCommand.ClientHandshake,
				"RPC_ClientHandshake"
			},
			{
				RpcCommand.ServerSyncedPlayerData,
				"RPC_ServerSyncedPlayerData"
			},
			{
				RpcCommand.Disconnect,
				"RPC_Disconnect"
			},
			{
				RpcCommand.Error,
				"RPC_Error"
			},
			{
				RpcCommand.Kick,
				"RPC_Kick"
			},
			{
				RpcCommand.Kicked,
				"RPC_Kicked"
			},
			{
				RpcCommand.Ban,
				"RPC_Ban"
			},
			{
				RpcCommand.Unban,
				"RPC_Unban"
			},
			{
				RpcCommand.AdminList,
				"RPC_AdminList"
			},
			{
				RpcCommand.Save,
				"RPC_Save"
			},
			{
				RpcCommand.SavePlayerProfile,
				"RPC_SavePlayerProfile"
			},
			{
				RpcCommand.PlayerList,
				"RPC_PlayerList"
			},
			{
				RpcCommand.PrintBanned,
				"RPC_PrintBanned"
			},
			{
				RpcCommand.RemoteCommand,
				"RPC_RemoteCommand"
			},
			{
				RpcCommand.RemotePrint,
				"RPC_RemotePrint"
			},
			{
				RpcCommand.SpawnObject,
				"RPC_SpawnObject"
			},
			{
				RpcCommand.DestroyZDO,
				"RPC_DestroyZDO"
			},
			{
				RpcCommand.RequestZDO,
				"RPC_RequestZDO"
			},
			{
				RpcCommand.ZDOData,
				"RPC_ZDOData"
			},
			{
				RpcCommand.RoutedRPC,
				"RPC_RoutedRPC"
			},
			{
				RpcCommand.SetTrigger,
				"RPC_SetTrigger"
			},
			{
				RpcCommand.Heal,
				"RPC_Heal"
			},
			{
				RpcCommand.Damage,
				"RPC_Damage"
			},
			{
				RpcCommand.Stagger,
				"RPC_Stagger"
			},
			{
				RpcCommand.UseStamina,
				"RPC_UseStamina"
			},
			{
				RpcCommand.OnDeath,
				"RPC_OnDeath"
			},
			{
				RpcCommand.OnTargeted,
				"RPC_OnTargeted"
			},
			{
				RpcCommand.FlashShield,
				"RPC_FlashShield"
			},
			{
				RpcCommand.AddStatusEffect,
				"RPC_AddStatusEffect"
			},
			{
				RpcCommand.Controls,
				"RPC_Controls"
			},
			{
				RpcCommand.ReleaseControl,
				"RPC_ReleaseControl"
			},
			{
				RpcCommand.RequestControl,
				"RPC_RequestControl"
			},
			{
				RpcCommand.RequestRespons,
				"RPC_RequestRespons"
			},
			{
				RpcCommand.ChatMessage,
				"RPC_ChatMessage"
			},
			{
				RpcCommand.TeleportPlayer,
				"RPC_TeleportPlayer"
			},
			{
				RpcCommand.Say,
				"RPC_Say"
			},
			{
				RpcCommand.DropItem,
				"RPC_DropItem"
			},
			{
				RpcCommand.DropItemByName,
				"RPC_DropItemByName"
			},
			{
				RpcCommand.RequestOwn,
				"RPC_RequestOwn"
			},
			{
				RpcCommand.SetPose,
				"RPC_SetPose"
			},
			{
				RpcCommand.SetVisualItem,
				"RPC_SetVisualItem"
			},
			{
				RpcCommand.OpenRespons,
				"RPC_OpenRespons"
			},
			{
				RpcCommand.RequestStack,
				"RPC_RequestStack"
			},
			{
				RpcCommand.StackResponse,
				"RPC_StackResponse"
			},
			{
				RpcCommand.RequestOpen,
				"RPC_RequestOpen"
			},
			{
				RpcCommand.RequestTakeAll,
				"RPC_RequestTakeAll"
			},
			{
				RpcCommand.TakeAllRespons,
				"RPC_TakeAllRespons"
			},
			{
				RpcCommand.AddFuel,
				"RPC_AddFuel"
			},
			{
				RpcCommand.AddItem,
				"RPC_AddItem"
			},
			{
				RpcCommand.RemoveDoneItem,
				"RPC_RemoveDoneItem"
			},
			{
				RpcCommand.SetSlotVisual,
				"RPC_SetSlotVisual"
			},
			{
				RpcCommand.AddFuelAmount,
				"RPC_AddFuelAmount"
			},
			{
				RpcCommand.SetFuelAmount,
				"RPC_SetFuelAmount"
			},
			{
				RpcCommand.ToggleOn,
				"RPC_ToggleOn"
			},
			{
				RpcCommand.Pickup,
				"RPC_Pickup"
			},
			{
				RpcCommand.RequestPickup,
				"RPC_RequestPickup"
			},
			{
				RpcCommand.UseDoor,
				"RPC_UseDoor"
			},
			{
				RpcCommand.Repair,
				"RPC_Repair"
			},
			{
				RpcCommand.Remove,
				"RPC_Remove"
			},
			{
				RpcCommand.HealthChanged,
				"RPC_HealthChanged"
			},
			{
				RpcCommand.UpdateMaterial,
				"RPC_UpdateMaterial"
			},
			{
				RpcCommand.SetAreaHealth,
				"RPC_SetAreaHealth"
			},
			{
				RpcCommand.SetEvent,
				"RPC_SetEvent"
			},
			{
				RpcCommand.BossSpawnInitiated,
				"RPC_BossSpawnInitiated"
			},
			{
				RpcCommand.RemoveBossSpawnInventoryItems,
				"RPC_RemoveBossSpawnInventoryItems"
			},
			{
				RpcCommand.SpawnBoss,
				"RPC_SpawnBoss"
			},
			{
				RpcCommand.SetTamed,
				"RPC_SetTamed"
			},
			{
				RpcCommand.ResetCloth,
				"RPC_ResetCloth"
			},
			{
				RpcCommand.FreezeFrame,
				"RPC_FreezeFrame"
			},
			{
				RpcCommand.OnHit,
				"RPC_OnHit"
			},
			{
				RpcCommand.Attach,
				"RPC_Attach"
			},
			{
				RpcCommand.TeleportTo,
				"RPC_TeleportTo"
			},
			{
				RpcCommand.StaggerCreature,
				"RPC_Stagger"
			},
			{
				RpcCommand.OnEat,
				"RPC_OnEat"
			},
			{
				RpcCommand.TryEat,
				"RPC_TryEat"
			},
			{
				RpcCommand.EatConfirmation,
				"RPC_EatConfirmation"
			},
			{
				RpcCommand.Nibble,
				"RPC_Nibble"
			},
			{
				RpcCommand.Step,
				"RPC_Step"
			},
			{
				RpcCommand.Wakeup,
				"RPC_Wakeup"
			},
			{
				RpcCommand.Grow,
				"RPC_Grow"
			},
			{
				RpcCommand.Shake,
				"RPC_Shake"
			},
			{
				RpcCommand.Command,
				"RPC_Command"
			},
			{
				RpcCommand.UnSummon,
				"RPC_UnSummon"
			},
			{
				RpcCommand.SetName,
				"RPC_SetName"
			},
			{
				RpcCommand.Forward,
				"RPC_Forward"
			},
			{
				RpcCommand.Backward,
				"RPC_Backward"
			},
			{
				RpcCommand.Rudder,
				"RPC_Rudder"
			},
			{
				RpcCommand.Stop,
				"RPC_Stop"
			},
			{
				RpcCommand.AddSaddle,
				"RPC_AddSaddle"
			},
			{
				RpcCommand.RemoveSaddle,
				"RPC_RemoveSaddle"
			},
			{
				RpcCommand.SetSaddle,
				"RPC_SetSaddle"
			},
			{
				RpcCommand.RequestControlShip,
				"RPC_RequestControl"
			},
			{
				RpcCommand.ReleaseControlShip,
				"RPC_ReleaseControl"
			},
			{
				RpcCommand.SetGlobalKey,
				"RPC_SetGlobalKey"
			},
			{
				RpcCommand.RemoveGlobalKey,
				"RPC_RemoveGlobalKey"
			},
			{
				RpcCommand.GlobalKeys,
				"RPC_GlobalKeys"
			},
			{
				RpcCommand.LocationIcons,
				"RPC_LocationIcons"
			},
			{
				RpcCommand.AddNoise,
				"RPC_AddNoise"
			}
		};
	}
	public static class Helpers
	{
		public static class Strings
		{
			public static string[] Statuses => new string[6] { "Rested", "Poison", "Burning", "Wet", "Cold", "SoftDeath" };
		}

		public static string GetRpcCommandName(this RpcCommand command)
		{
			string value;
			return RpcCommandMap.Names.TryGetValue(command, out value) ? value : "RPC_Unknown";
		}

		public static string GetPlayerInfo()
		{
			string[] value = (from x in Player.GetAllPlayers()
				select x.GetPlayerID() + " - " + x.GetPlayerName()).ToArray();
			return string.Join("\n", value);
		}

		public static void ListPrefabs()
		{
			if ((Object)(object)ZNetScene.instance == (Object)null)
			{
				ZLog.Log((object)"ZNetScene not ready yet.");
				return;
			}
			List<string> prefabNames = ZNetScene.instance.GetPrefabNames();
			foreach (string item in prefabNames)
			{
				ZLog.Log((object)("Prefab: " + item));
			}
			ZLog.Log((object)$"Total prefabs: {prefabNames.Count}");
		}

		public static List<string> GetEnvironmentNames()
		{
			List<string> result = null;
			if ((Object)(object)EnvMan.instance == (Object)null)
			{
				ZLog.Log((object)"ZNetScene not ready yet.");
				return result;
			}
			List<string> list = EnvMan.instance.m_environments.Select((EnvSetup e) => e.m_name).ToList();
			foreach (string item in list)
			{
				ZLog.Log((object)("Environment: " + item));
			}
			ZLog.Log((object)$"Total environments: {list.Count}");
			return list;
		}
	}
	public static class PlayerWrapper
	{
		public static PlayerWrapperType Create(ZNetPeer peer)
		{
			return new PlayerWrapperType(peer, PlayerUtils.GetZDO(peer));
		}

		public static void InvokeRoutedRpcOnWorld(this PlayerWrapperType player, RpcCommand rpc, params object[] args)
		{
			ZRoutedRpc.instance.InvokeRoutedRPC(player.Owner, rpc.GetRpcCommandName(), args);
		}

		public static void InvokeRoutedRpc(this PlayerWrapperType player, ZDOID target, RpcCommand rpc, params object[] args)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			ZRoutedRpc.instance.InvokeRoutedRPC(player.Owner, target, rpc.GetRpcCommandName(), args);
		}

		public static void InvokeRoutedRpcOnSelf(this PlayerWrapperType player, RpcCommand rpc, params object[] args)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			player.InvokeRoutedRpc(player.PlayerId, rpc, args);
		}

		public static ZDO GetZDO(this PlayerWrapperType player)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return ZDOMan.instance.GetZDO(player.PlayerId);
		}

		public static string GetSteamId(this PlayerWrapperType player)
		{
			return player.RPC.GetSocket().GetHostName();
		}
	}
	public static class StringUtils
	{
		public static int GetStableHashCode(this string str)
		{
			int num = 5381;
			foreach (char c in str)
			{
				num = (num * 33) ^ c;
			}
			return num;
		}
	}
}
namespace PolyhydraGames.Valheim.Plugin.Commands
{
	internal class GetEvent : RconCommand
	{
		public override string Command => "getevent";

		public override string Description => "Get current active/random raid event.";

		protected override string OnHandle(CommandArgs args)
		{
			RandomEvent activeEvent = RandEventSystem.instance.GetActiveEvent();
			RandomEvent currentRandomEvent = RandEventSystem.instance.GetCurrentRandomEvent();
			if (activeEvent == null && currentRandomEvent == null)
			{
				return "No active raid.";
			}
			return "Active: " + (activeEvent?.m_name ?? "none") + " | Random: " + (currentRandomEvent?.m_name ?? "none");
		}
	}
	internal class Impersonate : RconCommand
	{
		private static readonly Dictionary<string, UserInfo> ImpersonatedUsers = new Dictionary<string, UserInfo>();

		private static ulong NextId = 1uL;

		public override string Command => "impersonate";

		public override string Description => "Sends a message to the chat as a shout. Usage: impersonate <name> <message>";

		public UserInfo CreateUser(string name)
		{
			//IL_0000: 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)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			return new UserInfo
			{
				Name = name,
				UserId = new PlatformUserID("Bot", NextId++, false)
			};
		}

		private UserInfo GetUserInfo(string name)
		{
			if (ImpersonatedUsers.ContainsKey(name))
			{
				return ImpersonatedUsers[name];
			}
			return CreateUser(name);
		}

		protected override string OnHandle(CommandArgs args)
		{
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			if (args.Arguments.Count < 2)
			{
				return "Usage: impersonate <name> <message>";
			}
			string text = "";
			string text2 = "";
			try
			{
				text = args.GetString(0);
				text2 = string.Join(" ", args.Arguments.Skip(1));
				Vector3 val = default(Vector3);
				if (!ZoneSystem.instance.GetLocationIcon(Game.instance.m_StartLocation, ref val))
				{
					((Vector3)(ref val))..ctor(0f, 30f, 0f);
				}
				ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "ChatMessage", new object[4]
				{
					val,
					2,
					GetUserInfo(text),
					text2
				});
				return "Impersonated: " + text + " - " + text2;
			}
			catch (Exception ex)
			{
				return ex.Message + " FAILED  !!! Impersonated: " + text + " - " + text2;
			}
		}
	}
	internal class ListEvents : RconCommand
	{
		public override string Command => "listevents";

		public override string Description => "List all available random events.";

		protected override string OnHandle(CommandArgs args)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendLine("Available events:");
			foreach (RandomEvent @event in RandEventSystem.instance.m_events)
			{
				stringBuilder.AppendLine($"- {@event.m_name} (enabled={@event.m_enabled})");
			}
			return stringBuilder.ToString();
		}
	}
	public abstract class PolyRconCommand : RconCommand
	{
		public static readonly UserInfo ServerUserInfo = new UserInfo
		{
			Name = string.Empty,
			UserId = new PlatformUserID("Bot", 0uL, false)
		};

		protected override string OnHandle(CommandArgs args)
		{
			string @string = args.GetString(0);
			ZNetPeer val = ZNet.instance.GetPeerByHostName(@string) ?? ZNet.instance.GetPeerByPlayerName(@string);
			if (val == null)
			{
				return "Cannot find user " + @string;
			}
			ZDO zDO = PlayerUtils.GetZDO(val);
			return (zDO == null) ? ("Cannot handle command for player " + PlayerUtils.GetPlayerInfo(val) + ". ZDO not found") : OnHandle(PlayerWrapper.Create(val), args);
		}

		protected abstract string OnHandle(PlayerWrapperType player, CommandArgs args);

		public static string FirstArg(CommandArgs args)
		{
			return args.GetString(1);
		}
	}
	internal class RaidCommand : PolyRconCommand
	{
		public override string Command => "raid";

		public override string Description => "Start a raid. Usage: raid <eventName> [player]";

		protected override string OnHandle(PlayerWrapperType player, CommandArgs args)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			if (args.Arguments.Count < 1)
			{
				return "Usage: raid [playerId] <eventName>";
			}
			string text = PolyRconCommand.FirstArg(args);
			Vector3 refPosition = player.RefPosition;
			if (!RandEventSystem.instance.HaveEvent(text))
			{
				return "No such event: " + text;
			}
			RandEventSystem.instance.SetRandomEventByName(text, refPosition);
			return "Raid started: " + text + " " + ((refPosition != Vector3.zero) ? "at player" : "globally");
		}
	}
	internal class StartRandomRaid : RconCommand
	{
		public override string Command => "startraid";

		public override string Description => "Start a random raid from eligible events.";

		protected override string OnHandle(CommandArgs args)
		{
			RandEventSystem.instance.ConsoleStartRandomEvent();
			return "Random raid triggered.";
		}
	}
	internal class StopRaid : RconCommand
	{
		public override string Command => "stopraid";

		public override string Description => "Stop the current raid/event.";

		protected override string OnHandle(CommandArgs args)
		{
			RandEventSystem.instance.ConsoleResetRandomEvent();
			return "Raid/event stopped.";
		}
	}
	internal class Whisper : PolyRconCommand
	{
		public override string Command => "whisper";

		public override string Description => "Sends a message to a specific user. Usage: whisper <longId> <message>";

		protected override string OnHandle(PlayerWrapperType player, CommandArgs args)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			if (args.Arguments.Count < 2)
			{
				return "Usage: whisper <longId> <message>";
			}
			string text = string.Join(" ", args.Arguments.Skip(1));
			ZDOID playerId = player.PlayerId;
			Vector3 refPosition = player.RefPosition;
			int num = 0;
			string text2 = "Server";
			ZRoutedRpc.instance.InvokeRoutedRPC(player.ZDOID, "ChatMessage", new object[4]
			{
				refPosition,
				0,
				PolyRconCommand.ServerUserInfo,
				text
			});
			return "Sent message to " + player.Name;
		}
	}
}
namespace PolyhydraGames.Valheim.Plugin.Broke_Commands
{
	internal class Explode : PolyRconCommand
	{
		public override string Command => "explode";

		public override string Description => "Explode a player. Usage: explode <player>";

		protected override string OnHandle(PlayerWrapperType player, CommandArgs args)
		{
			//IL_002b: 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)
			if (args.Arguments.Count < 1)
			{
				return "Usage: explode <player>";
			}
			Object.Instantiate<GameObject>(ZNetScene.instance.GetPrefab("vfx_explosion"), player.RefPosition, Quaternion.identity);
			return "Boom! Exploded " + player.Name + ".";
		}
	}
	internal class ResetWind : RconCommand
	{
		public override string Command => "resetwind";

		public override string Description => "Reset wind to normal.";

		protected override string OnHandle(CommandArgs args)
		{
			EnvMan instance = EnvMan.instance;
			if (instance != null)
			{
				instance.ResetDebugWind();
			}
			return "Wind reset.";
		}
	}
	internal class SetTime : RconCommand
	{
		public override string Command => "settime";

		public override string Description => "Set time of day fraction (0=midnight, 0.5=noon).";

		protected override string OnHandle(CommandArgs args)
		{
			if (args.Arguments.Count < 1)
			{
				return "Usage: settime <0.0-1.0>";
			}
			if (!float.TryParse(args.GetString(0), out var result))
			{
				return "Invalid number";
			}
			EnvMan.instance.m_debugTimeOfDay = true;
			EnvMan.instance.m_debugTime = Mathf.Clamp01(result);
			return $"Time set to {result}";
		}
	}
	internal class SetWeather : RconCommand
	{
		public override string Command => "setweather";

		public override string Description => "Forces the environment/weather. Usage: setweather <name>";

		private string Usage()
		{
			string text = string.Join(", ", Helpers.GetEnvironmentNames());
			return "Usage: setweather <envName> (" + text + ")";
		}

		protected override string OnHandle(CommandArgs args)
		{
			if ((Object)(object)EnvMan.instance == (Object)null)
			{
				return "EnvMan not initialized";
			}
			if (args.Arguments.Count < 1)
			{
				return Usage();
			}
			string envName = args.GetString(0);
			List<string> environmentNames = Helpers.GetEnvironmentNames();
			if (environmentNames.All((string x) => x != envName))
			{
				return Usage();
			}
			EnvMan.instance.SetForceEnvironment(envName);
			ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "RPC_SetEnvironment", new object[2] { envName, 0f });
			return "Forced environment set to " + envName;
		}
	}
	internal class SetWind : RconCommand
	{
		public override string Command => "setwind";

		public override string Description => "Set wind. Usage: setwind <angle> <intensity>";

		protected override string OnHandle(CommandArgs args)
		{
			if (args.Arguments.Count < 2)
			{
				return "Usage: setwind <angle> <intensity>";
			}
			if (!float.TryParse(args.GetString(0), out var result) || !float.TryParse(args.GetString(1), out var result2))
			{
				return "Invalid numbers";
			}
			EnvMan instance = EnvMan.instance;
			if (instance != null)
			{
				instance.SetDebugWind(result, result2);
			}
			ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "RPC_SetDebugWind", new object[2] { result, result2 });
			return $"Wind forced: {result}°, {result2}";
		}
	}
	internal class Shake : PolyRconCommand
	{
		private Player player;

		public override string Command => "shake";

		public override string Description => "Shake the player. Usage: shake <player>";

		protected override string OnHandle(PlayerWrapperType player, CommandArgs args)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			if (args.Arguments.Count < 2)
			{
				return "Usage: shake <player> <force>";
			}
			float @float = args.GetFloat(2);
			player.InvokeRoutedRpcOnSelf(RpcCommand.Shake, player.RefPosition, @float);
			return "Shook " + player.Name;
		}
	}
	internal class SkipMorning : RconCommand
	{
		public override string Command => "skipmorning";

		public override string Description => "Skips to next morning.";

		protected override string OnHandle(CommandArgs args)
		{
			EnvMan instance = EnvMan.instance;
			if (instance != null)
			{
				instance.SkipToMorning();
			}
			return "Skipped to morning.";
		}
	}
	internal class Smite : PolyRconCommand
	{
		public override string Command => "smite";

		public override string Description => "Strike a player with lightning. Usage: smite <player>";

		protected override string OnHandle(PlayerWrapperType player, CommandArgs args)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			if (player == null)
			{
				return "No player found.";
			}
			if (args.Arguments.Count < 1)
			{
				return "Usage: smite <player>";
			}
			ZNetScene instance = ZNetScene.instance;
			if ((Object)(object)instance == (Object)null)
			{
				return "ZNetScene not ready on server.";
			}
			Vector3 refPosition = player.RefPosition;
			string[] names = new string[3] { "lightningAOE", "vfx_lightning_hit", "fx_thunder" };
			var (flag, text, text2) = TrySpawnFirstNetworked(instance, refPosition, Quaternion.identity, names);
			if (!flag)
			{
				return "Smite failed: " + text2 + ". Tip: use /listprefabs lightning and pick one with ZNetView.";
			}
			return "Smote " + player.Name + " with " + text + " ⚡";
		}

		private static (bool ok, string used, string reason) TrySpawnFirstNetworked(ZNetScene zns, Vector3 pos, Quaternion rot, string[] names)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			foreach (string text in names)
			{
				GameObject prefab = zns.GetPrefab(text);
				if ((Object)(object)prefab == (Object)null)
				{
					continue;
				}
				ZNetView component = prefab.GetComponent<ZNetView>();
				if (!((Object)(object)component == (Object)null))
				{
					GameObject val = Object.Instantiate<GameObject>(prefab, pos, rot);
					TimedDestruction component2 = val.GetComponent<TimedDestruction>();
					if ((Object)(object)component2 == (Object)null)
					{
						Object.Destroy((Object)(object)val, 5f);
					}
					return (true, text, "");
				}
			}
			string text2 = string.Join(", ", names);
			return (false, "", "no networked prefabs among: " + text2);
		}
	}
	internal class Stagger : PolyRconCommand
	{
		public override string Command => "stagger";

		public override string Description => "stagger the player. Usage: stagger <player>";

		protected override string OnHandle(PlayerWrapperType player, CommandArgs args)
		{
			//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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			if (args.Arguments.Count < 2)
			{
				return ((RconCommand)this).Description;
			}
			object[] array = new object[1];
			Vector3 refPosition = player.RefPosition;
			refPosition.x = player.RefPosition.x + 1f;
			array[0] = refPosition;
			player.InvokeRoutedRpcOnSelf(RpcCommand.AddNoise, array);
			return "Staggered " + player.Name;
		}
	}
}
namespace PolyhydraGames.Valheim.Plugin.AddPower
{
	internal class AddPower : PolyRconCommand
	{
		public override string Command => "addnoise";

		public override string Description => "Plays a noise in the vicinity of the player.";

		protected override string OnHandle(PlayerWrapperType player, CommandArgs args)
		{
			if (args.Arguments.Count < 2)
			{
				return "Usage: addpower <player> <powerName> ";
			}
			string @string = args.GetString(1);
			Metadata.ApplyEffectToPlayer(player.Peer, @string);
			return "Applied status '" + @string + "' to " + player.Name;
		}
	}
	public static class Metadata
	{
		public const string Guid = "com.polyhydragames.AddPower";

		public const string Name = "AddPower RCon Bridge";

		public const string Version = "1.0.0";

		public const string RCPCall = "AddPower";

		public const string Command = "addpower";

		public const string Description = "Add Power a   player.";

		public const string Usage = "Usage: addpower <player> <powerName> ";

		public const int MinimumParameters = 2;

		public static void ApplyEffectToPlayer(ZNetPeer peer, string noiseName)
		{
			peer.m_rpc.Invoke("AddPower", new object[1] { noiseName });
		}
	}
	[HarmonyPatch(typeof(Game))]
	public static class GuardianPowerRpc
	{
		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void RegisterRpc()
		{
			ZRoutedRpc.instance.Register<string>("AddPower", (Action<long, string>)delegate(long sender, string statusName)
			{
				StatusEffect val = ((IEnumerable<StatusEffect>)ObjectDB.instance.m_StatusEffects).FirstOrDefault((Func<StatusEffect, bool>)((StatusEffect se) => ((Object)se).name.Equals(statusName, StringComparison.OrdinalIgnoreCase)));
				if ((Object)(object)val == (Object)null)
				{
					Debug.LogWarning((object)("[GuardianPowerRpc] Could not find guardian power: " + statusName));
				}
				else
				{
					Player.m_localPlayer.SetGuardianPower(((Object)val).name);
					Player.m_localPlayer.ActivateGuardianPower();
				}
			});
		}
	}
}
namespace PolyhydraGames.Valheim.Plugin.AddNoise
{
	internal class AddNoise : PolyRconCommand
	{
		public override string Command => "addnoise";

		public override string Description => "Plays a noise in the vicinity of the player.";

		protected override string OnHandle(PlayerWrapperType player, CommandArgs args)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			if (args.Arguments.Count < 2)
			{
				return "Usage: addnoise <player> <noiseName> <position>";
			}
			string @string = args.GetString(0);
			Vector3 vector = CommandArgsExtensions.GetVector3(args, 1);
			Metadata.ApplyEffectToPlayer(player.Peer, @string, vector);
			return "Applied status '" + @string + "' to " + player.Name;
		}
	}
	public static class Metadata
	{
		public const string Guid = "com.polyhydragames.addnoisercon";

		public const string Name = "AddNoise RCon Bridge";

		public const string Version = "1.0.0";

		public const string RCPCall = "AddNoise";

		public const string Command = "addnoise";

		public const string Description = "Plays a noise in the vicinity of the player.";

		public const string Usage = "Usage: addnoise <player> <noiseName> <position>";

		public const int MinimumParameters = 2;

		public static void ApplyEffectToPlayer(ZNetPeer peer, string noiseName, Vector3 position)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			peer.m_rpc.Invoke("AddNoise", new object[2] { noiseName, position });
		}
	}
	[BepInPlugin("com.polyhydragames.addnoisercon", "AddNoise RCon Bridge", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class AddNoiseRconPlugin : BaseUnityPlugin
	{
		private Harmony _harmony;

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			_harmony = new Harmony("com.polyhydragames.addnoisercon");
			_harmony.PatchAll();
			ZRoutedRpc.instance.Register<string, Vector3>("AddNoise", (Action<long, string, Vector3>)PlayNoise);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"AddNoise RCon Bridge loaded.");
		}

		private void PlayNoise(long sender, string effectName, Vector3 position)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			if (effectName.Contains("https:"))
			{
				PlayUrl(effectName, position);
			}
			else
			{
				PlayPrefab(effectName, position);
			}
		}

		private void PlayPrefab(string effectName, Vector3 position)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			GameObject prefab = PrefabManager.Instance.GetPrefab(effectName);
			if ((Object)(object)prefab != (Object)null)
			{
				Object.Instantiate<GameObject>(prefab, position, Quaternion.identity);
				((BaseUnityPlugin)this).Logger.LogInfo((object)$"Played {effectName} at {position}");
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Effect prefab " + effectName + " not found!"));
			}
		}

		private void PlayUrl(string url, Vector3 position)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			AudioHelper audioHelper = new AudioHelper();
			((MonoBehaviour)this).StartCoroutine(audioHelper.PlayAudioFromUrl(url, position));
		}
	}
}
namespace PolyhydraGames.Valheim.Plugin.AddEffect
{
	internal class AddEffect : PolyRconCommand
	{
		public override string Command => "addeffect";

		public override string Description => "Adds a status to the player. Usage: addstatus <player> <statusName>";

		private string ProcessCommand(PlayerWrapperType player, CommandArgs args)
		{
			string text = PolyRconCommand.FirstArg(args);
			Metadata.ApplyEffectToPlayer(player.Peer, text);
			return "Applied status '" + text + "' to " + player.Name;
		}

		protected override string OnHandle(PlayerWrapperType player, CommandArgs args)
		{
			if (args.Arguments.Count < 2)
			{
				return "Usage: addstatus <player> <statusName>";
			}
			return ProcessCommand(player, args);
		}
	}
	public static class Metadata
	{
		public const string Guid = "com.polyhydragames.effectrcon";

		public const string Name = "Effect RCon Bridge";

		public const string Version = "1.0.0";

		public const string RCPCall = "ApplyStatusEffect";

		public const string Command = "addeffect";

		public const string Description = "Adds a status to the player. Usage: addstatus <player> <statusName>";

		public const string Usage = "Usage: addstatus <player> <statusName>";

		public const int MinimumParameters = 2;

		public static void ApplyEffectToPlayer(ZNetPeer peer, string effectName)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			ZPackage val = new ZPackage();
			val.Write(effectName);
			peer.m_rpc.Invoke("ApplyStatusEffect", new object[1] { val });
		}
	}
	[BepInPlugin("com.polyhydragames.effectrcon", "Effect RCon Bridge", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class EffectRconPlugin : BaseUnityPlugin
	{
		private Harmony _harmony;

		private void OnApplyStatusEffect(long sender, string effectName)
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Client received request to apply " + effectName));
			Player localPlayer = Player.m_localPlayer;
			if ((Object)(object)localPlayer == (Object)null)
			{
				return;
			}
			GameObject prefab = PrefabManager.Instance.GetPrefab(effectName);
			if ((Object)(object)prefab != (Object)null)
			{
				StatusEffect component = prefab.GetComponent<StatusEffect>();
				if ((Object)(object)component != (Object)null)
				{
					((Character)localPlayer).GetSEMan().AddStatusEffect(component, true, 0, 0f);
					((Terminal)Chat.instance).AddString("[Odin] You are blessed with undead herpes, aka " + effectName + "!");
				}
				else
				{
					((BaseUnityPlugin)this).Logger.LogWarning((object)"Effect was null");
				}
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"prefab was null");
			}
		}

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			_harmony = new Harmony("com.polyhydragames.effectrcon");
			_harmony.PatchAll();
			ZRoutedRpc.instance.Register<string>("ApplyStatusEffect", (Action<long, string>)OnApplyStatusEffect);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Effect RCon Bridge loaded.");
		}
	}
}