using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using Alexandria.BreakableAPI; using Alexandria.CharacterAPI; using Alexandria.CustomDodgeRollAPI; using Alexandria.DungeonAPI; using Alexandria.EnemyAPI; using Alexandria.ItemAPI; using Alexandria.Misc; using Alexandria.NPCAPI; using Alexandria.cAPI; using BepInEx; using Brave.BulletScript; using Dungeonator; using FullInspector; using FullSerializer; using Gunfiguration; using Gungeon; using HarmonyLib; using HutongGames.PlayMaker; using HutongGames.PlayMaker.Actions; using InControl; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using Mono.Collections.Generic; using MonoMod.Cil; using MonoMod.RuntimeDetour; using Pathfinding; using PathologicalGames; using SaveAPI; using UnityEngine; using UnityEngine.UI; using tk2dRuntime.TileMap; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class IsReadOnlyAttribute : Attribute { } [CompilerGenerated] [Microsoft.CodeAnalysis.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 SaveAPI { public class SpecialPickupObject : MonoBehaviour { public CustomDungeonFlags CustomSaveFlagToSetOnAcquisition; } public static class SaveTools { public static bool IsReallyCompleted(this MonsterHuntQuest quest) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) bool flag = true; foreach (GungeonFlags item in quest.FlagsToSetUponReward) { if ((int)item != 0 && !GameStatsManager.Instance.GetFlag(item)) { flag = false; break; } } if (quest is CustomHuntQuest customHuntQuest) { if (flag) { foreach (CustomDungeonFlags item2 in customHuntQuest.CustomFlagsToSetUponReward) { if (item2 != 0 && !AdvancedGameStatsManager.Instance.GetFlag(item2)) { flag = false; break; } } } bool flag2 = false; if ((int)quest.QuestFlag != 0) { flag2 = GameStatsManager.Instance.GetFlag(quest.QuestFlag); } else if (customHuntQuest.CustomQuestFlag != 0) { flag2 = AdvancedGameStatsManager.Instance.GetFlag(customHuntQuest.CustomQuestFlag); } return flag2 && flag; } return GameStatsManager.Instance.GetFlag(quest.QuestFlag) && flag; } public static void SafeMove(string oldPath, string newPath, bool allowOverwritting = false) { if (File.Exists(oldPath) && (allowOverwritting || !File.Exists(newPath))) { string text = SaveManager.ReadAllText(oldPath); try { SaveManager.WriteAllText(newPath, text); } catch (Exception ex) { Debug.LogErrorFormat("Failed to move {0} to {1}: {2}", new object[3] { oldPath, newPath, ex }); return; } try { File.Delete(oldPath); } catch (Exception ex2) { Debug.LogErrorFormat("Failed to delete old file {0}: {1}", new object[3] { oldPath, newPath, ex2 }); return; } if (File.Exists(oldPath + ".bak")) { File.Delete(oldPath + ".bak"); } } } public static List Convert(this List self, Func convertor) { List list = new List(); foreach (T item in self) { list.Add(convertor(item)); } return list; } public static bool SetsCustomFlagOnDeath(this AIActor enemy) { if ((Object)(object)((Component)enemy).GetComponent() != (Object)null) { return ((Component)enemy).GetComponent().SetsCustomFlagOnDeath; } return false; } public static CustomDungeonFlags GetCustomFlagToSetOnDeath(this AIActor enemy) { if (!((Object)(object)((Component)enemy).GetComponent() != (Object)null) || !((Component)enemy).GetComponent().SetsCustomFlagOnDeath) { return CustomDungeonFlags.NONE; } return ((Component)enemy).GetComponent().CustomFlagToSetOnDeath; } public static void SetCustomFlagToSetOnDeath(this AIActor enemy, CustomDungeonFlags flag) { SpecialAIActor orAddComponent = GameObjectExtensions.GetOrAddComponent(((Component)enemy).gameObject); if (flag == CustomDungeonFlags.NONE) { orAddComponent.SetsCustomFlagOnDeath = false; } else if (flag != 0) { orAddComponent.SetsCustomFlagOnDeath = true; } orAddComponent.CustomFlagToSetOnDeath = flag; } public static bool SetsCustomFlagOnActivation(this AIActor enemy) { if ((Object)(object)((Component)enemy).GetComponent() != (Object)null) { return ((Component)enemy).GetComponent().SetsCustomFlagOnActivation; } return false; } public static CustomDungeonFlags GetCustomFlagToSetOnActivation(this AIActor enemy) { if (!((Object)(object)((Component)enemy).GetComponent() != (Object)null) || !((Component)enemy).GetComponent().SetsCustomFlagOnActivation) { return CustomDungeonFlags.NONE; } return ((Component)enemy).GetComponent().CustomFlagToSetOnActivation; } public static void SetCustomFlagToSetOnActivation(this AIActor enemy, CustomDungeonFlags flag) { SpecialAIActor orAddComponent = GameObjectExtensions.GetOrAddComponent(((Component)enemy).gameObject); if (flag == CustomDungeonFlags.NONE) { orAddComponent.SetsCustomFlagOnActivation = false; } else if (flag != 0) { orAddComponent.SetsCustomFlagOnActivation = true; } orAddComponent.CustomFlagToSetOnActivation = flag; } public static bool SetsCustomCharacterSpecificFlagOnDeath(this AIActor enemy) { if ((Object)(object)((Component)enemy).GetComponent() != (Object)null) { return ((Component)enemy).GetComponent().SetsCustomCharacterSpecificFlagOnDeath; } return false; } public static CustomCharacterSpecificGungeonFlags GetCustomCharacterSpecificFlagToSetOnDeath(this AIActor enemy) { if (!((Object)(object)((Component)enemy).GetComponent() != (Object)null) || !((Component)enemy).GetComponent().SetsCustomCharacterSpecificFlagOnDeath) { return CustomCharacterSpecificGungeonFlags.NONE; } return ((Component)enemy).GetComponent().CustomCharacterSpecificFlagToSetOnDeath; } public static void SetCustomCharacterSpecificFlagToSetOnDeath(this AIActor enemy, CustomCharacterSpecificGungeonFlags flag) { SpecialAIActor orAddComponent = GameObjectExtensions.GetOrAddComponent(((Component)enemy).gameObject); if (flag == CustomCharacterSpecificGungeonFlags.NONE) { orAddComponent.SetsCustomCharacterSpecificFlagOnDeath = false; } else if (flag != 0) { orAddComponent.SetsCustomCharacterSpecificFlagOnDeath = true; } orAddComponent.CustomCharacterSpecificFlagToSetOnDeath = flag; } public static string PathCombine(string a, string b, string c) { return Path.Combine(Path.Combine(a, b), c); } public static DungeonPrerequisite SetupUnlockOnFlag(this PickupObject self, GungeonFlags flag, bool requiredFlagValue) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((BraveBehaviour)self).encounterTrackable == (Object)null) { return null; } return ((BraveBehaviour)self).encounterTrackable.SetupUnlockOnFlag(flag, requiredFlagValue); } public static DungeonPrerequisite SetupUnlockOnFlag(this EncounterTrackable self, GungeonFlags flag, bool requiredFlagValue) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown return self.AddPrerequisite(new DungeonPrerequisite { prerequisiteType = (PrerequisiteType)4, saveFlagToCheck = flag, requireFlag = requiredFlagValue }); } public static DungeonPrerequisite SetupUnlockOnStat(this PickupObject self, TrackedStats stat, float comparisonValue, PrerequisiteOperation comparisonOperation) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((BraveBehaviour)self).encounterTrackable == (Object)null) { return null; } return ((BraveBehaviour)self).encounterTrackable.SetupUnlockOnStat(stat, comparisonValue, comparisonOperation); } public static DungeonPrerequisite SetupUnlockOnStat(this EncounterTrackable self, TrackedStats stat, float comparisonValue, PrerequisiteOperation comparisonOperation) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown return self.AddPrerequisite(new DungeonPrerequisite { prerequisiteType = (PrerequisiteType)1, statToCheck = stat, prerequisiteOperation = comparisonOperation, comparisonValue = comparisonValue }); } public static DungeonPrerequisite SetupUnlockOnMaximum(this PickupObject self, TrackedMaximums maximum, float comparisonValue, PrerequisiteOperation comparisonOperation) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((BraveBehaviour)self).encounterTrackable == (Object)null) { return null; } return ((BraveBehaviour)self).encounterTrackable.SetupUnlockOnMaximum(maximum, comparisonValue, comparisonOperation); } public static DungeonPrerequisite SetupUnlockOnMaximum(this EncounterTrackable self, TrackedMaximums maximum, float comparisonValue, PrerequisiteOperation comparisonOperation) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown return self.AddPrerequisite(new DungeonPrerequisite { prerequisiteType = (PrerequisiteType)6, maxToCheck = maximum, prerequisiteOperation = comparisonOperation, comparisonValue = comparisonValue }); } public static DungeonPrerequisite SetupUnlockOnEncounter(this PickupObject self, string encounterObjectGuid, int requiredNumberOfEncounters, PrerequisiteOperation comparisonOperation) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((BraveBehaviour)self).encounterTrackable == (Object)null) { return null; } return ((BraveBehaviour)self).encounterTrackable.SetupUnlockOnEncounter(encounterObjectGuid, requiredNumberOfEncounters, comparisonOperation); } public static DungeonPrerequisite SetupUnlockOnEncounter(this EncounterTrackable self, string encounterObjectGuid, int requiredNumberOfEncounters, PrerequisiteOperation comparisonOperation) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown return self.AddPrerequisite(new DungeonPrerequisite { prerequisiteType = (PrerequisiteType)0, encounteredObjectGuid = encounterObjectGuid, requiredNumberOfEncounters = requiredNumberOfEncounters, prerequisiteOperation = comparisonOperation }); } public static DungeonPrerequisite SetupUnlockOnEncounter(this PickupObject self, PrototypeDungeonRoom encounterRoom, int requiredNumberOfEncounters, PrerequisiteOperation comparisonOperation) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((BraveBehaviour)self).encounterTrackable == (Object)null) { return null; } return ((BraveBehaviour)self).encounterTrackable.SetupUnlockOnEncounter(encounterRoom, requiredNumberOfEncounters, comparisonOperation); } public static DungeonPrerequisite SetupUnlockOnEncounter(this EncounterTrackable self, PrototypeDungeonRoom encounterRoom, int requiredNumberOfEncounters, PrerequisiteOperation comparisonOperation) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown return self.AddPrerequisite(new DungeonPrerequisite { prerequisiteType = (PrerequisiteType)0, encounteredRoom = encounterRoom, requiredNumberOfEncounters = requiredNumberOfEncounters, prerequisiteOperation = comparisonOperation }); } public static DungeonPrerequisite SetupUnlockOnEncounterOrFlag(this PickupObject self, GungeonFlags flag, bool requiredFlagValue, string encounterObjectGuid, int requiredNumberOfEncounters, PrerequisiteOperation comparisonOperation) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((BraveBehaviour)self).encounterTrackable == (Object)null) { return null; } return ((BraveBehaviour)self).encounterTrackable.SetupUnlockOnEncounterOrFlag(flag, requiredFlagValue, encounterObjectGuid, requiredNumberOfEncounters, comparisonOperation); } public static DungeonPrerequisite SetupUnlockOnEncounterOrFlag(this EncounterTrackable self, GungeonFlags flag, bool requiredFlagValue, string encounterObjectGuid, int requiredNumberOfEncounters, PrerequisiteOperation comparisonOperation) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0037: Expected O, but got Unknown return self.AddPrerequisite(new DungeonPrerequisite { prerequisiteType = (PrerequisiteType)7, saveFlagToCheck = flag, requireFlag = requiredFlagValue, encounteredObjectGuid = encounterObjectGuid, requiredNumberOfEncounters = requiredNumberOfEncounters, prerequisiteOperation = comparisonOperation }); } public static DungeonPrerequisite SetupUnlockOnEncounterOrFlag(this PickupObject self, GungeonFlags flag, bool requiredFlagValue, PrototypeDungeonRoom encounterRoom, int requiredNumberOfEncounters, PrerequisiteOperation comparisonOperation) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((BraveBehaviour)self).encounterTrackable == (Object)null) { return null; } return ((BraveBehaviour)self).encounterTrackable.SetupUnlockOnEncounterOrFlag(flag, requiredFlagValue, encounterRoom, requiredNumberOfEncounters, comparisonOperation); } public static DungeonPrerequisite SetupUnlockOnEncounterOrFlag(this EncounterTrackable self, GungeonFlags flag, bool requiredFlagValue, PrototypeDungeonRoom encounterRoom, int requiredNumberOfEncounters, PrerequisiteOperation comparisonOperation) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0037: Expected O, but got Unknown return self.AddPrerequisite(new DungeonPrerequisite { prerequisiteType = (PrerequisiteType)7, saveFlagToCheck = flag, requireFlag = requiredFlagValue, encounteredRoom = encounterRoom, requiredNumberOfEncounters = requiredNumberOfEncounters, prerequisiteOperation = comparisonOperation }); } public static DungeonPrerequisite SetupUnlockOnTileset(this PickupObject self, ValidTilesets requiredTileset, bool requiredTilesetValue) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((BraveBehaviour)self).encounterTrackable == (Object)null) { return null; } return ((BraveBehaviour)self).encounterTrackable.SetupUnlockOnTileset(requiredTileset, requiredTilesetValue); } public static DungeonPrerequisite SetupUnlockOnTileset(this EncounterTrackable self, ValidTilesets requiredTileset, bool requiredTilesetValue) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown return self.AddPrerequisite(new DungeonPrerequisite { prerequisiteType = (PrerequisiteType)3, requireTileset = requiredTilesetValue, requiredTileset = requiredTileset }); } public static DungeonPrerequisite SetupUnlockOnCharacter(this PickupObject self, PlayableCharacters requiredCharacter, bool requiredCharacterValue) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((BraveBehaviour)self).encounterTrackable == (Object)null) { return null; } return ((BraveBehaviour)self).encounterTrackable.SetupUnlockOnCharacter(requiredCharacter, requiredCharacterValue); } public static DungeonPrerequisite SetupUnlockOnCharacter(this EncounterTrackable self, PlayableCharacters requiredCharacter, bool requiredCharacterValue) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown return self.AddPrerequisite(new DungeonPrerequisite { prerequisiteType = (PrerequisiteType)2, requireCharacter = requiredCharacterValue, requiredCharacter = requiredCharacter }); } public static DungeonPrerequisite SetupUnlockOnEncounterOrCustomFlag(this PickupObject self, CustomDungeonFlags flag, bool requiredFlagValue, string encounterObjectGuid, int requiredNumberOfEncounters, PrerequisiteOperation comparisonOperation) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((BraveBehaviour)self).encounterTrackable == (Object)null) { return null; } return ((BraveBehaviour)self).encounterTrackable.SetupUnlockOnEncounterOrCustomFlag(flag, requiredFlagValue, encounterObjectGuid, requiredNumberOfEncounters, comparisonOperation); } public static DungeonPrerequisite SetupUnlockOnEncounterOrCustomFlag(this EncounterTrackable self, CustomDungeonFlags flag, bool requiredFlagValue, string encounterObjectGuid, int requiredNumberOfEncounters, PrerequisiteOperation comparisonOperation) { //IL_002b: 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) return (DungeonPrerequisite)(object)self.AddPrerequisite(new CustomDungeonPrerequisite { advancedPrerequisiteType = CustomDungeonPrerequisite.AdvancedPrerequisiteType.ENCOUNTER_OR_CUSTOM_FLAG, customFlagToCheck = flag, requireCustomFlag = requiredFlagValue, encounteredObjectGuid = encounterObjectGuid, requiredNumberOfEncounters = requiredNumberOfEncounters, prerequisiteOperation = comparisonOperation }); } public static DungeonPrerequisite SetupUnlockOnEncounterOrCustomFlag(this PickupObject self, CustomDungeonFlags flag, bool requiredFlagValue, PrototypeDungeonRoom encounterRoom, int requiredNumberOfEncounters, PrerequisiteOperation comparisonOperation) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((BraveBehaviour)self).encounterTrackable == (Object)null) { return null; } return ((BraveBehaviour)self).encounterTrackable.SetupUnlockOnEncounterOrCustomFlag(flag, requiredFlagValue, encounterRoom, requiredNumberOfEncounters, comparisonOperation); } public static DungeonPrerequisite SetupUnlockOnEncounterOrCustomFlag(this EncounterTrackable self, CustomDungeonFlags flag, bool requiredFlagValue, PrototypeDungeonRoom encounterRoom, int requiredNumberOfEncounters, PrerequisiteOperation comparisonOperation) { //IL_002b: 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) return (DungeonPrerequisite)(object)self.AddPrerequisite(new CustomDungeonPrerequisite { advancedPrerequisiteType = CustomDungeonPrerequisite.AdvancedPrerequisiteType.ENCOUNTER_OR_CUSTOM_FLAG, customFlagToCheck = flag, requireCustomFlag = requiredFlagValue, encounteredRoom = encounterRoom, requiredNumberOfEncounters = requiredNumberOfEncounters, prerequisiteOperation = comparisonOperation }); } public static DungeonPrerequisite SetupUnlockOnCustomFlag(this PickupObject self, CustomDungeonFlags flag, bool requiredFlagValue) { if ((Object)(object)((BraveBehaviour)self).encounterTrackable == (Object)null) { return null; } return ((BraveBehaviour)self).encounterTrackable.SetupUnlockOnCustomFlag(flag, requiredFlagValue); } public static DungeonPrerequisite SetupUnlockOnCustomFlag(this EncounterTrackable self, CustomDungeonFlags flag, bool requiredFlagValue) { return (DungeonPrerequisite)(object)self.AddPrerequisite(new CustomDungeonPrerequisite { advancedPrerequisiteType = CustomDungeonPrerequisite.AdvancedPrerequisiteType.CUSTOM_FLAG, requireCustomFlag = requiredFlagValue, customFlagToCheck = flag }); } public static DungeonPrerequisite SetupUnlockOnCustomStat(this PickupObject self, CustomTrackedStats stat, float comparisonValue, PrerequisiteOperation comparisonOperation) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((BraveBehaviour)self).encounterTrackable == (Object)null) { return null; } return ((BraveBehaviour)self).encounterTrackable.SetupUnlockOnCustomStat(stat, comparisonValue, comparisonOperation); } public static DungeonPrerequisite SetupUnlockOnCustomStat(this EncounterTrackable self, CustomTrackedStats stat, float comparisonValue, PrerequisiteOperation comparisonOperation) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) return (DungeonPrerequisite)(object)self.AddPrerequisite(new CustomDungeonPrerequisite { advancedPrerequisiteType = CustomDungeonPrerequisite.AdvancedPrerequisiteType.CUSTOM_STAT_COMPARISION, customStatToCheck = stat, prerequisiteOperation = comparisonOperation, comparisonValue = comparisonValue }); } public static DungeonPrerequisite SetupUnlockOnCustomMaximum(this PickupObject self, CustomTrackedMaximums maximum, float comparisonValue, PrerequisiteOperation comparisonOperation) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((BraveBehaviour)self).encounterTrackable == (Object)null) { return null; } return ((BraveBehaviour)self).encounterTrackable.SetupUnlockOnCustomMaximum(maximum, comparisonValue, comparisonOperation); } public static DungeonPrerequisite SetupUnlockOnCustomMaximum(this EncounterTrackable self, CustomTrackedMaximums maximum, float comparisonValue, PrerequisiteOperation comparisonOperation) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) return (DungeonPrerequisite)(object)self.AddPrerequisite(new CustomDungeonPrerequisite { advancedPrerequisiteType = CustomDungeonPrerequisite.AdvancedPrerequisiteType.CUSTOM_MAXIMUM_COMPARISON, customMaximumToCheck = maximum, prerequisiteOperation = comparisonOperation, comparisonValue = comparisonValue }); } public static DungeonPrerequisite SetupUnlockOnPastsBeaten(this PickupObject self, float comparisonValue, PrerequisiteOperation comparisonOperation) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((BraveBehaviour)self).encounterTrackable == (Object)null) { return null; } return ((BraveBehaviour)self).encounterTrackable.SetupUnlockOnPastsBeaten(comparisonValue, comparisonOperation); } public static DungeonPrerequisite SetupUnlockOnPastsBeaten(this EncounterTrackable self, float comparisonValue, PrerequisiteOperation comparisonOperation) { //IL_000e: 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) return (DungeonPrerequisite)(object)self.AddPrerequisite(new CustomDungeonPrerequisite { advancedPrerequisiteType = CustomDungeonPrerequisite.AdvancedPrerequisiteType.NUMBER_PASTS_COMPLETED_BETTER, prerequisiteOperation = comparisonOperation, comparisonValue = comparisonValue }); } public static T AddPrerequisite(this PickupObject self, T prereq) where T : DungeonPrerequisite { return (T)(object)self.AddPrerequisite((DungeonPrerequisite)(object)prereq); } public static T AddPrerequisite(this EncounterTrackable self, T prereq) where T : DungeonPrerequisite { return (T)(object)self.AddPrerequisite((DungeonPrerequisite)(object)prereq); } public static DungeonPrerequisite AddPrerequisite(this PickupObject self, DungeonPrerequisite prereq) { return ((BraveBehaviour)self).encounterTrackable.AddPrerequisite(prereq); } public static DungeonPrerequisite AddPrerequisite(this EncounterTrackable self, DungeonPrerequisite prereq) { if (!string.IsNullOrEmpty(self.ProxyEncounterGuid)) { self.ProxyEncounterGuid = ""; } if (self.prerequisites == null) { self.prerequisites = (DungeonPrerequisite[])(object)new DungeonPrerequisite[1] { prereq }; } else { self.prerequisites = self.prerequisites.Concat((IEnumerable)(object)new DungeonPrerequisite[1] { prereq }).ToArray(); } EncounterDatabaseEntry entry = EncounterDatabase.GetEntry(self.EncounterGuid); if (!string.IsNullOrEmpty(entry.ProxyEncounterGuid)) { entry.ProxyEncounterGuid = ""; } if (entry.prerequisites == null) { entry.prerequisites = (DungeonPrerequisite[])(object)new DungeonPrerequisite[1] { prereq }; } else { entry.prerequisites = entry.prerequisites.Concat((IEnumerable)(object)new DungeonPrerequisite[1] { prereq }).ToArray(); } return prereq; } public static string ListToString(List list) { string text = "("; for (int i = 0; i < list.Count; i++) { string text2 = list[i].ToString(); text += text2; if (i < list.Count - 1) { text += ", "; } } return text + ")"; } public static void InsertOrAdd(this List self, int index, T toAdd) { if (index < 0 || index > self.Count) { self.Add(toAdd); } else { self.Insert(index, toAdd); } } public static void LogSmart(string text, bool debuglog = false) { if (ETGModConsole.Instance != null) { ETGModConsole.Log((object)text, debuglog); } else { Debug.Log((object)text); } } public static List CloneList(List orig) { List list = new List(); for (int i = 0; i < orig.Count; i++) { list.Add(orig[i]); } return list; } public static T LoadAssetFromAnywhere(string path) where T : Object { string[] obj = new string[30] { "brave_resources_001", "dungeon_scene_001", "encounters_base_001", "enemies_base_001", "flows_base_001", "foyer_001", "foyer_002", "foyer_003", "shared_auto_001", "shared_auto_002", "shared_base_001", "dungeons/base_bullethell", "dungeons/base_castle", "dungeons/base_catacombs", "dungeons/base_cathedral", "dungeons/base_forge", "dungeons/base_foyer", "dungeons/base_gungeon", "dungeons/base_mines", "dungeons/base_nakatomi", "dungeons/base_resourcefulrat", "dungeons/base_sewer", "dungeons/base_tutorial", "dungeons/finalscenario_bullet", "dungeons/finalscenario_convict", "dungeons/finalscenario_coop", "dungeons/finalscenario_guide", "dungeons/finalscenario_pilot", "dungeons/finalscenario_robot", "dungeons/finalscenario_soldier" }; T val = default(T); string[] array = obj; foreach (string text in array) { try { val = ResourceManager.LoadAssetBundle(text).LoadAsset(path); } catch { } if ((Object)(object)val != (Object)null) { break; } } return val; } public static void SetComplex(this StringDBTable self, string key, params string[] values) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown StringCollection val = (StringCollection)new ComplexStringCollection(); foreach (string text in values) { val.AddString(text, 1f); } self[key] = val; } public static bool IsEnemyStateValid(AIActor enemy, JammedEnemyState requiredState) { return requiredState switch { JammedEnemyState.NoCheck => true, JammedEnemyState.Unjammed => !enemy.IsBlackPhantom, JammedEnemyState.Jammed => enemy.IsBlackPhantom, _ => false, }; } } public enum JammedEnemyState { NoCheck, Jammed, Unjammed } public static class CustomHuntQuests { private static bool m_loaded; private static Hook huntProgressLoadedHook; private static Hook huntProgressCompleteHook; private static Hook huntProgressQuestCompleteHook; private static Hook huntProgressNextQuestHook; private static Hook huntProgressProcessKillHook; private static Hook huntQuestCompleteHook; private static Hook huntQuestUnlockRewardsHook; public static MonsterHuntData HuntData; public static List addedOrderedQuests; public static List addedProceduralQuests; public static void DoSetup() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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 //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Expected O, but got Unknown //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Expected O, but got Unknown if (!m_loaded) { HuntData = (MonsterHuntData)BraveResources.Load("Monster Hunt Data", ".asset"); huntProgressLoadedHook = new Hook((MethodBase)typeof(MonsterHuntProgress).GetMethod("OnLoaded"), typeof(CustomHuntQuests).GetMethod("HuntProgressLoadedHook")); huntProgressCompleteHook = new Hook((MethodBase)typeof(MonsterHuntProgress).GetMethod("Complete"), typeof(CustomHuntQuests).GetMethod("HuntProgressCompleteHook")); huntProgressQuestCompleteHook = new Hook((MethodBase)typeof(MonsterHuntProgress).GetMethod("IsQuestComplete"), typeof(CustomHuntQuests).GetMethod("HuntProgressQuestCompleteHook")); huntProgressNextQuestHook = new Hook((MethodBase)typeof(MonsterHuntProgress).GetMethod("TriggerNextQuest"), typeof(CustomHuntQuests).GetMethod("HuntProgressNextQuestHook")); huntProgressProcessKillHook = new Hook((MethodBase)typeof(MonsterHuntProgress).GetMethod("ProcessKill"), typeof(CustomHuntQuests).GetMethod("HuntProgressProcessKillHook")); huntQuestCompleteHook = new Hook((MethodBase)typeof(MonsterHuntQuest).GetMethod("IsQuestComplete"), typeof(CustomHuntQuests).GetMethod("HuntQuestCompleteHook")); huntQuestUnlockRewardsHook = new Hook((MethodBase)typeof(MonsterHuntQuest).GetMethod("UnlockRewards"), typeof(CustomHuntQuests).GetMethod("HuntQuestUnlockRewardsHook")); m_loaded = true; } } public static void Unload() { if (!m_loaded) { return; } if (addedOrderedQuests != null) { foreach (MonsterHuntQuest addedOrderedQuest in addedOrderedQuests) { if (HuntData.OrderedQuests.Contains(addedOrderedQuest)) { HuntData.OrderedQuests.Remove(addedOrderedQuest); } } addedOrderedQuests.Clear(); addedOrderedQuests = null; } if (addedProceduralQuests != null) { foreach (MonsterHuntQuest addedProceduralQuest in addedProceduralQuests) { if (HuntData.ProceduralQuests.Contains(addedProceduralQuest)) { HuntData.ProceduralQuests.Remove(addedProceduralQuest); } } addedProceduralQuests.Clear(); addedProceduralQuests = null; } if (GameStatsManager.HasInstance && GameStatsManager.Instance.huntProgress != null) { GameStatsManager.Instance.huntProgress.OnLoaded(); } else { int? num = null; if (AdvancedGameStatsManager.HasInstance) { num = AdvancedGameStatsManager.Instance.cachedHuntIndex; AdvancedGameStatsManager.Save(); } GameStatsManager.Load(); if (num.HasValue && AdvancedGameStatsManager.HasInstance) { AdvancedGameStatsManager.Instance.cachedHuntIndex = num.Value; } } HuntData = null; Hook obj = huntProgressLoadedHook; if (obj != null) { obj.Dispose(); } Hook obj2 = huntProgressCompleteHook; if (obj2 != null) { obj2.Dispose(); } Hook obj3 = huntProgressNextQuestHook; if (obj3 != null) { obj3.Dispose(); } Hook obj4 = huntProgressProcessKillHook; if (obj4 != null) { obj4.Dispose(); } Hook obj5 = huntQuestCompleteHook; if (obj5 != null) { obj5.Dispose(); } Hook obj6 = huntQuestUnlockRewardsHook; if (obj6 != null) { obj6.Dispose(); } Hook obj7 = huntProgressQuestCompleteHook; if (obj7 != null) { obj7.Dispose(); } m_loaded = false; } public static void HuntProgressProcessKillHook(Action orig, MonsterHuntProgress self, AIActor target) { if (self.ActiveQuest == null || (self.CurrentActiveMonsterHuntProgress < self.ActiveQuest.NumberKillsRequired && (!(self.ActiveQuest is CustomHuntQuest) || (self.ActiveQuest as CustomHuntQuest).IsEnemyValid(target, self)))) { orig(self, target); } } public static MonsterHuntQuest FindNextQuestNoProcedural() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < HuntData.OrderedQuests.Count; i++) { if (!GameStatsManager.Instance.GetFlag(HuntData.OrderedQuests[i].QuestFlag)) { return HuntData.OrderedQuests[i]; } } return null; } public static int HuntProgressNextQuestHook(Func orig, MonsterHuntProgress self) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) MonsterHuntQuest val = null; int num = 0; for (int i = 0; i < HuntData.OrderedQuests.Count; i++) { if (HuntData.OrderedQuests[i] != null && !HuntData.OrderedQuests[i].IsQuestComplete()) { val = HuntData.OrderedQuests[i]; num = i; break; } } List orderedQuests = HuntData.OrderedQuests; List list = new List(); for (int j = 0; j < orderedQuests.Count; j++) { if (orderedQuests[j] != null && (int)orderedQuests[j].QuestFlag != 0) { list.Add(orderedQuests[j]); } } HuntData.OrderedQuests = list; if (self.ActiveQuest == null) { _ = self.ActiveQuest; } int result = orig(self); MonsterHuntQuest val2 = FindNextQuestNoProcedural(); HuntData.OrderedQuests = orderedQuests; if (self.ActiveQuest != null && val2 != null && HuntData.OrderedQuests.IndexOf(self.ActiveQuest) != self.CurrentActiveMonsterHuntID) { self.CurrentActiveMonsterHuntID = HuntData.OrderedQuests.IndexOf(self.ActiveQuest); } if (val != null && val2 == null) { self.ActiveQuest = val; self.CurrentActiveMonsterHuntID = num; self.CurrentActiveMonsterHuntProgress = 0; return result; } if (val != null && val2 != null && num < self.CurrentActiveMonsterHuntID) { self.ActiveQuest = val; self.CurrentActiveMonsterHuntID = num; self.CurrentActiveMonsterHuntProgress = 0; } return result; } public static void HuntProgressCompleteHook(Action orig, MonsterHuntProgress self) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) _ = self.ActiveQuest; GungeonFlags questFlag = self.ActiveQuest.QuestFlag; bool flag = GameStatsManager.Instance.GetFlag((GungeonFlags)1); if (self.ActiveQuest is CustomHuntQuest) { (self.ActiveQuest as CustomHuntQuest).Complete(); if ((int)self.ActiveQuest.QuestFlag == 0) { self.ActiveQuest.QuestFlag = (GungeonFlags)1; } } orig(self); GameStatsManager.Instance.SetFlag((GungeonFlags)1, flag); self.ActiveQuest.QuestFlag = questFlag; _ = self.ActiveQuest; } public static bool HuntQuestCompleteHook(Func orig, MonsterHuntQuest self) { if (self is CustomHuntQuest) { return (self as CustomHuntQuest).IsQuestComplete(); } return orig(self); } public static bool HuntProgressQuestCompleteHook(Func orig, MonsterHuntProgress self) { if (self.ActiveQuest is CustomHuntQuest) { return (self.ActiveQuest as CustomHuntQuest).IsQuestComplete(); } return orig(self); } public static void HuntQuestUnlockRewardsHook(Action orig, MonsterHuntQuest self) { if (self is CustomHuntQuest) { (self as CustomHuntQuest).UnlockRewards(); } else { orig(self); } } public static void HuntProgressLoadedHook(Action orig, MonsterHuntProgress self) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown _ = self.ActiveQuest; if (GameManager.HasInstance) { if (GameManager.Instance.platformInterface == null) { if (PlatformInterfaceSteam.IsSteamBuild()) { GameManager.Instance.platformInterface = (PlatformInterface)new PlatformInterfaceSteam(); } else if (PlatformInterfaceGalaxy.IsGalaxyBuild()) { GameManager.Instance.platformInterface = (PlatformInterface)new PlatformInterfaceGalaxy(); } else { GameManager.Instance.platformInterface = (PlatformInterface)new PlatformInterfaceGenericPC(); } } GameManager.Instance.platformInterface.Start(); } FieldInfo field = typeof(GameStatsManager).GetField("s_frifleHuntFlags", BindingFlags.Static | BindingFlags.NonPublic); FieldInfo field2 = typeof(GameStatsManager).GetField("s_pastFlags", BindingFlags.Static | BindingFlags.NonPublic); FieldInfo field3 = typeof(GameStatsManager).GetField("s_npcFoyerFlags", BindingFlags.Static | BindingFlags.NonPublic); if (field2.GetValue(null) == null) { List list = new List(); list.Add((GungeonFlags)18001); list.Add((GungeonFlags)18002); list.Add((GungeonFlags)18003); list.Add((GungeonFlags)18004); field2.SetValue(null, list); } if (field3.GetValue(null) == null) { List list2 = new List(); list2.Add((GungeonFlags)40005); list2.Add((GungeonFlags)27505); list2.Add((GungeonFlags)55505); list2.Add((GungeonFlags)24505); list2.Add((GungeonFlags)2003); list2.Add((GungeonFlags)45500); list2.Add((GungeonFlags)30005); list2.Add((GungeonFlags)25506); list2.Add((GungeonFlags)28501); list2.Add((GungeonFlags)35051); field3.SetValue(null, list2); } if (field.GetValue(null) == null) { List list3 = new List(); list3.Add((GungeonFlags)35101); list3.Add((GungeonFlags)35102); list3.Add((GungeonFlags)35103); list3.Add((GungeonFlags)35104); list3.Add((GungeonFlags)35105); list3.Add((GungeonFlags)35106); list3.Add((GungeonFlags)35107); list3.Add((GungeonFlags)35108); list3.Add((GungeonFlags)35109); list3.Add((GungeonFlags)35110); list3.Add((GungeonFlags)35111); list3.Add((GungeonFlags)35112); list3.Add((GungeonFlags)35113); list3.Add((GungeonFlags)35114); list3.Add((GungeonFlags)35500); field.SetValue(null, list3); } MonsterHuntQuest val = null; bool flag = GameStatsManager.Instance.GetFlag((GungeonFlags)35500); foreach (MonsterHuntQuest orderedQuest in HuntData.OrderedQuests) { if (orderedQuest != null && !orderedQuest.IsReallyCompleted()) { val = orderedQuest; } } if (val != null) { GameStatsManager.Instance.SetFlag((GungeonFlags)35500, false); } if (SaveAPIManager.IsFirstLoad) { if (!AdvancedGameStatsManager.HasInstance) { AdvancedGameStatsManager.Load(); } AdvancedGameStatsManager.Instance.cachedHuntIndex = self.CurrentActiveMonsterHuntID; } else { if (!AdvancedGameStatsManager.HasInstance) { AdvancedGameStatsManager.Load(); } if (AdvancedGameStatsManager.HasInstance && self.CurrentActiveMonsterHuntID == -1 && AdvancedGameStatsManager.Instance.cachedHuntIndex != -1) { if (GameStatsManager.Instance.GetFlag((GungeonFlags)35500) && GameStatsManager.Instance.GetFlag((GungeonFlags)36015)) { if (AdvancedGameStatsManager.Instance.cachedHuntIndex >= 0 && AdvancedGameStatsManager.Instance.cachedHuntIndex < HuntData.ProceduralQuests.Count) { self.CurrentActiveMonsterHuntID = AdvancedGameStatsManager.Instance.cachedHuntIndex; AdvancedGameStatsManager.Instance.cachedHuntIndex = -1; } } else if (AdvancedGameStatsManager.Instance.cachedHuntIndex >= 0 || AdvancedGameStatsManager.Instance.cachedHuntIndex < HuntData.OrderedQuests.Count) { self.CurrentActiveMonsterHuntID = AdvancedGameStatsManager.Instance.cachedHuntIndex; AdvancedGameStatsManager.Instance.cachedHuntIndex = -1; } } } orig(self); if (val == null && !GameStatsManager.Instance.GetFlag((GungeonFlags)35500)) { flag = true; List list4 = (List)field.GetValue(null); if (list4 != null) { int num = 0; for (int i = 0; i < list4.Count; i++) { num++; } if ((Object)(object)GameManager.Instance == (Object)null && GameManager.Instance.platformInterface == null) { GameManager.Instance.platformInterface.SetStat((PlatformStat)7, num); } } } GameStatsManager.Instance.SetFlag((GungeonFlags)35500, flag); _ = self.ActiveQuest; } public static MonsterHuntQuest AddProceduralQuest(List questIntroConversation, string targetEnemyName, List targetEnemyGuids, int numberKillsRequired, JammedEnemyState requiredState = JammedEnemyState.NoCheck, Func validTargetCheck = null, List rewardFlags = null, List customRewardFlags = null) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) string text = "#CUSTOMQUEST_PROCEDURAL_" + Guid.NewGuid().ToString().ToUpper() + "_" + Guid.NewGuid().ToString().ToUpper(); string text2 = text + "_INTRO"; string text3 = text + "_TARGET"; Databases.Strings.Core.SetComplex(text2, questIntroConversation.ToArray()); Databases.Strings.Enemies.Set(text3, targetEnemyName); return AddProceduralQuest((MonsterHuntQuest)(object)new CustomHuntQuest { QuestFlag = (GungeonFlags)0, QuestIntroString = text2, TargetStringKey = text3, ValidTargetMonsterGuids = SaveTools.CloneList(targetEnemyGuids), FlagsToSetUponReward = ((rewardFlags != null) ? SaveTools.CloneList(rewardFlags) : new List()), CustomFlagsToSetUponReward = ((customRewardFlags != null) ? SaveTools.CloneList(customRewardFlags) : new List()), NumberKillsRequired = numberKillsRequired, RequiredEnemyState = requiredState, ValidTargetCheck = validTargetCheck, CustomQuestFlag = CustomDungeonFlags.NONE }); } public static MonsterHuntQuest AddProceduralQuest(List questIntroConversation, string targetEnemyName, List targetEnemies, int numberKillsRequired, JammedEnemyState requiredState = JammedEnemyState.NoCheck, Func validTargetCheck = null, List rewardFlags = null, List customRewardFlags = null) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) string text = "#CUSTOMQUEST_PROCEDURAL_" + Guid.NewGuid().ToString().ToUpper() + "_" + Guid.NewGuid().ToString().ToUpper(); string text2 = text + "_INTRO"; string text3 = text + "_TARGET"; Databases.Strings.Core.SetComplex(text2, questIntroConversation.ToArray()); Databases.Strings.Enemies.Set(text3, targetEnemyName); return AddProceduralQuest((MonsterHuntQuest)(object)new CustomHuntQuest { QuestFlag = (GungeonFlags)0, QuestIntroString = text2, TargetStringKey = text3, ValidTargetMonsterGuids = targetEnemies.Convert((AIActor enemy) => enemy.EnemyGuid), FlagsToSetUponReward = ((rewardFlags != null) ? SaveTools.CloneList(rewardFlags) : new List()), CustomFlagsToSetUponReward = ((customRewardFlags != null) ? SaveTools.CloneList(customRewardFlags) : new List()), NumberKillsRequired = numberKillsRequired, RequiredEnemyState = requiredState, ValidTargetCheck = validTargetCheck, CustomQuestFlag = CustomDungeonFlags.NONE }); } public static MonsterHuntQuest AddQuest(CustomDungeonFlags questFlag, List questIntroConversation, string targetEnemyName, List targetEnemyGuids, int numberKillsRequired, List rewardFlags = null, List customRewardFlags = null, JammedEnemyState requiredState = JammedEnemyState.NoCheck, Func validTargetCheck = null, int? index = null) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) string text = "#CUSTOMQUEST_" + questFlag.ToString() + "_" + Guid.NewGuid().ToString().ToUpper(); string text2 = text + "_INTRO"; string text3 = text + "_TARGET"; Databases.Strings.Core.SetComplex(text2, questIntroConversation.ToArray()); Databases.Strings.Enemies.Set(text3, targetEnemyName); return AddQuest((MonsterHuntQuest)(object)new CustomHuntQuest { QuestFlag = (GungeonFlags)0, QuestIntroString = text2, TargetStringKey = text3, ValidTargetMonsterGuids = SaveTools.CloneList(targetEnemyGuids), FlagsToSetUponReward = ((rewardFlags != null) ? SaveTools.CloneList(rewardFlags) : new List()), CustomFlagsToSetUponReward = ((customRewardFlags != null) ? SaveTools.CloneList(customRewardFlags) : new List()), NumberKillsRequired = numberKillsRequired, RequiredEnemyState = requiredState, ValidTargetCheck = validTargetCheck, CustomQuestFlag = questFlag }, index); } public static MonsterHuntQuest AddQuest(GungeonFlags questFlag, List questIntroConversation, string targetEnemyName, List targetEnemyGuids, int numberKillsRequired, List rewardFlags = null, List customRewardFlags = null, JammedEnemyState requiredState = JammedEnemyState.NoCheck, Func validTargetCheck = null, int? index = null) { //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) string text = "#CUSTOMQUEST_" + ((object)(GungeonFlags)(ref questFlag)).ToString() + "_" + Guid.NewGuid().ToString().ToUpper(); string text2 = text + "_INTRO"; string text3 = text + "_TARGET"; Databases.Strings.Core.SetComplex(text2, questIntroConversation.ToArray()); Databases.Strings.Enemies.Set(text3, targetEnemyName); return AddQuest((MonsterHuntQuest)(object)new CustomHuntQuest { QuestFlag = questFlag, QuestIntroString = text2, TargetStringKey = text3, ValidTargetMonsterGuids = SaveTools.CloneList(targetEnemyGuids), FlagsToSetUponReward = ((rewardFlags != null) ? SaveTools.CloneList(rewardFlags) : new List()), CustomFlagsToSetUponReward = ((customRewardFlags != null) ? SaveTools.CloneList(customRewardFlags) : new List()), NumberKillsRequired = numberKillsRequired, RequiredEnemyState = requiredState, ValidTargetCheck = validTargetCheck, CustomQuestFlag = CustomDungeonFlags.NONE }, index); } public static MonsterHuntQuest AddQuest(CustomDungeonFlags questFlag, List questIntroConversation, string targetEnemyName, List targetEnemies, int numberKillsRequired, List rewardFlags = null, List customRewardFlags = null, JammedEnemyState requiredState = JammedEnemyState.NoCheck, Func validTargetCheck = null, int? index = null) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) string text = "#CUSTOMQUEST_" + questFlag.ToString() + "_" + Guid.NewGuid().ToString().ToUpper(); string text2 = text + "_INTRO"; string text3 = text + "_TARGET"; Databases.Strings.Core.SetComplex(text2, questIntroConversation.ToArray()); Databases.Strings.Enemies.Set(text3, targetEnemyName); return AddQuest((MonsterHuntQuest)(object)new CustomHuntQuest { QuestFlag = (GungeonFlags)0, QuestIntroString = text2, TargetStringKey = text3, ValidTargetMonsterGuids = targetEnemies.Convert((AIActor enemy) => enemy.EnemyGuid), FlagsToSetUponReward = ((rewardFlags != null) ? SaveTools.CloneList(rewardFlags) : new List()), CustomFlagsToSetUponReward = ((customRewardFlags != null) ? SaveTools.CloneList(customRewardFlags) : new List()), NumberKillsRequired = numberKillsRequired, RequiredEnemyState = requiredState, ValidTargetCheck = validTargetCheck, CustomQuestFlag = questFlag }, index); } public static MonsterHuntQuest AddQuest(GungeonFlags questFlag, List questIntroConversation, string targetEnemyName, List targetEnemies, int numberKillsRequired, List rewardFlags = null, List customRewardFlags = null, JammedEnemyState requiredState = JammedEnemyState.NoCheck, Func validTargetCheck = null, int? index = null) { //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) string text = "#CUSTOMQUEST_" + ((object)(GungeonFlags)(ref questFlag)).ToString() + "_" + Guid.NewGuid().ToString().ToUpper(); string text2 = text + "_INTRO"; string text3 = text + "_TARGET"; Databases.Strings.Core.SetComplex(text2, questIntroConversation.ToArray()); Databases.Strings.Enemies.Set(text3, targetEnemyName); return AddQuest((MonsterHuntQuest)(object)new CustomHuntQuest { QuestFlag = questFlag, QuestIntroString = text2, TargetStringKey = text3, ValidTargetMonsterGuids = targetEnemies.Convert((AIActor enemy) => enemy.EnemyGuid), FlagsToSetUponReward = ((rewardFlags != null) ? SaveTools.CloneList(rewardFlags) : new List()), CustomFlagsToSetUponReward = ((customRewardFlags != null) ? SaveTools.CloneList(customRewardFlags) : new List()), NumberKillsRequired = numberKillsRequired, RequiredEnemyState = requiredState, ValidTargetCheck = validTargetCheck, CustomQuestFlag = CustomDungeonFlags.NONE }, index); } public static MonsterHuntQuest AddQuest(MonsterHuntQuest quest, int? index = null) { if ((Object)(object)HuntData == (Object)null) { DoSetup(); } if (!index.HasValue) { HuntData.OrderedQuests.Add(quest); } else if (index.Value < 0) { HuntData.OrderedQuests.Add(quest); } else { HuntData.OrderedQuests.InsertOrAdd(index.Value, quest); } if (GameStatsManager.HasInstance && GameStatsManager.Instance.huntProgress != null) { GameStatsManager.Instance.huntProgress.OnLoaded(); } else { int? num = null; if (AdvancedGameStatsManager.HasInstance) { num = AdvancedGameStatsManager.Instance.cachedHuntIndex; AdvancedGameStatsManager.Save(); } GameStatsManager.Load(); if (num.HasValue && AdvancedGameStatsManager.HasInstance) { AdvancedGameStatsManager.Instance.cachedHuntIndex = num.Value; } } if (addedOrderedQuests == null) { addedOrderedQuests = new List(); } addedOrderedQuests.Add(quest); return quest; } public static MonsterHuntQuest AddProceduralQuest(MonsterHuntQuest quest) { if ((Object)(object)HuntData == (Object)null) { DoSetup(); } HuntData.ProceduralQuests.Add(quest); if (GameStatsManager.HasInstance && GameStatsManager.Instance.huntProgress != null) { GameStatsManager.Instance.huntProgress.OnLoaded(); } else { int? num = null; if (AdvancedGameStatsManager.HasInstance) { num = AdvancedGameStatsManager.Instance.cachedHuntIndex; AdvancedGameStatsManager.Save(); } GameStatsManager.Load(); if (num.HasValue && AdvancedGameStatsManager.HasInstance) { AdvancedGameStatsManager.Instance.cachedHuntIndex = num.Value; } } if (addedProceduralQuests == null) { addedProceduralQuests = new List(); } addedProceduralQuests.Add(quest); return quest; } } public class AdvancedMidGameSaveData { [fsProperty] public AdvancedGameStats PriorSessionStats; [fsProperty] public string midGameSaveGuid; [fsProperty] public bool invalidated; public AdvancedMidGameSaveData(string midGameSaveGuid) { this.midGameSaveGuid = midGameSaveGuid; PriorSessionStats = AdvancedGameStatsManager.Instance.MoveSessionStatsToSavedSessionStats(); } public bool IsValid() { return !invalidated; } public void Invalidate() { invalidated = true; } public void Revalidate() { invalidated = false; } public void LoadDataFromMidGameSave() { AdvancedGameStatsManager.Instance.AssignMidGameSavedSessionStats(PriorSessionStats); } } public static class SaveAPIManager { public delegate void OnActiveGameDataClearedDelegate(GameManager manager, bool destroyGameManager, bool endSession); [CompilerGenerated] private sealed class d__32 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Func orig; public Dungeon self; public MidGameSaveData data; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__32(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = orig(self, data); <>1__state = 1; return true; case 1: { <>1__state = -1; if (AdvancedGameStatsManager.VerifyAndLoadMidgameSave(out var midgameSave)) { midgameSave.LoadDataFromMidGameSave(); } return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static Hook saveHook; private static Hook loadHook; private static Hook resetHook; private static Hook beginSessionHook; private static Hook endSessionHook; private static Hook clearAllStatsHook; private static Hook deleteMidGameSaveHook; private static Hook midgameSaveHook; private static Hook invalidateSaveHook; private static Hook revalidateSaveHook; private static Hook frameDelayedInitizlizationHook; private static Hook moveSessionStatsHook; private static Hook prerequisiteHook; private static Hook clearActiveGameDataHook; private static Hook aiactorRewardsHook; private static Hook aiactorEngagedHook; private static bool m_loaded; public static SaveType AdvancedGameSave; public static SaveType AdvancedMidGameSave; public static OnActiveGameDataClearedDelegate OnActiveGameDataCleared; private static bool FirstLoad; public static bool IsFirstLoad => FirstLoad; public static void Setup(string prefix) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_0065: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_00ca: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Expected O, but got Unknown //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Expected O, but got Unknown //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Expected O, but got Unknown //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Expected O, but got Unknown //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Expected O, but got Unknown //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Expected O, but got Unknown //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Expected O, but got Unknown //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Expected O, but got Unknown //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Expected O, but got Unknown //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Expected O, but got Unknown //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Expected O, but got Unknown //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Expected O, but got Unknown //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Expected O, but got Unknown //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Expected O, but got Unknown //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Expected O, but got Unknown //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Expected O, but got Unknown if (!m_loaded) { AdvancedGameSave = new SaveType { filePattern = "Slot{0}." + prefix + "Save", encrypted = true, backupCount = 3, backupPattern = "Slot{0}." + prefix + "Backup.{1}", backupMinTimeMin = 45, legacyFilePattern = prefix + "GameStatsSlot{0}.txt" }; AdvancedMidGameSave = new SaveType { filePattern = "Active{0}." + prefix + "Game", legacyFilePattern = prefix + "ActiveSlot{0}.txt", encrypted = true, backupCount = 0, backupPattern = "Active{0}." + prefix + "Backup.{1}", backupMinTimeMin = 60 }; for (int i = 0; i < 3; i++) { SaveSlot val = (SaveSlot)i; SaveTools.SafeMove(Path.Combine(SaveManager.OldSavePath, string.Format(AdvancedGameSave.legacyFilePattern, val)), Path.Combine(SaveManager.OldSavePath, string.Format(AdvancedGameSave.filePattern, val))); SaveTools.SafeMove(Path.Combine(SaveManager.OldSavePath, string.Format(AdvancedGameSave.filePattern, val)), Path.Combine(SaveManager.OldSavePath, string.Format(AdvancedGameSave.filePattern, val))); SaveTools.SafeMove(SaveTools.PathCombine(SaveManager.SavePath, "01", string.Format(AdvancedGameSave.filePattern, val)), Path.Combine(SaveManager.SavePath, string.Format(AdvancedGameSave.filePattern, val)), allowOverwritting: true); } saveHook = new Hook((MethodBase)typeof(GameStatsManager).GetMethod("Save", BindingFlags.Static | BindingFlags.Public), typeof(SaveAPIManager).GetMethod("SaveHook")); loadHook = new Hook((MethodBase)typeof(GameStatsManager).GetMethod("Load", BindingFlags.Static | BindingFlags.Public), typeof(SaveAPIManager).GetMethod("LoadHook")); resetHook = new Hook((MethodBase)typeof(GameStatsManager).GetMethod("DANGEROUS_ResetAllStats", BindingFlags.Static | BindingFlags.Public), typeof(SaveAPIManager).GetMethod("ResetHook")); beginSessionHook = new Hook((MethodBase)typeof(GameStatsManager).GetMethod("BeginNewSession", BindingFlags.Instance | BindingFlags.Public), typeof(SaveAPIManager).GetMethod("BeginSessionHook")); endSessionHook = new Hook((MethodBase)typeof(GameStatsManager).GetMethod("EndSession", BindingFlags.Instance | BindingFlags.Public), typeof(SaveAPIManager).GetMethod("EndSessionHook")); clearAllStatsHook = new Hook((MethodBase)typeof(GameStatsManager).GetMethod("ClearAllStatsGlobal", BindingFlags.Instance | BindingFlags.Public), typeof(SaveAPIManager).GetMethod("ClearAllStatsHook")); deleteMidGameSaveHook = new Hook((MethodBase)typeof(SaveManager).GetMethod("DeleteCurrentSlotMidGameSave", BindingFlags.Static | BindingFlags.Public), typeof(SaveAPIManager).GetMethod("DeleteMidGameSaveHook")); midgameSaveHook = new Hook((MethodBase)typeof(GameManager).GetMethod("DoMidgameSave", BindingFlags.Static | BindingFlags.Public), typeof(SaveAPIManager).GetMethod("MidgameSaveHook")); invalidateSaveHook = new Hook((MethodBase)typeof(GameManager).GetMethod("InvalidateMidgameSave", BindingFlags.Static | BindingFlags.Public), typeof(SaveAPIManager).GetMethod("InvalidateSaveHook")); revalidateSaveHook = new Hook((MethodBase)typeof(GameManager).GetMethod("RevalidateMidgameSave", BindingFlags.Static | BindingFlags.Public), typeof(SaveAPIManager).GetMethod("RevalidateSaveHook")); frameDelayedInitizlizationHook = new Hook((MethodBase)typeof(Dungeon).GetMethod("FrameDelayedMidgameInitialization", BindingFlags.Instance | BindingFlags.NonPublic), typeof(SaveAPIManager).GetMethod("FrameDelayedInitizlizationHook")); moveSessionStatsHook = new Hook((MethodBase)typeof(GameStatsManager).GetMethod("MoveSessionStatsToSavedSessionStats", BindingFlags.Instance | BindingFlags.Public), typeof(SaveAPIManager).GetMethod("MoveSessionStatsHook")); prerequisiteHook = new Hook((MethodBase)typeof(DungeonPrerequisite).GetMethod("CheckConditionsFulfilled", BindingFlags.Instance | BindingFlags.Public), typeof(SaveAPIManager).GetMethod("PrerequisiteHook")); clearActiveGameDataHook = new Hook((MethodBase)typeof(GameManager).GetMethod("ClearActiveGameData", BindingFlags.Instance | BindingFlags.Public), typeof(SaveAPIManager).GetMethod("ClearActiveGameDataHook")); aiactorRewardsHook = new Hook((MethodBase)typeof(AIActor).GetMethod("HandleRewards", BindingFlags.Instance | BindingFlags.NonPublic), typeof(SaveAPIManager).GetMethod("AIActorRewardsHook")); aiactorEngagedHook = new Hook((MethodBase)typeof(AIActor).GetMethod("OnEngaged", BindingFlags.Instance | BindingFlags.NonPublic), typeof(SaveAPIManager).GetMethod("AIActorEngagedHook")); LoadGameStatsFirstLoad(); m_loaded = true; } } public static void Reload(string prefix) { Unload(); Setup(prefix); } private static void LoadGameStatsFirstLoad() { bool firstLoad = FirstLoad; FirstLoad = true; GameStatsManager.Load(); FirstLoad = firstLoad; } public static void Unload() { if (m_loaded) { AdvancedGameSave = null; AdvancedMidGameSave = null; Hook obj = saveHook; if (obj != null) { obj.Dispose(); } Hook obj2 = loadHook; if (obj2 != null) { obj2.Dispose(); } Hook obj3 = resetHook; if (obj3 != null) { obj3.Dispose(); } Hook obj4 = beginSessionHook; if (obj4 != null) { obj4.Dispose(); } Hook obj5 = endSessionHook; if (obj5 != null) { obj5.Dispose(); } Hook obj6 = clearAllStatsHook; if (obj6 != null) { obj6.Dispose(); } Hook obj7 = deleteMidGameSaveHook; if (obj7 != null) { obj7.Dispose(); } Hook obj8 = midgameSaveHook; if (obj8 != null) { obj8.Dispose(); } Hook obj9 = invalidateSaveHook; if (obj9 != null) { obj9.Dispose(); } Hook obj10 = revalidateSaveHook; if (obj10 != null) { obj10.Dispose(); } Hook obj11 = frameDelayedInitizlizationHook; if (obj11 != null) { obj11.Dispose(); } Hook obj12 = moveSessionStatsHook; if (obj12 != null) { obj12.Dispose(); } Hook obj13 = prerequisiteHook; if (obj13 != null) { obj13.Dispose(); } Hook obj14 = clearActiveGameDataHook; if (obj14 != null) { obj14.Dispose(); } Hook obj15 = aiactorRewardsHook; if (obj15 != null) { obj15.Dispose(); } Hook obj16 = aiactorEngagedHook; if (obj16 != null) { obj16.Dispose(); } CustomHuntQuests.Unload(); AdvancedGameStatsManager.Save(); AdvancedGameStatsManager.Unload(); BreachShopTool.Unload(); m_loaded = false; } } public static bool GetFlag(CustomDungeonFlags flag) { if (!AdvancedGameStatsManager.HasInstance) { return false; } return AdvancedGameStatsManager.Instance.GetFlag(flag); } public static float GetPlayerStatValue(CustomTrackedStats stat) { if (!AdvancedGameStatsManager.HasInstance) { return 0f; } return AdvancedGameStatsManager.Instance.GetPlayerStatValue(stat); } public static float GetSessionStatValue(CustomTrackedStats stat) { if (AdvancedGameStatsManager.HasInstance && AdvancedGameStatsManager.Instance.IsInSession) { return AdvancedGameStatsManager.Instance.GetSessionStatValue(stat); } return 0f; } public static float GetCharacterStatValue(PlayableCharacters character, CustomTrackedStats stat) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (AdvancedGameStatsManager.HasInstance) { return AdvancedGameStatsManager.Instance.GetCharacterStatValue(character, stat); } return 0f; } public static float GetCharacterStatValue(CustomTrackedStats stat) { if (AdvancedGameStatsManager.HasInstance) { if (GameManager.HasInstance && (Object)(object)GameManager.Instance.PrimaryPlayer != (Object)null) { return AdvancedGameStatsManager.Instance.GetCharacterStatValue(stat); } return AdvancedGameStatsManager.Instance.GetCharacterStatValue((PlayableCharacters)0, stat); } return 0f; } public static bool GetCharacterSpecificFlag(CustomCharacterSpecificGungeonFlags flag) { if (AdvancedGameStatsManager.HasInstance) { if (AdvancedGameStatsManager.Instance.IsInSession) { return AdvancedGameStatsManager.Instance.GetCharacterSpecificFlag(flag); } return AdvancedGameStatsManager.Instance.GetCharacterSpecificFlag((PlayableCharacters)0, flag); } return false; } public static bool GetCharacterSpecificFlag(PlayableCharacters character, CustomCharacterSpecificGungeonFlags flag) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (AdvancedGameStatsManager.HasInstance) { return AdvancedGameStatsManager.Instance.GetCharacterSpecificFlag(character, flag); } return false; } public static float GetPlayerMaximum(CustomTrackedMaximums maximum) { if (AdvancedGameStatsManager.HasInstance) { return AdvancedGameStatsManager.Instance.GetPlayerMaximum(maximum); } return 0f; } public static void SetFlag(CustomDungeonFlags flag, bool value) { if (AdvancedGameStatsManager.HasInstance) { AdvancedGameStatsManager.Instance.SetFlag(flag, value); } } public static void SetStat(CustomTrackedStats stat, float value) { if (AdvancedGameStatsManager.HasInstance) { AdvancedGameStatsManager.Instance.SetStat(stat, value); } } public static void RegisterStatChange(CustomTrackedStats stat, float value) { if (AdvancedGameStatsManager.HasInstance) { AdvancedGameStatsManager.Instance.RegisterStatChange(stat, value); } } public static void UpdateMaximum(CustomTrackedMaximums maximum, float value) { if (AdvancedGameStatsManager.HasInstance) { AdvancedGameStatsManager.Instance.UpdateMaximum(maximum, value); } } public static void SetCharacterSpecificFlag(CustomCharacterSpecificGungeonFlags flag, bool value) { if (AdvancedGameStatsManager.HasInstance) { AdvancedGameStatsManager.Instance.SetCharacterSpecificFlag(flag, value); } } public static void SetCharacterSpecificFlag(PlayableCharacters character, CustomCharacterSpecificGungeonFlags flag, bool value) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (AdvancedGameStatsManager.HasInstance) { AdvancedGameStatsManager.Instance.SetCharacterSpecificFlag(character, flag, value); } } public static void AIActorEngagedHook(Action orig, AIActor self, bool isReinforcement) { if (!self.HasBeenEngaged && self.SetsCustomFlagOnActivation()) { AdvancedGameStatsManager.Instance.SetFlag(self.GetCustomFlagToSetOnActivation(), value: true); } orig(self, isReinforcement); } public static void AIActorRewardsHook(Action orig, AIActor self) { if (!(bool)typeof(AIActor).GetField("m_hasGivenRewards", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(self) && !self.IsTransmogrified) { if (self.SetsCustomFlagOnDeath()) { AdvancedGameStatsManager.Instance.SetFlag(self.GetCustomFlagToSetOnDeath(), value: true); } if (self.SetsCustomCharacterSpecificFlagOnDeath()) { AdvancedGameStatsManager.Instance.SetCharacterSpecificFlag(self.GetCustomCharacterSpecificFlagToSetOnDeath(), value: true); } } orig(self); } public static bool SaveHook(Func orig) { bool result = orig(); AdvancedGameStatsManager.Save(); return result; } public static void LoadHook(Action orig) { AdvancedGameStatsManager.Load(); orig(); } public static void ResetHook(Action orig) { AdvancedGameStatsManager.DANGEROUS_ResetAllStats(); orig(); } public static void BeginSessionHook(Action orig, GameStatsManager self, PlayerController player) { orig(self, player); AdvancedGameStatsManager.Instance.BeginNewSession(player); } public static void EndSessionHook(Action orig, GameStatsManager self, bool recordSessionStats, bool decrementDifferentiator = true) { orig(self, recordSessionStats, decrementDifferentiator); AdvancedGameStatsManager.Instance.EndSession(recordSessionStats); } public static void ClearAllStatsHook(Action orig, GameStatsManager self) { orig(self); AdvancedGameStatsManager.Instance.ClearAllStatsGlobal(); } public static void DeleteMidGameSaveHook(Action orig, SaveSlot? overrideSaveSlot) { //IL_0035: 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) orig(overrideSaveSlot); if (AdvancedGameStatsManager.HasInstance) { AdvancedGameStatsManager.Instance.midGameSaveGuid = null; } string path = string.Format(SaveManager.MidGameSave.filePattern, (!overrideSaveSlot.HasValue) ? SaveManager.CurrentSaveSlot : overrideSaveSlot.Value); string path2 = Path.Combine(SaveManager.SavePath, path); if (File.Exists(path2)) { File.Delete(path2); } } public static void MidgameSaveHook(Action orig, ValidTilesets tileset) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) AdvancedGameStatsManager.DoMidgameSave(); orig(tileset); } public static void InvalidateSaveHook(Action orig, bool savestats) { AdvancedGameStatsManager.InvalidateMidgameSave(saveStats: false); orig(savestats); } public static void RevalidateSaveHook(Action orig) { AdvancedGameStatsManager.RevalidateMidgameSave(saveStats: false); orig(); } public static IEnumerator FrameDelayedInitizlizationHook(Func orig, Dungeon self, MidGameSaveData data) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__32(0) { orig = orig, self = self, data = data }; } public static GameStats MoveSessionStatsHook(Func orig, GameStatsManager self) { AdvancedGameStatsManager.Instance.MoveSessionStatsToSavedSessionStats(); return orig(self); } public static bool PrerequisiteHook(Func orig, DungeonPrerequisite self) { if (self is CustomDungeonPrerequisite) { return (self as CustomDungeonPrerequisite).CheckConditionsFulfilled(); } return orig(self); } public static void ClearActiveGameDataHook(Action orig, GameManager self, bool destroyGameManager, bool endSession) { orig(self, destroyGameManager, endSession); OnActiveGameDataCleared?.Invoke(self, destroyGameManager, endSession); } } public class SpecialAIActor : MonoBehaviour { public bool SetsCustomFlagOnActivation; public CustomDungeonFlags CustomFlagToSetOnActivation; public bool SetsCustomFlagOnDeath; public CustomDungeonFlags CustomFlagToSetOnDeath; public bool SetsCustomCharacterSpecificFlagOnDeath; public CustomCharacterSpecificGungeonFlags CustomCharacterSpecificFlagToSetOnDeath; } [fsObject] public class AdvancedGameStats { [fsProperty] private Dictionary stats; [fsProperty] private Dictionary maxima; [fsProperty] public HashSet m_flags; public AdvancedGameStats() { m_flags = new HashSet(); stats = new Dictionary(new CustomTrackedStatsComparer()); maxima = new Dictionary(new CustomTrackedMaximumsComparer()); } public float GetStatValue(CustomTrackedStats statToCheck) { if (!stats.ContainsKey(statToCheck)) { return 0f; } return stats[statToCheck]; } public float GetMaximumValue(CustomTrackedMaximums maxToCheck) { if (!maxima.ContainsKey(maxToCheck)) { return 0f; } return maxima[maxToCheck]; } public bool GetFlag(CustomCharacterSpecificGungeonFlags flag) { if (flag == CustomCharacterSpecificGungeonFlags.NONE) { Debug.LogError((object)"Something is attempting to get a NONE character-specific save flag!"); return false; } return m_flags.Contains(flag); } public void SetStat(CustomTrackedStats stat, float val) { if (stats.ContainsKey(stat)) { stats[stat] = val; } else { stats.Add(stat, val); } } public void SetMax(CustomTrackedMaximums max, float val) { if (maxima.ContainsKey(max)) { maxima[max] = Mathf.Max(maxima[max], val); } else { maxima.Add(max, val); } } public void SetFlag(CustomCharacterSpecificGungeonFlags flag, bool value) { if (flag == CustomCharacterSpecificGungeonFlags.NONE) { Debug.LogError((object)"Something is attempting to set a NONE character-specific save flag!"); } else if (value) { m_flags.Add(flag); } else { m_flags.Remove(flag); } } public void IncrementStat(CustomTrackedStats stat, float val) { if (stats.ContainsKey(stat)) { stats[stat] += val; } else { stats.Add(stat, val); } } public void AddStats(AdvancedGameStats otherStats) { foreach (KeyValuePair stat in otherStats.stats) { IncrementStat(stat.Key, stat.Value); } foreach (KeyValuePair item in otherStats.maxima) { SetMax(item.Key, item.Value); } foreach (CustomCharacterSpecificGungeonFlags flag in otherStats.m_flags) { m_flags.Add(flag); } } public void ClearAllState() { List list = new List(); foreach (KeyValuePair stat in stats) { list.Add(stat.Key); } foreach (CustomTrackedStats item in list) { stats[item] = 0f; } List list2 = new List(); foreach (KeyValuePair item2 in maxima) { list2.Add(item2.Key); } foreach (CustomTrackedMaximums item3 in list2) { maxima[item3] = 0f; } } } public static class BreachShopTool { public class DoubleMetaShopTier { private MetaShopTier m_topTier; private MetaShopTier m_bottomTier; public DoubleMetaShopTier(MetaShopTier topTier, MetaShopTier bottomTier) { m_topTier = topTier; m_bottomTier = bottomTier; } public DoubleMetaShopTier(DoubleMetaShopTier other) { m_topTier = other.m_topTier; m_bottomTier = other.m_bottomTier; } public MetaShopTier GetTopTier() { return m_topTier; } public MetaShopTier GetBottomTier() { return m_topTier; } public List GetTierList() { return new List { m_topTier, m_bottomTier }; } } public static MetaShopController BaseMetaShopController; public static GenericLootTable TrorcMetaShopItems; public static GenericLootTable GooptonMetaShopItems; public static GenericLootTable DougMetaShopItems; private static FieldInfo ItemControllersInfo = typeof(ShopController).GetField("m_itemControllers", BindingFlags.Instance | BindingFlags.NonPublic); private static FieldInfo BaseItemControllersInfo = typeof(BaseShopController).GetField("m_itemControllers", BindingFlags.Instance | BindingFlags.NonPublic); private static Hook pickupObjectEncounterableHook; private static Hook baseShopSetupHook; private static Hook metaShopSetupHook; private static Hook metaShopCurrentTierHook; private static Hook metaShopProximateTierHook; public static Dictionary> baseShopAddedItems; public static List metaShopAddedTiers; private static bool m_loaded; public static void DoSetup() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Expected O, but got Unknown if (!m_loaded) { BaseMetaShopController = SaveTools.LoadAssetFromAnywhere("Foyer_MetaShop").GetComponent(); TrorcMetaShopItems = SaveTools.LoadAssetFromAnywhere("Shop_Truck_Meta"); GooptonMetaShopItems = SaveTools.LoadAssetFromAnywhere("Shop_Goop_Meta"); DougMetaShopItems = SaveTools.LoadAssetFromAnywhere("Shop_Beetle_Meta"); pickupObjectEncounterableHook = new Hook((MethodBase)typeof(PickupObject).GetMethod("HandleEncounterable", BindingFlags.Instance | BindingFlags.NonPublic), typeof(BreachShopTool).GetMethod("HandleEncounterableHook")); baseShopSetupHook = new Hook((MethodBase)typeof(BaseShopController).GetMethod("DoSetup", BindingFlags.Instance | BindingFlags.NonPublic), typeof(BreachShopTool).GetMethod("BaseShopSetupHook")); metaShopSetupHook = new Hook((MethodBase)typeof(MetaShopController).GetMethod("DoSetup", BindingFlags.Instance | BindingFlags.NonPublic), typeof(BreachShopTool).GetMethod("MetaSetupHook")); metaShopCurrentTierHook = new Hook((MethodBase)typeof(MetaShopController).GetMethod("GetCurrentTier", BindingFlags.Instance | BindingFlags.NonPublic), typeof(BreachShopTool).GetMethod("MetaShopCurrentTierHook")); metaShopProximateTierHook = new Hook((MethodBase)typeof(MetaShopController).GetMethod("GetProximateTier", BindingFlags.Instance | BindingFlags.NonPublic), typeof(BreachShopTool).GetMethod("MetaShopProximateTierHook")); m_loaded = true; } } public static void Unload() { if (!m_loaded) { return; } if (baseShopAddedItems != null) { for (int i = 0; i < baseShopAddedItems.Keys.Count; i++) { WeightedGameObjectCollection val = baseShopAddedItems.Keys.ToList()[i]; if (val == null || baseShopAddedItems[val] == null) { continue; } for (int j = 0; j < baseShopAddedItems[val].Count; j++) { WeightedGameObject val2 = baseShopAddedItems[val][j]; if (val2 != null && val.elements.Contains(val2)) { val.elements.Remove(val2); } } } baseShopAddedItems.Clear(); baseShopAddedItems = null; } if (metaShopAddedTiers != null) { for (int k = 0; k < metaShopAddedTiers.Count; k++) { MetaShopTier val3 = metaShopAddedTiers[k]; if (val3 != null && BaseMetaShopController.metaShopTiers.Contains(val3)) { BaseMetaShopController.metaShopTiers.Remove(val3); } } metaShopAddedTiers.Clear(); metaShopAddedTiers = null; } BaseMetaShopController = null; TrorcMetaShopItems = null; GooptonMetaShopItems = null; DougMetaShopItems = null; Hook obj = pickupObjectEncounterableHook; if (obj != null) { obj.Dispose(); } Hook obj2 = baseShopSetupHook; if (obj2 != null) { obj2.Dispose(); } Hook obj3 = metaShopSetupHook; if (obj3 != null) { obj3.Dispose(); } Hook obj4 = metaShopCurrentTierHook; if (obj4 != null) { obj4.Dispose(); } Hook obj5 = metaShopProximateTierHook; if (obj5 != null) { obj5.Dispose(); } m_loaded = false; } public static void HandleEncounterableHook(Action orig, PickupObject po, PlayerController player) { orig(po, player); if ((Object)(object)po != (Object)null && (Object)(object)((Component)po).GetComponent() != (Object)null && ((Component)po).GetComponent().CustomSaveFlagToSetOnAcquisition != 0) { AdvancedGameStatsManager.Instance.SetFlag(((Component)po).GetComponent().CustomSaveFlagToSetOnAcquisition, value: true); } } public static void BaseShopSetupHook(Action orig, BaseShopController self) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 orig(self); if ((int)self.baseShopType != 6 || !((Object)(object)self.ExampleBlueprintPrefab != (Object)null)) { return; } List list = (List)BaseItemControllersInfo.GetValue(self); if (list == null) { return; } foreach (ShopItemController item in list) { if (!((Object)(object)item != (Object)null) || !((Object)(object)item.item != (Object)null) || !((Object)(object)((BraveBehaviour)item.item).encounterTrackable != (Object)null) || ((BraveBehaviour)item.item).encounterTrackable.journalData == null) { continue; } PickupObject blueprintUnlockedItem = GetBlueprintUnlockedItem(((BraveBehaviour)item.item).encounterTrackable); if (!((Object)(object)blueprintUnlockedItem != (Object)null) || !((Object)(object)((BraveBehaviour)blueprintUnlockedItem).encounterTrackable != (Object)null) || ((BraveBehaviour)blueprintUnlockedItem).encounterTrackable.prerequisites == null) { continue; } CustomDungeonFlags customDungeonFlags = CustomDungeonFlags.NONE; for (int i = 0; i < ((BraveBehaviour)blueprintUnlockedItem).encounterTrackable.prerequisites.Length; i++) { if (((BraveBehaviour)blueprintUnlockedItem).encounterTrackable.prerequisites[i] is CustomDungeonPrerequisite && (((BraveBehaviour)blueprintUnlockedItem).encounterTrackable.prerequisites[i] as CustomDungeonPrerequisite).advancedPrerequisiteType == CustomDungeonPrerequisite.AdvancedPrerequisiteType.CUSTOM_FLAG) { customDungeonFlags = (((BraveBehaviour)blueprintUnlockedItem).encounterTrackable.prerequisites[i] as CustomDungeonPrerequisite).customFlagToCheck; } } if (customDungeonFlags != 0) { ((Component)item.item).gameObject.AddComponent().CustomSaveFlagToSetOnAcquisition = customDungeonFlags; } } } public static void MetaSetupHook(Action orig, MetaShopController meta) { orig(meta); List list = (List)ItemControllersInfo.GetValue(meta); if (list == null) { return; } foreach (ShopItemController item in list) { if (!((Object)(object)item != (Object)null) || !((Object)(object)item.item != (Object)null) || !((Object)(object)((BraveBehaviour)item.item).encounterTrackable != (Object)null) || ((BraveBehaviour)item.item).encounterTrackable.journalData == null) { continue; } PickupObject blueprintUnlockedItem = GetBlueprintUnlockedItem(((BraveBehaviour)item.item).encounterTrackable); if (!((Object)(object)blueprintUnlockedItem != (Object)null) || !((Object)(object)((BraveBehaviour)blueprintUnlockedItem).encounterTrackable != (Object)null) || ((BraveBehaviour)blueprintUnlockedItem).encounterTrackable.prerequisites == null) { continue; } CustomDungeonFlags customFlagFromTargetItem = GetCustomFlagFromTargetItem(blueprintUnlockedItem.PickupObjectId); if (customFlagFromTargetItem != 0) { ((Component)item.item).gameObject.AddComponent().CustomSaveFlagToSetOnAcquisition = customFlagFromTargetItem; if (AdvancedGameStatsManager.Instance.GetFlag(customFlagFromTargetItem)) { item.ForceOutOfStock(); } } } } private static bool GetMetaItemUnlockedAdvanced(int pickupObjectId) { CustomDungeonFlags customFlagFromTargetItem = GetCustomFlagFromTargetItem(pickupObjectId); if (customFlagFromTargetItem == CustomDungeonFlags.NONE) { return true; } return AdvancedGameStatsManager.Instance.GetFlag(customFlagFromTargetItem); } public static MetaShopTier MetaShopCurrentTierHook(Func orig, MetaShopController self) { MetaShopTier val = null; for (int i = 0; i < self.metaShopTiers.Count; i++) { if (!GetMetaItemUnlockedAdvanced(self.metaShopTiers[i].itemId1) || !GetMetaItemUnlockedAdvanced(self.metaShopTiers[i].itemId2) || !GetMetaItemUnlockedAdvanced(self.metaShopTiers[i].itemId3)) { val = self.metaShopTiers[i]; break; } } List metaShopTiers = self.metaShopTiers; List list = new List(); for (int j = 0; j < metaShopTiers.Count; j++) { if (metaShopTiers[j] != null && (!ItemConditionsFulfilled(metaShopTiers[j].itemId1) || !ItemConditionsFulfilled(metaShopTiers[j].itemId2) || !ItemConditionsFulfilled(metaShopTiers[j].itemId3) || j == metaShopTiers.Count - 1)) { list.Add(metaShopTiers[j]); } } self.metaShopTiers = list; MetaShopTier val2 = orig(self); self.metaShopTiers = metaShopTiers; if (val == null) { return val2; } if (val2 == null) { return val; } if (self.metaShopTiers.IndexOf(val) >= self.metaShopTiers.IndexOf(val2)) { return val2; } return val; } public static MetaShopTier MetaShopProximateTierHook(Func orig, MetaShopController self) { MetaShopTier val = null; for (int i = 0; i < self.metaShopTiers.Count - 1; i++) { if (!GetMetaItemUnlockedAdvanced(self.metaShopTiers[i].itemId1) || !GetMetaItemUnlockedAdvanced(self.metaShopTiers[i].itemId2) || !GetMetaItemUnlockedAdvanced(self.metaShopTiers[i].itemId3)) { val = self.metaShopTiers[i + 1]; break; } } List metaShopTiers = self.metaShopTiers; List list = new List(); for (int j = 0; j < metaShopTiers.Count; j++) { if (metaShopTiers[j] != null && (!ItemConditionsFulfilled(metaShopTiers[j].itemId1) || !ItemConditionsFulfilled(metaShopTiers[j].itemId2) || !ItemConditionsFulfilled(metaShopTiers[j].itemId3))) { list.Add(metaShopTiers[j]); } } self.metaShopTiers = list; MetaShopTier val2 = orig(self); self.metaShopTiers = metaShopTiers; if (val == null) { return val2; } if (val2 == null) { return val; } if (self.metaShopTiers.IndexOf(val) >= self.metaShopTiers.IndexOf(val2)) { return val2; } return val; } public static CustomDungeonFlags GetCustomFlagFromTargetItem(int shopItemId) { CustomDungeonFlags result = CustomDungeonFlags.NONE; PickupObject byId = PickupObjectDatabase.GetById(shopItemId); for (int i = 0; i < ((BraveBehaviour)byId).encounterTrackable.prerequisites.Length; i++) { if (((BraveBehaviour)byId).encounterTrackable.prerequisites[i] is CustomDungeonPrerequisite && (((BraveBehaviour)byId).encounterTrackable.prerequisites[i] as CustomDungeonPrerequisite).advancedPrerequisiteType == CustomDungeonPrerequisite.AdvancedPrerequisiteType.CUSTOM_FLAG) { result = (((BraveBehaviour)byId).encounterTrackable.prerequisites[i] as CustomDungeonPrerequisite).customFlagToCheck; } } return result; } public static GungeonFlags GetFlagFromTargetItem(int shopItemId) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) GungeonFlags result = (GungeonFlags)0; PickupObject byId = PickupObjectDatabase.GetById(shopItemId); for (int i = 0; i < ((BraveBehaviour)byId).encounterTrackable.prerequisites.Length; i++) { if ((int)((BraveBehaviour)byId).encounterTrackable.prerequisites[i].prerequisiteType == 4) { result = ((BraveBehaviour)byId).encounterTrackable.prerequisites[i].saveFlagToCheck; } } return result; } public static bool ItemConditionsFulfilled(int shopItemId) { if ((Object)(object)PickupObjectDatabase.GetById(shopItemId) != (Object)null) { return PickupObjectDatabase.GetById(shopItemId).PrerequisitesMet(); } return false; } public static PickupObject GetBlueprintUnlockedItem(EncounterTrackable blueprintTrackable) { for (int i = 0; i < ((ObjectDatabase)(object)PickupObjectDatabase.Instance).Objects.Count; i++) { PickupObject val = ((ObjectDatabase)(object)PickupObjectDatabase.Instance).Objects[i]; if (Object.op_Implicit((Object)(object)val)) { EncounterTrackable encounterTrackable = ((BraveBehaviour)val).encounterTrackable; if (Object.op_Implicit((Object)(object)encounterTrackable) && encounterTrackable.journalData.PrimaryDisplayName.Equals(blueprintTrackable.journalData.PrimaryDisplayName, StringComparison.OrdinalIgnoreCase) && encounterTrackable.journalData.NotificationPanelDescription.Equals(blueprintTrackable.journalData.NotificationPanelDescription, StringComparison.OrdinalIgnoreCase) && encounterTrackable.journalData.AmmonomiconFullEntry.Equals(blueprintTrackable.journalData.AmmonomiconFullEntry, StringComparison.OrdinalIgnoreCase) && encounterTrackable.journalData.AmmonomiconSprite.Equals(blueprintTrackable.journalData.AmmonomiconSprite, StringComparison.OrdinalIgnoreCase)) { return val; } } } return null; } public static WeightedGameObject AddItemToTrorcMetaShop(this PickupObject po, int cost, int? index = null) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown if ((Object)(object)TrorcMetaShopItems == (Object)null) { DoSetup(); } WeightedGameObject val = new WeightedGameObject { rawGameObject = null, pickupId = po.PickupObjectId, weight = cost, forceDuplicatesPossible = false, additionalPrerequisites = (DungeonPrerequisite[])(object)new DungeonPrerequisite[0] }; if (!index.HasValue) { TrorcMetaShopItems.defaultItemDrops.elements.Add(val); } else if (index.Value < 0) { TrorcMetaShopItems.defaultItemDrops.elements.Add(val); } else { TrorcMetaShopItems.defaultItemDrops.elements.InsertOrAdd(index.Value, val); } RegisterBaseShopControllerAddedItem(val, TrorcMetaShopItems.defaultItemDrops); return val; } public static WeightedGameObject AddItemToGooptonMetaShop(this PickupObject po, int cost, int? index = null) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown if ((Object)(object)GooptonMetaShopItems == (Object)null) { DoSetup(); } WeightedGameObject val = new WeightedGameObject { rawGameObject = null, pickupId = po.PickupObjectId, weight = cost, forceDuplicatesPossible = false, additionalPrerequisites = (DungeonPrerequisite[])(object)new DungeonPrerequisite[0] }; if (!index.HasValue) { GooptonMetaShopItems.defaultItemDrops.elements.Add(val); } else if (index.Value < 0) { TrorcMetaShopItems.defaultItemDrops.elements.Add(val); } else { GooptonMetaShopItems.defaultItemDrops.elements.InsertOrAdd(index.Value, val); } RegisterBaseShopControllerAddedItem(val, GooptonMetaShopItems.defaultItemDrops); return val; } public static WeightedGameObject AddItemToDougMetaShop(this PickupObject po, int cost, int? index = null) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown if ((Object)(object)DougMetaShopItems == (Object)null) { DoSetup(); } WeightedGameObject val = new WeightedGameObject { rawGameObject = null, pickupId = po.PickupObjectId, weight = cost, forceDuplicatesPossible = false, additionalPrerequisites = (DungeonPrerequisite[])(object)new DungeonPrerequisite[0] }; if (!index.HasValue) { DougMetaShopItems.defaultItemDrops.elements.Add(val); } else if (index.Value < 0) { DougMetaShopItems.defaultItemDrops.elements.Add(val); } else { DougMetaShopItems.defaultItemDrops.elements.InsertOrAdd(index.Value, val); } RegisterBaseShopControllerAddedItem(val, DougMetaShopItems.defaultItemDrops); return val; } private static void RegisterBaseShopControllerAddedItem(WeightedGameObject obj, WeightedGameObjectCollection collection) { if (baseShopAddedItems == null) { baseShopAddedItems = new Dictionary>(); } if (!baseShopAddedItems.ContainsKey(collection)) { baseShopAddedItems.Add(collection, new List()); } if (baseShopAddedItems[collection] == null) { baseShopAddedItems[collection] = new List(); } baseShopAddedItems[collection].Add(obj); } public static List AddBaseMetaShopDoubleTier(int topLeftItemId, int topLeftItemPrice, int topMiddleItemId, int topMiddleItemPrice, int topRightItemId, int topRightItemPrice, int bottomLeftItemId, int bottomLeftItemPrice, int bottomMiddleItemId, int bottomMiddleItemPrice, int bottomRightItemId, int bottomRightItemPrice, int? index = null) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0038: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_0079: Expected O, but got Unknown return AddBaseMetaShopDoubleTier(new DoubleMetaShopTier(new MetaShopTier { itemId1 = topLeftItemId, overrideItem1Cost = topLeftItemPrice, itemId2 = topMiddleItemId, overrideItem2Cost = topMiddleItemPrice, itemId3 = topRightItemId, overrideItem3Cost = topRightItemPrice, overrideTierCost = topLeftItemId }, new MetaShopTier { itemId1 = bottomLeftItemId, overrideItem1Cost = bottomLeftItemPrice, itemId2 = bottomMiddleItemId, overrideItem2Cost = bottomMiddleItemPrice, itemId3 = bottomRightItemId, overrideItem3Cost = bottomRightItemPrice, overrideTierCost = topLeftItemId }), index); } public static List AddBaseMetaShopDoubleTier(int topLeftItemId, int topLeftItemPrice, int topMiddleItemId, int topMiddleItemPrice, int topRightItemId, int topRightItemPrice, int bottomLeftItemId, int bottomLeftItemPrice, int bottomMiddleItemId, int bottomMiddleItemPrice, int? index = null) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0038: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_0077: Expected O, but got Unknown return AddBaseMetaShopDoubleTier(new DoubleMetaShopTier(new MetaShopTier { itemId1 = topLeftItemId, overrideItem1Cost = topLeftItemPrice, itemId2 = topMiddleItemId, overrideItem2Cost = topMiddleItemPrice, itemId3 = topRightItemId, overrideItem3Cost = topRightItemPrice, overrideTierCost = topLeftItemId }, new MetaShopTier { itemId1 = bottomLeftItemId, overrideItem1Cost = bottomLeftItemPrice, itemId2 = bottomMiddleItemId, overrideItem2Cost = bottomMiddleItemPrice, itemId3 = -1, overrideItem3Cost = -1, overrideTierCost = topLeftItemId }), index); } public static List AddBaseMetaShopDoubleTier(int topLeftItemId, int topLeftItemPrice, int topMiddleItemId, int topMiddleItemPrice, int topRightItemId, int topRightItemPrice, int bottomLeftItemId, int bottomLeftItemPrice, int? index = null) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0038: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_0075: Expected O, but got Unknown return AddBaseMetaShopDoubleTier(new DoubleMetaShopTier(new MetaShopTier { itemId1 = topLeftItemId, overrideItem1Cost = topLeftItemPrice, itemId2 = topMiddleItemId, overrideItem2Cost = topMiddleItemPrice, itemId3 = topRightItemId, overrideItem3Cost = topRightItemPrice, overrideTierCost = topLeftItemId }, new MetaShopTier { itemId1 = bottomLeftItemId, overrideItem1Cost = bottomLeftItemPrice, itemId2 = -1, overrideItem2Cost = -1, itemId3 = -1, overrideItem3Cost = -1, overrideTierCost = topLeftItemId }), index); } public static MetaShopTier AddBaseMetaShopTier(int leftItemId, int leftItemPrice, int middleItemId, int middleItemPrice, int rightItemId, int rightItemPrice, int? index = null) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_003f: Expected O, but got Unknown return AddBaseMetaShopTier(new MetaShopTier { itemId1 = leftItemId, overrideItem1Cost = leftItemPrice, itemId2 = middleItemId, overrideItem2Cost = middleItemPrice, itemId3 = rightItemId, overrideItem3Cost = rightItemPrice, overrideTierCost = leftItemPrice }, index); } public static MetaShopTier AddBaseMetaShopTier(int leftItemId, int leftItemPrice, int middleItemId, int middleItemPrice, int? index = null) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown return AddBaseMetaShopTier(new MetaShopTier { itemId1 = leftItemId, overrideItem1Cost = leftItemPrice, itemId2 = middleItemId, overrideItem2Cost = middleItemPrice, itemId3 = -1, overrideItem3Cost = -1, overrideTierCost = leftItemPrice }, index); } public static MetaShopTier AddBaseMetaShopTier(int leftItemId, int leftItemPrice, int? index = null) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown return AddBaseMetaShopTier(new MetaShopTier { itemId1 = leftItemId, overrideItem1Cost = leftItemPrice, itemId2 = -1, overrideItem2Cost = -1, itemId3 = -1, overrideItem3Cost = -1, overrideTierCost = leftItemPrice }, index); } public static List AddBaseMetaShopDoubleTier(DoubleMetaShopTier tier, int? index = null) { return new List { AddBaseMetaShopTier(tier.GetBottomTier(), index), AddBaseMetaShopTier(tier.GetTopTier(), index) }; } public static MetaShopTier AddBaseMetaShopTier(MetaShopTier tier, int? index = null) { if ((Object)(object)BaseMetaShopController == (Object)null) { DoSetup(); } if (!index.HasValue) { BaseMetaShopController.metaShopTiers.Add(tier); } else if (index.Value < 0) { BaseMetaShopController.metaShopTiers.Add(tier); } else { BaseMetaShopController.metaShopTiers.InsertOrAdd(index.Value, tier); } if (metaShopAddedTiers == null) { metaShopAddedTiers = new List(); } metaShopAddedTiers.Add(tier); ReloadInstanceMetaShopTiers(); return tier; } public static void ReloadInstanceMetaShopTiers() { MetaShopController[] array = Object.FindObjectsOfType(); for (int i = 0; i < array.Length; i++) { array[i].metaShopTiers = SaveTools.CloneList(BaseMetaShopController.metaShopTiers); } } } public enum CustomDungeonFlags { NONE, HAS_DEFEATED_ARMI, HAS_DEFEATED_SKEL } internal static class CustomDungeonFlagsExtensions { public static void Set(this CustomDungeonFlags flag) { AdvancedGameStatsManager.Instance.SetFlag(flag, value: true); } public static void Unset(this CustomDungeonFlags flag) { AdvancedGameStatsManager.Instance.SetFlag(flag, value: false); } public static bool Get(this CustomDungeonFlags flag) { return AdvancedGameStatsManager.Instance.GetFlag(flag); } } public class CustomDungeonFlagsComparer : IEqualityComparer { public bool Equals(CustomDungeonFlags x, CustomDungeonFlags y) { return x == y; } public int GetHashCode(CustomDungeonFlags obj) { return (int)obj; } } public class CustomTrackedMaximumsComparer : IEqualityComparer { public bool Equals(CustomTrackedMaximums x, CustomTrackedMaximums y) { return x == y; } public int GetHashCode(CustomTrackedMaximums obj) { return (int)obj; } } public class CustomTrackedStatsComparer : IEqualityComparer { public bool Equals(CustomTrackedStats x, CustomTrackedStats y) { return x == y; } public int GetHashCode(CustomTrackedStats obj) { return (int)obj; } } public enum CustomTrackedMaximums { EXAMPLE_MAXIMUM, MAX_HEART_CONTAINERS_EVER } public enum CustomCharacterSpecificGungeonFlags { NONE, EXAMPLE_CHARACTER_SPECIFIC_FLAG, EXAMPLE_ENEMY_DEATH_CHARACTER_SPECIFIC_FLAG } public enum CustomTrackedStats { ENCOUNTERED_ARMI, DEFEATED_ARMI, DIED_TO_ARMI, ENCOUNTERED_SKEL, DEFEATED_SKEL, DIED_TO_SKEL } internal static class CustomTrackedStatsExtensions { public static void Increment(this CustomTrackedStats stat, float val = 1f) { AdvancedGameStatsManager.Instance.RegisterStatChange(stat, val); } public static void Set(this CustomTrackedStats stat, float val) { AdvancedGameStatsManager.Instance.SetStat(stat, val); } public static void Reset(this CustomTrackedStats stat) { AdvancedGameStatsManager.Instance.SetStat(stat, 0f); } public static float Get(this CustomTrackedStats stat) { return AdvancedGameStatsManager.Instance.GetPlayerStatValue(stat); } public static float GetForChar(this CustomTrackedStats stat) { return AdvancedGameStatsManager.Instance.GetCharacterStatValue(stat); } } [fsObject] internal class AdvancedGameStatsManager { private static AdvancedGameStatsManager m_instance; [fsProperty] public HashSet m_flags; [fsProperty] public string midGameSaveGuid; [fsProperty] public Dictionary m_characterStats; private AdvancedGameStats m_sessionStats; private AdvancedGameStats m_savedSessionStats; private PlayableCharacters m_sessionCharacter; private int m_numCharacters; [fsIgnore] public int cachedHuntIndex; [fsIgnore] public SaveSlot cachedSaveSlot; [fsIgnore] public bool IsInSession => m_sessionStats != null; public static bool HasInstance => m_instance != null; public static AdvancedGameStatsManager Instance => m_instance; public AdvancedGameStatsManager() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown m_flags = new HashSet(new CustomDungeonFlagsComparer()); m_characterStats = new Dictionary((IEqualityComparer?)new PlayableCharactersComparer()); m_numCharacters = -1; cachedHuntIndex = -1; } public static void Unload() { m_instance = null; } public void SetCharacterSpecificFlag(PlayableCharacters character, CustomCharacterSpecificGungeonFlags flag, bool value) { //IL_0014: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) if (flag == CustomCharacterSpecificGungeonFlags.NONE) { Debug.LogError((object)"Something is attempting to set a NONE character-specific save flag!"); return; } if (!m_characterStats.ContainsKey(character)) { m_characterStats.Add(character, new AdvancedGameStats()); } if (m_sessionStats != null && m_sessionCharacter == character) { m_sessionStats.SetFlag(flag, value); } else { m_characterStats[character].SetFlag(flag, value); } } public void SetStat(CustomTrackedStats stat, float value) { if (!float.IsNaN(value) && !float.IsInfinity(value) && m_sessionStats != null) { m_sessionStats.SetStat(stat, value); } } public void UpdateMaximum(CustomTrackedMaximums maximum, float val) { if (!float.IsNaN(val) && !float.IsInfinity(val) && m_sessionStats != null) { m_sessionStats.SetMax(maximum, val); } } public bool GetCharacterSpecificFlag(CustomCharacterSpecificGungeonFlags flag) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return GetCharacterSpecificFlag(m_sessionCharacter, flag); } public bool GetCharacterSpecificFlag(PlayableCharacters character, CustomCharacterSpecificGungeonFlags flag) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (flag == CustomCharacterSpecificGungeonFlags.NONE) { Debug.LogError((object)"Something is attempting to get a NONE character-specific save flag!"); return false; } if (m_sessionStats != null && m_sessionCharacter == character) { if (m_sessionStats.GetFlag(flag)) { return true; } if (m_savedSessionStats.GetFlag(flag)) { return true; } } if (m_characterStats.TryGetValue(character, out var value)) { return value.GetFlag(flag); } return false; } public static void DoMidgameSave() { string text = Guid.NewGuid().ToString(); SaveManager.Save(new AdvancedMidGameSaveData(text), SaveAPIManager.AdvancedMidGameSave, GameStatsManager.Instance.PlaytimeMin, 0u, (SaveSlot?)null); Instance.midGameSaveGuid = text; Save(); } public void RegisterStatChange(CustomTrackedStats stat, float value) { if (m_sessionStats == null) { Debug.LogError((object)"No session stats active and we're registering a stat change!"); } else if (!float.IsNaN(value) && !float.IsInfinity(value) && !(Mathf.Abs(value) > 10000f)) { m_sessionStats.IncrementStat(stat, value); } } public static void InvalidateMidgameSave(bool saveStats) { AdvancedMidGameSaveData midgameSave = null; if (VerifyAndLoadMidgameSave(out midgameSave, checkValidity: false)) { midgameSave.Invalidate(); SaveManager.Save(midgameSave, SaveAPIManager.AdvancedMidGameSave, GameStatsManager.Instance.PlaytimeMin, 0u, (SaveSlot?)null); GameStatsManager.Instance.midGameSaveGuid = midgameSave.midGameSaveGuid; if (saveStats) { GameStatsManager.Save(); } } } public static void RevalidateMidgameSave(bool saveStats) { AdvancedMidGameSaveData midgameSave = null; if (VerifyAndLoadMidgameSave(out midgameSave, checkValidity: false)) { midgameSave.Revalidate(); SaveManager.Save(midgameSave, SaveAPIManager.AdvancedMidGameSave, GameStatsManager.Instance.PlaytimeMin, 0u, (SaveSlot?)null); GameStatsManager.Instance.midGameSaveGuid = midgameSave.midGameSaveGuid; if (saveStats) { GameStatsManager.Save(); } } } public static bool VerifyAndLoadMidgameSave(out AdvancedMidGameSaveData midgameSave, bool checkValidity = true) { if (!SaveManager.Load(SaveAPIManager.AdvancedGameSave, ref midgameSave, true, 0u, (Func)null, (SaveSlot?)null)) { Debug.LogError((object)"No mid game save found"); return false; } if (midgameSave == null) { Debug.LogError((object)"Failed to load mid game save (0)"); return false; } if (checkValidity && !midgameSave.IsValid()) { return false; } if (GameStatsManager.Instance.midGameSaveGuid == null || GameStatsManager.Instance.midGameSaveGuid != midgameSave.midGameSaveGuid) { Debug.LogError((object)"Failed to load mid game save (1)"); return false; } return true; } public void ClearAllStatsGlobal() { m_sessionStats.ClearAllState(); m_savedSessionStats.ClearAllState(); if (m_numCharacters <= 0) { m_numCharacters = Enum.GetValues(typeof(PlayableCharacters)).Length; } for (int i = 0; i < m_numCharacters; i++) { if (m_characterStats.TryGetValue((PlayableCharacters)i, out var value)) { value.ClearAllState(); } } } public void ClearStatValueGlobal(CustomTrackedStats stat) { m_sessionStats.SetStat(stat, 0f); m_savedSessionStats.SetStat(stat, 0f); if (m_numCharacters <= 0) { m_numCharacters = Enum.GetValues(typeof(PlayableCharacters)).Length; } for (int i = 0; i < m_numCharacters; i++) { if (m_characterStats.TryGetValue((PlayableCharacters)i, out var value)) { value.SetStat(stat, 0f); } } } private PlayableCharacters GetCurrentCharacter() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) return GameManager.Instance.PrimaryPlayer.characterIdentity; } public float GetPlayerMaximum(CustomTrackedMaximums maximum) { if (m_numCharacters <= 0) { m_numCharacters = Enum.GetValues(typeof(PlayableCharacters)).Length; } float num = 0f; if (m_sessionStats != null) { num = Mathf.Max(new float[3] { num, m_sessionStats.GetMaximumValue(maximum), m_savedSessionStats.GetMaximumValue(maximum) }); } for (int i = 0; i < m_numCharacters; i++) { if (m_characterStats.TryGetValue((PlayableCharacters)i, out var value)) { num = Mathf.Max(num, value.GetMaximumValue(maximum)); } } return num; } public float GetPlayerStatValue(CustomTrackedStats stat) { if (m_numCharacters <= 0) { m_numCharacters = Enum.GetValues(typeof(PlayableCharacters)).Length; } float num = 0f; if (m_sessionStats != null) { num += m_sessionStats.GetStatValue(stat); } for (int i = 0; i < m_numCharacters; i++) { if (m_characterStats.TryGetValue((PlayableCharacters)i, out var value)) { num += value.GetStatValue(stat); } } return num; } public void SetCharacterSpecificFlag(CustomCharacterSpecificGungeonFlags flag, bool value) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) SetCharacterSpecificFlag(m_sessionCharacter, flag, value); } public float GetSessionStatValue(CustomTrackedStats stat) { return m_sessionStats.GetStatValue(stat) + m_savedSessionStats.GetStatValue(stat); } public float GetCharacterStatValue(CustomTrackedStats stat) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return GetCharacterStatValue(GetCurrentCharacter(), stat); } public AdvancedGameStats MoveSessionStatsToSavedSessionStats() { //IL_0019: 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) if (!IsInSession) { return null; } if (m_sessionStats != null) { if (m_characterStats.ContainsKey(m_sessionCharacter)) { m_characterStats[m_sessionCharacter].AddStats(m_sessionStats); } m_savedSessionStats.AddStats(m_sessionStats); m_sessionStats.ClearAllState(); } return m_savedSessionStats; } public float GetCharacterStatValue(PlayableCharacters character, CustomTrackedStats stat) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) float num = 0f; if (m_sessionCharacter == character) { num += m_sessionStats.GetStatValue(stat); } if (m_characterStats.ContainsKey(character)) { num += m_characterStats[character].GetStatValue(stat); } return num; } public void BeginNewSession(PlayerController player) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //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_007f: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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) if (m_characterStats == null) { m_characterStats = new Dictionary((IEqualityComparer?)new PlayableCharactersComparer()); } if (IsInSession) { m_sessionCharacter = player.characterIdentity; if (!m_characterStats.ContainsKey(player.characterIdentity)) { m_characterStats.Add(player.characterIdentity, new AdvancedGameStats()); } return; } m_sessionCharacter = player.characterIdentity; m_sessionStats = new AdvancedGameStats(); m_savedSessionStats = new AdvancedGameStats(); if (!m_characterStats.ContainsKey(player.characterIdentity)) { m_characterStats.Add(player.characterIdentity, new AdvancedGameStats()); } } public void EndSession(bool recordSessionStats) { //IL_001b: 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) if (IsInSession && m_sessionStats != null) { if (recordSessionStats && m_characterStats.ContainsKey(m_sessionCharacter)) { m_characterStats[m_sessionCharacter].AddStats(m_sessionStats); } m_sessionStats = null; m_savedSessionStats = null; } } public static void Load() { //IL_0021: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) SaveManager.Init(); bool flag = false; SaveSlot? val = null; int num = -1; if (m_instance != null) { flag = true; val = m_instance.cachedSaveSlot; num = m_instance.cachedHuntIndex; } if (!SaveManager.Load(SaveAPIManager.AdvancedGameSave, ref m_instance, true, 0u, (Func)null, (SaveSlot?)null)) { m_instance = new AdvancedGameStatsManager(); } m_instance.cachedSaveSlot = SaveManager.CurrentSaveSlot; if (flag && val.HasValue && m_instance.cachedSaveSlot == val.Value) { m_instance.cachedHuntIndex = num; } else { m_instance.cachedHuntIndex = -1; } } public static void DANGEROUS_ResetAllStats() { m_instance = new AdvancedGameStatsManager(); SaveManager.DeleteAllBackups(SaveAPIManager.AdvancedGameSave, (SaveSlot?)null); } public bool GetFlag(CustomDungeonFlags flag) { if (flag == CustomDungeonFlags.NONE) { Debug.LogError((object)"Something is attempting to get a NONE save flag!"); return false; } return m_flags.Contains(flag); } public void SetFlag(CustomDungeonFlags flag, bool value) { if (flag == CustomDungeonFlags.NONE) { Debug.LogError((object)"Something is attempting to set a NONE save flag!"); } else if (value) { m_flags.Add(flag); } else { m_flags.Remove(flag); } } public static bool Save() { bool result = false; try { result = SaveManager.Save(m_instance, SaveAPIManager.AdvancedGameSave, GameStatsManager.Instance.PlaytimeMin, 0u, (SaveSlot?)null); } catch (Exception ex) { Debug.LogErrorFormat("SAVE FAILED: {0}", new object[1] { ex }); } return result; } public void AssignMidGameSavedSessionStats(AdvancedGameStats source) { if (IsInSession && m_savedSessionStats != null) { m_savedSessionStats.AddStats(source); } } } public class CustomDungeonPrerequisite : DungeonPrerequisite { public enum AdvancedPrerequisiteType { NONE, CUSTOM_FLAG, CUSTOM_STAT_COMPARISION, CUSTOM_MAXIMUM_COMPARISON, NUMBER_PASTS_COMPLETED_BETTER, ENCOUNTER_OR_CUSTOM_FLAG } public AdvancedPrerequisiteType advancedPrerequisiteType; public CustomDungeonFlags customFlagToCheck; public bool requireCustomFlag; public Type requiredPassiveFlag; public CustomTrackedMaximums customMaximumToCheck; public CustomTrackedStats customStatToCheck; public virtual bool CheckConditionsFulfilled() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected I4, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected I4, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected I4, but got Unknown //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Expected I4, but got Unknown //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Expected I4, but got Unknown if (advancedPrerequisiteType == AdvancedPrerequisiteType.CUSTOM_FLAG) { return AdvancedGameStatsManager.Instance.GetFlag(customFlagToCheck) == requireCustomFlag; } if (advancedPrerequisiteType == AdvancedPrerequisiteType.CUSTOM_STAT_COMPARISION) { float playerStatValue = AdvancedGameStatsManager.Instance.GetPlayerStatValue(customStatToCheck); PrerequisiteOperation prerequisiteOperation = base.prerequisiteOperation; switch ((int)prerequisiteOperation) { case 0: return playerStatValue < base.comparisonValue; case 1: return playerStatValue == base.comparisonValue; case 2: return playerStatValue > base.comparisonValue; } Debug.LogError((object)"Switching on invalid stat comparison operation!"); } else if (advancedPrerequisiteType == AdvancedPrerequisiteType.CUSTOM_MAXIMUM_COMPARISON) { float playerMaximum = AdvancedGameStatsManager.Instance.GetPlayerMaximum(customMaximumToCheck); PrerequisiteOperation prerequisiteOperation = base.prerequisiteOperation; switch ((int)prerequisiteOperation) { case 0: return playerMaximum < base.comparisonValue; case 1: return playerMaximum == base.comparisonValue; case 2: return playerMaximum > base.comparisonValue; } Debug.LogError((object)"Switching on invalid stat comparison operation!"); } else { PrerequisiteOperation prerequisiteOperation; if (advancedPrerequisiteType != AdvancedPrerequisiteType.NUMBER_PASTS_COMPLETED_BETTER) { if (advancedPrerequisiteType == AdvancedPrerequisiteType.ENCOUNTER_OR_CUSTOM_FLAG) { EncounterDatabaseEntry val = null; if (!string.IsNullOrEmpty(base.encounteredObjectGuid)) { val = EncounterDatabase.GetEntry(base.encounteredObjectGuid); } if (AdvancedGameStatsManager.Instance.GetFlag(customFlagToCheck) == requireCustomFlag) { return true; } if (val != null) { int num = GameStatsManager.Instance.QueryEncounterable(val); prerequisiteOperation = base.prerequisiteOperation; switch ((int)prerequisiteOperation) { case 0: return num < base.requiredNumberOfEncounters; case 1: return num == base.requiredNumberOfEncounters; case 2: return num > base.requiredNumberOfEncounters; } Debug.LogError((object)"Switching on invalid stat comparison operation!"); } else if ((Object)(object)base.encounteredRoom != (Object)null) { int num2 = GameStatsManager.Instance.QueryRoomEncountered(base.encounteredRoom.GUID); prerequisiteOperation = base.prerequisiteOperation; switch ((int)prerequisiteOperation) { case 0: return num2 < base.requiredNumberOfEncounters; case 1: return num2 == base.requiredNumberOfEncounters; case 2: return num2 > base.requiredNumberOfEncounters; } Debug.LogError((object)"Switching on invalid stat comparison operation!"); } return false; } return CheckConditionsFulfilledOrig(); } float num3 = GameStatsManager.Instance.GetNumberPastsBeaten(); prerequisiteOperation = base.prerequisiteOperation; switch ((int)prerequisiteOperation) { case 0: return num3 < base.comparisonValue; case 1: return num3 == base.comparisonValue; case 2: return num3 > base.comparisonValue; } Debug.LogError((object)"Switching on invalid stat comparison operation!"); } return false; } public bool CheckConditionsFulfilledOrig() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_004c: Expected I4, but got Unknown //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected I4, but got Unknown //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Expected I4, but got Unknown //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023e: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected I4, but got Unknown //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Expected I4, but got Unknown //IL_00de: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected I4, but got Unknown //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Expected I4, but got Unknown //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) EncounterDatabaseEntry val = null; if (!string.IsNullOrEmpty(base.encounteredObjectGuid)) { val = EncounterDatabase.GetEntry(base.encounteredObjectGuid); } PrerequisiteType prerequisiteType = base.prerequisiteType; switch ((int)prerequisiteType) { case 0: if (val == null && (Object)(object)base.encounteredRoom == (Object)null) { return true; } if (val != null) { int num3 = GameStatsManager.Instance.QueryEncounterable(val); PrerequisiteOperation prerequisiteOperation = base.prerequisiteOperation; switch ((int)prerequisiteOperation) { case 0: return num3 < base.requiredNumberOfEncounters; case 1: return num3 == base.requiredNumberOfEncounters; case 2: return num3 > base.requiredNumberOfEncounters; } Debug.LogError((object)"Switching on invalid stat comparison operation!"); } else if ((Object)(object)base.encounteredRoom != (Object)null) { int num4 = GameStatsManager.Instance.QueryRoomEncountered(base.encounteredRoom.GUID); PrerequisiteOperation prerequisiteOperation = base.prerequisiteOperation; switch ((int)prerequisiteOperation) { case 0: return num4 < base.requiredNumberOfEncounters; case 1: return num4 == base.requiredNumberOfEncounters; case 2: return num4 > base.requiredNumberOfEncounters; } Debug.LogError((object)"Switching on invalid stat comparison operation!"); } return false; case 1: { float playerStatValue = GameStatsManager.Instance.GetPlayerStatValue(base.statToCheck); PrerequisiteOperation prerequisiteOperation = base.prerequisiteOperation; switch ((int)prerequisiteOperation) { case 0: return playerStatValue < base.comparisonValue; case 1: return playerStatValue == base.comparisonValue; case 2: return playerStatValue > base.comparisonValue; } Debug.LogError((object)"Switching on invalid stat comparison operation!"); break; } case 2: { PlayableCharacters val2 = (PlayableCharacters)(-1); if (!BraveRandom.IgnoreGenerationDifferentiator) { if ((Object)(object)GameManager.Instance.PrimaryPlayer != (Object)null) { val2 = GameManager.Instance.PrimaryPlayer.characterIdentity; } else if ((Object)(object)GameManager.PlayerPrefabForNewGame != (Object)null) { val2 = GameManager.PlayerPrefabForNewGame.GetComponent().characterIdentity; } else if ((Object)(object)GameManager.Instance.BestGenerationDungeonPrefab != (Object)null) { val2 = GameManager.Instance.BestGenerationDungeonPrefab.defaultPlayerPrefab.GetComponent().characterIdentity; } } return base.requireCharacter == (val2 == base.requiredCharacter); } case 3: if ((Object)(object)GameManager.Instance.BestGenerationDungeonPrefab != (Object)null) { return base.requireTileset == (GameManager.Instance.BestGenerationDungeonPrefab.tileIndices.tilesetId == base.requiredTileset); } return base.requireTileset == (GameManager.Instance.Dungeon.tileIndices.tilesetId == base.requiredTileset); case 4: return GameStatsManager.Instance.GetFlag(base.saveFlagToCheck) == base.requireFlag; case 5: return !base.requireDemoMode; case 6: { float playerMaximum = GameStatsManager.Instance.GetPlayerMaximum(base.maxToCheck); PrerequisiteOperation prerequisiteOperation = base.prerequisiteOperation; switch ((int)prerequisiteOperation) { case 0: return playerMaximum < base.comparisonValue; case 1: return playerMaximum == base.comparisonValue; case 2: return playerMaximum > base.comparisonValue; } Debug.LogError((object)"Switching on invalid stat comparison operation!"); break; } case 7: if (GameStatsManager.Instance.GetFlag(base.saveFlagToCheck) == base.requireFlag) { return true; } if (val != null) { int num = GameStatsManager.Instance.QueryEncounterable(val); PrerequisiteOperation prerequisiteOperation = base.prerequisiteOperation; switch ((int)prerequisiteOperation) { case 0: return num < base.requiredNumberOfEncounters; case 1: return num == base.requiredNumberOfEncounters; case 2: return num > base.requiredNumberOfEncounters; } Debug.LogError((object)"Switching on invalid stat comparison operation!"); } else if ((Object)(object)base.encounteredRoom != (Object)null) { int num2 = GameStatsManager.Instance.QueryRoomEncountered(base.encounteredRoom.GUID); PrerequisiteOperation prerequisiteOperation = base.prerequisiteOperation; switch ((int)prerequisiteOperation) { case 0: return num2 < base.requiredNumberOfEncounters; case 1: return num2 == base.requiredNumberOfEncounters; case 2: return num2 > base.requiredNumberOfEncounters; } Debug.LogError((object)"Switching on invalid stat comparison operation!"); } return false; case 8: return (float)GameStatsManager.Instance.GetNumberPastsBeaten() >= base.comparisonValue; default: Debug.LogError((object)"Switching on invalid prerequisite type!!!"); break; } return false; } } [Serializable] public class CustomHuntQuest : MonsterHuntQuest { [LongEnum] [SerializeField] public CustomDungeonFlags CustomQuestFlag; [LongEnum] [SerializeField] public List CustomFlagsToSetUponReward; [SerializeField] public Func ValidTargetCheck; [SerializeField] public JammedEnemyState RequiredEnemyState; public bool IsQuestComplete() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (CustomQuestFlag != 0 && AdvancedGameStatsManager.Instance.GetFlag(CustomQuestFlag)) { return true; } return GameStatsManager.Instance.GetFlag(base.QuestFlag); } public bool IsEnemyValid(AIActor enemy, MonsterHuntProgress progress) { if (ValidTargetCheck != null && !ValidTargetCheck(enemy, progress)) { return false; } return SaveTools.IsEnemyStateValid(enemy, RequiredEnemyState); } public void Complete() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if ((int)base.QuestFlag != 0) { GameStatsManager.Instance.SetFlag(base.QuestFlag, true); } if (CustomQuestFlag != 0) { AdvancedGameStatsManager.Instance.SetFlag(CustomQuestFlag, value: true); } } public void UnlockRewards() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < base.FlagsToSetUponReward.Count; i++) { GameStatsManager.Instance.SetFlag(base.FlagsToSetUponReward[i], true); } for (int j = 0; j < CustomFlagsToSetUponReward.Count; j++) { AdvancedGameStatsManager.Instance.SetFlag(CustomFlagsToSetUponReward[j], value: true); } } } } namespace CwaffingTheGungy { public class DemolitionContract : CwaffPassive { public static string ItemName = "Demolition Contract"; public static string ShortDescription = "Kablooie!"; public static string LongDescription = "Every enemy killed by an explosion drops an extra casing."; public static string Lore = "One key difference between a good demoman and a bad demoman is that a good demoman typically survives their first contracted demolition. On an unrelated note, this contract did not belong to a good demoman."; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)3; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)3, 1f); } public override void Pickup(PlayerController player) { base.Pickup(player); CustomActions.OnAnyHealthHaverDie = (Action)Delegate.Combine(CustomActions.OnAnyHealthHaverDie, new Action(HandleEnemyDeath)); } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); CustomActions.OnAnyHealthHaverDie = (Action)Delegate.Remove(CustomActions.OnAnyHealthHaverDie, new Action(HandleEnemyDeath)); } private void HandleEnemyDeath(HealthHaver hh) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) AIActor aiActor = ((BraveBehaviour)hh).aiActor; if (aiActor != null && !(hh.lastIncurredDamageSource != StringTableManager.GetEnemiesString("#EXPLOSION", -1))) { PlayerController owner = ((PassiveItem)this).Owner; if (owner != null) { LootEngine.SpawnCurrency(((GameActor)aiActor).CenterPosition, (!owner.HasSynergy(Synergy.GLUED_BACK_TOGETHER_IN_HELL)) ? 1 : 2, false); } } } } public class VolcanicAmmolet : CwaffBlankModificationItem, ICustomBlankDoer { [HarmonyPatch(typeof(ExplosionManager), "Dequeue")] private class ExplosionManagerDequeuePatch { private static void Postfix(ExplosionManager __instance) { if (__instance.m_queue.Count == 0) { _ExplosionTimer = 0.125f; } if (__instance.m_timer > _ExplosionTimer) { __instance.m_timer = _ExplosionTimer; } } } public static string ItemName = "Volcanic Ammolet"; public static string ShortDescription = "Blanks Detonate Projectiles"; public static string LongDescription = "Blanks create miniature explosions at the center of each enemy projectile. Grants 1 additional blank per floor."; public static string Lore = "The very talented senior engineers at ACNE corporation's Mt. Fuji Headquarters have discovered how to harness the natural power of volcanoes in Ammolet format...at least that's what their marketing team would have you believe. The reality is that igniting the gunpowder inside projectiles when destroying them is trivial, and most Ammolets have mechanisms that inhibit projectile explosions as a safety feature to comply with local consumer laws. It seems ACNE's legal team has gotten around this by slapping a 'not for retail' label on the Ammolet and giving it away as a free gift with 65-casing glasses of water."; private const float NORMAL_EXPLOSION_DELAY = 0.125f; private const float QUICK_EXPLOSION_DELAY = 1f / 32f; private static float _ExplosionTimer = 0.125f; private static ExplosionData _LargeVolcanicExplosion = null; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore, hideFromAmmonomicon: false, 1f); ((PickupObject)obj).quality = (ItemQuality)3; ItemBuilder.AddPassiveStatModifier((PickupObject)(object)obj, (StatType)18, 1f, (ModifyMethod)0); ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)4, 1f); _LargeVolcanicExplosion = Explosions.DefaultLarge.Clone(); _LargeVolcanicExplosion.damageToPlayer = 0f; } public void OnCustomBlankedProjectile(Projectile p) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) _ExplosionTimer = 1f / 32f; Exploder.Explode(((BraveBehaviour)p).transform.position, Synergy.DEMOLITION_MAN.Active() ? _LargeVolcanicExplosion : Scotsman._ScotsmanExplosion, Vector2.zero, (Action)null, false, (CoreDamageTypes)0, false); } } public class Calculator : CwaffPassive { [HarmonyPatch(typeof(PlayerItem), "Pickup")] private class PlayerItemPickupPatch { private static void Prefix(PlayerItem __instance, PlayerController player) { if (__instance.m_pickedUp || __instance.m_pickedUpThisRun || !__instance.consumable || !__instance.canStack || __instance.numberOfUses < 1) { return; } int num = 0; for (int i = 0; i < player.passiveItems.Count; i++) { if (player.passiveItems[i] is Calculator) { num++; } } __instance.numberOfUses *= num + 1; __instance.m_cachedNumberOfUses = __instance.numberOfUses; } } public static string ItemName = "Calculator"; public static string ShortDescription = "Fudging the Numbers"; public static string LongDescription = "Stackable active items come in double their normal stack size."; public static string Lore = "An ordinary calculator, lost by one of ACNE corporation's accountants. Due to their short term memory and extreme reliance on technology for doing basic arithmetic, it's unlikely that the contents of the Gungeon shipments they're in charge of will be properly accounted for in the foreseeable future. Fortunately, ACNE's 'when in doubt, ship it out!' policy means any accounting errors usually err on the side of more free stuff for the Gungeon."; public static void Init() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) ((PickupObject)Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore)).quality = (ItemQuality)2; } } public class ScaldingJelly : CwaffCompanion { public static string ItemName = "Scalding Jelly"; public static string ShortDescription = "Fiery Friend"; public static string LongDescription = "Spawns a friendly Ignizol that sets nearby ground ablaze as it jumps around. The Ignizol will launch itself at nearby enemies, and can be manually picked up and thrown using the interact key."; public static string Lore = "These small blobs were first spotted falling from the clouds, as if carelessly dropped from a kingdom in the heavens. While no such land of high rule actually exists, the origins of these fiery creatures is still a subject of hot debate among Gungeon scholars and meteorologists alike. At the very least, all known specimens have been docile towards Gungeoneers, passive combustion notwithstanding."; public static string CompanionName = "Ignizol"; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore, hideFromAmmonomicon: false, 1f); ((PickupObject)obj).quality = (ItemQuality)1; IgnizolCompanion ignizolCompanion = obj.InitCompanion(CompanionName, 20, new List(4) { "charge", "jump", "carry", "pitfall" }); tk2dSpriteAnimation component = ((Component)ignizolCompanion).gameObject.GetComponent(); foreach (string item in new List { "ignizol_pitfall_right", "ignizol_pitfall_left" }) { tk2dSpriteAnimationClip clipByName = component.GetClipByName(item); clipByName.fps = 5f; clipByName.frames[0].AddSound("ignizol_fall_sound"); } ((Component)ignizolCompanion).gameObject.GetComponent().MovementBehaviors.Add((MovementBehaviorBase)(object)new IgnizolCompanion.IgnizolMovementBehavior()); } } public class IgnizolCompanion : CwaffCompanionController { public class IgnizolMovementBehavior : CwaffCompanionMovementBehaviorBase { internal enum State { IDLE, WANDER, CHASE, CHARGE, JUMP, CARRY, THROW } private const string _LAUNCH_REASON = "launched"; private const string _CARRY_REASON = "carried"; private const float _IGNITE_DELAY = 1f; private const float _MOVE_SPEED = 3.5f; private const float _LAUNCH_RADIUS = 4.5f; private const float _COLLSION_DAMAGE = 10f; private const float _WANDER_TIME_MIN = 1.5f; private const float _WANDER_TIME_MAX = 4f; private const float _IDLE_TIME_MIN = 1f; private const float _IDLE_TIME_MAX = 3f; private const float _CHARGE_TIME = 1f; private const float _PICKUP_TIME = 0.3f; private const float _CHASE_RETARGET_TIME = 1f; private const float _LAUNCH_HEIGHT = 1f; private const float _LAUNCH_TIME = 0.4f; private const float _AIM_DEVIANCE = 0.5f; private const float _LAUNCH_DIST_MIN = 2f; private const float _LAUNCH_DIST_MAX = 5f; private const float _PICKUP_DIST = 2f; private const float _LIGHT_RADIUS_MIN = 2f; private const float _LIGHT_RADIUS_DLT = 1f; private const float _LIGHT_FLICKER_RATE = 10f; private const float _LIGHT_BRIGHTNESS_MIN = 10f; private const float _LIGHT_BRIGHTNESS_DLT = 5f; private const float _LAUNCH_RADIUS_SQR = 20.25f; private const float _LAUNCH_DIST_MIN_SQR = 4f; private const float _LAUNCH_DIST_MAX_SQR = 25f; private const float _PICKUP_DIST_SQR = 4f; private Vector2 _launchStart; private Vector2 _launchTarget; private Vector2 _launchVelocity; private float _launchBeginTime; private State _state = State.WANDER; private bool _airborne; private PlayerController _carrier; private tk2dSprite _jumpSprite; private EasyLight _light; private bool _launchSpriteFlipped; private int _lastIdleFrame = -1; private float _igniteTime; private static bool _RecursivePlay; private static DeadlyDeadlyGoopManager _FireGooper; public override void Start() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_00b5: 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_019d: 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) base.Start(); retargetOnPathingFailure = true; tk2dSpriteAnimator spriteAnimator = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).spriteAnimator; spriteAnimator.OnPlayAnimationCalled = (Action)Delegate.Combine(spriteAnimator.OnPlayAnimationCalled, new Action(EnsureSmoothIdleAnimationTransition)); ((BehaviorBase)this).m_aiActor.CustomPitDeathHandling += new CustomPitHandlingDelegate(CustomPitDeathHandling); ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.CollideWithOthers = true; ((BehaviorBase)this).m_aiActor.PreventFallingInPitsEver = false; ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.AddCollisionLayerOverride(CollisionMask.LayerToMask((CollisionLayer)2)); SpeculativeRigidbody specRigidbody = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreRigidbodyCollision)); _jumpSprite = new GameObject("ignizol_jump_renderer").AddComponent(); ((BraveBehaviour)_jumpSprite).transform.parent = ((BraveBehaviour)((BraveBehaviour)((BehaviorBase)this).m_aiActor).sprite).transform; ((tk2dBaseSprite)_jumpSprite).SetSprite(((BraveBehaviour)((BehaviorBase)this).m_aiActor).sprite.collection, ((BraveBehaviour)((BehaviorBase)this).m_aiActor).sprite.spriteId); ((BraveBehaviour)_jumpSprite).renderer.enabled = false; _igniteTime = 1f; Transform transform = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).transform; Color? val = ExtendedColours.vibrantOrange; _light = EasyLight.Create((Vector2?)null, transform, val, -1f, 2f, false, 10f, 0f, 0f, true, false, 30f, 0f, true, true); ((Component)_light).gameObject.transform.localPosition = Vector2.op_Implicit(((BraveBehaviour)((BehaviorBase)this).m_aiActor).sprite.GetRelativePositionFromAnchor((Anchor)7)); CwaffEvents.OnEmptyInteract = (Action)Delegate.Combine(CwaffEvents.OnEmptyInteract, new Action(AttemptToPickUpOrThrow)); } private void OnPreRigidbodyCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) PhysicsEngine.SkipCollision = true; if (_state == State.JUMP || _state == State.THROW) { HealthHaver healthHaver = ((BraveBehaviour)otherRigidbody).healthHaver; if (healthHaver != null) { myRigidbody.RegisterTemporaryCollisionException(otherRigidbody, 0.01f, (float?)2f); healthHaver.ApplyDamage(10f, ((Vector2)(ref myRigidbody.Velocity)).normalized, ScaldingJelly.CompanionName, (CoreDamageTypes)4, (DamageCategory)0, false, (PixelCollider)null, false); ((Component)((BehaviorBase)this).m_aiActor).gameObject.Play("ignizol_hit_sound"); } } } protected override void OnWarp() { _igniteTime = BraveTime.ScaledTimeSinceStartup + 1f; } protected override bool PreventWarping() { return _state == State.CARRY; } private void CustomPitDeathHandling(AIActor actor, ref bool suppressDamage) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) ResetState(); if (Object.op_Implicit((Object)(object)m_companionController.m_owner)) { Warp(((GameActor)m_companionController.m_owner).CenterPosition); } } private void AttemptToPickUpOrThrow(PlayerController interactor) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //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_004c: Unknown result type (might be due to invalid IL or missing references) if (_state == State.JUMP || _state == State.THROW) { return; } if (_state == State.CARRY) { if ((Object)(object)interactor == (Object)(object)_carrier) { GetThrown(); } return; } Vector2 val = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).sprite.WorldBottomCenter - ((GameActor)interactor).CenterPosition; if (((Vector2)(ref val)).sqrMagnitude < 4f) { GetPickedUp(interactor); } } private void GetPickedUp(PlayerController interactor) { _carrier = interactor; _state = State.CARRY; m_stateTimer = 0.3f; _allowPathing = false; ((BehaviorBase)this).m_aiAnimator.PlayUntilCancelled("carry", false, (string)null, -1f, false); ((Component)((BehaviorBase)this).m_aiActor).gameObject.Play("ignizol_lift_sound"); ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.CollideWithTileMap = false; ((GameActor)((BehaviorBase)this).m_aiActor).SetIsFlying(true, "carried", false, false); ((GameActor)((BehaviorBase)this).m_aiActor).ToggleShadowVisiblity(false); ((BehaviorBase)this).m_aiActor.ClearPath(); } private void GetThrown() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_0075: Unknown result type (might be due to invalid IL or missing references) _ = _carrier; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody; specRigidbody.CollideWithTileMap = true; specRigidbody.Reinitialize(); specRigidbody.CorrectForWalls(); _state = State.THROW; float self = Vector2Extensions.ToAngle(Vector3Extensions.XY(_carrier.unadjustedAimPoint) - ((GameActor)_carrier).CenterPosition); _launchTarget = ((GameActor)_carrier).CenterPosition + self.ToVector(5f); LaunchTowardsTarget(_launchTarget, wasThrown: true); _carrier = null; } private void EnsureSmoothIdleAnimationTransition(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip) { if (!_RecursivePlay) { tk2dSpriteAnimationClip currentClip = animator.CurrentClip; if (currentClip != null && currentClip.name.Contains("idle") && clip.name.Contains("idle")) { _RecursivePlay = true; animator.PlayFromFrame(clip, (((BraveBehaviour)((BehaviorBase)this).m_aiActor).spriteAnimator.CurrentFrame + 1) % currentClip.frames.Length); _RecursivePlay = false; } } } public override void Destroy() { if (Object.op_Implicit((Object)(object)_jumpSprite)) { Object.Destroy((Object)(object)_jumpSprite); } CwaffEvents.OnEmptyInteract = (Action)Delegate.Remove(CwaffEvents.OnEmptyInteract, new Action(AttemptToPickUpOrThrow)); base.Destroy(); } private AIActor FindTargetableEnemy() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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) RoomHandler currentRoom = m_companionController.m_owner.CurrentRoom; if (currentRoom == null) { return null; } if (Vector3Extensions.GetAbsoluteRoom(((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition) != currentRoom) { return null; } Vector2 unitCenter = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.UnitCenter; AIActor result = null; float num = 999f; foreach (AIActor item in currentRoom.SafeGetEnemiesInRoom()) { if (!Object.op_Implicit((Object)(object)item) || !((Behaviour)item).isActiveAndEnabled || !item.IsWorthShootingAt) { continue; } HealthHaver healthHaver = ((BraveBehaviour)item).healthHaver; if (healthHaver != null && !healthHaver.IsDead) { Vector2 val = ((GameActor)item).CenterPosition - unitCenter; float sqrMagnitude = ((Vector2)(ref val)).sqrMagnitude; if (!(sqrMagnitude > num)) { result = item; num = sqrMagnitude; } } } return result; } protected override void DetermineNewTarget() { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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) PlayerController owner = m_companionController.m_owner; _allowPathing = true; if (!((BehaviorBase)this).m_aiAnimator.IsPlaying("idle")) { ((BehaviorBase)this).m_aiAnimator.PlayUntilCancelled("idle", false, (string)null, -1f, false); } if (owner.IsInCombat) { AIActor val = FindTargetableEnemy(); if (val != null) { _targetActor = (GameActor)(object)val; _state = State.CHASE; m_stateTimer = 1f; return; } } _targetActor = null; RoomHandler val2; if (Object.op_Implicit((Object)(object)owner) && Object.op_Implicit((Object)(object)((BraveBehaviour)owner).healthHaver) && ((BraveBehaviour)owner).healthHaver.IsAlive) { RoomHandler currentRoom = owner.CurrentRoom; if (currentRoom != null) { val2 = currentRoom; goto IL_00b2; } } val2 = Vector3Extensions.GetAbsoluteRoom(((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition); goto IL_00b2; IL_00b2: if (val2 == null || _state == State.WANDER) { _targetPos = ((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition; _state = State.IDLE; _allowPathing = false; ((BehaviorBase)this).m_aiActor.ClearPath(); m_stateTimer = Random.Range(1f, 3f); } else { IntVector2 randomVisibleClearSpot = val2.GetRandomVisibleClearSpot(2, 2); _targetPos = ((IntVector2)(ref randomVisibleClearSpot)).ToVector2(); _state = State.WANDER; m_stateTimer = Random.Range(1.5f, 4f); } } protected override bool IsTargetValid() { if (_state == State.CHASE) { if (m_stateTimer > 0f && Object.op_Implicit((Object)(object)_targetActor) && Object.op_Implicit((Object)(object)((BraveBehaviour)_targetActor).healthHaver)) { return ((BraveBehaviour)_targetActor).healthHaver.IsAlive; } return false; } return true; } protected override void UpdateStateAndTargetPosition() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) if (!_airborne && _state != State.CARRY) { SetTheWorldAblaze(); } if (Object.op_Implicit((Object)(object)_targetActor) && Object.op_Implicit((Object)(object)((BraveBehaviour)_targetActor).sprite)) { if (_state == State.CHASE) { _targetPos = ((BraveBehaviour)_targetActor).sprite.WorldBottomCenter; } else if (_state == State.CHARGE) { _launchTarget = ((BraveBehaviour)_targetActor).sprite.WorldBottomCenter; } } } private void SetTheWorldAblaze() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (!(_igniteTime > BraveTime.ScaledTimeSinceStartup)) { if (!Object.op_Implicit((Object)(object)_FireGooper)) { _FireGooper = DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(EasyGoopDefinitions.FireDef); } float num = 1.5f; PlayerController owner = m_companionController.m_owner; if (owner != null && owner.HasSynergy(Synergy.COMBUST_LITERALLY_EVERYTHING)) { num *= 2f; } _FireGooper.AddGoopCircle(((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.UnitBottomCenter, num, -1, false, -1); } } protected override bool ReachedTarget() { switch (_state) { case State.CHASE: if (NearTargetPos(4.5f)) { return CanSeeTargetPos(); } return false; case State.IDLE: case State.WANDER: case State.CHARGE: return m_stateTimer <= 0f; case State.JUMP: case State.THROW: return !_airborne; default: return false; } } private void ResetState() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) ((BehaviorBase)this).m_aiActor.ClearPath(); _allowPathing = false; _airborne = false; _targetActor = null; _state = State.IDLE; m_stateTimer = Random.Range(1f, 3f); _targetPos = ((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition; ((GameActor)((BehaviorBase)this).m_aiActor).SetIsFlying(false, "launched", false, false); ((GameActor)((BehaviorBase)this).m_aiActor).SetIsFlying(false, "carried", false, false); ResetShadow(); DisableSecondaryRenderer(); if (!((BehaviorBase)this).m_aiAnimator.IsPlaying("idle")) { ((BehaviorBase)this).m_aiAnimator.PlayUntilCancelled("idle", false, (string)null, -1f, false); } } private void ResetShadow() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) ((GameActor)((BehaviorBase)this).m_aiActor).ToggleShadowVisiblity(true); GameObject shadowObject = ((GameActor)((BehaviorBase)this).m_aiActor).ShadowObject; shadowObject.transform.localPosition = Vector2Extensions.ToVector3ZUp(((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.UnitBottomCenter - Vector3Extensions.XY(((BraveBehaviour)((BehaviorBase)this).m_aiActor).transform.position), 0.1f); shadowObject.transform.position = dfVectorExtensions.Quantize(shadowObject.transform.position, 0.0625f); Transform transform = shadowObject.transform; transform.localPosition += ((GameActor)((BehaviorBase)this).m_aiActor).ActorShadowOffset; } protected override void OnReachedTarget() { //IL_005e: 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_006f: 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_00f1: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) switch (_state) { case State.IDLE: case State.WANDER: DetermineNewTarget(); break; case State.CHASE: _state = State.CHARGE; m_stateTimer = 1f; ((BehaviorBase)this).m_aiAnimator.PlayUntilCancelled("charge", false, (string)null, -1f, false); _launchTarget = _targetPos; _targetPos = ((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition; break; case State.CHARGE: if (!Object.op_Implicit((Object)(object)_targetActor) || !((Behaviour)_targetActor).isActiveAndEnabled || !Object.op_Implicit((Object)(object)((BraveBehaviour)_targetActor).healthHaver) || !((BraveBehaviour)_targetActor).healthHaver.IsAlive) { ResetState(); break; } _state = State.JUMP; _launchTarget = (Object.op_Implicit((Object)(object)((BraveBehaviour)_targetActor).sprite) ? ((BraveBehaviour)_targetActor).sprite.WorldBottomCenter : _targetActor.CenterPosition); LaunchTowardsTarget(_launchTarget, wasThrown: false); break; case State.JUMP: case State.THROW: ResetState(); break; case State.CARRY: break; } } private void LaunchTowardsTarget(Vector2 targetPos, bool wasThrown) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00b7: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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) ((BehaviorBase)this).m_aiAnimator.PlayUntilCancelled("jump", false, (string)null, -1f, false); ((Component)((BehaviorBase)this).m_aiActor).gameObject.Play("ignizol_launch_sound"); _launchStart = ((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition; _launchTarget = targetPos + Lazy.RandomVector(0.5f); Vector2 val = _launchTarget - _launchStart; float sqrMagnitude = ((Vector2)(ref val)).sqrMagnitude; if (sqrMagnitude > 25f) { val = 5f * ((Vector2)(ref val)).normalized; _launchTarget = _launchStart + val; } else if (sqrMagnitude < 4f) { val = 2f * ((Vector2)(ref val)).normalized; _launchTarget = _launchStart + val; } _launchVelocity = val / 0.4f; _launchBeginTime = BraveTime.ScaledTimeSinceStartup; ((GameActor)((BehaviorBase)this).m_aiActor).SetIsFlying(true, "launched", false, false); ((GameActor)((BehaviorBase)this).m_aiActor).ToggleShadowVisiblity(false); _airborne = true; _allowPathing = false; } private void UpdateMovementSpeed() { float movementSpeed = 3.5f; if (((BraveBehaviour)((BehaviorBase)this).m_aiActor).spriteAnimator.currentClip.name.Contains("idle")) { int currentFrame = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).spriteAnimator.CurrentFrame; if (_state != 0 && currentFrame == 7 && _lastIdleFrame != 7 && ((BehaviorBase)this).m_aiActor.MovementSpeed > 0f) { ((Component)((BehaviorBase)this).m_aiActor).gameObject.Play("ignizol_hop_sound"); } _lastIdleFrame = currentFrame; movementSpeed = ((currentFrame >= 3 && currentFrame <= 6) ? 3.5f : 0f); } ((BehaviorBase)this).m_aiActor.MovementSpeed = movementSpeed; } private void ToggleRendererAndOutlines(tk2dBaseSprite sprite, bool enabled) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (((BraveBehaviour)sprite).renderer.enabled != enabled) { ((BraveBehaviour)sprite).renderer.enabled = enabled; if (enabled) { SpriteOutlineManager.AddOutlineToSprite(sprite, Color.black, 0.2f, 0.05f, (OutlineType)0); } else { SpriteOutlineManager.RemoveOutlineFromSprite(sprite, false); } } } protected override void TickMovement(ref Vector2 voluntaryVel, ref Vector2 involuntaryVel) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0184: 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_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) Vector2 unitCenter = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.UnitCenter; if (Object.op_Implicit((Object)(object)_light)) { float num = Mathf.Abs(Mathf.Sin(10f * BraveTime.ScaledTimeSinceStartup)); _light.SetRadius(2f + 1f * num); _light.SetBrightness(10f + 5f * num); } if (_state == State.CHARGE || _state == State.CARRY) { voluntaryVel = Vector2.zero; involuntaryVel = Vector2.zero; if (_state == State.CHARGE) { ((BraveBehaviour)((BehaviorBase)this).m_aiActor).aiAnimator.FacingDirection = Vector2Extensions.ToAngle(_launchTarget - unitCenter); } else { if (!Object.op_Implicit((Object)(object)_carrier)) { return; } ((BraveBehaviour)((BehaviorBase)this).m_aiActor).aiAnimator.FacingDirection = ((GameActor)_carrier).FacingDirection; Vector3 val = Vector2.op_Implicit(dfVectorExtensions.Quantize(((BraveBehaviour)_carrier).sprite.WorldTopCenter + new Vector2(-0.5f, 0f), 0.0625f)); if (m_stateTimer <= 0f) { ((BraveBehaviour)((BehaviorBase)this).m_aiActor).transform.position = val; bool flipX = ((BraveBehaviour)_carrier).sprite.FlipX; if (UpdateSecondaryRenderer() || _launchSpriteFlipped != flipX) { ((BraveBehaviour)_jumpSprite).transform.parent = ((BraveBehaviour)_carrier).transform; ((BraveBehaviour)_jumpSprite).transform.position = val; _launchSpriteFlipped = flipX; } ((BraveBehaviour)_jumpSprite).transform.position = Vector3Extensions.WithY(((BraveBehaviour)_jumpSprite).transform.position, ((BraveBehaviour)_carrier).sprite.WorldTopCenter.y); ((tk2dBaseSprite)_jumpSprite).UpdateZDepth(); } else { Vector3 val2 = val - ((BraveBehaviour)((BehaviorBase)this).m_aiActor).transform.position; float num2 = 1f - m_stateTimer / 0.3f; Vector3 val3 = num2 * num2 * val2; ((BraveBehaviour)((BehaviorBase)this).m_aiActor).transform.position = Vector2.op_Implicit(Lazy.SmoothestLerp(Vector2.op_Implicit(((BraveBehaviour)((BehaviorBase)this).m_aiActor).transform.position + val3), Vector2.op_Implicit(val), 14f)); } ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.Reinitialize(); } } else if (_state != State.JUMP && _state != State.THROW) { involuntaryVel = Vector2.zero; UpdateMovementSpeed(); } else { voluntaryVel = Vector2.zero; involuntaryVel = _launchVelocity; float num3 = (BraveTime.ScaledTimeSinceStartup - _launchBeginTime) / 0.4f; if (num3 < 1f) { UpdateSecondaryRenderer(); ((BraveBehaviour)_jumpSprite).transform.parent = ((BraveBehaviour)((BraveBehaviour)((BehaviorBase)this).m_aiActor).sprite).transform; ((BraveBehaviour)_jumpSprite).transform.localPosition = new Vector3(0f, 1f * Mathf.Sin((float)Math.PI * num3), 0f); } else { involuntaryVel = Vector2.zero; _airborne = false; ((GameActor)((BehaviorBase)this).m_aiActor).SetIsFlying(false, "launched", true, false); ResetShadow(); DisableSecondaryRenderer(); } } } private bool UpdateSecondaryRenderer() { bool result = !((BraveBehaviour)_jumpSprite).renderer.enabled; ToggleRendererAndOutlines((tk2dBaseSprite)(object)_jumpSprite, enabled: true); ((tk2dBaseSprite)_jumpSprite).SetSprite(((BraveBehaviour)((BehaviorBase)this).m_aiActor).sprite.collection, ((BraveBehaviour)((BehaviorBase)this).m_aiActor).sprite.spriteId); ToggleRendererAndOutlines(((BraveBehaviour)((BehaviorBase)this).m_aiActor).sprite, enabled: false); return result; } private void DisableSecondaryRenderer() { ToggleRendererAndOutlines((tk2dBaseSprite)(object)_jumpSprite, enabled: false); ToggleRendererAndOutlines(((BraveBehaviour)((BehaviorBase)this).m_aiActor).sprite, enabled: true); } } } public class StuntHelmet : CwaffPassive { [HarmonyPatch(/*Could not decode attribute arguments.*/)] private class StuntExplosionPatch { [HarmonyILManipulator] private static void StuntExplosionIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); VariableDefinition val2 = il.DeclareLocal(); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchStloc(instr, 13) })) { return; } val.Emit(OpCodes.Ldloc_S, (byte)13); val.CallPrivate(typeof(StuntHelmet), "PlayerHasStuntHelmet"); val.Emit(OpCodes.Stloc, val2); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdfld(instr, "IsEthereal") })) { return; } val.Emit(OpCodes.Ldloc, val2); val.CallPrivate(typeof(StuntExplosionPatch), "Or"); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdfld(instr, "preventPlayerForce") })) { val.Emit(OpCodes.Ldloc, val2); val.CallPrivate(typeof(StuntExplosionPatch), "AndNot"); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdfld(instr, "force") })) { val.Emit(OpCodes.Ldloc, val2); val.Emit(OpCodes.Ldloc_S, (byte)13); val.CallPrivate(typeof(StuntHelmet), "DoStuntHelmetBoost"); } } } private static bool Or(bool val1, bool val2) { return val1 || val2; } private static bool AndNot(bool val1, bool val2) { if (val1) { return !val2; } return false; } } [CompilerGenerated] private sealed class d__13 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PlayerController target; public StuntHelmet helmet; private Material 5__2; private float 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; ((Component)target).gameObject.PlayUnique("stunt_time"); 5__2 = SpriteOutlineManager.GetOutlineMaterial(((BraveBehaviour)target).sprite); if (Object.op_Implicit((Object)(object)5__2)) { 5__2.SetColor(CwaffVFX._OverrideColorId, new Color(128f, 0f, 16f)); } target.ownerlessStatModifiers.Add(_StuntStats); target.stats.RecalculateStats(target, false, false); 5__3 = 0f; break; case 1: <>1__state = -1; if (!Object.op_Implicit((Object)(object)target) || !target.AcceptingAnyInput) { return false; } 5__3 += BraveTime.DeltaTime; break; } if (5__3 < 5f) { <>2__current = null; <>1__state = 1; return true; } if (Object.op_Implicit((Object)(object)5__2)) { 5__2.SetColor(CwaffVFX._OverrideColorId, new Color(0f, 0f, 0f)); } target.ownerlessStatModifiers.Remove(_StuntStats); target.stats.RecalculateStats(target, false, false); helmet._extantDamageBoostCoroutine = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static string ItemName = "Stunt Helmet"; public static string ShortDescription = "Aim for the Bushes"; public static string LongDescription = "Nullifies damage and quadruples knockback from all explosions that would otherwise affect the player. Increases base damage by 200% for 5 seconds after being pushed by an explosion."; public static string Lore = "In the grand scheme of things, a helmet won't really protect you from catching ablaze when being shot through a ring of fire, shattering all of your bones after falling off a motorcycle, or most of the other things that can go wrong while performing stunts. No, the helmet is there because it makes you look cool, and because it makes you easier to replace after your likely untimely demise. Despite that, the completely unwarranted feelings of safety and confidence it instills in some people is enough to incite extremely high-risk, medium-reward behaviors they otherwise wouldn't be inclined to engage in. And heck, some of those people are even still alive, so maybe this helmet thing has something going for it after all."; private const float _EXPLOSION_FORCE_MULT = 4f; private const float _DAMAGE_ADD = 2f; private const float _STUNT_TIME = 5f; internal static StatModifier _StuntStats = ((StatType)5).Add(2f); private Coroutine _extantDamageBoostCoroutine; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)2; ((PickupObject)(object)obj).AddToShop(ModdedShopType.Boomhildr); } private static bool PlayerHasStuntHelmet(PlayerController player) { if (Object.op_Implicit((Object)(object)player)) { return player.HasPassive(); } return false; } private static float DoStuntHelmetBoost(float origForce, bool hasStuntHelment, PlayerController player) { if (!hasStuntHelment) { return origForce; } StuntHelmet passive = player.GetPassive(); if (passive._extantDamageBoostCoroutine != null) { player.ownerlessStatModifiers.Remove(_StuntStats); ((MonoBehaviour)player).StopCoroutine(passive._extantDamageBoostCoroutine); } passive._extantDamageBoostCoroutine = ((MonoBehaviour)player).StartCoroutine(HandleDamageBoost(player, passive)); return origForce * 4f; } private static IEnumerator HandleDamageBoost(PlayerController target, StuntHelmet helmet) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__13(0) { target = target, helmet = helmet }; } } public class CustodiansBadge : CwaffPassive { public static string ItemName = "Custodian's Badge"; public static string ShortDescription = "Neat and Tidy"; public static string LongDescription = "Rewards extra shells for leaving decor unscathed after each combat encounter. Incurs one strike after letting more than 70% of decor in a room break. Disappears after incurring three strikes."; public static string Lore = "The role of Gungeon Custodian has been unfilled since the hiring of the Gungeon Janitorial Crew, who rendered the position mostly obsolete. The pay is mediocre, the working conditions are rather dangerous, and the job itself is surprisingly difficult. However, for adventurers who happen to be passing through the Gungeon, earning a few extra shells before inevitably getting fired for breaking everything with a BSG just might help pay for that extra piece of armor -- which will promptly be lost by stumbling into a pit."; internal const int _MAX_CHANCES = 3; internal const float _FAIL_THRESHOLD = 0.3f; internal const float _REWARD_THRESHOLD = 0.7f; internal const int _PERFECT_BONUS = 3; internal static string _MSG_JOIN = "Hey! Thanks for joining the curation crew! We like to keep an orderly Gungeon, so make sure you keep those mischievous Gundead from breaking everything."; internal static string _MSG_STRIKE_ONE = "Alright, you let a few too many things break. I'll let you off with a warning this time, but please be more careful in the future."; internal static string _MSG_STRIKE_TWO = "Look, your job is to keep stuff from breaking...and you're not doing that. One more muck-up like this and you're fired!"; internal static string _MSG_FIRED = "ALRIGHT, THAT'S IT, YOU'RE OUT OF THE JOB!"; internal static string _MSG_POISONED = "Ughh...it seems like some food poisoning has caught up to me, so your performance review will have to wait. Hope you're not letting too much break...."; internal static string _SIGNATURE = "\n\n- Your Boss[sprite \"resourceful_rat_icon_001\"]"; private int curRoomBreakables; private int maxRoomBreakables; public int chancesLeft = 3; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)1; ((PickupObject)obj).CanBeDropped = false; } public override void OnFirstPickup(PlayerController player) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) base.OnFirstPickup(player); chancesLeft = 3; string formattedNoteText = _MSG_JOIN + _SIGNATURE; CustomNoteDoer.CreateNote(((GameActor)player).CenterPosition, formattedNoteText, (NoteBackgroundType)3); } public override void Pickup(PlayerController player) { player.OnEnteredCombat = (Action)Delegate.Combine(player.OnEnteredCombat, new Action(OnEnteredCombat)); base.Pickup(player); } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { player.OnEnteredCombat = (Action)Delegate.Remove(player.OnEnteredCombat, new Action(OnEnteredCombat)); } } private void OnEnteredCombat() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)((PassiveItem)this).Owner)) { return; } RoomHandler currentRoom = ((PassiveItem)this).Owner.CurrentRoom; curRoomBreakables = 0; foreach (MinorBreakable allMinorBreakable in StaticReferenceManager.AllMinorBreakables) { if (Object.op_Implicit((Object)(object)allMinorBreakable) && !allMinorBreakable.IsBroken && Vector3Extensions.GetAbsoluteRoom(allMinorBreakable.CenterPoint) == currentRoom) { curRoomBreakables++; allMinorBreakable.OnBreakContext = (Action)Delegate.Combine(allMinorBreakable.OnBreakContext, new Action(HandleBroken)); } } maxRoomBreakables = curRoomBreakables; if (maxRoomBreakables != 0) { currentRoom.OnEnemiesCleared = (Action)Delegate.Combine(currentRoom.OnEnemiesCleared, new Action(OnRoomCleared)); } } private void OnRoomCleared() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) bool flag = true; float num = (float)curRoomBreakables / (float)maxRoomBreakables; IntVector2 centeredVisibleClearSpot; if (num < 0.3f) { if ((int)((PassiveItem)this).Owner.CurrentRoom.area.PrototypeRoomCategory != 3) { bool num2 = ((PassiveItem)this).Owner.HasSynergy(Synergy.JOB_SECURITY); if (!num2) { chancesLeft--; } string text = (num2 ? _MSG_POISONED : ((chancesLeft == 2) ? _MSG_STRIKE_ONE : ((chancesLeft != 1) ? _MSG_FIRED : _MSG_STRIKE_TWO))); text += _SIGNATURE; centeredVisibleClearSpot = ((PassiveItem)this).Owner.CurrentRoom.GetCenteredVisibleClearSpot(2, 2, ref flag, false); Vector2 position = ((IntVector2)(ref centeredVisibleClearSpot)).ToVector2(); if (flag) { CustomNoteDoer.CreateNote(position, text, (NoteBackgroundType)3); } if (chancesLeft == 0) { ((PassiveItem)this).Owner.RemovePassiveItem(((PickupObject)this).PickupObjectId); } } } else if (!(num <= 0.7f)) { int num3 = Mathf.CeilToInt(20f * (num - 0.7f)); int num4 = curRoomBreakables / 10; int num5 = Mathf.Max(num3, num4); string text2 = string.Format("Here's {0} casing{1}, keep up the good work! :)", num5, (num5 == 1) ? "" : "s"); if (num == 1f) { num5 += 3; text2 = "Marvelous!\n\n" + text2; } centeredVisibleClearSpot = ((PassiveItem)this).Owner.CurrentRoom.GetCenteredVisibleClearSpot(2, 2, ref flag, false); Vector2 position = ((IntVector2)(ref centeredVisibleClearSpot)).ToVector2(); if (flag) { CustomNoteDoer.CreateNote(position, text2 + _SIGNATURE, (NoteBackgroundType)3); } LootEngine.SpawnCurrency(flag ? position : ((GameActor)((PassiveItem)this).Owner).CenterPosition, num5, false, (Vector2?)null, (float?)null, 40f, 0.05f); } } private void HandleBroken(MinorBreakable mb) { curRoomBreakables--; } public override void MidGameSerialize(List data) { ((PickupObject)this).MidGameSerialize(data); data.Add(chancesLeft); } public override void MidGameDeserialize(List data) { ((PassiveItem)this).MidGameDeserialize(data); chancesLeft = (int)data[0]; } } public class AmethystShard : CwaffCompanion { public static string ItemName = "Amethyst Shard"; public static string ShortDescription = "Allay Your Worries"; public static string LongDescription = "Spawns a friendly Allay. While in combat, the Allay will attempt to grab small enemies and drop them into pits. Out of combat, the Allay will bring nearby minor collectibles to the player. Spinning around near a minor collectible will cause the Allay to pick it up and enter scouting mode, providing a small chance to find items of the same type when clearing a room. Interacting with the Allay will cause it to drop any held items."; public static string Lore = "A shiny purple gemstone normally found in geodes deep underground. It's not particularly useful in its own right, but folk tales claim these gemstones attract certain playful creatures with a love for relocating trinkets they find on the ground."; public static string CompanionName = "Allay"; public int itemsFound; public int scoutItemId = -1; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore, hideFromAmmonomicon: false, 1f); ((PickupObject)obj).quality = (ItemQuality)3; AllayCompanion allayCompanion = obj.InitCompanion(CompanionName, 12).SetPettingOffsets(new Vector2(-0.625f, -0.25f), (Vector2?)new Vector2(0.375f, -0.25f)).MakeIntangible(); ((BraveBehaviour)((BraveBehaviour)allayCompanion).aiActor).specRigidbody.CollideWithTileMap = true; ((Component)allayCompanion).gameObject.GetComponent().MovementBehaviors.Add((MovementBehaviorBase)(object)new AllayCompanion.AllayMovementBehavior()); AllayCompanion._AllaySparkles = VFX.Create("allay_sparkles", 10f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } public override void DisableEffect(PlayerController player) { scoutItemId = -1; ((PassiveItem)this).DisableEffect(player); } public override void MidGameSerialize(List data) { ((PickupObject)this).MidGameSerialize(data); data.Add(itemsFound); data.Add(scoutItemId); } public override void MidGameDeserialize(List data) { ((PassiveItem)this).MidGameDeserialize(data); itemsFound = (int)data[0]; scoutItemId = (int)data[1]; } } public class AllayCompanion : CwaffCompanionController { public class AllayMovementBehavior : CwaffCompanionMovementBehaviorBase { internal enum State { OWNER_FOLLOW, ENEMY_SEEK, ENEMY_CARRY, ITEM_SEEK, ITEM_RETRIEVE, ITEM_INSPECT, ITEM_LOCATE, ITEM_DANCE } private const float _ROOM_CLEAR_ITEM_CHANCE = 0.075f; public float IdealRadius = 3f; private GameActor _heldActor; private PickupObject _targetItem; private State _state; private bool _scouting; private Vector2 _pitPos; private tk2dSprite _heldItemRenderer; private GameActor _lastDroppedActor; private float _cumulativeGunRotation; private float _zeroRotationTime; private float _lastGunAngle; private Vector2 _lastVel; private float _bobAmount; private bool _wasBeingPet; private AmethystShard _allayItem; private int _heldItemId = -1; private static readonly List _PickupWhitelist = new List(1) { 565 }; private RoomHandler _cachedPitRoom; private bool _cachedRoomHasPits; private const float _DANCE_RADIUS = 3f; private const float _PICKUP_RADIUS = 1f; private float _targetAngle; private const float _SNAP_DIST = 1f; private const float _SNAP_DIST_SQR = 1f; private float _lastSparkle; public override void Start() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown base.Start(); preventWarpingWhenOnscreen = true; ((GameActor)((BehaviorBase)this).m_aiActor).FallingProhibited = true; AIActor aiActor = ((BehaviorBase)this).m_aiActor; aiActor.PathableTiles = (CellTypes)(aiActor.PathableTiles | 4); ((BraveBehaviour)((BehaviorBase)this).m_aiActor).sprite.HeightOffGround = 2f; ((BraveBehaviour)((BehaviorBase)this).m_aiActor).sprite.UpdateZDepth(); m_companionController.m_owner.OnRoomClearEvent += PossiblyFindCopyOfHeldItem; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody; specRigidbody.OnTileCollision = (OnTileCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnTileCollision, (Delegate?)new OnTileCollisionDelegate(OnTileCollision)); if (!GameManager.Instance.IsLoadingLevel) { ((Component)((BehaviorBase)this).m_aiActor).gameObject.Play("allay_spawn_sound"); } PlayerController owner = m_companionController.m_owner; if (owner != null) { foreach (PassiveItem passiveItem in owner.passiveItems) { if (passiveItem is AmethystShard amethystShard && !((Object)(object)((CompanionItem)amethystShard).ExtantCompanion != (Object)(object)((BehaviorBase)this).m_gameObject)) { _allayItem = amethystShard; break; } } } if (Object.op_Implicit((Object)(object)_allayItem) && _allayItem.scoutItemId != -1) { _heldItemId = _allayItem.scoutItemId; SetupHeldItemRenderer(); _scouting = true; } } public override void Destroy() { DropItem(); DropEnemy(droppedEarly: true); if (Object.op_Implicit((Object)(object)m_companionController) && Object.op_Implicit((Object)(object)m_companionController.m_owner)) { m_companionController.m_owner.OnRoomClearEvent -= PossiblyFindCopyOfHeldItem; } base.Destroy(); } private void OnTileCollision(CollisionData tileCollision) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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) //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (tileCollision.CollidedX) { _lastVel = Vector2Extensions.WithX(_lastVel, 0f); } if (tileCollision.CollidedY) { _lastVel = Vector2Extensions.WithY(_lastVel, 0f); } } private void PossiblyFindCopyOfHeldItem(PlayerController controller) { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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) if (_scouting && _heldItemId != -1 && controller.CurrentRoom != null && Object.op_Implicit((Object)(object)_allayItem)) { float num = 0.075f * (controller.HasSynergy(Synergy.SPAWNPROOFING) ? 2f : 1f); if (controller.HasSynergy(Synergy.SPAWNPROOFING) && StackOfTorches._TorchesInRoom.TryGetValue(controller.CurrentRoom, out var value) && value > 0) { num *= 2f; } if (!(Random.value > Mathf.Max(num - 0.01f * (float)_allayItem.itemsFound, 0.025f))) { _allayItem.itemsFound++; GameObject gameObject = ((Component)PickupObjectDatabase.GetById(_heldItemId)).gameObject; IntVector2 bestRewardLocation = controller.CurrentRoom.GetBestRewardLocation(IntVector2.One, (RewardLocationStyle)0, true); Vector3 val = ((IntVector2)(ref bestRewardLocation)).ToVector3(); Vector2 insideUnitCircle = Random.insideUnitCircle; _targetItem = ((Component)LootEngine.SpawnItem(gameObject, val, ((Vector2)(ref insideUnitCircle)).normalized, 0.1f, true, true, false)).gameObject.GetComponent(); ((Component)((BehaviorBase)this).m_aiActor).gameObject.Play("allay_find_sound"); _state = State.ITEM_LOCATE; } } } private AIActor FindCarriableEnemy() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) RoomHandler currentRoom = m_companionController.m_owner.CurrentRoom; if (currentRoom == null) { return null; } float num = 1f; GameLevelDefinition lastLoadedLevelDefinition = GameManager.Instance.GetLastLoadedLevelDefinition(); if (lastLoadedLevelDefinition != null) { num *= lastLoadedLevelDefinition.enemyHealthMultiplier; } float num2 = 40f * num; Vector2 unitCenter = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.UnitCenter; AIActor result = null; float num3 = 999f; foreach (AIActor item in currentRoom.SafeGetEnemiesInRoom()) { if (!Object.op_Implicit((Object)(object)item) || !((Behaviour)item).isActiveAndEnabled || (Object)(object)item == (Object)(object)_lastDroppedActor || !item.IsWorthShootingAt || ((GameActor)item).IsFlying || ((GameActor)item).FallingProhibited || ((GameActor)item).IsFalling) { continue; } HealthHaver healthHaver = ((BraveBehaviour)item).healthHaver; if (healthHaver == null || healthHaver.maximumHealth >= num2 || healthHaver.IsDead || healthHaver.IsBoss || healthHaver.IsSubboss || !healthHaver.IsVulnerable) { continue; } SpeculativeRigidbody specRigidbody = ((BraveBehaviour)item).specRigidbody; if (specRigidbody == null || !specRigidbody.CanBeCarried) { continue; } BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)item).behaviorSpeculator; if (behaviorSpeculator != null && behaviorSpeculator.IsInterruptable && !behaviorSpeculator.ImmuneToStun) { Vector2 val = ((GameActor)item).CenterPosition - unitCenter; float sqrMagnitude = ((Vector2)(ref val)).sqrMagnitude; if (!(sqrMagnitude > num3)) { result = item; num3 = sqrMagnitude; } } } return result; } private PickupObject FindCarriableItem(bool nearby = false) { //IL_00d5: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) PlayerController owner = m_companionController.m_owner; RoomHandler currentRoom = owner.CurrentRoom; if (currentRoom == null) { return null; } int count = CwaffEvents._DebrisPickups.Count; for (int i = 0; i < count; i++) { PickupObject val = CwaffEvents._DebrisPickups[i]; if (!Object.op_Implicit((Object)(object)val) || val.IsBeingSold) { continue; } HealthPickup val2 = (HealthPickup)(object)((val is HealthPickup) ? val : null); bool num = val2 != null && !val2.m_pickedUp; AmmoPickup val3 = (AmmoPickup)(object)((val is AmmoPickup) ? val : null); bool flag = val3 != null && !val3.m_pickedUp; bool flag2 = val is KeyBulletPickup; SilencerItem val4 = (SilencerItem)(object)((val is SilencerItem) ? val : null); bool flag3 = val4 != null && !((PlayerItem)val4).m_pickedUp; bool flag4 = _PickupWhitelist.Contains(val.PickupObjectId); if ((num || flag || flag2 || flag3 || flag4) && Vector3Extensions.GetAbsoluteRoom(((BraveBehaviour)val).transform.position) == currentRoom) { Vector2 val5 = ((GameActor)owner).CenterPosition - Vector3Extensions.XY(((BraveBehaviour)val).transform.position); float sqrMagnitude = ((Vector2)(ref val5)).sqrMagnitude; if (nearby == sqrMagnitude < 25f) { return ((Component)val).GetComponent(); } } } return null; } private bool FindNearestPit(Vector2 pos, out IntVector2 pitPos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Invalid comparison between Unknown and I4 //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) pitPos = IntVector2.Zero; if (_cachedPitRoom == null) { return false; } IntVector2 val = Vector2Extensions.ToIntVector2(pos, (VectorConversions)0); float num = 9999f; bool result = false; foreach (IntVector2 cell in _cachedPitRoom.Cells) { CellData val2 = GameManager.Instance.Dungeon.data[cell]; if (val2 != null && (int)val2.type == 4 && !val2.fallingPrevented) { IntVector2 val3 = cell - val; float num2 = ((IntVector2)(ref val3)).sqrMagnitude; if (!(num2 > num)) { result = true; num = num2; pitPos = cell; } } } return result; } private bool RoomContainsPits() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) RoomHandler currentRoom = m_companionController.m_owner.CurrentRoom; if (currentRoom == _cachedPitRoom) { return _cachedRoomHasPits; } _cachedPitRoom = currentRoom; _cachedRoomHasPits = FindNearestPit(((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.UnitCenter, out var _); return _cachedRoomHasPits; } protected override void DetermineNewTarget() { //IL_0095: 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_009c: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) PlayerController owner = m_companionController.m_owner; DropEnemy(droppedEarly: true); _scouting = _scouting && _heldItemId >= 0 && !m_companionController.IsBeingPet; if (!_scouting) { DropItem(); } _heldActor = null; _targetItem = null; _targetActor = (GameActor)(object)owner; _state = State.OWNER_FOLLOW; if (_scouting) { return; } if (owner.IsInCombat) { if (!RoomContainsPits()) { return; } AIActor val = FindCarriableEnemy(); if (val != null) { Vector2 unitCenter = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.UnitCenter; if (FindNearestPit(unitCenter, out var pitPos)) { _state = State.ENEMY_SEEK; _targetActor = (GameActor)(object)val; _pitPos = ((IntVector2)(ref pitPos)).ToVector2() + new Vector2(0.5f, 0.5f); } } } else { PickupObject val2 = FindCarriableItem(); if (val2 != null) { _state = State.ITEM_SEEK; _targetItem = val2; } } } protected override bool IsTargetValid() { //IL_0100: Unknown result type (might be due to invalid IL or missing references) switch (_state) { case State.ENEMY_CARRY: if (Object.op_Implicit((Object)(object)_heldActor) && Object.op_Implicit((Object)(object)((BraveBehaviour)_heldActor).healthHaver)) { return ((BraveBehaviour)_heldActor).healthHaver.IsAlive; } return false; case State.OWNER_FOLLOW: case State.ENEMY_SEEK: case State.ITEM_RETRIEVE: if (Object.op_Implicit((Object)(object)_targetActor) && Object.op_Implicit((Object)(object)((BraveBehaviour)_targetActor).healthHaver)) { return ((BraveBehaviour)_targetActor).healthHaver.IsAlive; } return false; case State.ITEM_SEEK: case State.ITEM_INSPECT: case State.ITEM_LOCATE: case State.ITEM_DANCE: if (Object.op_Implicit((Object)(object)_targetItem) && Object.op_Implicit((Object)(object)((BraveBehaviour)_targetItem).debris) && (_state == State.ITEM_LOCATE || _state == State.ITEM_DANCE || ((BraveBehaviour)_targetItem).debris.onGround) && Object.op_Implicit((Object)(object)((BraveBehaviour)((BraveBehaviour)_targetItem).debris).sprite)) { RoomHandler absoluteRoom = Vector3Extensions.GetAbsoluteRoom(((BraveBehaviour)((BraveBehaviour)_targetItem).debris).sprite.WorldCenter); if (absoluteRoom != null) { return absoluteRoom == m_companionController.m_owner.CurrentRoom; } } return false; default: return false; } } protected override void UpdateStateAndTargetPosition() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) if (_state == State.OWNER_FOLLOW || m_companionController.IsBeingPet) { DetermineNewTarget(); } if (_state != 0) { _cumulativeGunRotation = 0f; } switch (_state) { case State.ENEMY_CARRY: _targetPos = _pitPos; break; case State.OWNER_FOLLOW: case State.ENEMY_SEEK: case State.ITEM_RETRIEVE: _targetPos = _targetActor.CenterPosition; break; case State.ITEM_SEEK: case State.ITEM_INSPECT: case State.ITEM_LOCATE: case State.ITEM_DANCE: _targetPos = ((BraveBehaviour)((BraveBehaviour)_targetItem).debris).sprite.WorldCenter; break; } } protected override bool ReachedTarget() { //IL_005b: 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) if (m_companionController.IsBeingPet) { return false; } switch (_state) { case State.ITEM_DANCE: return true; case State.ENEMY_CARRY: if (((BehaviorBase)this).m_aiActor.IsOverPit) { if (!_heldActor.WillDefinitelyFall()) { Vector2 val = DeltaToTarget(); return ((Vector2)(ref val)).sqrMagnitude < 0.1f; } return true; } return false; case State.OWNER_FOLLOW: return NearTargetPos(IdealRadius); case State.ITEM_RETRIEVE: if (NearTargetPos(IdealRadius, checkInBounds: false)) { return !NearPit(); } return false; case State.ENEMY_SEEK: case State.ITEM_SEEK: case State.ITEM_INSPECT: return NearTargetPos(1f); case State.ITEM_LOCATE: return NearTargetPos(3f); default: return false; } } protected override void OnReachedTarget() { switch (_state) { case State.OWNER_FOLLOW: ((BehaviorBase)this).m_aiActor.ClearPath(); break; case State.ENEMY_SEEK: GrabEnemy(); break; case State.ENEMY_CARRY: DropEnemyInPit(); break; case State.ITEM_RETRIEVE: DropItemNearPlayer(); break; case State.ITEM_SEEK: case State.ITEM_INSPECT: GrabItem(); break; case State.ITEM_LOCATE: case State.ITEM_DANCE: DanceAroundItem(); break; } } private void DoSpinningChecks() { //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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) if (!GameManager.HasInstance || GameManager.Instance.IsLoadingLevel || GameManager.Instance.IsPaused || BraveTime.DeltaTime == 0f) { return; } if (_scouting || _state != 0 || !ReachedTarget()) { _cumulativeGunRotation = 0f; return; } PlayerController owner = m_companionController.m_owner; float num = Vector2Extensions.ToAngle(Vector3Extensions.XY(owner.unadjustedAimPoint) - ((GameActor)owner).CenterPosition); float num2 = Vector2.SignedAngle(BraveMathCollege.DegreesToVector(num, 1f), BraveMathCollege.DegreesToVector(_lastGunAngle, 1f)); num2 = Mathf.Clamp(num2, -90f, 90f); if (Mathf.Abs(num2) < 120f * BraveTime.DeltaTime) { if ((_zeroRotationTime += Time.deltaTime) < 0.0333f) { return; } num2 = 0f; _cumulativeGunRotation = 0f; } else { _zeroRotationTime = 0f; } _lastGunAngle = num; _cumulativeGunRotation += num2; if (!(Mathf.Abs(_cumulativeGunRotation) < 720f)) { _cumulativeGunRotation = 0f; PickupObject val = FindCarriableItem(nearby: true); if (val != null) { ((Component)((BehaviorBase)this).m_aiActor).gameObject.Play("allay_find_sound"); _state = State.ITEM_INSPECT; _targetItem = val; _targetActor = null; } } } private void GrabEnemy() { //IL_006f: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_targetActor)) { Lazy.RuntimeWarn("grabbing nonexistent enemy"); return; } BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)_targetActor).behaviorSpeculator; if (behaviorSpeculator != null) { behaviorSpeculator.InterruptAndDisable(); behaviorSpeculator.Stun(3600f, false); } SpeculativeRigidbody specRigidbody = ((BraveBehaviour)m_companionController).specRigidbody; SpeculativeRigidbody specRigidbody2 = ((BraveBehaviour)_targetActor).specRigidbody; specRigidbody.RegisterCarriedRigidbody(specRigidbody2); specRigidbody.CollideWithTileMap = false; Vector2 worldCenter = ((BraveBehaviour)((BraveBehaviour)m_companionController).aiActor).sprite.WorldCenter; Vector2 val = Vector3Extensions.XY(((BraveBehaviour)_targetActor).transform.position) - specRigidbody2.UnitCenter; ((BraveBehaviour)_targetActor).transform.position = Vector2Extensions.ToVector3ZUp(worldCenter + val, 0f); specRigidbody2.Reinitialize(); specRigidbody2.RegisterSpecificCollisionException(specRigidbody); specRigidbody.RegisterSpecificCollisionException(specRigidbody2); specRigidbody2.CollideWithOthers = false; specRigidbody2.CollideWithTileMap = false; specRigidbody2.AddCollisionLayerIgnoreOverride(CollisionMask.LayerToMask((CollisionLayer)5)); KnockbackDoer knockbackDoer = ((BraveBehaviour)_targetActor).knockbackDoer; if (knockbackDoer != null) { knockbackDoer.knockbackMultiplier = 0f; } _targetActor.FallingProhibited = true; _heldActor = _targetActor; _targetActor = null; FindNearestPit(Vector2.op_Implicit(((BraveBehaviour)m_companionController).transform.position), out var pitPos); _pitPos = ((IntVector2)(ref pitPos)).ToVector2() + new Vector2(0.5f, 0.5f); _targetPos = _pitPos; _state = State.ENEMY_CARRY; RepathToTarget(); } private void DropEnemyInPit() { DropEnemy(); ((Component)((BehaviorBase)this).m_aiActor).gameObject.Play("allay_drop_sound"); _state = State.OWNER_FOLLOW; DetermineNewTarget(); } private void DropEnemy(bool droppedEarly = false) { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_heldActor)) { return; } SpeculativeRigidbody specRigidbody = ((BraveBehaviour)m_companionController).specRigidbody; SpeculativeRigidbody specRigidbody2 = ((BraveBehaviour)_heldActor).specRigidbody; specRigidbody.DeregisterCarriedRigidbody(specRigidbody2); specRigidbody2.DeregisterSpecificCollisionException(specRigidbody); specRigidbody.DeregisterSpecificCollisionException(specRigidbody2); specRigidbody2.CollideWithOthers = true; specRigidbody2.CollideWithTileMap = true; specRigidbody2.RemoveCollisionLayerIgnoreOverride(CollisionMask.LayerToMask((CollisionLayer)5)); KnockbackDoer knockbackDoer = ((BraveBehaviour)_heldActor).knockbackDoer; if (knockbackDoer != null) { knockbackDoer.knockbackMultiplier = 1f; } _heldActor.FallingProhibited = false; BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)_heldActor).behaviorSpeculator; if (behaviorSpeculator != null) { behaviorSpeculator.EndStun(); ((Behaviour)behaviorSpeculator).enabled = true; } specRigidbody2.Reinitialize(); specRigidbody2.CorrectForWalls(); if (!droppedEarly) { Vector2 val = DeltaToTarget(); if (((Vector2)(ref val)).sqrMagnitude < 0.1f && !_heldActor.WillDefinitelyFall()) { _heldActor.ForceFall(); } } _lastDroppedActor = _heldActor; _heldActor = null; } private void SetupHeldItemRenderer() { //IL_005e: 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_00af: Unknown result type (might be due to invalid IL or missing references) tk2dSprite component = ((Component)PickupObjectDatabase.GetById(_heldItemId)).gameObject.GetComponent(); _heldItemRenderer = Lazy.SpriteObject(((tk2dBaseSprite)component).collection, ((tk2dBaseSprite)component).spriteId); ((tk2dBaseSprite)_heldItemRenderer).HeightOffGround = -2f; ((tk2dBaseSprite)_heldItemRenderer).UpdateZDepth(); ((tk2dBaseSprite)_heldItemRenderer).PlaceAtPositionByAnchor(Vector2.op_Implicit(((BraveBehaviour)((BraveBehaviour)m_companionController).aiActor).sprite.WorldCenter), (Anchor)7); ((BraveBehaviour)m_companionController).sprite.AttachRenderer((tk2dBaseSprite)(object)_heldItemRenderer); ((Component)_heldItemRenderer).gameObject.transform.parent = ((BraveBehaviour)((BraveBehaviour)m_companionController).sprite).transform; SpriteOutlineManager.AddOutlineToSprite((tk2dBaseSprite)(object)_heldItemRenderer, Color.black); } private void GrabItem() { if (!Object.op_Implicit((Object)(object)_targetItem)) { Lazy.RuntimeWarn("grabbing nonexistent item"); return; } _heldItemId = _targetItem.PickupObjectId; SetupHeldItemRenderer(); Object.Destroy((Object)(object)((Component)_targetItem).gameObject); _targetItem = null; _targetActor = (GameActor)(object)m_companionController.m_owner; if (_state == State.ITEM_INSPECT) { if (Object.op_Implicit((Object)(object)_allayItem)) { _allayItem.scoutItemId = _heldItemId; } _scouting = true; _state = State.OWNER_FOLLOW; } else { _state = State.ITEM_RETRIEVE; } RepathToTarget(); } private void DropItemNearPlayer() { DropItem(); ((Component)((BehaviorBase)this).m_aiActor).gameObject.Play("allay_drop_sound"); _targetActor = null; _state = State.OWNER_FOLLOW; DetermineNewTarget(); } private void DropItem() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0047: Unknown result type (might be due to invalid IL or missing references) if (_heldItemId != -1 && !GameManager.Instance.IsLoadingLevel) { GameObject gameObject = ((Component)PickupObjectDatabase.GetById(_heldItemId)).gameObject; Vector3 val = Vector2Extensions.ToVector3ZUp(((BraveBehaviour)((BehaviorBase)this).m_aiActor).sprite.WorldBottomCenter, 0f); Vector2 insideUnitCircle = Random.insideUnitCircle; LootEngine.SpawnItem(gameObject, val, ((Vector2)(ref insideUnitCircle)).normalized, 0.1f, true, false, false); } _heldItemId = -1; if (Object.op_Implicit((Object)(object)_allayItem) && !GameManager.Instance.IsLoadingLevel) { _allayItem.scoutItemId = -1; } if (Object.op_Implicit((Object)(object)_heldItemRenderer)) { ((BraveBehaviour)m_companionController).sprite.DetachRenderer((tk2dBaseSprite)(object)_heldItemRenderer); ((Component)_heldItemRenderer).gameObject.transform.parent = null; Object.Destroy((Object)(object)((Component)_heldItemRenderer).gameObject); _heldItemRenderer = null; } } private void DanceAroundItem() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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) ((BehaviorBase)this).m_aiActor.ClearPath(); if (_state == State.ITEM_LOCATE) { ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.CollideWithTileMap = false; _targetAngle = Vector2Extensions.ToAngle(((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.UnitCenter - _targetPos); _state = State.ITEM_DANCE; } } private void UpdateMovementSpeed() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) Vector2 val = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).sprite.WorldCenter - _targetPos; float movementSpeed = Mathf.Clamp(((Vector2)(ref val)).sqrMagnitude, 5f, (_state == State.ENEMY_CARRY) ? 12f : 20f); ((BehaviorBase)this).m_aiActor.MovementSpeed = movementSpeed; } private void DoSparkles() { //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_0032: Unknown result type (might be due to invalid IL or missing references) float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; if (!(scaledTimeSinceStartup - _lastSparkle < 0.06f)) { _lastSparkle = scaledTimeSinceStartup; GameObject allaySparkles = _AllaySparkles; Vector3 position = Vector2.op_Implicit(((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition); Quaternion? rotation = Lazy.RandomEulerZ(); float? endScale = 0.1f; float? fadeOutTime = 1f; CwaffVFX.Spawn(allaySparkles, position, rotation, null, 0.5f, fadeOutTime, 0f, null, fadeIn: false, null, endScale, null, randomFrame: true); } } protected override void TickMovement(ref Vector2 voluntaryVel, ref Vector2 involuntaryVel) { //IL_0065: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_016e: 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_0107: 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) //IL_0118: 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_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) UpdateMovementSpeed(); DoSpinningChecks(); if (DoDancingChecks()) { DoSparkles(); return; } if (m_companionController.IsBeingPet) { if (!_wasBeingPet) { ((Component)((BehaviorBase)this).m_aiActor).gameObject.Play("allay_pet_sound"); } _wasBeingPet = true; return; } _wasBeingPet = false; bool flag = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.UnitBottomCenter.InBounds(); if (flag && _state != State.ENEMY_CARRY && !((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.CollideWithTileMap) { ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.CollideWithTileMap = true; ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.CorrectForWalls(); } Vector2 val = DeltaToTarget(); if (!flag || (((BehaviorBase)this).m_aiActor.PathComplete && !ReachedTarget())) { voluntaryVel = ((BehaviorBase)this).m_aiActor.MovementSpeed * ((Vector2)(ref val)).normalized; } else if (_state != 0 && ((Vector2)(ref val)).sqrMagnitude < 1f) { voluntaryVel += 2f * ((Vector2)(ref val)).normalized; } if (((Vector2)(ref voluntaryVel)).sqrMagnitude > 1f || ((Vector2)(ref _lastVel)).sqrMagnitude > 1f) { voluntaryVel = Lazy.SmoothestLerp(_lastVel, voluntaryVel, flag ? 6f : 10f); } _lastVel = voluntaryVel; if (((Vector2)(ref voluntaryVel)).sqrMagnitude > 10f) { DoSparkles(); } if (voluntaryVel != Vector2.zero) { _bobAmount = 0f; return; } _bobAmount += 6f * BraveTime.DeltaTime; voluntaryVel = new Vector2(0f, 0.5f * Mathf.Sin(_bobAmount)); } private bool DoDancingChecks() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0069: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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) if (_state != State.ITEM_DANCE) { return false; } Vector2 unitCenter = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.UnitCenter; _targetAngle += 360f * BraveTime.DeltaTime; Vector2 b = _targetPos + _targetAngle.ToVector(3f); Vector2 val = Lazy.SmoothestLerp(unitCenter, b, 4f); Vector2 val2 = unitCenter - Vector3Extensions.XY(((BraveBehaviour)((BehaviorBase)this).m_aiActor).transform.position); ((BraveBehaviour)((BehaviorBase)this).m_aiActor).transform.position = Vector2.op_Implicit(val - val2); ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.Reinitialize(); ((BraveBehaviour)((BehaviorBase)this).m_aiActor).aiAnimator.FacingDirection = Vector2Extensions.ToAngle(val - unitCenter); return true; } } internal static GameObject _AllaySparkles; } public class PrismaticScope : CwaffPassive { public static string ItemName = "Prismatic Scope"; public static string ShortDescription = "A Colorful Sight"; public static string LongDescription = "Increases the damage of all beam weapons by 40%."; public static string Lore = "A thick, multifaceted lens shaped to refract light into a full spectrum of colors. Astute Gungeoneers noticed that installing the lens backwards on their guns served to focus and amplify their light-based projectiles. Even when installed backwards, the smatterings of multicolored light emitted are still highly aesthetic."; private const float _BEAM_DAMAGE_MULT = 1.4f; private const float _PARTICLE_TIME = 0.05f; internal static GameObject _PrismaticVFX; private float _timer; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)2; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)3, 1f); _PrismaticVFX = VFX.Create("prismatic_scope", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } public override void Pickup(PlayerController player) { base.Pickup(player); player.PostProcessBeam += PostProcessBeam; } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { player.PostProcessBeam -= PostProcessBeam; } } private void PostProcessBeam(BeamController beam) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 Projectile projectile = ((BraveBehaviour)beam).projectile; if (projectile != null) { Gun possibleSourceGun = projectile.PossibleSourceGun; if (possibleSourceGun != null && ((int)possibleSourceGun.gunClass == 20 || (int)possibleSourceGun.DefaultModule.shootStyle == 2)) { ProjectileData baseData = projectile.baseData; baseData.damage *= 1.4f; } } } public override void Update() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) ((PassiveItem)this).Update(); PlayerController owner = ((PassiveItem)this).Owner; if (owner != null) { Gun currentGun = ((GameActor)owner).CurrentGun; if (currentGun != null && currentGun.IsFiring && ((int)currentGun.gunClass == 20 || (int)currentGun.DefaultModule.shootStyle == 2) && !((_timer += BraveTime.DeltaTime) < 0.05f)) { _timer -= 0.05f; GameObject prismaticVFX = _PrismaticVFX; Vector2 basePosition = Vector2.op_Implicit(currentGun.barrelOffset.position); Vector2? baseVelocity = currentGun.gunAngle.ToVector(16f); float lifetime = 0.25f + 0.5f * Random.value; Color? emissiveColor = Color.white; CwaffVFX.SpawnBurst(prismaticVFX, 5, basePosition, 0f, baseVelocity, 0f, 4f, CwaffVFX.Vel.Random, CwaffVFX.Rot.None, lifetime, null, 100f, emissiveColor, fadeIn: false, uniform: false, null, null, null, randomFrame: true, -1, flipX: false, flipY: false, null, null, 1.55f, 30f); } } } } public class DriftersHeadgear : CwaffDodgeRollItem { public static string ItemName = "Drifter's Headgear"; public static string ShortDescription = "Hyper Light Dodger"; public static string LongDescription = "Grants the player an extremely quick dash in place of their dodge roll, but leaves them vulnerable to bullets and enemies while dashing."; public static string Lore = "A memento left behind by a former adventurer said to possess the ability to outrun everything except his inner demons. While he never elaborated on what exactly those demons were, it almost certainly wasn't the likes of the Gundead."; internal static GameObject _LinkVFXPrefab; internal static Projectile _LightningProjectile; private HLDRoll _dodgeRoller; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore, hideFromAmmonomicon: false, 1f); ((PickupObject)obj).quality = (ItemQuality)2; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)3, 1f); ((Component)obj).gameObject.AddComponent(); _LinkVFXPrefab = FakePrefab.Clone(((Component)Game.Items["shock_rounds"]).GetComponent().ChainLightningVFX).RegisterPrefab(deactivate: false); float? damage = 5f; float? speed = 0.001f; _LightningProjectile = Items.GunslingersAshes.CloneProjectile(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, damage, speed, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4)); } public override void Update() { ((PassiveItem)this).Update(); if (Object.op_Implicit((Object)(object)((PassiveItem)this).Owner)) { _dodgeRoller.isHyped = ((PassiveItem)this).Owner.HasSynergy(Synergy.HYPE_YOURSELF_UP); } } private void OnPreCollision(SpeculativeRigidbody myRigidbody, PixelCollider myCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherCollider) { if (((CustomDodgeRoll)_dodgeRoller)._isDodging && _dodgeRoller.isHyped) { Projectile component = ((Component)otherRigidbody).GetComponent(); if ((Object)(object)component != (Object)null && !(component.Owner is PlayerController)) { PassiveReflectItem.ReflectBullet(component, true, ((BraveBehaviour)((BraveBehaviour)((PassiveItem)this).Owner).specRigidbody).gameActor, 10f, 1f, 1f, 0f); PhysicsEngine.SkipCollision = true; } } } public override void Pickup(PlayerController player) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown ((PassiveItem)this).Pickup(player); _dodgeRoller = ((Component)this).gameObject.GetComponent(); SpeculativeRigidbody specRigidbody = ((BraveBehaviour)player).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreCollision)); } public override void DisableEffect(PlayerController player) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { SpeculativeRigidbody specRigidbody = ((BraveBehaviour)player).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Remove((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreCollision)); if (Object.op_Implicit((Object)(object)_dodgeRoller)) { ((CustomDodgeRoll)_dodgeRoller).AbortDodgeRoll(); } } } public override CustomDodgeRoll CustomDodgeRoll() { if (!Object.op_Implicit((Object)(object)_dodgeRoller)) { _dodgeRoller = ((Component)this).gameObject.GetComponent(); } return (CustomDodgeRoll)(object)_dodgeRoller; } } public class HLDRoll : CustomDodgeRoll { [CompilerGenerated] private sealed class d__15 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public HLDRoll <>4__this; private Vector2 5__2; private DustUpVFX 5__3; private bool 5__4; private float 5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__15(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_003f: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; HLDRoll hLDRoll = <>4__this; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; if (((GameActor)((CustomDodgeRoll)hLDRoll)._owner).IsFalling) { 5__4 = true; goto IL_01a9; } 5__5 += BraveTime.DeltaTime; } else { <>1__state = -1; float num2 = 55f * (hLDRoll.isHyped ? 1.2f : 1f); 5__2 = num2 * hLDRoll._dashDir; ((Component)((CustomDodgeRoll)hLDRoll)._owner).gameObject.Play("teledasher"); 5__3 = GameManager.Instance.Dungeon.dungeonDustups; for (int i = 0; i < 16; i++) { float num3 = Random.Range(0f, 360f); float num4 = Random.Range(0f, 360f); float num5 = Random.Range(0.3f, 1.25f); SpawnManager.SpawnVFX(5__3.rollLandDustup, Vector2.op_Implicit(((GameActor)((CustomDodgeRoll)hLDRoll)._owner).CenterPosition + BraveMathCollege.DegreesToVector(num3, num5)), Quaternion.Euler(0f, 0f, num4)); } 5__4 = false; 5__5 = 0f; } if (5__5 < 0.125f) { ((CustomDodgeRoll)hLDRoll)._owner.PlayerAfterImage(); ((BraveBehaviour)((CustomDodgeRoll)hLDRoll)._owner).specRigidbody.Velocity = 5__2; GameManager.Instance.Dungeon.dungeonDustups.InstantiateLandDustup(Vector2.op_Implicit(((GameActor)((CustomDodgeRoll)hLDRoll)._owner).CenterPosition)); <>2__current = null; <>1__state = 1; return true; } goto IL_01a9; IL_01a9: if (!5__4) { ((CustomDodgeRoll)hLDRoll)._owner.PlayerAfterImage(); for (int j = 0; j < 8; j++) { float num6 = Random.Range(0f, 360f); float num7 = Random.Range(0f, 360f); float num8 = Random.Range(0.3f, 1f); SpawnManager.SpawnVFX(5__3.rollLandDustup, Vector2.op_Implicit(((GameActor)((CustomDodgeRoll)hLDRoll)._owner).CenterPosition + BraveMathCollege.DegreesToVector(num6, num8)), Quaternion.Euler(0f, 0f, num7)); } } ((BraveBehaviour)((CustomDodgeRoll)hLDRoll)._owner).spriteAnimator.Stop(); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const float DASH_SPEED = 55f; private const float DASH_TIME = 0.125f; private const float DISOWN_TIME = 0.175f; private const float FADE_TIME = 0.5f; public bool isHyped; private Vector2 _dashDir; public override float bufferWindow => 0.5f; public override bool canUseWeapon => true; public override bool dodgesProjectiles => false; public override bool takesContactDamage => false; protected override void BeginDodgeRoll(Vector2 direction, bool buffered, bool wasAlreadyDodging) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_005e: Unknown result type (might be due to invalid IL or missing references) _dashDir = ((direction != Vector2.zero) ? direction : ((Vector2)(ref ((CustomDodgeRoll)this)._owner.m_lastNonzeroCommandedDirection)).normalized); if (isHyped) { Projectile component = SpawnManager.SpawnProjectile(((Component)DriftersHeadgear._LightningProjectile).gameObject, Vector2.op_Implicit(((GameActor)((CustomDodgeRoll)this)._owner).CenterPosition), Quaternion.Euler(0f, 0f, ((CustomDodgeRoll)this)._owner.m_currentGunAngle), true).GetComponent(); component.Owner = (GameActor)(object)((CustomDodgeRoll)this)._owner; component.Shooter = ((BraveBehaviour)((CustomDodgeRoll)this)._owner).specRigidbody; ((Component)component).gameObject.AddComponent(); ((Component)component).gameObject.AddComponent().expirationTimer = 0.675f; OwnerConnectLightningModifier ownerConnectLightningModifier = ((Component)component).gameObject.AddComponent(); ownerConnectLightningModifier.linkPrefab = DriftersHeadgear._LinkVFXPrefab; ownerConnectLightningModifier.disownTimer = 0.175f; ownerConnectLightningModifier.fadeTimer = 0.5f; ownerConnectLightningModifier.MakeGlowy(); } } protected override IEnumerator ContinueDodgeRoll() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__15(0) { <>4__this = this }; } } public class PlotArmor : CwaffPassive { [CompilerGenerated] private sealed class d__9 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public RoomHandler room; public PlotArmor <>4__this; public int armorToGain; private int 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; PlotArmor plotArmor = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; 5__2 = 0; break; case 1: { <>1__state = -1; bool flag = default(bool); IntVector2 centeredVisibleClearSpot = room.GetCenteredVisibleClearSpot(2, 2, ref flag, false); Vector2 val = ((IntVector2)(ref centeredVisibleClearSpot)).ToVector2(); if (!flag) { val = ((GameActor)((PassiveItem)plotArmor).Owner).CenterPosition; } LootEngine.SpawnItem(((Component)ItemHelper.Get(Items.Armor)).gameObject, Vector2.op_Implicit(val), Vector2.zero, 0f, true, true, false); int num2 = 5__2 + 1; 5__2 = num2; break; } } if (5__2 < armorToGain) { <>2__current = (object)new WaitForSeconds(0.33f); <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static string ItemName = "Plot Armor"; public static string ShortDescription = "Can't Die Yet"; public static string LongDescription = "Upon first entering a boss room foyer, spawns enough armor pickups to bring the player to 3 total armor (4 for zero-health characters). Always grants at least 1 armor."; public static string Lore = "The single most effective piece of armor ever created, under the right circumstances. The amount of protection it actually offers seems to vary from person to person over time, and the Gungeon's best blacksmiths are still trying to figure out how to fully harness the properties of \"plot\" to their advantage."; internal const int _MIN_PLAYER_ARMOR = 3; internal const int _MIN_ARMOR_TO_GIVE = 1; private RoomHandler _lastVisitedRoom; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)4; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)3, 1f); ((PickupObject)(object)obj).AddToShop(ModdedShopType.Ironside); } public override void Update() { ((PassiveItem)this).Update(); if (!Object.op_Implicit((Object)(object)((PassiveItem)this).Owner) || !Object.op_Implicit((Object)(object)((BraveBehaviour)((PassiveItem)this).Owner).healthHaver)) { return; } RoomHandler currentRoom = ((PassiveItem)this).Owner.CurrentRoom; if (currentRoom == _lastVisitedRoom) { return; } _lastVisitedRoom = currentRoom; if (currentRoom == null || currentRoom.hasEverBeenVisited || currentRoom != ChestTeleporterItem.FindBossFoyer()) { return; } int num = 3 + (((PassiveItem)this).Owner.ForceZeroHealthState ? 1 : 0); int num2 = (int)((BraveBehaviour)((PassiveItem)this).Owner).healthHaver.Armor; int armorToGain = Mathf.Max(1, num - num2); ((MonoBehaviour)((PassiveItem)this).Owner).StartCoroutine(SpawnSomeArmor(currentRoom, armorToGain)); if (((PassiveItem)this).Owner.HasSynergy(Synergy.DEUS_EX_MACHINA)) { ChekhovsGun gun = ((PassiveItem)this).Owner.GetGun(); if (gun != null) { Gun gun2 = ((GunBehaviour)gun).gun; gun2.GainAmmo(gun2.AdjustedMaxAmmo - gun2.CurrentAmmo); ((Component)((PassiveItem)this).Owner).gameObject.Play("chekhovs_gun_launch_sound_alt"); } } } private IEnumerator SpawnSomeArmor(RoomHandler room, int armorToGain) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__9(0) { <>4__this = this, room = room, armorToGain = armorToGain }; } } public class EchoChamber : CwaffPassive { public static string ItemName = "Echo Chamber"; public static string ShortDescription = "Primed and Corrupted"; public static string LongDescription = "Causes all fired projectiles to leave echoes that shoot weakened imitations of themselves for a few seconds."; public static string Lore = "Much like their owners, guns have memories, albeit limited and imperfect ones. The Hollowpoint that possesses this chamber is able to tap into these memories to manifest spectres of recently-fired projectiles. While the quality of these spectral projectiles may not be up to par with the originals in every conceivable way, one ought to count their blessings that the Hollowpoint is inadvertently helping at all."; internal static Projectile _FlakProjectile; internal static tk2dSprite _DefaultSprite; internal static GameObject _EchoPrefab; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)2; ((PickupObject)(object)obj).AddToShop(ModdedShopType.Doug); PickupObject obj2 = ItemHelper.Get(Items.FlakBullets); _FlakProjectile = ((ComplexProjectileModifier)((obj2 is ComplexProjectileModifier) ? obj2 : null)).CollisionSpawnProjectile; _DefaultSprite = ((Component)Items.Ak47.Projectile()).gameObject.GetComponentInChildren(); _EchoPrefab = VFX.Create("echo_effect", 16f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } public override void Pickup(PlayerController player) { base.Pickup(player); player.PostProcessProjectile += PostProcessProjectile; } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { player.PostProcessProjectile -= PostProcessProjectile; } } private void PostProcessProjectile(Projectile proj, float effectChanceScalar) { ((Component)proj).gameObject.AddComponent(); } } public class EchoProjectileSpawner : MonoBehaviour { [CompilerGenerated] private sealed class <g__DelayedTrigger_CR|17_0>d : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public EchoProjectileSpawner <>4__this; private float 5__2; private float 5__3; private float 5__4; private float 5__5; private int 5__6; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <g__DelayedTrigger_CR|17_0>d(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0027: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown int num = <>1__state; EchoProjectileSpawner echoProjectileSpawner = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; SpawnManager.SpawnVFX(EchoChamber._EchoPrefab, Vector2.op_Implicit(echoProjectileSpawner._echoPosition), Quaternion.identity).ExpireIn(2f, 2f, 0.25f, shrink: true); 5__2 = 0.5f; 5__3 = 1f; 5__4 = 1f; 5__5 = 0.25f; 5__6 = 0; break; case 1: { <>1__state = -1; 5__5 *= 2f; 5__2 *= 0.5f; 5__4 -= 0.1f; echoProjectileSpawner.SpawnProjectile(5__2, 5__3, 5__4); int num2 = 5__6 + 1; 5__6 = num2; break; } } if (5__6 < 3) { <>2__current = (object)new WaitForSeconds(5__5); <>1__state = 1; return true; } Object.Destroy((Object)(object)echoProjectileSpawner); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const float _DAMAGE_SCALE = 0.5f; private const int _NUM_ECHOS = 3; private const float _INITIAL_DELAY = 0.25f; private const float _DELAY_SCALE = 2f; private Projectile _projectile; private PlayerController _owner; private SpeculativeRigidbody _shooter; private Vector2 _echoPosition; private float _echoAngle; private Quaternion _echoRotation; private int _echoSpriteId; private tk2dSpriteCollectionData _echoSpriteCollection; private Vector2 _echoVelocity; private float _echoDamage; private float _echoRange; private bool _echoRotates; public EchoProjectileSpawner Setup(Projectile p, PlayerController pc) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) _projectile = p; _owner = pc; _shooter = ((BraveBehaviour)_owner).specRigidbody; _echoAngle = _owner.m_currentGunAngle; _echoRotates = _projectile.shouldRotate; _echoPosition = Vector2.op_Implicit(((BraveBehaviour)_projectile).transform.position); _echoRotation = ((BraveBehaviour)_projectile).transform.rotation; if (Object.op_Implicit((Object)(object)((BraveBehaviour)_projectile).sprite)) { _echoSpriteCollection = ((BraveBehaviour)_projectile).sprite.collection; _echoSpriteId = ((BraveBehaviour)_projectile).sprite.spriteId; } else { _echoSpriteCollection = ((tk2dBaseSprite)EchoChamber._DefaultSprite).collection; _echoSpriteId = ((tk2dBaseSprite)EchoChamber._DefaultSprite).spriteId; } _echoVelocity = _projectile.baseData.speed * _echoAngle.ToVector(); _echoDamage = _projectile.baseData.damage; _echoRange = _projectile.baseData.range; return this; } public void DelayedTrigger() { ((MonoBehaviour)this).StartCoroutine(DelayedTrigger_CR()); IEnumerator DelayedTrigger_CR() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <g__DelayedTrigger_CR|17_0>d(0) { <>4__this = this }; } } public void Trigger() { SpawnProjectile(); } private void SpawnProjectile(float damageScale = 1f, float speedScale = 1f, float spriteScale = 1f) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) Projectile component = SpawnManager.SpawnProjectile(((Component)EchoChamber._FlakProjectile).gameObject, Vector2.op_Implicit(_echoPosition), _echoAngle.EulerZ(), true).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.SetSpeed(speedScale * ((Vector2)(ref _echoVelocity)).magnitude); component.baseData.damage = damageScale * _echoDamage; component.baseData.range = _echoRange; component.baseData.force = 0.01f; component.collidesWithPlayer = false; component.collidesWithEnemies = true; component.Owner = (GameActor)(object)_owner; component.Shooter = _shooter; component.shouldRotate = _echoRotates; ((BraveBehaviour)component).sprite.SetSprite(_echoSpriteCollection, _echoSpriteId); ((BraveBehaviour)((BraveBehaviour)component).sprite).transform.localScale = new Vector3(spriteScale, spriteScale, 1f); ((Component)((BraveBehaviour)component).sprite).gameObject.SetAlpha(damageScale); component.SendInDirection(_echoVelocity, true, true); ((Component)component).gameObject.ExpireIn(0.5f, 0.5f, Mathf.Sqrt(damageScale)); ((Component)((BraveBehaviour)component).sprite).gameObject.ExpireIn(0.5f, 0.5f, Mathf.Sqrt(damageScale)); } } } public class EchoingProjectile : MonoBehaviour { private Projectile _projectile; private PlayerController _owner; private EchoProjectileSpawner _spawner; private void Start() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown _projectile = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); if (Object.op_Implicit((Object)(object)_projectile) && Object.op_Implicit((Object)(object)_owner)) { GameObject val = Object.Instantiate(new GameObject(), Vector2.op_Implicit(_projectile.SafeCenter), Object.op_Implicit((Object)(object)((BraveBehaviour)_projectile).sprite) ? ((BraveBehaviour)((BraveBehaviour)_projectile).sprite).transform.rotation : Quaternion.identity); _spawner = val.AddComponent(); _spawner.Setup(_projectile, _owner).DelayedTrigger(); } } } public class AstralProjector : CwaffPassive { [HarmonyPatch(typeof(PlayerController), "HandlePlayerInput")] private class HandlePlayerPhasingInputPatch { [HarmonyILManipulator] private static void HandlePlayerPhasingInputIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdcR4(instr, 0.01f) })) { val.Emit(OpCodes.Ldarg_0); val.CallPrivate(typeof(AstralProjector), "PreventRigidbodyCastDuringHandlePlayerInput"); } val.Index = 0; while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdcR4(instr, -0.01f) })) { val.Emit(OpCodes.Ldarg_0); val.CallPrivate(typeof(AstralProjector), "PreventRigidbodyCastDuringHandlePlayerInput"); } } } public static string ItemName = "Astral Projector"; public static string ShortDescription = "Enter the Gungeon's Walls"; public static string LongDescription = "Allows phasing through the inner walls of most rooms. Can not shoot, reload, teleport, or use items while phased."; public static string Lore = "Created after Bello accidentally dropped a run-of-the-mill projector into one of the cosmic rifts scattered throughout the Gungeon, the {ItemName} is now completely useless for its original purpose of displaying HD videos in decidedly non-HD quality on the walls of Bello's shop. Bello is still searching for a good projector and prefers not to talk about the whole incident."; private const float _UNPHASE_TIMER = 0.5f; private bool _phased; private bool _intangible; private bool _insideWalls; private float _intangibleTimer; private Shader _originalShader; private RoomHandler _phasedRoom; private static Vector2 _LastSanePosition = Vector2.zero; private static RoomCategory[] _BannedRoomTypes = (RoomCategory[])(object)new RoomCategory[4] { (RoomCategory)3, default(RoomCategory), (RoomCategory)7, (RoomCategory)8 }; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)4; ((PickupObject)(object)obj).AddToShop(ModdedShopType.TimeTrader); } public override void Pickup(PlayerController player) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown base.Pickup(player); _LastSanePosition = ((BraveBehaviour)player).specRigidbody.PrimaryPixelCollider.UnitBottomCenter; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)player).specRigidbody; specRigidbody.OnPreTileCollision = (OnPreTileCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreTileCollision, (Delegate?)new OnPreTileCollisionDelegate(OnPreTileCollision)); } public override void DisableEffect(PlayerController player) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { SpeculativeRigidbody specRigidbody = ((BraveBehaviour)player).specRigidbody; specRigidbody.OnPreTileCollision = (OnPreTileCollisionDelegate)Delegate.Remove((Delegate?)(object)specRigidbody.OnPreTileCollision, (Delegate?)new OnPreTileCollisionDelegate(OnPreTileCollision)); } } private static bool IsBossFoyer(RoomHandler room) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 for (int i = 0; i < room.connectedRooms.Count; i++) { if ((int)room.connectedRooms[i].area.PrototypeRoomCategory == 3) { return true; } } return false; } private bool CanStartPhase() { //IL_0015: 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) if (!Object.op_Implicit((Object)(object)((PassiveItem)this).Owner)) { return false; } if ((int)((PassiveItem)this).Owner.CurrentInputState != 0 && !_intangible) { return false; } RoomHandler currentRoom = ((PassiveItem)this).Owner.CurrentRoom; if (_BannedRoomTypes.Contains(currentRoom.area.PrototypeRoomCategory) || IsBossFoyer(currentRoom)) { return false; } if (currentRoom.area.IsProceduralRoom || (currentRoom.area.proceduralCells != null && currentRoom.area.proceduralCells.Count > 0)) { return false; } return true; } public override void Update() { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) ((PassiveItem)this).Update(); if (!Object.op_Implicit((Object)(object)((PassiveItem)this).Owner) || BraveTime.DeltaTime == 0f) { return; } ((PickupObject)this).CanBeDropped = !_intangible && !_phased; if (_intangibleTimer > 0f) { _intangibleTimer -= BraveTime.DeltaTime; if (_intangibleTimer <= 0f) { BecomeTangible(); } } if (!_phased || ((PassiveItem)this).Owner.ForceConstrainToRoom(_phasedRoom)) { return; } Vector2 lastSanePosition = TransformExtensions.PositionVector2(((BraveBehaviour)((PassiveItem)this).Owner).transform); Vector2 unitBottomCenter = ((BraveBehaviour)((PassiveItem)this).Owner).specRigidbody.PrimaryPixelCollider.UnitBottomCenter; if (!GameManager.Instance.Dungeon.data.CheckInBoundsAndValid(Vector2Extensions.ToIntVector2(unitBottomCenter, (VectorConversions)0))) { _intangibleTimer = 0.5f; lastSanePosition = _LastSanePosition; return; } _LastSanePosition = lastSanePosition; if (_insideWalls) { _insideWalls = false; } else { _phased = false; } } private void OnPreTileCollision(SpeculativeRigidbody me, PixelCollider myPixelCollider, Tile other, PixelCollider otherPixelCollider) { RoomHandler room = (_phased ? _phasedRoom : ((PassiveItem)this).Owner.CurrentRoom); if (_phased) { ((PassiveItem)this).Owner.ForceConstrainToRoom(room); } else if (!CanStartPhase() || !((PassiveItem)this).Owner.FullyWithinRoom(room)) { return; } if (!_phased) { _phasedRoom = ((PassiveItem)this).Owner.CurrentRoom; } _insideWalls = true; _intangibleTimer = 0.5f; PhysicsEngine.SkipCollision = true; _phased = true; if (!_intangible) { BecomeIntangible(); } } private void BecomeIntangible() { _intangible = true; GameManager.Instance.PreventPausing = true; ((PassiveItem)this).Owner.CurrentInputState = (PlayerInputState)3; tk2dBaseSprite sprite = ((BraveBehaviour)((PassiveItem)this).Owner).sprite; sprite.usesOverrideMaterial = true; _originalShader = ((BraveBehaviour)sprite).renderer.material.shader; ((BraveBehaviour)sprite).renderer.material.shader = ShaderCache.Acquire("Brave/Internal/HologramShader"); ((Component)((PassiveItem)this).Owner).gameObject.PlayUnique("phase_through_wall_sound"); } private void BecomeTangible() { _intangible = false; GameManager.Instance.PreventPausing = false; ((PassiveItem)this).Owner.CurrentInputState = (PlayerInputState)0; tk2dBaseSprite sprite = ((BraveBehaviour)((PassiveItem)this).Owner).sprite; sprite.usesOverrideMaterial = true; ((BraveBehaviour)sprite).renderer.material.shader = _originalShader; ((Component)((PassiveItem)this).Owner).gameObject.PlayUnique("phase_through_wall_sound"); } private static float PreventRigidbodyCastDuringHandlePlayerInput(float inValue, PlayerController pc) { if (pc.HasPassive()) { if (!(inValue > 0f)) { return -999f; } return 999f; } return inValue; } } public class TryhardSnacks : CwaffPassive { private class TryhardDamage : DamageAdjuster { private const float _TRYHARD_MULT = 10f; private const float _SPAWN_CAMP_TIME = 1f; protected override float AdjustDamage(float currentDamage, Projectile proj, AIActor enemy) { if (!enemy.IsInReinforcementLayer) { return currentDamage; } if (!_EngageTimes.TryGetValue(enemy, out var value)) { return currentDamage; } float num = 1f; if (Synergy.GAMER_REFLEXES.Active()) { num *= 2f; } if (BraveTime.ScaledTimeSinceStartup - value > num) { return currentDamage; } return 10f * currentDamage; } } [HarmonyPatch(typeof(AIActor), "OnEngaged")] private class TrackEngageTimePatch { private static void Prefix(AIActor __instance, bool isReinforcement) { if (isReinforcement && !__instance.HasBeenEngaged) { _EngageTimes[__instance] = BraveTime.ScaledTimeSinceStartup; } } } public static string ItemName = "Tryhard Snacks"; public static string ShortDescription = "Spawn Camping"; public static string LongDescription = "Projectiles deal 10x damage to enemies that spawned in less than a second ago."; public static string Lore = "A bag of triangular snacks shaped in the image of Mt. Dew, a holy place where tryhards have made pilgrimages to hone their tryharding skills for generations. Those who make the pilgrimage learn to embody the core values of alertness, preparedness, ruthlessness, smack-talking, and teabagging. Each bite-sized morsel is crafted to refinforce these values, as well as one's stomach lining."; internal static Dictionary _EngageTimes = new Dictionary(); public static void Init() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) ((PickupObject)Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore)).quality = (ItemQuality)3; CwaffEvents.OnNewFloorFullyLoaded = (Action)Delegate.Combine(CwaffEvents.OnNewFloorFullyLoaded, new Action(ResetEngageDictionary)); } private static void ResetEngageDictionary() { _EngageTimes.Clear(); } public override void Pickup(PlayerController player) { base.Pickup(player); player.PostProcessProjectile += PostProcessProjectile; } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { player.PostProcessProjectile -= PostProcessProjectile; } } private static void PostProcessProjectile(Projectile proj, float effectChanceScalar) { if (!Object.op_Implicit((Object)(object)((Component)proj).gameObject.GetComponent())) { ((Component)proj).gameObject.AddComponent(); } } } public class Lichguard : CwaffPassive { [HarmonyPatch] private static class PreventHarmfulStatModificationsPatches { private enum StatValues { IGNORE, HIGHER_IS_BETTER, LOWER_IS_BETTER } private static bool _CurrentStatsPlayerHasLichguard = false; private static readonly StatValues[] _StatValues = new StatValues[31] { StatValues.HIGHER_IS_BETTER, StatValues.HIGHER_IS_BETTER, StatValues.LOWER_IS_BETTER, StatValues.IGNORE, StatValues.HIGHER_IS_BETTER, StatValues.HIGHER_IS_BETTER, StatValues.HIGHER_IS_BETTER, StatValues.IGNORE, StatValues.HIGHER_IS_BETTER, StatValues.HIGHER_IS_BETTER, StatValues.LOWER_IS_BETTER, StatValues.HIGHER_IS_BETTER, StatValues.HIGHER_IS_BETTER, StatValues.LOWER_IS_BETTER, StatValues.IGNORE, StatValues.IGNORE, StatValues.HIGHER_IS_BETTER, StatValues.HIGHER_IS_BETTER, StatValues.HIGHER_IS_BETTER, StatValues.HIGHER_IS_BETTER, StatValues.HIGHER_IS_BETTER, StatValues.HIGHER_IS_BETTER, StatValues.HIGHER_IS_BETTER, StatValues.LOWER_IS_BETTER, StatValues.HIGHER_IS_BETTER, StatValues.HIGHER_IS_BETTER, StatValues.HIGHER_IS_BETTER, StatValues.HIGHER_IS_BETTER, StatValues.HIGHER_IS_BETTER, StatValues.HIGHER_IS_BETTER, StatValues.HIGHER_IS_BETTER }; private static float PreventHarmfulStatModifications(float oldMod, StatModifier stat) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected I4, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (!_CurrentStatsPlayerHasLichguard) { return oldMod; } int num = (int)stat.statToBoost; if (num >= _StatValues.Length || _StatValues[num] == StatValues.IGNORE) { return oldMod; } bool flag = _StatValues[num] == StatValues.HIGHER_IS_BETTER; if ((int)stat.modifyType == 1) { if (flag) { return Mathf.Max(oldMod, 1f); } return Mathf.Min(oldMod, 1f); } if ((int)stat.modifyType == 0) { if (flag) { return Mathf.Max(oldMod, 0f); } return Mathf.Min(oldMod, 0f); } return oldMod; } [HarmonyPatch(typeof(PlayerStats), "ApplyStatModifier")] [HarmonyILManipulator] private static void PlayerStatsApplyStatModifierPatchIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_000a: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdfld(instr, "amount") })) { val.Emit(OpCodes.Ldarg_1); val.CallPrivate(typeof(PreventHarmfulStatModificationsPatches), "PreventHarmfulStatModifications"); } } [HarmonyPatch(typeof(PlayerStats), "RecalculateStatsInternal")] [HarmonyPrefix] private static void PlayerStatsRecalculateStatsInternalPrefix(PlayerStats __instance, PlayerController owner) { _CurrentStatsPlayerHasLichguard = owner.HasPassive(); } [HarmonyPatch(typeof(PlayerStats), "RecalculateStatsInternal")] [HarmonyILManipulator] private static void PlayerStatsRecalculateStatsInternalIL(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int statLocal = 0; while (val.TryGotoNext((MoveType)2, new Func[2] { (Instruction instr) => ILPatternMatchingExt.MatchLdloc(instr, ref statLocal), (Instruction instr) => ILPatternMatchingExt.MatchLdfld(instr, "amount") })) { val.Emit(OpCodes.Ldloc, statLocal); val.CallPrivate(typeof(PreventHarmfulStatModificationsPatches), "PreventHarmfulStatModifications"); } } } public static string ItemName = "Lichguard"; public static string ShortDescription = "Arena Ready"; public static string LongDescription = "Prevents most item-induced stat decreases. Empowers Sunderbuss and Macheening, and removes their negative side effects."; public static string Lore = "An ancient artifact created by the first great gunsmith, Lord Kagreflak. Unlike most armor that protects the user from physical damage, this gauntlet was crafted to protect the user from the more ineffable magics and ailments that predominate the battlefield -- and as luck would have it, the Gungeon."; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)3; obj.IncreaseLootChance(typeof(Sunderbuss), 20f); obj.IncreaseLootChance(typeof(Macheening), 20f); } } public class RatPoison : CwaffPassive { [HarmonyPatch(typeof(PickupObject), "ShouldBeTakenByRat")] private class RatPoisonPatch { private static bool Prefix(Vector2 point, ref bool __result) { if (!Lazy.AnyoneHas()) { return true; } __result = false; return false; } } public static string ItemName = "Rat Poison"; public static string ShortDescription = "Swiper no Swiping"; public static string LongDescription = "Completely prevents the Resourceful Rat from stealing items."; public static string Lore = "The Hegemony has invested hundreds of thousands of credits into researching both diplomatic and military means of discouraging the Resourceful Rat's thievery. It turns out that splashing some pickle juice on your items is enough to keep the rodent at bay indefinitely, though the lingering odor is far from pleasant."; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)2; ((PickupObject)obj).IgnoredByRat = true; ((PickupObject)obj).ClearIgnoredByRatFlagOnPickup = false; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)2, 1f); } } public class MMReloading : CwaffPassive { [HarmonyPatch(/*Could not decode attribute arguments.*/)] private class SteadyHandsPatch { [HarmonyILManipulator] private static void SteadyHandsIL(ILContext il, MethodBase original) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_003a: 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_0077: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchCall(instr, "BraveTime", "get_DeltaTime") })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldfld, original.DeclaringType.GetEnumeratorField("$this")); val.CallPrivate(typeof(MMReloading), "ModifyReloadSpeedIfIdle"); val.Emit(OpCodes.Mul); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] private class SteadyHandsUIPatch { [HarmonyILManipulator] private static void SteadyHandsUIIL(ILContext il, MethodBase original) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_003a: 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_0077: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchCall(instr, "BraveTime", "get_DeltaTime") })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldfld, original.DeclaringType.GetEnumeratorField("$this")); val.CallPrivate(typeof(MMReloading), "ModifyVisualReloadSpeedIfIdle"); val.Emit(OpCodes.Mul); } } } public static string ItemName = "MM: Reloading"; public static string ShortDescription = "Chapter 1"; public static string LongDescription = "Guns reload 33% faster while standing still."; public static string Lore = "Gungeoneers aren't particularly good at multitasking -- as evidenced by the number of ridiculous ways they tend to get hit while exploring -- and countless hours spent reloading while running around has ingrained rather subpar reloading techniques deeply into their muscle memory. A quick refresher from the Reloading chapter of Manuel's Manual is more than enough for most Gungeoneers to instill some semblance of discipline into their reloading practices."; private const float _RELOAD_FACTOR = 1.33f; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)2; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)3, 1f); } private static float ModifyReloadSpeedIfIdle(Gun gun) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) GameActor currentOwner = gun.CurrentOwner; PlayerController val = (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null); if (val == null) { return 1f; } if (val.m_playerCommandedDirection != Vector2.zero) { return 1f; } if (!val.HasPassive()) { return 1f; } return 1.33f; } private static float ModifyVisualReloadSpeedIfIdle(GameUIReloadBarController c) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) PlayerController attachPlayer = c.m_attachPlayer; if (attachPlayer == null) { return 1f; } if (attachPlayer.m_playerCommandedDirection != Vector2.zero) { return 1f; } if (!attachPlayer.HasPassive()) { return 1f; } return 1.33f; } } public class CombatLeotard : CwaffPassive { public static string ItemName = "Combat Leotard"; public static string ShortDescription = "Move Like They Do"; public static string LongDescription = "Allows the user to fire most weapons while dodge rolling."; public static string Lore = "Touted as the world's only leotard built to both olympic and military specifications. On top of affording surprising flexibility and mobility, the suit also grants its wearer the confidence they can do just about anything when contorted at just about any angle. Whether this feeling comes from the suit's sleek design or the hundreds of electrodes lining the suit's interior is left to individual discretion."; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)3; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)3, 1f); } public override void Pickup(PlayerController player) { base.Pickup(player); PassiveItem.IncrementFlag(player, typeof(CombatLeotard)); } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { PassiveItem.DecrementFlag(player, typeof(CombatLeotard)); } } } public class NewtonsApple : CwaffPassive { public static string ItemName = "Newton's Apple"; public static string ShortDescription = "Doesn't Fall Far from the Tree"; public static string LongDescription = "Enemies home in on nearby player projectiles."; public static string Lore = "Before an apple helped Isaac Newton invent gravity, everyone was stuck floating around everywhere all the time. After gravity eliminated this burden from all but a select few, scientists got to work synthesizing even stronger gravity apples to alleviate the burden of independent motion from the rest of the population."; private static readonly Color _AttractColor = new Color(27f / 85f, 0.69803923f, 0.9490196f); private List _gravityProjectiles = new List(); private Dictionary _knockbackDict = new Dictionary(); public static void Init() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) ((PickupObject)Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore)).quality = (ItemQuality)1; } public override void Pickup(PlayerController player) { base.Pickup(player); player.PostProcessProjectile += PostProcessProjectile; player.OnRoomClearEvent += OnRoomClearEvent; } private void OnRoomClearEvent(PlayerController controller) { _knockbackDict.CleanupKnockbackData(); } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (!Object.op_Implicit((Object)(object)player)) { return; } player.PostProcessProjectile -= PostProcessProjectile; player.OnRoomClearEvent -= OnRoomClearEvent; foreach (Projectile gravityProjectile in _gravityProjectiles) { if (Object.op_Implicit((Object)(object)gravityProjectile)) { gravityProjectile.OnDestruction -= OnProjectileDestruction; } } _gravityProjectiles.Clear(); _knockbackDict.Clear(); } private void PostProcessProjectile(Projectile projectile, float arg2) { _gravityProjectiles.Add(projectile); projectile.OnDestruction += OnProjectileDestruction; } private void OnProjectileDestruction(Projectile projectile) { if (Object.op_Implicit((Object)(object)this)) { projectile.OnDestruction -= OnProjectileDestruction; _gravityProjectiles.TryRemove(projectile); } } public override void Update() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: 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) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) ((PassiveItem)this).Update(); if (!Object.op_Implicit((Object)(object)((PassiveItem)this).Owner)) { return; } float deltaTime = BraveTime.DeltaTime; foreach (AIActor allNearbyEnemy in Lazy.GetAllNearbyEnemies(((GameActor)((PassiveItem)this).Owner).CenterPosition, 100f, ignoreWalls: true)) { if (!Object.op_Implicit((Object)(object)allNearbyEnemy) || ((GameActor)allNearbyEnemy).IsGone) { continue; } KnockbackDoer knockbackDoer = ((BraveBehaviour)allNearbyEnemy).knockbackDoer; if (knockbackDoer == null || knockbackDoer.m_isImmobile.Value) { continue; } Vector2 centerPosition = ((GameActor)allNearbyEnemy).CenterPosition; Projectile val = null; float num = 36f; Vector2 val2; foreach (Projectile gravityProjectile in _gravityProjectiles) { if (Object.op_Implicit((Object)(object)gravityProjectile)) { val2 = gravityProjectile.SafeCenter - centerPosition; float sqrMagnitude = ((Vector2)(ref val2)).sqrMagnitude; if (!(sqrMagnitude > num)) { num = sqrMagnitude; val = gravityProjectile; } } } if (Object.op_Implicit((Object)(object)val)) { if (Random.value < deltaTime * 3f) { GameObject attractParticle = FluxFist._AttractParticle; Vector2 basePosition = 0.5f * (centerPosition + val.SafeCenter); Color? emissiveColor = _AttractColor; float? height = 8f; CwaffVFX.SpawnBurst(attractParticle, 2, basePosition, 0.5f, null, 0f, 1f, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.Random, 0.5f, null, 100f, emissiveColor, fadeIn: false, uniform: false, null, null, height); } float num2 = 1f - Mathf.Clamp01((num - 4f) / 32f); float num3 = 20f * num2; val2 = val.SafeCenter - centerPosition; Vector2 velocity = num3 * ((Vector2)(ref val2)).normalized; allNearbyEnemy.ApplyContinuousSourcedKnockback(((Component)this).gameObject, _knockbackDict, velocity); } } } } public class BlankChecks : CwaffPassive { [HarmonyPatch(typeof(PlayerController), "DoConsumableBlank")] private class BlankCheckPatch { private static void Prefix(PlayerController __instance) { if (__instance.HasPassive() && __instance.Blanks <= 0 && PlayerStats.GetTotalCurse() < 10) { __instance.Blanks += 3; __instance.IncreaseCurse(); } } } public static string ItemName = "Blank Checks"; public static string ShortDescription = "Write-off"; public static string LongDescription = "Pressing the blank button when out of blanks increases curse by 1 and grants 3 additional blanks, one of which is immediately used. Will not work at 10 curse or higher. Grants 1 blank when first picked up."; public static string Lore = "Rumor has it that blank checks were originally conceived of outside the domain of weaponry entirely, and were developed primarily for use in large-scale business transactions. As firearms are only very rarely involved in such transactions, why so many business people have any use for extra blanks remains a mystery to this day."; private const float _BLANK_EXPRESSION_DISCOUNT = 0.1f; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)3; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)2, 1f); ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)4, 1f); } public override void OnFirstPickup(PlayerController player) { base.OnFirstPickup(player); PlayerController primaryPlayer = GameManager.Instance.PrimaryPlayer; primaryPlayer.Blanks += 1; } public override void Pickup(PlayerController player) { base.Pickup(player); player.OnUsedBlank += OnUsedBlank; } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { player.OnUsedBlank -= OnUsedBlank; } } private void OnUsedBlank(PlayerController player, int remainingBlanks) { if (!player.HasSynergy(Synergy.BLANK_EXPRESSION)) { return; } foreach (BaseShopController allShop in StaticReferenceManager.AllShops) { if (((DungeonPlaceableBehaviour)allShop).GetAbsoluteParentRoom() == player.CurrentRoom) { allShop.ShopCostModifier = Mathf.Max(allShop.ShopCostModifier - 0.1f, 0f); } } } } public class ArmorPiercingRounds : CwaffPassive { public static string ItemName = "Armor Piercing Rounds"; public static string ShortDescription = "Bored to Death"; public static string LongDescription = "Projectiles ignore the invulnerable phases of most enemies. Does not break boss DPS caps."; public static string Lore = "A handful of the Gungeon's denizens have been gifted with various means of protecting themselves from the thousands of bullets, lasers, foam darts, and T-shirts fired their way on a daily basis. Bullet researchers have known for years that most of these defenses are thwarted by a heavy yet crude application of torque to projectiles, but lobbying from Big Arma has largely suppressed this knowledge from the general public in order to sell beefier and more impressive guns."; internal static GameObject _PierceVFX = null; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)1; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)3, 1f); ((PickupObject)(object)obj).AddToShop(ModdedShopType.Doug); _PierceVFX = VFX.Create("armor_pierce_effect", 40f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } internal static bool PossiblyDisableArmor(Projectile p, SpeculativeRigidbody body) { //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)p)) { GameActor owner = p.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null) { if (!val.HasPassive()) { KaliProjectile component = ((Component)p).GetComponent(); if (component == null || !component.Mastered) { return false; } } bool flag = false; if (body.ReflectProjectiles || body.ReflectBeams) { body.ReflectProjectiles = false; body.ReflectBeams = false; flag = true; } HealthHaver component2 = ((Component)body).GetComponent(); if (component2 != null) { flag |= component2.PreventAllDamage; component2.PreventAllDamage = false; if (!component2.IsBoss && !component2.IsSubboss) { flag |= component2.minimumHealth > 0f; component2.minimumHealth = 0f; } } BehaviorSpeculator component3 = ((Component)body).GetComponent(); if (component3 != null) { foreach (AttackBehaviorBase item in component3.AttackBehaviors.EmptyIfNull()) { TransformBehavior val2 = (TransformBehavior)(object)((item is TransformBehavior) ? item : null); if (val2 != null) { flag |= val2.Invulnerable; val2.Invulnerable = false; continue; } AttackBehaviorGroup val3 = (AttackBehaviorGroup)(object)((item is AttackBehaviorGroup) ? item : null); if (val3 == null) { continue; } foreach (AttackGroupItem item2 in val3.AttackBehaviors.EmptyIfNull()) { AttackBehaviorBase behavior = item2.Behavior; TransformBehavior val4 = (TransformBehavior)(object)((behavior is TransformBehavior) ? behavior : null); if (val4 != null) { flag |= val4.Invulnerable; val4.Invulnerable = false; } } } } if (flag) { ((Component)body).gameObject.Play("armor_pierced_sound"); SpawnManager.SpawnVFX(_PierceVFX, Vector2.op_Implicit(p.SafeCenter), Quaternion.identity); } return true; } } return false; } } public class ScavengingArms : CwaffPassive { public static string ItemName = "Scavenging Arms"; public static string ShortDescription = "Loot Boxes"; public static string LongDescription = "Room decorations (crates, statues, etc.) have a chance of spawning a small ammo pickup when broken by running or rolling into them. Each pickup restores 10% of a single gun's ammo."; public static string Lore = "Scavenging is a lost art in the age of shops, guaranteed chests, and random loot drops. After all, why would anyone risk their life drawing fire away from the miscellaneous objects littering the Gungeon on the off chance that some of it may be salvageable as a couple extra rounds of ammunition?\n\nHubris. The answer is hubris."; private const float _FIND_AMMO_CHANCE = 0.05f; private const float _AMMO_PERCENT_TO_GAIN = 0.1f; internal static GameObject _SmallAmmoPickup; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)2; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)3, 1f); _SmallAmmoPickup = ((Component)ItemHelper.Get(Items.PartialAmmo)).gameObject.ClonePrefab(); AmmoPickup component = _SmallAmmoPickup.GetComponent(); component.SpreadAmmoCurrentGunPercent = 0.1f; component.SpreadAmmoOtherGunsPercent = 0f; tk2dSpriteAnimation library = ((BraveBehaviour)component).spriteAnimator.library; int num = library.clips.Length; Array.Resize(ref library.clips, num + 1); tk2dSpriteAnimationFrame val = library.clips[((BraveBehaviour)component).spriteAnimator.defaultClipId].frames[0]; tk2dSpriteAnimationClip val2 = VFX.Create("blue_ammobox_pickup", 8f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1).GetComponent().library.clips[0]; library.clips[num] = val2; ((BraveBehaviour)component).spriteAnimator.defaultClipId = num; ((BraveBehaviour)component).spriteAnimator.deferNextStartClip = false; Material material = val.spriteCollection.spriteDefinitions[val.spriteId].material; tk2dSpriteDefinition[] spriteDefinitions = val2.frames[0].spriteCollection.spriteDefinitions; tk2dSpriteAnimationFrame[] frames = val2.frames; foreach (tk2dSpriteAnimationFrame val3 in frames) { spriteDefinitions[val3.spriteId].CopyMaterialProps(material); } component.minimapIcon = null; } internal static void HandleCollisionWithMinorBreakable(SpeculativeRigidbody myRigidbody, SpeculativeRigidbody otherRigidBody) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) if (!(Random.value > 0.05f)) { PlayerController component = ((Component)otherRigidBody).GetComponent(); if (component != null && component.HasPassive() && !((GameActor)component).CurrentGun.InfiniteAmmo && !((GameActor)component).CurrentGun.LocalInfiniteAmmo && ((GameActor)component).CurrentGun.CanGainAmmo) { LootEngine.SpawnItem(_SmallAmmoPickup, Vector2.op_Implicit(myRigidbody.UnitCenter), Vector2.zero, 0f, false, false, false); AkSoundEngine.PostEvent("knife_gun_hit", ((Component)component).gameObject); } } } } public class Domino : CwaffPassive { public static string ItemName = "Domino"; public static string ShortDescription = "Free Delivery"; public static string LongDescription = "Upon clearing a floor of enemies, adds an optional pizza delivery event marker to the floor exit room. Triggering the event grants a Pizza Peel for delivering as many pizzas as possible to Bullet Kin on the way back to the floor entrance. Casings are awarded upon reaching the event marker in the floor entrance based on the amount of pizzas delivered, while an additional casing multiplier or chest reward may be granted for high delivery rates. No rewards are granted if the event marker is not reached before the timer runs out."; public static string Lore = "Pizza delivery in the Gungeon is rather awkward. Bullet Kin are known to immensely enjoy their pizza; however, Gungeon protocol prohibits them from ordering pizza while on duty. Bullet Kin have consequently been known to occasionally aid adventurers in clearing out floors for the sole purpose of clocking out to enjoy their pizza time earlier."; internal static bool _ShouldPlayMusic = true; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)2; ((PickupObject)(object)obj).BanFromCoop(); PizzaPeel.Init(); MoneyGun.Init(); PizzaGun.Init(); } public override void Pickup(PlayerController player) { base.Pickup(player); player.OnRoomClearEvent += OnRoomClear; CwaffEvents.OnChangedRooms = (Action)Delegate.Combine(CwaffEvents.OnChangedRooms, new Action(PizzaTimeController.MaybeSpawnPizzaAtExit)); CwaffEvents.OnFloorEnded = (Action)Delegate.Combine(CwaffEvents.OnFloorEnded, new Action(PizzaTimeController.OnFloorEnded)); CwaffEvents.OnCleanStart = (Action)Delegate.Remove(CwaffEvents.OnCleanStart, new Action(PizzaTimeController.OnFloorEnded)); CwaffEvents.OnCleanStart = (Action)Delegate.Combine(CwaffEvents.OnCleanStart, new Action(PizzaTimeController.OnFloorEnded)); } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { player.OnRoomClearEvent -= OnRoomClear; } CwaffEvents.OnChangedRooms = (Action)Delegate.Remove(CwaffEvents.OnChangedRooms, new Action(PizzaTimeController.MaybeSpawnPizzaAtExit)); CwaffEvents.OnFloorEnded = (Action)Delegate.Remove(CwaffEvents.OnFloorEnded, new Action(PizzaTimeController.OnFloorEnded)); } private static void OnRoomClear(PlayerController player) { PizzaTimeController.MaybeSpawnPizzaAtExit(player, null, null); } } public class PizzaPeel : CwaffGun { public static string ItemName = "Pizza Peel"; public static string ShortDescription = "Pizza Time"; public static string LongDescription = "Delivers fresh, hot pizza slices to hungry bullet kin."; public static string Lore = ""; private const int _SHOOT_FPS = 30; internal static GameObject _CashVFX = null; internal static GameObject _PizzaSliceVFX = null; internal static GameObject _PizzaBox = null; internal static readonly List _IdleAnimations = new List(5); internal static readonly List _FireAnimations = new List(4); public static void Init() { //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_057a: Unknown result type (might be due to invalid IL or missing references) //IL_0582: Unknown result type (might be due to invalid IL or missing references) //IL_058a: Unknown result type (might be due to invalid IL or missing references) //IL_0592: Unknown result type (might be due to invalid IL or missing references) //IL_059a: Unknown result type (might be due to invalid IL or missing references) //IL_059c: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_05a8: Unknown result type (might be due to invalid IL or missing references) //IL_05b4: Expected O, but got Unknown Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore, hideFromAmmonomicon: true); int? shootFps = 30; int? reloadFps = 4; Items? muzzleFrom = Items.Mailbox; Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)(-50), (GunClass)15, 1.5f, 600, Items.Banana, defaultAudio: false, infiniteAmmo: true, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, null, null, null, -1, -1, -1, muzzleFrom, modulesAreTiers: false, null, 60, 1f, (Anchor)3, -1f, null, -1f, muzzleLit: false, 0f, 0f, null, null, preventRotation: false, 0f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: false, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0, autoPlay: true, attacksThroughWalls: false, suppressReloadLabel: false, 1f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: false, preventRollingWhenCharging: false, 1f, 0.1f).SetReloadAudio("pizza_flip_sound", 0, 8, 16, 20, 24, 28, 32).Attach((Action)null, allowDuplicates: false) .AssignGun(out gunRef); int? clipSize = 4; float? cooldown = 0.06f; float? damage = 0f; float? speed = 25f; float? range = 18f; float? force = 12f; bool? pierceBreakables = true; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "pizza_projectile", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, null, null, null, null, null, 0f, ignoredForReloadPurposes: false, mirror: false, null, null, null, pierceBreakables)).Attach(); for (int i = 0; i < 5; i++) { _IdleAnimations.Add(gunRef.QuickUpdateGunAnimation($"{i}_slice_idle")); if (i < 4) { _FireAnimations.Add(gunRef.QuickUpdateGunAnimation($"{i}_slice_fire", null, returnToIdle: true, 30)); gunRef.SetGunAudio(_FireAnimations[i], "pizza_flip_sound"); } } gunRef.idleAnimation = _IdleAnimations[0]; gunRef.shootAnimation = _FireAnimations[0]; Color? emissiveColour = Color.green; _CashVFX = VFX.Create("cold_hard_cash_vfx", 18f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 1f, emissiveColour); _PizzaSliceVFX = VFX.Create("pizza_slice_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _PizzaBox = VFX.Create("pizza_box", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); SpeculativeRigidbody orAddComponent = GameObjectExtensions.GetOrAddComponent(_PizzaBox); orAddComponent.CanBePushed = false; orAddComponent.PixelColliders = new List { new PixelCollider { ColliderGenerationMode = (PixelColliderGeneration)0, ManualOffsetX = -13, ManualOffsetY = -8, ManualWidth = 26, ManualHeight = 16, CollisionLayer = (CollisionLayer)6, Enabled = true, IsTrigger = true } }; _PizzaBox.AddComponent(); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); UpdateAnimations(); ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.StopAndResetFrameToDefault(); ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.Play(((GunBehaviour)this).gun.idleAnimation); } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); UpdateAnimations(); ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.StopAndResetFrameToDefault(); ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.Play(((GunBehaviour)this).gun.idleAnimation); } public override void OnDestroy() { if (PizzaTimeController._PizzaTimeHappening) { PizzaTimeController.EndPizzaTime(); } base.OnDestroy(); } private void UpdateAnimations() { if (((GunBehaviour)this).gun.IsReloading) { ((GunBehaviour)this).gun.idleAnimation = _IdleAnimations[4]; ((GunBehaviour)this).gun.shootAnimation = _FireAnimations[3]; } else { ((GunBehaviour)this).gun.idleAnimation = _IdleAnimations[Mathf.Clamp(((GunBehaviour)this).gun.ClipShotsRemaining, 0, 4)]; ((GunBehaviour)this).gun.shootAnimation = _FireAnimations[Mathf.Clamp(((GunBehaviour)this).gun.ClipShotsRemaining - 1, 0, 3)]; } ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.defaultClipId = ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.GetClipIdByName(((GunBehaviour)this).gun.idleAnimation); } public override void Update() { base.Update(); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) && ((GunBehaviour)this).PlayerOwner.AcceptingNonMotionInput) { UpdateAnimations(); } } public override void PostProcessProjectile(Projectile projectile) { ((GunBehaviour)this).PostProcessProjectile(projectile); UpdateAnimations(); } } public class PizzaPeelAmmoDisplay : CustomAmmoDisplay { private Gun _gun; private PizzaPeel _peel; private PlayerController _owner; private void Start() { _gun = ((Component)this).GetComponent(); _peel = ((Component)_gun).GetComponent(); ref PlayerController owner = ref _owner; GameActor currentOwner = _gun.CurrentOwner; owner = (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null); } public override bool DoCustomAmmoDisplay(GameUIAmmoController uic) { if (!Object.op_Implicit((Object)(object)_owner)) { return false; } int maxDeliveries = PizzaTimeController._MaxDeliveries; int curDeliveries = PizzaTimeController._CurDeliveries; int num = Mathf.CeilToInt(PizzaTimeController._PizzaEventTimer); uic.GunAmmoCountLabel.Text = $"{num}[sprite \"stopwatch_ui\"]\n{curDeliveries}/{maxDeliveries}[sprite \"pizza_ui\"]"; return true; } } public class PizzaBox : MonoBehaviour { private const float _PARTICLE_RATE = 0.025f; private const string NO_PIZZA_MESSAGE = "After microseconds of careful consideration, we've determined you to be completely incapable of delivering pizza in your current state. Thank you for understanding.\n\n~ Management"; private Vector2 _basePos; private float _nextParticle; private bool _didNote; public bool endsEvent; private void Start() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0033: 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) //IL_003d: Unknown result type (might be due to invalid IL or missing references) SpeculativeRigidbody component = ((Component)this).gameObject.GetComponent(); component.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)component.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(MaybeStartEvent)); _basePos = Vector2.op_Implicit(((Component)this).transform.position); } private void Update() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; float num = 0.1875f * Mathf.Sin(3f * scaledTimeSinceStartup); Vector2 val = _basePos + new Vector2(0f, num); ((Component)this).transform.position = Vector2.op_Implicit(val); if (!(_nextParticle > scaledTimeSinceStartup)) { GameObject singlePixel = VFX.SinglePixel; Vector3 position = Vector2.op_Implicit(val); Vector2? velocity = 2f * Vector2.up + Lazy.RandomVector(); Color? overrideColor = Color.red; float? height = 5f; CwaffVFX.Spawn(singlePixel, position, null, velocity, 0.5f, null, 3000f, null, fadeIn: false, null, null, height, randomFrame: false, -1, flipX: false, flipY: false, null, overrideColor, 8f); _nextParticle = scaledTimeSinceStartup + 0.025f; } } private void MaybeStartEvent(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)otherRigidbody)) { return; } PlayerController component = ((Component)otherRigidbody).gameObject.GetComponent(); if (component == null) { return; } if (endsEvent) { PizzaTimeController.HandleDeliverySuccess(); } else if (!PizzaTimeController.StartPizzaTime(component)) { if (!_didNote) { _didNote = true; CustomNoteDoer.CreateNote(((GameActor)component).CenterPosition, "After microseconds of careful consideration, we've determined you to be completely incapable of delivering pizza in your current state. Thank you for understanding.\n\n~ Management", (NoteBackgroundType)3); } return; } GameObject pizzaSliceVFX = PizzaPeel._PizzaSliceVFX; Vector2 centerPosition = ((GameActor)component).CenterPosition; float? fadeOutTime = 0.25f; CwaffVFX.SpawnBurst(pizzaSliceVFX, 20, centerPosition, 1f, null, 6f, 2f, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.Random, 0.8f, fadeOutTime, 0f, null, fadeIn: false, uniform: true); Object.Destroy((Object)(object)((Component)this).gameObject); } } public class PizzaPeelProjectile : MonoBehaviour { private static int _PizzaItem = -1; private Projectile _projectile; private PlayerController _owner; private void Start() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown _projectile = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); if (Object.op_Implicit((Object)(object)_owner)) { SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreRigidbodyCollision)); Projectile projectile = _projectile; projectile.OnHitEnemy = (Action)Delegate.Combine(projectile.OnHitEnemy, new Action(DoPizzaChecks)); } } private void OnPreRigidbodyCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { if (Object.op_Implicit((Object)(object)otherRigidbody)) { WantsPizza component = ((Component)otherRigidbody).gameObject.GetComponent(); if (component != null && component.hasPizza) { PhysicsEngine.SkipCollision = true; } } } private void DoPizzaChecks(Projectile projectile, SpeculativeRigidbody rigidbody, bool arg3) { //IL_00db: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)rigidbody)) { return; } AIActor component = ((Component)rigidbody).gameObject.GetComponent(); if (component == null) { return; } WantsPizza component2 = ((Component)rigidbody).gameObject.GetComponent(); if (component2 == null || component2.hasPizza) { return; } component2.hasPizza = true; if (_PizzaItem < 0) { _PizzaItem = Lazy.PickupId(); } component.ReplaceGun((Items)_PizzaItem); if (component.EnemyGuid == "01972dee89fc4404a5c408d50007dad5") { ((BraveBehaviour)component).aiAnimator.OverrideIdleAnimation = "smile"; } if (Object.op_Implicit((Object)(object)((BraveBehaviour)component).aiShooter)) { BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)((BraveBehaviour)component).aiShooter).behaviorSpeculator; if (behaviorSpeculator != null) { behaviorSpeculator.AttackBehaviors = new List(); behaviorSpeculator.OverrideBehaviors = new List(); behaviorSpeculator.OtherBehaviors = new List(); behaviorSpeculator.TargetBehaviors = new List(); behaviorSpeculator.MovementBehaviors = new List(); behaviorSpeculator.FullyRefreshBehaviors(); } } GameObject obj = SpawnManager.SpawnVFX(PizzaPeel._CashVFX, Vector2.op_Implicit(((BraveBehaviour)component).sprite.WorldTopCenter + new Vector2(0f, 1f)), Quaternion.identity, true); ((tk2dBaseSprite)obj.GetComponent()).HeightOffGround = 1f; obj.transform.parent = ((BraveBehaviour)((BraveBehaviour)component).sprite).transform; obj.AddComponent().Setup(0.25f, 0.5f, 0f, 0.5f, 0.25f, 50f); ((Component)component).gameObject.Play("got_some_cash"); PizzaTimeController._CurDeliveries++; } private void Update() { } private void OnDestroy() { } } public class MoneyGun : CwaffGun { public static string ItemName = "Money Gun"; public static string ShortDescription = "O:"; public static string LongDescription = "$$$"; public static string Lore = "$$$$$"; public static void Init() { Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore, hideFromAmmonomicon: true).SetAttributes((ItemQuality)(-50), (GunClass)50, 1.2f, 999, Items.Banana, defaultAudio: false, infiniteAmmo: true, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, null, null, null, null, null, null, null, -1, -1, -1, null, modulesAreTiers: false, null, 60, 1f, (Anchor)3, -1f, null, -1f, muzzleLit: false, 0f, 0f, null, null, preventRotation: false, 0f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: false, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0).DefaultModule.projectiles = new List { Lazy.NoProjectile() }; } public override void Update() { base.Update(); ((GunBehaviour)this).gun.OverrideAngleSnap = 180f; } } public class PizzaGun : CwaffGun { public static string ItemName = "Pizza Gun"; public static string ShortDescription = "=D"; public static string LongDescription = "Pizza"; public static string Lore = "Peepaga, Peepaga"; public static void Init() { Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore, hideFromAmmonomicon: true).SetAttributes((ItemQuality)(-50), (GunClass)50, 1.2f, 999, Items.Banana, defaultAudio: false, infiniteAmmo: true, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, null, null, null, null, null, null, null, -1, -1, -1, null, modulesAreTiers: false, null, 60, 1f, (Anchor)3, -1f, null, -1f, muzzleLit: false, 0f, 0f, null, null, preventRotation: true, 0f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: false, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0).DefaultModule.projectiles = new List { Lazy.NoProjectile() }; } } public class WantsPizza : MonoBehaviour { public bool hasPizza; private AIActor _enemy; private HealthHaver _hh; private GameObject _threatArrow; private void Start() { _enemy = ((Component)this).gameObject.GetComponent(); } private void Update() { if (!Object.op_Implicit((Object)(object)_enemy)) { return; } if (!Object.op_Implicit((Object)(object)_hh)) { _hh = ((Component)this).gameObject.GetComponent(); if (!Object.op_Implicit((Object)(object)_hh)) { return; } } _hh.IsVulnerable = false; _hh.TriggerInvulnerabilityPeriod(999999f); HandleIndicators(); } private void OnDestroy() { if (Object.op_Implicit((Object)(object)_threatArrow)) { Object.Destroy((Object)(object)_threatArrow); } } private void HandleIndicators() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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_0188: Unknown result type (might be due to invalid IL or missing references) if (PizzaTimeController._MaxDeliveries - PizzaTimeController._CurDeliveries > 6) { return; } if (!Object.op_Implicit((Object)(object)_threatArrow)) { _threatArrow = (GameObject)Object.Instantiate(BraveResources.Load("Global VFX/Alert_Arrow", ".prefab")); GameObjectExtensions.SetLayerRecursively(_threatArrow, LayerMask.NameToLayer("Unoccluded")); } tk2dBaseSprite component = _threatArrow.GetComponent(); if (hasPizza) { ((BraveBehaviour)component).renderer.enabled = false; return; } component.HeightOffGround = 8f; component.UpdateZDepth(); if (!(component.GetCurrentSpriteDef().name == "blankframe")) { Vector2 centerPosition = ((GameActor)PizzaTimeController._DeliveryBoi).CenterPosition; Vector2 centerPosition2 = ((GameActor)_enemy).CenterPosition; Vector2 zero = Vector2.zero; if (!BraveMathCollege.LineSegmentRectangleIntersection(centerPosition, centerPosition2, GameManager.Instance.MainCameraController.MinVisiblePoint, GameManager.Instance.MainCameraController.MaxVisiblePoint, ref zero)) { ((BraveBehaviour)component).renderer.enabled = false; return; } ((BraveBehaviour)component).renderer.enabled = true; float num = Mathf.RoundToInt(BraveMathCollege.Atan2Degrees(centerPosition2 - centerPosition) / 5f) * 5; Quaternion val = Quaternion.Euler(0f, 0f, num); Vector2 val2 = Vector2.op_Implicit(val * Vector2.op_Implicit(Vector2.right)); zero -= ((Vector2)(ref val2)).normalized * 0.5f; _threatArrow.transform.position = dfVectorExtensions.Quantize(Vector2Extensions.ToVector3ZUp(zero, 0f), 0.0625f); _threatArrow.transform.localRotation = val; } } } public class PizzaTimeController : MonoBehaviour { [HarmonyPatch(typeof(PlayerController), "AttemptTeleportToRoom")] private static class PlayerControllerAttemptTeleportToRoomPatch { private static bool Prefix(PlayerController __instance) { return !_PizzaTimeHappening; } } [HarmonyPatch] private static class IncreaseSpeedOOCDuringPizzaEventPatch { [HarmonyPatch(typeof(PlayerController), "Update")] [HarmonyILManipulator] private static void PlayerControllerUpdateIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdfld(instr, "IncreaseSpeedOutOfCombat") })) { val.CallPrivate(typeof(IncreaseSpeedOOCDuringPizzaEventPatch), "ForceOOCSpeedIncrease"); } } private static bool ForceOOCSpeedIncrease(bool origValue) { if (!origValue) { return _PizzaTimeHappening; } return true; } } private const int _MIN_DELIVERY_ROOMS = 5; private const string _PIZZA_TIME_OVERRIDE = "Pizza Time"; internal const int _INDICATOR_THRESHOLD = 6; internal static bool _PizzaTimeHappening = false; internal static bool _PizzaTimeAttemptedThisFloor = false; internal static Gun _ExtantGun = null; internal static PlayerController _DeliveryBoi = null; internal static int _CurDeliveries = 0; internal static int _MaxDeliveries = 0; internal static bool _ScannedRoomsThisFloor = false; internal static float _PizzaEventTimer = 0f; internal static RoomHandler _ElevatorRoom = null; internal static RoomHandler _StartRoom = null; private static PizzaTimeController _Instance = null; private static int _MoneyItem = -1; private static readonly List _DeliveryRooms = new List(); private static readonly LinkedList _OccupiedRooms = new LinkedList(); private static readonly LinkedList _Hungrybois = new LinkedList(); private static bool _PlayingMusic = false; private static PizzaBox _GoalBox = null; private static readonly List _PizzaTimeBlackList = new List(); private static readonly string[] _ChestNames = new string[5] { "Brown", "Blue", "Green", "Red", "Black" }; internal static void MaybeSpawnPizzaAtExit(PlayerController player, RoomHandler oldRoom, RoomHandler newRoom) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_005a: Unknown result type (might be due to invalid IL or missing references) if (!_PizzaTimeHappening && !_PizzaTimeAttemptedThisFloor && !GameManager.Instance.IsLoadingLevel && CanStartPizzaTime(player)) { _PizzaTimeAttemptedThisFloor = true; if (_ElevatorRoom != null && _StartRoom != null) { GameObject pizzaBox = PizzaPeel._PizzaBox; IntVector2 bestRewardLocation = _ElevatorRoom.GetBestRewardLocation(new IntVector2(1, 1), (RewardLocationStyle)0, true); pizzaBox.Instantiate(Vector2.op_Implicit(((IntVector2)(ref bestRewardLocation)).ToVector2())).GetComponent().endsEvent = false; } } } private static void DoPizzaTimeMusic() { AkSoundEngine.PostEvent("Stop_MUS_All", ((Component)GameManager.Instance).gameObject); _PlayingMusic = true; } private static void StopPizzaTimeMusic() { GameManager.Instance.DungeonMusicController.ResetForNewFloor(GameManager.Instance.Dungeon); GameManager.Instance.DungeonMusicController.NotifyEnteredNewRoom(_StartRoom); } public static void HandleDeliverySuccess() { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) float floorIndex = Lazy.GetFloorIndex(); int num = ((floorIndex >= 5f) ? 3 : ((floorIndex >= 3f) ? 2 : ((floorIndex >= 1f) ? 1 : 2))); int num2 = num; float num3 = (float)_CurDeliveries / (float)_MaxDeliveries; int num4 = _CurDeliveries; if (!(num3 >= 1f)) { if (!(num3 >= 0.9f)) { if (!(num3 >= 0.5f)) { if (num3 < 0.5f) { num4 /= 2; } } else { num2 = 0; } } } else { num2++; } bool flag = default(bool); IntVector2 centeredVisibleClearSpot = _DeliveryBoi.CurrentRoom.GetCenteredVisibleClearSpot(2, 2, ref flag, false); if (num2 > 0) { if (Random.value > 0.3f) { num2++; } Lazy.SpawnChestWithSpecificItem(_DeliveryBoi.GetRandomChestRewardOfQuality((ItemQuality)num2).GetComponent(), centeredVisibleClearSpot); } LootEngine.SpawnCurrency(((IntVector2)(ref centeredVisibleClearSpot)).ToVector2(), num4, false, (Vector2?)null, (float?)null, 4f, 0.05f); string text = $"{Mathf.RoundToInt(100f * num3)}% of pizzas delivered\n\n----------\n\nReward:\n- {num4} casings"; if (num2 > 0) { text = text + "\n- " + _ChestNames[num2 - 1] + " Chest"; } CustomNoteDoer.CreateNote(((IntVector2)(ref centeredVisibleClearSpot)).ToVector2() + new Vector2(0f, 1f), text, (NoteBackgroundType)3); EndPizzaTime(); } public static void HandleDeliveryFailure() { } private static void SpawnHungryBulletKins() { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) if (_MoneyItem < 0) { _MoneyItem = Lazy.PickupId(); } AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5"); foreach (RoomHandler deliveryRoom in _DeliveryRooms) { int num = Random.Range(1, 5); List> goodSpotsInternal = deliveryRoom.GetGoodSpotsInternal(2, 2, false); if (goodSpotsInternal.Count > num) { goodSpotsInternal.Shuffle(); } else if (goodSpotsInternal.Count < num) { num = goodSpotsInternal.Count; } for (int i = 0; i < num; i++) { IntVector2 first = goodSpotsInternal[i].First; AIActor val = AIActor.Spawn(orLoadByGuid, first, deliveryRoom, false, (AwakenAnimationType)0, true); val.IgnoreForRoomClear = true; val.CollisionDamage = 0f; val.ParentRoom.ResetEnemyHPPercentage(); ((Component)val).gameObject.AddComponent(); val.ReplaceGun((Items)_MoneyItem); BehaviorSpeculator component = ((Component)val).gameObject.GetComponent(); if (component != null) { component.AttackBehaviors.Clear(); component.OverrideBehaviors.Clear(); component.OtherBehaviors.Clear(); component.MovementBehaviors.Clear(); } val.HasDonePlayerEnterCheck = true; val.OnEngaged(true); _Hungrybois.AddLast(val); } } _CurDeliveries = 0; _MaxDeliveries = _Hungrybois.Count; } private static void DespawnHungryBulletKins() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) RoomHandler val = (Object.op_Implicit((Object)(object)_DeliveryBoi) ? _DeliveryBoi.CurrentRoom : null); int count = _Hungrybois.Count; for (int i = 0; i < count; i++) { AIActor value = _Hungrybois.First.Value; _Hungrybois.RemoveFirst(); if (!Object.op_Implicit((Object)(object)value) || !Object.op_Implicit((Object)(object)((Component)value).gameObject)) { continue; } WantsPizza component = ((Component)value).gameObject.GetComponent(); if (component == null || !component.hasPizza) { if (val != null && Vector3Extensions.GetAbsoluteRoom(((GameActor)value).CenterPosition) == val) { value.EraseFromExistence(true); } else { Object.Destroy((Object)(object)((Component)value).gameObject); } } } _Hungrybois.Clear(); } private static void CalculateEventTimer() { _PizzaEventTimer = (float)_Hungrybois.Count * (GameManager.IsTurboMode ? 3f : 4f); float floorIndex = Lazy.GetFloorIndex(); if (floorIndex >= 1f) { _PizzaEventTimer *= 0.8f + 0.2f * floorIndex; } else { _PizzaEventTimer *= 1.3f; } } internal static void OnFloorEnded() { if (_PizzaTimeHappening) { EndPizzaTime(floorEnded: true); } _DeliveryRooms.Clear(); _OccupiedRooms.Clear(); _Hungrybois.Clear(); _CurDeliveries = 0; _MaxDeliveries = 0; _ScannedRoomsThisFloor = false; _PizzaTimeAttemptedThisFloor = false; _ElevatorRoom = null; _StartRoom = null; } private static bool RoomStillHasEnemies(RoomHandler room) { if (room.remainingReinforcementLayers != null && room.remainingReinforcementLayers.Count > 0) { return true; } if (room.activeEnemies == null) { return false; } for (int i = 0; i < room.activeEnemies.Count; i++) { if (!room.activeEnemies[i].IgnoreForRoomClear) { return true; } } return false; } internal static void ScanRooms() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Invalid comparison between Unknown and I4 List rooms = GameManager.Instance.Dungeon.data.rooms; for (int i = 0; i < rooms.Count; i++) { RoomHandler val = rooms[i]; if (val != null) { if ((int)val.area.PrototypeRoomCategory == 7) { _StartRoom = val; } if ((int)val.area.PrototypeRoomCategory == 8) { _ElevatorRoom = val; } if (RoomStillHasEnemies(val)) { _OccupiedRooms.AddLast(val); } if (val.IsStandardRoom && val.EverHadEnemies) { _DeliveryRooms.Add(val); } } } _ScannedRoomsThisFloor = true; } private static bool AnyRoomsStillOccupied() { int count = _OccupiedRooms.Count; for (int i = 0; i < count; i++) { LinkedListNode first = _OccupiedRooms.First; _OccupiedRooms.RemoveFirst(); if (RoomStillHasEnemies(first.Value)) { _OccupiedRooms.AddLast(first); } } return _OccupiedRooms.Count > 0; } private static bool AllRoomsCleared() { if (!_ScannedRoomsThisFloor) { ScanRooms(); } if (_DeliveryRooms.Count > 5) { return !AnyRoomsStillOccupied(); } return false; } public static bool CanStartPizzaTime(PlayerController deliveryboi) { if (_PizzaTimeHappening) { return false; } if (!Object.op_Implicit((Object)(object)deliveryboi) || deliveryboi.IsGunLocked) { return false; } if (!AllRoomsCleared()) { return false; } return true; } public static bool StartPizzaTime(PlayerController deliveryboi) { //IL_000a: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_007e: Unknown result type (might be due to invalid IL or missing references) if (!GivePizzaPeel(deliveryboi)) { return false; } _Instance = new GameObject().AddComponent(); ((Component)_Instance).gameObject.Play("pizza_event_start_sound"); _PizzaTimeHappening = true; _DeliveryBoi = deliveryboi; _DeliveryBoi.OverrideHat(CwaffHats._PizzaHat); SpawnHungryBulletKins(); CalculateEventTimer(); DoPizzaTimeMusic(); GameObject pizzaBox = PizzaPeel._PizzaBox; IntVector2 bestRewardLocation = _StartRoom.GetBestRewardLocation(new IntVector2(1, 1), (RewardLocationStyle)0, true); _GoalBox = pizzaBox.Instantiate(Vector2.op_Implicit(((IntVector2)(ref bestRewardLocation)).ToVector2())).GetComponent(); _GoalBox.endsEvent = true; return true; } public static void EndPizzaTime(bool floorEnded = false) { _PizzaTimeHappening = false; if (!floorEnded) { StopPizzaTimeMusic(); if (Object.op_Implicit((Object)(object)_Instance)) { ((Component)_Instance).gameObject.Play("pizza_event_start_sound"); } DespawnHungryBulletKins(); } if (Object.op_Implicit((Object)(object)_DeliveryBoi)) { DestroyPizzaPeel(_DeliveryBoi); _DeliveryBoi.ClearHatOverride(CwaffHats._PizzaHat); _DeliveryBoi = null; } if (Object.op_Implicit((Object)(object)_GoalBox)) { Object.Destroy((Object)(object)((Component)_GoalBox).gameObject); _GoalBox = null; } if (Object.op_Implicit((Object)(object)_Instance)) { Object.Destroy((Object)(object)((Component)_Instance).gameObject); _Instance = null; } } private static bool GivePizzaPeel(PlayerController deliveryboi) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected I4, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected I4, but got Unknown if (_PizzaTimeBlackList.Contains((int)deliveryboi.characterIdentity)) { return false; } if (deliveryboi.inventory.GunLocked.Value) { return false; } deliveryboi.inventory.GunChangeForgiveness = true; PickupObject obj = Lazy.Pickup(); Gun val = (Gun)(object)((obj is Gun) ? obj : null); _ExtantGun = deliveryboi.inventory.AddGunToInventory(val, true); if ((Object)(object)((GameActor)deliveryboi).CurrentGun != (Object)(object)_ExtantGun) { _PizzaTimeBlackList.AddUnique((int)deliveryboi.characterIdentity); if (deliveryboi.inventory.ContainsGun(((PickupObject)_ExtantGun).PickupObjectId)) { deliveryboi.ForceDropGun(_ExtantGun); } Object.Destroy((Object)(object)((Component)_ExtantGun).gameObject); return false; } ((PickupObject)_ExtantGun).CanBeDropped = false; ((PickupObject)_ExtantGun).CanBeSold = false; deliveryboi.inventory.GunLocked.SetOverride("Pizza Time", true, (float?)null); return true; } private static void DestroyPizzaPeel(PlayerController deliveryboi) { deliveryboi.inventory.GunLocked.RemoveOverride("Pizza Time"); deliveryboi.inventory.GunChangeForgiveness = false; if (Object.op_Implicit((Object)(object)_ExtantGun)) { deliveryboi.inventory.DestroyGun(_ExtantGun); _ExtantGun = null; } } private void Update() { if (Domino._ShouldPlayMusic) { ((MonoBehaviour)(object)this).LoopSoundIf(_PlayingMusic, "pizza_time", 9056, 5318); } _PizzaEventTimer -= BraveTime.DeltaTime; if (!(_PizzaEventTimer > 0f)) { _PizzaEventTimer = 0f; HandleDeliveryFailure(); EndPizzaTime(); } } } public class LibraryCardtridge : CwaffPassive { private class DiscountBooks : MonoBehaviour { public bool isDiscounted; public int? originalCustomCost; public int? originalOverrideCost; public int originalCurrentCost = -1; } public static string ItemName = "Library Cardtridge"; public static string ShortDescription = "Knowledge is Firepower"; public static string LongDescription = "Books and paper-based items are free at shops. Bookllets are charmed upon entering a room. Piles of books explode when destroyed."; public static string Lore = "It's pretty safe to assume that most who enter the Gungeon don't come there with the primary goal of reading books, but if you're one of the 4 who do, a library cardtridge is a must-have. Not only does it make reading that much more affordable, but when some unruly Bullet Kin inevitably swing by to destroy your preferred chair and knock over your favorite mug filled with ginger peach green tea, you'll be armed with the knowledge to transform the table you're sitting at into a true bastion of defense."; internal static GameActorCharmEffect _CharmEffect = null; private static HashSet _BookItemIDs = null; private static HashSet _BookEnemyGUIDs = null; private static bool _DidLateInit = false; private static ExplosionData _BookExplosion = null; private static readonly List _ModdedItemNames = new List(55) { "ski:slide_tech_slide", "ski:slide_tech_reload", "ski:slide_tech_counter", "ski:slide_tech_shatter", "ski:slide_tech_split", "ski:slide_tech_surf", "ski:table_tech_amped_cover", "ski:book_of_book", "ski:manuel's_manual", "ski:bullet_tech_flip", "ski:chicago_typewriter", "psog:death_warrant", "psog:gun_warrant", "psog:table_tech_devour", "psog:table_tech_ignition", "psog:table_rwxg_telefrag", "psog:hegemony_shipment_ticket", "psog:scroll_of_guonification", "psog:tome_of_guonmancy", "nn:libram_of_the_chambers", "nn:table_tech_table", "nn:table_tech_speed", "nn:table_tech_invulnerability", "nn:table_tech_ammo", "nn:table_tech_guon", "nn:table_tech_spectre", "nn:table_tech_astronomy", "nn:table_tech_vitality", "nn:table_tech-nology", "nn:uns-table_tech", "nn:book_of_mimic_anatomy", "nn:map_fragment", "nn:tattered_map", "nn:paper_badge", "nn:chance_card", "nn:organ_donor_card", "nn:kalibers_prayer", "nn:gunidae_solvit_haatelis", "nn:coupon", "nn:bombinomicon", "nn:scroll_of_exact_knowledge", "nn:pencil", "nn:bookllet", "nn:lorebook", "ck:mininomocon", "ck:steam_sale", "ck:support_contract", "kp:table_tech_life", "kp:table_tech_petrify", "kp:drawn", "ex:table_tech_assassin", "bb:pilot's_guide_to_pickpocketing", "rtr:blank_spellbock", "rtr:table_tech_stealth", "kts:scroll_of_approximate_knowledge" }; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)1; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)1, 1f); ((PickupObject)(object)obj).AddToShop(ModdedShopType.Talbert); _BookItemIDs = new HashSet(); _BookItemIDs.Add(487); _BookItemIDs.Add(354); _BookItemIDs.Add(137); _BookItemIDs.Add(281); _BookItemIDs.Add(814); _BookItemIDs.Add(400); _BookItemIDs.Add(666); _BookItemIDs.Add(397); _BookItemIDs.Add(399); _BookItemIDs.Add(398); _BookItemIDs.Add(633); _BookItemIDs.Add(396); _BookItemIDs.Add(465); _BookItemIDs.Add(477); _BookItemIDs.Add(115); _BookEnemyGUIDs = new HashSet(); _BookEnemyGUIDs.Add("c0ff3744760c4a2eb0bb52ac162056e6"); _BookEnemyGUIDs.Add("6f22935656c54ccfb89fca30ad663a64"); _BookEnemyGUIDs.Add("a400523e535f41ac80a43ff6b06dc0bf"); _BookEnemyGUIDs.Add("78e0951b097b46d89356f004dda27c42"); PickupObject obj2 = ItemHelper.Get(Items.YellowChamber); _CharmEffect = ((YellowChamberItem)((obj2 is YellowChamberItem) ? obj2 : null)).CharmEffect; _BookExplosion = Explosions.DefaultLarge.With(100f, 10f, 100f, 3f, preventPlayerForce: true, shake: false); } private void MakeBooksFriendlyAndExplodey(AIActor enemy) { if (enemy.IsHostileAndNotABoss() && _BookEnemyGUIDs.Contains(enemy.EnemyGuid)) { enemy.IgnoreForRoomClear = true; enemy.ParentRoom.ResetEnemyHPPercentage(); ((GameActor)enemy).ApplyEffect((GameActorEffect)(object)_CharmEffect, 1f, (Projectile)null); ((BraveBehaviour)enemy).healthHaver.OnDeath += delegate { //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_0015: Unknown result type (might be due to invalid IL or missing references) Exploder.Explode(Vector2.op_Implicit(((GameActor)enemy).CenterPosition), _BookExplosion, Vector2.zero, (Action)null, false, (CoreDamageTypes)0, false); }; } } private void OnEnemySpawn(AIActor enemy) { MakeBooksFriendlyAndExplodey(enemy); } private void ExplodingBooks(MinorBreakable mb) { //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_0015: Unknown result type (might be due to invalid IL or missing references) Exploder.Explode(Vector2.op_Implicit(((BraveBehaviour)mb).sprite.WorldCenter), _BookExplosion, Vector2.zero, (Action)null, false, (CoreDamageTypes)0, false); } private void OnEnteredCombat() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) RoomHandler absoluteParentRoom = ((DungeonPlaceableBehaviour)((PassiveItem)this).Owner).GetAbsoluteParentRoom(); foreach (MinorBreakable allMinorBreakable in StaticReferenceManager.AllMinorBreakables) { if (((Object)allMinorBreakable).name == "Pile Of Books" && Vector3Extensions.GetAbsoluteRoom(((BraveBehaviour)allMinorBreakable).transform.position) == absoluteParentRoom) { allMinorBreakable.OnBreakContext = (Action)Delegate.Combine(allMinorBreakable.OnBreakContext, new Action(ExplodingBooks)); } } } public override void Pickup(PlayerController player) { if (!_DidLateInit) { _BookItemIDs.Add(Lazy.PickupId()); _BookItemIDs.Add(Lazy.PickupId()); _BookItemIDs.Add(Lazy.PickupId()); _BookItemIDs.Add(Lazy.PickupId()); _BookItemIDs.Add(Lazy.PickupId()); _BookItemIDs.Add(Lazy.PickupId()); foreach (string moddedItemName in _ModdedItemNames) { PickupObject moddedItem = Lazy.GetModdedItem(moddedItemName); if (moddedItem != null) { _BookItemIDs.Add(moddedItem.PickupObjectId); } } _DidLateInit = true; } base.Pickup(player); MakeBooksFree(); GameManager.Instance.OnNewLevelFullyLoaded += MakeBooksFree; player.OnEnteredCombat = (Action)Delegate.Combine(player.OnEnteredCombat, new Action(OnEnteredCombat)); AIActor.OnPreStart = (Action)Delegate.Combine(AIActor.OnPreStart, new Action(OnEnemySpawn)); } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); AIActor.OnPreStart = (Action)Delegate.Remove(AIActor.OnPreStart, new Action(OnEnemySpawn)); GameManager.Instance.OnNewLevelFullyLoaded -= MakeBooksFree; NoMoreFreeBooks(); if (Object.op_Implicit((Object)(object)player)) { player.OnEnteredCombat = (Action)Delegate.Remove(player.OnEnteredCombat, new Action(OnEnteredCombat)); } } private void MakeBooksFree() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) foreach (BaseShopController item in StaticReferenceManager.AllShops.EmptyIfNull()) { if (!Object.op_Implicit((Object)(object)item) || item.m_itemControllers == null) { continue; } foreach (ShopItemController itemController in item.m_itemControllers) { if (Object.op_Implicit((Object)(object)itemController) && Object.op_Implicit((Object)(object)itemController.item) && _BookItemIDs.Contains(itemController.item.PickupObjectId) && (int)itemController.CurrencyType == 0) { DiscountBooks orAddComponent = GameObjectExtensions.GetOrAddComponent(((Component)itemController).gameObject); if (!orAddComponent.isDiscounted) { orAddComponent.originalCustomCost = (itemController.item.UsesCustomCost ? new int?(itemController.item.CustomCost) : null); orAddComponent.originalCurrentCost = itemController.CurrentPrice; orAddComponent.originalOverrideCost = itemController.OverridePrice; itemController.item.UsesCustomCost = true; itemController.item.CustomCost = 0; itemController.OverridePrice = 0; orAddComponent.isDiscounted = true; } } } } } private void NoMoreFreeBooks() { foreach (BaseShopController allShop in StaticReferenceManager.AllShops) { if (allShop.m_itemControllers == null) { continue; } foreach (ShopItemController itemController in allShop.m_itemControllers) { if (!Object.op_Implicit((Object)(object)itemController)) { continue; } DiscountBooks component = ((Component)itemController).gameObject.GetComponent(); if (component != null && component.isDiscounted) { if (component.originalCustomCost.HasValue) { itemController.item.CustomCost = component.originalCustomCost.Value; } else { itemController.item.UsesCustomCost = false; } itemController.OverridePrice = component.originalOverrideCost; itemController.CurrentPrice = component.originalCurrentCost; component.isDiscounted = false; } } } } } public class ReserveAmmolet : CwaffBlankModificationItem, ICustomBlankDoer { public static string ItemName = "Reserve Ammolet"; public static string ShortDescription = "Blanks Restore Ammo"; public static string LongDescription = "Blanks restore 1% ammo to the current gun per projectile cleared. Grants 1 additional blank per floor."; public static string Lore = "The latest and greatest from the brilliant minds of ACNE Corporation's Ammolet Division. Instead of destroying projectiles like most off-the-shelf ammolets, ACNE's premium Reserve Ammolet uses a proprietary suite of technologies to halt the momentum of all hostile projectiles and siphon them into its wearer's arms (* to clarify for legal reasons, this is not referring to the wearer's biological arms, but their fire arms [** to clarify further for more legal reasons, this ammolet replenishes ammunition to guns, and does not require its wearer to set their arms on fire to function])."; private int _stashedAmmo; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore, hideFromAmmonomicon: false, 1f); ((PickupObject)obj).quality = (ItemQuality)3; ItemBuilder.AddPassiveStatModifier((PickupObject)(object)obj, (StatType)18, 1f, (ModifyMethod)0); ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)4, 1f); } public override void Update() { ((PassiveItem)this).Update(); if (_stashedAmmo > 0) { ((GameActor)((PassiveItem)this).Owner).CurrentGun.GainAmmo(Mathf.CeilToInt(0.01f * (float)_stashedAmmo * (float)((GameActor)((PassiveItem)this).Owner).CurrentGun.AdjustedMaxAmmo)); _stashedAmmo = 0; } } public void OnCustomBlankedProjectile(Projectile p) { _stashedAmmo++; } } public class GorgunEye : CwaffPassive { public static string ItemName = "Gorgun Eye"; public static string ShortDescription = "Staredown"; public static string LongDescription = "Stuns enemies while looking directly at them."; public static string Lore = "Contrary to popular belief, Gorgun eyes have no intrinsic petrification properties. Gungeon archaeologists have discovered that Gorgun shamans traditionally imbue the eyes of their peers with petrification magic during infancy. More recently, it appears that Gorguns have begun to prefer enchanting synthetic eyes and disposable contact lenses, presumably after collectively realizing that petrifying everyone you meet was mildly inconvenient during social gatherings."; private const float _CONE_RADIUS = 10f; private const float _STUN_LINGER_TIME = 0.1f; private const string _EFFECT_NAME = "Gorgun Eyed"; private static readonly Color _StoneColor = new Color(0.5f, 0.5f, 0.5f, 1f); private static GameActorHealthEffect _GorgunTint = null; private List _afflictedEnemies = new List(); private List _afflictedEnemiesAlt = new List(); public static void Init() { //IL_0021: 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) //IL_003d: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)4; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)2, 1f); ((PickupObject)(object)obj).AddToShop(ModdedShopType.Handy); _GorgunTint = new GameActorHealthEffect { AppliesTint = true, TintColor = _StoneColor, AppliesDeathTint = true, DeathTintColor = _StoneColor, AffectsEnemies = true, DamagePerSecondToEnemies = 0f, duration = 10000000f, effectIdentifier = "Gorgun Eyed" }; } public override void Update() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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_00e9: 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_00ef: Unknown result type (might be due to invalid IL or missing references) ((PassiveItem)this).Update(); PlayerController owner = ((PassiveItem)this).Owner; if (owner == null) { return; } bool flag = owner.HasSynergy(Synergy.PIERCING_GAZE); bool flag2 = owner.HasSynergy(Synergy.BLANK_STARE); _afflictedEnemiesAlt.Clear(); Vector2 centerPosition = ((GameActor)owner).CenterPosition; float currentGunAngle = owner.m_currentGunAngle; AIActor val = null; float num = 999999f; foreach (AIActor item in owner.CurrentRoom.SafeGetEnemiesInRoom()) { if (!Object.op_Implicit((Object)(object)item) || !item.IsHostileAndNotABoss(canBeDead: false, canBeNeutral: true) || !Object.op_Implicit((Object)(object)((BraveBehaviour)item).behaviorSpeculator) || ((BraveBehaviour)item).behaviorSpeculator.ImmuneToStun) { continue; } Vector2 v = ((GameActor)item).CenterPosition - centerPosition; if (!v.IsNearAngle(currentGunAngle, 10f)) { continue; } if (flag) { _afflictedEnemiesAlt.Add(item); continue; } float sqrMagnitude = ((Vector2)(ref v)).sqrMagnitude; if (!(sqrMagnitude >= num)) { Vector2 val2 = centerPosition.ToNearestWallOrObject(currentGunAngle, 0f) - centerPosition; if (!(((Vector2)(ref val2)).sqrMagnitude < sqrMagnitude)) { val = item; num = sqrMagnitude; } } } if (!flag && Object.op_Implicit((Object)(object)val)) { _afflictedEnemiesAlt.Add(val); } foreach (AIActor item2 in _afflictedEnemiesAlt) { ((BraveBehaviour)item2).behaviorSpeculator.Stun(0.1f, false); if (!_afflictedEnemies.Contains(item2)) { ((GameActor)item2).ApplyEffect((GameActorEffect)(object)_GorgunTint, 1f, (Projectile)null); ((Component)item2).gameObject.PlayUnique("gorgun_eye_activate"); } } foreach (AIActor afflictedEnemy in _afflictedEnemies) { if (!Object.op_Implicit((Object)(object)afflictedEnemy) || _afflictedEnemiesAlt.Contains(afflictedEnemy)) { continue; } ((GameActor)afflictedEnemy).RemoveEffect((GameActorEffect)(object)_GorgunTint); if (flag2) { BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)afflictedEnemy).behaviorSpeculator; if (behaviorSpeculator != null && !behaviorSpeculator.ImmuneToStun) { behaviorSpeculator.Stun(1f, true); } } } BraveUtility.Swap>(ref _afflictedEnemies, ref _afflictedEnemiesAlt); } } public class ComfySlippers : CwaffPassive { public static string ItemName = "Comfy Slippers"; public static string ShortDescription = "Furry Foot Friends"; public static string LongDescription = "Increases movement speed and dodge roll speed while on carpeted surfaces."; public static string Lore = "The fluffiest and fuzziest footwear that stray casings you picked up off of the ground can buy. On top of being fashionable and adorable as all get-out, the padded insoles and added arch support reduce ankle strain and let you glide effortlessly across suitably soft floors. As an added bonus, your new slipper buddies provide some much-needed companionship on those cold, musty Gungeon nights, and will always be there to remind you that looking down at your feet while scurrying through the Gungeon is rather dangerous and probably isn't a fantastic idea and WATCH OUT FOR THAT PITF--."; internal const float _MOVEMENT_BOOST = 2f; internal const float _DODGE_BOOST = 0.2f; internal static StatModifier[] _ComfyBuffs = null; internal static StatModifier[] _NoBoosts = (StatModifier[])(object)new StatModifier[0]; private CellFloorType _lastFloorType; public static void Init() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) ((PickupObject)Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore)).quality = (ItemQuality)1; _ComfyBuffs = (StatModifier[])(object)new StatModifier[2] { ((StatType)0).Add(2f), ((StatType)28).Add(0.2f) }; } public override void DisableEffect(PlayerController player) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { _lastFloorType = (CellFloorType)0; SetComfiness(comfy: false); } } public override void Update() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0061: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Invalid comparison between Unknown and I4 ((PassiveItem)this).Update(); if (GameManager.HasInstance && !GameManager.Instance.IsLoadingLevel && !GameManager.IsReturningToBreach && Object.op_Implicit((Object)(object)((PassiveItem)this).Owner) && Object.op_Implicit((Object)(object)((BraveBehaviour)((PassiveItem)this).Owner).specRigidbody)) { CellFloorType floorTypeFromPosition = GameManager.Instance.Dungeon.GetFloorTypeFromPosition(((BraveBehaviour)((PassiveItem)this).Owner).specRigidbody.UnitBottomCenter); if (floorTypeFromPosition != _lastFloorType) { _lastFloorType = floorTypeFromPosition; SetComfiness((int)floorTypeFromPosition == 2); } } } private void SetComfiness(bool comfy) { ((PassiveItem)this).passiveStatModifiers = (comfy ? _ComfyBuffs : _NoBoosts); ((PassiveItem)this).Owner.stats.RecalculateStats(((PassiveItem)this).Owner, false, false); } } public class BulletproofTablecloth : CwaffPassive { [HarmonyPatch(typeof(MajorBreakable), "ApplyDamage")] private class MajorBreakableApplyDamagePatch { private static bool Prefix(MajorBreakable __instance, float damage, Vector2 sourceDirection, bool isSourceEnemy, bool isExplosion, bool ForceDamageOverride) { Transform parent = ((Component)__instance).gameObject.transform.parent; if (parent == null) { return true; } FlippableCover component = ((Component)parent).gameObject.GetComponent(); if (component == null) { return true; } if (!Lazy.AnyoneHas()) { return true; } if (Synergy.FURNITURE_POLISH.Active()) { ((Component)component).GetComponentInChildren().ReflectProjectiles = true; } return false; } } public static string ItemName = "Bulletproof Tablecloth"; public static string ShortDescription = "Kevlar for Dinner"; public static string LongDescription = "Makes flippable tables immune to bullets and most other sources of damage."; public static string Lore = "Putting kevlar vests on tables is a somewhat unhinged idea that only a battle-hardened and brain-damaged individual who has spent inordinate amounts of time in the Gungeon could have concocted. Trorc happens to match all of those criteria, and perhaps unsurpringly, bulletproof tablecloths are his brain child. They're apparently popular enough for Trorc to continue selling them, and for what it's worth, they do their job extremely well...but does that job really need doing?"; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)3; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)3, 1f); } } public class DrabOutfit : CwaffPassive { [HarmonyPatch(typeof(FloorRewardData), "DetermineCurrentMagnificence")] private class DrabOutfitPatch { private static bool Prefix(bool isGenerationForMagnificence, ref float __result) { if (!Lazy.AnyoneHas()) { return true; } __result = 0f; return false; } } public static string ItemName = "Drab Outfit"; public static string ShortDescription = "Completely Unremarkable"; public static string LongDescription = "Sets Magnificence stat to 0 while in inventory, increasing the frequency of red and black chest spawns."; public static string Lore = "This garment seems to go slightly out of its way to be as plain and boring as possible. It does not go completely out of its way, however, as that would actually make it notable in some sense. Which it certainly isn't."; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)1; ((PickupObject)(object)obj).AddToShop(ModdedShopType.Rusty); } } public class CatEarHeadband : CwaffPassive { [CompilerGenerated] private sealed class <g__BreakStealth_CR|10_0>d : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public CatEarHeadband <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <g__BreakStealth_CR|10_0>d(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown int num = <>1__state; CatEarHeadband catEarHeadband = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(3f); <>1__state = 1; return true; case 1: <>1__state = -1; catEarHeadband.BreakStealth(((PassiveItem)catEarHeadband).Owner); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static string ItemName = "Cat Ear Headband"; public static string ShortDescription = "Stealthy Entrances"; public static string LongDescription = "Gain 3 seconds of light stealth upon entering combat. Cannot steal or sneak attack while lightly stealthed."; public static string Lore = "Wearing these headbands for extended periods has been shown to cause increasingly severe side effects over time. These typically start with a propensity for curling your hands and uttering the occasional meow, but eventually culminate in forgetting to put on clothes in the morning and spending 6-12 hours a day in front of a webcam periodically checking that your undergarments are still intact."; internal const float _STEALTH_TIME = 3f; private bool _stealthedEntrance; public static void Init() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) ((PickupObject)Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore)).quality = (ItemQuality)3; } public override void Pickup(PlayerController player) { base.Pickup(player); player.OnEnteredCombat = (Action)Delegate.Combine(player.OnEnteredCombat, new Action(OnEnteredCombat)); } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { player.OnEnteredCombat = (Action)Delegate.Remove(player.OnEnteredCombat, new Action(OnEnteredCombat)); } } private void OnEnteredCombat() { if (!_stealthedEntrance) { BecomeInvisible(); } } private void BecomeInvisible() { //IL_0071: Unknown result type (might be due to invalid IL or missing references) ((PassiveItem)this).Owner.OnDidUnstealthyAction += BreakStealth; ((GameActor)((PassiveItem)this).Owner).SetIsStealthed(true, "CatEarHeadband"); _stealthedEntrance = true; Material[] array = ((PassiveItem)this).Owner.SetOverrideShader(ShaderCache.Acquire("Brave/Internal/HighPriestAfterImage")); foreach (Material obj in array) { obj.SetFloat(CwaffVFX._EmissivePowerId, 0f); obj.SetFloat("_Opacity", 0.5f); obj.SetColor("_DashColor", Color.gray); } ((MonoBehaviour)((PassiveItem)this).Owner).StartCoroutine(BreakStealth_CR()); IEnumerator BreakStealth_CR() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <g__BreakStealth_CR|10_0>d(0) { <>4__this = this }; } } private void BreakStealth(PlayerController pc) { if (!((Object)(object)((PassiveItem)this).Owner != (Object)(object)pc) && _stealthedEntrance) { ((PassiveItem)this).Owner.ClearOverrideShader(); _stealthedEntrance = false; ((GameActor)((PassiveItem)this).Owner).SetIsStealthed(false, "CatEarHeadband"); ((PassiveItem)this).Owner.OnDidUnstealthyAction -= BreakStealth; } } } public class FourDBullets : CwaffPassive { public static string ItemName = "4D Bullets"; public static string ShortDescription = "No-Clipping Clips"; public static string LongDescription = "Bullets can phase through the inner walls of a room, but lose 1/3 of their power after phasing."; public static string Lore = "Wall hacks are almost universally despised for the completely one-sided advantage they give to those who possess them. Although most Gungeoneers aren't concerned for the Gundead's feelings, wall hacks also unfortunately don't exist in the real world. Historical attempts to create guns and gadgets that emulate wall hacks have generally ended in the loss of lives and, in some extreme cases, the loss of some pretty nice guns. The latest generation of technology has at least partially succeeded in emulating wall hacks by augmenting guns to shoot bullets into the 4th dimension. However, due to most Gungeoneers' inability to see said 4th dimension, their bullets tend to ricochet off walls in 4D space, losing a lot of their oomph in the process."; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)4; ((PickupObject)(object)obj).AddToShop(ModdedShopType.TimeTrader); ((PickupObject)(object)obj).AddToShop(ModdedShopType.Doug); } public override void Pickup(PlayerController player) { base.Pickup(player); player.PostProcessProjectile += PostProcessProjectile; } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { player.PostProcessProjectile -= PostProcessProjectile; } } private void PostProcessProjectile(Projectile proj, float effectChanceScalar) { if (Object.op_Implicit((Object)(object)((PassiveItem)this).Owner)) { ((Component)proj).gameObject.AddComponent(); } } } public class PhaseThroughInnerWallsBehavior : MonoBehaviour { private const float _PHASE_DAMAGE_SCALING = 0.667f; private const float _ROOM_BORDER_WIDTH = 1f; private const float _LENIENCE = 0.5f; private const float _INSET = 1.5f; private Projectile _projectile; private PlayerController _owner; private RoomHandler _startingRoom; private bool _phased; private void Start() { //IL_002e: 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_005f: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown _projectile = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); _startingRoom = Vector3Extensions.GetAbsoluteRoom(((BraveBehaviour)_projectile).transform.position); SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody.OnPreTileCollision = (OnPreTileCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreTileCollision, (Delegate?)new OnPreTileCollisionDelegate(OnPreTileCollision)); } private void OnPreTileCollision(SpeculativeRigidbody me, PixelCollider myPixelCollider, Tile other, PixelCollider otherPixelCollider) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0033: 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 (Vector3Extensions.GetAbsoluteRoom(((BraveBehaviour)_projectile).transform.position) != _startingRoom) { return; } Rect val = _startingRoom.GetBoundingRect().Inset(1.5f); if (!((Rect)(ref val)).Contains(((BraveBehaviour)_projectile).transform.position)) { return; } PhysicsEngine.SkipCollision = true; if (!_phased) { _phased = true; if (Object.op_Implicit((Object)(object)_owner) && !_owner.HasSynergy(Synergy.PROJECTING_MUCH)) { ProjectileData baseData = _projectile.baseData; baseData.damage *= 0.667f; } tk2dBaseSprite sprite = ((BraveBehaviour)_projectile).sprite; if (sprite != null) { sprite.usesOverrideMaterial = true; ((BraveBehaviour)sprite).renderer.material.shader = ShaderCache.Acquire("Brave/Internal/HologramShader"); } ((Component)this).gameObject.PlayUnique("phase_through_wall_sound"); } } } public class WeddingRing : CwaffPassive { public static string ItemName = "Wedding Ring"; public static string ShortDescription = "Commitment"; public static string LongDescription = "Every enemy killed without switching guns grants 1% boosts to damage, reload speed, and chance not to consume ammo, up to a maximum of 50% each. Boosts are reset upon firing another gun."; public static string Lore = "Whether it is legal and/or ethical to marry a gun has been the topic of a surprising number of conversations in the Breach and the Gungeon, with the general consensus seeming to be: \"well...um...probably, yes, but it's weird as heck!\" Regardless of its legality, ethics, or sanity, more than one Gungeoneer has slapped a wedding ring on their favorite gun. And whether attributable to the placebo effect, madness, or empirical results, these gunnymooners have reported that their loyalty brings out the best in both them and their guns."; private const float _BONUS_PER_KILL = 0.01f; private const float _MAX_BONUS = 1.5f; private int _committedGunId = -1; private float _commitmentMult = 1f; private int _lastKnownAmmo; private bool _refundAmmo; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)2; ((PickupObject)(object)obj).AddToShop(ModdedShopType.Rusty); obj.passiveStatModifiers = (StatModifier[])(object)new StatModifier[3] { ((StatType)10).Mult(1f), ((StatType)5).Mult(1f), ((StatType)22).Mult(1f) }; } public override void Pickup(PlayerController player) { base.Pickup(player); player.OnPreFireProjectileModifier = (Func)Delegate.Combine(player.OnPreFireProjectileModifier, new Func(ChanceToRefundAmmo)); player.PostProcessProjectile += PostProcessProjectile; player.OnKilledEnemy += OnKilledEnemy; } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { player.OnKilledEnemy -= OnKilledEnemy; player.PostProcessProjectile -= PostProcessProjectile; player.OnPreFireProjectileModifier = (Func)Delegate.Remove(player.OnPreFireProjectileModifier, new Func(ChanceToRefundAmmo)); UpdateCommitmentStats(player, reset: true); } } private void UpdateCommitmentStats(PlayerController player, bool reset = false) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Invalid comparison between Unknown and I4 _commitmentMult = (reset ? 1f : Mathf.Min(_commitmentMult + 0.01f, 1.5f)); StatModifier[] passiveStatModifiers = ((PassiveItem)this).passiveStatModifiers; foreach (StatModifier obj in passiveStatModifiers) { obj.amount = (((int)obj.statToBoost == 10) ? (1f / _commitmentMult) : _commitmentMult); } player.stats.RecalculateStats(player, false, false); } private void OnKilledEnemy(PlayerController player) { UpdateCommitmentStats(player); } private Projectile ChanceToRefundAmmo(Gun gun, Projectile projectile) { _refundAmmo = Random.value < _commitmentMult - 1f; _lastKnownAmmo = ((GameActor)((PassiveItem)this).Owner).CurrentGun.CurrentAmmo; return projectile; } private void PostProcessProjectile(Projectile proj, float effectChanceScalar) { PlayerController owner = ((PassiveItem)this).Owner; if (owner != null && ((PickupObject)((GameActor)owner).CurrentGun).PickupObjectId != _committedGunId) { UpdateCommitmentStats(owner, reset: true); _committedGunId = ((PickupObject)((GameActor)owner).CurrentGun).PickupObjectId; _refundAmmo = false; } } private void LateUpdate() { if (_refundAmmo && Object.op_Implicit((Object)(object)((PassiveItem)this).Owner) && Object.op_Implicit((Object)(object)((GameActor)((PassiveItem)this).Owner).CurrentGun)) { _refundAmmo = false; ((GameActor)((PassiveItem)this).Owner).CurrentGun.CurrentAmmo = _lastKnownAmmo; } } public override void MidGameSerialize(List data) { ((PickupObject)this).MidGameSerialize(data); data.Add(_committedGunId); data.Add(_commitmentMult); data.Add(_lastKnownAmmo); } public override void MidGameDeserialize(List data) { ((PassiveItem)this).MidGameDeserialize(data); _committedGunId = (int)data[0]; _commitmentMult = (float)data[1]; _lastKnownAmmo = (int)data[2]; } } public class ReflexAmmolet : CwaffBlankModificationItem { [HarmonyPatch(typeof(SilencerInstance), "TriggerSilencer")] private class ReflexAmmoletReflectPatch { private static bool BlankShouldReflect(bool orig, PlayerController user) { if (!orig) { return user.HasPassive(); } return true; } [HarmonyILManipulator] private static void ReflexAmmoletIL(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int user = 0; if (val.TryGotoNext((MoveType)2, new Func[4] { (Instruction instr) => ILPatternMatchingExt.MatchLdarg(instr, ref user), (Instruction instr) => ILPatternMatchingExt.MatchLdcI4(instr, 383), (Instruction instr) => ILPatternMatchingExt.MatchLdcI4(instr, 0), (Instruction instr) => ILPatternMatchingExt.MatchCallvirt(instr, "HasActiveBonusSynergy") })) { val.Emit(OpCodes.Ldarg, user); val.CallPrivate(typeof(ReflexAmmoletReflectPatch), "BlankShouldReflect"); } } } [HarmonyPatch(typeof(SilencerInstance), "DestroyBulletsInRange")] private class ReflexAmmoletSpeedPatch { private static float ReflectSpeed(float orig, PlayerController user) { if (!user.HasPassive()) { return orig; } return 50f; } [HarmonyILManipulator] private static void ReflexAmmoletIL(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int user = 0; if (val.TryGotoNext((MoveType)0, new Func[6] { (Instruction instr) => ILPatternMatchingExt.MatchLdarg(instr, ref user), (Instruction instr) => ILPatternMatchingExt.MatchLdcR4(instr, 10f), (Instruction instr) => ILPatternMatchingExt.MatchLdcR4(instr, 1f), (Instruction instr) => ILPatternMatchingExt.MatchLdcR4(instr, 1f), (Instruction instr) => ILPatternMatchingExt.MatchLdcR4(instr, 0f), (Instruction instr) => ILPatternMatchingExt.MatchCall(instr, "ReflectBullet") })) { val.Index += 2; val.Emit(OpCodes.Ldarg, user); val.CallPrivate(typeof(ReflexAmmoletSpeedPatch), "ReflectSpeed"); } } } public static string ItemName = "Reflex Ammolet"; public static string ShortDescription = "Blanks Return Fire"; public static string LongDescription = "Blanks reflect projectiles back towards their respective nearest enemies. Grants 1 additional blank per floor."; public static string Lore = "Blanks are useful from a defensive perspective, but destroying projectiles is unnecessarily wasteful when you stop to think about it. Straight from ACNE Corporation's Ammolet Division's Sustainability Subdivision, the patent-pending Reflex Ammolet does away with unnecessary projectile waste, and instead lets you *lay waste* to your enemies with their own projectiles."; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore, hideFromAmmonomicon: false, 1f); ((PickupObject)obj).quality = (ItemQuality)3; ItemBuilder.AddPassiveStatModifier((PickupObject)(object)obj, (StatType)18, 1f, (ModifyMethod)0); ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)4, 1f); } } public class VoodooDoll : CwaffPassive { public static string ItemName = "Voodoo Doll"; public static string ShortDescription = "Pew Pew Unto Others"; public static string LongDescription = "Whenever a player-owned projectile hits an enemy, all other enemies of the same type take damage."; public static string Lore = "There are actually two types of voodoo dolls. Traditional voodoo dolls are created in the likeness of a single, specific individual, and doing physical damage to the doll inflicts equivalent physical damage to the individual it depicts. By contrast, the dolls found in the Gungeon depict an unknown figure smiling in the face of life's hardships, motivating the Gundead to do their best. Upon seeing their peers struggle, this motivation is promptly shattered, inflicting (arguably more powerful) emotional damage instead."; private static bool _VoodooDollEffectHappening = false; internal static GameObject _VoodooGhostVFX; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)4; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)2, 1f); _VoodooGhostVFX = VFX.Create("voodoo_ghost", 2f, loops: true, -1, 0.5f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } public override void Pickup(PlayerController player) { base.Pickup(player); player.OnDealtDamageContext += OnDealtDamage; } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { player.OnDealtDamageContext -= OnDealtDamage; } } private void OnDealtDamage(PlayerController source, float damage, bool fatal, HealthHaver enemy) { if (!_VoodooDollEffectHappening && Object.op_Implicit((Object)(object)enemy) && Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).aiActor) && ((BraveBehaviour)enemy).aiActor.IsHostile(canBeDead: true)) { _VoodooDollEffectHappening = true; DoVoodooDollEffect(damage, enemy); _VoodooDollEffectHappening = false; } } private void DoVoodooDollEffect(float damage, HealthHaver enemy) { //IL_0097: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_00e7: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)enemy) || !Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).aiActor)) { return; } List list = ((DungeonPlaceableBehaviour)((BraveBehaviour)enemy).aiActor).GetAbsoluteParentRoom().SafeGetEnemiesInRoom(); string enemyGuid = ((BraveBehaviour)enemy).aiActor.EnemyGuid; for (int num = list.Count - 1; num >= 0; num--) { AIActor val = list[num]; if (Object.op_Implicit((Object)(object)val) && val.IsHostileAndNotABoss() && !(val.EnemyGuid != enemyGuid) && !((Object)(object)val == (Object)(object)((BraveBehaviour)enemy).aiActor)) { if (Object.op_Implicit((Object)(object)((BraveBehaviour)val).healthHaver)) { ((BraveBehaviour)val).healthHaver.ApplyDamage(damage, Vector2.zero, "Voodoo Doll", (CoreDamageTypes)2, (DamageCategory)5, true, (PixelCollider)null, false); } if (Object.op_Implicit((Object)(object)((BraveBehaviour)val).sprite)) { bool flag = Lazy.CoinFlip(); Vector2 val2 = (flag ? ((BraveBehaviour)val).sprite.WorldTopRight : ((BraveBehaviour)val).sprite.WorldTopLeft); GameObject voodooGhostVFX = _VoodooGhostVFX; Vector3 position = Vector2.op_Implicit(val2); float? fadeOutTime = 0.4f; bool flipX = flag; CwaffVFX.Spawn(voodooGhostVFX, position, null, null, 0.4f, fadeOutTime, 0f, null, fadeIn: false, null, null, null, randomFrame: false, -1, flipX); } } } } } public class MMAiming : CwaffPassive { public static string ItemName = "MM: Aiming"; public static string ShortDescription = "Chapter 2"; public static string LongDescription = "Spread is reduced by 50% while standing still."; public static string Lore = "Every Gungeoneer seems to believe they can fend off the Gundead by just running around guns akimbo, and their occasional successes do nothing to dissuade these Rambo wannabes from poor shooting form. As outlined in the Aiming chapter of Manuel's Manual, an ancient technique known as 'standing still and taking the time to look where you are shooting' can dramatically improve any arms-bearer's accuracy in the heat of battle."; private const float _SPREAD_FACTOR = 0.5f; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)2; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)3, 1f); } internal static float ModifySpreadIfIdle(float oldSpread, PlayerController player) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) Vector2 vector = ((TwoAxisInputControl)player.m_activeActions.Move).Vector; if (((Vector2)(ref vector)).sqrMagnitude > 0.1f || !player.HasPassive()) { return oldSpread; } return 0.5f * oldSpread; } } public class BionicFinger : CwaffPassive { [HarmonyPatch(typeof(PlayerController), "HandleGunFiringInternal")] private class RemoveSemiAutoCooldownPatch { [HarmonyILManipulator] private static void HandleGunFiringInternalIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchCall(instr, "get_ControllerFakeSemiAutoCooldown") })) { val.Emit(OpCodes.Ldarg_0); val.CallPrivate(typeof(BionicFinger), "OverrideSemiAutoCooldown"); } } } public static string ItemName = "Bionic Finger"; public static string ShortDescription = "Trigger Happiest"; public static string LongDescription = "Allows semi-automatic weapons to automatically fire at their maximum manual fire rate."; public static string Lore = "The latest and greatest in cyborg prosthetic technology. In addition to negating one of the only downsides of using semi-automatic weaponry, this finger has the added benefit of reducing the incidence rate of carpal tunnel syndrome and repetitive wrist strain among arms-bearers, making it a must-have for both the health-conscious and the lazy alike."; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)2; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)3, 1f); ((PickupObject)(object)obj).AddToShop(ModdedShopType.Rusty); ((PickupObject)(object)obj).AddToShop(ModdedShopType.Handy); } private static float OverrideSemiAutoCooldown(float oldCooldown, PlayerController pc) { if (!pc.HasPassive()) { return oldCooldown; } return 0f; } internal static float ModifySpreadIfSemiautomatic(float oldSpread, PlayerController player) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)((GameActor)player).CurrentGun) || (int)((GameActor)player).CurrentGun.DefaultModule.shootStyle != 0) { return oldSpread; } if (!player.HasSynergy(Synergy.AIM_BOTS)) { return oldSpread; } return 0f; } } public class UtilityVest : CwaffPassive { public static string ItemName = "Utility Vest"; public static string ShortDescription = "Pocket Protector"; public static string LongDescription = "When taking otherwise fatal damage, destroys the least valuable item in the player's inventory instead."; public static string Lore = "Most Gungeoneers opt to bring the R&G department's classic Bag-O'-Holding model for stashing the ludicrous amount of guns and gear they accrue across the Gungeon's many floors. Although being able to carry an unlimited amount of items is already a pretty sweet deal, this latest evolution in hammerspace techno-magic automatically deploys your loot in the precise location that would block mortally-wounding projectiles. Reception to this model has been mixed, with Gungeoneers who prefer preserving their loot over their lives or vice versa being split 50-50."; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)2; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)3, 1f); ((PickupObject)(object)obj).AddToShop(ModdedShopType.Ironside); } public override void Pickup(PlayerController player) { base.Pickup(player); HealthHaver healthHaver = ((BraveBehaviour)player).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Combine(healthHaver.ModifyDamage, new Action(OnTakeDamage)); } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { HealthHaver healthHaver = ((BraveBehaviour)player).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Remove(healthHaver.ModifyDamage, new Action(OnTakeDamage)); } } private void OnTakeDamage(HealthHaver hh, ModifyDamageEventArgs data) { if (hh.PlayerWillDieFromHit(data)) { PickupObject worstItemWeCanScrapAsArmor = GetWorstItemWeCanScrapAsArmor(); if (worstItemWeCanScrapAsArmor != null) { UsedItemAsArmor(worstItemWeCanScrapAsArmor); data.ModifiedDamage = 0f; } } } private void UsedItemAsArmor(PickupObject item) { //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_0076: Unknown result type (might be due to invalid IL or missing references) ((Component)((PassiveItem)this).Owner).gameObject.Play("sentry_shoot"); ((PassiveItem)this).Owner.ForceBlank(25f, 0.5f, false, true, (Vector2?)null, true, -1f); ((BraveBehaviour)((PassiveItem)this).Owner).healthHaver.TriggerInvulnerabilityPeriod(-1f); DebrisObject obj = Lazy.MakeDebrisFromSprite(((BraveBehaviour)item).sprite, Vector2.op_Implicit(((GameActor)((PassiveItem)this).Owner).CenterPosition), (Vector2?)new Vector2(4f, 4f), (float?)null); obj.doesDecay = true; obj.decayOnBounce = 0.5f; obj.bounceCount = 1; obj.breaksOnFall = true; obj.canRotate = true; ((MonoBehaviour)obj).StartCoroutine(Lazy.DecayOverTime(obj, 2f)); Gun val = (Gun)(object)((item is Gun) ? item : null); if (val != null) { val.HasEverBeenAcquiredByPlayer = true; ((PassiveItem)this).Owner.inventory.RemoveGunFromInventory(val); val.ToggleRenderers(true); Object.Destroy((Object)(object)((Component)val.DropGun(0.5f)).gameObject); return; } PassiveItem val2 = (PassiveItem)(object)((item is PassiveItem) ? item : null); if (val2 != null) { Object.Destroy((Object)(object)((Component)((PassiveItem)this).Owner.DropPassiveItem(val2)).gameObject); return; } PlayerItem val3 = (PlayerItem)(object)((item is PlayerItem) ? item : null); if (val3 != null) { Object.Destroy((Object)(object)((Component)((PassiveItem)this).Owner.DropActiveItem(val3, 4f, false)).gameObject); } } private static float GetItemArmorPriority(PickupObject item, PlayerController owner) { //IL_0033: 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) //IL_0039: 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_0055: Expected I4, but got Unknown if (!item.CanActuallyBeDropped(owner)) { return -1f; } if (item.PickupObjectId == Lazy.PickupId()) { return 0f; } if (item.PickupObjectId == 127) { return 6f; } ItemQuality quality = item.quality; float num; switch (quality - 1) { case 4: num = 1f; break; case 3: num = 2f; break; case 2: num = 3f; break; case 1: num = 4f; break; case 0: num = 5f; break; default: return -1f; } Gun val = (Gun)(object)((item is Gun) ? item : null); if (val != null) { return num + ((val.CurrentAmmo == 0) ? 0.5f : 0f); } return num; } private PickupObject GetWorstItemWeCanScrapAsArmor() { float num = -1f; PickupObject result = null; foreach (PickupObject item in ((PassiveItem)this).Owner.AllItems()) { float itemArmorPriority = GetItemArmorPriority(item, ((PassiveItem)this).Owner); if (!(itemArmorPriority <= num)) { result = item; num = itemArmorPriority; } } return result; } } public class SuperColdWatch : CwaffPassive { public static string ItemName = "Super Cold Watch"; public static string ShortDescription = "Time Moves As You...Don't?"; public static string LongDescription = "All other objects gradually slow down as the player moves, down to a minimum of 1/8 their normal speed. Standing still or dodge rolling will reset time to its normal speed."; public static string Lore = "A Super Hot Watch that was left to cool off in the Hollow for far too long. You feel an otherworldly coldness and stillness in the air around you as you hold it, comparable to being permanently stuck in the moment of complete silence after telling a poorly received joke at a funeral."; private const float _BUILDUP_TIME = 5f; private const float _MAX_TIMESCALE_REDUCTION = 0.875f; private bool _active; private float _activeTime; private float _effectStrength; private StatModifier[] _statModifiers; public static void Init() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) ((PickupObject)Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore)).quality = (ItemQuality)5; } private void UpdateStats() { _effectStrength = 0.875f * Ease.OutQuad(Mathf.Clamp01(_activeTime / 5f)); if (_statModifiers == null) { _statModifiers = (StatModifier[])(object)new StatModifier[3] { ((StatType)1).Mult(1f), ((StatType)0).Mult(1f), ((StatType)10).Mult(1f) }; } float num = 1f - _effectStrength; float num2 = 1f / num; _statModifiers[0].amount = num2; _statModifiers[1].amount = num2; _statModifiers[2].amount = num; ((PassiveItem)this).passiveStatModifiers = _statModifiers; if (Object.op_Implicit((Object)(object)((PassiveItem)this).m_owner)) { VolleyRebuildHelpers.RecalculateStatsWithoutRebuildingGunVolleys(((PassiveItem)this).m_owner.stats, ((PassiveItem)this).m_owner); tk2dSpriteAnimator spriteAnimator = ((BraveBehaviour)((PassiveItem)this).m_owner).spriteAnimator; if (spriteAnimator != null) { spriteAnimator.OverrideTimeScale = num2; } } } public override void Update() { //IL_003c: 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_004f: Invalid comparison between Unknown and I4 ((PassiveItem)this).Update(); _ = Time.realtimeSinceStartup; if (!((PassiveItem)this).m_pickedUp || GameManager.Instance.IsLoadingLevel || !Object.op_Implicit((Object)(object)((PassiveItem)this).m_owner) || ((int)((PassiveItem)this).m_owner.CurrentInputState != 0 && (int)((PassiveItem)this).m_owner.CurrentInputState != 2) || ((GameActor)((PassiveItem)this).m_owner).IsFalling || ((PassiveItem)this).m_owner.IsDodgeRolling || !Object.op_Implicit((Object)(object)((BraveBehaviour)((PassiveItem)this).m_owner).healthHaver) || ((BraveBehaviour)((PassiveItem)this).m_owner).healthHaver.IsDead || !Object.op_Implicit((Object)(object)((BraveBehaviour)((PassiveItem)this).m_owner).specRigidbody) || !(((Vector2)(ref ((BraveBehaviour)((PassiveItem)this).m_owner).specRigidbody.Velocity)).sqrMagnitude > 0.01f)) { if (_active) { _activeTime = 0f; _effectStrength = 0f; BraveTime.ClearMultiplier(((Component)this).gameObject); UpdateStats(); _active = false; } } else { _activeTime += Time.deltaTime; UpdateStats(); BraveTime.SetTimeScaleMultiplier(1f - _effectStrength, ((Component)this).gameObject); _active = true; } } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { tk2dSpriteAnimator spriteAnimator = ((BraveBehaviour)player).spriteAnimator; if (spriteAnimator != null) { spriteAnimator.OverrideTimeScale = 1f; } } } } public class SafetyGloves : CwaffPassive { public static string ItemName = "Safety Gloves"; public static string ShortDescription = "Handling with Care"; public static string LongDescription = "Pressing interact near most Bullet Kin variants instantly defeats them and restores 10% ammo to the current gun."; public static string Lore = "Bullet Kin, despite being animated by the magic of the Gungeon, are still just ammunition at the end of the day, and the only thing preventing them from being used as such is the difficulty of getting near them and grabbing hold of them. A sturdy enough glove will solve exactly one of those issues, so by extension, two such gloves should solve both of those issues."; private const float _REACH = 3f; private const float _REACH_SQR = 9f; private static GameObject _HandlingVFX; private GameObject _extantVfx; private bool _shouldClearVfx; public static void Init() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) ((PickupObject)Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore)).quality = (ItemQuality)2; _HandlingVFX = VFX.Create("safety_gloves_vfx", 2f, loops: true, -1, 1f, (Anchor)1, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } public override void Update() { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) ((PassiveItem)this).Update(); if (!GameManager.HasInstance || GameManager.Instance.IsLoadingLevel || GameManager.IsReturningToBreach) { return; } if ((Object)(object)_extantVfx != (Object)null && _shouldClearVfx) { Object.Destroy((Object)(object)_extantVfx); _extantVfx = null; } _shouldClearVfx = true; PlayerController owner = ((PassiveItem)this).Owner; if (owner == null || owner.IsPetting || owner.IsDodgeRolling || owner.m_handlingQueuedAnimation) { return; } Gun currentGun = ((GameActor)owner).CurrentGun; if (currentGun == null || !currentGun.CanGainAmmo || currentGun.InfiniteAmmo || currentGun.LocalInfiniteAmmo || currentGun.CurrentAmmo == currentGun.AdjustedMaxAmmo) { return; } RoomHandler absoluteParentRoom = ((DungeonPlaceableBehaviour)owner).GetAbsoluteParentRoom(); if (absoluteParentRoom == null) { return; } Vector2 centerPosition = ((GameActor)owner).CenterPosition; float currentGunAngle = owner.m_currentGunAngle; AIActor val = null; float num = 9f; foreach (AIActor item in absoluteParentRoom.SafeGetEnemiesInRoom()) { if (!Object.op_Implicit((Object)(object)item) || !Enemies.BulletKinVariants.Contains(item.EnemyGuid)) { continue; } Vector2 v = ((GameActor)item).CenterPosition - centerPosition; if (v.IsNearAngle(currentGunAngle, 90f)) { float sqrMagnitude = ((Vector2)(ref v)).sqrMagnitude; if (!(sqrMagnitude >= num)) { val = item; num = sqrMagnitude; } } } if (!Object.op_Implicit((Object)(object)val)) { return; } if (owner.m_activeActions == null || !((OneAxisInputControl)owner.m_activeActions.InteractAction).WasPressed) { _shouldClearVfx = false; Vector2 pos = (((Object)(object)((BraveBehaviour)val).sprite != (Object)null) ? ((BraveBehaviour)val).sprite.WorldTopCenter : ((GameActor)val).CenterPosition); if (!Object.op_Implicit((Object)(object)_extantVfx)) { _extantVfx = SpawnManager.SpawnVFX(_HandlingVFX, false); } _extantVfx.transform.position = Vector2.op_Implicit(pos.HoverAt(0.25f, 10f, 0.5f)); } else { _extantVfx.SafeDestroy(); _extantVfx = null; val.DuplicateInWorld().ArcTowards(0.5f, ((BraveBehaviour)owner).sprite, useBottom: false, 0.1f, 1f); ((Component)owner).gameObject.Play("safety_glove_grab_sound"); ((Component)val).gameObject.Play("Play_ENM_Death"); val.EraseFromExistence(true); currentGun.GainAmmo(currentGun.AdjustedMaxAmmo / 10); } } } public class Blazer : CwaffPassive { [CompilerGenerated] private sealed class <g__RemoveBoosts_CR|12_0>d : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Blazer <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <g__RemoveBoosts_CR|12_0>d(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown int num = <>1__state; Blazer blazer = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(3f); <>1__state = 1; return true; case 1: <>1__state = -1; if (Object.op_Implicit((Object)(object)((PassiveItem)blazer).Owner)) { blazer.RemoveBoosts(((PassiveItem)blazer).Owner); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static string ItemName = "Blazer"; public static string ShortDescription = "Get 'em While It's Hot"; public static string LongDescription = "Fire rate, charge time, and reload speed are doubled for 3 seconds upon entering combat."; public static string Lore = "A simple yet timeless garment, its light weight, loose fit, and hot palette get office managers and Gungeoneers alike in the mood for taking care of business as soon as they walk into a room."; internal const float _BOOST_TIME = 3f; internal static StatModifier[] _Boosts = null; internal static StatModifier[] _NoBoosts = (StatModifier[])(object)new StatModifier[0]; private bool _boostedEntrance; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)4; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)3, 1f); _Boosts = (StatModifier[])(object)new StatModifier[3] { ((StatType)1).Mult(2f), ((StatType)10).Mult(0.5f), ((StatType)25).Mult(2f) }; } public override void Pickup(PlayerController player) { ((PassiveItem)this).passiveStatModifiers = _NoBoosts; base.Pickup(player); player.OnEnteredCombat = (Action)Delegate.Combine(player.OnEnteredCombat, new Action(OnEnteredCombat)); } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { player.OnEnteredCombat = (Action)Delegate.Remove(player.OnEnteredCombat, new Action(OnEnteredCombat)); RemoveBoosts(player); } } private void OnEnteredCombat() { if (!_boostedEntrance) { BoostStats(); } } private void BoostStats() { _boostedEntrance = true; ((PassiveItem)this).passiveStatModifiers = _Boosts; ((PassiveItem)this).Owner.stats.RecalculateStats(((PassiveItem)this).Owner, false, false); ((MonoBehaviour)((PassiveItem)this).Owner).StartCoroutine(RemoveBoosts_CR()); IEnumerator RemoveBoosts_CR() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <g__RemoveBoosts_CR|12_0>d(0) { <>4__this = this }; } } private void RemoveBoosts(PlayerController pc) { if (!((Object)(object)((PassiveItem)this).Owner != (Object)(object)pc) && _boostedEntrance) { ((PassiveItem)this).passiveStatModifiers = _NoBoosts; ((PassiveItem)this).Owner.stats.RecalculateStats(((PassiveItem)this).Owner, false, false); _boostedEntrance = false; } } } public class AdrenalineShot : CwaffPassive { public static string ItemName = "Adrenaline Shot"; public static string ShortDescription = "Just a Little Longer"; public static string LongDescription = "Upon taking fatal damage, the player is put in a critical 0-health state and has 60 seconds to restore at least half a heart or exit the current floor. Taking any damage in this state decreases the countdown by 4 seconds. This item cannot be used by the Robot or other 0-health characters, and gives 20 casings instead."; public static string Lore = "This otherwise normal-looking epinephrine injector has approximately 5 times the doctor-approved amount of adrenaline deemed necessary for your everyday anaphylaxis. While there's no telling what kinds of long-term effects that much adrenaline might have on your health, it's reasonable to assume it probably won't be worse than the short-term effects of having your vital organs punctured by bullets...probably."; internal const float _MAX_RUSH_TIME = 90f; internal const float _MAX_ADRENALINE_TIME = 60f; internal const float _MAX_ADRENALINE_LOSS = 4f; internal const int _CASINGS_FOR_ROBOT = 20; internal static float _LastHeartbeatTime = 0f; internal bool _adrenalineActive; private float _adrenalineTimer = 60f; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)2; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)3, 1f); } public override void OnFirstPickup(PlayerController player) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (player.ForceZeroHealthState) { LootEngine.SpawnCurrency(((GameActor)player).CenterPosition, 20, false); } } public override void Pickup(PlayerController player) { base.Pickup(player); if (!player.ForceZeroHealthState) { HealthHaver healthHaver = ((BraveBehaviour)player).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Combine(healthHaver.ModifyDamage, new Action(OnTakeDamage)); } } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { if (_adrenalineActive) { DeactivateAdrenaline(); } if (!player.ForceZeroHealthState) { HealthHaver healthHaver = ((BraveBehaviour)player).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Remove(healthHaver.ModifyDamage, new Action(OnTakeDamage)); } } } public override void Update() { //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown //IL_0135: Unknown result type (might be due to invalid IL or missing references) ((PassiveItem)this).Update(); if (!Object.op_Implicit((Object)(object)((PassiveItem)this).Owner) || !_adrenalineActive) { return; } if (GameManager.Instance.IsLoadingLevel) { DeactivateAdrenaline(); } else if (!GameManager.Instance.IsPaused && ((PassiveItem)this).Owner.AcceptingNonMotionInput) { _adrenalineTimer -= BraveTime.DeltaTime; float adrenalineTimer = _adrenalineTimer; float num = ((adrenalineTimer > 30f) ? 2f : ((adrenalineTimer > 10f) ? 1f : ((!(adrenalineTimer > 3f)) ? 0.25f : 0.5f))); float num2 = num; if (BraveTime.ScaledTimeSinceStartup - _LastHeartbeatTime > num2) { _LastHeartbeatTime = BraveTime.ScaledTimeSinceStartup; ((Component)((PassiveItem)this).Owner).gameObject.Play("heartbeat"); } if (!(_adrenalineTimer > 0f)) { HealthHaver healthHaver = ((BraveBehaviour)((PassiveItem)this).Owner).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Remove(healthHaver.ModifyDamage, new Action(OnTakeDamage)); ((BraveBehaviour)((PassiveItem)this).Owner).healthHaver.OnHealthChanged -= new OnHealthChangedEvent(OnHealthChanged); ((BraveBehaviour)((PassiveItem)this).Owner).healthHaver.ApplyDamage(999f, Vector2.zero, ItemName, (CoreDamageTypes)0, (DamageCategory)5, true, (PixelCollider)null, false); } } } private void OnTakeDamage(HealthHaver hh, ModifyDamageEventArgs data) { if (!hh.PlayerWillDieFromHit(data)) { return; } if (_adrenalineActive) { if (!((PassiveItem)this).Owner.HasSynergy(Synergy.ADRENALINE_RUSH)) { _adrenalineTimer -= 4f; } if (_adrenalineTimer <= 0f) { return; } ((Component)hh).gameObject.Play("adrenaline_tank_damage_sound"); } data.ModifiedDamage = 0f; hh.TriggerInvulnerabilityPeriod(-1f); Lazy.DoDamagedFlash(hh); if (!_adrenalineActive) { ActivateAdrenaline(); } } private void ActivateAdrenaline() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) _adrenalineActive = true; ((PickupObject)this).CanBeDropped = false; ((PickupObject)this).CanBeSold = false; ((Component)((PassiveItem)this).Owner).gameObject.AddComponent(); ((BraveBehaviour)((PassiveItem)this).Owner).healthHaver.ForceSetCurrentHealth(0.5f); ((BraveBehaviour)((PassiveItem)this).Owner).healthHaver.OnHealthChanged += new OnHealthChangedEvent(OnHealthChanged); Color val = Color.Lerp(Color.gray, Color.clear, 0.25f); ((PassiveItem)this).Owner.FlatColorOverridden = true; ((PassiveItem)this).Owner.baseFlatColorOverride = val; ((PassiveItem)this).Owner.ChangeFlatColorOverride(val); ((PassiveItem)this).Owner.DoGenericItemActivation(((BraveBehaviour)this).sprite, "minecraft_totem_pop_sound"); _adrenalineTimer = (((PassiveItem)this).Owner.HasSynergy(Synergy.ADRENALINE_RUSH) ? 90f : 60f); } private void OnHealthChanged(float resultValue, float maxValue) { if (resultValue > 0.5f) { DeactivateAdrenaline(); } } private void DeactivateAdrenaline() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) _adrenalineActive = false; ((PickupObject)this).CanBeDropped = true; ((PickupObject)this).CanBeSold = true; ((BraveBehaviour)((PassiveItem)this).Owner).healthHaver.OnHealthChanged -= new OnHealthChangedEvent(OnHealthChanged); ((BraveBehaviour)((PassiveItem)this).Owner).healthHaver.ForceSetCurrentHealth(Mathf.Max(((BraveBehaviour)((PassiveItem)this).Owner).healthHaver.currentHealth - 0.5f, 0.5f)); ((PassiveItem)this).Owner.baseFlatColorOverride = Color.clear; ((PassiveItem)this).Owner.ChangeFlatColorOverride(Color.clear); ((Component)((PassiveItem)this).Owner).gameObject.Play("adrenaline_deactivate_sound"); Object.Destroy((Object)(object)((Component)((PassiveItem)this).Owner).gameObject.GetComponent()); } } public class UnderAdrenalineEffects : MonoBehaviour { } public class CampingSupplies : CwaffPassive { public static string ItemName = "Camping Supplies"; public static string ShortDescription = "In for the Long Gun"; public static string LongDescription = "Increases damage over time while standing still. Damage boost is reset after moving."; public static string Lore = "Camping has proven time and again to be an effective strategy to any Gungeoneer that has the mental fortitude to endure insults to their skill, their mother, their face, and their mother's face."; private static float[] _CampTimes = new float[4] { 0f, 2f, 5f, 10f }; private static float[] _CampMults = new float[4] { 1f, 1.3f, 1.6f, 1.9f }; private static int _MaxCampLevel = _CampMults.Length - 1; private static GameObject _BonfirePrefab; private static GameObject _SmokePrefab; private static GameObject[] _CampfirePrefabs; private static GameObject[] _SodaCanPrefabs; private const float _MOVEMENT_THRESHOLD = 0.01f; private const float _SODA_CAN_TOSS_CHANCE = 0.003f; private const float _MAX_CAN_THROW_RATE = 1f; private int _campLevel; private float _timeSinceMoving; private GameObject _activeCampfire; private Vector3 _campfirePos = Vector3.zero; private float _lastCanToss; private StatModifier _campMod = ((StatType)5).Mult(1f); public static void Init() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) ((PickupObject)Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore)).quality = (ItemQuality)2; Object obj = ResourceCache.Acquire("Global VFX/VFX_Item_Spawn_Poof"); _SmokePrefab = (GameObject)(object)((obj is GameObject) ? obj : null); PickupObject obj2 = ItemHelper.Get(Items.GunSoul); _BonfirePrefab = ((ExtraLifeItem)((obj2 is ExtraLifeItem) ? obj2 : null)).BonfireSynergyBonfire; _CampfirePrefabs = (GameObject[])(object)new GameObject[4] { VFX.Create("campfire_a", 8f, loops: true, -1, 0.5f, (Anchor)1, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 0.1f), VFX.Create("campfire_b", 8f, loops: true, -1, 0.5f, (Anchor)1, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 0.5f), VFX.Create("campfire_c", 8f, loops: true, -1, 0.5f, (Anchor)1, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 1f), VFX.Create("campfire_d", 8f, loops: true, -1, 0.5f, (Anchor)1, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 2f) }; _SodaCanPrefabs = (GameObject[])(object)new GameObject[3] { VFX.Create("can_of_coke", 2f, loops: true, -1, 0.5f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1), VFX.Create("can_of_pepsi", 2f, loops: true, -1, 0.5f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1), VFX.Create("can_of_sprite", 2f, loops: true, -1, 0.5f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1) }; } public override void OnFirstPickup(PlayerController player) { base.OnFirstPickup(player); ((PassiveItem)this).passiveStatModifiers = (StatModifier[])(object)new StatModifier[1] { _campMod }; } public override void Pickup(PlayerController player) { base.Pickup(player); ResetStats(player); } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { ResetStats(player); } } public override void Update() { //IL_0027: 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) ((PassiveItem)this).Update(); if (!Object.op_Implicit((Object)(object)((PassiveItem)this).Owner)) { return; } if (((PassiveItem)this).Owner.IsInCombat) { Vector2 val = ((GameActor)((PassiveItem)this).Owner).Velocity.ZeroIfNan(); if (((Vector2)(ref val)).magnitude <= 0.01f) { if (_campLevel > 0 && Random.Range(0f, 1f) < 0.003f) { TossASodaCan(); } RecalculateStats(((PassiveItem)this).Owner); return; } } ResetStats(((PassiveItem)this).Owner); } private void ResetStats(PlayerController player) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_activeCampfire)) { TossASodaCan(); DoSmokeAt(_campfirePos); Object.Destroy((Object)(object)_activeCampfire); } _activeCampfire = null; _campfirePos = Vector3.zero; _timeSinceMoving = 0f; _campMod.amount = 1f; ((PassiveItem)this).passiveStatModifiers[0] = _campMod; if (_campLevel > 0) { _campLevel = 0; player.stats.RecalculateStats(player, false, false); } } private void RecalculateStats(PlayerController player) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) if (_campLevel == _MaxCampLevel) { return; } _timeSinceMoving += BraveTime.DeltaTime * (player.HasSynergy(Synergy.COZY_CAMPER) ? 2f : 1f); if (!(_timeSinceMoving < _CampTimes[_campLevel + 1])) { _campLevel++; _campMod.amount = _CampMults[_campLevel]; player.stats.RecalculateStats(player, false, false); if (!Object.op_Implicit((Object)(object)_activeCampfire)) { Vector3 campfirePos = Vector2Extensions.ToVector3ZisY(((GameActor)player).CenterPosition - player.m_currentGunAngle.ToVector(), 1f); _campfirePos = campfirePos; DoSmokeAt(_campfirePos); } else { Object.Destroy((Object)(object)_activeCampfire); } _activeCampfire = SpawnManager.SpawnVFX(_CampfirePrefabs[_campLevel], _campfirePos, Quaternion.identity); } } private void DoSmokeAt(Vector3 pos) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) GameObject smokePrefab = _SmokePrefab; Vector3? position = pos; Anchor? anchor = (Anchor)4; smokePrefab.Instantiate(position, null, anchor); } private void TossASodaCan() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) if (BraveTime.DeltaTime != 0f && !(BraveTime.ScaledTimeSinceStartup - _lastCanToss < 1f)) { _lastCanToss = BraveTime.ScaledTimeSinceStartup; ((Component)((PassiveItem)this).Owner).gameObject.Play("pop_soda_can_sound"); GameObject obj = SpawnManager.SpawnVFX(_SodaCanPrefabs.ChooseRandom(), Vector2.op_Implicit(((GameActor)((PassiveItem)this).Owner).CenterPosition), Quaternion.identity); Vector3 val = Vector2Extensions.ToVector3ZUp(Lazy.RandomVector(5f), Random.Range(1f, 3f)); float num = 1f; DebrisObject orAddComponent = GameObjectExtensions.GetOrAddComponent(obj); orAddComponent.angularVelocity = 180f; orAddComponent.angularVelocityVariance = 180f; orAddComponent.decayOnBounce = 0.5f; orAddComponent.bounceCount = 2; orAddComponent.canRotate = true; orAddComponent.Trigger(val, num, 1f); } } } public class AmmoConservationManual : CwaffPassive { [HarmonyPatch(typeof(AmmoPickup), "Pickup")] private class AmmoConservationManualPatch { private static void Prefix(PlayerController player, ref float __state) { if (((GameActor)player).CurrentGun.InfiniteAmmo || ((GameActor)player).CurrentGun.AdjustedMaxAmmo <= 0) { __state = 0f; } else { __state = (float)((GameActor)player).CurrentGun.CurrentAmmo / (float)((GameActor)player).CurrentGun.AdjustedMaxAmmo; } } private static void Postfix(AmmoPickup __instance, PlayerController player, float __state) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) AmmoConservationManual passive = player.GetPassive(); if (passive != null) { AmmoPickupMode mode = __instance.mode; float num = (((int)mode == 1) ? __state : (((int)mode != 2) ? 0f : Mathf.Max(0f, __state - 0.5f))); float num2 = num; passive._conservedAmmo += 0.5f * num2; if (!(passive._conservedAmmo < 1f)) { passive._conservedAmmo -= 1f; LootEngine.SpawnItem(((Component)ItemHelper.Get(Items.Ammo)).gameObject, Vector2.op_Implicit(((GameActor)player).CenterPosition), Vector2.zero, 0f, true, true, false); } } } } public static string ItemName = "Ammo Conservation Manual"; public static string ShortDescription = "Waste Not, Want Not"; public static string LongDescription = "Picking up any ammo box that would fill the current gun past 100% ammo will conserve half of any overfilled ammo for later. Spawns an extra ammo box for every 100% ammo conserved."; public static string Lore = "The immediate reaction of most unenlightened Gungeoneers upon encountering an ammo box is to dump all of the ammo out of their weapon before replenishing it with the ammo in the box. The pages of this manual are completely blank aside from a single line on the first page that reads 'hey moron, you can just replace the missing ammo and save the rest for later.' Seeing as the manual's a bestseller at the local bookstore, apparently a lot of people needed these words of wisdom."; private const float _PERCENT_AMMO_TO_CONSERVE = 0.5f; private float _conservedAmmo; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)2; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)3, 1f); } public override void MidGameSerialize(List data) { ((PickupObject)this).MidGameSerialize(data); data.Add(_conservedAmmo); } public override void MidGameDeserialize(List data) { ((PassiveItem)this).MidGameDeserialize(data); _conservedAmmo = (float)data[0]; } } public class GoopStabilizer : CwaffPassive { [HarmonyPatch(typeof(GoopDefinition), "GetLifespan")] private class GoopStabilizerPatch { private static void Postfix(GoopDefinition __instance, ref float __result) { if (_AnyoneHasGoopStabilizer) { __result *= 4f; } } } public static string ItemName = "Goop Stabilizer"; public static string ShortDescription = "Probably Non-toxic"; public static string LongDescription = "Quadruples the lifetime of goops."; public static string Lore = "The finest researchers the Gungeon has to offer have spent many sleepless minutes pondering the mechanics of goops. Why do they dissipate so quickly? Why are they so chemically reactive? Is cheese goop safe to eat? Investigations of the latter two questions have all ended in constipation, but a breakthrough in goop stabilization has led to this compound."; private const float _STABILIZATION_MULT = 4f; private static bool _AnyoneHasGoopStabilizer = false; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)1; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)0, 1f); } public override void Pickup(PlayerController player) { base.Pickup(player); PassiveItem.IncrementFlag(player, typeof(GoopStabilizer)); _AnyoneHasGoopStabilizer = true; } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { PassiveItem.DecrementFlag(player, typeof(GoopStabilizer)); } _AnyoneHasGoopStabilizer = PassiveItem.IsFlagSetAtAll(typeof(GoopStabilizer)); } } public class BubbleWand : CwaffPassive { public static string ItemName = "Bubble Wand"; public static string ShortDescription = "Bring It Around Town"; public static string LongDescription = "Upon entering combat, each enemy has a 50% chance of having their held gun replaced with a harmless Bubble Blaster."; public static string Lore = "Bubble blowing is a surprisingly popular pastime among the Gundead -- at least for those who have hands -- yet it is rare for Gungeoneers to actually encounter any Gundead enjoying their bubbles. It is believed that they are rather self-conscious about their below-average bubble-blowing abilities, and that showing a shared interest in their passion might be enough to get some of them to open up a bit more."; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)3; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)0, 1f); } internal static void PostProcessProjectile(Projectile projectile) { projectile.collidesWithEnemies = false; projectile.collidesWithPlayer = false; projectile.UpdateCollisionMask(); } } public class WarriorsGi : CwaffPassive { public static string ItemName = "Warrior's Gi"; public static string ShortDescription = "Going Further Beyond"; public static string LongDescription = "After taking damage that leaves the player one hit from death, gives a permanent buff to several stats. Can be activated up to 5 times, with diminishing returns."; public static string Lore = "A battle-torn training garment worn by the great Gunsoku, an almost-mythical being widely considered to be the greatest master of finger guns in history. Known best for saving the planet from galactic terrors such as Shell, Majin Boom, and Beebeerus, his unflinching drive for self-improvement and fighting stronger opponents has inspired many generations of Gungeoneers."; internal const float _MAX_POWER = 5f; internal readonly float[] _FIRE_RATE_MULT = new float[6] { 1f, 1.2f, 1.3f, 1.35f, 1.38f, 1.4f }; internal readonly float[] _MOVEMENT_MULT = new float[6] { 1f, 1.2f, 1.35f, 1.45f, 1.48f, 1.5f }; internal readonly float[] _DODGE_MULT = new float[6] { 1f, 1.15f, 1.25f, 1.3f, 1.33f, 1.35f }; internal readonly float[] _DAMAGE_MULT = new float[6] { 1f, 1.4f, 1.7f, 1.85f, 1.95f, 2f }; internal readonly float[] _BOSS_DAMAGE_MULT = new float[6] { 1f, 1.4f, 1.7f, 1.85f, 1.95f, 2f }; internal static GameObject _SaiyanSpark; internal static GameObject _ZenkaiAura; private float _lastHitsFromDeath; private StatModifier _rateOfFireStat; private StatModifier _movementSpeedStat; private StatModifier _dodgeRollSpeedStat; private StatModifier _damageStat; private StatModifier _bossDamageStat; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)3; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)3, 1f); _SaiyanSpark = VFX.Create("saiyan_spark", 12f, loops: false, -1, 0.5f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); Color? emissiveColour = Color.yellow; _ZenkaiAura = VFX.Create("zenkai_aura", 12f, loops: true, -1, 0.4f, (Anchor)1, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 5f, emissiveColour); } public override void Pickup(PlayerController player) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown base.Pickup(player); ((BraveBehaviour)player).healthHaver.OnDamaged += new OnDamagedEvent(OnDamaged); ((BraveBehaviour)player).healthHaver.OnHealthChanged += new OnHealthChangedEvent(OnHealthChanged); _lastHitsFromDeath = player.NumHitsFromDeath(); RecalculatePower(player); } public override void OnFirstPickup(PlayerController player) { _rateOfFireStat = ((StatType)1).Mult(1f); _movementSpeedStat = ((StatType)0).Mult(1f); _dodgeRollSpeedStat = ((StatType)28).Mult(1f); _damageStat = ((StatType)5).Mult(1f); _bossDamageStat = ((StatType)22).Mult(1f); ((PassiveItem)this).passiveStatModifiers = (StatModifier[])(object)new StatModifier[5] { _rateOfFireStat, _movementSpeedStat, _dodgeRollSpeedStat, _damageStat, _bossDamageStat }; } public override void DisableEffect(PlayerController player) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { ((BraveBehaviour)player).healthHaver.OnDamaged -= new OnDamagedEvent(OnDamaged); ((BraveBehaviour)player).healthHaver.OnHealthChanged -= new OnHealthChangedEvent(OnHealthChanged); } } private void OnHealthChanged(float resultValue, float maxValue) { _lastHitsFromDeath = Mathf.Max(_lastHitsFromDeath, (float)((PassiveItem)this).Owner.NumHitsFromDeath()); } private void OnDamaged(float resultValue, float maxValue, CoreDamageTypes damageTypes, DamageCategory damageCategory, Vector2 damageDirection) { float num = ((PassiveItem)this).Owner.NumHitsFromDeath(); if (num < Mathf.Min(_lastHitsFromDeath, (float)(((PassiveItem)this).Owner.HasSynergy(Synergy.SAIYAN_PRIDE) ? 3 : 2))) { DoZenkaiBoost(((PassiveItem)this).Owner); } _lastHitsFromDeath = num; } private void DoZenkaiBoost(PlayerController player) { ZenkaiAura orAddComponent = GameObjectExtensions.GetOrAddComponent(((Component)player).gameObject); orAddComponent.SetupIfNecessary(); orAddComponent.IncreasePower(); RecalculatePower(player); } private void RecalculatePower(PlayerController player) { ZenkaiAura orAddComponent = GameObjectExtensions.GetOrAddComponent(((Component)player).gameObject); int num = (Object.op_Implicit((Object)(object)orAddComponent) ? orAddComponent.GetPower() : 0); _rateOfFireStat.amount = _FIRE_RATE_MULT[num]; _movementSpeedStat.amount = _MOVEMENT_MULT[num]; _dodgeRollSpeedStat.amount = _DODGE_MULT[num]; _damageStat.amount = _DAMAGE_MULT[num]; _bossDamageStat.amount = _BOSS_DAMAGE_MULT[num]; player.stats.RecalculateStats(player, false, false); } public override void MidGameSerialize(List data) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Invalid comparison between Unknown and I4 ((PickupObject)this).MidGameSerialize(data); PlayerController primaryPlayer = GameManager.Instance.PrimaryPlayer; int num = ((primaryPlayer != null) ? GameObjectExtensions.GetOrAddComponent(((Component)primaryPlayer).gameObject)._zenkaiLevel : 0); data.Add(num); if ((int)GameManager.Instance.CurrentGameType == 1) { PlayerController secondaryPlayer = GameManager.Instance.SecondaryPlayer; int num2 = ((secondaryPlayer != null) ? GameObjectExtensions.GetOrAddComponent(((Component)secondaryPlayer).gameObject)._zenkaiLevel : 0); data.Add(num2); } } public override void MidGameDeserialize(List data) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Invalid comparison between Unknown and I4 ((PassiveItem)this).MidGameDeserialize(data); int num = (int)data[0]; if (num > 0) { PlayerController primaryPlayer = GameManager.Instance.PrimaryPlayer; if (primaryPlayer != null) { ZenkaiAura orAddComponent = GameObjectExtensions.GetOrAddComponent(((Component)primaryPlayer).gameObject); if (orAddComponent != null) { orAddComponent._zenkaiLevel = num; } if (GameManager.Instance.PrimaryPlayer.passiveItems.Contains((PassiveItem)(object)this)) { RecalculatePower(GameManager.Instance.PrimaryPlayer); } } } if ((int)GameManager.Instance.CurrentGameType != 1) { return; } int num2 = (int)data[1]; if (num2 <= 0) { return; } PlayerController secondaryPlayer = GameManager.Instance.SecondaryPlayer; if (secondaryPlayer != null) { ZenkaiAura orAddComponent2 = GameObjectExtensions.GetOrAddComponent(((Component)secondaryPlayer).gameObject); if (orAddComponent2 != null) { orAddComponent2._zenkaiLevel = num2; } if (GameManager.Instance.SecondaryPlayer.passiveItems.Contains((PassiveItem)(object)this)) { RecalculatePower(GameManager.Instance.SecondaryPlayer); } } } } public class ZenkaiAura : MonoBehaviour { private const float _AURA_LIFE = 1.5f; private const float _AURA_FADE_TIME = 1f; private readonly float[] _MIN_SPARK_GAPS = new float[6] { 999f, 2f, 1f, 0.75f, 0.5f, 0.33f }; private readonly float[] _MAX_SPARK_GAPS = new float[6] { 999f, 15f, 9f, 6f, 3f, 2f }; private readonly float[] _SPARK_ALPHAS = new float[6] { 0f, 0.35f, 0.65f, 5f, 25f, 225f }; internal int _zenkaiLevel; private PlayerController _saiyan; private GameObject _extantAura; private float _auraLife; private bool _didSetup; private float _nextSparkTime; private void Start() { SetupIfNecessary(); } public void SetupIfNecessary() { if (!_didSetup) { PlayerController component = ((Component)this).gameObject.GetComponent(); if (component != null) { _saiyan = component; _didSetup = true; } } } private void DoRandomSparks() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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) if (_zenkaiLevel < 1) { return; } _nextSparkTime -= BraveTime.DeltaTime; if (!(_nextSparkTime > 0f)) { ((Component)_saiyan).gameObject.Play("dbz_spark_sound"); GameObject val = SpawnManager.SpawnVFX(WarriorsGi._SaiyanSpark, Vector2Extensions.ToVector3ZUp(((GameActor)_saiyan).CenterPosition + Lazy.RandomVector(0.3f), 10f), Lazy.RandomEulerZ()); tk2dSprite component = val.GetComponent(); ((tk2dBaseSprite)component).HeightOffGround = 10f; ((tk2dBaseSprite)component).UpdateZDepth(); float num = _SPARK_ALPHAS[_zenkaiLevel]; if (num < 1f) { val.SetAlphaImmediate(num); } else { val.SetGlowiness(num); } val.transform.parent = ((BraveBehaviour)_saiyan).transform; _nextSparkTime = Random.Range(_MIN_SPARK_GAPS[_zenkaiLevel], _MAX_SPARK_GAPS[_zenkaiLevel]); } } private void DoAuraChecks() { if (Object.op_Implicit((Object)(object)_extantAura)) { _auraLife -= BraveTime.DeltaTime; float num = (_auraLife / 1f).Clamp(); if (num > 0f) { _extantAura.SetAlpha(num); return; } Object.Destroy((Object)(object)_extantAura); _extantAura = null; } } private void LateUpdate() { if (Object.op_Implicit((Object)(object)_saiyan)) { DoRandomSparks(); DoAuraChecks(); } } public void IncreasePower() { //IL_0041: 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) if (Object.op_Implicit((Object)(object)_saiyan) && (float)_zenkaiLevel != 5f) { _zenkaiLevel++; _extantAura.SafeDestroy(); _extantAura = SpawnManager.SpawnVFX(WarriorsGi._ZenkaiAura, _saiyan.SpriteBottomCenter, Quaternion.identity); _extantAura.transform.parent = ((BraveBehaviour)_saiyan).transform; _auraLife = 1.5f; _nextSparkTime = Random.Range(_MIN_SPARK_GAPS[_zenkaiLevel], _MAX_SPARK_GAPS[_zenkaiLevel]); ((Component)_saiyan).gameObject.Play("zenkai_aura_sound"); } } public int GetPower() { return _zenkaiLevel; } } public class DeadRinger : CwaffPassive { [CompilerGenerated] private sealed class d__20 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PlayerController pc; private Vector3 5__2; private Vector3 5__3; private GameObject 5__4; private tk2dSprite 5__5; private tk2dSpriteAnimator 5__6; private tk2dSpriteAnimationClip 5__7; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__20(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__4 = null; 5__5 = null; 5__6 = null; 5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: { <>1__state = -1; _ = ((BraveBehaviour)pc).sprite; 5__2 = ((BraveBehaviour)pc).sprite.scale; 5__3 = ((BraveBehaviour)((BraveBehaviour)pc).sprite).transform.position; 5__4 = SpawnManager.SpawnDebris(_CorpsePrefab, ((BraveBehaviour)pc).transform.position, Quaternion.identity); 5__5 = 5__4.GetComponent(); ((tk2dBaseSprite)5__5).SetSprite(((BraveBehaviour)pc).sprite.Collection, ((BraveBehaviour)pc).sprite.spriteId); 5__6 = GameObjectExtensions.GetOrAddComponent(((Component)5__5).gameObject); string text = ((!pc.UseArmorlessAnim) ? "death_coop" : "death_coop_armorless"); 5__7 = ((BraveBehaviour)pc).spriteAnimator.GetClipByName(text); 5__6.Play(5__7, 0f, 8f, true); <>2__current = null; <>1__state = 1; return true; } case 1: <>1__state = -1; break; case 2: <>1__state = -1; break; } if (5__6.IsPlaying(5__7)) { <>2__current = null; <>1__state = 2; return true; } ((tk2dBaseSprite)5__5).scale = 5__2; 5__4.transform.position = 5__3; ((tk2dBaseSprite)5__5).HeightOffGround = -3.5f; ((tk2dBaseSprite)5__5).UpdateZDepth(); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static string ItemName = "Dead Ringer"; public static string ShortDescription = "Tactical Defeat"; public static string LongDescription = "Feign death and become stealthed upon taking damage. Shooting while stealthed deals 10x damage and removes stealth. Projectiles deal 5x damage for 2 seconds after breaking stealth."; public static string Lore = "Developed by the French government for use by their elite secret agents in case of their inevitable failure, this marvelous gadget takes making lemonade out of lemons to the next level."; internal const float _DEAD_RINGER_STEALTH_MULT = 10f; internal const float _DEAD_RINGER_SURPRISE_MULT = 5f; internal const float _DEAD_RINGER_SURPRISE_TIMER = 2f; internal const float _LENIENCE = 0.75f; internal const float _DECOY_LIFE = 3f; internal const float SEGALS_LAW_STOP_TIME = 5f; internal static GameObject _CorpsePrefab; internal static GameObject _DecoyPrefab; internal static GameObject _ExplosiveDecoyPrefab; private float _lastActivationTime; private float _lastDecloakTime; public static void Init() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) ((PickupObject)Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore)).quality = (ItemQuality)2; Object obj = BraveResources.Load("Global Prefabs/PlayerCorpse", ".prefab"); _CorpsePrefab = (GameObject)(object)((obj is GameObject) ? obj : null); _DecoyPrefab = ((Component)ItemHelper.Get(Items.Decoy)).GetComponent().objectToSpawn.ClonePrefab(); _DecoyPrefab.GetComponent().DeathExplosionTimer = 3f; _ExplosiveDecoyPrefab = ((Component)ItemHelper.Get(Items.ExplosiveDecoy)).GetComponent().objectToSpawn.ClonePrefab(); _ExplosiveDecoyPrefab.GetComponent().DeathExplosionTimer = 3f; } public override void Pickup(PlayerController player) { base.Pickup(player); player.OnReceivedDamage += OnReceivedDamage; ((PassiveItem)this).Owner.PostProcessProjectile += SneakAttackProcessor; } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { player.OnReceivedDamage -= OnReceivedDamage; player.PostProcessProjectile -= SneakAttackProcessor; BreakStealth(player); } } private void OnReceivedDamage(PlayerController player) { if (!((Object)(object)((PassiveItem)this).Owner != (Object)(object)player) && !((GameActor)player).IsStealthed) { FeignDeath(); BecomeInvisible(); } } private void FeignDeath() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) ((Component)((PassiveItem)this).Owner).gameObject.Play("spy_uncloak_feigndeath"); if (((PassiveItem)this).Owner.HasSynergy(Synergy.DEAD_MAN_EXPANDING)) { GameObject explosiveDecoyPrefab = _ExplosiveDecoyPrefab; Vector3? position = ((PassiveItem)this).Owner.SpriteBottomCenter; Anchor? anchor = (Anchor)1; SpeculativeRigidbody component = explosiveDecoyPrefab.Instantiate(position, null, anchor).GetComponent(); if (component != null) { component.RegisterGhostCollisionException(((BraveBehaviour)((PassiveItem)this).Owner).specRigidbody); } } else if (((PassiveItem)this).Owner.HasSynergy(Synergy.DEAD_MAN_STANDING)) { GameObject decoyPrefab = _DecoyPrefab; Vector3? position2 = ((PassiveItem)this).Owner.SpriteBottomCenter; Anchor? anchor = (Anchor)1; SpeculativeRigidbody component2 = decoyPrefab.Instantiate(position2, null, anchor).GetComponent(); if (component2 != null) { component2.RegisterGhostCollisionException(((BraveBehaviour)((PassiveItem)this).Owner).specRigidbody); } } if (((PassiveItem)this).Owner.HasSynergy(Synergy.SEGALS_LAW)) { JojoReferenceHandler.RefreshTimeStop(5f); } ((MonoBehaviour)this).StartCoroutine(AnimateTheCorpse(((PassiveItem)this).Owner)); } private IEnumerator AnimateTheCorpse(PlayerController pc) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__20(0) { pc = pc }; } private void BecomeInvisible() { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)((GameActor)((PassiveItem)this).Owner).CurrentGun)) { ((GameActor)((PassiveItem)this).Owner).CurrentGun.CeaseAttack(false, (ProjectileData)null); } ((PassiveItem)this).Owner.OnDidUnstealthyAction += BreakStealth; ((GameActor)((PassiveItem)this).Owner).SetIsStealthed(true, "DeadRinger"); ((PassiveItem)this).Owner.SetCapableOfStealing(true, "DeadRinger", (float?)null); _lastActivationTime = BraveTime.ScaledTimeSinceStartup; Material[] array = ((PassiveItem)this).Owner.SetOverrideShader(ShaderCache.Acquire("Brave/Internal/HighPriestAfterImage")); foreach (Material obj in array) { obj.SetFloat(CwaffVFX._EmissivePowerId, 0f); obj.SetFloat("_Opacity", 0.5f); obj.SetColor("_DashColor", Color.gray); } DoSmokeAroundPlayer(8); } private void BreakStealth(PlayerController pc) { if (!((Object)(object)((PassiveItem)this).Owner != (Object)(object)pc) && !JustBecameStealthy()) { _lastDecloakTime = BraveTime.ScaledTimeSinceStartup; ((PassiveItem)this).Owner.ClearOverrideShader(); ((PassiveItem)this).Owner.OnDidUnstealthyAction -= BreakStealth; ((GameActor)((PassiveItem)this).Owner).SetIsStealthed(false, "DeadRinger"); ((PassiveItem)this).Owner.SetCapableOfStealing(false, "DeadRinger", (float?)null); ((Component)((PassiveItem)this).Owner).gameObject.Play("medigun_heal_detach"); DoSmokeAroundPlayer(8); } } private bool JustBecameStealthy() { return BraveTime.ScaledTimeSinceStartup < _lastActivationTime + 0.75f; } private void SneakAttackProcessor(Projectile proj, float _) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) if (JustBecameStealthy() || !Object.op_Implicit((Object)(object)((PassiveItem)this).Owner)) { return; } if (((GameActor)((PassiveItem)this).Owner).IsStealthed) { ProjectileData baseData = proj.baseData; baseData.damage *= 10f; } else { if (!(BraveTime.ScaledTimeSinceStartup - _lastDecloakTime < 2f)) { return; } ProjectileData baseData2 = proj.baseData; baseData2.damage *= 5f; } proj.AdjustPlayerProjectileTint(Color.gray, 2, 0f); } private void DoSmokeAroundPlayer(int amount) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_0036: 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) Object obj = ResourceCache.Acquire("Global VFX/VFX_Item_Spawn_Poof"); GameObject original = (GameObject)(object)((obj is GameObject) ? obj : null); Vector2 centerPosition = ((GameActor)((PassiveItem)this).Owner).CenterPosition; for (int i = 0; i < amount; i++) { Vector3? position = Vector2.op_Implicit(centerPosition + Lazy.RandomVector(Random.Range(0f, 0.5f))); Anchor? anchor = (Anchor)4; original.Instantiate(position, null, anchor); } } } public class CreditCard : CwaffPassive { [HarmonyPatch(typeof(GameUIRoot), "UpdatePlayerConsumables")] private class GameUIRootUpdatePlayerConsumablesPatch { private static void Postfix(GameUIRoot __instance, PlayerConsumables playerConsumables) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0068: 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) if ((Object)(object)__instance.p_playerCoinSprite == (Object)null) { __instance.p_playerCoinSprite = ((Component)((dfControl)__instance.p_playerCoinLabel).Parent).GetComponentInChildren(); } if (!Lazy.AnyoneHas()) { ((dfControl)__instance.p_playerCoinLabel).Color = Color32.op_Implicit(Color.white); __instance.p_playerCoinSprite.SpriteName = "ui_coin_idle_002"; return; } int num = playerConsumables.Currency - 500; ((dfControl)__instance.p_playerCoinLabel).Color = Color32.op_Implicit((num >= 0) ? Color.yellow : Color.red); __instance.p_playerCoinLabel.ProcessMarkup = true; __instance.p_playerCoinLabel.Text = IntToStringSansGarbage.GetStringForInt(num); __instance.p_playerCoinSprite.SpriteName = "credit_card_icon_ui"; } } [HarmonyPatch(typeof(GameUIRoot), "ShowCoreUI")] private class GameUIRootShowCoreUIPatch { private static void Postfix(GameUIRoot __instance, string reason) { if (Object.op_Implicit((Object)(object)GameManager.Instance.PrimaryPlayer) && Object.op_Implicit((Object)(object)__instance.p_playerCoinLabel) && Object.op_Implicit((Object)(object)((dfControl)__instance.p_playerCoinLabel).Parent) && Object.op_Implicit((Object)(object)((dfControl)__instance.p_playerCoinLabel).Parent.Parent)) { __instance.UpdatePlayerConsumables(GameManager.Instance.PrimaryPlayer.carriedConsumables); } } } public static string ItemName = "Credit Card"; public static string ShortDescription = "Shop 'til You Drop"; public static string LongDescription = "Allows the player to go into debt by up to 500 casings. Grants 1 coolness for every 50 casings held, and 1 curse for every 50 casings in debt. Cannot be dropped while in debt."; public static string Lore = "Perhaps the greatest emblem of 20th century economics, this handy little piece of plastic gives unprecedented purchasing power for all of your Gungeon needs. Comes with the teensiest of interest rates, charged directly to your soul for your convenience."; internal const int _BASE_CREDIT = 500; internal const int _CHEAT_DEATH_COST = 100; internal const int _CREDIT_DELTA = 50; private int oldCurrency; private StatModifier curseMod; private StatModifier coolMod; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)3; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)2, 1f); } public override void OnFirstPickup(PlayerController player) { base.OnFirstPickup(player); curseMod = ((StatType)14).Add(0f); coolMod = ((StatType)4).Add(0f); ((PassiveItem)this).passiveStatModifiers = (StatModifier[])(object)new StatModifier[2] { curseMod, coolMod }; } public override void Pickup(PlayerController player) { base.Pickup(player); HealthHaver healthHaver = ((BraveBehaviour)player).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Combine(healthHaver.ModifyDamage, new Action(OnTakeDamage)); oldCurrency = 500; PlayerConsumables carriedConsumables = player.carriedConsumables; carriedConsumables.Currency += 500; UpdateCreditScore(); } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { PlayerConsumables carriedConsumables = player.carriedConsumables; carriedConsumables.Currency -= 500; HealthHaver healthHaver = ((BraveBehaviour)player).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Remove(healthHaver.ModifyDamage, new Action(OnTakeDamage)); } } private void OnTakeDamage(HealthHaver hh, ModifyDamageEventArgs data) { if (hh.PlayerWillDieFromHit(data)) { PlayerController component = ((Component)hh).GetComponent(); if (component != null && component.carriedConsumables.Currency >= 100 && component.HasSynergy(Synergy.DEATH_AND_TAXES)) { PlayerConsumables carriedConsumables = component.carriedConsumables; carriedConsumables.Currency -= 100; data.ModifiedDamage = 0f; hh.TriggerInvulnerabilityPeriod(-1f); Lazy.DoDamagedFlash(hh); component.DoGenericItemActivation(((BraveBehaviour)this).sprite, "minecraft_totem_pop_sound"); } } } public override void Update() { ((PassiveItem)this).Update(); if (Object.op_Implicit((Object)(object)((PassiveItem)this).Owner)) { UpdateCreditScore(); } } private void UpdateCreditScore() { int currency = GameManager.Instance.PrimaryPlayer.carriedConsumables.Currency; if (oldCurrency != currency) { oldCurrency = currency; ((PickupObject)this).CanBeDropped = currency >= 500; curseMod.amount = ((currency <= 500) ? ((500 - currency) / 50) : 0); coolMod.amount = ((currency >= 500) ? ((currency - 500) / 50) : 0); VolleyRebuildHelpers.RecalculateStatsWithoutRebuildingGunVolleys(((PassiveItem)this).Owner.stats, ((PassiveItem)this).Owner); } } } public class DisplayPedestal : CwaffPassive { [HarmonyPatch] private class DisplayCasePatches { private static bool _NextGunIsPristine; [HarmonyPatch(typeof(Gun), "Pickup")] [HarmonyPrefix] private static void CheckIfPristine(Gun __instance, PlayerController player) { ((Component)__instance).gameObject.GetComponent()?.NoLongerPristine(); if (!__instance.HasEverBeenAcquiredByPlayer && PassiveItem.IsFlagSetForCharacter(player, typeof(DisplayPedestal))) { _NextGunIsPristine = true; } } [HarmonyPatch(typeof(GunInventory), "AddGunToInventory")] [HarmonyPostfix] private static void AddGunToInventory(GunInventory __instance, Gun gun, bool makeActive, ref Gun __result) { if (_NextGunIsPristine) { _NextGunIsPristine = false; ((Component)__result).gameObject.AddComponent(); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyILManipulator] private static void SellCellControllerHandleSoldItemPatchIL(ILContext il, MethodBase original) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_003a: 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) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdfld(instr, "SellValueModifier") })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldfld, original.DeclaringType.GetEnumeratorField("targetItem")); val.CallPrivate(typeof(DisplayCasePatches), "MintConditionMult"); } } private static float MintConditionMult(float origMult, PickupObject targetItem) { if (!Object.op_Implicit((Object)(object)((Component)targetItem).gameObject.GetComponent())) { return origMult; } return 1f; } } public static string ItemName = "Display Pedestal"; public static string ShortDescription = "Professionally Graded"; public static string LongDescription = "Picking up any new gun preserves it in Mint Condition until fired or dropped. Each Mint Condition gun increases coolness by one, and can be sold to the Sell Creep at its full purchase price."; public static string Lore = "A miniature replica of the pedestal one often encounters after a particularly challenging fight, with the same propensity for making guns appear a lot more prestigious than they actually are. With proper care and the right buyer, you too can get away with selling unwanted weaponry for the same ludicrous prices as Bello."; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)2; obj.passiveStatModifiers = (StatModifier[])(object)new StatModifier[1] { ((StatType)4).Add(0f) }; } public override void Pickup(PlayerController player) { base.Pickup(player); PassiveItem.IncrementFlag(player, typeof(DisplayPedestal)); ((PassiveItem)this).passiveStatModifiers[0].amount = 0f; player.stats.RecalculateStats(player, false, false); } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (!Object.op_Implicit((Object)(object)player)) { return; } PassiveItem.DecrementFlag(player, typeof(DisplayPedestal)); if (PassiveItem.IsFlagSetForCharacter(player, typeof(DisplayPedestal))) { return; } foreach (Gun allGun in player.inventory.AllGuns) { if (Object.op_Implicit((Object)(object)allGun)) { ((Component)allGun).gameObject.GetComponent()?.NoLongerPristine(); } } } public void UpdateStats() { if (Object.op_Implicit((Object)(object)((PassiveItem)this).m_owner)) { ((PassiveItem)this).passiveStatModifiers[0].amount = CwaffRunData.Instance.pristineGunIds[((PassiveItem)this).m_owner.PlayerIDX].Count; ((PassiveItem)this).m_owner.stats.RecalculateStats(((PassiveItem)this).m_owner, false, false); } } internal static void RestoreMidGameData(PlayerController p) { int playerIDX = p.PlayerIDX; List list = CwaffRunData.Instance.pristineGunIds[playerIDX]; foreach (Gun allGun in p.inventory.AllGuns) { if (list.Contains(((PickupObject)allGun).PickupObjectId)) { ((Component)allGun).gameObject.AddComponent(); } } } } public class PristineGun : MonoBehaviour { private Gun _gun; private PlayerController _player; private bool _inInventory; private void Start() { _gun = ((Component)this).gameObject.GetComponent(); _player = GunTools.GunPlayerOwner(_gun); if (!Object.op_Implicit((Object)(object)_player)) { Object.Destroy((Object)(object)this); return; } _inInventory = true; Gun gun = _gun; gun.OnDropped = (Action)Delegate.Combine(gun.OnDropped, new Action(Drop)); Gun gun2 = _gun; gun2.OnPostFired = (Action)Delegate.Combine(gun2.OnPostFired, new Action(PostFired)); _player.GunChanged += GunChanged; CwaffRunData.Instance.pristineGunIds[_player.PlayerIDX].AddUnique(((PickupObject)_gun).PickupObjectId); _player.GetPassive()?.UpdateStats(); if ((Object)(object)((GameActor)_player).CurrentGun == (Object)(object)_gun && Object.op_Implicit((Object)(object)((BraveBehaviour)_gun).sprite)) { OohShiny(); } } private void GunChanged(Gun previous, Gun current, bool newGun) { if ((Object)(object)current == (Object)(object)_gun && Object.op_Implicit((Object)(object)((BraveBehaviour)_gun).sprite)) { OohShiny(); } } private void OohShiny() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (!MidGameSaveData.IsInitializingPlayerData) { ((Component)_gun).gameObject.Play("shiny_new_gun_sound"); } CwaffVFX.SpawnBurst(AllayCompanion._AllaySparkles, 20, ((BraveBehaviour)_gun).sprite.WorldCenter, 1f, (Vector2?)new Vector2(0f, 3f), 1f, 1f, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.Random, 1f, startScale: (float?)0.75f, endScale: (float?)0.5f, fadeOutTime: (float?)0.5f, emissivePower: 5f, emissiveColor: (Color?)null, fadeIn: false, uniform: false, height: (float?)null, randomFrame: false, specificFrame: -1, flipX: false, flipY: false, anchorTransform: (Transform)null, overrideColor: (Color?)null, emitColorPower: 1.55f, spread: 0f, spriteCol: (tk2dSpriteCollectionData)null, spriteId: -1, lifetimeVariance: 0f, minVariance: 0f, unoccluded: false); } private void PostFired(PlayerController player, Gun gun) { NoLongerPristine(); } private void Drop() { Gun gun = _gun; gun.OnDropped = (Action)Delegate.Remove(gun.OnDropped, new Action(Drop)); Gun gun2 = _gun; gun2.OnPostFired = (Action)Delegate.Remove(gun2.OnPostFired, new Action(PostFired)); _inInventory = false; if (Object.op_Implicit((Object)(object)_player)) { _player.GunChanged -= GunChanged; CwaffRunData.Instance.pristineGunIds[_player.PlayerIDX].TryRemove(((PickupObject)_gun).PickupObjectId); _player.GetPassive()?.UpdateStats(); } } internal void NoLongerPristine() { if (Object.op_Implicit((Object)(object)_gun)) { Gun gun = _gun; gun.OnDropped = (Action)Delegate.Remove(gun.OnDropped, new Action(Drop)); Gun gun2 = _gun; gun2.OnPostFired = (Action)Delegate.Remove(gun2.OnPostFired, new Action(PostFired)); } if (Object.op_Implicit((Object)(object)_player)) { _player.GunChanged -= GunChanged; } if (_inInventory && Object.op_Implicit((Object)(object)_gun) && Object.op_Implicit((Object)(object)_player)) { CwaffRunData.Instance.pristineGunIds[_player.PlayerIDX].TryRemove(((PickupObject)_gun).PickupObjectId); _player.GetPassive()?.UpdateStats(); } Object.Destroy((Object)(object)this); } } public class Gyroscope : CwaffDodgeRollItem { public static string ItemName = "Gyroscope"; public static string ShortDescription = "Spin to Win"; public static string LongDescription = "Grants a chargeable dodge roll that transforms the user into a rampant tornado, reflecting projectiles but effectively randomizing shooting direction. Longer charges result in longer invulnerability periods but may cause dizziness, leaving the user briefly immobile and vulnerable."; public static string Lore = "Watching this simple toy spin for even a few seconds is completely mesmerizing. Its trifold axes of rotation inspire truly revolutionary possibilities for avoiding projectiles."; internal static GameObject _TornadoVFX; private GyroscopeRoll _dodgeRoller; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore, hideFromAmmonomicon: false, 1f); ((PickupObject)obj).quality = (ItemQuality)3; ((Component)obj).gameObject.AddComponent(); _TornadoVFX = VFX.Create("tornado", 20f, loops: true, -1, 1f, (Anchor)1, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } private void OnPreCollision(SpeculativeRigidbody myRigidbody, PixelCollider myCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherCollider) { if (!((CustomDodgeRoll)_dodgeRoller)._isDodging) { return; } Projectile component = ((Component)otherRigidbody).GetComponent(); if (!((Object)(object)component == (Object)null) && !(component.Owner is PlayerController)) { if (_dodgeRoller.reflectingProjectiles) { PassiveReflectItem.ReflectBullet(component, true, ((BraveBehaviour)((BraveBehaviour)((PassiveItem)this).Owner).specRigidbody).gameActor, 10f, 1f, 1f, 0f); } if (!((BraveBehaviour)((PassiveItem)this).Owner).healthHaver.IsVulnerable) { PhysicsEngine.SkipCollision = true; } } } public override void Pickup(PlayerController player) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown ((PassiveItem)this).Pickup(player); _dodgeRoller = ((Component)this).gameObject.GetComponent(); SpeculativeRigidbody specRigidbody = ((BraveBehaviour)player).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreCollision)); } public override void DisableEffect(PlayerController player) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { SpeculativeRigidbody specRigidbody = ((BraveBehaviour)player).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Remove((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreCollision)); if (Object.op_Implicit((Object)(object)_dodgeRoller)) { ((CustomDodgeRoll)_dodgeRoller).AbortDodgeRoll(); } } } public override CustomDodgeRoll CustomDodgeRoll() { if (!Object.op_Implicit((Object)(object)_dodgeRoller)) { _dodgeRoller = ((Component)this).gameObject.GetComponent(); } return (CustomDodgeRoll)(object)_dodgeRoller; } } public class GyroscopeRoll : CustomDodgeRoll { [CompilerGenerated] private sealed class d__48 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public GyroscopeRoll <>4__this; private float 5__2; private float 5__3; private DustUpVFX 5__4; private BraveInput 5__5; private tk2dSpriteAnimator 5__6; private float 5__7; private float 5__8; private float 5__9; private float 5__10; private float 5__11; private float 5__12; private float 5__13; private float 5__14; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__48(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__4 = null; 5__5 = null; 5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Expected O, but got Unknown //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Expected O, but got Unknown //IL_0509: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Unknown result type (might be due to invalid IL or missing references) //IL_0513: Unknown result type (might be due to invalid IL or missing references) //IL_0768: Unknown result type (might be due to invalid IL or missing references) //IL_0772: Expected O, but got Unknown //IL_0772: Unknown result type (might be due to invalid IL or missing references) //IL_077c: Expected O, but got Unknown //IL_0918: Unknown result type (might be due to invalid IL or missing references) //IL_091d: Unknown result type (might be due to invalid IL or missing references) //IL_0929: Unknown result type (might be due to invalid IL or missing references) //IL_0933: Unknown result type (might be due to invalid IL or missing references) //IL_0938: Unknown result type (might be due to invalid IL or missing references) //IL_0949: Unknown result type (might be due to invalid IL or missing references) //IL_094e: Unknown result type (might be due to invalid IL or missing references) //IL_09c8: Unknown result type (might be due to invalid IL or missing references) //IL_0b50: Unknown result type (might be due to invalid IL or missing references) //IL_0b55: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_05dc: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_0580: Unknown result type (might be due to invalid IL or missing references) //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_0589: Unknown result type (might be due to invalid IL or missing references) //IL_058e: Unknown result type (might be due to invalid IL or missing references) //IL_0590: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_0a8b: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_063a: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_061a: Unknown result type (might be due to invalid IL or missing references) //IL_061f: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Unknown result type (might be due to invalid IL or missing references) //IL_0650: Unknown result type (might be due to invalid IL or missing references) //IL_0655: Unknown result type (might be due to invalid IL or missing references) //IL_0666: Unknown result type (might be due to invalid IL or missing references) //IL_066b: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Unknown result type (might be due to invalid IL or missing references) //IL_05c7: Unknown result type (might be due to invalid IL or missing references) //IL_0b16: Unknown result type (might be due to invalid IL or missing references) //IL_0ad8: Unknown result type (might be due to invalid IL or missing references) //IL_0add: Unknown result type (might be due to invalid IL or missing references) //IL_0ae1: Unknown result type (might be due to invalid IL or missing references) //IL_0af5: Unknown result type (might be due to invalid IL or missing references) //IL_0706: Unknown result type (might be due to invalid IL or missing references) //IL_06c1: Unknown result type (might be due to invalid IL or missing references) //IL_06ca: Unknown result type (might be due to invalid IL or missing references) //IL_06cf: Unknown result type (might be due to invalid IL or missing references) //IL_06d4: Unknown result type (might be due to invalid IL or missing references) //IL_06e5: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; GyroscopeRoll gyroscopeRoll = <>4__this; SpeculativeRigidbody specRigidbody; SpeculativeRigidbody specRigidbody2; SpeculativeRigidbody specRigidbody3; SpeculativeRigidbody specRigidbody4; string baseDodgeAnimationName; tk2dSpriteAnimationFrame[] frames; switch (num) { default: return false; case 0: { <>1__state = -1; 5__2 = gyroscopeRoll.GetDodgeRollSpeed(); 5__3 = 5__2 * 5f; 5__4 = GameManager.Instance.Dungeon.dungeonDustups; 5__5 = BraveInput.GetInstanceForPlayer(((CustomDodgeRoll)gyroscopeRoll)._owner.PlayerIDX); gyroscopeRoll.tookDamageDuringDodgeRoll = false; ((CustomDodgeRoll)gyroscopeRoll)._owner.OnReceivedDamage += gyroscopeRoll.OnReceivedDamage; PlayerController owner = ((CustomDodgeRoll)gyroscopeRoll)._owner; owner.OnRealPlayerDeath = (Action)Delegate.Combine(owner.OnRealPlayerDeath, new Action(gyroscopeRoll.OnReceivedDamage)); gyroscopeRoll.stumbleClip = null; gyroscopeRoll.tornadoVFX = Object.Instantiate(Gyroscope._TornadoVFX, Vector2.op_Implicit(((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).specRigidbody.UnitBottomCenter), Quaternion.identity); 5__6 = gyroscopeRoll.tornadoVFX.GetComponent(); ((BraveBehaviour)((BraveBehaviour)5__6).sprite).transform.parent = ((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).transform; ((BraveBehaviour)((BraveBehaviour)5__6).sprite).transform.position = ((CustomDodgeRoll)gyroscopeRoll)._owner.SpriteBottomCenter; ((BraveBehaviour)5__6).sprite.usesOverrideMaterial = true; ((BraveBehaviour)5__6).renderer.SetAlpha(0f); 5__7 = 0f; 5__8 = 0f; 5__9 = 0f; gyroscopeRoll.forcedDirection = ((GameActor)((CustomDodgeRoll)gyroscopeRoll)._owner).FacingDirection; ((CustomDodgeRoll)gyroscopeRoll)._owner.m_overrideGunAngle = gyroscopeRoll.forcedDirection; _ = ((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).transform.position; gyroscopeRoll.rollDamageModifier = ((StatType)21).Mult(1f); ((CustomDodgeRoll)gyroscopeRoll)._owner.ownerlessStatModifiers.Add(gyroscopeRoll.rollDamageModifier); gyroscopeRoll.speedModifier = ((StatType)0).Mult(1f); ((CustomDodgeRoll)gyroscopeRoll)._owner.ownerlessStatModifiers.Add(gyroscopeRoll.speedModifier); gyroscopeRoll.isSpeedModActive = true; gyroscopeRoll.isRollModActive = true; ((CustomDodgeRoll)gyroscopeRoll)._owner.stats.RecalculateStats(((CustomDodgeRoll)gyroscopeRoll)._owner, false, false); 5__10 = 0f; goto IL_03f2; } case 1: <>1__state = -1; goto IL_03f2; case 2: <>1__state = -1; 5__13 += BraveTime.DeltaTime; goto IL_073f; case 3: <>1__state = -1; 5__14 -= BraveTime.DeltaTime; goto IL_097c; case 4: { <>1__state = -1; 5__14 += BraveTime.DeltaTime; goto IL_0ba6; } IL_03f2: if (((CustomDodgeRoll)gyroscopeRoll)._dodgeButtonHeld) { if (((GameActor)((CustomDodgeRoll)gyroscopeRoll)._owner).IsFalling || gyroscopeRoll.tookDamageDuringDodgeRoll) { return false; } 5__7 += BraveTime.DeltaTime; 5__10 = Mathf.Min(1f, 5__7 / 3f); 5__8 = 720f + 1440f * (5__10 * 5__10); gyroscopeRoll.UpdateForcedDirection(gyroscopeRoll.forcedDirection + 5__8 * BraveTime.DeltaTime); gyroscopeRoll.speedModifier.amount = 1f - 5__10 * 5__10; ((CustomDodgeRoll)gyroscopeRoll)._owner.stats.RecalculateStats(((CustomDodgeRoll)gyroscopeRoll)._owner, false, false); if (Random.Range(0f, 100f) < 10f) { float forcedDirection = gyroscopeRoll.forcedDirection; float num2 = Random.Range(0f, 360f); float num3 = Random.Range(0.3f, 1.25f); SpawnManager.SpawnVFX(5__4.rollLandDustup, Vector2.op_Implicit(((GameActor)((CustomDodgeRoll)gyroscopeRoll)._owner).CenterPosition - BraveMathCollege.DegreesToVector(forcedDirection, num3)), Quaternion.Euler(0f, 0f, num2)); } if (5__10 >= 0.4f) { 5__9 = 0.5f * (5__10 - 0.4f) / 0.6f; ((BraveBehaviour)((BraveBehaviour)5__6).sprite).transform.position = ((CustomDodgeRoll)gyroscopeRoll)._owner.SpriteBottomCenter; ((BraveBehaviour)5__6).renderer.SetAlpha(5__9); } gyroscopeRoll.ExtinguishFire(); <>2__current = null; <>1__state = 1; return true; } ((CustomDodgeRoll)gyroscopeRoll)._owner.ownerlessStatModifiers.Remove(gyroscopeRoll.speedModifier); gyroscopeRoll.isSpeedModActive = false; ((CustomDodgeRoll)gyroscopeRoll)._owner.stats.RecalculateStats(((CustomDodgeRoll)gyroscopeRoll)._owner, false, false); gyroscopeRoll._grounded = false; gyroscopeRoll.reflectingProjectiles = 5__10 >= 0.4f; specRigidbody = ((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(gyroscopeRoll.BounceAwayEnemies)); specRigidbody2 = ((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).specRigidbody; specRigidbody2.OnCollision = (Action)Delegate.Combine(specRigidbody2.OnCollision, new Action(gyroscopeRoll.BounceOffWalls)); ((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).healthHaver.IsVulnerable = false; 5__11 = 5__2 + 5__10 * (5__3 - 5__2); 5__12 = 1f + 5__10 * 3f; gyroscopeRoll.targetVelocity = 5__11 * ((TwoAxisInputControl)5__5.ActiveActions.Move).Value; 5__13 = 0f; goto IL_073f; IL_073f: if (5__13 < 5__12) { if (((GameActor)((CustomDodgeRoll)gyroscopeRoll)._owner).IsFalling || gyroscopeRoll.tookDamageDuringDodgeRoll) { return false; } gyroscopeRoll.UpdateForcedDirection(gyroscopeRoll.forcedDirection + 5__8 * BraveTime.DeltaTime); if (gyroscopeRoll.useDriftMechanics) { Vector2 val = 60f * BraveTime.DeltaTime * ((TwoAxisInputControl)5__5.ActiveActions.Move).Value; gyroscopeRoll.targetVelocity += val; if (((Vector2)(ref gyroscopeRoll.targetVelocity)).magnitude > 5__11) { gyroscopeRoll.targetVelocity = 5__11 * ((Vector2)(ref gyroscopeRoll.targetVelocity)).normalized; } } else { float num4 = 180f * BraveTime.DeltaTime; float num5 = Vector2Extensions.ToAngle(gyroscopeRoll.targetVelocity); float num6 = BraveMathCollege.ClampAngle180(((GameActor)((CustomDodgeRoll)gyroscopeRoll)._owner).FacingDirection - num5); if (Mathf.Abs(num6) <= num4) { gyroscopeRoll.targetVelocity = BraveMathCollege.DegreesToVector(((GameActor)((CustomDodgeRoll)gyroscopeRoll)._owner).FacingDirection, 5__11); } else { gyroscopeRoll.targetVelocity = BraveMathCollege.DegreesToVector(num5 + Mathf.Sign(num6) * num4, 5__11); } } gyroscopeRoll.targetVelocity *= 0.99f; ((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).specRigidbody.Velocity = gyroscopeRoll.targetVelocity; if (Random.Range(0f, 100f) < 10f) { float forcedDirection2 = gyroscopeRoll.forcedDirection; float num7 = Random.Range(0f, 360f); float num8 = Random.Range(0.3f, 1.25f); SpawnManager.SpawnVFX(5__4.rollLandDustup, Vector2.op_Implicit(((GameActor)((CustomDodgeRoll)gyroscopeRoll)._owner).CenterPosition - BraveMathCollege.DegreesToVector(forcedDirection2, num8)), Quaternion.Euler(0f, 0f, num7)); } ((BraveBehaviour)((BraveBehaviour)5__6).sprite).transform.position = ((CustomDodgeRoll)gyroscopeRoll)._owner.SpriteBottomCenter; gyroscopeRoll.ExtinguishFire(); <>2__current = null; <>1__state = 2; return true; } specRigidbody3 = ((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).specRigidbody; specRigidbody3.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Remove((Delegate?)(object)specRigidbody3.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(gyroscopeRoll.BounceAwayEnemies)); specRigidbody4 = ((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).specRigidbody; specRigidbody4.OnCollision = (Action)Delegate.Remove(specRigidbody4.OnCollision, new Action(gyroscopeRoll.BounceOffWalls)); ((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).healthHaver.IsVulnerable = true; gyroscopeRoll.reflectingProjectiles = false; ((CustomDodgeRoll)gyroscopeRoll)._owner.ownerlessStatModifiers.Remove(gyroscopeRoll.rollDamageModifier); gyroscopeRoll.isRollModActive = false; ((CustomDodgeRoll)gyroscopeRoll)._owner.stats.RecalculateStats(((CustomDodgeRoll)gyroscopeRoll)._owner, false, false); gyroscopeRoll._grounded = true; if (((CustomDodgeRoll)gyroscopeRoll)._owner.HasSynergy(Synergy.PERFECTLY_BALANCED) || !(5__10 >= 0.4f)) { break; } ((CustomDodgeRoll)gyroscopeRoll)._owner.SetInputOverride("gyrostumble"); ((CustomDodgeRoll)gyroscopeRoll)._owner.ToggleGunRenderers(false, "gyrostumble"); ((CustomDodgeRoll)gyroscopeRoll)._owner.ToggleHandRenderers(false, "gyrostumble"); ((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).spriteAnimator.Stop(); ((CustomDodgeRoll)gyroscopeRoll)._owner.QueueSpecificAnimation(((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).spriteAnimator.GetClipByName("spinfall").name); ((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).spriteAnimator.SetFrame(0, false); ((Component)((CustomDodgeRoll)gyroscopeRoll)._owner).gameObject.Play("Play_Fall"); 5__13 = 0.65f; 5__14 = 5__13; goto IL_097c; IL_0ba6: if (5__14 < 1.25f && !gyroscopeRoll.tookDamageDuringDodgeRoll) { ((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).specRigidbody.Velocity = Vector2.zero; if (((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).spriteAnimator.CurrentFrame > 3) { ((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).spriteAnimator.Stop(); } <>2__current = null; <>1__state = 4; return true; } break; IL_097c: if (5__14 > 0f) { if (gyroscopeRoll.tookDamageDuringDodgeRoll) { return false; } ((BraveBehaviour)5__6).renderer.SetAlpha(5__9 * (5__14 / 5__13)); ((BraveBehaviour)((BraveBehaviour)5__6).sprite).transform.position = Vector2.op_Implicit(((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).sprite.WorldBottomCenter); gyroscopeRoll.targetVelocity *= 0.9f; ((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).specRigidbody.Velocity = gyroscopeRoll.targetVelocity; <>2__current = null; <>1__state = 3; return true; } Object.Destroy((Object)(object)gyroscopeRoll.tornadoVFX); ((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).spriteAnimator.Stop(); if (!(5__10 >= 0.75f)) { break; } baseDodgeAnimationName = Lazy.GetBaseDodgeAnimationName(((CustomDodgeRoll)gyroscopeRoll)._owner, ((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).specRigidbody.Velocity); gyroscopeRoll.stumbleClip = ((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).spriteAnimator.GetClipByName(baseDodgeAnimationName); ((CustomDodgeRoll)gyroscopeRoll)._owner.QueueSpecificAnimation(gyroscopeRoll.stumbleClip.name); ((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).spriteAnimator.SetFrame(0, false); ((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).spriteAnimator.ClipFps = 24f; gyroscopeRoll.wasFrameInvulnerable = new List(); frames = gyroscopeRoll.stumbleClip.frames; foreach (tk2dSpriteAnimationFrame val2 in frames) { gyroscopeRoll.wasFrameInvulnerable.Add(val2.invulnerableFrame); val2.invulnerableFrame = false; } ((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).sprite.FlipX = Mathf.Abs(Vector2Extensions.ToAngle(((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).specRigidbody.Velocity)) > 90f; if (((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).sprite.FlipX) { Transform transform = ((Component)((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).sprite).gameObject.transform; Bounds untrimmedBounds = ((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).sprite.GetUntrimmedBounds(); transform.localPosition = new Vector3(((Bounds)(ref untrimmedBounds)).size.x, 0f, 0f); } else { ((Component)((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).sprite).gameObject.transform.localPosition = Vector3.zero; } ((BraveBehaviour)((CustomDodgeRoll)gyroscopeRoll)._owner).sprite.UpdateZDepth(); 5__14 = 0f; goto IL_0ba6; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const float MAX_DASH_TIME = 4f; private const float MIN_DASH_TIME = 1f; private const float MAX_ROT = 180f; private const float MAX_DRIFT = 60f; private const float GYRO_FRICTION = 0.99f; private const float MIN_SPIN = 720f; private const float MAX_SPIN = 2160f; private const float CHARGE_TIME = 3f; private const float DIZZY_THRES = 0.4f; private const float STUMBLE_THRES = 0.75f; private const float STUMBLE_TIME = 1.25f; private const float STOP_FRICTION = 0.9f; private const float TORNADO_ALPHA = 0.5f; private const float SPIN_DELTA = 1440f; private bool useDriftMechanics = true; private bool isSpeedModActive; private bool isRollModActive; private bool tookDamageDuringDodgeRoll; private float forcedDirection; private StatModifier speedModifier; private StatModifier rollDamageModifier; private GameObject tornadoVFX; private Vector2 targetVelocity = Vector2.zero; private bool _grounded = true; private tk2dSpriteAnimationClip stumbleClip; private List wasFrameInvulnerable = new List(); public override float fireReduction => 0f; public override bool isAirborne => !_grounded; public override bool dodgesProjectiles => false; public override bool lockedDirection => false; public override bool canDodgeInPlace => true; public override bool canUseWeapon => true; public bool reflectingProjectiles { get; private set; } private void UpdateForcedDirection(float newDirection) { //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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) forcedDirection = newDirection; if (forcedDirection > 180f) { ((Component)((CustomDodgeRoll)this)._owner).gameObject.Play("undertale_arrow"); forcedDirection -= 360f; } string baseIdleAnimationName = Lazy.GetBaseIdleAnimationName(((CustomDodgeRoll)this)._owner, forcedDirection); if (!((BraveBehaviour)((CustomDodgeRoll)this)._owner).spriteAnimator.IsPlaying(baseIdleAnimationName)) { ((BraveBehaviour)((CustomDodgeRoll)this)._owner).spriteAnimator.Stop(); ((BraveBehaviour)((CustomDodgeRoll)this)._owner).spriteAnimator.Play(baseIdleAnimationName); } if (((BraveBehaviour)((CustomDodgeRoll)this)._owner).sprite.FlipX != Mathf.Abs(forcedDirection) > 90f) { tk2dBaseSprite sprite = ((BraveBehaviour)((CustomDodgeRoll)this)._owner).sprite; sprite.FlipX = !sprite.FlipX; if (((BraveBehaviour)((CustomDodgeRoll)this)._owner).sprite.FlipX) { Transform transform = ((Component)((BraveBehaviour)((CustomDodgeRoll)this)._owner).sprite).gameObject.transform; Bounds untrimmedBounds = ((BraveBehaviour)((CustomDodgeRoll)this)._owner).sprite.GetUntrimmedBounds(); transform.localPosition = new Vector3(((Bounds)(ref untrimmedBounds)).size.x, 0f, 0f); } else { ((Component)((BraveBehaviour)((CustomDodgeRoll)this)._owner).sprite).gameObject.transform.localPosition = Vector3.zero; } ((BraveBehaviour)((CustomDodgeRoll)this)._owner).sprite.UpdateZDepth(); } ((CustomDodgeRoll)this)._owner.m_overrideGunAngle = forcedDirection; ((CustomDodgeRoll)this)._owner.forceAimPoint = ((GameActor)((CustomDodgeRoll)this)._owner).CenterPosition + BraveMathCollege.DegreesToVector(forcedDirection, 1f); } private void OnReceivedDamage(PlayerController p) { ((CustomDodgeRoll)this).FinishDodgeRoll(false); tookDamageDuringDodgeRoll = true; } private float GetDodgeRollSpeed() { return ((CustomDodgeRoll)this)._owner.rollStats.GetModifiedTime(((CustomDodgeRoll)this)._owner) / ((CustomDodgeRoll)this)._owner.rollStats.GetModifiedDistance(((CustomDodgeRoll)this)._owner) / BraveTime.DeltaTime; } private void DoElasticCollision(SpeculativeRigidbody b1, SpeculativeRigidbody b2, out Vector2 newv1, out Vector2 newv2, bool ignoreOtherVelocity = false) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_000d: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_002d: 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_0033: 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_0045: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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) Vector2 unitCenter = b1.UnitCenter; Vector2 unitCenter2 = b2.UnitCenter; Vector2 velocity = b1.Velocity; Vector2 val = (ignoreOtherVelocity ? Vector2.zero : b2.Velocity); Vector2 val2 = unitCenter - unitCenter2; float num = Mathf.Max(0.1f, ((Vector2)(ref val2)).sqrMagnitude); newv1 = velocity - Vector2.Dot(velocity - val, unitCenter - unitCenter2) / num * (unitCenter - unitCenter2); newv2 = val - Vector2.Dot(val - velocity, unitCenter2 - unitCenter) / num * (unitCenter2 - unitCenter); } private void BounceAwayEnemies(SpeculativeRigidbody myRigidbody, PixelCollider myCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherCollider) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)otherRigidbody) && Object.op_Implicit((Object)(object)((BraveBehaviour)otherRigidbody).aiActor) && Object.op_Implicit((Object)(object)((BraveBehaviour)((BraveBehaviour)otherRigidbody).aiActor).healthHaver) && !((BraveBehaviour)((BraveBehaviour)otherRigidbody).aiActor).healthHaver.IsDead) { AIActor aiActor = ((BraveBehaviour)otherRigidbody).aiActor; DoElasticCollision(myRigidbody, otherRigidbody, out var newv, out var newv2, ignoreOtherVelocity: true); float num = 0.5f * (((Vector2)(ref newv2)).magnitude + ((Vector2)(ref newv)).magnitude); ((BraveBehaviour)aiActor).knockbackDoer.ApplyKnockback(newv2, 16f * num, false); targetVelocity = ((Vector2)(ref targetVelocity)).magnitude * ((Vector2)(ref newv)).normalized; ((BraveBehaviour)((CustomDodgeRoll)this)._owner).specRigidbody.Velocity = newv; rollDamageModifier.amount = Mathf.Sqrt(((Vector2)(ref targetVelocity)).magnitude); ((CustomDodgeRoll)this)._owner.stats.RecalculateStats(((CustomDodgeRoll)this)._owner, true, false); ((CustomDodgeRoll)this)._owner.ApplyRollDamage(aiActor); ((Component)((CustomDodgeRoll)this)._owner).gameObject.PlayOnce("undertale_damage"); } } private void ExtinguishFire() { if (!(((CustomDodgeRoll)this)._owner.CurrentFireMeterValue <= 0f)) { ((CustomDodgeRoll)this)._owner.CurrentFireMeterValue = Mathf.Max(0f, ((CustomDodgeRoll)this)._owner.CurrentFireMeterValue - 1f * BraveTime.DeltaTime); if (((CustomDodgeRoll)this)._owner.CurrentFireMeterValue == 0f) { ((CustomDodgeRoll)this)._owner.IsOnFire = false; } } } protected override IEnumerator ContinueDodgeRoll() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__48(0) { <>4__this = this }; } protected override void FinishDodgeRoll(bool aborted = false) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown if (stumbleClip != null) { for (int i = 0; i < stumbleClip.frames.Length; i++) { stumbleClip.frames[i].invulnerableFrame = wasFrameInvulnerable[i]; } } ((CustomDodgeRoll)this)._owner.OnReceivedDamage -= OnReceivedDamage; reflectingProjectiles = false; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)((CustomDodgeRoll)this)._owner).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Remove((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(BounceAwayEnemies)); SpeculativeRigidbody specRigidbody2 = ((BraveBehaviour)((CustomDodgeRoll)this)._owner).specRigidbody; specRigidbody2.OnCollision = (Action)Delegate.Remove(specRigidbody2.OnCollision, new Action(BounceOffWalls)); ((CustomDodgeRoll)this)._owner.ToggleHandRenderers(true, "gyrostumble"); ((CustomDodgeRoll)this)._owner.ToggleGunRenderers(true, "gyrostumble"); ((CustomDodgeRoll)this)._owner.ClearInputOverride("gyrostumble"); ((CustomDodgeRoll)this)._owner.m_overrideGunAngle = null; ((CustomDodgeRoll)this)._owner.forceAimPoint = null; Gun currentGun = ((GameActor)((CustomDodgeRoll)this)._owner).CurrentGun; if (currentGun != null) { currentGun.HandleSpriteFlip(((GameActor)((CustomDodgeRoll)this)._owner).SpriteFlipped); } ((BraveBehaviour)((CustomDodgeRoll)this)._owner).spriteAnimator.Stop(); ((BraveBehaviour)((CustomDodgeRoll)this)._owner).spriteAnimator.Play(((BraveBehaviour)((CustomDodgeRoll)this)._owner).spriteAnimator.GetClipByName("idle_front")); ((BraveBehaviour)((CustomDodgeRoll)this)._owner).healthHaver.IsVulnerable = true; if (isSpeedModActive) { ((CustomDodgeRoll)this)._owner.ownerlessStatModifiers.Remove(speedModifier); } if (isRollModActive) { ((CustomDodgeRoll)this)._owner.ownerlessStatModifiers.Remove(rollDamageModifier); } isSpeedModActive = false; isRollModActive = false; ((CustomDodgeRoll)this)._owner.stats.RecalculateStats(((CustomDodgeRoll)this)._owner, false, false); if (Object.op_Implicit((Object)(object)tornadoVFX)) { Object.Destroy((Object)(object)tornadoVFX); } } private void BounceOffWalls(CollisionData tileCollision) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) float num = Vector2Extensions.ToAngle(-targetVelocity); float num2 = Vector2Extensions.ToAngle(((CastResult)tileCollision).Normal); float num3 = BraveMathCollege.ClampAngle360(num + 2f * (num2 - num)); targetVelocity = BraveMathCollege.DegreesToVector(num3, ((Vector2)(ref targetVelocity)).magnitude); ((BraveBehaviour)((CustomDodgeRoll)this)._owner).specRigidbody.Velocity = targetVelocity; } } public class JohnsWick : CwaffPassive { [CompilerGenerated] private sealed class d__16 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public SpeculativeRigidbody s; public bool once; private Color? 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = Color.blue; break; case 1: <>1__state = -1; break; } if (Object.op_Implicit((Object)(object)s)) { Vector3 val = Vector2Extensions.ToVector3ZisY(s.HitboxPixelCollider.UnitBottomLeft, 0f); Vector3 val2 = Vector2Extensions.ToVector3ZisY(s.HitboxPixelCollider.UnitTopRight, 0f); Color? val3 = 5__2; float? num = 0.5f; GlobalSparksDoer.DoRadialParticleBurst(1, val, val2, 15f, 2.25f, 1f, (float?)null, num, val3, (SparksType)8); if (once) { return false; } <>2__current = null; <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static string ItemName = "John's Wick"; public static string ShortDescription = "No Dogs Harmed"; public static string LongDescription = "Move faster and deal double damage while on fire, and take damage from fire more slowly."; public static string Lore = "According to Bello, the wick inside this lantern was once possessed by a man who survived dozens of assassination attempts en route to grabbing breakfast at a hotel. This raises far more questions than it answers, and Bello refuses to elaborate further."; private const float _FIRE_TIMER_MULT = 0.25f; private const float _MOVEMENT_BOOST = 5f; private const float _DAMAGE_BOOST = 2f; private bool _wasOnFire; private StatModifier[] _flameOn; private StatModifier[] _flameOff; private DamageTypeModifier _fireResistance; public static void Init() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) ((PickupObject)Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore)).quality = (ItemQuality)2; } public override void OnFirstPickup(PlayerController player) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown base.OnFirstPickup(player); _flameOff = (StatModifier[])(object)new StatModifier[0]; _flameOn = (StatModifier[])(object)new StatModifier[2] { ((StatType)0).Add(5f), ((StatType)5).Mult(2f) }; _wasOnFire = false; _fireResistance = new DamageTypeModifier { damageType = (CoreDamageTypes)4, damageMultiplier = 0.25f }; } public override void Pickup(PlayerController player) { base.Pickup(player); ((PassiveItem)this).passiveStatModifiers = _flameOff; player.PostProcessProjectile += PostProcessProjectile; ((BraveBehaviour)player).healthHaver.damageTypeModifiers.AddUnique(_fireResistance); } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { player.PostProcessProjectile -= PostProcessProjectile; ((BraveBehaviour)player).healthHaver.damageTypeModifiers.TryRemove(_fireResistance); } } private void PostProcessProjectile(Projectile proj, float effectChanceScalar) { if (Object.op_Implicit((Object)(object)((PassiveItem)this).Owner) && _wasOnFire) { ((MonoBehaviour)proj).StartCoroutine(GetWicked(((BraveBehaviour)proj).specRigidbody)); } } private IEnumerator GetWicked(SpeculativeRigidbody s, bool once = false) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__16(0) { s = s, once = once }; } public override void Update() { ((PassiveItem)this).Update(); if (Object.op_Implicit((Object)(object)((PassiveItem)this).Owner)) { if (_wasOnFire != ((PassiveItem)this).Owner.IsOnFire) { _wasOnFire = ((PassiveItem)this).Owner.IsOnFire; ((PassiveItem)this).passiveStatModifiers = (((PassiveItem)this).Owner.IsOnFire ? _flameOn : _flameOff); ((PassiveItem)this).Owner.stats.RecalculateStats(((PassiveItem)this).Owner, false, false); } if (((PassiveItem)this).Owner.IsOnFire) { ((MonoBehaviour)((PassiveItem)this).Owner).StartCoroutine(GetWicked(((BraveBehaviour)((PassiveItem)this).Owner).specRigidbody, once: true)); } } } } public class ChewToy : CwaffCompanion { [HarmonyPatch] private static class ShmuppyReinforcementPatch { private const float _SPAWN_CHANCE = 0.02f; private static bool _SpawnedThisRoom; private static RoomHandler _LastSpawnedRoom; [HarmonyPatch(typeof(AIActor), "OnEngaged")] [HarmonyPrefix] private static void AIActorOnEngagedPrefixPatch(AIActor __instance, bool isReinforcement, ref bool __state) { __state = false; if (Object.op_Implicit((Object)(object)__instance) && !__instance.m_hasBeenEngaged && !__instance.IsInReinforcementLayer && !(__instance.EnemyGuid != "01972dee89fc4404a5c408d50007dad5") && !(Random.value > 0.02f)) { __state = true; } } [HarmonyPatch(typeof(AIActor), "OnEngaged")] [HarmonyPostfix] private static void AIActorOnEngagedPostfixPatch(AIActor __instance, bool isReinforcement, ref bool __state) { //IL_000e: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (!__state || !Object.op_Implicit((Object)(object)__instance)) { return; } RoomHandler absoluteRoom = Vector3Extensions.GetAbsoluteRoom(((GameActor)__instance).CenterPosition); if (absoluteRoom != null && absoluteRoom != null) { if (_LastSpawnedRoom != absoluteRoom) { _LastSpawnedRoom = absoluteRoom; _SpawnedThisRoom = false; } if (!_SpawnedThisRoom) { AIActor.Spawn(ShmuppyEnemyPrefab, (IntVector2)(((??)ShmuppyEnemyPrefab.RandomCellForEnemySpawn(absoluteRoom)) ?? Vector2Extensions.ToIntVector2(((GameActor)__instance).CenterPosition, (VectorConversions)2)), absoluteRoom, true, (AwakenAnimationType)2, true).SpawnInInstantly(isReinforcement: false); _SpawnedThisRoom = true; } } } } public static string ItemName = "Chew Toy"; public static string ShortDescription = "Bullet Bitten"; public static string LongDescription = "Spawns a friendly Shmuppy. While in combat, Shmuppy will distract and draw fire from a single enemy. Shmuppy is scared of bosses, and will play dead during boss fights."; public static string Lore = "While normally completely loyal to the Bullet Kin, Shmuppies have an incredibly soft spot for their favorite chew toys, and with minimal effort, can be coaxed into joining any friendly Gungeoneer on their adventure. They seem to be a lot more easily distracted while by your side, but their heart is in the right place."; public static string CompanionName = "Shmuppy"; public static string EnemyDesc = "Bullet Dog"; public static string EnemyLongDesc = "A valued companion in bullet society. While docile and physically harmless most of the time, their barks can disrupt the passage of fired bullets and thus are a helpful way to mildly disarm trespassing gungeoneers, hopefully long enough to be stopped by reinforcements."; public static AIActor ShmuppyEnemyPrefab = null; private static readonly string[] Directions = new string[8] { "back", "back_right", "right", "front_right", "front", "front_left", "left", "back_left" }; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore, hideFromAmmonomicon: false, 1f); ((PickupObject)obj).quality = (ItemQuality)1; ShmuppyCompanion shmuppyCompanion = obj.InitCompanion(CompanionName, 20, new List(3) { "bark", "hurt", "death" }).SetPettingOffsets(new Vector2(-0.875f, -0.25f), (Vector2?)new Vector2(0.6875f, -0.25f)); ((Component)shmuppyCompanion).gameObject.GetComponent().MovementBehaviors.Add((MovementBehaviorBase)(object)new ShmuppyCompanion.ShmuppyMovementBehavior()); ShmuppyEnemyPrefab = CompanionName.InitEnemy(30, extraAnims: new List(3) { "bark", "hurt", "death" }, shortDesc: EnemyDesc, longDesc: EnemyLongDesc, baseFps: 20); ((Component)ShmuppyEnemyPrefab).gameObject.GetComponent().MovementBehaviors.Add((MovementBehaviorBase)(object)new ShmuppyCompanion.ShmuppyMovementBehavior()); AIActor[] array = (AIActor[])(object)new AIActor[2] { ((BraveBehaviour)shmuppyCompanion).aiActor, ShmuppyEnemyPrefab }; foreach (AIActor obj2 in array) { KnockbackDoer component = ((Component)obj2).gameObject.GetComponent(); if (component != null) { component.weight = 30f; } tk2dSpriteAnimation component2 = ((Component)obj2).gameObject.GetComponent(); string[] directions = Directions; foreach (string text in directions) { component2.GetClipByName("shmuppy_idle_" + text).fps = 8f; component2.GetClipByName("shmuppy_bark_" + text).frames[2].AddSound("shmuppy_bark_sound"); } } } } public class ShmuppyCompanion : CwaffCompanionController { public class ShmuppyMovementBehavior : CwaffCompanionMovementBehaviorBase { internal enum State { IDLE, FOLLOW, CHASE, BARK, DISTRACT, PLAYDEAD } private const float _SPEED = 10f; private const float NEAR_OWNER = 2f; private const float FAR_FROM_OWNER = 6f; private State _state; private HealthHaver _hh; private UltraFortunesFavor _uff; public override void Start() { //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown base.Start(); retargetOnPathingFailure = true; ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.CollideWithOthers = true; ((BehaviorBase)this).m_aiActor.MovementSpeed = 10f; _hh = ((Component)((BehaviorBase)this).m_aiActor).gameObject.GetComponent(); if (!_isCompanion) { _uff = ((Component)((BehaviorBase)this).m_aiActor).gameObject.AddComponent(); _uff.sparkOctantVFX = CwaffCompanionAndEnemyBuilder.FortunesFavorVFX; _uff.vfxOffset = 0.625f; _uff.bulletRadius = 2f; _uff.bulletSpeedModifier = 0.8f; _uff.beamRadius = 2f; _uff.goopRadius = 2f; ((Behaviour)_uff).enabled = false; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreRigidbodyCollision)); } } private void OnPreRigidbodyCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { if (Object.op_Implicit((Object)(object)((Component)otherRigidbody).gameObject.GetComponent())) { PhysicsEngine.SkipCollision = true; } } private void ResetState() { _state = State.IDLE; m_stateTimer = 0.5f; ((BehaviorBase)this).m_aiAnimator.EndAnimation(); GameActor targetActor = _targetActor; AIActor val = (AIActor)(object)((targetActor is AIActor) ? targetActor : null); if (val != null && (Object)(object)val.OverrideTarget == (Object)(object)((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody) { val.OverrideTarget = null; } } private AIActor FindNearbyBulletKin() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) foreach (AIActor allNearbyEnemy in Lazy.GetAllNearbyEnemies(((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition, 16f, ignoreWalls: true)) { HealthHaver healthHaver = ((BraveBehaviour)allNearbyEnemy).healthHaver; if (healthHaver != null && healthHaver.IsAlive && allNearbyEnemy.AmmonomiconName().Contains("Bullet Kin")) { return allNearbyEnemy; } } return null; } private void FollowOwner() { //IL_0042: 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_0047: Unknown result type (might be due to invalid IL or missing references) _targetActor = (GameActor)(_isCompanion ? ((object)m_companionController.m_owner) : ((object)FindNearbyBulletKin())); _targetPos = (Object.op_Implicit((Object)(object)_targetActor) ? _targetActor.CenterPosition : ((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition); _state = ((!NearTargetActor(6f)) ? State.FOLLOW : State.IDLE); RepathToTarget(); } protected override void OnWarp() { DetermineNewTarget(); } protected override void TickMovement(ref Vector2 voluntaryVel, ref Vector2 involuntaryVel) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) base.TickMovement(ref voluntaryVel, ref involuntaryVel); if (_state != State.BARK && Object.op_Implicit((Object)(object)_uff)) { ((Behaviour)_uff).enabled = false; } else if (_state == State.BARK && Object.op_Implicit((Object)(object)_targetActor)) { float facingDirection = Vector2Extensions.ToAngle(_targetActor.CenterPosition - ((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition); ((BehaviorBase)this).m_aiAnimator.FacingDirection = facingDirection; } } protected override bool IsTargetValid() { return _state switch { State.IDLE => true, State.FOLLOW => Object.op_Implicit((Object)(object)_targetActor), State.CHASE => Object.op_Implicit((Object)(object)_targetActor), State.BARK => Object.op_Implicit((Object)(object)_targetActor), State.DISTRACT => Object.op_Implicit((Object)(object)_targetActor), State.PLAYDEAD => true, _ => false, }; } private void DetermineNewTargetAsCompanion() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) _allowPathing = true; ResetState(); PlayerController owner = m_companionController.m_owner; if (owner == null) { return; } FollowOwner(); if (!owner.IsInCombat) { return; } List allNearbyEnemies = Lazy.GetAllNearbyEnemies(((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition, 16f, ignoreWalls: true); if (allNearbyEnemies.Count != 0) { AIActor val = allNearbyEnemies.ChooseRandom(); if (val != null) { _targetActor = (GameActor)(object)val; _targetPos = _targetActor.CenterPosition; _state = State.CHASE; } } } private void DetermineNewTargetAsEnemy() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) _allowPathing = true; ResetState(); PlayerController randomActivePlayer = GameManager.Instance.GetRandomActivePlayer(); if (Object.op_Implicit((Object)(object)randomActivePlayer)) { _targetActor = (GameActor)(object)randomActivePlayer; _targetPos = _targetActor.CenterPosition; _state = State.CHASE; } } protected override void DetermineNewTarget() { if (_isCompanion) { DetermineNewTargetAsCompanion(); } else { DetermineNewTargetAsEnemy(); } } protected override void UpdateStateAndTargetPosition() { //IL_001d: 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) if (Object.op_Implicit((Object)(object)_targetActor) && _state != State.DISTRACT) { _targetPos = _targetActor.CenterPosition; } } protected override bool ReachedTarget() { if (_isCompanion && Object.op_Implicit((Object)(object)m_companionController) && m_companionController.IsBeingPet) { return false; } switch (_state) { case State.IDLE: return true; case State.FOLLOW: return NearTargetActor(2f); case State.CHASE: return NearTargetActor(5f); case State.BARK: if (!NearTargetActor(3f)) { return StateExpired(); } return true; case State.DISTRACT: if (!NearTargetPos(3f)) { return StateExpired(); } return true; case State.PLAYDEAD: return !InCombat(); default: return false; } } private Vector2 GetRandomVisiblePointInRoom() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_003f: Unknown result type (might be due to invalid IL or missing references) RoomHandler val; if (_isCompanion) { PlayerController owner = m_companionController.m_owner; if (owner != null) { val = owner.CurrentRoom; goto IL_0031; } } val = Vector3Extensions.GetAbsoluteRoom(((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition); goto IL_0031; IL_0031: if (val != null) { IntVector2 randomVisibleClearSpot = val.GetRandomVisibleClearSpot(2, 2); return ((IntVector2)(ref randomVisibleClearSpot)).ToVector2(); } return ((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition; } protected override void OnReachedTarget() { //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) switch (_state) { case State.IDLE: DetermineNewTarget(); break; case State.FOLLOW: ResetState(); break; case State.CHASE: { _allowPathing = false; ((BehaviorBase)this).m_aiActor.ClearPath(); if (Object.op_Implicit((Object)(object)_targetActor)) { HealthHaver component = ((Component)_targetActor).gameObject.GetComponent(); if (component != null && (component.IsBoss || component.IsSubboss)) { _state = State.PLAYDEAD; ((BehaviorBase)this).m_aiAnimator.PlayUntilCancelled("death", false, (string)null, -1f, false); break; } } _state = State.BARK; if (!_isCompanion) { ((Behaviour)_uff).enabled = true; } m_stateTimer = 3f; GameActor targetActor = _targetActor; AIActor val = (AIActor)(object)((targetActor is AIActor) ? targetActor : null); if (val != null && (Object)(object)val.OverrideTarget == (Object)null) { val.OverrideTarget = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody; } if (Object.op_Implicit((Object)(object)_targetActor)) { float facingDirection = Vector2Extensions.ToAngle(_targetActor.CenterPosition - ((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition); ((BehaviorBase)this).m_aiAnimator.FacingDirection = facingDirection; } ((BehaviorBase)this).m_aiAnimator.EndAnimation(); ((BehaviorBase)this).m_aiAnimator.PlayUntilCancelled("bark", false, (string)null, -1f, false); break; } case State.BARK: { ResetState(); GameActor targetActor2 = _targetActor; AIActor val2 = (AIActor)(object)((targetActor2 is AIActor) ? targetActor2 : null); if (val2 != null && (Object)(object)val2.OverrideTarget == (Object)null) { val2.OverrideTarget = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody; } _allowPathing = true; _state = State.DISTRACT; m_stateTimer = 5f; _targetPos = GetRandomVisiblePointInRoom(); break; } case State.DISTRACT: if (m_stateTimer <= 0f) { ResetState(); FollowOwner(); } else { _targetPos = GetRandomVisiblePointInRoom(); } break; case State.PLAYDEAD: FollowOwner(); break; } } } } public class RingOfDefenestration : CwaffPassive { [HarmonyPatch(typeof(GameStatsManager), "RegisterStatChange")] private class RingOfDefenestrationPatch { private static void Postfix(TrackedStats stat, float value) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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) if ((int)stat != 64 || !Lazy.AnyoneHas()) { return; } int num = _RewardWeights.WeightedRandom(); int num2 = ((!(Random.value <= 0.33f) || !Synergy.THE_ABYSS_STARES_BACK.Active()) ? 1 : 2); for (int i = 0; i < num2; i++) { if (num < 0) { LootEngine.SpawnCurrency(((GameActor)GameManager.Instance.BestActivePlayer).CenterPosition, -num, false); } else { LootEngine.SpawnItem(((Component)PickupObjectDatabase.GetById(num)).gameObject, Vector2.op_Implicit(((GameActor)GameManager.Instance.BestActivePlayer).CenterPosition), Vector2.zero, 0f, true, true, false); } } } } public static string ItemName = "Ring of Defenestration"; public static string ShortDescription = "Babies AND Bathwater"; public static string LongDescription = "Pushing an enemy into a pit has an 80% chance to spawn casings and a 20% chance to spawn a random pickup."; public static string Lore = "Every warrior worth their salt occasionally tosses their opponents out of a window or moving vehicle to plummet towards their doom. While stylish and assertive, this maneuver unfortunately makes it very difficult to retrieve any loot the victims may have been carrying. This ring represents a pact with the Pit Lord to return any loot carried by those sacrificed to the pits of the Gungeon."; internal static readonly List _RewardWeights = new List { new IntVector2(-3, 40), new IntVector2(-5, 24), new IntVector2(-10, 16), new IntVector2(85, 4), new IntVector2(120, 4), new IntVector2(224, 4), new IntVector2(78, 4), new IntVector2(600, 4) }; public static void Init() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) ((PickupObject)Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore)).quality = (ItemQuality)2; } } public static class Lazy { private class LoopingSoundHandler : MonoBehaviour { private class LoopingSoundData { public uint id; public float timer; public bool finishNaturally; } private const float _TIMEOUT = 0.1f; private static List _LoopTimers = new List(16); private void Update() { for (int num = _LoopTimers.Count - 1; num >= 0; num--) { LoopingSoundData loopingSoundData = _LoopTimers[num]; if (!loopingSoundData.finishNaturally && !(BraveTime.ScaledTimeSinceStartup - loopingSoundData.timer < 0.1f)) { AkSoundEngine.StopPlayingID(loopingSoundData.id); _LoopTimers.RemoveAt(num); } } } public void NewSound(uint soundId, GameObject gameObject, bool finishNaturally) { _LoopTimers.Add(new LoopingSoundData { id = AkSoundEngine.PostEvent(soundId, gameObject, 1048576u), timer = BraveTime.ScaledTimeSinceStartup, finishNaturally = finishNaturally }); } public void RefreshSoundTimer(uint playingId) { for (int i = 0; i < _LoopTimers.Count; i++) { if (_LoopTimers[i].id == playingId) { _LoopTimers[i].timer = BraveTime.ScaledTimeSinceStartup; break; } } } } [CompilerGenerated] private sealed class <g__Dissipate_CR|103_0>d : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Func easeEmit; public Func easeAmp; public Func easeFade; public tk2dMeshSprite ms; public float emissionStart; public bool progressive; public float amplitudeStart; public string sound; public float soundTime; public float time; public float emissionEnd; public float amplitudeEnd; private Material 5__2; private bool 5__3; private float 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <g__Dissipate_CR|103_0>d(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (easeEmit == null) { easeEmit = Ease.OutQuad; } if (easeAmp == null) { easeAmp = Ease.OutQuad; } if (easeFade == null) { easeFade = Ease.OutQuad; } 5__2 = ((BraveBehaviour)ms).renderer.material; 5__2.shader = CwaffShaders.ShatterShader; 5__2.SetFloat("_Emission", emissionStart); 5__2.SetFloat("_Progressive", progressive ? 1f : 0f); 5__2.SetFloat("_Amplitude", amplitudeStart); 5__2.SetFloat("_RandomSeed", Random.value); if ((Object)(object)ms.optionalPalette != (Object)null) { 5__2.SetFloat("_UsePalette", 1f); 5__2.SetTexture("_PaletteTex", (Texture)(object)ms.optionalPalette); } 5__3 = sound == null; 5__4 = 0f; break; case 1: <>1__state = -1; 5__4 += BraveTime.DeltaTime; break; } if (5__4 < time) { if (!5__3 && 5__4 >= soundTime) { ((Component)ms).gameObject.Play(sound); 5__3 = true; } float arg = 5__4 / time; 5__2.SetFloat(CwaffVFX._FadeId, easeFade(arg)); if (emissionEnd >= 0f) { 5__2.SetFloat("_Emission", Mathf.Lerp(emissionStart, emissionEnd, easeEmit(arg))); } if (amplitudeEnd >= 0f) { 5__2.SetFloat("_Amplitude", Mathf.Lerp(amplitudeStart, amplitudeEnd, easeAmp(arg))); } <>2__current = null; <>1__state = 1; return true; } Object.Destroy((Object)(object)((Component)ms).gameObject); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <g__PlaySoundUntilDeathOrTimeout_CR|33_0>d : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public string soundName; public float timer; public GameObject source; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <g__PlaySoundUntilDeathOrTimeout_CR|33_0>d(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; _SoundTimers[soundName] = timer; source.Play(soundName); break; case 1: <>1__state = -1; break; } if ((Object)(object)source != (Object)null && _SoundTimers[soundName] > 0f) { _SoundTimers[soundName] -= BraveTime.DeltaTime; <>2__current = null; <>1__state = 1; return true; } source.Play(soundName + "_stop_all"); _SoundTimers.Remove(soundName); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__54 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private AIActor <>2__current; private int <>l__initialThreadId; private float maxDistance; public float <>3__maxDistance; private Vector2 start; public Vector2 <>3__start; private bool ignoreWalls; public bool <>3__ignoreWalls; private float coneAngle; public float <>3__coneAngle; private float maxDeviation; public float <>3__maxDeviation; private float 5__2; private List.Enumerator <>7__wrap2; AIActor IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__54(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Thread.CurrentThread.ManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <>7__wrap2 = default(List.Enumerator); <>1__state = -2; } private bool MoveNext() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = maxDistance * maxDistance; start.SafeGetEnemiesInRoom(ref _TempEnemies); <>7__wrap2 = _TempEnemies.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; break; } while (<>7__wrap2.MoveNext()) { AIActor current = <>7__wrap2.Current; if (!current.IsHostile(canBeDead: false, canBeNeutral: true)) { continue; } Vector2 centerPosition = ((GameActor)current).CenterPosition; if (ignoreWalls || start.HasLineOfSight(centerPosition)) { Vector2 val = centerPosition - start; float num = Vector2Extensions.ToAngle(val).Clamp360(); if (!(Mathf.Abs((coneAngle - num).Clamp180()) > maxDeviation) && !(((Vector2)(ref val)).sqrMagnitude > 5__2)) { <>2__current = current; <>1__state = 1; return true; } } } <>m__Finally1(); <>7__wrap2 = default(List.Enumerator); return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>7__wrap2).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { //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) d__54 d__; if (<>1__state == -2 && <>l__initialThreadId == Thread.CurrentThread.ManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__54(0); } d__.start = <>3__start; d__.coneAngle = <>3__coneAngle; d__.maxDeviation = <>3__maxDeviation; d__.maxDistance = <>3__maxDistance; d__.ignoreWalls = <>3__ignoreWalls; return d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } [CompilerGenerated] private sealed class d__100 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float time; public bool shrink; public DebrisObject debris; private float 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__100(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = time; break; case 1: <>1__state = -1; 5__2 -= BraveTime.DeltaTime; break; } if (5__2 > 0f) { if (shrink) { Vector2 worldCenter = ((BraveBehaviour)debris).sprite.WorldCenter; ((BraveBehaviour)debris).sprite.scale = 5__2 / time * Vector3.one; ((BraveBehaviour)debris).sprite.PlaceAtScaledPositionByAnchor(Vector2.op_Implicit(worldCenter), (Anchor)4); } else { ((BraveBehaviour)((BraveBehaviour)debris).sprite).renderer.SetAlpha(5__2 / time); } <>2__current = null; <>1__state = 1; return true; } Object.Destroy((Object)(object)((Component)debris).gameObject); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } internal static tk2dSpriteCollectionData _GunSpriteCollection = null; private static readonly Dictionary _CustomPickups = new Dictionary(); private static readonly Dictionary _CustomPickupIds = new Dictionary(); private static ProjectileModule _BaseModule = null; private static GenericLootTable _GunLoot = null; private static GenericLootTable _ItemLoot = null; private static readonly List _GunsToFinalize = new List(); internal static Dictionary _SoundTimers = new Dictionary(); private static readonly uint[] _PlayingIds = new uint[16]; private static Projectile _NullProjectilePrefab = null; private static List _TempEnemies = new List(); private static List _TempNearbyEnemies = new List(); private static List> _ActorDistances = new List>(); private static Dictionary _FragmentDict = new Dictionary(); private static GameObject _BlankVFXPrefab = null; private const int _RANDOM_STRING_LENGTH = 10; private const int _MAX_CACHED_RANDOM_STRINGS = 100; private static List _RandomStrings = new List(100); private static readonly Dictionary _ReadableTexes = new Dictionary(); private static GameObject _BaseDispersalSystem = null; [Conditional("DEBUG")] public static void DebugLog(object text) { ETGModConsole.Log(text, false); } [Conditional("DEBUG")] public static void DebugWarn(string text) { ETGModConsole.Log((object)("" + text + ""), false); } [Conditional("DEBUG")] public static void DebugConsoleLog(object text) { Console.WriteLine(text); } public static void RuntimeWarn(string text) { ETGModConsole.Log((object)("" + text + "; tell Captain Pretzel"), false); } public static TItemClass SetupItem(string itemName, string shortDescription, string longDescription, string lore, bool hideFromAmmonomicon = false, float weight = 1f) where TItemClass : PickupObject where TItemSpecific : TItemClass { //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Invalid comparison between Unknown and I4 if (_GunLoot == null) { _GunLoot = GameManager.Instance.RewardManager.GunsLootTable; } if (_ItemLoot == null) { _ItemLoot = GameManager.Instance.RewardManager.ItemsLootTable; } string text = itemName.InternalName(); string text2 = "cg:" + text; bool num = (object)typeof(TItemClass) == typeof(Gun); string text3; TItemClass val2; if (num) { if (_BaseModule == null) { _BaseModule = Items._38Special.AsGun().DefaultModule; } GameObject gameObject = ((Component)ItemHelper.Get(Items.PeaShooter)).gameObject; gameObject.SetActive(false); GameObject val = Object.Instantiate(gameObject); gameObject.SetActive(true); ((Object)val).name = text; text3 = "cg_" + text + "_ammonomicon"; Gun component = val.GetComponent(); ((Component)component.barrelOffset).transform.localScale = Vector3.one; component.gunName = itemName; component.gunSwitchGroup = text; component.modifiedVolley = null; component.singleModule = null; component.RawSourceVolley = ScriptableObject.CreateInstance(); component.Volley.projectiles = new List { ProjectileModule.CreateClone(_BaseModule, false, -1) }; component.QuickUpdateGunAnimations(); val2 = (TItemClass)(object)((component is TItemClass) ? component : null); } else { GameObject obj = Extensions.RegisterPrefab(new GameObject(itemName)); text3 = text + "_icon"; tk2dSpriteCollectionData itemCollection = Databases.Items.ItemCollection; tk2dSprite obj2 = obj.AddComponent(); ((tk2dBaseSprite)obj2).SetSprite(itemCollection, itemCollection.GetSpriteIdByName(text3)); ((tk2dBaseSprite)obj2).SortingOrder = 0; ((tk2dBaseSprite)obj2).IsPerpendicular = true; val2 = (TItemClass)(object)obj.AddComponent(); } Databases.Items.SetupItem((PickupObject)(object)val2, itemName); if (!hideFromAmmonomicon || C.DEBUG_BUILD) { Game.Items.Add(text2, (PickupObject)(object)val2); } ((PickupObject)val2).itemName = itemName; ((BraveBehaviour)(object)val2).encounterTrackable.journalData.AmmonomiconSprite = text3; ((BraveBehaviour)(object)val2).encounterTrackable.EncounterGuid = "cg-" + text; GunExt.SetShortDescription((PickupObject)(object)val2, shortDescription); GunExt.SetLongDescription((PickupObject)(object)val2, longDescription + "\n\n" + lore); Databases.Items.Add((PickupObject)(object)val2, false, "ANY"); GenericLootTable val3 = (num ? _GunLoot : _ItemLoot); if ((int)((PickupObject)val2).quality == -50) { val3.defaultItemDrops.elements.RemoveAt(val3.defaultItemDrops.elements.Count - 1); } else if (weight != 1f) { val3.defaultItemDrops.elements.Last().weight = weight; } if (hideFromAmmonomicon) { ((BraveBehaviour)(object)val2).encounterTrackable.journalData.SuppressInAmmonomicon = true; } if (!num) { _CustomPickups[typeof(TItemSpecific)] = (PickupObject)(object)val2; _CustomPickupIds[typeof(TItemSpecific)] = ((PickupObject)val2).PickupObjectId; } return val2; } public static TItemSpecific SetupFakeItem() where TItemSpecific : FakeItem { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown //IL_0157: Unknown result type (might be due to invalid IL or missing references) string name = typeof(TItemSpecific).Name; string text = name.InternalName(); string text2 = "cg:" + text; GameObject obj = Extensions.RegisterPrefab(new GameObject(name)); tk2dSprite obj2 = obj.AddComponent(); ((tk2dBaseSprite)obj2).collection = Databases.Items.ItemCollection; ((tk2dBaseSprite)obj2).spriteId = 0; TItemSpecific val = obj.AddComponent(); Databases.Items.SetupItem((PickupObject)(object)val, name); if (C.DEBUG_BUILD) { Game.Items.Add(text2, (PickupObject)(object)val); } ((PickupObject)val).itemName = name; ((BraveBehaviour)val).encounterTrackable.EncounterGuid = "cg-" + text; ((PickupObject)val).PickupObjectId = ((ObjectDatabase)(object)PickupObjectDatabase.Instance).Objects.Count; ((ObjectDatabase)(object)PickupObjectDatabase.Instance).Objects.Add((PickupObject)(object)val); ((AssetBundleDatabase)(object)EncounterDatabase.Instance).Entries.Add(new EncounterDatabaseEntry(((BraveBehaviour)val).encounterTrackable) { myGuid = ((BraveBehaviour)val).encounterTrackable.EncounterGuid, path = "Assets/Resources/ITEMDB:" + ((Object)val).name + ".prefab" }); ((BraveBehaviour)val).encounterTrackable.journalData.SuppressInAmmonomicon = true; ((BraveBehaviour)val).encounterTrackable.m_doNotificationOnEncounter = false; ((PickupObject)val).quality = (ItemQuality)(-50); ((PickupObject)val).ShouldBeExcludedFromShops = true; ((BraveBehaviour)val).encounterTrackable.SuppressInInventory = true; ((BraveBehaviour)val).encounterTrackable.IgnoreDifferentiator = true; ((PickupObject)val).CanBeDropped = false; ((PickupObject)val).PersistsOnDeath = true; ((PickupObject)val).CanBeSold = false; ((PickupObject)val).IgnoredByRat = true; ((PickupObject)val).ClearIgnoredByRatFlagOnPickup = false; return val; } public static PassiveItem SetupPassive(string itemName, string shortDescription, string longDescription, string lore, bool hideFromAmmonomicon = false, float weight = 1f) where T : PassiveItem { return Lazy.SetupItem(itemName, shortDescription, longDescription, lore, hideFromAmmonomicon, weight); } public static PlayerItem SetupActive(string itemName, string shortDescription, string longDescription, string lore, bool hideFromAmmonomicon = false, float weight = 1f) where T : PlayerItem { return Lazy.SetupItem(itemName, shortDescription, longDescription, lore, hideFromAmmonomicon, weight); } public static Gun SetupGun(string gunName, string shortDescription, string longDescription, string lore, bool hideFromAmmonomicon = false, float weight = 1f) where T : GunBehaviour { //IL_0097: Unknown result type (might be due to invalid IL or missing references) Gun val = Lazy.SetupItem(gunName, shortDescription, longDescription, lore, hideFromAmmonomicon, weight); ((Component)val).gameObject.AddComponent(); _CustomPickups[typeof(T)] = (PickupObject)(object)val; _CustomPickupIds[typeof(T)] = ((PickupObject)val).PickupObjectId; if (_GunSpriteCollection == null) { _GunSpriteCollection = ((BraveBehaviour)val).sprite.collection; } AttachPoint[] array = val.AttachPointsForClip(val.idleAnimation); if (array != null) { for (int i = 0; i < array.Length; i++) { if (array[i].name == "Casing") { ((Component)val.barrelOffset).transform.localPosition = array[i].position; } } } ((BraveBehaviour)val).spriteAnimator.DefaultClipId = ((BraveBehaviour)val).spriteAnimator.GetClipIdByName(val.idleAnimation); ((BraveBehaviour)val).spriteAnimator.playAutomatically = true; _GunsToFinalize.Add(val); return val; } public static void FinalizeGuns() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected I4, but got Unknown foreach (Gun item in _GunsToFinalize) { EncounterDatabase.GetEntry(((BraveBehaviour)item).encounterTrackable.EncounterGuid).shootStyleInt = (int)item.DefaultModule.shootStyle; } _GunsToFinalize.Clear(); } public static PickupObject Pickup() { return _CustomPickups[typeof(T)]; } public static PickupObject Pickup(Type t) { return _CustomPickups[t]; } public static int PickupId() { return _CustomPickupIds[typeof(T)]; } public static int PickupId(Type t) { return _CustomPickupIds[t]; } public static void CustomNotification(string header, string text, tk2dBaseSprite sprite = null, NotificationColor? color = null) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (sprite == null) { sprite = GameUIRoot.Instance.notificationController.notificationObjectSprite; } GameUIRoot.Instance.notificationController.DoCustomNotification(header, text, sprite.Collection, sprite.spriteId, color.GetValueOrDefault((NotificationColor)2), false, false); } public static List EasyNamedDirectionalAnimations(string[] animNameList) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) List list = new List(); foreach (string text in animNameList) { NamedDirectionalAnimation val = new NamedDirectionalAnimation(); val.name = text; DirectionalAnimation val2 = new DirectionalAnimation(); val2.Type = (DirectionType)1; val2.Prefix = text; val2.AnimNames = new string[1] { text }; val2.Flipped = (FlipType[])(object)new FlipType[1]; val.anim = val2; list.Add(val); } return list; } public static void MovePlayerTowardsPositionUntilHittingWall(PlayerController player, Vector2 position) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_003c: 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) //IL_004b: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) int num = 100; Vector2 val = Vector2.op_Implicit(((BraveBehaviour)player).transform.position); Vector2 val2 = (position - val) / (float)num; Vector2 val3 = Vector2.zero; for (int i = 0; i < num; i++) { ((BraveBehaviour)player).transform.position = Vector2Extensions.ToVector3ZisY(val + (float)i * val2, 0f); ((BraveBehaviour)player).specRigidbody.Reinitialize(); if (PhysicsEngine.Instance.OverlapCast(((BraveBehaviour)player).specRigidbody, (List)null, true, false, (int?)null, (int?)null, false, (Vector2?)null, (Func)null, (SpeculativeRigidbody[])(object)new SpeculativeRigidbody[0])) { ((BraveBehaviour)player).transform.position = Vector2.op_Implicit(val3); break; } val3 = Vector2.op_Implicit(((BraveBehaviour)player).transform.position); } } public static string GetBaseIdleAnimationName(PlayerController p, float gunAngle) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 string empty = string.Empty; bool flag = (Object)(object)((GameActor)p).CurrentGun != (Object)null; if ((int)GameManager.Instance.CurrentLevelOverrideState == 4) { flag = false; } float num = 155f; float num2 = 25f; if (false) { num = -155f; num2 = -25f; } float num3 = 120f; float num4 = 60f; float num5 = -60f; float num6 = -120f; bool flag2 = gunAngle <= num && gunAngle >= num2; if (false) { flag2 = gunAngle <= num || gunAngle >= num2; } empty = (flag2 ? ((!(gunAngle < num3) || !(gunAngle >= num4)) ? ((flag || p.ForceHandless) ? "_bw" : "_bw_twohands") : ((!flag && !p.ForceHandless) ? "_backward_twohands" : ((!p.RenderBodyHand) ? "_backward" : "_backward_hand"))) : ((!(gunAngle <= num5) || !(gunAngle >= num6)) ? ((!flag && !p.ForceHandless) ? "_twohands" : ((!p.RenderBodyHand) ? "" : "_hand")) : ((!flag && !p.ForceHandless) ? "_forward_twohands" : ((!p.RenderBodyHand) ? "_forward" : "_forward_hand")))); if (p.UseArmorlessAnim) { empty += "_armorless"; } return "idle" + empty; } public static string GetBaseDodgeAnimationName(PlayerController p, Vector2 vector) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (Mathf.Abs(vector.x) < 0.1f) { return ((!(vector.y > 0.1f)) ? "dodge" : "dodge_bw") + ((!p.UseArmorlessAnim) ? string.Empty : "_armorless"); } return ((!(vector.y > 0.1f)) ? "dodge_left" : "dodge_left_bw") + ((!p.UseArmorlessAnim) ? string.Empty : "_armorless"); } public static float RandomAngle() { return Random.Range(-180f, 180f); } public static Vector2 RandomVector(float magnitude = 1f) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) return magnitude * RandomAngle().ToVector(); } public static Quaternion RandomEulerZ() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return RandomAngle().EulerZ(); } public static bool CoinFlip() { return Random.Range(0, 2) == 1; } public static Projectile GunDefaultProjectile(int gunid) { PickupObject byId = PickupObjectDatabase.GetById(gunid); return ((Gun)((byId is Gun) ? byId : null)).DefaultModule.projectiles[0]; } public static Texture2D GetTexturedEnemyIdleAnimation(AIActor enemy, Color blendColor, float blendAmount, Color? sheenColor = null, float sheenWidth = 20f) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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) tk2dSpriteDefinition val = ((BraveBehaviour)enemy).sprite.collection.spriteDefinitions[GetIdForBestIdleAnimation(enemy)]; bool flag = val.uvs[0].x == val.uvs[1].x; Texture2D val2 = GunTools.DesheetTexture(val); Texture2D val3 = new Texture2D(flag ? ((Texture)val2).height : ((Texture)val2).width, flag ? ((Texture)val2).width : ((Texture)val2).height); for (int i = 0; i < ((Texture)val3).width; i++) { for (int j = 0; j < ((Texture)val3).height; j++) { Color val4 = val2.GetPixel(flag ? j : i, flag ? i : j); if (val4.a > 0f) { val4 = Color.Lerp(val4, blendColor, blendAmount); if (sheenColor.HasValue) { val4 = Color.Lerp(val4, sheenColor.Value, Mathf.Sin(6.28f * ((float)(i + j) % sheenWidth / sheenWidth))); } } val3.SetPixel(i, j, val4); } } return val3; } public static void PlaySoundUntilDeathOrTimeout(string soundName, GameObject source, float timer) { if (_SoundTimers.ContainsKey(soundName)) { _SoundTimers[soundName] = timer; } else { ((MonoBehaviour)GameManager.Instance).StartCoroutine(PlaySoundUntilDeathOrTimeout_CR(soundName, source, timer)); } static IEnumerator PlaySoundUntilDeathOrTimeout_CR(string soundName, GameObject source, float timer) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <g__PlaySoundUntilDeathOrTimeout_CR|33_0>d(0) { soundName = soundName, source = source, timer = timer }; } } public static void LoopSoundIf(this MonoBehaviour behav, bool play, string soundName, int loopPointMs = 0, int rewindAmountMs = 0, bool finishNaturally = false) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) uint iDFromString = AkSoundEngine.GetIDFromString(soundName); uint num = (uint)_PlayingIds.Length; if ((int)AkSoundEngine.GetPlayingIDsFromGameObject(((Component)behav).gameObject, ref num, _PlayingIds) != 1) { return; } int num3 = default(int); for (int i = 0; i < num; i++) { uint num2 = _PlayingIds[i]; if (AkSoundEngine.GetEventIDFromPlayingID(num2) != iDFromString) { continue; } if (!play) { if (!finishNaturally) { AkSoundEngine.StopPlayingID(num2); } return; } ((Component)(object)GameManager.Instance).GetOrAddComponent().RefreshSoundTimer(num2); AkSoundEngine.PostEvent(soundName + (GameManager.Instance.IsPaused ? "_pause" : "_resume"), ((Component)behav).gameObject); if (loopPointMs > 0 && (int)AkSoundEngine.GetSourcePlayPosition(num2, ref num3) == 1 && num3 >= loopPointMs) { AkSoundEngine.SeekOnEvent(iDFromString, ((Component)behav).gameObject, num3 - rewindAmountMs); } return; } if (play) { ((Component)(object)GameManager.Instance).GetOrAddComponent().NewSound(iDFromString, ((Component)behav).gameObject, finishNaturally); } } public static void DoSmokeAt(Vector3 pos) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) Object obj = ResourceCache.Acquire("Global VFX/VFX_Item_Spawn_Poof"); Object.Instantiate((GameObject)(object)((obj is GameObject) ? obj : null)).GetComponent().PlaceAtPositionByAnchor(pos, (Anchor)4); } public static void DoPickupAt(Vector3 pos, bool playSound = true) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_001c: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate((GameObject)ResourceCache.Acquire("Global VFX/VFX_Item_Pickup")); tk2dSprite component = val.GetComponent(); ((tk2dBaseSprite)component).PlaceAtPositionByAnchor(pos, (Anchor)4); ((tk2dBaseSprite)component).HeightOffGround = 6f; ((tk2dBaseSprite)component).UpdateZDepth(); if (playSound) { val.Play("Play_OBJ_item_pickup_01"); } } public static DebrisObject MakeDebrisFromSprite(tk2dBaseSprite sprite, Vector3 position, Vector2? initialVelocity = null, float? angularVelocity = null) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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) GameObject val = new GameObject("debrisboi"); val.transform.position = position; ((tk2dBaseSprite)val.AddComponent()).SetSprite(sprite.collection, sprite.spriteId); DebrisObject val2 = val.AddComponent(); if (initialVelocity.HasValue) { val2.Trigger(Vector2.op_Implicit(initialVelocity.Value), 1f, angularVelocity.GetValueOrDefault()); } return val2; } public static RoomHandler CurrentRoom() { return GameManager.Instance.BestActivePlayer.CurrentRoom; } public static Projectile NoProjectile() { //IL_02a2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_NullProjectilePrefab == (Object)null) { float? damage = 0f; float? force = 0f; float? speed = 1f; float? range = 1f; _NullProjectilePrefab = Items.Ak47.CloneProjectile(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: true)); _NullProjectilePrefab.isFakeBullet = true; _NullProjectilePrefab.damageTypes = (CoreDamageTypes)0; _NullProjectilePrefab.collidesWithEnemies = false; _NullProjectilePrefab.collidesWithPlayer = false; Object.Destroy((Object)(object)((Component)_NullProjectilePrefab).gameObject.GetComponent()); ((Component)_NullProjectilePrefab).gameObject.AddComponent().expirationTimer = 0f; ((Component)_NullProjectilePrefab).gameObject.AddComponent(); } return _NullProjectilePrefab; } public static bool AnyEnemyInLineOfSight(Vector2 start, Vector2 end, bool canBeNeutral = true, bool accountForWalls = false) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_0057: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) start.SafeGetEnemiesInRoom(ref _TempEnemies); Vector2 val = default(Vector2); foreach (AIActor tempEnemy in _TempEnemies) { if (tempEnemy.IsHostile(canBeDead: false, canBeNeutral) && Object.op_Implicit((Object)(object)((BraveBehaviour)tempEnemy).specRigidbody)) { PixelCollider hitboxPixelCollider = ((BraveBehaviour)tempEnemy).specRigidbody.HitboxPixelCollider; if ((!accountForWalls || start.HasLineOfSight(hitboxPixelCollider.UnitCenter)) && BraveUtility.LineIntersectsAABB(start, end, hitboxPixelCollider.UnitBottomLeft, hitboxPixelCollider.UnitDimensions, ref val)) { return true; } } } return false; } public static AIActor NearestEnemyInLineOfSight(out Vector2 ipoint, Vector2 start, Vector2 end, bool canBeNeutral = true, bool accountForWalls = false) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) AIActor result = null; float num = float.MaxValue; start.SafeGetEnemiesInRoom(ref _TempEnemies); ipoint = Vector2.zero; Vector2 val = default(Vector2); foreach (AIActor tempEnemy in _TempEnemies) { if (!tempEnemy.IsHostile(canBeDead: false, canBeNeutral) || !Object.op_Implicit((Object)(object)((BraveBehaviour)tempEnemy).specRigidbody)) { continue; } PixelCollider hitboxPixelCollider = ((BraveBehaviour)tempEnemy).specRigidbody.HitboxPixelCollider; if ((!accountForWalls || start.HasLineOfSight(hitboxPixelCollider.UnitCenter)) && BraveUtility.LineIntersectsAABB(start, end, hitboxPixelCollider.UnitBottomLeft, hitboxPixelCollider.UnitDimensions, ref val)) { Vector2 val2 = ((GameActor)tempEnemy).CenterPosition - start; float sqrMagnitude = ((Vector2)(ref val2)).sqrMagnitude; if (!(sqrMagnitude > num)) { ipoint = val; num = sqrMagnitude; result = tempEnemy; } } } return result; } public static AIActor NearestEnemyInLineOfSight(Vector2 start, Vector2 end, bool canBeNeutral = true, bool accountForWalls = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) Vector2 ipoint; return NearestEnemyInLineOfSight(out ipoint, start, end, canBeNeutral, accountForWalls); } public static void AllEnemiesInLineOfSight(ref List enemies, Vector2 start, Vector2 end, bool canBeNeutral = true, bool accountForWalls = false, bool sort = false) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_0069: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) start.SafeGetEnemiesInRoom(ref _TempEnemies); enemies.Clear(); _ActorDistances.Clear(); Vector2 val = default(Vector2); foreach (AIActor tempEnemy in _TempEnemies) { if (tempEnemy.IsHostile(canBeDead: false, canBeNeutral) && Object.op_Implicit((Object)(object)((BraveBehaviour)tempEnemy).specRigidbody)) { PixelCollider hitboxPixelCollider = ((BraveBehaviour)tempEnemy).specRigidbody.HitboxPixelCollider; if ((!accountForWalls || start.HasLineOfSight(hitboxPixelCollider.UnitCenter)) && BraveUtility.LineIntersectsAABB(start, end, hitboxPixelCollider.UnitBottomLeft, hitboxPixelCollider.UnitDimensions, ref val)) { List> actorDistances = _ActorDistances; Vector2 val2 = val - start; actorDistances.Add(new Tuple(((Vector2)(ref val2)).sqrMagnitude, tempEnemy)); } } } if (sort) { _ActorDistances.Sort((Tuple x, Tuple y) => x.First.CompareTo(y.First)); } foreach (Tuple actorDistance in _ActorDistances) { enemies.Add(actorDistance.Second); } } public static void AllEnemiesInLineOfSight(this PlayerController player, ref List enemies, bool canBeNeutral = true, bool accountForWalls = false, bool sort = false) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)player)) { enemies.Clear(); Vector2 centerPosition = ((GameActor)player).CenterPosition; AllEnemiesInLineOfSight(ref enemies, centerPosition, centerPosition + player.m_currentGunAngle.ToVector(100f), canBeNeutral, accountForWalls, sort); } } public static List AllEnemiesInLineOfSight(this PlayerController player, bool canBeNeutral = true, bool accountForWalls = false, bool sort = false) { player.AllEnemiesInLineOfSight(ref _TempNearbyEnemies, canBeNeutral, accountForWalls, sort); return _TempNearbyEnemies; } public static void AllEnemiesInLineOfSight(this Gun gun, ref List enemies, bool canBeNeutral = true, bool accountForWalls = false, bool sort = false) { //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) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)gun)) { enemies.Clear(); Vector2 val = Vector3Extensions.XY(((Component)gun.barrelOffset).transform.position); AllEnemiesInLineOfSight(ref enemies, val, val + gun.CurrentAngle.ToVector(100f), canBeNeutral, accountForWalls, sort); } } public static List AllEnemiesInLineOfSight(this Gun gun, bool canBeNeutral = true, bool accountForWalls = false, bool sort = false) { gun.AllEnemiesInLineOfSight(ref _TempNearbyEnemies, canBeNeutral, accountForWalls, sort); return _TempNearbyEnemies; } public static IEnumerable AllEnemiesWithinConeOfVision(Vector2 start, float coneAngle, float maxDeviation, float maxDistance = 100f, bool ignoreWalls = false) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__54(-2) { <>3__start = start, <>3__coneAngle = coneAngle, <>3__maxDeviation = maxDeviation, <>3__maxDistance = maxDistance, <>3__ignoreWalls = ignoreWalls }; } public static AIActor NearestEnemyWithinConeOfVision(Vector2 start, float coneAngle, float maxDeviation, float maxDistance = 100f, bool useNearestAngleInsteadOfDistance = true, bool ignoreWalls = false) { //IL_000a: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0048: Unknown result type (might be due to invalid IL or missing references) float num = maxDeviation; float num2 = maxDistance * maxDistance; float num3 = num2; AIActor result = null; start.SafeGetEnemiesInRoom(ref _TempEnemies); foreach (AIActor tempEnemy in _TempEnemies) { if (!tempEnemy.IsHostile(canBeDead: false, canBeNeutral: true)) { continue; } Vector2 centerPosition = ((GameActor)tempEnemy).CenterPosition; if (!ignoreWalls && !start.HasLineOfSight(centerPosition)) { continue; } Vector2 val = centerPosition - start; float num4 = Vector2Extensions.ToAngle(val).Clamp360(); float num5 = Mathf.Abs((coneAngle - num4).Clamp180()); if (!(num5 > maxDeviation)) { float sqrMagnitude = ((Vector2)(ref val)).sqrMagnitude; if (!(sqrMagnitude > num2) && (useNearestAngleInsteadOfDistance ? (num5 < num) : (sqrMagnitude < num3))) { result = tempEnemy; num = num5; num3 = sqrMagnitude; } } } return result; } public static Vector2? NearestEnemyPosWithinConeOfVision(Vector2 start, float coneAngle, float maxDeviation, float maxDistance = 100f, bool useNearestAngleInsteadOfDistance = true, bool ignoreWalls = false) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) AIActor val = NearestEnemyWithinConeOfVision(start, coneAngle, maxDeviation, 100f, useNearestAngleInsteadOfDistance, ignoreWalls); if (!Object.op_Implicit((Object)(object)val)) { return null; } return ((GameActor)val).CenterPosition; } public static AIActor NearestEnemy(Vector2 start, bool ignoreWalls = false) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return NearestEnemyWithinConeOfVision(start, 0f, 360f, 100f, useNearestAngleInsteadOfDistance: false, ignoreWalls); } public static Vector2? NearestEnemyPos(Vector2 start, bool ignoreWalls = false) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return NearestEnemyPosWithinConeOfVision(start, 0f, 360f, 100f, useNearestAngleInsteadOfDistance: false, ignoreWalls); } public static void GetAllNearbyEnemies(ref List enemies, Vector2 center, float radius = -1f, bool ignoreWalls = false) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) float num = radius * radius; enemies.Clear(); center.SafeGetEnemiesInRoom(ref _TempEnemies); foreach (AIActor tempEnemy in _TempEnemies) { if (!tempEnemy.IsHostile(canBeDead: false, canBeNeutral: true)) { continue; } Vector2 centerPosition = ((GameActor)tempEnemy).CenterPosition; if (radius > 0f) { Vector2 val = centerPosition - center; if (((Vector2)(ref val)).sqrMagnitude > num) { continue; } } if (ignoreWalls || center.HasLineOfSight(centerPosition)) { enemies.Add(tempEnemy); } } } public static List GetAllNearbyEnemies(Vector2 center, float radius = 100f, bool ignoreWalls = false) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) GetAllNearbyEnemies(ref _TempNearbyEnemies, center, radius, ignoreWalls); return _TempNearbyEnemies; } public static Chest SpawnChestWithSpecificItem(PickupObject pickup, IntVector2 position, ItemQuality? overrideChestQuality = null, bool overrideJunk = false) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_006c: Unknown result type (might be due to invalid IL or missing references) Chest val = Chest.Spawn(GameManager.Instance.RewardManager.GetTargetChestPrefab((ItemQuality)(((??)overrideChestQuality) ?? pickup.quality)) ?? GameManager.Instance.RewardManager.GetTargetChestPrefab((ItemQuality)3), position); val.forceContentIds = new List { pickup.PickupObjectId }; if (overrideJunk) { val.overrideJunkId = pickup.PickupObjectId; } RoomHandler absoluteRoom = Vector3Extensions.GetAbsoluteRoom(((IntVector2)(ref position)).ToVector2()); if (absoluteRoom != null) { val.RegisterChestOnMinimap(absoluteRoom); } return val; } public static double FastPow(double a, double b) { int num = (int)(BitConverter.DoubleToInt64Bits(a) >> 32); return BitConverter.Int64BitsToDouble((long)(int)(b * (double)(num - 1072632447) + 1072632447.0) << 32); } public static double FastSqrt(double a) { int num = (int)(BitConverter.DoubleToInt64Bits(a) >> 32); return BitConverter.Int64BitsToDouble((long)(int)(0.5 * (double)(num - 1072632447) + 1072632447.0) << 32); } public static PickupObject GetModdedItem(string itemName) { return Game.Items.GetSafe(itemName); } public static float Log2(float f) { return Mathf.Log(f, 2f); } public static bool LineIntersectsCircle(Vector2 startp, Vector2 endp, Vector2 p, float radius) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //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_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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) //IL_0021: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0045: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) Vector2 val = endp - startp; _ = startp - p; _ = endp - p; float sqrMagnitude = ((Vector2)(ref val)).sqrMagnitude; float num = Vector2.Dot(p - startp, val) / sqrMagnitude; num = Mathf.Clamp01(num); Vector2 val2 = startp + num * val; Vector2 val3 = p - val2; return ((Vector2)(ref val3)).sqrMagnitude <= radius * radius; } public static Vector2? PointOrthognalTo(Vector2 start, Vector2 target, Vector2 dir, float projAmount = 1000f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: 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_000d: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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) //IL_0021: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) Vector2 val = start + projAmount * dir; Vector2 val2 = projAmount * Vector2Extensions.Rotate(dir, 90f); Vector2 value = default(Vector2); if (!BraveUtility.LineIntersectsLine(start, val, target + val2, target - val2, ref value)) { return null; } return value; } public static tk2dSpriteDefinition GetSpriteFragment(tk2dSpriteDefinition orig, int x, int y, int edgeSize) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: 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_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //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_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0246: 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_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: 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_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: 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_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Expected O, but got Unknown string text = $"{orig.name}_{x}_{y}_{edgeSize}"; if (_FragmentDict.TryGetValue(text, out var value)) { return value; } bool num = orig.uvs[0].x == orig.uvs[1].x; float num2 = 1f / (float)edgeSize; Vector3 position = orig.position0; Vector2 val = Vector2.op_Implicit(num2 * orig.boundsDataExtents); Vector2 val2 = num2 * (orig.uvs[3] - orig.uvs[0]); Vector2[] uvs; if (num) { int num3 = edgeSize - x - 1; Vector2 val3 = orig.uvs[0] + new Vector2((float)y * val2.x, (float)num3 * val2.y); Vector2 val4 = orig.uvs[0] + new Vector2((float)(y + 1) * val2.x, (float)(num3 + 1) * val2.y); uvs = (Vector2[])(object)new Vector2[4] { new Vector2(val3.x, val4.y), val3, val4, new Vector2(val4.x, val3.y) }; } else { Vector2 val5 = orig.uvs[0] + new Vector2((float)x * val2.x, (float)y * val2.y); Vector2 val6 = orig.uvs[0] + new Vector2((float)(x + 1) * val2.x, (float)(y + 1) * val2.y); uvs = (Vector2[])(object)new Vector2[4] { val5, new Vector2(val6.x, val5.y), new Vector2(val5.x, val6.y), val6 }; } tk2dSpriteDefinition val7 = new tk2dSpriteDefinition { name = text, texelSize = orig.texelSize, flipped = orig.flipped, physicsEngine = orig.physicsEngine, colliderType = orig.colliderType, collisionLayer = orig.collisionLayer, material = orig.material, materialInst = orig.materialInst, position0 = position + new Vector3((float)x * val.x, (float)y * val.y, 0f), position1 = position + new Vector3((float)(x + 1) * val.x, (float)y * val.y, 0f), position2 = position + new Vector3((float)x * val.x, (float)(y + 1) * val.y, 0f), position3 = position + new Vector3((float)(x + 1) * val.x, (float)(y + 1) * val.y, 0f), boundsDataExtents = orig.boundsDataExtents, boundsDataCenter = orig.boundsDataCenter, untrimmedBoundsDataExtents = orig.untrimmedBoundsDataExtents, untrimmedBoundsDataCenter = orig.untrimmedBoundsDataCenter, uvs = uvs }; _FragmentDict[text] = val7; return val7; } public static Color RandomColor() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) return new Color(Random.value, Random.value, Random.value); } public static T SpriteObject(tk2dSpriteCollectionData spriteColl, int spriteId) where T : tk2dBaseSprite { //IL_0000: Unknown result type (might be due to invalid IL or missing references) T val = new GameObject().AddComponent(); ((tk2dBaseSprite)val).SetSprite(spriteColl, spriteId); return val; } public static tk2dSprite SpriteObject(tk2dSpriteCollectionData spriteColl, int spriteId) { return Lazy.SpriteObject(spriteColl, spriteId); } public static void CreateHoveringGun(PlayerController player) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) Object obj = ResourceCache.Acquire("Global Prefabs/HoveringGun"); GameObject obj2 = Object.Instantiate((GameObject)(object)((obj is GameObject) ? obj : null), Vector2Extensions.ToVector3ZisY(((GameActor)player).CenterPosition, 0f), Quaternion.identity); obj2.transform.parent = ((BraveBehaviour)player).transform; HoveringGunController component = obj2.GetComponent(); component.ConsumesTargetGunAmmo = false; component.ChanceToConsumeTargetGunAmmo = 0f; component.Position = (HoverPosition)1; component.Aim = (AimType)1; component.Trigger = (FireType)3; component.CooldownTime = 0.01f; component.ShootDuration = 0f; component.OnlyOnEmptyReload = false; component.Initialize(((GameActor)player).CurrentGun, player); } public static List Combine(params List[] lists) { List list = new List(); foreach (List list2 in lists) { if (list2 == null) { continue; } foreach (T item in list2) { list.Add(item); } } return list; } public static GameObject CreateDecoy(Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_006c: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown GameObject val = new GameObject("fake target"); ((GameActor)val.AddComponent()).HasShadow = false; SpeculativeRigidbody obj = val.AddComponent(); obj.CollideWithTileMap = false; obj.CollideWithOthers = false; obj.CanBeCarried = false; obj.CanBePushed = false; obj.CanCarry = false; obj.PixelColliders = new List { new PixelCollider { ColliderGenerationMode = (PixelColliderGeneration)0, CollisionLayer = (CollisionLayer)14, ManualWidth = 4, ManualHeight = 4 } }; val.transform.position = position; return val; } public static bool AnyoneHas() where T : PassiveItem { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 PlayerController primaryPlayer = GameManager.Instance.PrimaryPlayer; if (primaryPlayer == null) { return false; } for (int i = 0; i < primaryPlayer.passiveItems.Count; i++) { if (primaryPlayer.passiveItems[i] is T) { return true; } } if ((int)GameManager.Instance.CurrentGameType != 1) { return false; } PlayerController secondaryPlayer = GameManager.Instance.SecondaryPlayer; if (secondaryPlayer == null) { return false; } for (int j = 0; j < secondaryPlayer.passiveItems.Count; j++) { if (secondaryPlayer.passiveItems[j] is T) { return true; } } return false; } public static bool AnyoneHas(int id) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 PlayerController primaryPlayer = GameManager.Instance.PrimaryPlayer; if (primaryPlayer == null) { return false; } for (int i = 0; i < primaryPlayer.passiveItems.Count; i++) { if (((PickupObject)primaryPlayer.passiveItems[i]).PickupObjectId == id) { return true; } } if ((int)GameManager.Instance.CurrentGameType != 1) { return false; } PlayerController secondaryPlayer = GameManager.Instance.SecondaryPlayer; if (secondaryPlayer == null) { return false; } for (int j = 0; j < secondaryPlayer.passiveItems.Count; j++) { if (((PickupObject)secondaryPlayer.passiveItems[j]).PickupObjectId == id) { return true; } } return false; } public static bool AnyoneHasActive() where T : PlayerItem { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 PlayerController primaryPlayer = GameManager.Instance.PrimaryPlayer; if (primaryPlayer == null) { return false; } for (int i = 0; i < primaryPlayer.activeItems.Count; i++) { if (primaryPlayer.activeItems[i] is T) { return true; } } if ((int)GameManager.Instance.CurrentGameType != 1) { return false; } PlayerController secondaryPlayer = GameManager.Instance.SecondaryPlayer; if (secondaryPlayer == null) { return false; } for (int j = 0; j < secondaryPlayer.activeItems.Count; j++) { if (secondaryPlayer.activeItems[j] is T) { return true; } } return false; } public static bool AnyoneHasActive(int id) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 PlayerController primaryPlayer = GameManager.Instance.PrimaryPlayer; if (primaryPlayer == null) { return false; } for (int i = 0; i < primaryPlayer.activeItems.Count; i++) { if (((PickupObject)primaryPlayer.activeItems[i]).PickupObjectId == id) { return true; } } if ((int)GameManager.Instance.CurrentGameType != 1) { return false; } PlayerController secondaryPlayer = GameManager.Instance.SecondaryPlayer; if (secondaryPlayer == null) { return false; } for (int j = 0; j < secondaryPlayer.activeItems.Count; j++) { if (((PickupObject)secondaryPlayer.activeItems[j]).PickupObjectId == id) { return true; } } return false; } public static bool AnyoneHasGun() where T : Gun { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Invalid comparison between Unknown and I4 PlayerController primaryPlayer = GameManager.Instance.PrimaryPlayer; if (primaryPlayer == null) { return false; } for (int i = 0; i < primaryPlayer.inventory.AllGuns.Count; i++) { if (primaryPlayer.inventory.AllGuns[i] is T) { return true; } } if ((int)GameManager.Instance.CurrentGameType != 1) { return false; } PlayerController secondaryPlayer = GameManager.Instance.SecondaryPlayer; if (secondaryPlayer == null) { return false; } for (int j = 0; j < secondaryPlayer.inventory.AllGuns.Count; j++) { if (secondaryPlayer.inventory.AllGuns[j] is T) { return true; } } return false; } public static bool AnyoneHasGun(int id) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Invalid comparison between Unknown and I4 PlayerController primaryPlayer = GameManager.Instance.PrimaryPlayer; if (primaryPlayer == null) { return false; } for (int i = 0; i < primaryPlayer.inventory.AllGuns.Count; i++) { if (((PickupObject)primaryPlayer.inventory.AllGuns[i]).PickupObjectId == id) { return true; } } if ((int)GameManager.Instance.CurrentGameType != 1) { return false; } PlayerController secondaryPlayer = GameManager.Instance.SecondaryPlayer; if (secondaryPlayer == null) { return false; } for (int j = 0; j < secondaryPlayer.inventory.AllGuns.Count; j++) { if (((PickupObject)secondaryPlayer.inventory.AllGuns[j]).PickupObjectId == id) { return true; } } return false; } public static int GetIdForBestIdleAnimation(AIActor enemy) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) int num = 0; int num2 = -1; AIAnimator component = ((Component)enemy).GetComponent(); if (component != null) { tk2dSpriteAnimator component2 = ((Component)enemy).GetComponent(); if (component2 != null && (int)component.IdleAnimation.Type != 0) { string name = component.IdleAnimation.GetInfo(270f, false).name; tk2dSpriteAnimationClip clipByName = component2.GetClipByName(name); if (clipByName != null && clipByName.frames != null && clipByName.frames.Length != 0) { return clipByName.frames[0].spriteId; } } } tk2dSpriteDefinition[] spriteDefinitions = ((BraveBehaviour)enemy).sprite.collection.spriteDefinitions; for (int i = 0; i < spriteDefinitions.Length; i++) { tk2dSpriteDefinition val = spriteDefinitions[i]; int num3 = 0; if (!val.name.Contains("001")) { continue; } if (val.name.Contains("idle_f")) { num3 = 5; } else if (val.name.Contains("idle_right") || val.name.Contains("idle_r")) { num3 = 4; } else if (val.name.Contains("idle_left") || val.name.Contains("idle_l")) { num3 = 3; } else if (val.name.Contains("idle") || val.name.Contains("fire") || val.name.Contains("run_right") || val.name.Contains("right_run")) { num3 = 2; } else if (val.name.Contains("death") || val.name.Contains("left") || val.name.Contains("right")) { num3 = 1; } if (num3 > num) { num = num3; num2 = i; if (num == 5) { break; } } } if (num2 >= 0) { return num2; } return ((BraveBehaviour)enemy).sprite.collection.FirstValidDefinitionIndex; } public static float SmoothestLerp(float a, float b, float r) { return b + (a - b) * Mathf.Exp((0f - BraveTime.DeltaTime) * r); } public static Vector2 SmoothestLerp(Vector2 a, Vector2 b, float r) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_003a: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Exp((0f - BraveTime.DeltaTime) * r); return new Vector2(b.x + (a.x - b.x) * num, b.y + (a.y - b.y) * num); } public static void DoMicroBlankAt(Vector2 pos, PlayerController user = null, float radius = 4f, float additionalTimeAtMaxRadius = 0.25f) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0072: Expected O, but got Unknown //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown if (_BlankVFXPrefab == null) { _BlankVFXPrefab = (GameObject)BraveResources.Load("Global VFX/BlankVFX_Ghost", ".prefab"); } GameObject val = new GameObject("silencer"); val.AddComponent().TriggerSilencer(pos, 20f, radius, _BlankVFXPrefab, 0f, 3f, 3f, 3f, 30f, 3f, additionalTimeAtMaxRadius, user, false, false); Extensions.Play(val, "Play_OBJ_silenceblank_small_01"); } public static void DoDamagedFlash(HealthHaver hh) { //IL_008b: 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) if (!hh.flashesOnDamage || !((Object)(object)((BraveBehaviour)hh).spriteAnimator != (Object)null) || hh.m_isFlashing) { return; } if (hh.m_flashOnHitCoroutine != null) { ((MonoBehaviour)hh).StopCoroutine(hh.m_flashOnHitCoroutine); hh.m_flashOnHitCoroutine = null; } if (hh.materialsToFlash == null) { hh.materialsToFlash = new List(); hh.outlineMaterialsToFlash = new List(); hh.sourceColors = new List(); } if (Object.op_Implicit((Object)(object)((BraveBehaviour)hh).gameActor)) { for (int i = 0; i < hh.materialsToFlash.Count; i++) { hh.materialsToFlash[i].SetColor(CwaffVFX._OverrideColorId, ((BraveBehaviour)hh).gameActor.CurrentOverrideColor); } } if (hh.outlineMaterialsToFlash != null) { for (int j = 0; j < hh.outlineMaterialsToFlash.Count && j < hh.sourceColors.Count; j++) { hh.outlineMaterialsToFlash[j].SetColor(CwaffVFX._OverrideColorId, hh.sourceColors[j]); } } hh.m_flashOnHitCoroutine = ((MonoBehaviour)hh).StartCoroutine(hh.FlashOnHit((DamageCategory)0, (PixelCollider)null)); } public static List DefaultList(int size) { return Enumerable.Repeat(default(T), size).ToList(); } public static void PrintStat(StatModifier stat) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_001b: Unknown result type (might be due to invalid IL or missing references) ETGModConsole.Log((object)string.Format(" have {0} stat {1} by {2}", ((int)stat.modifyType == 1) ? "mul" : "add", stat.statToBoost, stat.amount), false); } public static void PrintOwnerlessStats(PlayerController player) { foreach (StatModifier ownerlessStatModifier in player.ownerlessStatModifiers) { PrintStat(ownerlessStatModifier); } } public static string SetupCustomAmmoClip(string clipname) { return AtlasHelper.GetOrAddCustomAmmoType(clipname + "_clip", ResMap.Get(clipname + "_clipfull")[0], ResMap.Get(clipname + "_clipempty")[0]); } public static string GenRandomCorruptedString() { if (_RandomStrings.Count >= 100) { return _RandomStrings[Random.Range(0, 100)]; } string text = "[color #dd6666]" + Convert.ToBase64String(Guid.NewGuid().ToByteArray()).Substring(0, 10) + "[/color]"; _RandomStrings.Add(text); return text; } public static void DoElasticBounce(CollisionData collision) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0027: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) Vector2 val = collision.MyRigidbody.UnitCenter - collision.OtherRigidbody.UnitCenter; Vector2 velocity = collision.MyRigidbody.Velocity; Vector2 velocity2 = collision.OtherRigidbody.Velocity; float num = 1f / Mathf.Max(0.1f, ((Vector2)(ref val)).sqrMagnitude); Vector2 val2 = velocity - Vector2.Dot(velocity - velocity2, val) * num * val; _ = velocity2 - Vector2.Dot(velocity2 - velocity, -val) * num * -val; PhysicsEngine.PostSliceVelocity = Mathf.Sqrt(Mathf.Max(((Vector2)(ref velocity)).sqrMagnitude, ((Vector2)(ref velocity2)).sqrMagnitude)) * ((Vector2)(ref val2)).normalized; } public static Color GetPaletteColor(Texture2D palette, float red) { //IL_0081: Unknown result type (might be due to invalid IL or missing references) double num = (double)red * 15.9375; double num2 = Math.Floor(num) * 0.0625 + 0.4; double num3 = (double)Math.Sign(num) * Math.Abs(num - Math.Truncate(num)) + 0.4; int num4 = (int)Math.Round(0.5 * num2 * (double)((Texture)palette).width); int num5 = (int)Math.Round(0.5 * num3 * (double)((Texture)palette).height); return palette.GetPixel(num4, num5); } public static Color[] GetPixelColorsForEnemy(string guid) { AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); tk2dSpriteDefinition val = ((tk2dBaseSprite)((Component)orLoadByGuid).GetComponent()).collection.spriteDefinitions[GetIdForBestIdleAnimation(orLoadByGuid)]; Texture mainTexture = val.material.mainTexture; if (!_ReadableTexes.TryGetValue(mainTexture, out var value)) { Texture2D val2 = (_ReadableTexes[mainTexture] = ETGMod.GetRW((Texture2D)(object)((mainTexture is Texture2D) ? mainTexture : null))); value = val2; } return value.GetPixels(Mathf.RoundToInt(val.uvs[0].x * (float)((Texture)value).width), Mathf.RoundToInt(val.uvs[0].y * (float)((Texture)value).height), Mathf.RoundToInt((val.uvs[3].x - val.uvs[0].x) * (float)((Texture)value).width), Mathf.RoundToInt((val.uvs[3].y - val.uvs[0].y) * (float)((Texture)value).height)); } public static IEnumerator DecayOverTime(DebrisObject debris, float time, bool shrink = false) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__100(0) { debris = debris, time = time, shrink = shrink }; } public static tk2dMeshSprite CreateMeshSpriteObject(tk2dSpriteCollectionData collection, int spriteId, Vector2 pos, bool pointMesh = false, Texture2D optionalPalette = null) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("mesh sprite object"); val.transform.position = Vector2.op_Implicit(dfVectorExtensions.Quantize(pos, 0.0625f)); tk2dMeshSprite obj = val.AddComponent(); ((tk2dBaseSprite)obj).SetSprite(collection, spriteId); tk2dSpriteDefinition val2 = collection.spriteDefinitions[spriteId]; int xSize = Mathf.RoundToInt(16f * val2.boundsDataExtents.x); int ySize = Mathf.RoundToInt(16f * val2.boundsDataExtents.y); obj.ResizeMesh(xSize, ySize, pointMesh); obj.optionalPalette = optionalPalette; return obj; } public static tk2dMeshSprite CreateMeshSpriteObject(tk2dBaseSprite s, Vector2 pos, bool pointMesh = false, Texture2D optionalPalette = null) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) return CreateMeshSpriteObject(s.collection, s.spriteId, pos, pointMesh, optionalPalette); } public static void Dissipate(this tk2dMeshSprite ms, float time, float amplitudeStart = 0f, float amplitudeEnd = -1f, bool progressive = false, float emissionStart = 0f, float emissionEnd = -1f, Func easeEmit = null, Func easeAmp = null, Func easeFade = null, string sound = null, float soundTime = 0f) { ((MonoBehaviour)ms).StartCoroutine(Dissipate_CR(ms, time, amplitudeStart, amplitudeEnd, progressive, emissionStart, emissionEnd, easeEmit, easeAmp, easeFade, sound, soundTime)); static IEnumerator Dissipate_CR(tk2dMeshSprite ms, float time, float amplitudeStart = 0f, float amplitudeEnd = -1f, bool progressive = false, float emissionStart = 0f, float emissionEnd = -1f, Func easeEmit = null, Func easeAmp = null, Func easeFade = null, string sound = null, float soundTime = 0f) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <g__Dissipate_CR|103_0>d(0) { ms = ms, time = time, amplitudeStart = amplitudeStart, amplitudeEnd = amplitudeEnd, progressive = progressive, emissionStart = emissionStart, emissionEnd = emissionEnd, easeEmit = easeEmit, easeAmp = easeAmp, easeFade = easeFade, sound = sound, soundTime = soundTime }; } } public static float GetFloorIndex() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Invalid comparison between Unknown and I4 //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Invalid comparison between Unknown and I4 //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Invalid comparison between Unknown and I4 //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 //IL_001e: 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) //IL_0036: Expected I4, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Invalid comparison between Unknown and I4 //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Invalid comparison between Unknown and I4 //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 ValidTilesets tilesetId = GameManager.Instance.Dungeon.tileIndices.tilesetId; if ((int)tilesetId <= 32) { if ((int)tilesetId <= 8) { switch (tilesetId - 1) { default: if ((int)tilesetId != 8) { break; } return 2.5f; case 1: return 1f; case 3: return 1.5f; case 0: return 2f; case 2: break; } } else { if ((int)tilesetId == 16) { return 3f; } if ((int)tilesetId == 32) { return 4f; } } } else if ((int)tilesetId <= 128) { if ((int)tilesetId == 64) { return 5f; } if ((int)tilesetId == 128) { return 5.5f; } } else { if ((int)tilesetId == 2048) { return 4.5f; } if ((int)tilesetId == 32768) { return 3.5f; } } return 0f; } public static Vector2 MaxMagnitude(Vector2 a, Vector2 b) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (!(((Vector2)(ref a)).sqrMagnitude > ((Vector2)(ref b)).sqrMagnitude)) { return b; } return a; } public static void Append(ref T[] array, T value) { int num = array.Length; Array.Resize(ref array, num + 1); array[num] = value; } public static T RegisterEasyRATPlaceable(string guid) where T : MonoBehaviour { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown GameObject val = Extensions.RegisterPrefab(new GameObject(guid)); T result = val.AddComponent(); DungeonPlaceable value = BreakableAPIToolbox.GenerateDungeonPlaceable(new Dictionary { { val, 1f } }, 1, 1, (DungeonPrerequisite[])null); StaticReferences.StoredDungeonPlaceables.Add(guid, value); StaticReferences.customPlaceables.Add("cg:" + guid, value); return result; } public static GameObject DispersalParticles(Color color) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_BaseDispersalSystem == (Object)null) { _BaseDispersalSystem = ((Component)Items.FlashRay.DefaultProjectile()).GetComponentInChildren().DispersalParticleSystemPrefab; } GameObject obj = _BaseDispersalSystem.ClonePrefab(); obj.GetComponent().SetColor(color); return obj; } public static bool DeterminePerfectAngleToShootAt(Vector2 shootPoint, Vector2 targetPoint, Vector2 targetVelocity, float projectileSpeed, out float shootAngle, out float t, bool adjustForTurboMode = true) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0031: 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) //IL_0043: 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_004d: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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) shootAngle = -361f; t = -1f; float num = projectileSpeed; if (adjustForTurboMode && GameManager.IsTurboMode) { num *= TurboModeController.sEnemyBulletSpeedMultiplier; } Vector2 val = targetPoint - shootPoint; float num2 = Vector2.Dot(targetVelocity, targetVelocity) - num * num; float num3 = 2f * Vector2.Dot(val, targetVelocity); float num4 = Vector2.Dot(val, val); if (Mathf.Abs(num2) > 0.0001f) { float num5 = Mathf.Sqrt(num3 * num3 - 4f * num2 * num4); float num6 = (0f - num3 + num5) / (2f * num2); float num7 = (0f - num3 - num5) / (2f * num2); if (num6 <= 0f && num7 <= 0f) { return false; } t = ((num7 < 0f) ? num6 : ((num6 < 0f) ? num7 : Mathf.Min(num6, num7))); } else { if (Mathf.Abs(num3) < 0.0001f) { return false; } t = (0f - num4) / num3; if (t < 0f) { return false; } } Vector2 val2 = targetPoint + t * targetVelocity; shootAngle = Vector2Extensions.ToAngle(val2 - shootPoint); if (float.IsNaN(shootAngle)) { return false; } return true; } public static GameObject EasyDebris(string basePath) { GameObject val = Items.Ak47.AsGun().shellCasing.ClonePrefab(); ((Object)val.GetComponent()).name = basePath + " debris"; tk2dSprite component = val.GetComponent(); List list = ResMap.Get(basePath); ((tk2dBaseSprite)component).SetSprite(VFX.Collection, VFX.Collection.GetSpriteIdByName(list[0])); tk2dSpriteAnimationClip val2 = val.NewAnimation("animation", list, 2f, loops: true, -1, (Anchor)4); (((Component)(object)component).GetOrAddComponent().library = ((Component)(object)component).GetOrAddComponent()).clips = (tk2dSpriteAnimationClip[])(object)new tk2dSpriteAnimationClip[1] { val2 }; return val; } public static void ScorchGroundAt(Vector2 pos) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //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) GameObjectExtensions.SetLayerRecursively(Object.Instantiate(Sunderbuss._ScorchMark, Vector2.op_Implicit(pos), Quaternion.identity), LayerMask.NameToLayer("BG_Critical")); } public static IntVector2? RandomCellForEnemySpawn(this AIActor enemyPrefab, RoomHandler room, IntVector2? targetCenter = null) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0028: 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) CellValidator val = (CellValidator)delegate(IntVector2 c) { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < enemyPrefab.Clearance.x; i++) { for (int j = 0; j < enemyPrefab.Clearance.y; j++) { if (GameManager.Instance.Dungeon.data.isTopWall(c.x + i, c.y + j)) { return false; } if (targetCenter.HasValue) { if (IntVector2.DistanceSquared(targetCenter.Value, c.x + i, c.y + j) < 16f) { return false; } if (IntVector2.DistanceSquared(targetCenter.Value, c.x + i, c.y + j) > 400f) { return false; } } } } return true; }; return room.GetRandomAvailableCell((IntVector2?)enemyPrefab.Clearance, (CellTypes?)enemyPrefab.PathableTiles, false, val); } } public class Commands { [HarmonyPatch] private class DebugInputPatch { [HarmonyPatch(typeof(GameManager), "Update")] private static bool Prefix(GameManager __instance) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (!C.DEBUG_BUILD) { return true; } if (!Input.GetKey((KeyCode)305)) { return true; } PlayerController primaryPlayer = __instance.PrimaryPlayer; if (Input.GetKeyDown((KeyCode)115)) { _DebugStealth = !_DebugStealth; ((GameActor)primaryPlayer).SetIsStealthed(_DebugStealth, "Debug stealth"); } if (Input.GetKeyDown((KeyCode)99)) { _DebugCameraLock = !_DebugCameraLock; GameManager.Instance.MainCameraController.OverridePosition = Vector2.op_Implicit(GameManager.Instance.MainCameraController.previousBasePosition); GameManager.Instance.MainCameraController.SetManualControl(_DebugCameraLock, true); } if (Input.GetKeyDown((KeyCode)109)) { primaryPlayer.AcquireMastery(((GameActor)primaryPlayer).CurrentGun); if (Object.op_Implicit((Object)(object)((GameActor)primaryPlayer).CurrentGun)) { ((Component)((GameActor)primaryPlayer).CurrentGun).gameObject.GetComponent()?.OnSwitchedToThisGun(); } } Input.GetKeyDown((KeyCode)98); if (Input.GetKeyDown((KeyCode)101)) { ((Component)primaryPlayer).GetComponent().DieInAir(false, true, true, false); } if (Input.GetKeyDown((KeyCode)122)) { Gun currentGun = ((GameActor)primaryPlayer).CurrentGun; if (currentGun.CurrentAmmo > 1) { currentGun.CurrentAmmo = 1; } else { currentGun.CurrentAmmo = currentGun.AdjustedMaxAmmo; } } if (Input.GetKeyDown((KeyCode)48) && _OnDebugKeyPressed != null) { _OnDebugKeyPressed(); } if (Input.GetKeyDown((KeyCode)57)) { if (!GameUIRoot.Instance.CoreUIHidden.HasOverride("CG_DEBUG")) { GameUIRoot.Instance.HideCoreUI("CG_DEBUG"); GameUIRoot.Instance.ToggleLowerPanels(false, false, "CG_DEBUG"); Minimap.Instance.ToggleMinimap(false, false); ((Component)GameUIRoot.Instance.PauseMenuPanel).GetComponent().ForceHideMetaCurrencyPanel(); } else { GameUIRoot.Instance.ShowCoreUI("CG_DEBUG"); GameUIRoot.Instance.ToggleLowerPanels(true, false, "CG_DEBUG"); Minimap.Instance.ToggleMinimap(false, false); ((Component)GameUIRoot.Instance.PauseMenuPanel).GetComponent().ForceRevealMetaCurrencyPanel(); } } if (Input.GetKeyDown((KeyCode)56)) { PrototypeDungeonRoom val = FloorPuzzleRoomController._FloorPuzzleRooms[0]; if ((Object)(object)val != (Object)null) { Console.WriteLine("generating debug flow with room " + ((Object)val).name); OneOffDebugDungeonFlow.TestSingleRoom(val); } else { Console.WriteLine("attempted to generate null room"); } } return true; } } [CompilerGenerated] private sealed class <g__NukeFloor_CR|6_0>d : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private List 5__2; private List 5__3; private int 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <g__NukeFloor_CR|6_0>d(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; for (int i = 0; i < 5__3.Count; i++) { if (Object.op_Implicit((Object)(object)5__3[i])) { Object.Destroy((Object)(object)((Component)5__3[i]).gameObject); } } goto IL_0107; } <>1__state = -1; 5__2 = GameManager.Instance.Dungeon.data.rooms; 5__3 = new List(); 5__4 = 0; goto IL_0119; IL_0119: if (5__4 < 5__2.Count) { RoomHandler val = 5__2[5__4]; if (val != null) { val.ClearReinforcementLayers(); val.GetActiveEnemies((ActiveEnemyType)0, ref 5__3); for (int j = 0; j < 5__3.Count; j++) { if (Object.op_Implicit((Object)(object)5__3[j])) { ((Behaviour)5__3[j]).enabled = true; } } <>2__current = null; <>1__state = 1; return true; } goto IL_0107; } return false; IL_0107: 5__4++; goto IL_0119; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } internal static bool _DebugStealth = false; internal static bool _DebugCameraLock = false; internal static Action _OnDebugKeyPressed = null; private static bool _Wiggling = false; private static int _WaterLayer = -1; public static void Init() { if (!C.DEBUG_BUILD) { return; } ETGModConsole.Commands.AddGroup("hh", (Action)delegate { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) AIActor shmuppyEnemyPrefab = ChewToy.ShmuppyEnemyPrefab; IntVector2? randomAvailableCell = GameManager.Instance.PrimaryPlayer.CurrentRoom.GetRandomAvailableCell((IntVector2?)shmuppyEnemyPrefab.Clearance, (CellTypes?)shmuppyEnemyPrefab.PathableTiles, false, (CellValidator)null); if (randomAvailableCell.HasValue) { AIActor.Spawn(shmuppyEnemyPrefab, randomAvailableCell.Value, GameManager.Instance.PrimaryPlayer.CurrentRoom, true, (AwakenAnimationType)0, true).HandleReinforcementFallIntoRoom(0f); } }); ETGModConsole.Commands.AddGroup("gg", (Action)delegate { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) MasteryRitualComponent.PrepareDroppedItemForMasteryRitual(((Component)LootEngine.SpawnItem(((Component)PickupObjectDatabase.GetById(Lazy.PickupId())).gameObject, Vector2.op_Implicit(((GameActor)GameManager.Instance.PrimaryPlayer).CenterPosition), Vector2.zero, 0f, true, false, false)).GetComponent()); }); ETGModConsole.Commands.AddGroup("oo", (Action)delegate { Lazy.CreateHoveringGun(GameManager.Instance.PrimaryPlayer); }); ETGModConsole.Commands.AddGroup("zz", (Action)delegate { //IL_0017: Unknown result type (might be due to invalid IL or missing references) PlayerController primaryPlayer = GameManager.Instance.PrimaryPlayer; tk2dMeshSprite tk2dMeshSprite2 = Lazy.CreateMeshSpriteObject(((BraveBehaviour)primaryPlayer).sprite, ((BraveBehaviour)primaryPlayer).sprite.WorldTopCenter, pointMesh: true); ((BraveBehaviour)tk2dMeshSprite2).renderer.material.shader = CwaffShaders.ShatterShader; ((BraveBehaviour)tk2dMeshSprite2).renderer.material.SetFloat("_Progressive", 1f); ((BraveBehaviour)tk2dMeshSprite2).renderer.material.SetFloat("_Amplitude", 10f); ((Component)tk2dMeshSprite2).gameObject.AddComponent().Setup(((BraveBehaviour)tk2dMeshSprite2).renderer.material); }); ETGModConsole.Commands.AddGroup("ww", (Action)delegate { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown if (CwaffShaders._WiggleMat == null) { CwaffShaders._WiggleMat = new Material(CwaffShaders.ScreenWiggleShader); } if (_WaterLayer < 0) { _WaterLayer = 1 << LayerMask.NameToLayer("Water"); } _Wiggling = !_Wiggling; if (_Wiggling) { Pixelator.Instance.RegisterAdditionalRenderPass(CwaffShaders._WiggleMat); ((GameActor)GameManager.Instance.PrimaryPlayer).ToggleShadowVisiblity(false); SpriteOutlineManager.ToggleOutlineRenderers(((BraveBehaviour)GameManager.Instance.PrimaryPlayer).sprite, false); } else { Pixelator.Instance.DeregisterAdditionalRenderPass(CwaffShaders._WiggleMat); } }); ETGModConsole.Commands.AddGroup("shiny", (Action)delegate(string[] args) { tk2dBaseSprite sprite2 = ((BraveBehaviour)GameManager.Instance.PrimaryPlayer).sprite; SpriteOutlineManager.RemoveOutlineFromSprite(sprite2, false); sprite2.usesOverrideMaterial = true; Material material2 = ((BraveBehaviour)sprite2).renderer.material; material2.shader = CwaffShaders.EmissiveAlphaShader; float num = 100f; if (args.Length >= 1) { num = float.Parse(args[0]); } float num2 = 0.5f; if (args.Length >= 2) { num2 = float.Parse(args[1]); } ETGModConsole.Log((object)$"testing custom shader power {num} alpha {num2}", false); material2.SetFloat(CwaffVFX._EmissivePowerId, num); material2.SetFloat(CwaffVFX._FadeId, num2); }); ETGModConsole.Commands.AddGroup("shader", (Action)delegate(string[] args) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) if (args == null || args.Length < 1) { ETGModConsole.Log((object)"need a shader name and property and value", false); return; } try { tk2dBaseSprite sprite = ((BraveBehaviour)GameManager.Instance.PrimaryPlayer).sprite; sprite.usesOverrideMaterial = true; Material material = ((BraveBehaviour)sprite).renderer.material; if (args.Length == 2 && ETGMod.StartsWithInvariant(args[0], "_")) { if (args[0] == "_OverrideColor") { material.SetVector(args[0], new Vector4(1f, 1f, 0f, 1f)); } else { ETGModConsole.Log((object)("Setting property " + args[0] + " of current shader to " + args[1]), false); material.SetFloat(args[0], float.Parse(args[1])); } } else { ETGModConsole.Log((object)("Setting shader to " + args[0]), false); material.shader = ShaderCache.Acquire(args[0]); } } catch (Exception arg) { ETGModConsole.Log((object)$"something went wrong D: {arg}", false); } }); ETGModConsole.Commands.AddGroup("ss", (Action)delegate { GameManager.Instance.LoadCustomLevel("cg_armisticefloor"); }); ETGModConsole.Commands.AddGroup("nukefloor", (Action)delegate { NukeFloor(); }); } internal static void NukeFloor() { ((MonoBehaviour)GameManager.Instance).StartCoroutine(NukeFloor_CR()); static IEnumerator NukeFloor_CR() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <g__NukeFloor_CR|6_0>d(0); } } } public class FlowCommands { private static List knownFlows = new List(); private static List knownTilesets = new List(); private static List knownScenes = new List(); private static string[] ReturnMatchesFromList(string matchThis, List inThis) { List list = new List(); string text = matchThis.ToLower(); foreach (string inThi in inThis) { string text2 = inThi.ToLower(); if (StringAutocompletionExtensions.AutocompletionMatch(text2, text)) { list.Add(text2); } } return list.ToArray(); } public static void Install() { //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Expected O, but got Unknown if (CwaffDungeons._KnownFlows != null && CwaffDungeons._KnownFlows.Count > 0) { foreach (DungeonFlow knownFlow in CwaffDungeons._KnownFlows) { if (((Object)knownFlow).name != null && ((Object)knownFlow).name != string.Empty) { knownFlows.Add(((Object)knownFlow).name.ToLower()); } } } foreach (GameLevelDefinition dungeonFloor in GameManager.Instance.dungeonFloors) { if (dungeonFloor.dungeonPrefabPath != null && dungeonFloor.dungeonPrefabPath != string.Empty) { knownTilesets.Add(dungeonFloor.dungeonPrefabPath.ToLower()); } if (dungeonFloor.dungeonSceneName != null && dungeonFloor.dungeonSceneName != string.Empty) { knownScenes.Add(dungeonFloor.dungeonSceneName.ToLower()); } } foreach (GameLevelDefinition customFloor in GameManager.Instance.customFloors) { if (customFloor.dungeonPrefabPath != null && customFloor.dungeonPrefabPath != string.Empty) { knownTilesets.Add(customFloor.dungeonPrefabPath.ToLower()); } if (customFloor.dungeonSceneName != null && customFloor.dungeonSceneName != string.Empty) { knownScenes.Add(customFloor.dungeonSceneName.ToLower()); } } ETGModConsole.Commands.AddUnit("load_flow", (Action)LoadFlowFunction, new AutocompletionSettings((Func)((int index, string input) => index switch { 0 => ReturnMatchesFromList(input.ToLower(), knownFlows), 1 => ReturnMatchesFromList(input.ToLower(), knownTilesets), 2 => ReturnMatchesFromList(input.ToLower(), knownScenes), _ => new string[0], }))); } public static void LoadFlowFunction(string[] args) { if ((args == null) | (args.Length == 0) | (args[0].ToLower() == "help")) { ETGModConsole.Log((object)"WARNING: this command can crash gungeon! \nIf the game hangs on loading screen, use console to load a different level!\nUsage: load_flow [FLOW NAME] [TILESET NAME]. [TILESET NAME] is optional. Press tab for a list of each.\nOnce you run the command and you press escape, you should see the loading screen. If nothing happens when you use the command, the flow you tried to load doesn't exist or the path to it needs to be manually specified. Example: \"load_flow NPCParadise\".\nIf it hangs on loading screen then the tileset you tried to use doesn't exist, is no longer functional, or the flow uses rooms that are not compatible with the chosen tileset.\nAlso, you should probably know that if you run this command from the breach, the game never gives you the ability to shoot or use active items, so you should probably start a run first.", false); return; } if (args != null && args.Length > 3) { ETGModConsole.Log((object)"ERROR: Too many arguments specified! DungoenFlow name, dungoen prefab name, and dungoen scene name are the expected arguments!", false); return; } bool flag = args.Length > 1; bool flag2 = args.Length > 2; if (flag && !knownTilesets.Contains(args[1]) && Object.op_Implicit((Object)(object)DungeonDatabase.GetOrLoadByName(args[1]))) { knownTilesets.Add(args[1]); } bool num = flag && !knownTilesets.Contains(args[1]); string text = args[0].Replace('-', ' '); if (num) { ETGModConsole.Log((object)"Not a valid tileset!", false); return; } try { string text2 = "Attempting to load Dungeon Flow \"" + args[0] + "\""; if (flag) { text2 = text2 + " with tileset \"" + args[1] + "\""; } if (flag2) { text2 = text2 + " and scene \"" + args[2] + "\""; } text2 += "."; ETGModConsole.Log((object)text2, false); if (args.Length == 1) { GameManager.Instance.LoadCustomFlowForDebug(text, "", ""); } else if (args.Length == 2) { string text3 = args[1]; GameManager.Instance.LoadCustomFlowForDebug(text, text3, ""); } else if (args.Length == 3) { string text4 = args[1]; string text5 = args[2]; GameManager.Instance.LoadCustomFlowForDebug(text, text4, text5); } else { ETGModConsole.Log((object)"If you're trying to go nowhere, you're succeeding.", false); } } catch (Exception ex) { ETGModConsole.Log((object)"WHOOPS! Something went wrong! Most likely you tried to load a broken flow, or the tileset is incomplete and doesn't have the right tiles for the flow.", false); ETGModConsole.Log((object)"In order to get the game back into working order, the mod is now loading NPCParadise, with the castle tileset.", false); Debug.Log((object)"WHOOPS! Something went wrong! Most likely you tried to load a broken flow, or the tileset is incomplete and doesn't have the right tiles for the flow."); Debug.Log((object)"In order to get the game back into working order, the mod is now loading NPCParadise, with the castle tileset."); Debug.LogException(ex); GameManager.Instance.LoadCustomFlowForDebug("npcparadise", "Base_Castle", "tt_castle"); } } } public class PogoGun : CwaffGun { public static string ItemName = "Pogo Gun"; public static string ShortDescription = "Shoot Mode"; public static string LongDescription = "Fires ordinary projectiles via extraordinary mechanisms. Cannot be fired while being ridden. Infinite ammo. Does not reveal secret walls."; public static string Lore = "Rogo's trusty pogo, versatile as both a weapon and a mode of transportation. He never goes anywhere without it."; private static readonly Vector3 _PogoLeftHandOffset = new Vector3(-0.1875f, 1.0625f, 0f); private static readonly Vector3 _PogoRightHandOffset = new Vector3(0.25f, 1.0625f, 0f); private PogoStick _pogoItem; private tk2dSprite _leftHand; private tk2dSprite _rightHand; private bool _wasOnPogo; private bool _onPogo { get { if (Object.op_Implicit((Object)(object)_pogoItem)) { return _pogoItem._active; } return false; } } public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 30; Items? muzzleFrom = Items.Mailbox; Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)(-100), (GunClass)15, 1.5f, 1000, Items.Banana, defaultAudio: false, infiniteAmmo: true, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, null, null, null, "pogo_gun_shoot_sound", null, null, -1, -1, -1, muzzleFrom, modulesAreTiers: false, null, 60, 1f, (Anchor)3, -1f, null, -1f, muzzleLit: false, 0f, 0f, null, null, preventRotation: false, 0f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: false, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0, autoPlay: true, attacksThroughWalls: false, suppressReloadLabel: false, 1f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: false, preventRollingWhenCharging: false, 1f, 0.1f, canAttackWhileRolling: false, isStarterGun: true).SetReloadAudio("rogo_dodge_sound", 3, 6, 9).SetReloadAudio("pogo_gun_reload_sound", 18) .AssignGun(out gunRef); Projectile baseProjectile = Items.Ak47.Projectile(); int? clipSize = 12; float? cooldown = 0.2f; float? damage = 4.5f; float? speed = 30f; float? range = 18f; float? force = 12f; gun2.InitProjectile(GunData.New(null, baseProjectile, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, null, null, "paintball_impact_enemy_sound", "paintball_impact_wall_sound")); ((PickupObject)gunRef).PreventStartingOwnerFromDropping = true; GunExt.SetName((PickupObject)(object)gunRef, PogoStick.ItemName); } private void CheckPogoActive() { if (Object.op_Implicit((Object)(object)_pogoItem)) { if ((Object)(object)_pogoItem._owner == (Object)(object)((GunBehaviour)this).PlayerOwner) { return; } _pogoItem = null; } PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null) { PogoStick active = playerOwner.GetActive(); if (active != null) { _pogoItem = active; } } } private void EnableRenderers(PlayerController pc = null) { if (!Object.op_Implicit((Object)(object)pc)) { pc = ((GunBehaviour)this).PlayerOwner; } pc.ToggleGunRenderers(true, ItemName); pc.ToggleHandRenderers(true, ItemName); if (Object.op_Implicit((Object)(object)_rightHand)) { ((BraveBehaviour)_rightHand).renderer.enabled = false; } if (Object.op_Implicit((Object)(object)_leftHand)) { ((BraveBehaviour)_leftHand).renderer.enabled = false; } } private void UpdateHandRenderers() { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_0104: 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_010e: Unknown result type (might be due to invalid IL or missing references) tk2dSprite val = (_onPogo ? _pogoItem._attachedPogoSprite : null); if (Object.op_Implicit((Object)(object)val) && ((BraveBehaviour)val).renderer.enabled) { float heightOffGround = (_pogoItem._inFrontOfPlayer ? 1.25f : 0f); if (Object.op_Implicit((Object)(object)_rightHand)) { ((BraveBehaviour)_rightHand).renderer.enabled = true; ((BraveBehaviour)_rightHand).transform.parent = ((BraveBehaviour)val).transform; ((BraveBehaviour)_rightHand).transform.position = ((BraveBehaviour)val).transform.position + _PogoRightHandOffset; ((tk2dBaseSprite)_rightHand).HeightOffGround = heightOffGround; ((tk2dBaseSprite)_rightHand).UpdateZDepth(); } if (Object.op_Implicit((Object)(object)_leftHand)) { ((BraveBehaviour)_leftHand).renderer.enabled = true; ((BraveBehaviour)_leftHand).transform.parent = ((BraveBehaviour)val).transform; ((BraveBehaviour)_leftHand).transform.position = ((BraveBehaviour)val).transform.position + _PogoLeftHandOffset; ((tk2dBaseSprite)_leftHand).HeightOffGround = heightOffGround; ((tk2dBaseSprite)_leftHand).UpdateZDepth(); } } else { if (Object.op_Implicit((Object)(object)_rightHand)) { ((BraveBehaviour)_rightHand).renderer.enabled = false; } if (Object.op_Implicit((Object)(object)_leftHand)) { ((BraveBehaviour)_leftHand).renderer.enabled = false; } } } private void DisableRenderers(PlayerController pc = null) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)pc)) { pc = ((GunBehaviour)this).PlayerOwner; } pc.ToggleGunRenderers(false, ItemName); pc.ToggleHandRenderers(false, ItemName); if (!Object.op_Implicit((Object)(object)_rightHand) && Object.op_Implicit((Object)(object)pc.primaryHand)) { _rightHand = new GameObject().AddComponent(); ((tk2dBaseSprite)_rightHand).SetSprite(((BraveBehaviour)pc.primaryHand).sprite.collection, ((BraveBehaviour)pc.primaryHand).sprite.spriteId); } if (!Object.op_Implicit((Object)(object)_leftHand) && Object.op_Implicit((Object)(object)pc.primaryHand)) { _leftHand = new GameObject().AddComponent(); ((tk2dBaseSprite)_leftHand).SetSprite(((BraveBehaviour)pc.primaryHand).sprite.collection, ((BraveBehaviour)pc.primaryHand).sprite.spriteId); } UpdateHandRenderers(); } public override void OnTriedToInitiateAttack(PlayerController player) { base.OnTriedToInitiateAttack(player); if (_onPogo) { player.SuppressThisClick = true; } } public override void OnReloadPressed(PlayerController player, Gun gun, bool manualReload) { base.OnReloadPressed(player, gun, manualReload); } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); _wasOnPogo = false; ((GunBehaviour)this).Update(); } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); EnableRenderers(); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); _wasOnPogo = false; ((GunBehaviour)this).Update(); } public override void OnDroppedByPlayer(PlayerController player) { EnableRenderers(player); base.OnDroppedByPlayer(player); } public override void OnDestroy() { EnableRenderers(); if (Object.op_Implicit((Object)(object)_rightHand)) { ((Component)_rightHand).gameObject.transform.parent = null; Object.Destroy((Object)(object)((Component)_rightHand).gameObject); } if (Object.op_Implicit((Object)(object)_leftHand)) { ((Component)_leftHand).gameObject.transform.parent = null; Object.Destroy((Object)(object)((Component)_leftHand).gameObject); } base.OnDestroy(); } public override void Update() { base.Update(); if (!Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { return; } CheckPogoActive(); bool onPogo = _onPogo; if (onPogo != _wasOnPogo) { _wasOnPogo = onPogo; if (onPogo) { DisableRenderers(); } else { EnableRenderers(); } } UpdateHandRenderers(); } } public class Rogo { public static string Name = "Rogo"; public static readonly PlayableCharacters Character = Name.ExtendEnum("cg"); private static Dictionary _AnimFPS = new Dictionary { { "death", 6f }, { "death_coop", 6f }, { "death_shot", 18f }, { "dodge", 18f }, { "dodge_bw", 18f }, { "dodge_left", 24f }, { "dodge_left_bw", 24f }, { "ghost_sneeze_left", 12f }, { "ghost_sneeze_right", 12f }, { "idle", 9f }, { "idle_backward", 9f }, { "idle_backward_hand", 9f }, { "idle_bw", 9f }, { "idle_forward", 9f }, { "idle_forward_hand", 9f }, { "idle_hand", 9f }, { "pet", 4f }, { "pitfall_return", 27f }, { "run_down", 20f }, { "run_down_hand", 20f }, { "run_right", 20f }, { "run_right_bw", 20f }, { "run_right_hand", 20f }, { "run_up", 20f }, { "run_up_hand", 20f }, { "select_choose", 14f }, { "select_choose_long", 9f }, { "select_idle", 9f }, { "select_stargaze", 9f }, { "select_stargaze_cry", 9f } }; public static void Init() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_005e: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00cf: Expected O, but got Unknown PogoGun.Init(); CustomCharacterData data = new CustomCharacterData { baseCharacter = (PlayableCharacters)2, identity = Character, name = Name, nameShort = Name, nickname = Name, health = 2f, armor = 2f, foyerPos = new Vector3(30.25f, 21.25f), loadout = new List> { new Tuple(Lazy.Pickup(), false), new Tuple(Lazy.Pickup(), false) }, idleDoer = Extensions.RegisterPrefab(new GameObject()).InitComponent((Action)delegate(CharacterSelectIdleDoer i) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_005b: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00ad: 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_00bd: 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_00d4: Expected O, but got Unknown i.phases = (CharacterSelectIdlePhase[])(object)new CharacterSelectIdlePhase[5] { new CharacterSelectIdlePhase { inAnimation = "select_error", holdMin = 0f, holdMax = 0f }, new CharacterSelectIdlePhase { inAnimation = "select_off", holdMin = 1f, holdMax = 1f }, new CharacterSelectIdlePhase { inAnimation = "select_casing", holdMin = 0f, holdMax = 0f }, new CharacterSelectIdlePhase { inAnimation = "select_headspin", holdMin = 0f, holdMax = 0f }, new CharacterSelectIdlePhase { inAnimation = "select_stargaze", holdMin = 2f, holdMax = 4f } }; }, allowDuplicates: false) }; PlayerController val = data.MakeNewCustomCharacter(); val.InitAnimations(data, _AnimFPS).AddOrReplaceAnimation("doorway", "rogo_doorway", 10, 8).AddOrReplaceAnimation("select_error", "rogo_select_error", 10) .AddOrReplaceAnimation("select_off", "rogo_select_off", 10) .SetLoopPoint("select_casing") .SetAudio("dodge", "rogo_dodge_sound", default(int)) .SetAudio("dodge_bw", "rogo_dodge_sound", default(int)) .SetAudio("dodge_left", "rogo_dodge_sound", default(int)) .SetAudio("dodge_left_bw", "rogo_dodge_sound", default(int)) .SetAudio("run_down", "rogo_step_sound", 3, 7) .SetAudio("run_down_hand", "rogo_step_sound", 3, 7) .SetAudio("run_right", "rogo_step_sound", 3, 7) .SetAudio("run_right_bw", "rogo_step_sound", 3, 7) .SetAudio("run_right_hand", "rogo_step_sound", 3, 7) .SetAudio("run_up", "rogo_step_sound", 3, 7) .SetAudio("run_up_hand", "rogo_step_sound", 3, 7) .SetAudio("pitfall", "Play_Fall", default(int)) .SetAudio("pitfall_down", "Play_Fall", default(int)) .SetAudio("pitfall_return", "rogo_shake_sound", 3, 7, 11, 15) .SetAudio("pet", "rogo_pet_sound", 1) .SetAudio("select_choose", "rogo_off_balance_sound", 9, 11, 13) .SetAudio("select_choose", "rogo_more_off_balance_sound", 15, 17, 19) .SetAudio("select_choose", "rogo_stumble_sound", 22) .SetAudio("select_choose", "rogo_recover_sound", 28); HatUtility.SetupHatOffsets(val, 0, -2, 0, -7); HatUtility.AddHatOffset(val, "rogo_run_front_001", 1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_front_002", 2, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_front_003", 1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_front_004", 0, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_front_005", -1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_front_006", -2, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_front_007", -1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_front_008", 0, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_back_001", 1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_back_002", 2, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_back_003", 1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_back_004", 0, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_back_005", -1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_back_006", -2, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_back_007", -1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_back_008", 0, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_side_001", 1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_side_002", 2, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_side_003", 1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_side_004", 0, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_side_005", -1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_side_006", -2, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_side_007", -1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_side_008", 0, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_bw_001", 1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_bw_002", 2, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_bw_003", 1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_bw_004", 0, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_bw_005", -1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_bw_006", -2, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_bw_007", -1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_run_bw_008", 0, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_item_get_001", 1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_item_get_002", 2, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_item_get_003", 1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_item_get_004", -1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_item_get_005", -2, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_item_get_006", -1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_item_get_007", 1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_item_get_008", 2, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_item_get_009", 1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_item_get_010", -1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_item_get_011", -2, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rogo_item_get_012", -1, 0, (int?)null, (int?)null); } } public static class CwaffCharacter { [HarmonyPatch] private static class FoyerCharacterHandlerCreateOverheadCardPatch { [HarmonyPatch(typeof(FoyerCharacterHandler), "CreateOverheadCard")] private static bool Prefix(FoyerCharacterSelectFlag selectCharacter, CustomCharacterData data) { if (!_CwaffCharacters.Contains(data)) { return true; } selectCharacter.ClearOverheadElement(); if (!_OverheadPrefabs.TryGetValue(data, out var value)) { GameObject val2 = (_OverheadPrefabs[data] = data.CwaffCreateOverheadCard(selectCharacter)); value = val2; } selectCharacter.OverheadElement = value; if (Object.op_Implicit((Object)(object)data.idleDoer)) { ((Component)selectCharacter).gameObject.GetComponent().phases = data.idleDoer.phases; } return false; } } private static readonly HashSet _CwaffCharacters = new HashSet(); private static readonly Dictionary _OverheadPrefabs = new Dictionary(); private static readonly Vector3 BASEGAME_FACECARD_POSITION = new Vector3(0f, 1.687546f, 0.2250061f); private static readonly tk2dSpriteCollectionData UICollection = ((GameObject)ResourceCache.Acquire("ControllerButtonSprite")).GetComponent().Collection; internal static readonly dfAtlas UIAtlas = GameUIRoot.Instance.ConversationBar.portraitSprite.Atlas; public static readonly tk2dSpriteCollectionData Collection = SpriteBuilder.ConstructCollection(Extensions.RegisterPrefab(new GameObject(), deactivate: false, markFake: false), "GungeonCraft_Character_Collection", false); private static readonly Dictionary> _AlexandriaPunchoutData = (Dictionary>)typeof(SpriteHandler).GetField("punchoutPlayerAnimInfo", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null); public static PlayerController MakeNewCustomCharacter(this CustomCharacterData data) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) data.nameInternal = data.name.ToLower(); data.collection = Collection; data.normalMaterial = new Material(ShaderCache.Acquire("Brave/PlayerShader")); data.characterID = CharacterBuilder.storedCharacters.Count; data.altGun = new List>(); data.bossCard = new List { ResourceExtractor.GetTextureFromResource("CwaffingTheGungy/Resources/" + data.nameInternal + "_bosscard.png", (Assembly)null) }; data.pastWinPic = ResourceExtractor.GetTextureFromResource("CwaffingTheGungy/Resources/" + data.nameInternal + "_victory.png", (Assembly)null); _CwaffCharacters.Add(data); GameObject obj = CharacterBuilder.GetPlayerPrefab(data.baseCharacter).ClonePrefab(); obj.AddComponent().data = data; PlayerController component = obj.GetComponent(); component.AllowZeroHealthState = data.health == 0f; component.ForceZeroHealthState = data.health == 0f; ((BraveBehaviour)component).healthHaver.CursedMaximum = data.health; ((BraveBehaviour)component).healthHaver.maximumHealth = data.health; component.stats.SetBaseStatValue((StatType)3, data.health, component); component.uiPortraitName = data.nameInternal + "_facecard_idle_001"; component.minimapIconPrefab = Object.Instantiate(component.minimapIconPrefab); Object.DontDestroyOnLoad((Object)(object)component.minimapIconPrefab); int spriteIdByName = Collection.GetSpriteIdByName(data.nameInternal + "_minimap_icon", -1); if (spriteIdByName >= 0) { Collection.spriteDefinitions[spriteIdByName].BetterConstructOffsetsFromAnchor((Anchor)4); ((tk2dBaseSprite)component.minimapIconPrefab.GetComponent()).SetSprite(Collection, spriteIdByName); } int spriteIdByName2 = Collection.GetSpriteIdByName(data.nameInternal + "_hand_001"); Collection.spriteDefinitions[spriteIdByName2].BetterConstructOffsetsFromAnchor((Anchor)4); ((BraveBehaviour)component.primaryHand).sprite.SetSprite(Collection, spriteIdByName2); ((BraveBehaviour)component.secondaryHand).sprite.SetSprite(Collection, spriteIdByName2); CharacterBuilder.CustomizeCharacterNoSprites(component, data, (tk2dSpriteCollectionData)null, (tk2dSpriteAnimation)null, (tk2dSpriteCollectionData)null, (tk2dSpriteAnimation)null, false, (Assembly)null); SetupPunchoutSprites(component, data); CharacterBuilder.storedCharacters.Add(data.nameInternal, new Tuple(data, ((Component)component).gameObject)); ETGModConsole.Characters.Add(data.nameShort.ToLowerInvariant(), data.nameShort); return component; } private static void SetupPunchoutSprites(PlayerController pc, CustomCharacterData data) { //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Invalid comparison between Unknown and I4 //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Invalid comparison between Unknown and I4 PunchoutPlayerController player = ((Component)ResourceManager.LoadAssetBundle("enemies_base_001").LoadAsset("MetalGearRat").GetComponent()).GetComponent().PunchoutMinigamePrefab.GetComponent().Player; tk2dSpriteAnimation library = ((Component)player).gameObject.GetComponent().Library; tk2dSpriteCollectionData spriteCollection = library.clips[0].frames[0].spriteCollection; dfAtlas atlas = player.PlayerUiSprite.Atlas; string nameInternal = data.nameInternal; List list = ResMap.Get(nameInternal + "_punchout_facecard"); for (int i = 0; i < list.Count; i++) { ToolsCharApi.AddNewItemToAtlas(atlas, spriteCollection.GetSpriteDefinition(list[i]), $"punch_player_health_{nameInternal}_00{i + 1}"); } int num = library.clips.Length; Array.Resize(ref library.clips, num + _AlexandriaPunchoutData.Count); foreach (KeyValuePair> alexandriaPunchoutDatum in _AlexandriaPunchoutData) { int loopStart = (((int)alexandriaPunchoutDatum.Value.Item1 == 1) ? 7 : (((int)alexandriaPunchoutDatum.Value.Item1 == 2) ? (-1) : 0)); tk2dSpriteAnimationClip val = spriteCollection.AddAnimation(nameInternal + alexandriaPunchoutDatum.Key, null, alexandriaPunchoutDatum.Value.Item2, loopStart); if (val != null) { library.clips[num++] = val; } } } public static tk2dSpriteAnimator AddOrReplaceAnimation(this tk2dSpriteAnimator animator, string animName, string spriteName, int fps = 4, int loopStart = -1) { tk2dSpriteAnimationClip val = Collection.AddAnimation(spriteName, animName, fps, loopStart); if (val == null) { return animator; } int clipIdByName = animator.Library.GetClipIdByName(animName); if (clipIdByName >= 0) { animator.Library.clips[clipIdByName] = val; } else { Lazy.Append(ref animator.Library.clips, val); } return animator; } public static tk2dSpriteAnimator InitAnimations(this PlayerController pc, CustomCharacterData data, Dictionary fpsDict) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Invalid comparison between Unknown and I4 tk2dSpriteCollectionData collection = Collection; ((BraveBehaviour)pc).spriteAnimator.Library = Object.Instantiate(((BraveBehaviour)pc).spriteAnimator.Library); ((Object)((BraveBehaviour)pc).spriteAnimator.library).name = data.nameInternal + " library"; Object.DontDestroyOnLoad((Object)(object)((BraveBehaviour)pc).spriteAnimator.Library); tk2dSpriteAnimationClip[] clips = ((BraveBehaviour)pc).spriteAnimator.Library.clips; for (int i = 0; i < clips.Length; i++) { tk2dSpriteAnimationClip val = clips[i]; if (!fpsDict.TryGetValue(val.name, out var value)) { value = val.fps; } int loopStart = (((int)val.wrapMode == 2) ? (-1) : val.loopStart); string name = val.frames[0].spriteCollection.spriteDefinitions[val.frames[0].spriteId].name; int num = name.IndexOf("_") + 1; int num2 = name.LastIndexOf("_"); string text = name.Substring(num, num2 - num); tk2dSpriteAnimationClip val2 = collection.AddAnimation(data.nameInternal + "_" + text, val.name, value, loopStart); if (val2 == null) { continue; } tk2dSpriteAnimationClip val3 = val2; if (val.name.Contains("dodge")) { int num3 = Mathf.CeilToInt(0.5f * (float)val3.frames.Length); for (int j = 0; j < num3; j++) { val3.frames[j].invulnerableFrame = true; val3.frames[j].groundedFrame = false; } } clips[i] = val3; } return ((BraveBehaviour)pc).spriteAnimator; } public static tk2dSpriteAnimator SetAudio(this tk2dSpriteAnimator animator, string name = null, string audio = "", params int[] frameIds) { tk2dSpriteAnimationFrame[] frames = animator.GetClipByName(name).frames; foreach (int num in frameIds) { frames[num].triggerEvent = true; frames[num].eventAudio = audio; } return animator; } public static tk2dSpriteAnimator SetLoopPoint(this tk2dSpriteAnimator animator, string name = null, int loopPoint = 0) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) tk2dSpriteAnimationClip clipByName = animator.GetClipByName(name); clipByName.wrapMode = (WrapMode)((loopPoint < 0) ? 2 : ((loopPoint != 0) ? 1 : 0)); clipByName.loopStart = loopPoint; return animator; } private static GameObject CwaffCreateOverheadCard(this CustomCharacterData data, FoyerCharacterSelectFlag selectCharacter) { //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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) GameObject val = selectCharacter.OverheadElement.ClonePrefab(deactivate: true, markFake: false); ((Object)val).name = "CHR_" + data.nameShort + "Panel"; FoyerInfoPanelController component = val.GetComponent(); component.followTransform = ((BraveBehaviour)selectCharacter).transform; ((Component)((Component)component.textPanel).transform.Find("NameLabel")).GetComponent().Text = "#CHAR_" + data.nameShort.ToUpper(); ((Component)((Component)component.textPanel).transform.Find("PastKilledLabel")).GetComponent().ModifyLocalizedText("(No Past)"); GameObject val2 = FakePrefab.Clone(((Component)((Component)component.itemsPanel).GetComponentInChildren()).gameObject); dfSprite[] componentsInChildren = ((Component)component.itemsPanel).GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate((Object)(object)((Component)componentsInChildren[i]).gameObject); } for (int j = 0; j < data.loadout.Count; j++) { PickupObject first = data.loadout[j].First; string text = ((first.PickupObjectId > 823) ? first.itemName : first.DisplayName).InternalName() + "_ui"; if (UIAtlas.map.TryGetValue(text, out var value)) { dfSprite component2 = FakePrefab.Clone(val2).GetComponent(); component2.SpriteName = text; ((dfControl)component2).Size = 3f * value.sizeInPixels; ((Component)component2).transform.parent = ((Component)component.itemsPanel).transform; ((Component)component2).transform.localPosition = new Vector3(((float)j + 0.1f) * 0.1f, 0f, 0f); ((dfControl)component.itemsPanel).Controls.Add((dfControl)(object)component2); } } CharacterSelectFacecardIdleDoer componentInChildren = val.GetComponentInChildren(); ((Object)((Component)componentInChildren).gameObject).name = data.nameShort + " Sprite FaceCard"; ((BraveBehaviour)componentInChildren).spriteAnimator = ((Component)componentInChildren).gameObject.GetComponent(); ((BraveBehaviour)componentInChildren).transform.localPosition = BASEGAME_FACECARD_POSITION; ((BraveBehaviour)componentInChildren).transform.parent.localPosition = Vector3.zero; ((BraveBehaviour)((BraveBehaviour)componentInChildren).spriteAnimator).sprite.scale = 8f * Vector3.one; string text2 = data.nameShort.ToLower() + "_facecard_appear"; tk2dSpriteAnimationClip val3 = UICollection.AddAnimation(text2 ?? "", null, 17f, -1); if (val3 != null) { tk2dSpriteAnimationFrame[] frames = val3.frames; foreach (tk2dSpriteAnimationFrame val4 in frames) { val4.spriteCollection.spriteDefinitions[val4.spriteId].BetterConstructOffsetsFromAnchor((Anchor)1); } ((BraveBehaviour)componentInChildren).spriteAnimator.AddClip(val3); componentInChildren.appearAnimation = text2; ((BraveBehaviour)componentInChildren).spriteAnimator.DefaultClipId = ((BraveBehaviour)componentInChildren).spriteAnimator.Library.clips.Length - 1; } string text3 = data.nameShort.ToLower() + "_facecard_idle"; tk2dSpriteAnimationClip val5 = UICollection.AddAnimation(text3 ?? "", null, 17f); if (val5 != null) { tk2dSpriteAnimationFrame[] frames = val5.frames; foreach (tk2dSpriteAnimationFrame val6 in frames) { val6.spriteCollection.spriteDefinitions[val6.spriteId].BetterConstructOffsetsFromAnchor((Anchor)1); } ((BraveBehaviour)componentInChildren).spriteAnimator.AddClip(val5); componentInChildren.coreIdleAnimation = text3; } component.scaledSprites = (tk2dSprite[])(object)new tk2dSprite[1] { (tk2dSprite)/*isinst with value type is only supported in some contexts*/ }; return val.RegisterPrefab(); } } public enum Floors { GUNGEON = 1, CASTLEGEON = 2, SEWERGEON = 4, CATHEDRALGEON = 8, MINEGEON = 0x10, CATACOMBGEON = 0x20, FORGEGEON = 0x40, HELLGEON = 0x80, SPACEGEON = 0x100, PHOBOSGEON = 0x200, WESTGEON = 0x400, OFFICEGEON = 0x800, BELLYGEON = 0x1000, JUNGLEGEON = 0x2000, FINALGEON = 0x4000, RATGEON = 0x8000 } [HarmonyPatch] internal static class BossPatches { [HarmonyPatch(typeof(Bullet), "FrameUpdate")] [HarmonyPrefix] private static bool BulletFrameUpdatePatch(Bullet __instance) { if (__instance.TimeScale >= 0f) { return true; } __instance.DoTick(); return false; } [HarmonyPatch(typeof(Bullet), "UpdatePosition")] [HarmonyPrefix] private static bool BulletUpdatePositionPatch(Bullet __instance) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (__instance.TimeScale >= 0f) { return true; } Vector2 position = __instance.Position; float deltaTime = BraveTime.DeltaTime; position.x += __instance.Velocity.x * deltaTime; position.y += __instance.Velocity.y * deltaTime; __instance.Position = position; return false; } } public class BossController : DungeonPlaceableBehaviour, IPlaceConfigurable { [CompilerGenerated] private sealed class d__16 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public AIActor enemy; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSecondsRealtime(1f / 60f); <>1__state = 1; return true; case 1: <>1__state = -1; SpriteOutlineManager.RemoveOutlineFromSprite(((BraveBehaviour)enemy).sprite, false); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public string enemyGuid; public string musicId; public int loopPoint = -1; public int loopRewind = -1; private AIActor theBoss; private bool bossFightStarted; private RoomHandler bossRoom; private BossController() { } internal static BossController NewPrefab(string guid) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown return SpriteBuilder.AddComponent(Extensions.RegisterPrefab(new GameObject("BossController")), new BossController { enemyGuid = guid }); } public void ConfigureOnPlacement(RoomHandler room) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown foreach (AIActor item in room.SafeGetEnemiesInRoom()) { if (item.EnemyGuid == enemyGuid) { theBoss = item; break; } } if ((Object)(object)theBoss == (Object)null) { ETGModConsole.Log((object)"Something went horrendously wrong setting up the Boss o.o", false); return; } SetUpBossRoom(theBoss); bossRoom = room; bossRoom.Entered += new OnEnteredEventHandler(OnBossRoomEntered); } private void OnBossRoomEntered(PlayerController p) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown bossRoom.Entered -= new OnEnteredEventHandler(OnBossRoomEntered); SetUpBossFight(theBoss); } public void SetMusic(string musicName, int loopPoint = -1, int rewindAmount = -1) { musicId = musicName; this.loopPoint = loopPoint; loopRewind = rewindAmount; } private void RegisterAnyInteractables(AIActor enemy) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) Component[] componentsInChildren = ((Component)enemy).GetComponentsInChildren(typeof(IPlayerInteractable)); for (int i = 0; i < componentsInChildren.Length; i++) { if (componentsInChildren[i] is IPlayerInteractable) { ? val = Vector3Extensions.GetAbsoluteRoom(((BraveBehaviour)enemy).transform.position); Component obj = componentsInChildren[i]; ((RoomHandler)val).RegisterInteractable((IPlayerInteractable)(object)((obj is IPlayerInteractable) ? obj : null)); } } } private void SetUpBossRoom(AIActor enemy) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Invalid comparison between Unknown and I4 RegisterAnyInteractables(enemy); GenericIntroDoer component = ((Component)enemy).GetComponent(); if (!string.IsNullOrEmpty(component.preIntroAnim)) { ((BraveBehaviour)enemy).aiAnimator.PlayUntilCancelled(component.preIntroAnim, false, (string)null, -1f, false); } ((BraveBehaviour)enemy).healthHaver.ManualDeathHandling = true; if ((int)component.triggerType == 20) { ((BraveBehaviour)enemy).healthHaver.IsVulnerable = false; } } private void SetUpBossFight(AIActor enemy) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 BossNPC npc = ((Component)enemy).GetComponent(); if ((Object)(object)npc != (Object)null) { npc.SetBossController(this); ((BraveBehaviour)enemy).healthHaver.OnPreDeath += delegate { npc.FinishBossFight(); }; } else { ((BraveBehaviour)enemy).healthHaver.OnPreDeath += delegate { //IL_000b: Unknown result type (might be due to invalid IL or missing references) Vector3Extensions.GetAbsoluteRoom(((BraveBehaviour)enemy).transform.position).UnsealRoom(); }; } if ((int)((Component)enemy).GetComponent().triggerType == 10) { StartBossFight(enemy); } } public void StartBossFight(AIActor enemy) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Invalid comparison between Unknown and I4 //IL_00a3: Unknown result type (might be due to invalid IL or missing references) if (!bossFightStarted) { bossFightStarted = true; ((BraveBehaviour)enemy).aiAnimator.EndAnimation(); BossNPC component = ((Component)enemy).GetComponent(); if ((Object)(object)component != (Object)null) { ((MonoBehaviour)((BraveBehaviour)enemy).aiAnimator).StartCoroutine(RemoveOutlines(enemy)); component.startedFight = true; Vector3Extensions.GetAbsoluteRoom(((Component)enemy).gameObject.transform.position).DeregisterInteractable((IPlayerInteractable)(object)component); } if (musicId != null) { enemy.PlayBossMusic(musicId, loopPoint, loopRewind); } if ((int)((Component)enemy).GetComponent().triggerType == 20) { ((BraveBehaviour)enemy).healthHaver.IsVulnerable = true; } Vector3Extensions.GetAbsoluteRoom(((BraveBehaviour)enemy).transform.position).SealRoom(); } } private IEnumerator RemoveOutlines(AIActor enemy) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__16(0) { enemy = enemy }; } } public class BossNPC : FancyNPC { [CompilerGenerated] private sealed class <g__FinishBossFight_CR|7_0>d : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public BossNPC <>4__this; private AIActor 5__2; private IEnumerator