using System;
using System.Diagnostics;
using System.IO;
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 GameNetcodeStuff;
using HoloPlatform.NetcodePatcher;
using LethalLib.Modules;
using Unity.Netcode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("HoloPlatform")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Adds a new item, the Holo-Platform. Never fail a skill jump again!")]
[assembly: AssemblyFileVersion("0.3.0.0")]
[assembly: AssemblyInformationalVersion("0.3.0")]
[assembly: AssemblyProduct("HoloPlatform")]
[assembly: AssemblyTitle("HoloPlatform")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.3.0.0")]
[module: UnverifiableCode]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
namespace HoloPlatform
{
public class Config
{
public static ConfigEntry<int> storePrice;
public Config(ConfigFile cfg)
{
storePrice = cfg.Bind<int>("Item", "Store Price", 250, "The price of the item in the terminal store");
}
}
internal class PlatformEnemAI : EnemyAI
{
private const float MoveSpeed = 30f;
public PlayerControllerB ownerPlayer;
public override void OnGainedOwnership()
{
ownerPlayer = StartOfRound.Instance.allPlayerObjects[(uint)((NetworkBehaviour)this).OwnerClientId].GetComponent<PlayerControllerB>();
base.targetPlayer = ownerPlayer;
}
public override void Update()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: 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_0029: 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_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Update();
Vector3 val = base.targetPlayer.playerGlobalHead.position - ((Component)this).transform.position;
Vector3 normalized = ((Vector3)(ref val)).normalized;
Vector3 val2 = default(Vector3);
((Vector3)(ref val2))..ctor(normalized.x * (Time.deltaTime * 30f), 0f, normalized.z * (Time.deltaTime * 30f));
Transform transform = ((Component)this).transform;
transform.position += val2;
}
protected override void __initializeVariables()
{
((EnemyAI)this).__initializeVariables();
}
protected internal override string __getTypeName()
{
return "PlatformEnemAI";
}
}
public class PlatformItemBehaviour : PhysicsProp
{
private NetworkObject netPlatObject;
public override void OnNetworkSpawn()
{
((NetworkBehaviour)this).OnNetworkSpawn();
((GrabbableObject)this).insertedBattery.charge = 1f;
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (!((NetworkBehaviour)this).IsOwner)
{
return;
}
if (((GrabbableObject)this).isBeingUsed)
{
if (((NetworkBehaviour)this).IsHost)
{
SpawnPlatform();
}
else
{
SpawnPlatformServerRpc();
}
}
else if (!((GrabbableObject)this).isBeingUsed)
{
if (((NetworkBehaviour)this).IsHost)
{
DespawnPlatform();
}
else
{
DespawnPlatformServerRpc();
}
}
}
public override void UseUpBatteries()
{
((GrabbableObject)this).UseUpBatteries();
if (((NetworkBehaviour)this).IsOwner)
{
if (((NetworkBehaviour)this).IsHost)
{
DespawnPlatform();
}
else
{
DespawnPlatformServerRpc();
}
}
}
public override void DiscardItem()
{
((GrabbableObject)this).DiscardItem();
if (((GrabbableObject)this).isBeingUsed)
{
((GrabbableObject)this).isBeingUsed = false;
if (((NetworkBehaviour)this).IsHost)
{
DespawnPlatform();
}
else
{
DespawnPlatformServerRpc();
}
}
}
[ServerRpc]
private void SpawnPlatformServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Invalid comparison between Unknown and I4
//IL_010e: 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_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2440242326u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2440242326u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
Vector3 val3 = default(Vector3);
((Vector3)(ref val3))..ctor(((GrabbableObject)this).playerHeldBy.playerGlobalHead.position.x, ((GrabbableObject)this).playerHeldBy.playerGlobalHead.position.y - 2.75f, ((GrabbableObject)this).playerHeldBy.playerGlobalHead.position.z);
netPlatObject = NetworkObjectReference.op_Implicit(RoundManager.Instance.SpawnEnemyGameObject(val3, 0f, -1, Plugin.holoPlat));
netPlatObject.ChangeOwnership(((GrabbableObject)this).playerHeldBy.actualClientId);
Plugin.Logger.LogInfo((object)"Successfully spawned platform game object");
}
}
private void SpawnPlatform()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: 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_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(((GrabbableObject)this).playerHeldBy.playerGlobalHead.position.x, ((GrabbableObject)this).playerHeldBy.playerGlobalHead.position.y - 2.75f, ((GrabbableObject)this).playerHeldBy.playerGlobalHead.position.z);
netPlatObject = NetworkObjectReference.op_Implicit(RoundManager.Instance.SpawnEnemyGameObject(val, 0f, -1, Plugin.holoPlat));
netPlatObject.ChangeOwnership(((GrabbableObject)this).playerHeldBy.actualClientId);
Plugin.Logger.LogInfo((object)"Successfully spawned platform game object");
}
[ServerRpc]
private void DespawnPlatformServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Invalid comparison between Unknown and I4
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1866125912u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1866125912u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
RoundManager.Instance.DespawnEnemyOnServer(netPlatObject);
Plugin.Logger.LogInfo((object)"Despawned platform game object");
}
}
private void DespawnPlatform()
{
RoundManager.Instance.DespawnEnemyOnServer(netPlatObject);
Plugin.Logger.LogInfo((object)"Despawned platform game object");
}
protected override void __initializeVariables()
{
((PhysicsProp)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_PlatformItemBehaviour()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(2440242326u, new RpcReceiveHandler(__rpc_handler_2440242326));
NetworkManager.__rpc_func_table.Add(1866125912u, new RpcReceiveHandler(__rpc_handler_1866125912));
}
private static void __rpc_handler_2440242326(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
}
else
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((PlatformItemBehaviour)(object)target).SpawnPlatformServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1866125912(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
}
else
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((PlatformItemBehaviour)(object)target).DespawnPlatformServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "PlatformItemBehaviour";
}
}
[BepInPlugin("poiuygfd.HoloPlatform", "HoloPlatform", "0.3.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public const string ModGUID = "poiuygfd.HoloPlatform";
public static Plugin instance;
public static ManualLogSource Logger;
public static EnemyType holoPlat;
public static Item holoPlatItem;
public static Config Config { get; internal set; }
private void Awake()
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
for (int i = 0; i < types.Length; i++)
{
MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
foreach (MethodInfo methodInfo in methods)
{
if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
instance = this;
Logger = ((BaseUnityPlugin)this).Logger;
Config = new Config(((BaseUnityPlugin)this).Config);
AssetBundle obj = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "holoplatassets"));
EnemyType val = obj.LoadAsset<EnemyType>("Assets/PlatformItem/HoloPlatEnem.asset");
TerminalNode val2 = obj.LoadAsset<TerminalNode>("Assets/PlatformItem/terminal/HoloPlatTerminalNode.asset");
TerminalKeyword val3 = obj.LoadAsset<TerminalKeyword>("Assets/PlatformItem/terminal/HoloPlatTerminalKey.asset");
NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
Enemies.RegisterEnemy(val, 0, (LevelTypes)1, (SpawnType)0, val2, val3);
holoPlat = val;
Item val4 = obj.LoadAsset<Item>("Assets/PlatformItem/HoloPlatItem.asset");
PlatformItemBehaviour platformItemBehaviour = val4.spawnPrefab.AddComponent<PlatformItemBehaviour>();
((GrabbableObject)platformItemBehaviour).grabbable = true;
((GrabbableObject)platformItemBehaviour).grabbableToEnemies = true;
((GrabbableObject)platformItemBehaviour).itemProperties = val4;
NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab);
Utilities.FixMixerGroups(val4.spawnPrefab);
TerminalNode val5 = ScriptableObject.CreateInstance<TerminalNode>();
val5.clearPreviousText = true;
val5.displayText = "The company is sick of seeing new recruits plummet to their death over the simplest of jumps, so they created this piece of tech to prevent that from happening.\n\nThe revolutionary Holo-Platform creates a holographic platform underneath your feet to stand on and easily walk across treacherous falls.\n\nBe careful though, such powerful and advanced technology in such a small package means battery life is very short. Try not to let the battery run out while crossing a gap, or you may fall to an untimely demise.\n\n";
Items.RegisterShopItem(val4, (TerminalNode)null, (TerminalNode)null, val5, Config.storePrice.Value);
Logger.LogInfo((object)"Loaded Holo-Platform");
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "HoloPlatform";
public const string PLUGIN_NAME = "HoloPlatform";
public const string PLUGIN_VERSION = "0.3.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace HoloPlatform.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}