using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using NoTitanGiants.Patches;
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 = "")]
[assembly: AssemblyCompany("NoTitanGiants")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Prevents Forest Giants spawns on the planet Titan.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NoTitanGiants")]
[assembly: AssemblyTitle("NoTitanGiants")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace NoTitanGiants
{
[BepInPlugin("NoTitanGiants", "NoTitanGiants", "1.0.0")]
public class TitanPlugin : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("NoTitanGiants");
private static TitanPlugin Instance;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin NoTitanGiants is loaded!");
harmony.PatchAll(typeof(TitanPlugin));
harmony.PatchAll(typeof(RoundManagerTPatch));
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "NoTitanGiants";
public const string PLUGIN_NAME = "NoTitanGiants";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace NoTitanGiants.Patches
{
[HarmonyPatch(typeof(RoundManager))]
internal class RoundManagerTPatch
{
public static string GIANT_NAME = "ForestGiant";
public static string TITAN_NAME = "8 Titan";
internal static ManualLogSource logs = Logger.CreateLogSource("NoTitanGiants");
[HarmonyPatch("GenerateNewFloor")]
[HarmonyPostfix]
private static void RemoveTitansFromSpawnTable(ref SelectableLevel ___currentLevel)
{
if (___currentLevel.PlanetName != TITAN_NAME)
{
return;
}
List<SpawnableEnemyWithRarity> outsideEnemies = ___currentLevel.OutsideEnemies;
int num = -1;
for (int i = 0; i < outsideEnemies.Count; i++)
{
logs.LogMessage((object)outsideEnemies[i].enemyType.enemyName);
if (outsideEnemies[i].enemyType.enemyName == GIANT_NAME)
{
num = i;
break;
}
}
if (num > -1)
{
logs.LogInfo((object)$"Removing the giant at index {num}");
outsideEnemies.RemoveAt(num);
}
}
}
}