Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of AuditDepartment v1.0.0
AuditDepartment.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using AuditDepartment.Artifacts; using AuditDepartment.Items; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using On.RoR2; using R2API; using RoR2; using RoR2.ExpansionManagement; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.Rendering; [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("AuditDepartment")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+947fe8c0727e30df0632b0d4d3ff7b12c6bc74a8")] [assembly: AssemblyProduct("AuditDepartment")] [assembly: AssemblyTitle("AuditDepartment")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 AuditDepartment { internal static class Assets { private static GameObject prefabHolder; internal static Transform PrefabHolder { get { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)prefabHolder)) { prefabHolder = new GameObject("AuditDepartmentPrefabHolder"); Object.DontDestroyOnLoad((Object)(object)prefabHolder); prefabHolder.SetActive(false); } return prefabHolder.transform; } } internal static void SetItemTier(ItemDef def, ItemTier tier) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) typeof(ItemDef).GetField("deprecatedTier", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(def, tier); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate { //IL_0002: Unknown result type (might be due to invalid IL or missing references) ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef(tier); if (Object.op_Implicit((Object)(object)itemTierDef)) { typeof(ItemDef).GetField("_itemTierDef", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(def, itemTierDef); } }); } internal static ItemDef CreateItemDef(string name, string tokenBase, ItemTier tier, Sprite icon, GameObject model, ItemTag[] tags, bool canRemove = true) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) ItemDef val = ScriptableObject.CreateInstance<ItemDef>(); ((Object)val).name = name; val.nameToken = tokenBase + "_NAME"; val.pickupToken = tokenBase + "_PICKUP"; val.descriptionToken = tokenBase + "_DESC"; val.loreToken = tokenBase + "_LORE"; val.canRemove = canRemove; val.hidden = false; val.tags = tags; val.pickupIconSprite = icon; val.pickupModelPrefab = model; SetItemTier(val, tier); return val; } private static byte[] ReadResource(string resourceName) { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName); if (stream == null) { return null; } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); return memoryStream.ToArray(); } internal static Texture2D LoadRawTexture(string resourceName, int size) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown try { byte[] array = ReadResource(resourceName); if (array == null || array.Length != size * size * 4) { return null; } Texture2D val = new Texture2D(size, size, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1 }; val.LoadRawTextureData(array); val.Apply(); return val; } catch (Exception arg) { Log.Error($"Failed to load texture '{resourceName}': {arg}"); return null; } } internal static Sprite LoadSprite(string resourceName, int size) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) Texture2D val = LoadRawTexture(resourceName, size); return Object.op_Implicit((Object)(object)val) ? Sprite.Create(val, new Rect(0f, 0f, (float)size, (float)size), new Vector2(0.5f, 0.5f)) : null; } internal static Material CreatePickupMaterial(Color color, Texture2D mainTexture, Color emission) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) //IL_0059: Expected O, but got Unknown //IL_0053: 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_0113: Unknown result type (might be due to invalid IL or missing references) GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarCoin/PickupLunarCoin.prefab").WaitForCompletion(); Renderer val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponentInChildren<Renderer>(true) : null); Material val3 = ((Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.sharedMaterial)) ? new Material(val2.sharedMaterial) : new Material(Shader.Find("Standard"))); string[] array = new string[5] { "_MainTex", "_NormalTex", "_BumpMap", "_EmTex", "_EmissionMap" }; foreach (string text in array) { if (val3.HasProperty(text)) { val3.SetTexture(text, (Texture)(object)((!(text == "_MainTex")) ? null : (Object.op_Implicit((Object)(object)mainTexture) ? mainTexture : Texture2D.whiteTexture))); } } if (val3.HasProperty("_Color")) { val3.color = color; } if (val3.HasProperty("_EmColor")) { val3.SetColor("_EmColor", emission); } return val3; } internal static Mesh LoadObjMesh(string resourceName) { //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Expected O, but got Unknown //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) byte[] array = ReadResource(resourceName); if (array == null) { return null; } List<Vector3> positions = new List<Vector3>(); List<Vector2> texCoords = new List<Vector2>(); List<Vector3> objNormals = new List<Vector3>(); Dictionary<(int, int, int), int> vertexMap = new Dictionary<(int, int, int), int>(); List<Vector3> vertices = new List<Vector3>(); List<Vector2> uvs = new List<Vector2>(); List<Vector3> normals = new List<Vector3>(); List<int> list = new List<int>(); using (StreamReader streamReader = new StreamReader(new MemoryStream(array))) { string text; while ((text = streamReader.ReadLine()) != null) { string[] array2 = text.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (array2.Length == 0) { continue; } switch (array2[0]) { case "v": positions.Add(new Vector3(0f - float.Parse(array2[1], CultureInfo.InvariantCulture), float.Parse(array2[2], CultureInfo.InvariantCulture), float.Parse(array2[3], CultureInfo.InvariantCulture))); break; case "vt": texCoords.Add(new Vector2(float.Parse(array2[1], CultureInfo.InvariantCulture), float.Parse(array2[2], CultureInfo.InvariantCulture))); break; case "vn": objNormals.Add(new Vector3(0f - float.Parse(array2[1], CultureInfo.InvariantCulture), float.Parse(array2[2], CultureInfo.InvariantCulture), float.Parse(array2[3], CultureInfo.InvariantCulture))); break; case "f": { int item = ResolveVertex(array2[1]); int item2 = ResolveVertex(array2[2]); for (int i = 3; i < array2.Length; i++) { int num = ResolveVertex(array2[i]); list.Add(item); list.Add(num); list.Add(item2); item2 = num; } break; } } } } Mesh val = new Mesh { indexFormat = (IndexFormat)1 }; val.SetVertices(vertices); val.SetUVs(0, uvs); val.SetNormals(normals); val.SetTriangles(list, 0); val.RecalculateBounds(); return val; int ResolveVertex(string token) { //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) string[] array3 = token.Split('/'); int num2 = int.Parse(array3[0], CultureInfo.InvariantCulture); int num3 = ((array3.Length > 1 && array3[1].Length > 0) ? int.Parse(array3[1], CultureInfo.InvariantCulture) : 0); int num4 = ((array3.Length > 2 && array3[2].Length > 0) ? int.Parse(array3[2], CultureInfo.InvariantCulture) : 0); if (num2 < 0) { num2 += positions.Count + 1; } if (num3 < 0) { num3 += texCoords.Count + 1; } if (num4 < 0) { num4 += objNormals.Count + 1; } (int, int, int) key = (num2, num3, num4); if (vertexMap.TryGetValue(key, out var value)) { return value; } value = vertices.Count; vertices.Add(positions[num2 - 1]); uvs.Add((num3 > 0) ? texCoords[num3 - 1] : Vector2.zero); normals.Add((num4 > 0) ? objNormals[num4 - 1] : Vector3.up); vertexMap[key] = value; return value; } } internal static GameObject CreatePickupModel(string name, string objResource, string textureResource, int textureSize, float targetSize, Func<GameObject> fallback = null) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) try { Mesh val = LoadObjMesh(objResource); if ((Object)(object)val == (Object)null) { Log.Warning("Model resource '" + objResource + "' missing; using fallback model for " + name + "."); return (fallback != null) ? fallback() : MysteryModel(); } Texture2D mainTexture = LoadRawTexture(textureResource, textureSize); GameObject val2 = new GameObject(name); val2.transform.SetParent(PrefabHolder); val2.AddComponent<MeshFilter>().mesh = val; ((Renderer)val2.AddComponent<MeshRenderer>()).material = CreatePickupMaterial(Color.white, mainTexture, Color.black); float[] array = new float[3]; Bounds bounds = val.bounds; array[0] = ((Bounds)(ref bounds)).size.x; bounds = val.bounds; array[1] = ((Bounds)(ref bounds)).size.y; bounds = val.bounds; array[2] = ((Bounds)(ref bounds)).size.z; float num = Mathf.Max(array); if (num > 0f) { val2.transform.localScale = Vector3.one * (targetSize / num); } return val2; } catch (Exception arg) { Log.Error($"Failed to build pickup model {name}: {arg}"); return (fallback != null) ? fallback() : MysteryModel(); } } internal static GameObject MysteryModel() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) return Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mystery/PickupMystery.prefab").WaitForCompletion(); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Isaac_Cummings.AuditDepartment", "AuditDepartment", "1.0.0")] public class AuditDepartmentPlugin : BaseUnityPlugin { public const string PluginGUID = "Isaac_Cummings.AuditDepartment"; public const string PluginAuthor = "Isaac_Cummings"; public const string PluginName = "AuditDepartment"; public const string PluginVersion = "1.0.0"; public static ConfigEntry<KeyboardShortcut> DebugSpawnPackKey; public void Awake() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) Log.Init(((BaseUnityPlugin)this).Logger); DebugSpawnPackKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Debug", "SpawnPackKey", new KeyboardShortcut((KeyCode)288, Array.Empty<KeyCode>()), "Drops one of each AuditDepartment item for testing (host only). Set to an empty shortcut to disable."); RedTape.Init(((BaseUnityPlugin)this).Config); LineItemVeto.Init(((BaseUnityPlugin)this).Config); HostileTakeover.Init(((BaseUnityPlugin)this).Config); StimulusPackage.Init(((BaseUnityPlugin)this).Config); OffTheBooks.Init(((BaseUnityPlugin)this).Config); ArtifactOfAusterity.Init(((BaseUnityPlugin)this).Config); DirectorHooks.Init(); Log.Info("AuditDepartment loaded."); } private void Update() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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) //IL_00ee: 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) KeyboardShortcut value = DebugSpawnPackKey.Value; if (!((KeyboardShortcut)(ref value)).IsDown() || !NetworkServer.active || !Object.op_Implicit((Object)(object)Run.instance)) { return; } LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); CharacterBody val = ((firstLocalUser != null) ? firstLocalUser.cachedBody : null); if (Object.op_Implicit((Object)(object)val)) { Log.Info("Debug: spawning AuditDepartment pack"); Vector3 forward = ((Component)val).gameObject.transform.forward; ItemDef[] array = (ItemDef[])(object)new ItemDef[5] { RedTape.Def, LineItemVeto.Def, HostileTakeover.Def, StimulusPackage.Def, OffTheBooks.Def }; for (int i = 0; i < array.Length; i++) { Vector3 val2 = Quaternion.AngleAxis(-30f + 15f * (float)i, Vector3.up) * forward; PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(array[i].itemIndex), val.corePosition + Vector3.up * 1.5f, val2 * 10f); } } } } internal static class DirectorCompat { private static FieldInfo currentMonsterCardCostField; private static bool costResolved; internal static int GetCurrentCardCost(CombatDirector director) { if (!costResolved) { costResolved = true; currentMonsterCardCostField = typeof(CombatDirector).GetField("currentMonsterCardCost", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (currentMonsterCardCostField == null) { Log.Warning("CombatDirector.currentMonsterCardCost not found; Line-Item Veto disabled."); } } return (currentMonsterCardCostField != null) ? ((int)currentMonsterCardCostField.GetValue(director)) : (-1); } } internal static class DirectorHooks { private class LedgerWaveMarker : MonoBehaviour { } [CompilerGenerated] private static class <>O { public static hook_Simulate <0>__OnSimulate; public static hook_AttemptSpawnOnTarget <1>__OnAttemptSpawnOnTarget; public static hook_TakeDamage <2>__OnTakeDamage; public static Action<CharacterBody> <3>__OnBodyStart; public static Action<DamageReport> <4>__OnCharacterDeath; public static Action<Stage> <5>__OnStageBegin; } private static Xoroshiro128Plus rng; private static float vetoReadyTime; private static readonly Dictionary<CharacterMaster, float> ledgers = new Dictionary<CharacterMaster, float>(); private static float takeoverPool; private static readonly List<CharacterMaster> hiredAllies = new List<CharacterMaster>(); private static float stimulusGoldPool; private static readonly Dictionary<CombatDirector, float> earnedThisStage = new Dictionary<CombatDirector, float>(); private static bool spawningLedgerWave; internal static void Init() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown rng = new Xoroshiro128Plus((ulong)DateTime.Now.Ticks); object obj = <>O.<0>__OnSimulate; if (obj == null) { hook_Simulate val = OnSimulate; <>O.<0>__OnSimulate = val; obj = (object)val; } CombatDirector.Simulate += (hook_Simulate)obj; object obj2 = <>O.<1>__OnAttemptSpawnOnTarget; if (obj2 == null) { hook_AttemptSpawnOnTarget val2 = OnAttemptSpawnOnTarget; <>O.<1>__OnAttemptSpawnOnTarget = val2; obj2 = (object)val2; } CombatDirector.AttemptSpawnOnTarget += (hook_AttemptSpawnOnTarget)obj2; object obj3 = <>O.<2>__OnTakeDamage; if (obj3 == null) { hook_TakeDamage val3 = OnTakeDamage; <>O.<2>__OnTakeDamage = val3; obj3 = (object)val3; } HealthComponent.TakeDamage += (hook_TakeDamage)obj3; CharacterBody.onBodyStartGlobal += OnBodyStart; GlobalEventManager.onCharacterDeathGlobal += OnCharacterDeath; Stage.onServerStageBegin += OnStageBegin; } private static void OnStageBegin(Stage stage) { ledgers.Clear(); earnedThisStage.Clear(); hiredAllies.Clear(); takeoverPool = 0f; stimulusGoldPool = 0f; vetoReadyTime = 0f; } private static int TotalStacks(ItemDef def) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 if (!Object.op_Implicit((Object)(object)def) || (int)def.itemIndex == -1) { return 0; } int num = 0; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { CharacterMaster val = (Object.op_Implicit((Object)(object)instance) ? instance.master : null); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.inventory)) { num += val.inventory.GetItemCount(def); } } return num; } private static void GiveGoldToHolders(ItemDef def, uint gold) { List<(CharacterMaster, int)> list = new List<(CharacterMaster, int)>(); int num = 0; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { CharacterMaster val = (Object.op_Implicit((Object)(object)instance) ? instance.master : null); int num2 = ((Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.inventory)) ? val.inventory.GetItemCount(def) : 0); if (num2 > 0) { list.Add((val, num2)); num += num2; } } if (num == 0 || gold == 0) { return; } uint num3 = 0u; foreach (var item3 in list) { CharacterMaster item = item3.Item1; int item2 = item3.Item2; uint num4 = (uint)((ulong)(gold * item2) / (ulong)num); item.GiveMoney(num4); num3 += num4; } if (num3 < gold) { list[0].Item1.GiveMoney(gold - num3); } } private static DirectorCard SampleAffordableCard(float budget) { ClassicStageInfo instance = ClassicStageInfo.instance; WeightedSelection<DirectorCard> val = (Object.op_Implicit((Object)(object)instance) ? instance.monsterSelection : null); if (val == null) { return null; } for (int i = 0; i < 10; i++) { DirectorCard val2 = val.Evaluate(rng.nextNormalizedFloat); if (val2 != null && Object.op_Implicit((Object)(object)val2.spawnCard) && val2.IsAvailable() && val2.cost > 0 && (float)val2.cost <= budget) { return val2; } } return null; } private static CharacterMaster SpawnCardOnTarget(DirectorCard card, CharacterBody target, TeamIndex team, float minDistance, float maxDistance) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //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_0063: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Invalid comparison between Unknown and I4 //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Invalid comparison between Unknown and I4 //IL_008c: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)DirectorCore.instance) || card == null || !Object.op_Implicit((Object)(object)target)) { return null; } DirectorPlacementRule val = new DirectorPlacementRule { placementMode = (PlacementMode)1, minDistance = minDistance, maxDistance = maxDistance, spawnOnTarget = target.coreTransform }; DirectorSpawnRequest val2 = new DirectorSpawnRequest(card.spawnCard, val, rng) { teamIndexOverride = team, ignoreTeamMemberLimit = ((int)team == 2), summonerBodyObject = (((int)team == 1) ? ((Component)target).gameObject : null) }; GameObject val3 = DirectorCore.instance.TrySpawnObject(val2); return Object.op_Implicit((Object)(object)val3) ? val3.GetComponent<CharacterMaster>() : null; } private static void OnSimulate(orig_Simulate orig, CombatDirector self, float deltaTime) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 if (!NetworkServer.active || !Object.op_Implicit((Object)(object)Run.instance) || (int)self.teamIndex != 2 || self.shouldSpawnOneWave) { orig.Invoke(self, deltaTime); return; } float monsterCredit = self.monsterCredit; orig.Invoke(self, deltaTime); float num = self.monsterCredit - monsterCredit; if (num <= 0f) { return; } int num2 = TotalStacks(StimulusPackage.Def); if (num2 > 0) { float num3 = num * StimulusPackage.BoostPerStack.Value * (float)num2; self.monsterCredit += num3; num += num3; stimulusGoldPool += num3 * StimulusPackage.KickbackGoldPerCredit.Value; PayStimulusKickback(); } if (ArtifactOfAusterity.Enabled) { earnedThisStage.TryGetValue(self, out var value); float num4 = ArtifactOfAusterity.BudgetBase.Value * (1f + ArtifactOfAusterity.BudgetDifficultyScale.Value * Run.instance.difficultyCoefficient); float num5 = num * ArtifactOfAusterity.BoostFactor.Value; float num6 = Mathf.Clamp(num4 - value, 0f, num5); self.monsterCredit += num6 - num; num = num6; earnedThisStage[self] = value + num6; if (num <= 0f) { return; } } int num7 = TotalStacks(HostileTakeover.Def); if (num7 > 0) { float num8 = Mathf.Min(HostileTakeover.SkimCap.Value, HostileTakeover.SkimPerStack.Value * (float)num7); float num9 = num * num8; self.monsterCredit -= num9; takeoverPool += num9; TrySpendTakeoverPool(num7); } } private static void PayStimulusKickback() { int num = 0; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)instance.master)) { num++; } } if (num == 0) { return; } uint num2 = (uint)(stimulusGoldPool / (float)num); if (num2 == 0) { return; } foreach (PlayerCharacterMasterController instance2 in PlayerCharacterMasterController.instances) { CharacterMaster val = (Object.op_Implicit((Object)(object)instance2) ? instance2.master : null); if (Object.op_Implicit((Object)(object)val)) { val.GiveMoney(num2); } } stimulusGoldPool -= (float)num2 * (float)num; } private static void TrySpendTakeoverPool(int totalStacks) { hiredAllies.RemoveAll((CharacterMaster master) => !Object.op_Implicit((Object)(object)master) || !Object.op_Implicit((Object)(object)master.GetBody()) || !master.GetBody().healthComponent.alive); int num = Mathf.Min(HostileTakeover.AllyCapBase.Value + totalStacks - 1, HostileTakeover.AllyCapMax.Value); if (hiredAllies.Count >= num || takeoverPool < 25f) { return; } CharacterBody val = RichestHolderBody(HostileTakeover.Def); if (!Object.op_Implicit((Object)(object)val)) { return; } DirectorCard val2 = SampleAffordableCard(takeoverPool); if (val2 == null) { return; } CharacterMaster val3 = SpawnCardOnTarget(val2, val, (TeamIndex)1, 10f, 35f); if (Object.op_Implicit((Object)(object)val3)) { takeoverPool -= val2.cost; hiredAllies.Add(val3); if (HostileTakeover.AllyLifetime.Value > 0f) { ((Component)val3).gameObject.AddComponent<MasterSuicideOnTimer>().lifeTimer = HostileTakeover.AllyLifetime.Value; } Log.Info($"Hostile Takeover hired {((Object)val2.spawnCard).name} for {val2.cost} credits ({hiredAllies.Count}/{num} on payroll)."); } } private static CharacterBody RichestHolderBody(ItemDef def) { CharacterBody result = null; int num = 0; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { CharacterMaster val = (Object.op_Implicit((Object)(object)instance) ? instance.master : null); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.inventory)) { int itemCount = val.inventory.GetItemCount(def); CharacterBody body = val.GetBody(); if (itemCount > num && Object.op_Implicit((Object)(object)body) && body.healthComponent.alive) { result = body; num = itemCount; } } } return result; } private static bool OnAttemptSpawnOnTarget(orig_AttemptSpawnOnTarget orig, CombatDirector self, Transform spawnTarget, PlacementMode placementMode) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown if (NetworkServer.active && Object.op_Implicit((Object)(object)Run.instance) && (int)self.teamIndex == 2 && !self.shouldSpawnOneWave && Run.instance.time >= vetoReadyTime) { int num = TotalStacks(LineItemVeto.Def); if (num > 0) { int currentCardCost = DirectorCompat.GetCurrentCardCost(self); if (currentCardCost >= LineItemVeto.MinVetoCost.Value) { self.monsterCredit = Mathf.Max(0f, self.monsterCredit - (float)currentCardCost); uint num2 = (uint)((float)currentCardCost * LineItemVeto.GoldPerCredit.Value); GiveGoldToHolders(LineItemVeto.Def, num2); vetoReadyTime = Run.instance.time + Mathf.Max(LineItemVeto.CooldownMin.Value, LineItemVeto.CooldownBase.Value * Mathf.Pow(LineItemVeto.CooldownStackMultiplier.Value, (float)(num - 1))); Log.Info($"Line-Item Veto: denied a {currentCardCost}-credit spawn, paid {num2} gold."); if (LineItemVeto.BroadcastVetoes.Value) { Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = $"<color=#7fdc5a>Line-Item Veto: a {currentCardCost}-credit requisition was denied. {num2} gold recovered.</color>" }); } return false; } } } return orig.Invoke(self, spawnTarget, placementMode); } private static void OnBodyStart(CharacterBody body) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Invalid comparison between Unknown and I4 //IL_00da: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !Object.op_Implicit((Object)(object)Run.instance) || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.teamComponent) || (int)body.teamComponent.teamIndex != 2) { return; } int num = 0; int num2 = 0; float num3 = RedTape.Radius.Value * RedTape.Radius.Value; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { CharacterMaster val = (Object.op_Implicit((Object)(object)instance) ? instance.master : null); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.inventory)) { continue; } CharacterBody body2 = val.GetBody(); if (Object.op_Implicit((Object)(object)body2) && body2.healthComponent.alive) { Vector3 val2 = body2.corePosition - body.corePosition; if (!(((Vector3)(ref val2)).sqrMagnitude > num3)) { num += val.inventory.GetItemCount(RedTape.Def); num2 += val.inventory.GetItemCount(OffTheBooks.Def); } } } if (num > 0) { float num4 = RedTape.DurationBase.Value + RedTape.DurationPerStack.Value * (float)(num - 1); body.AddTimedBuff(Buffs.Slow60, num4); if (Object.op_Implicit((Object)(object)Buffs.Weak)) { body.AddTimedBuff(Buffs.Weak, num4); } } bool flag = spawningLedgerWave || (Object.op_Implicit((Object)(object)body.master) && Object.op_Implicit((Object)(object)((Component)body.master).GetComponent<LedgerWaveMarker>())); if (num2 > 0 && !flag) { body.AddTimedBuff(OffTheBooks.AuditedBuff, 3600f); } } private static void OnTakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { if (NetworkServer.active && damageInfo != null && damageInfo.damage > 0f && Object.op_Implicit((Object)(object)self.body) && self.body.HasBuff(OffTheBooks.AuditedBuff)) { int num = TotalStacks(OffTheBooks.Def); if (num > 0) { damageInfo.damage *= 1f + OffTheBooks.DamageBonusBase.Value + OffTheBooks.DamageBonusPerStack.Value * (float)(num - 1); } } orig.Invoke(self, damageInfo); } private static void OnCharacterDeath(DamageReport report) { if (!NetworkServer.active || !Object.op_Implicit((Object)(object)Run.instance) || report == null) { return; } CharacterBody victimBody = report.victimBody; if (!Object.op_Implicit((Object)(object)victimBody) || !victimBody.HasBuff(OffTheBooks.AuditedBuff)) { return; } CharacterMaster attackerMaster = report.attackerMaster; if (Object.op_Implicit((Object)(object)attackerMaster) && Object.op_Implicit((Object)(object)attackerMaster.playerCharacterMasterController) && Object.op_Implicit((Object)(object)attackerMaster.inventory) && attackerMaster.inventory.GetItemCount(OffTheBooks.Def) != 0) { int num = OffTheBooks.MinCreditPerKill.Value; DeathRewards component = ((Component)victimBody).GetComponent<DeathRewards>(); if (Object.op_Implicit((Object)(object)component) && component.spawnValue > 0) { num = Mathf.Max(num, component.spawnValue); } ledgers.TryGetValue(attackerMaster, out var value); value += (float)num; if (value >= (float)OffTheBooks.LedgerThreshold.Value) { value = BalanceBooks(attackerMaster, value); } ledgers[attackerMaster] = value; } } private static float BalanceBooks(CharacterMaster holder, float ledger) { //IL_00db: 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_0100: Expected O, but got Unknown CharacterBody body = holder.GetBody(); if (!Object.op_Implicit((Object)(object)body) || !body.healthComponent.alive) { return ledger; } int i = 0; spawningLedgerWave = true; try { for (; i < OffTheBooks.MaxMonstersPerWave.Value; i++) { DirectorCard val = SampleAffordableCard(ledger); if (val == null) { break; } CharacterMaster val2 = SpawnCardOnTarget(val, body, (TeamIndex)2, 20f, 45f); if (!Object.op_Implicit((Object)(object)val2)) { break; } ((Component)val2).gameObject.AddComponent<LedgerWaveMarker>(); ledger -= (float)val.cost; } } finally { spawningLedgerWave = false; } if (i > 0) { Log.Info($"Off the Books: balanced {Util.GetBestMasterName(holder)}'s ledger with {i} monsters."); Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "<color=#b85ce0>" + Util.GetBestMasterName(holder) + "'s books have been balanced.</color>" }); } return ledger; } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } } } namespace AuditDepartment.Items { internal static class HostileTakeover { internal static ItemDef Def; internal static ConfigEntry<float> SkimPerStack; internal static ConfigEntry<float> SkimCap; internal static ConfigEntry<int> AllyCapBase; internal static ConfigEntry<int> AllyCapMax; internal static ConfigEntry<float> AllyLifetime; internal static void Init(ConfigFile config) { //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown SkimPerStack = config.Bind<float>("HostileTakeover", "SkimPerStack", 0.15f, "Fraction of monster director income skimmed per stack (all holders combined)."); SkimCap = config.Bind<float>("HostileTakeover", "SkimCap", 0.5f, "Hard cap on the total skim fraction for the whole lobby, regardless of stacks."); AllyCapBase = config.Bind<int>("HostileTakeover", "AllyCapBase", 2, "Maximum hired monsters alive at once with one stack (+1 per additional stack)."); AllyCapMax = config.Bind<int>("HostileTakeover", "AllyCapMax", 6, "Absolute ceiling on hired monsters alive at once."); AllyLifetime = config.Bind<float>("HostileTakeover", "AllyLifetime", 120f, "Seconds a hired monster stays on payroll before its contract expires (0 = permanent)."); Sprite icon = Assets.LoadSprite("AuditDepartment.icon_hostile_takeover.rgba", 128); GameObject model = Assets.CreatePickupModel("PickupHostileTakeover", "AuditDepartment.models.hostile_takeover.obj", "AuditDepartment.models.hostile_takeover.rgba", 512, 0.7f); ItemTag[] array = new ItemTag[3]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); Def = Assets.CreateItemDef("HostileTakeover", "HOSTILE_TAKEOVER", (ItemTier)2, icon, model, (ItemTag[])(object)array); ItemAPI.Add(new CustomItem(Def, new ItemDisplayRuleDict((ItemDisplayRule[])null))); int num = Mathf.RoundToInt(SkimPerStack.Value * 100f); int num2 = Mathf.RoundToInt(SkimCap.Value * 100f); LanguageAPI.Add("HOSTILE_TAKEOVER_NAME", "Hostile Takeover"); LanguageAPI.Add("HOSTILE_TAKEOVER_PICKUP", "Skim the enemy's budget. Spend it hiring their monsters onto your side."); LanguageAPI.Add("HOSTILE_TAKEOVER_DESC", $"Skim <style=cIsUtility>{num}% <style=cStack>(per stack, up to {num2}% total)</style></style> of the monster director's income " + "and spend it hiring <style=cIsUtility>monsters from this stage</style> to fight for you. " + $"Up to <style=cIsUtility>{AllyCapBase.Value} <style=cStack>(+1 per stack, max {AllyCapMax.Value})</style></style> hires at once, " + $"each on a <style=cIsUtility>{AllyLifetime.Value:0}s</style> contract."); LanguageAPI.Add("HOSTILE_TAKEOVER_LORE", "MINUTES, EMERGENCY BOARD MEETING\nItem 1: It has come to the board's attention that the board is no longer in control of the company.\nItem 2: The new majority shareholder has proposed a motion to 'keep doing whatever you were doing, but for me now.'\nItem 3: Motion carried unanimously. The lemurians voted in a bloc."); } } internal static class LineItemVeto { internal static ItemDef Def; internal static ConfigEntry<int> MinVetoCost; internal static ConfigEntry<float> CooldownBase; internal static ConfigEntry<float> CooldownStackMultiplier; internal static ConfigEntry<float> CooldownMin; internal static ConfigEntry<float> GoldPerCredit; internal static ConfigEntry<bool> BroadcastVetoes; internal static void Init(ConfigFile config) { //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown MinVetoCost = config.Bind<int>("LineItemVeto", "MinVetoCost", 100, "Only spawns costing at least this many director credits are vetoed (small fry get rubber-stamped)."); CooldownBase = config.Bind<float>("LineItemVeto", "CooldownBase", 45f, "Seconds between vetoes with one stack in the lobby. The veto is global: one budget, one committee."); CooldownStackMultiplier = config.Bind<float>("LineItemVeto", "CooldownStackMultiplier", 0.85f, "Cooldown is multiplied by this per stack beyond the first (all holders combined)."); CooldownMin = config.Bind<float>("LineItemVeto", "CooldownMin", 10f, "Cooldown floor."); GoldPerCredit = config.Bind<float>("LineItemVeto", "GoldPerCredit", 1f, "Gold awarded per vetoed director credit, split among holders by stack count."); BroadcastVetoes = config.Bind<bool>("LineItemVeto", "BroadcastVetoes", true, "Announce vetoes in chat."); Def = Assets.CreateItemDef("LineItemVeto", "LINE_ITEM_VETO", (ItemTier)1, Assets.LoadSprite("AuditDepartment.icon_line_item_veto.rgba", 128), Assets.CreatePickupModel("PickupLineItemVeto", "AuditDepartment.models.line_item_veto.obj", "AuditDepartment.models.line_item_veto.rgba", 512, 0.55f), (ItemTag[])(object)new ItemTag[2] { (ItemTag)3, (ItemTag)4 }); ItemAPI.Add(new CustomItem(Def, new ItemDisplayRuleDict((ItemDisplayRule[])null))); LanguageAPI.Add("LINE_ITEM_VETO_NAME", "Line-Item Veto"); LanguageAPI.Add("LINE_ITEM_VETO_PICKUP", "Periodically cancel the enemy's most expensive reinforcements — and pocket the budget."); LanguageAPI.Add("LINE_ITEM_VETO_DESC", $"Every <style=cIsUtility>{CooldownBase.Value:0}s</style> <style=cStack>(x{CooldownStackMultiplier.Value:0.00} per stack)</style>, " + $"the next enemy spawn costing <style=cIsUtility>{MinVetoCost.Value}+ director credits</style> is " + "<style=cIsUtility>vetoed</style>: the spawn is cancelled and its budget is paid out as <style=cIsUtility>gold</style> to all holders."); LanguageAPI.Add("LINE_ITEM_VETO_LORE", "Requisition 8841: one (1) Magma Worm, urgent.\nStatus: DENIED.\nReason: duplicate of Requisition 8840 (one (1) Magma Worm, urgent), which was denied as a duplicate of Requisition 8839.\nNote from the comptroller: keep them coming. We're paid by the denial."); } } internal static class OffTheBooks { internal static ItemDef Def; internal static BuffDef AuditedBuff; internal static ConfigEntry<float> DamageBonusBase; internal static ConfigEntry<float> DamageBonusPerStack; internal static ConfigEntry<int> LedgerThreshold; internal static ConfigEntry<int> MinCreditPerKill; internal static ConfigEntry<int> MaxMonstersPerWave; internal static void Init(ConfigFile config) { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) DamageBonusBase = config.Bind<float>("OffTheBooks", "DamageBonusBase", 0.15f, "Bonus damage audited enemies take from all sources, with one stack in the lobby."); DamageBonusPerStack = config.Bind<float>("OffTheBooks", "DamageBonusPerStack", 0.05f, "Additional bonus damage per stack beyond the first (all holders combined)."); LedgerThreshold = config.Bind<int>("OffTheBooks", "LedgerThreshold", 300, "Director credits of audited kills a holder accrues before the books are balanced with a wave spawned on them."); MinCreditPerKill = config.Bind<int>("OffTheBooks", "MinCreditPerKill", 15, "Minimum credits an audited kill adds to the ledger (used when the victim has no recorded spawn cost)."); MaxMonstersPerWave = config.Bind<int>("OffTheBooks", "MaxMonstersPerWave", 3, "Maximum monsters spawned per ledger balancing."); Def = Assets.CreateItemDef("OffTheBooks", "OFF_THE_BOOKS", (ItemTier)6, Assets.LoadSprite("AuditDepartment.icon_off_the_books.rgba", 128), Assets.CreatePickupModel("PickupOffTheBooks", "AuditDepartment.models.off_the_books.obj", "AuditDepartment.models.off_the_books.rgba", 512, 0.5f), (ItemTag[])(object)new ItemTag[2] { (ItemTag)1, (ItemTag)4 }); Def.requiredExpansion = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion(); ItemAPI.Add(new CustomItem(Def, new ItemDisplayRuleDict((ItemDisplayRule[])null))); AuditedBuff = ScriptableObject.CreateInstance<BuffDef>(); ((Object)AuditedBuff).name = "AuditDepartmentAudited"; AuditedBuff.buffColor = new Color(0.72f, 0.36f, 0.89f); AuditedBuff.canStack = false; AuditedBuff.isDebuff = true; AuditedBuff.iconSprite = Assets.LoadSprite("AuditDepartment.icon_buff_audited.rgba", 128); ContentAddition.AddBuffDef(AuditedBuff); ItemRelationshipProvider val = ScriptableObject.CreateInstance<ItemRelationshipProvider>(); ((Object)val).name = "AuditDepartmentContagiousItems"; val.relationshipType = Addressables.LoadAssetAsync<ItemRelationshipType>((object)"RoR2/DLC1/Common/ContagiousItem.asset").WaitForCompletion(); val.relationships = (Pair[])(object)new Pair[1] { new Pair { itemDef1 = RedTape.Def, itemDef2 = Def } }; ContentAddition.AddItemRelationshipProvider(val); int num = Mathf.RoundToInt(DamageBonusBase.Value * 100f); int num2 = Mathf.RoundToInt(DamageBonusPerStack.Value * 100f); LanguageAPI.Add("OFF_THE_BOOKS_NAME", "Off the Books"); LanguageAPI.Add("OFF_THE_BOOKS_PICKUP", "Nearby spawns are audited and take extra damage... but your kills go off the books, and the books always balance. <style=cIsVoid>Corrupts all Red Tape</style>."); LanguageAPI.Add("OFF_THE_BOOKS_DESC", "Enemies that spawn nearby are <style=cIsVoid>audited</style>, taking " + $"<style=cIsDamage>+{num}% <style=cStack>(+{num2}% per stack)</style> damage</style> from all sources. " + "Audited enemies <style=cIsHealth>you</style> kill accrue their spawn cost to a ledger; at " + $"<style=cIsHealth>{LedgerThreshold.Value} credits</style> the books are balanced with a monster wave spawned " + "<style=cIsHealth>on you</style>. <style=cIsVoid>Corrupts all Red Tape</style>."); LanguageAPI.Add("OFF_THE_BOOKS_LORE", "The auditor's ledger has two columns. The first records what was spent. The second records what was owed. Nothing in the ledger explains to whom, and the auditor has stopped asking, because every time the columns are unequal, something arrives to correct them."); } } internal static class RedTape { internal static ItemDef Def; internal static ConfigEntry<float> Radius; internal static ConfigEntry<float> DurationBase; internal static ConfigEntry<float> DurationPerStack; internal static void Init(ConfigFile config) { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown Radius = config.Bind<float>("RedTape", "Radius", 75f, "Enemies spawning within this range of a holder are affected."); DurationBase = config.Bind<float>("RedTape", "DurationBase", 3f, "Seconds of slow and weaken applied to nearby spawns, with one stack."); DurationPerStack = config.Bind<float>("RedTape", "DurationPerStack", 1.5f, "Additional seconds per stack beyond the first (stacks of all nearby holders combined)."); Def = Assets.CreateItemDef("RedTape", "RED_TAPE", (ItemTier)0, Assets.LoadSprite("AuditDepartment.icon_red_tape.rgba", 128), Assets.CreatePickupModel("PickupRedTape", "AuditDepartment.models.red_tape.obj", "AuditDepartment.models.red_tape.rgba", 512, 0.5f), (ItemTag[])(object)new ItemTag[2] { (ItemTag)3, (ItemTag)4 }); ItemAPI.Add(new CustomItem(Def, new ItemDisplayRuleDict((ItemDisplayRule[])null))); LanguageAPI.Add("RED_TAPE_NAME", "Red Tape"); LanguageAPI.Add("RED_TAPE_PICKUP", "Enemies spawning nearby are buried in paperwork."); LanguageAPI.Add("RED_TAPE_DESC", $"Enemies that spawn within <style=cIsUtility>{Radius.Value:0}m</style> are " + "<style=cIsUtility>slowed</style> and <style=cIsUtility>weakened</style> for " + $"<style=cIsUtility>{DurationBase.Value:0.#}s</style> <style=cStack>(+{DurationPerStack.Value:0.#}s per stack)</style>. " + "<style=cIsVoid>Corruptible</style>."); LanguageAPI.Add("RED_TAPE_LORE", "Form 77-C (Hostile Materialization Permit) must be filed in triplicate no fewer than three business days before manifesting on the combat plane. Applicants report that by the time approval arrives, the war is usually over."); } } internal static class StimulusPackage { internal static ItemDef Def; internal static ConfigEntry<float> BoostPerStack; internal static ConfigEntry<float> KickbackGoldPerCredit; internal static void Init(ConfigFile config) { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown BoostPerStack = config.Bind<float>("StimulusPackage", "BoostPerStack", 0.5f, "Extra monster director income per stack (all players' stacks combined — the whole lobby shares the heat)."); KickbackGoldPerCredit = config.Bind<float>("StimulusPackage", "KickbackGoldPerCredit", 0.5f, "Gold paid out per bonus credit the directors earn, split evenly among all players."); Def = Assets.CreateItemDef("StimulusPackage", "STIMULUS_PACKAGE", (ItemTier)3, Assets.LoadSprite("AuditDepartment.icon_stimulus_package.rgba", 128), Assets.CreatePickupModel("PickupStimulusPackage", "AuditDepartment.models.stimulus_package.obj", "AuditDepartment.models.stimulus_package.rgba", 512, 0.6f), (ItemTag[])(object)new ItemTag[2] { (ItemTag)3, (ItemTag)4 }); ItemAPI.Add(new CustomItem(Def, new ItemDisplayRuleDict((ItemDisplayRule[])null))); int num = Mathf.RoundToInt(BoostPerStack.Value * 100f); LanguageAPI.Add("STIMULUS_PACKAGE_NAME", "Stimulus Package"); LanguageAPI.Add("STIMULUS_PACKAGE_PICKUP", "Fund the enemy. Everyone gets a cut. Everyone gets the consequences."); LanguageAPI.Add("STIMULUS_PACKAGE_DESC", $"Monster directors earn <style=cIsHealth>+{num}% income per stack</style> <style=cStack>(all players' stacks combined)</style>. " + "A <style=cIsUtility>kickback</style> on every bonus credit is paid out as <style=cIsUtility>gold, split evenly among all players</style>."); LanguageAPI.Add("STIMULUS_PACKAGE_LORE", "The committee approved emergency funding to the invasion on the theory that a stronger invasion would stimulate the defense sector, which would stimulate the economy, which would fund the committee. Minutes show one dissenting vote, recorded only as 'the intern.'"); } } } namespace AuditDepartment.Artifacts { internal static class ArtifactOfAusterity { internal static ArtifactDef Def; internal static ConfigEntry<float> BoostFactor; internal static ConfigEntry<float> BudgetBase; internal static ConfigEntry<float> BudgetDifficultyScale; internal static bool Enabled => Object.op_Implicit((Object)(object)Def) && Object.op_Implicit((Object)(object)RunArtifactManager.instance) && RunArtifactManager.instance.IsArtifactEnabled(Def); internal static void Init(ConfigFile config) { BoostFactor = config.Bind<float>("ArtifactOfAusterity", "BoostFactor", 1.5f, "Director income multiplier while the stage budget lasts."); BudgetBase = config.Bind<float>("ArtifactOfAusterity", "BudgetBase", 450f, "Base credits each director may earn per stage before its budget is exhausted."); BudgetDifficultyScale = config.Bind<float>("ArtifactOfAusterity", "BudgetDifficultyScale", 0.4f, "Budget grows by this fraction of itself per point of difficulty coefficient."); Def = ScriptableObject.CreateInstance<ArtifactDef>(); Def.cachedName = "ArtifactOfAusterity"; Def.nameToken = "ARTIFACT_AUSTERITY_NAME"; Def.descriptionToken = "ARTIFACT_AUSTERITY_DESC"; Def.smallIconSelectedSprite = Assets.LoadSprite("AuditDepartment.icon_artifact_austerity_enabled.rgba", 128); Def.smallIconDeselectedSprite = Assets.LoadSprite("AuditDepartment.icon_artifact_austerity_disabled.rgba", 128); ContentAddition.AddArtifactDef(Def); LanguageAPI.Add("ARTIFACT_AUSTERITY_NAME", "Artifact of Austerity"); LanguageAPI.Add("ARTIFACT_AUSTERITY_DESC", "Monster spawning runs on a fixed budget each stage: spending is faster while it lasts, then stops entirely."); } } }