using System;
using System.Collections.Generic;
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 Fanteon.Bosses;
using Fanteon.Interface;
using Fanteon.Teleporters;
using GlobalEnums;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Fanteon")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Fanteon")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("6FE49B0E-6714-48ED-A4E9-5AC6C97F6F20")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Fanteon
{
[BepInPlugin("nsky.fanteon", "Fanteon", "1.0.0")]
public class FanteonMain : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("nsky.fanteon");
private static ManualLogSource logger;
private static Vector3 savedLoction;
private ConfigEntry<KeyCode> modifierBench;
private ConfigEntry<KeyCode> turnOff;
private ConfigEntry<KeyCode> modifier;
private ConfigEntry<KeyCode> phantom;
private ConfigEntry<KeyCode> trobbio;
private ConfigEntry<KeyCode> firstWeaver;
private ConfigEntry<KeyCode> antQueen;
private ConfigEntry<KeyCode> DrillOne;
private ConfigEntry<KeyCode> DrillTwo;
private void Awake()
{
modifierBench = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "ModifierAltBench", (KeyCode)308, "Alt key");
modifier = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "ModifierCtrlBoss", (KeyCode)306, "Ctrl key");
turnOff = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "TurnOff", (KeyCode)48, "number 0");
phantom = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "Phantom", (KeyCode)49, "number 1");
firstWeaver = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "FirstWeaver", (KeyCode)50, "number 2");
antQueen = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "AntQueen", (KeyCode)51, "number 3");
DrillOne = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "DrillOne", (KeyCode)52, "number 4");
DrillTwo = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "DrillTwo", (KeyCode)53, "number 5");
trobbio = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keybinds", "Trobbio", (KeyCode)54, "number 6");
harmony.PatchAll();
BossController.logger = ((BaseUnityPlugin)this).Logger;
logger = ((BaseUnityPlugin)this).Logger;
Debug.Log((object)"FanteonMain Awake");
}
private void Update()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: 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_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_024b: Unknown result type (might be due to invalid IL or missing references)
//IL_021a: Unknown result type (might be due to invalid IL or missing references)
//IL_0293: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Unknown result type (might be due to invalid IL or missing references)
//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
//IL_0323: Unknown result type (might be due to invalid IL or missing references)
//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
//IL_036b: Unknown result type (might be due to invalid IL or missing references)
//IL_033a: Unknown result type (might be due to invalid IL or missing references)
//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
//IL_0382: Unknown result type (might be due to invalid IL or missing references)
//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
if (UnityInput.Current.GetKey(modifierBench.Value) && UnityInput.Current.GetKey(phantom.Value))
{
BossController.TurnOn(new Phantom().BoolPropertyName);
BossController.Teleport(new Phantom(), Bench: true);
}
if (UnityInput.Current.GetKey(modifier.Value) && UnityInput.Current.GetKey(phantom.Value))
{
BossController.TurnOn(new Phantom().BoolPropertyName);
BossController.Teleport(new Phantom(), Bench: false);
}
if (UnityInput.Current.GetKey(modifierBench.Value) && UnityInput.Current.GetKey(firstWeaver.Value))
{
BossController.TurnOn(new FirstWeaver().BoolPropertyName);
BossController.Teleport(new FirstWeaver(), Bench: true);
}
if (UnityInput.Current.GetKey(modifier.Value) && UnityInput.Current.GetKey(firstWeaver.Value))
{
BossController.TurnOn(new FirstWeaver().BoolPropertyName);
BossController.Teleport(new FirstWeaver(), Bench: false);
}
if (UnityInput.Current.GetKey(modifierBench.Value) && UnityInput.Current.GetKey(antQueen.Value))
{
BossController.TurnOn(new AntQueen().BoolPropertyName);
BossController.Teleport(new AntQueen(), Bench: true);
}
if (UnityInput.Current.GetKey(modifier.Value) && UnityInput.Current.GetKey(antQueen.Value))
{
BossController.TurnOn(new AntQueen().BoolPropertyName);
BossController.Teleport(new AntQueen(), Bench: false);
}
if (UnityInput.Current.GetKey(modifierBench.Value) && UnityInput.Current.GetKey(DrillOne.Value))
{
BossController.TurnOn(new DrillOne().BoolPropertyName);
BossController.Teleport(new DrillOne(), Bench: true);
}
if (UnityInput.Current.GetKey(modifier.Value) && UnityInput.Current.GetKey(DrillOne.Value))
{
BossController.TurnOn(new DrillOne().BoolPropertyName);
BossController.Teleport(new DrillOne(), Bench: false);
}
if (UnityInput.Current.GetKey(modifierBench.Value) && UnityInput.Current.GetKey(DrillTwo.Value))
{
BossController.TurnOn(new DrillTwo().BoolPropertyName);
BossController.Teleport(new DrillTwo(), Bench: true);
}
if (UnityInput.Current.GetKey(modifier.Value) && UnityInput.Current.GetKey(DrillTwo.Value))
{
BossController.TurnOn(new DrillTwo().BoolPropertyName);
BossController.Teleport(new DrillTwo(), Bench: false);
}
if (UnityInput.Current.GetKey(modifierBench.Value) && UnityInput.Current.GetKey(trobbio.Value))
{
BossController.TurnOn(new Trobbio().BoolPropertyName);
BossController.Teleport(new Trobbio(), Bench: true);
}
if (UnityInput.Current.GetKey(modifier.Value) && UnityInput.Current.GetKey(trobbio.Value))
{
BossController.TurnOn(new Trobbio().BoolPropertyName);
BossController.Teleport(new Trobbio(), Bench: false);
}
if (UnityInput.Current.GetKey(modifier.Value) && UnityInput.Current.GetKeyDown(turnOff.Value))
{
BossController.TurnOff(new Phantom().BoolPropertyName);
BossController.TurnOff(new Trobbio().BoolPropertyName);
BossController.TurnOff(new FirstWeaver().BoolPropertyName);
BossController.TurnOff(new AntQueen().BoolPropertyName);
}
if (UnityInput.Current.GetKey(modifierBench.Value) && UnityInput.Current.GetKeyDown(turnOff.Value))
{
GetLocation();
}
}
private void GetLocation()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: 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)
//IL_003b: 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)
try
{
Vector3 position = ((Component)HeroController.instance).transform.position;
string sceneName = GameManager.instance.sceneName;
string entryGateName = GameManager.instance.entryGateName;
logger.LogInfo((object)$"POS {position.x}, {position.y}, {position.z}");
logger.LogInfo((object)("gate " + entryGateName));
logger.LogInfo((object)("scene " + sceneName));
}
catch (Exception arg)
{
logger.LogError((object)$"GetLocation error: {arg}");
}
}
}
}
namespace Fanteon.Teleporters
{
public static class BossController
{
public static ManualLogSource logger;
public static BossesBool BossesBool { get; set; } = new BossesBool();
public static void TurnOn(string name)
{
BossesBool.SetValue(PlayerData.instance, name, value: false);
}
public static void TurnOff(string name)
{
BossesBool.SetValue(PlayerData.instance, name, value: true);
}
public static void Teleport(IBoss Boss, bool Bench)
{
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: 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_0107: Expected O, but got Unknown
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: 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_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: 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_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
try
{
if (PlayerData.instance.atBench)
{
return;
}
if (!Bench)
{
if (GameManager.instance.sceneName != Boss.Location)
{
SceneLoadInfo val = new SceneLoadInfo
{
SceneName = Boss.Location,
EntryGateName = Boss.LocationGate,
HeroLeaveDirection = (GatePosition)5,
EntryDelay = 0f,
Visualization = (SceneLoadVisualizations)0,
AlwaysUnloadUnusedAssets = true,
IsFirstLevelForPlayer = false
};
GameManager.instance.BeginSceneTransition(val);
TurnOn(Boss.BoolPropertyName);
}
else
{
HeroController.instance.Teleport(Boss.BossCoords);
}
}
else if (GameManager.instance.sceneName != Boss.BenchLocation)
{
SceneLoadInfo val2 = new SceneLoadInfo
{
SceneName = Boss.BenchLocation,
EntryGateName = Boss.BenchGate,
HeroLeaveDirection = (GatePosition)5,
EntryDelay = 0f,
Visualization = (SceneLoadVisualizations)0,
AlwaysUnloadUnusedAssets = true,
IsFirstLevelForPlayer = false
};
GameManager.instance.BeginSceneTransition(val2);
TurnOn(Boss.BoolPropertyName);
}
else
{
HeroController.instance.Teleport(Boss.BenchCoords);
}
}
catch (Exception arg)
{
logger.LogError((object)$"TeleportBoss error: {arg}");
}
}
}
public static class TeleportExtension
{
public static void Teleport(this HeroController hero, Vector3 position)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
((Component)hero).transform.position = position;
if (hero.cState != null)
{
hero.cState.recoiling = false;
hero.cState.transitioning = false;
}
}
}
}
namespace Fanteon.Interface
{
public interface IBoss
{
string Location { get; set; }
string BenchLocation { get; set; }
string LocationGate { get; set; }
string BenchGate { get; set; }
string BoolPropertyName { get; set; }
Vector3 BossCoords { get; set; }
Vector3 BenchCoords { get; set; }
}
}
namespace Fanteon.Damage
{
[HarmonyPatch(typeof(HeroBox), "TakeDamageFromDamager")]
public static class TakeDamagePatcher
{
[HarmonyPrefix]
private static void TakeDamagePatch(ref DamageHero damageHero, GameObject damagingObject, ref int ___damageDealt, ref HazardType ___hazardType, ref DamageHero ___lastDamageHero, ref GameObject ___lastDamagingObject, ref CollisionSide ___collisionSide, ref DamagePropertyFlags ___damagePropertyFlags, ref bool ___isHitBuffered)
{
try
{
if ((Object)(object)damageHero == (Object)null || !damageHero.CanCauseDamage)
{
return;
}
Debug.Log((object)("Damaged by hero: " + ((Object)damageHero).name));
int num = (((Behaviour)damageHero).enabled ? damageHero.damageDealt : 0);
if (num > 1)
{
if (num > 2)
{
Debug.Log((object)$"Capping damage from {num} to 1 from {((Object)damagingObject).name}");
}
damageHero.damageDealt = 1;
}
}
catch (Exception ex)
{
Debug.LogException(ex);
Debug.Log((object)"Exception when Damaged by hero");
}
}
}
[HarmonyPatch(typeof(PlayerData), "TakeHealth")]
public static class TakeHealthPatcher
{
[HarmonyPrefix]
private static void TakeHealthPatch(ref int amount, PlayerData __instance)
{
try
{
if (__instance != null && amount > 0 && amount < __instance.maxHealth)
{
amount = 1;
}
Debug.Log((object)"Damaged by something");
}
catch (Exception ex)
{
Debug.Log((object)"Exception when Damaged by something");
Debug.LogException(ex);
}
}
}
}
namespace Fanteon.Bosses
{
public class AntQueen : IBoss
{
public string Location { get; set; } = "Ant_Queen";
public string BenchLocation { get; set; } = "Bone_East_27";
public string LocationGate { get; set; } = "left1";
public string BenchGate { get; set; } = "left1";
public string BoolPropertyName { get; set; } = "defeatedAntQueen";
public Vector3 BossCoords { get; set; } = new Vector3(29.04369f, 21.56768f, 0.004f);
public Vector3 BenchCoords { get; set; } = new Vector3(24.37014f, 47.62621f, 0.004f);
}
public class BossesBool
{
private List<string> Bosses { get; set; } = new List<string> { "defeatedPhantom", "defeatedFirstWeaver", "defeatedAntQueen", "defeatedTrobbio", "defeatedCoralDrillerSolo", "defeatedCoralDrillers" };
public void SetValue(PlayerData instance, string name, bool value)
{
switch (name)
{
case "defeatedPhantom":
instance.defeatedPhantom = value;
break;
case "defeatedFirstWeaver":
instance.defeatedFirstWeaver = value;
break;
case "defeatedAntQueen":
instance.defeatedAntQueen = value;
break;
case "defeatedTrobbio":
instance.defeatedTrobbio = value;
break;
case "defeatedCoralDrillerSolo":
if (value)
{
instance.defeatedCoralDrillers = false;
}
instance.defeatedCoralDrillerSolo = value;
break;
case "defeatedCoralDrillers":
if (value)
{
instance.defeatedCoralDrillerSolo = true;
}
instance.defeatedCoralDrillers = value;
break;
}
}
public bool GetValue(PlayerData instance, string name)
{
return name switch
{
"defeatedPhantom" => instance.defeatedPhantom,
"defeatedFirstWeaver" => instance.defeatedFirstWeaver,
"defeatedAntQueen" => instance.defeatedAntQueen,
"defeatedTrobbio" => instance.defeatedTrobbio,
"defeatedCoralDrillerSolo" => instance.defeatedCoralDrillerSolo,
"defeatedCoralDrillers" => instance.defeatedCoralDrillers,
_ => false,
};
}
}
public class DrillOne : IBoss
{
public string Location { get; set; } = "Coral_11";
public string BenchLocation { get; set; } = "Bellway_08";
public string LocationGate { get; set; } = "right1";
public string BenchGate { get; set; } = "left1";
public string BoolPropertyName { get; set; } = "defeatedCoralDrillerSolo";
public Vector3 BossCoords { get; set; } = new Vector3(74.47978f, 14.56769f, 0.004f);
public Vector3 BenchCoords { get; set; } = new Vector3(120.61f, 13.56769f, 0.004f);
}
public class DrillTwo : IBoss
{
public string Location { get; set; } = "Coral_27";
public string BenchLocation { get; set; } = "Bellway_08";
public string LocationGate { get; set; } = "right1";
public string BenchGate { get; set; } = "left1";
public string BoolPropertyName { get; set; } = "defeatedCoralDrillers";
public Vector3 BossCoords { get; set; } = new Vector3(42.01044f, 33.56768f, 0.004f);
public Vector3 BenchCoords { get; set; } = new Vector3(120.61f, 13.56769f, 0.004f);
}
public class FirstWeaver : IBoss
{
public string Location { get; set; } = "Slab_10c";
public string BenchLocation { get; set; } = "Slab_06";
public string LocationGate { get; set; } = "left1";
public string BenchGate { get; set; } = "top1";
public string BoolPropertyName { get; set; } = "defeatedFirstWeaver";
public Vector3 BossCoords { get; set; } = new Vector3(22.20576f, 12.5633f, 0.004f);
public Vector3 BenchCoords { get; set; } = new Vector3(92.18942f, 9.567685f, 0.004f);
}
public class Phantom : IBoss
{
public string Location { get; set; } = "Organ_01";
public string BenchLocation { get; set; } = "Organ_01";
public string LocationGate { get; set; } = "left1";
public string BenchGate { get; set; } = "left1";
public string BoolPropertyName { get; set; } = "defeatedPhantom";
public Vector3 BossCoords { get; set; } = new Vector3(102.0242f, 104.5677f, 0.004f);
public Vector3 BenchCoords { get; set; } = new Vector3(52.455f, 31.56768f, 0.004f);
}
public class Trobbio : IBoss
{
public string Location { get; set; } = "Library_13";
public string BenchLocation { get; set; } = "Song_20";
public string LocationGate { get; set; } = "left1";
public string BenchGate { get; set; } = "right6";
public string BoolPropertyName { get; set; } = "defeatedTrobbio";
public Vector3 BossCoords { get; set; } = new Vector3(54.53138f, 14.56769f, 0.004f);
public Vector3 BenchCoords { get; set; } = new Vector3(42.66294f, 10.56769f, 0.004f);
}
}