using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using AbsoluteCompany.patches;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LethalLib.Modules;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("AbsoluteCompany")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AbsoluteCompany")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5f1c6734-fcbd-4d3b-a7cf-c7cdf5a921c2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AbsoluteCompany
{
[BepInPlugin("Absolutelyaya.AbsoluteCompany", "AbsoluteCompany", "1.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class AbsoluteCompanyMod : BaseUnityPlugin
{
private const string guid = "Absolutelyaya.AbsoluteCompany";
private const string modName = "AbsoluteCompany";
private const string modVersion = "1.0.1";
private readonly Harmony harmony = new Harmony("Absolutelyaya.AbsoluteCompany");
private static AbsoluteCompanyMod Instance;
public static ManualLogSource logger;
public static AssetBundle Assets;
private ConfigEntry<int> configFlorpRarity;
private void Awake()
{
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Expected O, but got Unknown
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
logger = Logger.CreateLogSource("AbsoluteCompany");
logger.LogInfo((object)"Absolutely Initialized.");
Assets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "absolute"));
configFlorpRarity = ((BaseUnityPlugin)this).Config.Bind<int>("Scrap", "FlorpRarity", 30, new ConfigDescription("How rare Florp is. Lower == Less Spawns.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
RegisterScrap("florp");
harmony.PatchAll(typeof(EnemyPatches));
harmony.PatchAll(typeof(TerminalPatches));
}
private void RegisterScrap(string id)
{
Item val = AbsoluteCompanyMod.loadAsset<Item>(id + ".asset");
if (!((Object)(object)val == (Object)null))
{
NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
Items.RegisterScrap(val, configFlorpRarity.Value, (LevelTypes)(-1));
logger.LogInfo((object)$"registered Scrap '{id}'.");
}
}
public static T loadAsset<T>(string id) where T : Object
{
T val = Assets.LoadAsset<T>($"assets/{id}");
if ((Object)(object)val == (Object)null)
{
logger.LogError((object)$"Failed to load asset for '{id}'");
return default(T);
}
return val;
}
}
}
namespace AbsoluteCompany.patches
{
[HarmonyPatch]
internal class EnemyPatches
{
[HarmonyPatch(typeof(SpringManAI), "__initializeVariables")]
[HarmonyPostfix]
public static void CreateMannequinModel(SpringManAI __instance)
{
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
Transform val = ((Component)__instance).transform.Find("SpringManModel");
Transform val2 = ((Component)val).transform.Find("Head");
Transform val3 = ((Component)val).transform.Find("Body");
Renderer[] componentsInChildren = ((Component)val2).GetComponentsInChildren<Renderer>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
componentsInChildren[i].enabled = false;
}
componentsInChildren = ((Component)val3).GetComponentsInChildren<Renderer>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
componentsInChildren[i].enabled = false;
}
Animator[] componentsInChildren2 = ((Component)val).GetComponentsInChildren<Animator>();
for (int i = 0; i < componentsInChildren2.Length; i++)
{
((Behaviour)componentsInChildren2[i]).enabled = false;
}
((Component)val).GetComponentInChildren<ScanNodeProperties>().headerText = "Mannequin";
GameObject val4 = AbsoluteCompanyMod.loadAsset<GameObject>("prefabs/springmannequinmodel.prefab");
if (!((Object)(object)val4 == (Object)null))
{
GameObject val5 = Object.Instantiate<GameObject>(val4, ((Component)__instance).gameObject.transform);
((Object)val5).name = "SpringMannequinModel";
val5.transform.Rotate(new Vector3(0f, 90f, 0f), (Space)1);
Animator val6 = (((EnemyAI)__instance).creatureAnimator = val5.GetComponentInChildren<Animator>());
__instance.animStopPoints = val5.GetComponentInChildren<AnimationStopPoints>();
val6.Rebind();
}
}
}
[HarmonyPatch]
internal class TerminalPatches
{
[HarmonyPatch(typeof(Terminal), "Awake")]
[HarmonyPostfix]
public static void EditTerminal(Terminal __instance)
{
__instance.enemyFiles[7].creatureName = "Mannequin";
__instance.enemyFiles[7].displayText = "Type: Lesser Demon\r\n\r\nDuring the departure of the angels after the Disappearance of God, many sinners attempted to escape the Violence layer, braving the labyrinth that lay at its edges, thinking they could find a way out in the absence of Heaven's wardens.\r\n\r\nThe fools who attempted would realize far too late that angels were not all that kept them from freedom, as the Garden of forking Paths is no ordinary labyrinth, but with malicious intent, overseen with cunning cruelty.\r\n\r\nThe halls, similar enough to give no sense of direction, but different enough to grant no familiarity, would eventually exhaust each escapee, and as they fell into a deep sleep, their metamorphosis began.\r\n\r\nEach sinner was torn apart joint by joint, their broken and shattered limbs shoved into hollow statues, starting them to life as the flesh and blood of Mannequins.\r\n\r\nThe gift of death is a rare privilege in Hell, so sinners who attempted to control their fate now lie in eternal agony, unable to now control even their own bodies, which now continue to carry on the same punishment to other unfortunate fools.\r\n\r\nThas fukced up - Sigurd";
__instance.terminalNodes.allKeywords[46].word = "mannequin";
}
}
}