using System;
using System.Collections.Generic;
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 HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using SlayersSillyStuff.Scrap;
using Unity.Netcode;
using UnityEngine;
[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("SlayersSillyStuff")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Slayers Silly Stuff")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SlayersSillyStuff")]
[assembly: AssemblyTitle("SlayersSillyStuff")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
internal class <Module>
{
static <Module>()
{
}
}
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[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;
}
}
}
namespace SlayersSillyStuff
{
public class Networker : NetworkBehaviour
{
public static Networker Instance { get; private set; }
public override void OnNetworkSpawn()
{
Instance = this;
((NetworkBehaviour)this).OnNetworkSpawn();
if (!((NetworkBehaviour)this).IsServer)
{
}
}
[ServerRpc(RequireOwnership = false)]
public void MoveItemServerRpc(Vector3 position, int newValue, ulong clientId)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1157311365u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
BytePacker.WriteValueBitPacked(val2, newValue);
BytePacker.WriteValueBitPacked(val2, clientId);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1157311365u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
MoveItemClientRpc(position, newValue, clientId);
}
}
}
[ClientRpc]
public void MoveItemClientRpc(Vector3 position, int newValue, ulong itemID)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3685289889u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
BytePacker.WriteValueBitPacked(val2, newValue);
BytePacker.WriteValueBitPacked(val2, itemID);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3685289889u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(itemID, out var value))
{
Landmine.SpawnExplosion(position, true, 0f, 1f, 20, 1f, (GameObject)null, false);
GameObject gameObject = ((Component)value).gameObject;
gameObject.transform.position = position;
Hmmmm hmmmm = default(Hmmmm);
if (gameObject.TryGetComponent<Hmmmm>(ref hmmmm))
{
((GrabbableObject)hmmmm).SetScrapValue(newValue);
((GrabbableObject)hmmmm).targetFloorPosition = position;
((GrabbableObject)hmmmm).FallToGround(false);
hmmmm.scanNodeProperties.scrapValue = newValue;
}
}
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_Networker()
{
//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(1157311365u, new RpcReceiveHandler(__rpc_handler_1157311365));
NetworkManager.__rpc_func_table.Add(3685289889u, new RpcReceiveHandler(__rpc_handler_3685289889));
}
private static void __rpc_handler_1157311365(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0030: 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_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
Vector3 position = default(Vector3);
((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
int newValue = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref newValue);
ulong clientId = default(ulong);
ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
target.__rpc_exec_stage = (__RpcExecStage)1;
((Networker)(object)target).MoveItemServerRpc(position, newValue, clientId);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3685289889(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0030: 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_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
Vector3 position = default(Vector3);
((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
int newValue = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref newValue);
ulong itemID = default(ulong);
ByteUnpacker.ReadValueBitPacked(reader, ref itemID);
target.__rpc_exec_stage = (__RpcExecStage)2;
((Networker)(object)target).MoveItemClientRpc(position, newValue, itemID);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "Networker";
}
}
[BepInPlugin("Slayer6409.SlayersSillyStuff", "SlayersSillyStuff", "0.0.3")]
public class Plugin : BaseUnityPlugin
{
private const string modGUID = "Slayer6409.SlayersSillyStuff";
private const string modName = "SlayersSillyStuff";
private const string modVersion = "0.0.3";
public static GameObject NetworkerPrefab;
private readonly Harmony harmony = new Harmony("Slayer6409.SlayersSillyStuff");
public static Item Hmmm;
public static ManualLogSource Log;
public static ConfigFile BepInExConfig = null;
public static AssetBundle LoadedAssets;
public static Dictionary<string, LevelTypes> RegLevels = new Dictionary<string, LevelTypes>
{
{
"Experimentation",
(LevelTypes)4
},
{
"Assurance",
(LevelTypes)8
},
{
"Vow",
(LevelTypes)16
},
{
"Offense",
(LevelTypes)32
},
{
"March",
(LevelTypes)64
},
{
"Rend",
(LevelTypes)128
},
{
"Dine",
(LevelTypes)256
},
{
"Titan",
(LevelTypes)512
},
{
"Adamance",
(LevelTypes)2048
},
{
"Artifice",
(LevelTypes)4096
},
{
"Embrion",
(LevelTypes)8192
}
};
private List<Item> AddedScrap = new List<Item>();
private void Awake()
{
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin SlayersSillyStuff is loaded!");
NetcodeWeaver();
LoadedAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "slayerssillystuff"));
NetworkerPrefab = LoadedAssets.LoadAsset<GameObject>("Networker");
NetworkerPrefab.AddComponent<Networker>();
BepInExConfig = new ConfigFile(Path.Combine(Paths.ConfigPath, "Slayers Silly Scrap.cfg"), true);
LoadScrap();
harmony.PatchAll();
}
internal void LoadScrap()
{
//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
Hmmm = LoadedAssets.LoadAsset<Item>("HmmmItem");
Hmmm.minValue = 110;
Hmmm.maxValue = 350;
Hmmmm hmmmm = Hmmm.spawnPrefab.AddComponent<Hmmmm>();
((GrabbableObject)hmmmm).grabbable = true;
((GrabbableObject)hmmmm).grabbable = true;
((GrabbableObject)hmmmm).itemProperties = Hmmm;
AddedScrap.Add(Hmmm);
Dictionary<(string, string), int> dictionary = new Dictionary<(string, string), int>
{
{
(Hmmm.itemName, "Default"),
12
},
{
(Hmmm.itemName, "Experimentation"),
8
},
{
(Hmmm.itemName, "Assurance"),
12
},
{
(Hmmm.itemName, "Vow"),
11
},
{
(Hmmm.itemName, "Offense"),
14
},
{
(Hmmm.itemName, "March"),
18
},
{
(Hmmm.itemName, "Rend"),
20
},
{
(Hmmm.itemName, "Dine"),
22
},
{
(Hmmm.itemName, "Titan"),
24
},
{
(Hmmm.itemName, "Adamance"),
11
},
{
(Hmmm.itemName, "Artifice"),
13
},
{
(Hmmm.itemName, "Embrion"),
28
}
};
foreach (Item item in AddedScrap)
{
NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab);
Utilities.FixMixerGroups(item.spawnPrefab);
}
foreach (Item item2 in AddedScrap)
{
ConfigEntry<int> val = BepInExConfig.Bind<int>(item2.itemName + " Spawn rates", "Default", dictionary[(item2.itemName, "Default")], "Default spawn rate for all levels");
foreach (KeyValuePair<string, LevelTypes> regLevel in RegLevels)
{
ConfigEntry<int> val2 = BepInExConfig.Bind<int>(item2.itemName + " Spawn rates", regLevel.Key, dictionary[(item2.itemName, regLevel.Key)], "Sets how often " + item2.itemName + " spawns on " + regLevel.Key);
Items.RegisterScrap(item2, val2.Value, regLevel.Value);
}
Items.RegisterScrap(item2, val.Value, (LevelTypes)(-1));
}
}
private static void NetcodeWeaver()
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
}
public class Consts
{
public const string Default = "Default";
public const string Experimentation = "Experimentation";
public const string Assurance = "Assurance";
public const string Vow = "Vow";
public const string Offense = "Offense";
public const string March = "March";
public const string Rend = "Rend";
public const string Dine = "Dine";
public const string Titan = "Titan";
public const string Adamance = "Adamance";
public const string Artifice = "Artifice";
public const string Embrion = "Embrion";
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "SlayersSillyStuff";
public const string PLUGIN_NAME = "SlayersSillyStuff";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace SlayersSillyStuff.Scrap
{
public class Hmmmm : PhysicsProp
{
public PlayerControllerB PlayerUser = null;
public ScanNodeProperties scanNodeProperties;
public override void Start()
{
scanNodeProperties = ((Component)this).GetComponentInChildren<ScanNodeProperties>();
((GrabbableObject)this).Start();
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (!buttonDown || (Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.inShipPhase || !StartOfRound.Instance.shipHasLanded || (Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null)
{
return;
}
PlayerUser = ((GrabbableObject)this).playerHeldBy;
GameNetworkManager.Instance.localPlayerController.DiscardHeldObject(true, (NetworkObject)null, ((GrabbableObject)this).GetItemFloorPosition(((Component)this).transform.position), false);
int newValue = ((GrabbableObject)this).scrapValue + Random.Range(40, 80);
Vector3 val = Vector3.up;
do
{
try
{
val = RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length)].transform.position;
}
catch
{
}
}
while (val == Vector3.up);
((GrabbableObject)this).targetFloorPosition = val;
Networker.Instance.MoveItemServerRpc(val, newValue, ((NetworkBehaviour)this).NetworkObjectId);
}
protected override void __initializeVariables()
{
((PhysicsProp)this).__initializeVariables();
}
protected internal override string __getTypeName()
{
return "Hmmmm";
}
}
}
namespace SlayersSillyStuff.Patches
{
[HarmonyPatch(typeof(GameNetworkManager))]
internal class GameNetworkManagerPatch
{
[HarmonyPostfix]
[HarmonyPatch("Start")]
public static void AddPrefab(ref GameNetworkManager __instance)
{
((Component)__instance).GetComponent<NetworkManager>().AddNetworkPrefab(Plugin.NetworkerPrefab);
}
}
[HarmonyPatch(typeof(StartOfRound))]
internal class StartOfRoundPatch
{
[HarmonyPostfix]
[HarmonyPatch("Start")]
public static void InstantiateNetworker(StartOfRound __instance)
{
//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)
if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
{
GameObject val = Object.Instantiate<GameObject>(Plugin.NetworkerPrefab, Vector3.zero, Quaternion.identity);
val.GetComponent<NetworkObject>().Spawn(true);
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}