using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LC_Spooders.Patches;
using Unity.Netcode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("LC_Spooders")]
[assembly: AssemblyDescription("LC_Spooders")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("STAR-B")]
[assembly: AssemblyProduct("LC_Spooders")]
[assembly: AssemblyCopyright("Copyright © STAR-B 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("da07515e-c8ad-420f-bbe5-ccf3944204d2")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.1.0")]
namespace LC_Spooders
{
internal class Config
{
private static ConfigFile ConfigFile { get; set; }
internal static ConfigEntry<int> SpooderHealth { get; set; }
internal static ConfigEntry<int> SpooderAttackDamage { get; set; }
static Config()
{
}
}
[BepInPlugin("STAR-B.LC_Spooders", "LC Spooders", "1.0.1")]
public class Plugin : BaseUnityPlugin
{
public void Awake()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
ManualLogSource obj = Logger.CreateLogSource("STAR-B.LC_Spooders");
LevelEnemiesPatch.Init(obj);
SandSpiderAIPatch.Init(obj);
Harmony val = new Harmony("STAR-B.LC_Spooders");
val.PatchAll(typeof(LevelEnemiesPatch));
val.PatchAll(typeof(SandSpiderAIPatch));
obj.LogInfo((object)"LC Spooders has loaded!");
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "STAR-B.LC_Spooders";
public const string PLUGIN_NAME = "LC Spooders";
public const string PLUGIN_VERSION = "1.0.1";
}
}
namespace LC_Spooders.Patches
{
[HarmonyPatch(typeof(RoundManager))]
internal static class LevelEnemiesPatch
{
private static ManualLogSource Logger { get; set; }
public static void Init(ManualLogSource logger)
{
Logger = logger;
}
[HarmonyPatch("BeginEnemySpawning")]
[HarmonyPrefix]
private static void BeginEnemySpawning(RoundManager __instance)
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
Logger.LogInfo((object)"BEGIN EMEMY SPAWNING");
if (!((NetworkBehaviour)__instance).IsServer)
{
return;
}
__instance.currentLevel.maxEnemyPowerCount = 8;
__instance.currentLevel.enemySpawnChanceThroughoutDay = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 100f),
new Keyframe(1f, 100f)
});
__instance.currentLevel.spawnProbabilityRange = 1f;
SpawnableEnemyWithRarity spider = null;
__instance.currentLevel.Enemies.ForEach(delegate(SpawnableEnemyWithRarity enemy)
{
if (enemy.enemyType.enemyName.ToLower().Contains("spider"))
{
spider = enemy;
}
});
if (spider != null)
{
spider.rarity = 999;
spider.enemyType.MaxCount = 999;
spider.enemyType.PowerLevel = 1;
__instance.currentLevel.Enemies.Clear();
__instance.currentLevel.Enemies.Add(spider);
}
}
}
[HarmonyPatch(typeof(SandSpiderAI))]
internal static class SandSpiderAIPatch
{
private static ManualLogSource Logger { get; set; }
public static void Init(ManualLogSource logger)
{
Logger = logger;
}
[HarmonyPatch("HitEnemy")]
[HarmonyPrefix]
private static void HitEnemy(SandSpiderAI __instance, ref int force)
{
force = ((EnemyAI)__instance).enemyHP;
}
[HarmonyPatch("OnCollideWithPlayer")]
[HarmonyPrefix]
private static bool OnCollideWithPlayer(SandSpiderAI __instance, Collider other, bool ___onWall, ref float ___timeSinceHittingPlayer, bool ___spoolingPlayerBody)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
if (!((EnemyAI)__instance).isEnemyDead && !___onWall && ___timeSinceHittingPlayer > 1f)
{
PlayerControllerB val = ((EnemyAI)__instance).MeetsStandardPlayerCollisionConditions(other, ___spoolingPlayerBody, true);
if ((Object)(object)val != (Object)null)
{
int num = 20;
___timeSinceHittingPlayer = 0f;
val.DamagePlayer(num, true, true, (CauseOfDeath)6, 0, false, default(Vector3));
__instance.HitPlayerServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId);
}
}
return false;
}
}
}