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] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] internal sealed class IsReadOnlyAttribute : Attribute { } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace 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 != CustomDungeonFlags.NONE && !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 != CustomDungeonFlags.NONE) { 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 != CustomDungeonFlags.NONE) { 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 != CustomDungeonFlags.NONE) { 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 != CustomCharacterSpecificGungeonFlags.NONE) { 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 unsafe 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*)(&questFlag))/*cast due to .constrained prefix*/).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 unsafe 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*)(&questFlag))/*cast due to .constrained prefix*/).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); 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 orig(self, data); if (AdvancedGameStatsManager.VerifyAndLoadMidgameSave(out var midgameSave)) { midgameSave.LoadDataFromMidGameSave(); } } 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 != CustomDungeonFlags.NONE) { 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 != CustomDungeonFlags.NONE) { ((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 != CustomDungeonFlags.NONE) { ((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, ENCOUNTERED_DON } 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 != CustomDungeonFlags.NONE && 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 != CustomDungeonFlags.NONE) { 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(); } protected override void DetermineNewTarget() { //IL_0051: 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_00da: 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_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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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 = Lazy.NearestEnemy(((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.UnitCenter); 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_00c7; } } val2 = Vector3Extensions.GetAbsoluteRoom(((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition); goto IL_00c7; IL_00c7: 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 != State.IDLE && 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 { 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); } public override void Pickup(PlayerController player) { base.Pickup(player); player.SetImmuneToExplosions(value: true, ItemName); } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); player.SetImmuneToExplosions(value: false, ItemName); } internal 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) { ((Component)target).gameObject.PlayUnique("stunt_time"); Material mat = SpriteOutlineManager.GetOutlineMaterial(((BraveBehaviour)target).sprite); if (Object.op_Implicit((Object)(object)mat)) { mat.SetColor(CwaffVFX._OverrideColorId, new Color(128f, 0f, 16f)); } target.ownerlessStatModifiers.Add(_StuntStats); target.stats.RecalculateStats(target, false, false); for (float elapsed = 0f; elapsed < 5f; elapsed += BraveTime.DeltaTime) { yield return null; if (!Object.op_Implicit((Object)(object)target) || !target.AcceptingAnyInput) { yield break; } } if (Object.op_Implicit((Object)(object)mat)) { mat.SetColor(CwaffVFX._OverrideColorId, new Color(0f, 0f, 0f)); } target.ownerlessStatModifiers.Remove(_StuntStats); target.stats.RecalculateStats(target, false, false); helmet._extantDamageBoostCoroutine = null; } } 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_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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) if (m_companionController.m_owner.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 allNearbyEnemy in unitCenter.GetAllNearbyEnemies()) { if ((Object)(object)allNearbyEnemy == (Object)(object)_lastDroppedActor || ((GameActor)allNearbyEnemy).IsFlying || ((GameActor)allNearbyEnemy).FallingProhibited || ((GameActor)allNearbyEnemy).IsFalling) { continue; } HealthHaver healthHaver = ((BraveBehaviour)allNearbyEnemy).healthHaver; if (healthHaver == null || healthHaver.maximumHealth >= num2 || healthHaver.IsBoss || healthHaver.IsSubboss) { continue; } SpeculativeRigidbody specRigidbody = ((BraveBehaviour)allNearbyEnemy).specRigidbody; if (specRigidbody == null || !specRigidbody.CanBeCarried) { continue; } BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)allNearbyEnemy).behaviorSpeculator; if (behaviorSpeculator != null && behaviorSpeculator.IsInterruptable && !behaviorSpeculator.ImmuneToStun) { Vector2 val = ((GameActor)allNearbyEnemy).CenterPosition - unitCenter; float sqrMagnitude = ((Vector2)(ref val)).sqrMagnitude; if (!(sqrMagnitude > num3)) { result = allNearbyEnemy; 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 != State.OWNER_FOLLOW) { _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 != State.OWNER_FOLLOW || !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 != State.OWNER_FOLLOW && ((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 { 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() { float num = 55f * (isHyped ? 1.2f : 1f); Vector2 vel = num * _dashDir; ((Component)((CustomDodgeRoll)this)._owner).gameObject.Play("teledasher"); DustUpVFX dusts = GameManager.Instance.Dungeon.dungeonDustups; for (int i = 0; i < 16; i++) { float num2 = Random.Range(0f, 360f); float num3 = Random.Range(0f, 360f); float num4 = Random.Range(0.3f, 1.25f); SpawnManager.SpawnVFX(dusts.rollLandDustup, Vector2.op_Implicit(((GameActor)((CustomDodgeRoll)this)._owner).CenterPosition + BraveMathCollege.DegreesToVector(num2, num4)), Quaternion.Euler(0f, 0f, num3)); } bool interrupted = false; for (float timer = 0f; timer < 0.125f; timer += BraveTime.DeltaTime) { ((CustomDodgeRoll)this)._owner.PlayerAfterImage(); ((BraveBehaviour)((CustomDodgeRoll)this)._owner).specRigidbody.Velocity = vel; GameManager.Instance.Dungeon.dungeonDustups.InstantiateLandDustup(Vector2.op_Implicit(((GameActor)((CustomDodgeRoll)this)._owner).CenterPosition)); yield return null; if (((GameActor)((CustomDodgeRoll)this)._owner).IsFalling) { interrupted = true; break; } } if (!interrupted) { ((CustomDodgeRoll)this)._owner.PlayerAfterImage(); for (int j = 0; j < 8; j++) { float num5 = Random.Range(0f, 360f); float num6 = Random.Range(0f, 360f); float num7 = Random.Range(0.3f, 1f); SpawnManager.SpawnVFX(dusts.rollLandDustup, Vector2.op_Implicit(((GameActor)((CustomDodgeRoll)this)._owner).CenterPosition + BraveMathCollege.DegreesToVector(num5, num7)), Quaternion.Euler(0f, 0f, num6)); } } ((BraveBehaviour)((CustomDodgeRoll)this)._owner).spriteAnimator.Stop(); } } public class PlotArmor : CwaffPassive { 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) { int i = 0; bool flag = default(bool); while (i < armorToGain) { yield return (object)new WaitForSeconds(0.33f); IntVector2 centeredVisibleClearSpot = room.GetCenteredVisibleClearSpot(2, 2, ref flag, false); Vector2 val = ((IntVector2)(ref centeredVisibleClearSpot)).ToVector2(); if (!flag) { val = ((GameActor)((PassiveItem)this).Owner).CenterPosition; } LootEngine.SpawnItem(((Component)ItemHelper.Get(Items.Armor)).gameObject, Vector2.op_Implicit(val), Vector2.zero, 0f, true, true, false); int num = i + 1; i = num; } } } 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 { 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() { SpawnManager.SpawnVFX(EchoChamber._EchoPrefab, Vector2.op_Implicit(_echoPosition), Quaternion.identity).ExpireIn(2f, 2f, 0.25f, shrink: true); float baseDamageScale = 0.5f; float baseSpeedScale = 1f; float baseSpriteScale = 1f; float delay = 0.25f; int i = 0; while (i < 3) { yield return (object)new WaitForSeconds(delay); delay *= 2f; baseDamageScale *= 0.5f; baseSpriteScale -= 0.1f; SpawnProjectile(baseDamageScale, baseSpeedScale, baseSpriteScale); int num = i + 1; i = num; } Object.Destroy((Object)(object)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.Remove(projectile); } } public override void Update() { //IL_0020: 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_006a: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: 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_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: 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_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: 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_0108: 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_0117: 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 ((GameActor)((PassiveItem)this).Owner).CenterPosition.GetAllNearbyEnemies()) { 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 = "Guarantees Don's Pizza Kitchen will appear on every main floor."; 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 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"; internal static bool _ShouldPlayMusic = true; internal static GameObject _PizzaMinimapIcon = null; public static void Init() { //IL_0021: 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_006e: 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_008b: Expected O, but got Unknown //IL_00b0: 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.BanFromCoop(); PizzaPeel.Init(); AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5"); orLoadByGuid.AddSpecialAnimation("bullet_money", "money", 8f, loop: true, copyMaterialSettings: true, new IntVector2(-7, 0)); orLoadByGuid.AddSpecialAnimation("bullet_pizza", "pizza", 12f, loop: true, copyMaterialSettings: true, new IntVector2(-7, 0)); _PizzaMinimapIcon = Extensions.RegisterPrefab(new GameObject("minimap_pizza_icon"), deactivate: false); ((tk2dBaseSprite)_PizzaMinimapIcon.AddComponent()).SetSprite(VFX.Collection, AtlasHelper.AddSpritesToCollection(ResMap.Get("minimap_pizza_icon"), VFX.Collection).x); } public override void Pickup(PlayerController player) { base.Pickup(player); CwaffEvents.OnCleanStart = (Action)Delegate.Remove(CwaffEvents.OnCleanStart, new Action(PizzaTimeController.OnFloorEnded)); CwaffEvents.OnCleanStart = (Action)Delegate.Combine(CwaffEvents.OnCleanStart, new Action(PizzaTimeController.OnFloorEnded)); CwaffEvents.OnFloorEnded = (Action)Delegate.Combine(CwaffEvents.OnFloorEnded, new Action(PizzaTimeController.OnFloorEnded)); } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); CwaffEvents.OnFloorEnded = (Action)Delegate.Remove(CwaffEvents.OnFloorEnded, new Action(PizzaTimeController.OnFloorEnded)); } } 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_0467: 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_059f: 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_05a6: Unknown result type (might be due to invalid IL or missing references) //IL_05ae: Unknown result type (might be due to invalid IL or missing references) //IL_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_05be: Unknown result type (might be due to invalid IL or missing references) //IL_05c6: Unknown result type (might be due to invalid IL or missing references) //IL_05c8: Unknown result type (might be due to invalid IL or missing references) //IL_05cd: Unknown result type (might be due to invalid IL or missing references) //IL_05d4: Unknown result type (might be due to invalid IL or missing references) //IL_05e0: 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, 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 } }; } 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[_IdleAnimations.Count - 1]; ((GunBehaviour)this).gun.shootAnimation = _FireAnimations[_FireAnimations.Count - 1]; } else { ((GunBehaviour)this).gun.idleAnimation = _IdleAnimations[Mathf.Clamp(((GunBehaviour)this).gun.ClipShotsRemaining, 0, _IdleAnimations.Count - 1)]; ((GunBehaviour)this).gun.shootAnimation = _FireAnimations[Mathf.Clamp(((GunBehaviour)this).gun.ClipShotsRemaining - 1, 0, _FireAnimations.Count - 1)]; } ((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 PizzaPeelProjectile : MonoBehaviour { 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_00a2: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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; component2.DeregisterRoomIcon(); 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); ((BraveBehaviour)component).aiAnimator.OverrideIdleAnimation = "pizza"; ((Component)component).gameObject.Play("got_some_cash"); PizzaTimeController._CurDeliveries++; } } public class WantsPizza : MonoBehaviour { public bool hasPizza; internal RoomHandler _room; private AIActor _enemy; private HealthHaver _hh; private GameObject _threatArrow; private GameObject _roomIcon; private void Start() { _enemy = ((Component)this).gameObject.GetComponent(); KnockbackDoer knockbackDoer = ((BraveBehaviour)_enemy).knockbackDoer; if (knockbackDoer != null) { knockbackDoer.SetImmobile(true, "pizza"); } SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_enemy).specRigidbody; if (specRigidbody != null) { specRigidbody.AddCollisionLayerIgnoreOverride(CollisionMask.LayerToMask((CollisionLayer)1, (CollisionLayer)0)); } } 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() { DeregisterRoomIcon(); 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 void RegisterRoomIcon(RoomHandler room) { _room = room; _roomIcon = Minimap.Instance.RegisterRoomIcon(room, Domino._PizzaMinimapIcon, true); } public void DeregisterRoomIcon() { if (Object.op_Implicit((Object)(object)_roomIcon)) { Minimap.Instance.DeregisterRoomIcon(_room, _roomIcon); _roomIcon = null; } } } 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 _PizzaTimeTriedToSpawnThisFloor = false; internal static bool _PizzaTimeAttemptedThisFloor = false; internal static bool _TimerExpired = false; internal static bool _RuinedEquipment = 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; internal static FancyNPC _DonNPC = null; private static PizzaTimeController _Instance = null; 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 readonly List _PizzaTimeBlackList = new List(); private static readonly string[] _ChestNames = new string[5] { "Brown", "Blue", "Green", "Red", "Black" }; 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_00d0: 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_009f: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_018e: 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) //IL_00fa: 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) { num2 = 0; num4 /= 2; } } else { num2 = 0; } } } else { num2++; } FancyNPC donNPC = _DonNPC; bool flag = default(bool); IntVector2 position = ((donNPC == null || !Object.op_Implicit((Object)(object)((BraveBehaviour)donNPC).sprite)) ? _DeliveryBoi.CurrentRoom.GetCenteredVisibleClearSpot(2, 2, ref flag, false) : Vector2Extensions.ToIntVector2(((BraveBehaviour)donNPC).sprite.WorldBottomCenter + new Vector2(-0.5f, -5f), (VectorConversions)2)); if (num2 > 0) { if (Random.value > 0.3f) { num2++; } Chest val = Lazy.SpawnChestWithSpecificItem(_DeliveryBoi.GetRandomChestRewardOfQuality((ItemQuality)num2).GetComponent(), position); if (Object.op_Implicit((Object)(object)val)) { val.ForceUnlock(); } } LootEngine.SpawnCurrency(((IntVector2)(ref position)).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}[sprite \"ui_coin\"]"; if (num2 > 0) { text = text + "\n- " + _ChestNames[num2 - 1] + " Chest"; } CustomNoteDoer.CreateNote(((IntVector2)(ref position)).ToVector2() + new Vector2(-1.5f, 0f), text, (NoteBackgroundType)3); } private static void SpawnHungryBulletKins() { //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_0078: Unknown result type (might be due to invalid IL or missing references) AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5"); foreach (RoomHandler deliveryRoom in _DeliveryRooms) { int num = Random.Range(1, 5); for (int i = 0; i < num; i++) { int? overrideClearance = 4; IntVector2? val = orLoadByGuid.RandomCellForEnemySpawn(deliveryRoom, spawnFarFromPlayer: false, null, overrideClearance); if (val.HasValue) { IntVector2 valueOrDefault = val.GetValueOrDefault(); AIActor val2 = AIActor.Spawn(orLoadByGuid, valueOrDefault, deliveryRoom, false, (AwakenAnimationType)0, true); val2.IgnoreForRoomClear = true; val2.CollisionDamage = 0f; val2.ParentRoom.ResetEnemyHPPercentage(); WantsPizza wantsPizza = ((Component)val2).gameObject.AddComponent(); BehaviorSpeculator component = ((Component)val2).gameObject.GetComponent(); if (component != null) { component.AttackBehaviors.Clear(); component.OverrideBehaviors.Clear(); component.OtherBehaviors.Clear(); component.MovementBehaviors.Clear(); } val2.HasDonePlayerEnterCheck = true; val2.OnEngaged(true); AIShooter aiShooter = ((BraveBehaviour)val2).aiShooter; if (aiShooter != null) { Gun currentGun = aiShooter.CurrentGun; if (currentGun != null) { aiShooter.ToggleHandRenderers(false, "pizza"); if ((Object)(object)aiShooter.m_cachedBraveBulletSource != (Object)null) { ((Behaviour)aiShooter.m_cachedBraveBulletSource).enabled = false; } GameObject gameObject = ((Component)currentGun.DropGun(0.5f)).gameObject; if (gameObject != null) { Object.Destroy((Object)(object)gameObject); } } Object.Destroy((Object)(object)aiShooter); } ((BraveBehaviour)val2).aiAnimator.OverrideIdleAnimation = "money"; wantsPizza.RegisterRoomIcon(deliveryRoom); _Hungrybois.AddLast(val2); continue; } num = i; break; } } _CurDeliveries = 0; _MaxDeliveries = _Hungrybois.Count; } private static void DespawnHungryBulletKins() { //IL_0074: 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.DeregisterRoomIcon(); RoomHandler absoluteRoom = Vector3Extensions.GetAbsoluteRoom(((GameActor)value).CenterPosition); if (absoluteRoom != null) { Minimap.Instance.DeregisterRoomIcon(absoluteRoom, PizzaPeel._PizzaSliceVFX); } if (val != null && component._room == 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; _DonNPC = null; _ScannedRoomsThisFloor = false; _PizzaTimeTriedToSpawnThisFloor = false; _PizzaTimeAttemptedThisFloor = false; _TimerExpired = false; _RuinedEquipment = 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; } internal static bool CheckAnyRoomsStillOccupied() { if (!_ScannedRoomsThisFloor) { ScanRooms(); } 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 !CheckAnyRoomsStillOccupied(); } return false; } public static bool CanStartPizzaTime(PlayerController deliveryboi) { if (_PizzaTimeHappening) { return false; } if (!Object.op_Implicit((Object)(object)deliveryboi) || deliveryboi.IsGunLocked || deliveryboi.inventory.GunLocked.Value) { return false; } if (!AllRoomsCleared()) { return false; } return true; } private static void OnReceivedDamage(PlayerController deliveryboi) { if (_PizzaTimeHappening) { deliveryboi.OnReceivedDamage -= OnReceivedDamage; _RuinedEquipment = true; EndPizzaTime(); } } public static bool StartPizzaTime(PlayerController deliveryboi) { //IL_00e7: 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) if (!GivePizzaPeel(deliveryboi)) { return false; } CwaffEvents.OnFloorEnded = (Action)Delegate.Remove(CwaffEvents.OnFloorEnded, new Action(OnFloorEnded)); CwaffEvents.OnFloorEnded = (Action)Delegate.Combine(CwaffEvents.OnFloorEnded, new Action(OnFloorEnded)); CwaffEvents.OnCleanStart = (Action)Delegate.Remove(CwaffEvents.OnCleanStart, new Action(OnFloorEnded)); CwaffEvents.OnCleanStart = (Action)Delegate.Combine(CwaffEvents.OnCleanStart, new Action(OnFloorEnded)); deliveryboi.OnReceivedDamage += OnReceivedDamage; _Instance = new GameObject().AddComponent(); ((Component)_Instance).gameObject.Play("pizza_event_start_sound"); _PizzaTimeHappening = true; _PizzaTimeAttemptedThisFloor = true; _DeliveryBoi = deliveryboi; _DeliveryBoi.OverrideHat(CwaffHats._PizzaHat); SpawnHungryBulletKins(); CalculateEventTimer(); DoPizzaTimeMusic(); GameObject pizzaSliceVFX = PizzaPeel._PizzaSliceVFX; Vector2 centerPosition = ((GameActor)deliveryboi).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); return true; } public static void EndPizzaTime(bool floorEnded = false) { if (!_PizzaTimeHappening) { return; } _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)) { _DeliveryBoi.OnReceivedDamage -= OnReceivedDamage; DestroyPizzaPeel(_DeliveryBoi); _DeliveryBoi.ClearHatOverride(CwaffHats._PizzaHat); _DeliveryBoi = 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); } if (Object.op_Implicit((Object)(object)_DeliveryBoi) && !_DeliveryBoi.IsInputOverridden && _DeliveryBoi.AcceptingNonMotionInput) { _PizzaEventTimer -= BraveTime.DeltaTime; if (!(_PizzaEventTimer > 0f)) { _PizzaEventTimer = 0f; _TimerExpired = true; 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) : ((int?)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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00ac: 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) ((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 centerPosition.AllEnemiesWithinConeOfVision(currentGunAngle, 10f)) { if (item.IsABoss() || !Object.op_Implicit((Object)(object)((BraveBehaviour)item).behaviorSpeculator) || ((BraveBehaviour)item).behaviorSpeculator.ImmuneToStun) { continue; } if (flag) { _afflictedEnemiesAlt.Add(item); continue; } Vector2 val2 = ((GameActor)item).CenterPosition - centerPosition; float sqrMagnitude = ((Vector2)(ref val2)).sqrMagnitude; if (!(sqrMagnitude >= num)) { 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_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_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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Invalid comparison between Unknown and I4 //IL_0086: 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_0098: Unknown result type (might be due to invalid IL or missing references) ((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)) { return; } Vector2 unitBottomCenter = ((BraveBehaviour)((PassiveItem)this).Owner).specRigidbody.UnitBottomCenter; if (((PassiveItem)this).Owner.HasSynergy(Synergy.BEDTIME_ROUTINE)) { if (!Object.op_Implicit((Object)(object)SudsWave._ToothpasteGooper)) { SudsWave._ToothpasteGooper = DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(EasyGoopDefinitions.ToothpasteGoop); } if (SudsWave._ToothpasteGooper.m_goopedPositions.Contains(unitBottomCenter.WorldToGoopPosition())) { SudsWave._ToothpasteGooper.AddGoopCircle(unitBottomCenter, 1f, -1, false, -1); } } CellFloorType floorTypeFromPosition = GameManager.Instance.Dungeon.GetFloorTypeFromPosition(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 { 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 (object)new WaitForSeconds(3f); BreakStealth(((PassiveItem)this).Owner); } } 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_0028: 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_00c5: 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_00ca: 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) //IL_00d3: 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; } string enemyGuid = ((BraveBehaviour)enemy).aiActor.EnemyGuid; foreach (AIActor allNearbyEnemy in ((GameActor)((BraveBehaviour)enemy).aiActor).CenterPosition.GetAllNearbyEnemies()) { if (!(allNearbyEnemy.EnemyGuid != enemyGuid) && !((Object)(object)allNearbyEnemy == (Object)(object)((BraveBehaviour)enemy).aiActor)) { if (Object.op_Implicit((Object)(object)((BraveBehaviour)allNearbyEnemy).healthHaver)) { ((BraveBehaviour)allNearbyEnemy).healthHaver.ApplyDamage(damage, Vector2.zero, "Voodoo Doll", (CoreDamageTypes)2, (DamageCategory)5, true, (PixelCollider)null, false); } if (Object.op_Implicit((Object)(object)((BraveBehaviour)allNearbyEnemy).sprite)) { bool flag = Lazy.CoinFlip(); Vector2 val = (flag ? ((BraveBehaviour)allNearbyEnemy).sprite.WorldTopRight : ((BraveBehaviour)allNearbyEnemy).sprite.WorldTopLeft); GameObject voodooGhostVFX = _VoodooGhostVFX; Vector3 position = Vector2.op_Implicit(val); 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_00a7: 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_0101: 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_013d: 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) ((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; } AIActor val = ((GameActor)owner).CenterPosition.NearestEnemyWithinConeOfVision(owner.m_currentGunAngle, 90f, 3f, useNearestAngleInsteadOfDistance: false, ignoreWalls: true); 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 { 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 (object)new WaitForSeconds(3f); if (Object.op_Implicit((Object)(object)((PassiveItem)this).Owner)) { RemoveBoosts(((PassiveItem)this).Owner); } } } 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) //IL_00bf: 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]; List list = new List(4) { "campfire_a", "campfire_b", "campfire_c", "campfire_d" }; for (int i = 0; i < 4; i++) { GameObject[] campfirePrefabs = _CampfirePrefabs; int num = i; string name = list[i]; Color? emissiveColour = new Color(1f, 1f, 0.2f); campfirePrefabs[num] = VFX.Create(name, 8f, loops: true, -1, 0.5f, (Anchor)1, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 10f, emissiveColour, orphaned: false, attached: true, unlit: false, 0f, 0f, null, 10f, 0f, useBetterEmission: true); } _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_00a6: 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, 1f, (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 { 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) { _ = ((BraveBehaviour)pc).sprite; Vector3 deathScale = ((BraveBehaviour)pc).sprite.scale; Vector3 deathPosition = ((BraveBehaviour)((BraveBehaviour)pc).sprite).transform.position; GameObject corpse = SpawnManager.SpawnDebris(_CorpsePrefab, ((BraveBehaviour)pc).transform.position, Quaternion.identity); tk2dSprite corpseSprite = corpse.GetComponent(); ((tk2dBaseSprite)corpseSprite).SetSprite(((BraveBehaviour)pc).sprite.Collection, ((BraveBehaviour)pc).sprite.spriteId); tk2dSpriteAnimator animator = GameObjectExtensions.GetOrAddComponent(((Component)corpseSprite).gameObject); string text = ((!pc.UseArmorlessAnim) ? "death_coop" : "death_coop_armorless"); tk2dSpriteAnimationClip deathClip = ((BraveBehaviour)pc).spriteAnimator.GetClipByName(text); animator.Play(deathClip, 0f, 8f, true); yield return null; while (animator.IsPlaying(deathClip)) { yield return null; } ((tk2dBaseSprite)corpseSprite).scale = deathScale; corpse.transform.position = deathPosition; ((tk2dBaseSprite)corpseSprite).HeightOffGround = -3.5f; ((tk2dBaseSprite)corpseSprite).UpdateZDepth(); } 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, copyShaders: 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].Remove(((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].Remove(((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 { 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() { float minDashSpeed = GetDodgeRollSpeed(); float maxDashSpeed = minDashSpeed * 5f; DustUpVFX dusts = GameManager.Instance.Dungeon.dungeonDustups; BraveInput instanceForPlayer = BraveInput.GetInstanceForPlayer(((CustomDodgeRoll)this)._owner.PlayerIDX); tookDamageDuringDodgeRoll = false; ((CustomDodgeRoll)this)._owner.OnReceivedDamage += OnReceivedDamage; PlayerController owner = ((CustomDodgeRoll)this)._owner; owner.OnRealPlayerDeath = (Action)Delegate.Combine(owner.OnRealPlayerDeath, new Action(OnReceivedDamage)); stumbleClip = null; tornadoVFX = Object.Instantiate(Gyroscope._TornadoVFX, Vector2.op_Implicit(((BraveBehaviour)((CustomDodgeRoll)this)._owner).specRigidbody.UnitBottomCenter), Quaternion.identity); tk2dSpriteAnimator tornadoAnimator = tornadoVFX.GetComponent(); ((BraveBehaviour)((BraveBehaviour)tornadoAnimator).sprite).transform.parent = ((BraveBehaviour)((CustomDodgeRoll)this)._owner).transform; ((BraveBehaviour)((BraveBehaviour)tornadoAnimator).sprite).transform.position = ((CustomDodgeRoll)this)._owner.SpriteBottomCenter; ((BraveBehaviour)tornadoAnimator).sprite.usesOverrideMaterial = true; ((BraveBehaviour)tornadoAnimator).renderer.SetAlpha(0f); float totalTime = 0f; float curSpinSpeed = 0f; float tornadoCurAlpha = 0f; forcedDirection = ((GameActor)((CustomDodgeRoll)this)._owner).FacingDirection; ((CustomDodgeRoll)this)._owner.m_overrideGunAngle = forcedDirection; _ = ((BraveBehaviour)((CustomDodgeRoll)this)._owner).transform.position; rollDamageModifier = ((StatType)21).Mult(1f); ((CustomDodgeRoll)this)._owner.ownerlessStatModifiers.Add(rollDamageModifier); speedModifier = ((StatType)0).Mult(1f); ((CustomDodgeRoll)this)._owner.ownerlessStatModifiers.Add(speedModifier); isSpeedModActive = true; isRollModActive = true; ((CustomDodgeRoll)this)._owner.stats.RecalculateStats(((CustomDodgeRoll)this)._owner, false, false); float chargePercent = 0f; while (((CustomDodgeRoll)this)._dodgeButtonHeld) { if (((GameActor)((CustomDodgeRoll)this)._owner).IsFalling || tookDamageDuringDodgeRoll) { yield break; } totalTime += BraveTime.DeltaTime; chargePercent = Mathf.Min(1f, totalTime / 3f); curSpinSpeed = 720f + 1440f * (chargePercent * chargePercent); UpdateForcedDirection(forcedDirection + curSpinSpeed * BraveTime.DeltaTime); speedModifier.amount = 1f - chargePercent * chargePercent; ((CustomDodgeRoll)this)._owner.stats.RecalculateStats(((CustomDodgeRoll)this)._owner, false, false); if (Random.Range(0f, 100f) < 10f) { float num = forcedDirection; float num2 = Random.Range(0f, 360f); float num3 = Random.Range(0.3f, 1.25f); SpawnManager.SpawnVFX(dusts.rollLandDustup, Vector2.op_Implicit(((GameActor)((CustomDodgeRoll)this)._owner).CenterPosition - BraveMathCollege.DegreesToVector(num, num3)), Quaternion.Euler(0f, 0f, num2)); } if (chargePercent >= 0.4f) { tornadoCurAlpha = 0.5f * (chargePercent - 0.4f) / 0.6f; ((BraveBehaviour)((BraveBehaviour)tornadoAnimator).sprite).transform.position = ((CustomDodgeRoll)this)._owner.SpriteBottomCenter; ((BraveBehaviour)tornadoAnimator).renderer.SetAlpha(tornadoCurAlpha); } ExtinguishFire(); yield return null; } ((CustomDodgeRoll)this)._owner.ownerlessStatModifiers.Remove(speedModifier); isSpeedModActive = false; ((CustomDodgeRoll)this)._owner.stats.RecalculateStats(((CustomDodgeRoll)this)._owner, false, false); _grounded = false; reflectingProjectiles = chargePercent >= 0.4f; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)((CustomDodgeRoll)this)._owner).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(BounceAwayEnemies)); SpeculativeRigidbody specRigidbody2 = ((BraveBehaviour)((CustomDodgeRoll)this)._owner).specRigidbody; specRigidbody2.OnCollision = (Action)Delegate.Combine(specRigidbody2.OnCollision, new Action(BounceOffWalls)); ((BraveBehaviour)((CustomDodgeRoll)this)._owner).healthHaver.IsVulnerable = false; float dash_speed = minDashSpeed + chargePercent * (maxDashSpeed - minDashSpeed); float dash_time = 1f + chargePercent * 3f; targetVelocity = dash_speed * ((TwoAxisInputControl)instanceForPlayer.ActiveActions.Move).Value; float timer; for (timer = 0f; timer < dash_time; timer += BraveTime.DeltaTime) { if (((GameActor)((CustomDodgeRoll)this)._owner).IsFalling || tookDamageDuringDodgeRoll) { yield break; } UpdateForcedDirection(forcedDirection + curSpinSpeed * BraveTime.DeltaTime); if (useDriftMechanics) { Vector2 val = 60f * BraveTime.DeltaTime * ((TwoAxisInputControl)instanceForPlayer.ActiveActions.Move).Value; targetVelocity += val; if (((Vector2)(ref targetVelocity)).magnitude > dash_speed) { targetVelocity = dash_speed * ((Vector2)(ref targetVelocity)).normalized; } } else { float num4 = 180f * BraveTime.DeltaTime; float num5 = Vector2Extensions.ToAngle(targetVelocity); float num6 = BraveMathCollege.ClampAngle180(((GameActor)((CustomDodgeRoll)this)._owner).FacingDirection - num5); if (Mathf.Abs(num6) <= num4) { targetVelocity = BraveMathCollege.DegreesToVector(((GameActor)((CustomDodgeRoll)this)._owner).FacingDirection, dash_speed); } else { targetVelocity = BraveMathCollege.DegreesToVector(num5 + Mathf.Sign(num6) * num4, dash_speed); } } targetVelocity *= 0.99f; ((BraveBehaviour)((CustomDodgeRoll)this)._owner).specRigidbody.Velocity = targetVelocity; if (Random.Range(0f, 100f) < 10f) { float num7 = forcedDirection; float num8 = Random.Range(0f, 360f); float num9 = Random.Range(0.3f, 1.25f); SpawnManager.SpawnVFX(dusts.rollLandDustup, Vector2.op_Implicit(((GameActor)((CustomDodgeRoll)this)._owner).CenterPosition - BraveMathCollege.DegreesToVector(num7, num9)), Quaternion.Euler(0f, 0f, num8)); } ((BraveBehaviour)((BraveBehaviour)tornadoAnimator).sprite).transform.position = ((CustomDodgeRoll)this)._owner.SpriteBottomCenter; ExtinguishFire(); yield return null; } SpeculativeRigidbody specRigidbody3 = ((BraveBehaviour)((CustomDodgeRoll)this)._owner).specRigidbody; specRigidbody3.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Remove((Delegate?)(object)specRigidbody3.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(BounceAwayEnemies)); SpeculativeRigidbody specRigidbody4 = ((BraveBehaviour)((CustomDodgeRoll)this)._owner).specRigidbody; specRigidbody4.OnCollision = (Action)Delegate.Remove(specRigidbody4.OnCollision, new Action(BounceOffWalls)); ((BraveBehaviour)((CustomDodgeRoll)this)._owner).healthHaver.IsVulnerable = true; reflectingProjectiles = false; ((CustomDodgeRoll)this)._owner.ownerlessStatModifiers.Remove(rollDamageModifier); isRollModActive = false; ((CustomDodgeRoll)this)._owner.stats.RecalculateStats(((CustomDodgeRoll)this)._owner, false, false); _grounded = true; if (((CustomDodgeRoll)this)._owner.HasSynergy(Synergy.PERFECTLY_BALANCED) || !(chargePercent >= 0.4f)) { yield break; } ((CustomDodgeRoll)this)._owner.SetInputOverride("gyrostumble"); ((CustomDodgeRoll)this)._owner.ToggleGunRenderers(false, "gyrostumble"); ((CustomDodgeRoll)this)._owner.ToggleHandRenderers(false, "gyrostumble"); ((BraveBehaviour)((CustomDodgeRoll)this)._owner).spriteAnimator.Stop(); ((CustomDodgeRoll)this)._owner.QueueSpecificAnimation(((BraveBehaviour)((CustomDodgeRoll)this)._owner).spriteAnimator.GetClipByName("spinfall").name); ((BraveBehaviour)((CustomDodgeRoll)this)._owner).spriteAnimator.SetFrame(0, false); ((Component)((CustomDodgeRoll)this)._owner).gameObject.Play("Play_Fall"); timer = 0.65f; for (float timer2 = timer; timer2 > 0f; timer2 -= BraveTime.DeltaTime) { if (tookDamageDuringDodgeRoll) { yield break; } ((BraveBehaviour)tornadoAnimator).renderer.SetAlpha(tornadoCurAlpha * (timer2 / timer)); ((BraveBehaviour)((BraveBehaviour)tornadoAnimator).sprite).transform.position = Vector2.op_Implicit(((BraveBehaviour)((CustomDodgeRoll)this)._owner).sprite.WorldBottomCenter); targetVelocity *= 0.9f; ((BraveBehaviour)((CustomDodgeRoll)this)._owner).specRigidbody.Velocity = targetVelocity; yield return null; } Object.Destroy((Object)(object)tornadoVFX); ((BraveBehaviour)((CustomDodgeRoll)this)._owner).spriteAnimator.Stop(); if (!(chargePercent >= 0.75f)) { yield break; } string baseDodgeAnimationName = Lazy.GetBaseDodgeAnimationName(((CustomDodgeRoll)this)._owner, ((BraveBehaviour)((CustomDodgeRoll)this)._owner).specRigidbody.Velocity); stumbleClip = ((BraveBehaviour)((CustomDodgeRoll)this)._owner).spriteAnimator.GetClipByName(baseDodgeAnimationName); ((CustomDodgeRoll)this)._owner.QueueSpecificAnimation(stumbleClip.name); ((BraveBehaviour)((CustomDodgeRoll)this)._owner).spriteAnimator.SetFrame(0, false); ((BraveBehaviour)((CustomDodgeRoll)this)._owner).spriteAnimator.ClipFps = 24f; wasFrameInvulnerable = new List(); tk2dSpriteAnimationFrame[] frames = stumbleClip.frames; foreach (tk2dSpriteAnimationFrame val2 in frames) { wasFrameInvulnerable.Add(val2.invulnerableFrame); val2.invulnerableFrame = false; } ((BraveBehaviour)((CustomDodgeRoll)this)._owner).sprite.FlipX = Mathf.Abs(Vector2Extensions.ToAngle(((BraveBehaviour)((CustomDodgeRoll)this)._owner).specRigidbody.Velocity)) > 90f; 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(); for (float timer2 = 0f; timer2 < 1.25f; timer2 += BraveTime.DeltaTime) { if (tookDamageDuringDodgeRoll) { break; } ((BraveBehaviour)((CustomDodgeRoll)this)._owner).specRigidbody.Velocity = Vector2.zero; if (((BraveBehaviour)((CustomDodgeRoll)this)._owner).spriteAnimator.CurrentFrame > 3) { ((BraveBehaviour)((CustomDodgeRoll)this)._owner).spriteAnimator.Stop(); } yield return null; } } 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 { 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.Remove(_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) { Color? startColor = Color.blue; while (Object.op_Implicit((Object)(object)s)) { Vector3 val = Vector2Extensions.ToVector3ZisY(s.HitboxPixelCollider.UnitBottomLeft, 0f); Vector3 val2 = Vector2Extensions.ToVector3ZisY(s.HitboxPixelCollider.UnitTopRight, 0f); Color? val3 = startColor; float? num = 0.5f; GlobalSparksDoer.DoRadialParticleBurst(1, val, val2, 15f, 2.25f, 1f, (float?)null, num, val3, (SparksType)8); if (once) { break; } yield return null; } } 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 VengefulSpirit : CwaffPassive { private class VengefulDamage : DamageAdjuster { public VengefulSpirit spirit; protected override float AdjustDamage(float currentDamage, Projectile proj, AIActor enemy) { if (!Object.op_Implicit((Object)(object)enemy) || !Object.op_Implicit((Object)(object)spirit) || string.IsNullOrEmpty(enemy.EnemyGuid) || !spirit.vengeantNames.Contains(enemy.GetActorName())) { return currentDamage; } return currentDamage * 2f; } } public static string ItemName = "Vengeful Spirit"; public static string ShortDescription = "D:<"; public static string LongDescription = "Deal double damage to any enemy type that has ever injured you."; public static string Lore = "Revenge is often said to be a dish best served cold, but those who make that claim have no idea what they're talking about. First off, revenge isn't a dish, it's not even edible. Second, and more importantly, a nice hot homecooked plate of revenge sounds much better than some frozen bag of revenge you can get at any supermarket."; public List vengeantNames = new List(); 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)4; } public override void Pickup(PlayerController player) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown base.Pickup(player); player.PostProcessProjectile += PostProcessProjectile; HealthHaverExt obj = EnemyTools.Ext(((BraveBehaviour)player).healthHaver); obj.OnDamagedContext = (OnDamagedContextDelegate)Delegate.Combine((Delegate?)(object)obj.OnDamagedContext, (Delegate?)new OnDamagedContextDelegate(OnDamagedContext)); } private void OnDamagedContext(HealthHaver hh, float damage, string source, float resultValue, float maxValue, CoreDamageTypes damageTypes, DamageCategory damageCategory, Vector2 damageDirection, bool ignoreInvulnerabilityFrames, bool ignoreDamageCaps) { vengeantNames.AddUnique(source); } public override void DisableEffect(PlayerController player) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { player.PostProcessProjectile -= PostProcessProjectile; HealthHaverExt obj = EnemyTools.Ext(((BraveBehaviour)player).healthHaver); obj.OnDamagedContext = (OnDamagedContextDelegate)Delegate.Remove((Delegate?)(object)obj.OnDamagedContext, (Delegate?)new OnDamagedContextDelegate(OnDamagedContext)); } } private void PostProcessProjectile(Projectile proj, float effectChanceScalar) { if (!Object.op_Implicit((Object)(object)((Component)proj).gameObject.GetComponent())) { ((Component)proj).gameObject.AddComponent().spirit = this; } } public override void MidGameSerialize(List data) { ((PickupObject)this).MidGameSerialize(data); data.Add(vengeantNames.Count); foreach (string vengeantName in vengeantNames) { data.Add(vengeantName); } } public override void MidGameDeserialize(List data) { ((PassiveItem)this).MidGameDeserialize(data); int num = 0; int num2 = (int)data[num++]; for (int i = 0; i < num2; i++) { vengeantNames.Add((string)data[num++]); } } } 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 || isReinforcement) && !(__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_0083: 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_007a: 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, spawnFarFromPlayer: true)) ?? 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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) { SpeculativeRigidbody specRigidbody = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreRigidbodyCollision)); } } private void SetupUltraFortunesFavor() { if (!Object.op_Implicit((Object)(object)_uff)) { _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 = true; ((BraveBehaviour)((BehaviorBase)this).m_aiActor).RegenerateCache(); } } private void DismissUltraFortunesFavor() { if (Object.op_Implicit((Object)(object)_uff)) { if (_uff.m_bulletBlocker != null) { ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.PixelColliders.Remove(_uff.m_bulletBlocker); } if (_uff.m_beamReflector != null) { ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.PixelColliders.Remove(_uff.m_beamReflector); } Object.Destroy((Object)(object)_uff); _uff = null; ((BraveBehaviour)((BehaviorBase)this).m_aiActor).RegenerateCache(); } } 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; } DismissUltraFortunesFavor(); } private AIActor FindNearbyBulletKin() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) foreach (AIActor allNearbyEnemy in ((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition.GetAllNearbyEnemies(16f, ignoreWalls: true, includeDead: false, includeGone: false, includeInvulnerable: true)) { if (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_0034: 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) base.TickMovement(ref voluntaryVel, ref involuntaryVel); if (_state != State.BARK) { DismissUltraFortunesFavor(); } 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_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) _allowPathing = true; ResetState(); PlayerController owner = m_companionController.m_owner; if (owner == null) { return; } FollowOwner(); if (!owner.IsInCombat) { return; } ReadOnlyCollection allNearbyEnemies = ((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition.GetAllNearbyEnemies(16f); 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_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_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: 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_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) 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) { SetupUltraFortunesFavor(); } 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; } } } } private struct ActorPosData { public AIActor actor; public float sqrDistance; public float angle; public Vector2 ipoint; public ActorPosData(AIActor actor, float sqrDistance, float angle = 0f, Vector2 ipoint = default(Vector2)) { //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) this.actor = actor; this.sqrDistance = sqrDistance; this.angle = angle; this.ipoint = ipoint; } } 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 int _CurrentGunClips = 0; internal static int _MaxGunClips = 0; internal static Dictionary _SoundTimers = new Dictionary(); private static readonly uint[] _PlayingIds = new uint[16]; private static Projectile _NullProjectilePrefab = null; private static List _InternalNearbyEnemies = new List(); private static readonly ReadOnlyCollection _ReadOnlyEnemies = new ReadOnlyCollection(_InternalNearbyEnemies); private static readonly List _ActorDistances = new List(); private static List _TempEnemiesInSight = new List(); private static List _TempEnemies = 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; private static GameObject _ScorchMark = null; private static readonly int _IgnoreLaunchCollisions = CollisionMask.LayerToMask((CollisionLayer)4, (CollisionLayer)0, (CollisionLayer)1, (CollisionLayer)5); [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_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0266: 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(); } ((Object)(object)val2).name = text2; Databases.Items.SetupItem((PickupObject)(object)val2, itemName); ((Object)(object)val2).name = text; 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 PrepareAnimationLibraries() { tk2dSpriteAnimation library = ((BraveBehaviour)((Component)ItemHelper.Get(Items.PeaShooter)).gameObject.GetComponent()).spriteAnimator.Library; _CurrentGunClips = library.clips.Length; _MaxGunClips = _CurrentGunClips + 1000; Array.Resize(ref library.clips, _MaxGunClips); } public static void FinalizeAnimationLibraries() { Array.Resize(ref ((BraveBehaviour)((Component)ItemHelper.Get(Items.PeaShooter)).gameObject.GetComponent()).spriteAnimator.Library.clips, _CurrentGunClips); } 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, (NotificationColor)(((??)color) ?? 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 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_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) return magnitude * (360f * Random.value).ToVector(); } public static Quaternion RandomEulerZ() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) return Quaternion.Euler(0f, 0f, 360f * Random.value); } public static bool CoinFlip() { return Random.value < 0.5f; } 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_006d: Expected O, but got Unknown //IL_008e: 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_0095: 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_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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00bb: 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_00dc: Unknown result type (might be due to invalid IL or missing references) GetCollectionAndIdForBestIdleAnimation(enemy, out var spriteCol, out var spriteId); tk2dSpriteDefinition val = spriteCol.spriteDefinitions[spriteId]; 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 text, GameObject val, float value) { _SoundTimers[text] = value; val.Play(text); while ((Object)(object)val != (Object)null && _SoundTimers[text] > 0f) { _SoundTimers[text] -= BraveTime.DeltaTime; yield return null; } val.Play(text + "_stop_all"); _SoundTimers.Remove(text); } } 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 Projectile NoProjectile() { //IL_02b4: 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, 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_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) AllEnemiesInLineOfSightInternal(ref _InternalNearbyEnemies, out var _, start, end, canBeNeutral, accountForWalls, sort: false, stopAfterFindingOne: true); return _InternalNearbyEnemies.Count > 0; } public static AIActor NearestEnemyInLineOfSight(out Vector2 ipoint, Vector2 start, Vector2 end, bool canBeNeutral = true, bool accountForWalls = false) { //IL_0006: 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) AllEnemiesInLineOfSightInternal(ref _InternalNearbyEnemies, out ipoint, start, end, canBeNeutral, accountForWalls, sort: true); if (_InternalNearbyEnemies.Count <= 0) { return null; } return _InternalNearbyEnemies[0]; } public static AIActor NearestEnemyInLineOfSight(Vector2 start, Vector2 end, bool canBeNeutral = true, bool accountForWalls = false) { //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) AllEnemiesInLineOfSightInternal(ref _InternalNearbyEnemies, out var _, start, end, canBeNeutral, accountForWalls, sort: true); if (_InternalNearbyEnemies.Count <= 0) { return null; } return _InternalNearbyEnemies[0]; } public static ReadOnlyCollection AllEnemiesInLineOfSight(this Gun gun, bool canBeNeutral = true, bool accountForWalls = false, bool sort = false) { //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_0015: 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_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_002f: Unknown result type (might be due to invalid IL or missing references) Vector2 val = Vector3Extensions.XY(((Component)gun.barrelOffset).transform.position); AllEnemiesInLineOfSightInternal(ref _InternalNearbyEnemies, out var _, val, val + gun.CurrentAngle.ToVector(100f), canBeNeutral, accountForWalls, sort); return _ReadOnlyEnemies; } public static AIActor NearestEnemy(Vector2 start, float maxDistance = -1f, bool ignoreWalls = false) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return start.NearestEnemyWithinConeOfVision(0f, 360f, maxDistance, useNearestAngleInsteadOfDistance: false, ignoreWalls); } public static ReadOnlyCollection GetAllNearbyEnemies(this Vector2 center, float radius = 100f, bool ignoreWalls = true, bool includeDead = false, bool includeGone = false, bool includeInvulnerable = false, bool limitToCurrentRoom = true, bool includeHarmless = false) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) GetAllNearbyEnemiesInternal(ref _InternalNearbyEnemies, center, radius, ignoreWalls, includeDead, includeGone, includeInvulnerable, limitToCurrentRoom, includeHarmless); return _ReadOnlyEnemies; } public static AIActor NearestEnemyWithinConeOfVision(this Vector2 start, float coneAngle, float maxDeviation = 360f, float maxDistance = 100f, bool useNearestAngleInsteadOfDistance = true, bool ignoreWalls = false, bool includeInvulnerable = true) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) _ActorDistances.Clear(); foreach (ActorPosData item in AllEnemiesWithinConeOfVisionInternal(start, coneAngle, maxDeviation, maxDistance, ignoreWalls, includeInvulnerable)) { _ActorDistances.Add(item); } if (_ActorDistances.Count != 0) { return _ActorDistances.GetMinimum(useNearestAngleInsteadOfDistance ? ((Func)((ActorPosData a, ActorPosData b) => a.angle < b.angle)) : ((Func)((ActorPosData a, ActorPosData b) => a.sqrDistance < b.sqrDistance))).actor; } return null; } public static IEnumerable AllEnemiesWithinConeOfVision(this Vector2 start, float coneAngle, float maxDeviation = 360f, float maxDistance = 100f, bool ignoreWalls = false, bool includeInvulnerable = true) { //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) foreach (ActorPosData item in AllEnemiesWithinConeOfVisionInternal(start, coneAngle, maxDeviation, maxDistance, ignoreWalls, includeInvulnerable)) { yield return item.actor; } } private static IEnumerable AllEnemiesWithinConeOfVisionInternal(Vector2 start, float coneAngle, float maxDeviation, float maxDistance = 100f, bool ignoreWalls = false, bool includeInvulnerable = true) { //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) GetAllNearbyEnemiesInternal(ref _InternalNearbyEnemies, start, maxDistance, ignoreWalls, includeDead: false, includeGone: false, includeInvulnerable); foreach (AIActor internalNearbyEnemy in _InternalNearbyEnemies) { Vector2 val = ((GameActor)internalNearbyEnemy).CenterPosition - start; float num = Mathf.Abs((coneAngle - Vector2Extensions.ToAngle(val).Clamp360()).Clamp180()); if (num <= maxDeviation) { yield return new ActorPosData(internalNearbyEnemy, ((Vector2)(ref val)).sqrMagnitude, num); } } } private static void AllEnemiesInLineOfSightInternal(ref List enemies, out Vector2 ipoint, Vector2 start, Vector2 end, bool canBeNeutral = true, bool accountForWalls = false, bool sort = false, bool stopAfterFindingOne = false) { //IL_0005: 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_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_0069: 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_008f: 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_00a3: 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) GetAllNearbyEnemiesInternal(ref _TempEnemiesInSight, start, 100f, !accountForWalls, includeDead: false, includeGone: false, includeInvulnerable: true); enemies.Clear(); _ActorDistances.Clear(); ipoint = default(Vector2); Vector2 val = default(Vector2); foreach (AIActor item in _TempEnemiesInSight) { if (!Object.op_Implicit((Object)(object)((BraveBehaviour)item).specRigidbody)) { continue; } PixelCollider hitboxPixelCollider = ((BraveBehaviour)item).specRigidbody.HitboxPixelCollider; if (BraveUtility.LineIntersectsAABB(start, end, hitboxPixelCollider.UnitBottomLeft, hitboxPixelCollider.UnitDimensions, ref val)) { if (stopAfterFindingOne) { enemies.Add(item); return; } List actorDistances = _ActorDistances; Vector2 val2 = val - start; actorDistances.Add(new ActorPosData(item, ((Vector2)(ref val2)).sqrMagnitude, 0f, val)); } } if (sort) { _ActorDistances.Sort((ActorPosData x, ActorPosData y) => x.sqrDistance.CompareTo(y.sqrDistance)); } foreach (ActorPosData actorDistance in _ActorDistances) { enemies.Add(actorDistance.actor); } if (_ActorDistances.Count > 0) { ipoint = _ActorDistances[0].ipoint; } } private static void GetAllNearbyEnemiesInternal(ref List enemies, Vector2 center, float radius = -1f, bool ignoreWalls = true, bool includeDead = false, bool includeGone = false, bool includeInvulnerable = false, bool limitToCurrentRoom = true, bool includeHarmless = false) { //IL_0068: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0120: 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_0123: 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_0137: 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) float num = radius * radius; enemies.Clear(); _TempEnemies.Clear(); if (!limitToCurrentRoom) { foreach (AIActor allEnemy in StaticReferenceManager.AllEnemies) { _TempEnemies.Add(allEnemy); } } else { Dungeon dungeon = GameManager.Instance.Dungeon; if (dungeon != null && dungeon.data != null) { RoomHandler absoluteRoom = Vector3Extensions.GetAbsoluteRoom(center); if (absoluteRoom != null) { absoluteRoom.GetActiveEnemies((ActiveEnemyType)0, ref _TempEnemies); } } } foreach (AIActor tempEnemy in _TempEnemies) { if (!Object.op_Implicit((Object)(object)tempEnemy) || !((Behaviour)tempEnemy).isActiveAndEnabled || (!includeGone && ((GameActor)tempEnemy).IsGone) || (!includeHarmless && !tempEnemy.IsHostile(canBeDead: false, canBeNeutral: true))) { continue; } HealthHaver healthHaver = ((BraveBehaviour)tempEnemy).healthHaver; if ((!includeDead && (!Object.op_Implicit((Object)(object)healthHaver) || healthHaver.IsDead)) || (!includeInvulnerable && (!Object.op_Implicit((Object)(object)healthHaver) || !healthHaver.IsVulnerable || healthHaver.PreventAllDamage))) { 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 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 PickupObject GetModdedItem(string itemName) { return Game.Items.GetSafe(itemName); } 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 void GetCollectionAndIdForBestIdleAnimation(AIActor enemy, out tk2dSpriteCollectionData spriteCol, out int spriteId) { //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) { spriteCol = clipByName.frames[0].spriteCollection; spriteId = clipByName.frames[0].spriteId; return; } } } spriteCol = ((BraveBehaviour)enemy).sprite.collection; tk2dSpriteDefinition[] spriteDefinitions = spriteCol.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; } } } spriteId = ((num2 >= 0) ? num2 : spriteCol.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(); } [Conditional("DEBUG")] 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); } [Conditional("DEBUG")] public static void PrintOwnerlessStats(PlayerController player) { foreach (StatModifier ownerlessStatModifier in player.ownerlessStatModifiers) { _ = 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 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) { GetCollectionAndIdForBestIdleAnimation(EnemyDatabase.GetOrLoadByGuid(guid), out var spriteCol, out var spriteId); tk2dSpriteDefinition val = spriteCol.spriteDefinitions[spriteId]; 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) { for (float lifeleft = time; lifeleft > 0f; lifeleft -= BraveTime.DeltaTime) { if (shrink) { Vector2 worldCenter = ((BraveBehaviour)debris).sprite.WorldCenter; ((BraveBehaviour)debris).sprite.scale = lifeleft / time * Vector3.one; ((BraveBehaviour)debris).sprite.PlaceAtScaledPositionByAnchor(Vector2.op_Implicit(worldCenter), (Anchor)4); } else { ((BraveBehaviour)((BraveBehaviour)debris).sprite).renderer.SetAlpha(lifeleft / time); } yield return null; } Object.Destroy((Object)(object)((Component)debris).gameObject); } 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 tk2dMeshSprite2, float num3, float num2 = 0f, float num6 = -1f, bool flag = false, float num = 0f, float num5 = -1f, Func func = null, Func func2 = null, Func func3 = null, string text = null, float num4 = 0f) { if (func == null) { func = Ease.OutQuad; } if (func2 == null) { func2 = Ease.OutQuad; } if (func3 == null) { func3 = Ease.OutQuad; } Material mat = ((BraveBehaviour)tk2dMeshSprite2).renderer.material; mat.shader = CwaffShaders.ShatterShader; mat.SetFloat("_Emission", num); mat.SetFloat("_Progressive", flag ? 1f : 0f); mat.SetFloat("_Amplitude", num2); mat.SetFloat("_RandomSeed", Random.value); if ((Object)(object)tk2dMeshSprite2.optionalPalette != (Object)null) { mat.SetFloat("_UsePalette", 1f); mat.SetTexture("_PaletteTex", (Texture)(object)tk2dMeshSprite2.optionalPalette); } bool playedSound = text == null; for (float elapsed = 0f; elapsed < num3; elapsed += BraveTime.DeltaTime) { if (!playedSound && elapsed >= num4) { ((Component)tk2dMeshSprite2).gameObject.Play(text); playedSound = true; } float arg = elapsed / num3; mat.SetFloat(CwaffVFX._FadeId, func3(arg)); if (num5 >= 0f) { mat.SetFloat("_Emission", Mathf.Lerp(num, num5, func(arg))); } if (num6 >= 0f) { mat.SetFloat("_Amplitude", Mathf.Lerp(num2, num6, func2(arg))); } yield return null; } Object.Destroy((Object)(object)((Component)tk2dMeshSprite2).gameObject); } } 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 RegisterEasyRATPlaceable(this GameObject placeableObject, string guid) { DungeonPlaceable value = BreakableAPIToolbox.GenerateDungeonPlaceable(new Dictionary { { placeableObject, 1f } }, 1, 1, (DungeonPrerequisite[])null); StaticReferences.StoredDungeonPlaceables.Add(guid, value); StaticReferences.customPlaceables.Add("cg:" + guid, value); return placeableObject; } 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_003d: 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) if ((Object)(object)_ScorchMark == (Object)null) { _ScorchMark = ((Component)Explosions.EmergencyCrate.effect.transform.Find("scorch")).gameObject.ClonePrefab(); } GameObjectExtensions.SetLayerRecursively(Object.Instantiate(_ScorchMark, Vector2.op_Implicit(pos), Quaternion.identity), LayerMask.NameToLayer("BG_Critical")); } public static float SquareDistanceToNearestActivePlayer(Vector2 pos) { //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_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) float num = float.MaxValue; PlayerController[] allPlayers = GameManager.Instance.AllPlayers; foreach (PlayerController val in allPlayers) { if (Object.op_Implicit((Object)(object)val)) { Vector2 val2 = ((GameActor)val).CenterPosition - pos; float sqrMagnitude = ((Vector2)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; } } } return num; } public static IntVector2? RandomCellForEnemySpawn(this AIActor enemyPrefab, RoomHandler room, bool spawnFarFromPlayer = false, IntVector2? targetCenter = null, int? overrideClearance = null, float minDist = 4f, float maxDist = 20f) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_006d: 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 (room == null) { return null; } int xClearance = overrideClearance ?? 2; int yClearance = overrideClearance ?? 2; float minSqrDist = minDist * minDist; float maxSqrDist = maxDist * maxDist; CellValidator val = (CellValidator)delegate(IntVector2 c) { //IL_000a: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00aa: 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_0080: Unknown result type (might be due to invalid IL or missing references) if (spawnFarFromPlayer && SquareDistanceToNearestActivePlayer(((IntVector2)(ref c)).ToVector2()) < 64f) { return false; } for (int i = 0; i < xClearance; i++) { for (int j = 0; j < yClearance; j++) { if (GameManager.Instance.Dungeon.data.isTopWall(c.x + i, c.y + j)) { return false; } if (targetCenter.HasValue) { if (minSqrDist > 0f && IntVector2.DistanceSquared(targetCenter.Value, c.x + i, c.y + j) < minSqrDist) { return false; } if (IntVector2.DistanceSquared(targetCenter.Value, c.x + i, c.y + j) > maxSqrDist) { return false; } } } } return true; }; return room.GetRandomAvailableCell((IntVector2?)new IntVector2(xClearance, yClearance), (CellTypes?)enemyPrefab.PathableTiles, false, val); } public static DirectionType AutoDetectDirectionFromSpriteName(string name) { if (!ResMap.Has(name + "_north_northeast")) { if (!ResMap.Has(name + "_northeast")) { if (!ResMap.Has(name + "_north")) { if (ResMap.Has(name + "_front_right")) { if (!ResMap.Has(name + "_right")) { if (!ResMap.Has(name + "_front")) { return (DirectionType)4; } return (DirectionType)5; } return (DirectionType)6; } if (!ResMap.Has(name + "_right")) { if (!ResMap.Has(name + "_front")) { if (!ResMap.Has(name)) { return (DirectionType)0; } return (DirectionType)1; } return (DirectionType)3; } return (DirectionType)2; } return (DirectionType)9; } return (DirectionType)10; } return (DirectionType)7; } public static bool AllRoomsVisited(bool includeSecretRooms = true, bool includeWarpRooms = true, bool onlyIncludeStandardRooms = false) { //IL_0053: 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_0094: Invalid comparison between Unknown and I4 //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Invalid comparison between Unknown and I4 if (!includeSecretRooms || !includeWarpRooms || onlyIncludeStandardRooms) { int count = GameManager.Instance.Dungeon.data.rooms.Count; for (int i = 0; i < count; i++) { RoomHandler val = GameManager.Instance.Dungeon.data.rooms[i]; if (!val.RevealedOnMap && (int)val.visibility == 0 && !Object.op_Implicit((Object)(object)val.OverrideTilemap) && (includeSecretRooms || !val.IsSecretRoom) && (includeWarpRooms || !val.IsStartOfWarpWing) && (!onlyIncludeStandardRooms || val.IsStandardRoom || (int)val.area.PrototypeRoomCategory == 5 || (int)val.area.PrototypeRoomCategory == 4)) { return false; } } } return true; } public static string GetPlayerCharacterName(PlayerController player) { //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected I4, but got Unknown PlayableCharacters characterIdentity = player.characterIdentity; switch ((int)characterIdentity) { case 1: return ((Component)GameUIRoot.Instance).GetComponent().GetValue("#CHAR_CONVICT_SHORT"); case 6: return ((Component)GameUIRoot.Instance).GetComponent().GetValue("#CHAR_GUIDE_SHORT"); case 5: return ((Component)GameUIRoot.Instance).GetComponent().GetValue("#CHAR_MARINE_SHORT"); case 0: return ((Component)GameUIRoot.Instance).GetComponent().GetValue("#CHAR_ROGUE_SHORT"); case 7: return ((Component)GameUIRoot.Instance).GetComponent().GetValue("#CHAR_CULTIST_SHORT"); case 2: return ((Component)GameUIRoot.Instance).GetComponent().GetValue("#CHAR_ROBOT_SHORT"); case 8: return ((Component)GameUIRoot.Instance).GetComponent().GetValue("#CHAR_BULLET_SHORT"); case 9: return ((Component)GameUIRoot.Instance).GetComponent().GetValue("#CHAR_PARADOX_SHORT"); case 10: return ((Component)GameUIRoot.Instance).GetComponent().GetValue("#CHAR_GUNSLINGER_SHORT"); default: { CustomCharacter component = ((Component)player).gameObject.GetComponent(); if (component != null) { return component.data.nameShort.Replace("_", ""); } return ((Object)player).name.Replace("_", ""); } } } public static void LaunchAllEnemiesAroundPoint(float damage, float force, Vector2 shockwaveCenter, float minRange, float maxRange, float horizontalForce, float flipPotency = 1f, float potencyAtMaxRange = 1f) { //IL_000a: 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_0036: 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_00bb: Unknown result type (might be due to invalid IL or missing references) float num = minRange * minRange; float num2 = maxRange * maxRange; foreach (AIActor allNearbyEnemy in shockwaveCenter.GetAllNearbyEnemies(maxRange, ignoreWalls: true, includeDead: false, includeGone: false, includeInvulnerable: true, limitToCurrentRoom: false)) { Vector2 val = ((GameActor)allNearbyEnemy).CenterPosition - shockwaveCenter; float sqrMagnitude = ((Vector2)(ref val)).sqrMagnitude; HealthHaver healthHaver = ((BraveBehaviour)allNearbyEnemy).healthHaver; if (healthHaver != null && !(sqrMagnitude < num)) { float num3 = 1f - (1f - potencyAtMaxRange) * Mathf.InverseLerp(num, num2, sqrMagnitude); BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)allNearbyEnemy).behaviorSpeculator; if (behaviorSpeculator == null || behaviorSpeculator.ImmuneToStun || healthHaver.IsBoss || healthHaver.IsSubboss) { ((BraveBehaviour)allNearbyEnemy).healthHaver.ApplyDamage(num3 * damage, Vector2.zero, "Uppies! :D", (CoreDamageTypes)0, (DamageCategory)2, false, (PixelCollider)null, false); } else { ((MonoBehaviour)allNearbyEnemy).StartCoroutine(LaunchTime(allNearbyEnemy, shockwaveCenter, num3 * damage, num3 * force, num3 * horizontalForce, num3 > flipPotency)); } } } static IEnumerator LaunchTime(AIActor enemy, Vector2 center, float num6, float num5, float num4, bool doFlips) { //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) int originalLayer = ((Component)enemy).gameObject.layer; GameObjectExtensions.SetLayerRecursively(((Component)enemy).gameObject, LayerMask.NameToLayer("Unoccluded")); if (Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).behaviorSpeculator)) { ((BraveBehaviour)enemy).behaviorSpeculator.Stun(3f, false); } if (Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).healthHaver)) { ((BraveBehaviour)enemy).healthHaver.vulnerable = false; } Vector2 val2; if (Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).knockbackDoer)) { if (num4 > 0f) { ((Component)enemy).gameObject.AddComponent().knockbackCap = 50f; KnockbackDoer knockbackDoer = ((BraveBehaviour)enemy).knockbackDoer; val2 = ((GameActor)enemy).CenterPosition - center; knockbackDoer.ApplyKnockback(((Vector2)(ref val2)).normalized, num4, true); } else { ((BraveBehaviour)enemy).knockbackDoer.SetImmobile(true, "Uppies! :D"); } } SpeculativeRigidbody body = ((BraveBehaviour)enemy).specRigidbody; body.AddCollisionLayerIgnoreOverride(_IgnoreLaunchCollisions); enemy.ToggleRenderers(false); tk2dSprite tempSprite = body.DecoupleSpriteFromCollider(); if (Object.op_Implicit((Object)(object)enemy.optionalPalette)) { tempSprite.SetOptionalPalette(enemy.optionalPalette); } GameObjectExtensions.SetLayerRecursively(((Component)tempSprite).gameObject, LayerMask.NameToLayer("Unoccluded")); float launchSpeed = num5; float yOffset = 0f; float angle = 0f; Transform t = ((BraveBehaviour)tempSprite).transform; Vector2 centerOfGravity = body.UnitCenter - Vector3Extensions.XY(t.position); _ = body.UnitBottomCenter; Vector2 val3 = default(Vector2); while (true) { float deltaTime = BraveTime.DeltaTime; launchSpeed -= 60f * deltaTime; yOffset += launchSpeed * deltaTime; if (yOffset < 0f) { break; } ((Vector2)(ref val3))..ctor(body.UnitCenter.x, body.UnitBottomCenter.y + yOffset); if (doFlips) { angle += 1440f * deltaTime; } Quaternion val4 = Quaternion.Euler(0f, 0f, angle); Vector2 val5 = Vector3Extensions.XY(val4 * Vector2.op_Implicit(centerOfGravity)); t.position = Vector2.op_Implicit(val3 - val5); t.rotation = val4; yield return null; } ((BraveBehaviour)((BraveBehaviour)enemy).sprite).renderer.enabled = true; body.RemoveCollisionLayerIgnoreOverride(_IgnoreLaunchCollisions); enemy.ToggleRenderers(true); Object.Destroy((Object)(object)((Component)tempSprite).gameObject); GameObjectExtensions.SetLayerRecursively(((Component)enemy).gameObject, originalLayer); if (Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).healthHaver)) { ((BraveBehaviour)enemy).healthHaver.vulnerable = true; HealthHaver healthHaver2 = ((BraveBehaviour)enemy).healthHaver; val2 = ((GameActor)enemy).CenterPosition - center; healthHaver2.ApplyDamage(num6, ((Vector2)(ref val2)).normalized, "Uppies! :D", (CoreDamageTypes)0, (DamageCategory)2, false, (PixelCollider)null, false); } if (num4 <= 0f && Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).knockbackDoer)) { ((BraveBehaviour)enemy).knockbackDoer.SetImmobile(false, "Uppies! :D"); } if (Object.op_Implicit((Object)(object)body)) { body.CollideWithOthers = true; } } } } 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; } } 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; internal static GameObject _CommandObject = null; public static void Init() { if (!C.DEBUG_BUILD) { return; } 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("hh", (Action)delegate { EmissionTester.UpdateFromFile(); }); 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 sprite = ((BraveBehaviour)GameManager.Instance.PrimaryPlayer).sprite; SpriteOutlineManager.RemoveOutlineFromSprite(sprite, false); sprite.usesOverrideMaterial = true; Material material = ((BraveBehaviour)sprite).renderer.material; material.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); material.SetFloat(CwaffVFX._EmissivePowerId, num); material.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() { List rooms = GameManager.Instance.Dungeon.data.rooms; List enemiesToKill = new List(); for (int i = 0; i < rooms.Count; i++) { RoomHandler val = rooms[i]; if (val != null) { val.ClearReinforcementLayers(); val.GetActiveEnemies((ActiveEnemyType)0, ref enemiesToKill); for (int j = 0; j < enemiesToKill.Count; j++) { if (Object.op_Implicit((Object)(object)enemiesToKill[j])) { ((Behaviour)enemiesToKill[j]).enabled = true; } } yield return null; for (int k = 0; k < enemiesToKill.Count; k++) { if (Object.op_Implicit((Object)(object)enemiesToKill[k])) { Object.Destroy((Object)(object)((Component)enemiesToKill[k]).gameObject); } } } } } } } 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 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 class SlimyboiManager : MonoBehaviour { private const float _SLIME_UNDER_TABLE_CHANCE = 0.33f; private static SlimyboiManager _Instance = null; private static Dictionary> _TrapMap = new Dictionary>(); private int _enemiesExplodedThisRoom; private HashSet _processedRooms; private List _allActiveSlimes; private List _enemyKillTimes; private ReadOnlyCollection _readOnlyActiveSlimes; public static bool HasInstance => Object.op_Implicit((Object)(object)_Instance); public static ReadOnlyCollection ActiveSlimes => _Instance._readOnlyActiveSlimes; public static void EnsureInstance() { if (!Object.op_Implicit((Object)(object)_Instance)) { _Instance = ((Component)GameManager.Instance).gameObject.AddComponent(); _Instance._enemiesExplodedThisRoom = 0; _Instance._processedRooms = new HashSet(); _Instance._allActiveSlimes = new List(); _Instance._enemyKillTimes = new List(); _Instance._readOnlyActiveSlimes = new ReadOnlyCollection(_Instance._allActiveSlimes); _TrapMap = new Dictionary>(); CwaffEvents.OnCleanStart = (Action)Delegate.Remove(CwaffEvents.OnCleanStart, new Action(OnCleanStart)); CwaffEvents.OnCleanStart = (Action)Delegate.Combine(CwaffEvents.OnCleanStart, new Action(OnCleanStart)); CwaffEvents.OnChangedRooms = (Action)Delegate.Remove(CwaffEvents.OnChangedRooms, new Action(OnChangedRooms)); CwaffEvents.OnChangedRooms = (Action)Delegate.Combine(CwaffEvents.OnChangedRooms, new Action(OnChangedRooms)); CwaffEvents.OnFloorEnded = (Action)Delegate.Remove(CwaffEvents.OnFloorEnded, new Action(OnFloorEnded)); CwaffEvents.OnFloorEnded = (Action)Delegate.Combine(CwaffEvents.OnFloorEnded, new Action(OnFloorEnded)); } } internal static void ForceDestroy() { if (Object.op_Implicit((Object)(object)_Instance)) { Object.Destroy((Object)(object)_Instance); } _Instance = null; } private static void OnCleanStart() { ForceDestroy(); } public static void RegisterSlime(SlimyboiController sloim) { if (Object.op_Implicit((Object)(object)_Instance)) { _Instance._allActiveSlimes.Add(sloim); } } public static void DeregisterSlime(SlimyboiController sloim) { if (Object.op_Implicit((Object)(object)_Instance)) { _Instance._allActiveSlimes.Remove(sloim); } } public static bool AnyActiveSlimes() { if (Object.op_Implicit((Object)(object)_Instance)) { return _Instance._allActiveSlimes.Count > 0; } return false; } public static int NumActiveSlimes() { if (!Object.op_Implicit((Object)(object)_Instance)) { return 0; } return _Instance._allActiveSlimes.Count; } private static void OnFloorEnded() { _TrapMap.Clear(); if (Object.op_Implicit((Object)(object)_Instance)) { _Instance._processedRooms.Clear(); } } internal static void DebugSlimeSpawn() { SpawnSingleSlime(SlimyboiType.Pink); } internal static void RegisterTrap(TrapController trap, RoomHandler room) { if (room != null && Object.op_Implicit((Object)(object)trap)) { if (!_TrapMap.TryGetValue(room, out var value) || value == null) { List list = (_TrapMap[room] = new List()); value = list; } value.Add(trap); if (room.area != null && (Object)(object)room.area.prototypeRoom != (Object)null) { _ = ((Object)room.area.prototypeRoom).name; } } } private static void SpawnSingleSlime(SlimyboiType sloim, RoomHandler room = null, IntVector2? spawnPos = null, PlayerController player = null) { //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_0016: 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_00ad: 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_00a4: Unknown result type (might be due to invalid IL or missing references) if (room == null && spawnPos.HasValue) { IntVector2 value = spawnPos.Value; room = Vector3Extensions.GetAbsoluteRoom(((IntVector2)(ref value)).ToVector2()); } if (room == null) { room = (Object.op_Implicit((Object)(object)player) ? player : GameManager.Instance.BestActivePlayer).CurrentRoom; } AIActor prefab = sloim.Data().prefab; AIActor obj = AIActor.Spawn(prefab, (IntVector2)(((??)spawnPos) ?? ((??)prefab.RandomCellForEnemySpawn(room)) ?? Vector2Extensions.ToIntVector2(((GameActor)(Object.op_Implicit((Object)(object)player) ? player : GameManager.Instance.BestActivePlayer)).CenterPosition, (VectorConversions)2)), room, true, (AwakenAnimationType)2, true); obj.SpawnInInstantly(); ((Component)obj).gameObject.GetComponent().HandleRoomSpawn(); } private static IEnumerator SpawnSlimesEnumerator(List slimes, PlayerController player = null, RoomHandler room = null, Vector2? spawnPos = null) { if (!Object.op_Implicit((Object)(object)_Instance) || slimes == null || slimes.Count == 0) { yield break; } if (room == null && spawnPos.HasValue) { room = Vector3Extensions.GetAbsoluteRoom(spawnPos.Value); } if (room == null) { room = (Object.op_Implicit((Object)(object)player) ? player : GameManager.Instance.BestActivePlayer).CurrentRoom; } bool centeredSpawn = spawnPos.HasValue && room != null; IntVector2 spawnCenter = (IntVector2)(spawnPos.HasValue ? Vector2Extensions.ToIntVector2(spawnPos.Value, (VectorConversions)2) : default(IntVector2)); foreach (SlimyboiType slime in slimes) { if (centeredSpawn) { IntVector2? val = slime.Data().prefab.RandomCellForEnemySpawn(room, spawnFarFromPlayer: false, spawnCenter, null, 0f, 4f); if (val.HasValue) { IntVector2 valueOrDefault = val.GetValueOrDefault(); SpawnSingleSlime(slime, room, valueOrDefault); goto IL_019b; } } SpawnSingleSlime(slime, room); goto IL_019b; IL_019b: yield return (object)new WaitForSeconds(0.3f); } slimes.Clear(); } private static void SpawnSlimes(List slimes, PlayerController player = null, RoomHandler room = null, Vector2? pos = null) { if (Object.op_Implicit((Object)(object)_Instance) && !GameManager.Instance.IsFoyer) { ((MonoBehaviour)_Instance).StartCoroutine(SpawnSlimesEnumerator(slimes, player, room, pos)); } } private static List DetermineRoomSlimesToSpawn(PlayerController player, RoomHandler room, bool wasCombatEncounter) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Invalid comparison between Unknown and I4 //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Invalid comparison between Unknown and I4 List list = new List(); if (!wasCombatEncounter) { if ((int)room.area.PrototypeRoomCategory == 6) { list.AddMultiple(SlimyboiType.Quantum, 2); } else if ((int)room.area.PrototypeRoomCategory == 4) { int num = 1; foreach (IPlayerInteractable roomInteractable in room.GetRoomInteractables()) { Chest val = (Chest)(object)((roomInteractable is Chest) ? roomInteractable : null); if (val != null && Object.op_Implicit((Object)(object)val) && !val.IsBroken) { num = Mathf.Max(num, val.EstimateValue()); } } list.AddMultiple(SlimyboiType.Phosphor, num); } else if (room.IsShop) { bool flag = false; foreach (BaseShopController allShop in StaticReferenceManager.AllShops) { if (allShop.m_room == room && allShop.IsMainShopkeep) { flag = true; } } list.AddMultiple(SlimyboiType.Tabby, flag ? 4 : 2); } } float pitCoverage = room.GetPitCoverage(); int nonSpikeTraps; int num2 = CountSpikeTraps(room, out nonSpikeTraps); _ = list.Count; if (pitCoverage > 0f) { list.Add(SlimyboiType.Dervish); } if (pitCoverage > 0.2f) { list.Add(SlimyboiType.Dervish); } if (num2 > 0) { list.AddMultiple(SlimyboiType.Crystal, Mathf.CeilToInt((float)(num2 + 1) / 5f)); } if (nonSpikeTraps > 0) { list.AddMultiple(SlimyboiType.Honey, Mathf.CeilToInt((float)nonSpikeTraps / 10f)); } if (!wasCombatEncounter) { return list; } if ((int)room.area.PrototypeRoomCategory == 3) { list.Add(SlimyboiType.Gold); if (!room.PlayerHasTakenDamageInThisRoom) { list.Add(SlimyboiType.Gold); } } for (int num3 = _Instance._enemyKillTimes.Count - 1; num3 >= 2; num3--) { if (!(_Instance._enemyKillTimes[num3] - _Instance._enemyKillTimes[num3 - 2] > 1f)) { list.Add(SlimyboiType.Quicksilver); break; } } _Instance._enemyKillTimes.Clear(); if (_Instance._enemiesExplodedThisRoom > 0) { list.AddMultiple(SlimyboiType.Boom, _Instance._enemiesExplodedThisRoom); _Instance._enemiesExplodedThisRoom = 0; } int num4 = 1; if ((Object)(object)room.area.prototypeRoom != (Object)null && room.area.prototypeRoom.additionalObjectLayers != null) { num4 += room.area.prototypeRoom.additionalObjectLayers.Count; } if (!room.PlayerHasTakenDamageInThisRoom) { num4++; } for (int i = 0; i < num4; i++) { list.Add(SlimyboiType.Pink); } return list; } private static int CountSpikeTraps(RoomHandler room, out int nonSpikeTraps) { nonSpikeTraps = 0; if (!Object.op_Implicit((Object)(object)_Instance) || room == null || !_TrapMap.TryGetValue(room, out var value)) { return 0; } int num = 0; foreach (TrapController item in value) { BasicTrapController val = (BasicTrapController)(object)((item is BasicTrapController) ? item : null); if (val != null && ((TrapController)val).TrapSwitchState == "spikes") { num++; } else if (item is PathingTrapController) { string name = ((Object)((Component)item).gameObject).name; if (name.Contains("sawblade")) { num += 2; } else if (name.Contains("spinning_log")) { num += 5; } else { nonSpikeTraps++; } } else { nonSpikeTraps++; } } return num; } private static void HandleSlimeSpawns(PlayerController player, RoomHandler room, bool combatEnded) { if (Object.op_Implicit((Object)(object)_Instance) && room != null && room.area != null && !_Instance._processedRooms.Contains(room) && !GameManager.Instance.IsFoyer && (combatEnded || !room.IsUnclearedCombatRoom())) { _Instance._processedRooms.Add(room); List list = DetermineRoomSlimesToSpawn(player, room, combatEnded); if (Random.value < 0.005f) { list.Add(SlimyboiType.Glitch); } SpawnSlimes(list, player, room); } } public static void OnCombatRoomClear(PlayerController player) { HandleSlimeSpawns(player, player.CurrentRoom, combatEnded: true); } public static void OnChangedRooms(PlayerController player, RoomHandler oldRoom, RoomHandler newRoom) { HandleSlimeSpawns(player, newRoom, combatEnded: false); } public static void OnKeyCollected(KeyBulletPickup key, PlayerController player) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) SpawnSlimes(new List(2) { SlimyboiType.Hunter, SlimyboiType.Hunter }, player, null, ((GameActor)player).CenterPosition); } public static void OnBlankCollected(SilencerItem blank, PlayerController player) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) SpawnSlimes(new List(1) { SlimyboiType.Tangle }, player, null, ((GameActor)player).CenterPosition); } public static void OnAnyHealthHaverDie(HealthHaver hh) { AIActor aiActor = ((BraveBehaviour)hh).aiActor; if (aiActor != null && !Object.op_Implicit((Object)(object)((Component)aiActor).gameObject.GetComponent())) { _Instance._enemyKillTimes.Add(BraveTime.ScaledTimeSinceStartup); if (hh.lastIncurredDamageSource == StringTableManager.GetEnemiesString("#EXPLOSION", -1)) { _Instance._enemiesExplodedThisRoom++; } } } public static void OnAnyPlayerCollectedHealth(HealthPickup health, PlayerController player) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (health.armorAmount > 0) { SpawnSlimes(new List(2) { SlimyboiType.Rock, SlimyboiType.Rock }, player, null, ((GameActor)player).CenterPosition); } } public static void OnWillPickUpCurrency(PlayerController player, CurrencyPickup currency) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (currency.IsMetaCurrency) { return; } int num = 0; for (int num2 = currency.currencyValue; num2 > 0; num2--) { if (Random.value <= 0.01f) { num++; } } if (num > 0) { SpawnSlimes(Enumerable.Repeat(SlimyboiType.Lucky, num).ToList(), player, null, ((GameActor)player).CenterPosition); } } public static void HandleTableFlip(FlippableCover table) { //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) if (Object.op_Implicit((Object)(object)_Instance) && !(Random.value > 0.33f)) { SpawnSlimes(new List(1) { SlimyboiType.Saber }, null, null, Vector2.op_Implicit(((BraveBehaviour)table).transform.position)); } } public static void HandleBrazierFlip(BrazierController brazier) { //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) SpawnSlimes(new List(1) { SlimyboiType.Fire }, null, null, Vector2.op_Implicit(((BraveBehaviour)brazier).transform.position)); } public static void OnMinorBreakableShattered(MinorBreakable breakable) { //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_009b: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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) if (!Object.op_Implicit((Object)(object)_Instance) || !breakable.goopsOnBreak) { return; } GoopDefinition goopType = breakable.goopType; if (goopType != null) { if (goopType.AppliesDamageOverTime) { SpawnSlimes(new List(4) { SlimyboiType.Rad, SlimyboiType.Rad, SlimyboiType.Rad, SlimyboiType.Rad }, null, null, Vector2.op_Implicit(((BraveBehaviour)breakable).transform.position)); } else if (goopType.UsesGreenFire) { SpawnSlimes(new List(4) { SlimyboiType.Fire, SlimyboiType.Fire, SlimyboiType.Rad, SlimyboiType.Rad }, null, null, Vector2.op_Implicit(((BraveBehaviour)breakable).transform.position)); } else if (goopType.isOily) { SpawnSlimes(new List(4) { SlimyboiType.Fire, SlimyboiType.Fire, SlimyboiType.Fire, SlimyboiType.Fire }, null, null, Vector2.op_Implicit(((BraveBehaviour)breakable).transform.position)); } else if (goopType.CanBeElectrified || goopType.CanBeFrozen) { SpawnSlimes(new List(4) { SlimyboiType.Puddle, SlimyboiType.Puddle, SlimyboiType.Puddle, SlimyboiType.Puddle }, null, null, Vector2.op_Implicit(((BraveBehaviour)breakable).transform.position)); } } } public static void OnWillPickUpAnyPassive(PlayerController player, PickupObject pickup) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) IounStoneOrbitalItem val = (IounStoneOrbitalItem)(object)((pickup is IounStoneOrbitalItem) ? pickup : null); if (val != null && !((PassiveItem)val).m_pickedUpThisRun && (((PlayerOrbitalItem)val).BreaksUponContact || ((PlayerOrbitalItem)val).BreaksUponOwnerDamage)) { SpawnSlimes(new List(1) { SlimyboiType.Mosaic }, player, null, ((GameActor)player).CenterPosition); } } } [HarmonyPatch] internal static class SlimyboiPatches { private static bool _NextAttackIgnoresDamageCaps = false; private static SpeculativeRigidbody[] _IgnoredBodiesPlusSlimes = (SpeculativeRigidbody[])(object)new SpeculativeRigidbody[0]; private static Vector2 _PreAdjustCameraPos = default(Vector2); private static void SlimyboiControllerIgnoreDamageCaps(AIActor actor) { if (Object.op_Implicit((Object)(object)actor) && Object.op_Implicit((Object)(object)((Component)actor).gameObject.GetComponent())) { _NextAttackIgnoresDamageCaps = true; } } [HarmonyPatch(typeof(HealthHaver), "ApplyDamage")] [HarmonyPrefix] private static void HealthHaverApplyDamagePatch(HealthHaver __instance, float damage, Vector2 direction, string sourceName, CoreDamageTypes damageTypes, DamageCategory damageCategory, bool ignoreInvulnerabilityFrames, PixelCollider hitPixelCollider, ref bool ignoreDamageCaps) { if (_NextAttackIgnoresDamageCaps) { ignoreDamageCaps = true; } _NextAttackIgnoresDamageCaps = false; } [HarmonyPatch(typeof(AIActor), "OnCollision")] [HarmonyILManipulator] private static void AIActorOnCollisionPatchIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_006c: 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, "CollisionDamageTypes") }) && val.TryGotoNext((MoveType)0, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchCallvirt(instr, "ApplyDamage") })) { val.Emit(OpCodes.Ldarg_0); val.CallPrivate(typeof(SlimyboiPatches), "SlimyboiControllerIgnoreDamageCaps"); } } [HarmonyPatch(typeof(BeamController), "GetIgnoreRigidbodies")] [HarmonyPostfix] private static void BeamControllerGetIgnoreRigidbodiesPatch(BeamController __instance, ref SpeculativeRigidbody[] __result) { if (!SlimyboiManager.AnyActiveSlimes() || !(__instance.Owner is PlayerController)) { return; } int num = SlimyboiManager.NumActiveSlimes(); int num2 = __result.Length; int num3 = num + num2; if (num3 != _IgnoredBodiesPlusSlimes.Length) { _IgnoredBodiesPlusSlimes = (SpeculativeRigidbody[])(object)new SpeculativeRigidbody[num3]; } int i; for (i = 0; i < num2; i++) { _IgnoredBodiesPlusSlimes[i] = __result[i]; } foreach (SlimyboiController activeSlime in SlimyboiManager.ActiveSlimes) { _IgnoredBodiesPlusSlimes[i++] = (Object.op_Implicit((Object)(object)activeSlime) ? ((BraveBehaviour)activeSlime).specRigidbody : null); } __result = _IgnoredBodiesPlusSlimes; } [HarmonyPatch(typeof(PathingTrapController), "Start")] [HarmonyPostfix] private static void PathingTrapControllerStartPatch(PathingTrapController __instance) { SlimyboiManager.RegisterTrap((TrapController)(object)__instance, __instance.m_parentRoom); } [HarmonyPatch(typeof(BasicTrapController), "Start")] [HarmonyPostfix] private static void BasicTrapControllerStartPatch(BasicTrapController __instance) { SlimyboiManager.RegisterTrap((TrapController)(object)__instance, __instance.m_parentRoom); } [HarmonyPatch(typeof(FlippableCover), "Flip", new Type[] { typeof(Direction) })] [HarmonyPostfix] private static void FlippableCoverFlipPatch(FlippableCover __instance, Direction flipDirection) { SlimyboiManager.HandleTableFlip(__instance); } [HarmonyPatch(typeof(BulletKingToadieController), "PreRigidbodyCollision")] [HarmonyPostfix] private static void BulletKingToadieControllerPreRigidbodyCollisionPatch(BulletKingToadieController __instance, SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { if (Object.op_Implicit((Object)(object)((Component)otherRigidbody).gameObject.GetComponent())) { PhysicsEngine.SkipCollision = false; } } [HarmonyPatch(typeof(DemonWallMovementBehavior), "Update")] [HarmonyPrefix] private static void DemonWallMovementBehaviorUpdatePrefixPatch(DemonWallMovementBehavior __instance) { //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) if (SlimyboiManager.HasInstance && !(((BehaviorBase)__instance).m_deltaTime <= 0f)) { DemonWallController demonWallController = __instance.m_demonWallController; if (demonWallController != null && demonWallController.IsCameraLocked) { _PreAdjustCameraPos = Vector2.op_Implicit(GameManager.Instance.MainCameraController.OverridePosition); } } } [HarmonyPatch(typeof(DemonWallMovementBehavior), "Update")] [HarmonyPostfix] private static void DemonWallMovementBehaviorUpdatePostfixPatch(DemonWallMovementBehavior __instance) { //IL_0044: 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_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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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) if (SlimyboiManager.HasInstance && !(((BehaviorBase)__instance).m_deltaTime <= 0f)) { DemonWallController demonWallController = __instance.m_demonWallController; if (demonWallController != null && demonWallController.IsCameraLocked) { CameraController mainCameraController = GameManager.Instance.MainCameraController; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0f, ((BraveBehaviour)demonWallController).specRigidbody.HitboxPixelCollider.UnitDimensions.y - mainCameraController.Camera.orthographicSize + 0.5f); mainCameraController.OverridePosition = Vector2.op_Implicit(Lazy.SmoothestLerp(_PreAdjustCameraPos, ((BraveBehaviour)demonWallController).specRigidbody.UnitCenter + val, 2f)); } } } [HarmonyPatch(typeof(BrazierController), "Interact")] [HarmonyPostfix] private static void BrazierControllerInteractPatch(BrazierController __instance, PlayerController interactor) { SlimyboiManager.HandleBrazierFlip(__instance); } } public class Rancher { public static string Name = "Beatrix"; public static string InternalName = "Rancher"; public static readonly PlayableCharacters Character = InternalName.ExtendEnum("cg"); private static Dictionary _AnimFPS = new Dictionary { { "death", 8f }, { "death_coop", 8f }, { "death_shot", 8f }, { "dodge", 18f }, { "dodge_bw", 18f }, { "dodge_left", 24f }, { "dodge_left_bw", 24f }, { "ghost_idle_back", 9f }, { "ghost_idle_back_left", 9f }, { "ghost_idle_back_right", 9f }, { "ghost_idle_front", 9f }, { "ghost_idle_left", 9f }, { "ghost_idle_right", 9f }, { "ghost_sneeze_left", 12f }, { "ghost_sneeze_right", 12f }, { "idle", 9f }, { "idle_select", 9f }, { "idle_backward", 9f }, { "idle_backward_hand", 9f }, { "idle_backward_twohands", 9f }, { "idle_bw", 9f }, { "idle_bw_hand", 9f }, { "idle_bw_twohands", 9f }, { "idle_forward", 9f }, { "idle_forward_hand", 9f }, { "idle_forward_twohands", 9f }, { "idle_hand", 9f }, { "idle_twohands", 9f }, { "item_get", 9f }, { "jetpack_down", 9f }, { "jetpack_right", 9f }, { "jetpack_right_bw", 9f }, { "jetpack_up", 9f }, { "pet", 9f }, { "pitfall_return", 9f }, { "run_down", 11f }, { "run_down_hand", 11f }, { "run_down_twohands", 11f }, { "run_right", 11f }, { "run_right_bw", 11f }, { "run_right_bw_hand", 11f }, { "run_right_bw_twohands", 11f }, { "run_right_hand", 11f }, { "run_right_twohands", 11f }, { "run_up", 11f }, { "run_up_hand", 11f }, { "run_up_twohands", 11f }, { "select_choose", 12f }, { "select_idle", 9f }, { "slide_down", 8f }, { "slide_right", 8f }, { "slide_up", 8f }, { "spinfall", 12f } }; public static void Init() { //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_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_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_0026: 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_003c: 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_0052: 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_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_009f: 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_00ae: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_0139: Unknown result type (might be due to invalid IL or missing references) Slimybois.Init(); Vacpack.Init(); PortableHydroTurret.Init(); CustomCharacterData data = new CustomCharacterData { baseCharacter = (PlayableCharacters)2, identity = Character, name = Name, nameShort = InternalName, nickname = InternalName, health = 3f, armor = 0f, foyerPos = new Vector3(27.25f, 19.75f), 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 i.phases = (CharacterSelectIdlePhase[])(object)new CharacterSelectIdlePhase[2] { new CharacterSelectIdlePhase { inAnimation = "select_slime", holdMin = 0f, holdMax = 0f }, new CharacterSelectIdlePhase { inAnimation = "select_run", holdMin = 2f, holdMax = 4f } }; }, allowDuplicates: false), stats = new Dictionary { { (StatType)1, 0.5f }, { (StatType)25, 0.5f }, { (StatType)10, 2f }, { (StatType)2, 2f } } }; PlayerController val = data.MakeNewCustomCharacter(); val.ForceHandless = false; val.gunAttachPoint.localPosition = new Vector3(0.5f, 0.5f, 0f); val.InitAnimations(data, _AnimFPS, new List(5) { "select_stargaze", "select_casing", "select_stargaze_cry", "select_headspin", "spinfall" }).AddOrReplaceAnimation("doorway", "rancher_doorway", 10, 8).AddOrReplaceAnimation("spinfall", "rancher_spinfall", 16, 0) .AddOrReplaceAnimation("select_slime", "rancher_select_slime", 11, 0) .AddOrReplaceAnimation("select_run", "rancher_select_run", 16, 0) .SetAudio("dodge", "Play_Leap", default(int)) .SetAudio("dodge_bw", "Play_Leap", default(int)) .SetAudio("dodge_left", "Play_Leap", default(int)) .SetAudio("dodge_left_bw", "Play_Leap", default(int)) .SetAudio("dodge", "Play_Roll", 4) .SetAudio("dodge_bw", "Play_Roll", 4) .SetAudio("dodge_left", "Play_Roll", 4) .SetAudio("dodge_left_bw", "Play_Roll", 4) .SetAudio("pitfall", "Play_Fall", default(int)) .SetAudio("pitfall_down", "Play_Fall", default(int)) .SetAudio("pitfall_return", "Play_Respawn", default(int)) .SetAudio("pet", "Play_CHR_fool_voice_01", 1); HatUtility.SetupHatOffsets(val, 0, -6, 0, -11); HatUtility.AddHatOffset(val, "rancher_run_side_002", 0, 1, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rancher_run_side_003", 0, 1, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rancher_run_side_005", 1, 1, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rancher_run_side_006", 1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rancher_run_bw_002", 0, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rancher_run_bw_003", 0, 1, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rancher_run_bw_005", 1, 0, (int?)null, (int?)null); HatUtility.AddHatOffset(val, "rancher_run_bw_006", 1, 1, (int?)null, (int?)null); } } public static class Slimybois { internal const float _DEFAULT_COOLDOWN = 2f; internal const int _BASE_HEALTH = 6; internal const float _BASE_DAMAGE = 0.6f; internal const float _BASE_ATTACK_RANGE = 3f; internal const float _BASE_ATTACK_KB = 5f; internal const float _BASE_WEIGHT = 40f; internal const float _BASE_SPEED = 4.5f; public static readonly int NumSlimes = Enum.GetNames(typeof(SlimyboiType)).Length; public static SlimeData[] SlimeData = null; public static string[] SlimeBlurbs = null; public static GameObject SlimeParticleSystem = null; internal static GameObject _SlimeDeathVFX; internal static GameObject _SlimeImpactVFX; internal static GameObject _SlimeExplodeImpactVFX; internal static tk2dSpriteAnimationClip _SlimeVineVFX; internal static GameActorEffect _SlimePoisonEffect; internal static GameActorEffect _SlimeFireEffect; internal static GameActorEffect _SlimeSlowEffect; public static readonly List[] RawSlimeBlurbs = new List[20] { new List(5) { "[w]Found...Somewhere", "[g]Attacks Inflict Fire, Poison, and Slow", "[g]5x Health", "[g]Immune to Status Effects", "[b]0.5x Move Speed" }, new List(4) { "[w]Found under Tables", "[g]1.5x Attack Speed", "[g]1.5x Attack Damage", "[b]0.75x Move Speed" }, new List(2) { "[w]Found near Normal Enemies", "[g]Is Pink :)" }, new List(3) { "[w]Found near Traps", "[g]Attacks Inflict Slow", "[b]0.5x Move Speed" }, new List(4) { "[w]Found in Poison Barrels", "[g]Attacks Inflict Poison", "[g]Immune to Poison", "[g]Grants Poison Immunity to Nearby Slimes" }, new List(3) { "[w]Attracted by Blanks", "[g]Destroys Nearby Projectiles with Vines", "[g]2x Health" }, new List(4) { "[w]Attracted by Keys", "[g]Will Attempt to Dodge Projectiles", "[g]2x Move Speed", "[g]1.5x Attack Speed" }, new List(4) { "[w]Attracted by Explosions", "[g]Explodes on Death", "[g]4x Attack Damage", "[b]Explosions Damage Nearby Slimes" }, new List(7) { "[w]Attracted by Armor", "[g]Immune to Projectiles", "[g]Immune to Fire", "[g]5x Health", "[b]2x Weight", "[b]0.5x Attack Speed", "[b]0.5x Move Speed" }, new List(5) { "[w]Found in Hidden Rooms", "[g]Immune to All Damage", "[g]Can Fly", "[b]Perishes In 20 Seconds Unless Vacuumed", "[b]Cannot be Healed" }, new List(7) { "[w]Found in Treasure Rooms", "[g]Heals a Nearby Slime by 1HP Every 0.33 Seconds", "[g]Can Fly", "[g]Immune to Status Effects", "[g]3x Health", "[b]Cannot be Healed", "[b]0.33x Damage" }, new List(4) { "[w]Attracted by Glass", "[g]Attacks Restore 5HP to a Nearby Slime", "[g]3x Health", "[g]2x Attack Speed" }, new List(5) { "[w]Found near Pits", "[g]Can Fly", "[g]Grants Flight to Nearby Slimes", "[g]2x Move Speed", "[b]0.5x Attack Damage" }, new List(6) { "[w]Found in Shops", "[g]Follows the Player When Not in Combat", "[g]Can Always Be Vacuumed", "[g]2x Health", "[g]2x Attack Speed", "[b]0.5x Attack Damage" }, new List(3) { "[w]Attracted by Currency", "[g]Attacked Enemies Drop an Extra Casing", "[g]2x Health" }, new List(6) { "[w]Found in Ice and Water Barrels", "[g]Enemy Projectiles Restore Health", "[g]Immune to Fire", "[g]2x Health", "[b]Passively Loses Health", "[b]Cannot Be Healed" }, new List(5) { "[w]Attracted by Speed", "[g]Can Fly", "[g]2.5x Move Speed", "[g]4x Attack Speed", "[b]0.5x Health" }, new List(4) { "[w]Found in Braziers and Oil Barrels", "[g]Attacks Inflict Fire", "[g]Immune to Fire", "[g]Grants Fire Immunity to Nearby Slimes" }, new List(5) { "[w]Found near Strong Enemies", "[g]Grants Invulnerability to Nearby Slimes", "[b]Cannot Become Invulnerable", "[b]Cannot Be Healed", "[b]1 Health Point" }, new List(5) { "[w]Found near Spikes", "[g]Reflects Enemy Bullets", "[g]Immune to Spike Rollers", "[b]Cannot Move While in Combat", "[b]4x Weight" } }; public static void Init() { //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_006b: 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_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_00f6: 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_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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: 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_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_071f: Unknown result type (might be due to invalid IL or missing references) //IL_07a9: Unknown result type (might be due to invalid IL or missing references) SlimeData = new SlimeData[NumSlimes]; SlimeData.SetupEntry(new SlimeData { type = SlimyboiType.Quicksilver, overrideAttackCooldown = 0.5f, overrideSpeed = 11.25f, goopColor = Color.white }); SlimeData.SetupEntry(new SlimeData { type = SlimyboiType.Dervish, flags = SlimyboiFlags.CanFly, goopColor = Color.gray, overrideSpeed = 9f, overrideContactDamage = 0.3f }); SlimeData.SetupEntry(new SlimeData { type = SlimyboiType.Phosphor, flags = (SlimyboiFlags.CanFly | SlimyboiFlags.FireImmunity | SlimyboiFlags.PoisonImmunity | SlimyboiFlags.FullStatusImmunity | SlimyboiFlags.CantReceiveHealing), goopColor = Color.cyan, overrideContactDamage = 0.2f, overrideHealth = 18 }); SlimeData.SetupEntry(new SlimeData { type = SlimyboiType.Pink, goopColor = Color.magenta }); SlimeData.SetupEntry(new SlimeData { type = SlimyboiType.Hunter, flags = SlimyboiFlags.DodgesProjectiles }); SlimeData.SetupEntry(new SlimeData { type = SlimyboiType.Rad, goopColor = ExtendedColours.lime, flags = (SlimyboiFlags.PoisonImmunity | SlimyboiFlags.AttacksPoison) }); SlimeData.SetupEntry(new SlimeData { type = SlimyboiType.Fire, goopColor = Color.red, flags = (SlimyboiFlags.FireImmunity | SlimyboiFlags.AttacksIgnite) }); SlimeData.SetupEntry(new SlimeData { type = SlimyboiType.Crystal, goopColor = Color.blue, overrideWeight = 160f, flags = (SlimyboiFlags.ImmobileInCombat | SlimyboiFlags.ImmuneToMovingTraps | SlimyboiFlags.ReflectsProjectiles) }); SlimeData.SetupEntry(new SlimeData { type = SlimyboiType.Tangle, goopColor = Color.green, overrideHealth = 12 }); SlimeData.SetupEntry(new SlimeData { type = SlimyboiType.Rock, goopColor = ExtendedColours.darkBrown, overrideHealth = 30, overrideSpeed = 2.25f, overrideAttackCooldown = 4f, overrideWeight = 80f, flags = (SlimyboiFlags.FireImmunity | SlimyboiFlags.ProjectileImmunity) }); SlimeData.SetupEntry(new SlimeData { type = SlimyboiType.Saber, goopColor = ExtendedColours.brown, overrideSpeed = 3.375f, overrideAttackCooldown = 1.3333334f, overrideContactDamage = 0.90000004f }); SlimeData.SetupEntry(new SlimeData { type = SlimyboiType.Honey, goopColor = Color.yellow, overrideSpeed = 2.25f, flags = SlimyboiFlags.AttacksSlow }); SlimeData.SetupEntry(new SlimeData { type = SlimyboiType.Boom, goopColor = ExtendedColours.vibrantOrange, flags = (SlimyboiFlags.ExplodesOnDeath | SlimyboiFlags.ExplosiveAttacks), overrideContactDamage = 2.4f }); SlimeData.SetupEntry(new SlimeData { type = SlimyboiType.Puddle, goopColor = ExtendedColours.skyblue, flags = (SlimyboiFlags.FireImmunity | SlimyboiFlags.AbsorbsBullets | SlimyboiFlags.PassiveHealthDrain | SlimyboiFlags.CantReceiveHealing) }); SlimeData.SetupEntry(new SlimeData { type = SlimyboiType.Quantum, goopColor = Color.white, flags = (SlimyboiFlags.CanFly | SlimyboiFlags.FireImmunity | SlimyboiFlags.PoisonImmunity | SlimyboiFlags.QuantumInstability | SlimyboiFlags.FullStatusImmunity | SlimyboiFlags.PassiveHealthDrain | SlimyboiFlags.CantReceiveHealing) }); SlimeData.SetupEntry(new SlimeData { type = SlimyboiType.Tabby, goopColor = Color.white, flags = (SlimyboiFlags.FollowPlayer | SlimyboiFlags.CanAlwaysVac), overrideHealth = 12, overrideContactDamage = 0.3f, overrideAttackCooldown = 1f }); SlimeData.SetupEntry(new SlimeData { type = SlimyboiType.Gold, goopColor = ExtendedColours.paleYellow, flags = (SlimyboiFlags.CanFly | SlimyboiFlags.CantReceiveHealing), overrideHealth = 1 }); SlimeData.SetupEntry(new SlimeData { type = SlimyboiType.Lucky, goopColor = Color.white, overrideHealth = 12, flags = SlimyboiFlags.ExtraCasingOnKill }); SlimeData.SetupEntry(new SlimeData { type = SlimyboiType.Mosaic, goopColor = ExtendedColours.pink, flags = SlimyboiFlags.AttacksHealAllies, overrideHealth = 18, overrideAttackCooldown = 1f }); SlimeData.SetupEntry(new SlimeData { type = SlimyboiType.Glitch, goopColor = Color.black, flags = (SlimyboiFlags.FireImmunity | SlimyboiFlags.PoisonImmunity | SlimyboiFlags.AttacksPoison | SlimyboiFlags.AttacksIgnite | SlimyboiFlags.FullStatusImmunity | SlimyboiFlags.AttacksSlow), overrideHealth = 30 }); foreach (SlimyboiType value in Enum.GetValues(typeof(SlimyboiType))) { if (SlimeData[(int)value] == null) { SlimeData.SetupEntry(new SlimeData { type = value }); } } SlimeBlurbs = new string[NumSlimes]; for (int i = 0; i < NumSlimes; i++) { SlimeBlurbs[i] = ProcessSlimeBlurb(RawSlimeBlurbs[i]); } _SlimeImpactVFX = VFX.Create("slime_impact_vfx", 60f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); ((tk2dBaseSprite)(object)_SlimeImpactVFX.GetComponent()).MakeGlowyBetter(5f, glowColorPower: 5f, glowColor: Color.white); _SlimeExplodeImpactVFX = VFX.Create("slime_explode_impact_vfx", 30f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); ((tk2dBaseSprite)(object)_SlimeExplodeImpactVFX.GetComponent()).MakeGlowyBetter(15f, glowColorPower: 5f, glowColor: Color.white); _SlimeDeathVFX = VFX.Create("slime_death_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); ((tk2dBaseSprite)(object)_SlimeDeathVFX.GetComponent()).MakeGlowyBetter(100f, glowColorPower: 100f, glowColor: Color.white); _SlimeVineVFX = VFX.Create("slime_vine_vfx", 20f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1).DefaultAnimation(); SlimeParticleSystem = MakeSlimeParticleSystem(Color.white); _SlimePoisonEffect = (GameActorEffect)(object)((Component)ItemHelper.Get(Items.IrradiatedLead)).GetComponent().HealthModifierEffect; _SlimeFireEffect = (GameActorEffect)(object)((Component)ItemHelper.Get(Items.HotLead)).GetComponent().FireModifierEffect; _SlimeSlowEffect = (GameActorEffect)(object)Items.TripleCrossbow.AsGun().DefaultModule.projectiles[0].speedEffect; } private static SlimeData Init(this SlimeData sd) { //IL_0073: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Expected O, but got Unknown //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(sd.slimeName)) { sd.slimeName = Enum.GetName(typeof(SlimyboiType), sd.type).ToLower(); } sd.fullName = ETGMod.ToTitleCaseInvariant(sd.slimeName) + " Slime"; AIActor val = ("Slime " + sd.slimeName).InitEnemy(sd.overrideHealth ?? 6, (string)null, (string)null, 12, (List)null, autoRigidBody: true, doCorpse: false, (IntVector2?)new IntVector2(16, 8), useUntrimmedBounds: true); val.procedurallyOutlined = false; val.MovementSpeed = sd.overrideSpeed ?? 4.5f; val.CollisionDamage = 0f; val.CollisionKnockbackStrength = 0f; if (sd.flags.IsSet(SlimyboiFlags.CanFly)) { val.PathableTiles = (CellTypes)(val.PathableTiles | 4); } if (sd.flags.IsSet(SlimyboiFlags.FullStatusImmunity)) { ((GameActor)val).ImmuneToAllEffects = true; } float num = sd.overrideAttackRange ?? 3f; BehaviorSpeculator component = ((Component)val).gameObject.GetComponent(); component.InstantFirstTick = true; component.OverrideBehaviors.Add((OverrideBehaviorBase)(object)new SlimyboiImmobileInCombatBehavior()); component.OverrideBehaviors.Add((OverrideBehaviorBase)(object)new SlimyboiDodgeBehavior()); component.TargetBehaviors.Add((TargetBehaviorBase)(object)new SlimyboiTargetingBehavior { Radius = 35f, LineOfSight = false, ObjectPermanence = false }); component.MovementBehaviors.Add((MovementBehaviorBase)(object)new SlimyboiSeekBehavior { StopWhenInRange = true, CustomMinRange = 1.75f, CustomRange = 2.75f, PathInterval = 0.5f }); if (sd.flags.IsSet(SlimyboiFlags.FollowPlayer)) { component.MovementBehaviors.Add((MovementBehaviorBase)(object)new SlimyboiFollowPlayerBehavior { PathInterval = 0.5f }); } component.MovementBehaviors.Add((MovementBehaviorBase)new MoveErraticallyBehavior { PathInterval = 0.5f, StayOnScreen = false, UseTargetsRoom = false, AvoidTarget = false }); component.AttackBehaviors.Add((AttackBehaviorBase)(object)new SlimyboiChargeBehavior { chargeDamage = (sd.overrideContactDamage ?? 0.6f), chargeKnockback = 5f, chargeSpeed = 30f, minRange = 0f, maxRange = num, Cooldown = (sd.overrideAttackCooldown ?? 2f), maxChargeDistance = num + 0.5f }); ((Component)val).gameObject.GetComponent().weight = sd.overrideWeight ?? 40f; ((Component)val).gameObject.GetComponent().facingType = (FacingType)2; DebrisObject val2 = BreakableAPIToolbox.GenerateDebrisObject("slime_debris", false, 1f, 2f, 0f, 0f, (tk2dSprite)null, 1f, (string)null, (GameObject)null, 1, true, (GoopDefinition)null, 1f); val2.decayOnBounce = 0.8f; val2.usesLifespan = true; ((BraveBehaviour)val2).sprite.MakeGlowyBetter(50f, Color.white, 100f, 0.5f, sd.goopColor); SlimyboiController slimyboiController = ((Component)val).gameObject.AddComponent(); slimyboiController.slimeType = sd.type; slimyboiController.attributes = sd.flags; sd.debris = ((Component)val2).gameObject; sd.prefab = val; return sd; } public static SlimeData Data(this SlimyboiType type) { return SlimeData[(int)type]; } public static void SetupEntry(this SlimeData[] slimeData, SlimeData sd) { slimeData[(int)sd.type] = sd.Init(); } public static bool IsSet(this SlimyboiFlags flags, SlimyboiFlags flag) { return (flags & flag) == flag; } public static bool Attribute(this SlimyboiController sloim, SlimyboiFlags flag) { return (sloim.attributes & flag) == flag; } public static string ProcessSlimeBlurb(string rawBlurb) { return rawBlurb.Replace("[b]", "[color #dd6666]").Replace("[g]", "[color #66dd66]").Replace("[w]", "[color #dddd66]") + "[/color]"; } public static string ProcessSlimeBlurb(List rawBlurb) { for (int i = 0; i < rawBlurb.Count; i++) { rawBlurb[i] = ProcessSlimeBlurb(rawBlurb[i]); } return string.Join("\n\n", rawBlurb.ToArray()); } private static GameObject MakeSlimeParticleSystem(Color particleColor) { //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_0065: 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_008f: 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) //IL_00bc: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_0147: 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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0151: 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_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Expected O, but got Unknown //IL_01d0: 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_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: 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) //IL_0201: 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_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: 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_023d: 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_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Expected O, but got Unknown //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Expected O, but got Unknown //IL_0423: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(((Component)Items.CombinedRifle.AsGun().alternateVolley.projectiles[0].projectiles[0]).GetComponent().ParticleSystemToSpawn).RegisterPrefab(); ParticleSystem component = val.GetComponent(); float num = 2f; MainModule main = component.main; ((MainModule)(ref main)).duration = 3600f; ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(1f); ((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(0.0625f); ((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)1; ((MainModule)(ref main)).startRotation = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).startRotation3D = false; ((MainModule)(ref main)).startRotationMultiplier = 0f; ((MainModule)(ref main)).maxParticles = 200; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(particleColor); ((MainModule)(ref main)).emitterVelocityMode = (ParticleSystemEmitterVelocityMode)0; ForceOverLifetimeModule forceOverLifetime = component.forceOverLifetime; ((ForceOverLifetimeModule)(ref forceOverLifetime)).enabled = false; VelocityOverLifetimeModule velocityOverLifetime = component.velocityOverLifetime; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)0; AnimationCurve val2 = new AnimationCurve(); val2.AddKey(0f, 1f); val2.AddKey(0.5f, 0.1f); val2.AddKey(1f, 0f); MinMaxCurve val3 = default(MinMaxCurve); ((MinMaxCurve)(ref val3))..ctor(40f, val2); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).z = val3; MinMaxCurve x = (((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = val3); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = x; float num2 = (((VelocityOverLifetimeModule)(ref velocityOverLifetime)).zMultiplier = 1f); float xMultiplier = (((VelocityOverLifetimeModule)(ref velocityOverLifetime)).yMultiplier = num2); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).xMultiplier = xMultiplier; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).yMultiplier = 0f; RotationOverLifetimeModule rotationOverLifetime = component.rotationOverLifetime; ((RotationOverLifetimeModule)(ref rotationOverLifetime)).enabled = false; RotationBySpeedModule rotationBySpeed = component.rotationBySpeed; ((RotationBySpeedModule)(ref rotationBySpeed)).enabled = false; Gradient val5 = new Gradient(); val5.SetKeys((GradientColorKey[])(object)new GradientColorKey[0], (GradientAlphaKey[])(object)new GradientAlphaKey[5] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(0.5f, 0.25f), new GradientAlphaKey(0.15f, 0.5f), new GradientAlphaKey(0.01f, 0.75f), new GradientAlphaKey(0.01f, 1f) }); ColorOverLifetimeModule colorOverLifetime = component.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val5); EmissionModule emission = component.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(42f); ParticleSystemRenderer component2 = val.GetComponent(); ((Renderer)component2).sortingLayerName = "Background"; ((Renderer)component2).material.SetFloat("_InvFade", 3f); ((Renderer)component2).material.SetFloat("_EmissionGain", 0.75f); ((Renderer)component2).material.SetColor("_EmissionColor", Color.white); ((Renderer)component2).material.SetColor("_DiffuseColor", Color.white); SizeOverLifetimeModule sizeOverLifetime = component.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; AnimationCurve val6 = new AnimationCurve(); val6.AddKey(0f, 1f); val6.AddKey(0.75f, 1f); val6.AddKey(1f, 0f); ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, val6); ShapeModule shape = component.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)12; ((ShapeModule)(ref shape)).randomDirectionAmount = 0.1f; ((ShapeModule)(ref shape)).alignToDirection = false; ((ShapeModule)(ref shape)).scale = Vector3.one; ((ShapeModule)(ref shape)).radiusThickness = 1f; ((ShapeModule)(ref shape)).radiusMode = (ParticleSystemShapeMultiModeValue)0; ((ShapeModule)(ref shape)).length = 16f; ((ShapeModule)(ref shape)).radius = 0.5f; ((ShapeModule)(ref shape)).rotation = new Vector3(0f, 0f, 90f); ((ShapeModule)(ref shape)).arc = 360f; ((ShapeModule)(ref shape)).arcMode = (ParticleSystemShapeMultiModeValue)0; ((ShapeModule)(ref shape)).arcSpeed = MinMaxCurve.op_Implicit(num); ((ShapeModule)(ref shape)).meshShapeType = (ParticleSystemMeshShapeType)0; InheritVelocityModule inheritVelocity = component.inheritVelocity; ((InheritVelocityModule)(ref inheritVelocity)).enabled = true; ((InheritVelocityModule)(ref inheritVelocity)).mode = (ParticleSystemInheritVelocityMode)1; ((InheritVelocityModule)(ref inheritVelocity)).curveMultiplier = 1f; AnimationCurve val7 = new AnimationCurve(); val7.AddKey(0f, 1f); val7.AddKey(0.05f, 0f); ((InheritVelocityModule)(ref inheritVelocity)).curve = new MinMaxCurve(1f, val7); return val; } } public enum SlimyboiType { Glitch, Saber, Pink, Honey, Rad, Tangle, Hunter, Boom, Rock, Quantum, Phosphor, Mosaic, Dervish, Tabby, Lucky, Puddle, Quicksilver, Fire, Gold, Crystal } public class SlimeData { public SlimyboiType type; public string slimeName; public string fullName; public AIActor prefab; public GameObject debris; public SlimyboiFlags flags; public Color goopColor = Color.white; public int? overrideHealth; public float? overrideWeight; public float? overrideSpeed; public float? overrideContactDamage; public float? overrideAttackCooldown; public float? overrideAttackRange; public GoopDefinition goopDefinition; public GameObject attackVFX; } [Flags] public enum SlimyboiFlags { None = 0, Allied = 1, CanFly = 2, ExplodesOnDeath = 4, ExtraCasingOnKill = 8, PitImmunity = 0x10, FireImmunity = 0x20, PoisonImmunity = 0x40, ExplosionImmunity = 0x80, ProjectileImmunity = 0x100, QuantumInstability = 0x200, ImmobileInCombat = 0x400, AbsorbsBullets = 0x800, PassivelyGoops = 0x1000, DodgesProjectiles = 0x2000, ImmuneToMovingTraps = 0x4000, CantVacInCombat = 0x8000, AttacksPoison = 0x10000, AttacksIgnite = 0x20000, ReflectsProjectiles = 0x40000, FullStatusImmunity = 0x80000, AttacksSlow = 0x100000, ExplosiveAttacks = 0x200000, PassiveHealthDrain = 0x400000, FollowPlayer = 0x800000, CanAlwaysVac = 0x1000000, CantReceiveHealing = 0x2000000, AttacksHealAllies = 0x4000000 } public class SlimyboiController : BraveBehaviour { public class LuckyCasingDrop : MonoBehaviour { private void Start() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) AIActor component = ((Component)this).gameObject.GetComponent(); if (component != null) { ((Component)this).gameObject.PlayUnique("slime_coin_sound"); LootEngine.SpawnCurrency(((GameActor)component).CenterPosition, 1, false, (Vector2?)null, (float?)null, 4f, 0.05f); } } } private const string VACPACK_FLYING_REASON = "Vacpack"; private const string DERVISH_FLYING_REASON = "Dervish Aura"; private const float _BASE_IFRAME_LENGTH = 1f; private const float _DODGE_IFRAME_LENGTH = 0.25f; private const float _DODGE_COOLDOWN = 1f; private const float _DODGE_LENGTH = 2f; private const float _HEAL_RADIUS = 7.5f; private const float _AURA_RADIUS = 6f; private const float _AURA_THICKNESS = 0.05f; private const float _AURA_PERSIST_TIME = 2f; private const float _REFLECT_GLOW_TIME = 1f; private const float _REFLECT_GLOW_STRENGTH = 10f; private const float _HEAL_COOLDOWN_TIME = 0.33f; private const float _HEAL_AMOUNT = 1f; private const float _VINE_ATTACK_TIME = 0.1f; private const float _VINE_HOLD_TIME = 0.3f; private const float _VINE_RETRACT_TIME = 0.1f; private const float _VINE_RADIUS = 5f; private const float _HEALTH_FROM_BULLETS = 2.5f; private const float _HEALTH_DRAIN_RATE = 2f; private const float _HEALTH_DRAIN_AMOUNT = 1f; private const float _MAX_GROUP_HEAL = 10f; private const float _MAX_STUCK_TIME = 0.25f; private const float _HEAL_RADIUS_SQR = 56.25f; private const float _AURA_RADIUS_SQR = 36f; private const float _VINE_RADIUS_SQR = 25f; private const float _VINE_TOTAL_TIME = 0.5f; public SlimyboiFlags attributes; public SlimyboiType slimeType; internal float _dodgeCooldown; internal Vector2 _dodgeVector; internal bool _queuedDodge; internal PlayerController _owner; internal tk2dBaseSprite _renderSprite; private bool _setup; private SlimeData _slimeData; private bool _activelyBeingLaunched; private float _jumpDuration = 1f; private float _jumpTimer; private float _growDuration = 1f; private float _growTimer; private float _reflectGlowTimer; private float _projectileIframeTimer; private float _buffCooldownTimer; private tk2dSprite _trueSprite; private ParticleSystem _ps; private Geometry _aura; private EasyLight _light; private bool _didGlowSetup; private bool _appearOutOfNowhere; private Color? _queuedOutlineColor; private float _iframeLength = 1f; private Vector2 _lastPosition; private float _stuckTime; private SlimyboiChargeBehavior _chargeBehavior; private CwaffRopeMesh _vineMesh; private Projectile _vineTarget; private Vector2? _vineTargetPos; private float _vineTimer; private float _vineDirection; private DamageTypeModifier _poisonImmunity; private float _immuneToPoisonTimer; private DamageTypeModifier _fireImmunity; private float _immuneToFireTimer; private float _flightTimer; private float _goldTimer; private float _healthDrainTimer; private static readonly List _TempSlimes = new List(); private static readonly ReadOnlyCollection _TempSlimesRO = new ReadOnlyCollection(_TempSlimes); private void Start() { Setup(); } private void Setup() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0093: 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_009b: 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_00b0: Expected O, but got Unknown //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_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_00cd: Expected O, but got Unknown //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Expected O, but got Unknown //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Expected O, but got Unknown if (!_setup) { _slimeData = slimeType.Data(); HealthHaver healthHaver = ((BraveBehaviour)this).healthHaver; healthHaver.SuppressDeathSounds = true; healthHaver.OnDeath += OnDeath; healthHaver.OnDamaged += new OnDamagedEvent(OnDamaged); attributes |= SlimyboiFlags.Allied; AIActor aiActor = ((BraveBehaviour)this).aiActor; aiActor.CanTargetEnemies = true; aiActor.CanTargetPlayers = false; aiActor.HitByEnemyBullets = true; aiActor.IgnoreForRoomClear = true; aiActor.IsHarmlessEnemy = true; aiActor.IsNormalEnemy = false; aiActor.PreventAutoKillOnBossDeath = true; _poisonImmunity = new DamageTypeModifier { damageType = (CoreDamageTypes)16, damageMultiplier = 0f }; _fireImmunity = new DamageTypeModifier { damageType = (CoreDamageTypes)4, damageMultiplier = 0f }; if (healthHaver.damageTypeModifiers == null) { healthHaver.damageTypeModifiers = new List(); } if (((GameActor)aiActor).EffectResistances == null) { ((GameActor)aiActor).EffectResistances = (ActorEffectResistance[])(object)new ActorEffectResistance[0]; } if (attributes.IsSet(SlimyboiFlags.QuantumInstability)) { healthHaver.PreventAllDamage = true; healthHaver.IsVulnerable = false; } if (attributes.IsSet(SlimyboiFlags.PassiveHealthDrain)) { _healthDrainTimer = 2f; } if (_slimeData.flags.IsSet(SlimyboiFlags.PoisonImmunity)) { healthHaver.damageTypeModifiers.Add(_poisonImmunity); ((GameActor)aiActor).SetResistance((EffectResistanceType)2, 1f); } if (_slimeData.flags.IsSet(SlimyboiFlags.FireImmunity)) { healthHaver.damageTypeModifiers.Add(_fireImmunity); ((GameActor)aiActor).SetResistance((EffectResistanceType)1, 1f); } _iframeLength = GetIframesForFloor(); int num = ((BraveBehaviour)this).behaviorSpeculator.AttackBehaviors.FindIndex((AttackBehaviorBase a) => a is SlimyboiChargeBehavior); if (num >= 0) { _chargeBehavior = ((BraveBehaviour)this).behaviorSpeculator.AttackBehaviors[num] as SlimyboiChargeBehavior; } SpeculativeRigidbody specRigidbody = ((BraveBehaviour)this).specRigidbody; specRigidbody.AddCollisionLayerOverride(CollisionMask.LayerToMask((CollisionLayer)2)); specRigidbody.AddCollisionLayerOverride(CollisionMask.LayerToMask((CollisionLayer)4)); specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreRigidbodyCollision)); ref tk2dSprite trueSprite = ref _trueSprite; tk2dBaseSprite sprite = ((BraveBehaviour)specRigidbody).sprite; trueSprite = (tk2dSprite)(object)((sprite is tk2dSprite) ? sprite : null); SlimyboiManager.RegisterSlime(this); _setup = true; } } private static float GetIframesForFloor() { float baseLevelHealthModifier = AIActor.BaseLevelHealthModifier; return Mathf.Clamp(1f / (baseLevelHealthModifier * baseLevelHealthModifier) - 0.2f, 0.05f, 1f); } private void OnDamaged(float resultValue, float maxValue, CoreDamageTypes damageTypes, DamageCategory damageCategory, Vector2 damageDirection) { _projectileIframeTimer = _iframeLength; } public void HandleRoomSpawn() { ((Component)this).gameObject.Play("slime_vacuum_sound"); _appearOutOfNowhere = true; Setup(); } public void HandleFiredFromVacpack(Vector2 dir, PlayerController owner) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) _activelyBeingLaunched = true; _owner = owner; ((Component)this).gameObject.Play("slime_launch_sound"); ((GameActor)((BraveBehaviour)this).aiActor).SetIsFlying(true, "Vacpack", false, false); ((BraveBehaviour)this).aiActor.CollisionDamage = 1f; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)this).specRigidbody; specRigidbody.OnCollision = (Action)Delegate.Combine(specRigidbody.OnCollision, new Action(OnCollisionAfterBeingShot)); RecreateParticleSystem(dir); } private void RecreateParticleSystem(Vector2 dir) { //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_0061: 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_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_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) Setup(); if (Object.op_Implicit((Object)(object)_ps)) { DestroyParticleSystem(); } GameObject val = Object.Instantiate(Slimybois.SlimeParticleSystem); val.transform.position = Vector2.op_Implicit(((BraveBehaviour)((BraveBehaviour)this).aiActor).sprite.WorldCenter); val.transform.parent = ((Component)this).gameObject.transform; val.transform.localRotation = dir.EulerZ(); _ps = val.GetComponent(); MainModule main = _ps.main; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(_slimeData.goopColor); } private void DestroyParticleSystem(bool immediate = false) { //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_0075: 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_007d: 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) if (Object.op_Implicit((Object)(object)_ps)) { _ps.Stop(true, (ParticleSystemStopBehavior)(!immediate)); ((Component)_ps).gameObject.transform.parent = null; if (immediate) { Object.Destroy((Object)(object)((Component)_ps).gameObject); } else { GameObject gameObject = ((Component)_ps).gameObject; MainModule main = _ps.main; float duration = ((MainModule)(ref main)).duration; main = _ps.main; MinMaxCurve startLifetime = ((MainModule)(ref main)).startLifetime; Object.Destroy((Object)(object)gameObject, Mathf.Min(3f, duration + ((MinMaxCurve)(ref startLifetime)).constantMax)); } _ps = null; } } private void HandleNoLongerFiredFromVacpack() { _activelyBeingLaunched = false; KnockbackUnleasher knockbackUnleasher = ((Component)this).gameObject.AddComponent(); if (knockbackUnleasher != null) { Object.Destroy((Object)(object)knockbackUnleasher); } ((GameActor)((BraveBehaviour)this).aiActor).SetIsFlying(false, "Vacpack", false, false); ResetCollisionDamage(); SpeculativeRigidbody specRigidbody = ((BraveBehaviour)this).specRigidbody; specRigidbody.OnCollision = (Action)Delegate.Remove(specRigidbody.OnCollision, new Action(OnCollisionAfterBeingShot)); PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(((BraveBehaviour)this).specRigidbody, (int?)null, false); DestroyParticleSystem(); } public void HandleVacuumedByVacpack() { ((GameActor)((BraveBehaviour)this).aiActor).SetIsFlying(true, "Vacpack", false, false); ((BraveBehaviour)this).specRigidbody.CollideWithOthers = false; } public void HandleNoLongerVacuumedByVacpack() { ((GameActor)((BraveBehaviour)this).aiActor).SetIsFlying(false, "Vacpack", false, false); ((BraveBehaviour)this).specRigidbody.CollideWithOthers = true; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(((BraveBehaviour)this).specRigidbody, (int?)null, false); } public void Jump(float? overideDuration = null, bool growIn = false) { _jumpTimer = overideDuration ?? Mathf.Clamp(0.6f * (slimeType.Data().overrideAttackCooldown ?? 2f), 0.15f, 0.5f); _jumpDuration = _jumpTimer; if (growIn) { _growTimer = 0.5f * _jumpTimer; _growDuration = _growTimer; } } private void ResetCollisionDamage() { ((BraveBehaviour)this).aiActor.CollisionDamage = 0f; foreach (AttackBehaviorBase attackBehavior in ((BraveBehaviour)this).behaviorSpeculator.AttackBehaviors) { if (attackBehavior is SlimyboiChargeBehavior slimyboiChargeBehavior) { ((ChargeBehavior)slimyboiChargeBehavior).m_cachedDamage = 0f; } } } private void Update() { float deltaTime = BraveTime.DeltaTime; HandleRenderSprite(deltaTime); HandleUnstick(deltaTime); if (_activelyBeingLaunched && !((BraveBehaviour)this).knockbackDoer.CheckSourceInKnockbacks(((Component)this).gameObject)) { HandleNoLongerFiredFromVacpack(); } UpdateTimers(deltaTime); UpdateSlimeSpecificBehaviors(deltaTime); } private void HandleUnstick(float dtime) { //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_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_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) Vector2 lastPosition = _lastPosition; _lastPosition = ((BraveBehaviour)this).specRigidbody.UnitCenter; if (_lastPosition != lastPosition) { _stuckTime = 0f; } else if (!((_stuckTime += dtime) < 0.25f)) { Path path = ((BraveBehaviour)this).aiActor.Path; if (path == null || path.Positions == null || path.Positions.Last == null) { _stuckTime = 0f; return; } PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(((BraveBehaviour)this).specRigidbody, (int?)null, false); _stuckTime = 0f; } } private void HandleRenderSprite(float dtime) { //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0434: 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_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; if (!Object.op_Implicit((Object)(object)_renderSprite)) { if (!Object.op_Implicit((Object)(object)_trueSprite) || (Object)(object)((tk2dBaseSprite)_trueSprite).Collection != (Object)(object)VFX.Collection) { return; } _renderSprite = (tk2dBaseSprite)(object)((BraveBehaviour)this).specRigidbody.DecoupleSpriteFromCollider(); if (slimeType == SlimyboiType.Quantum) { _renderSprite.usesOverrideMaterial = true; Material material = ((BraveBehaviour)_renderSprite).renderer.material; material.shader = CwaffShaders.WiggleShader; material.SetFloat("_Amplitude", 0.001f); material.SetFloat("_Distortion", 100f); material.SetFloat("_Speed", 10f); material.SetFloat("_Tearing", 0f); material.SetFloat("_FadeSpeed", 10f); material.SetFloat("_FadeAmp", 10f); } else if (slimeType == SlimyboiType.Glitch) { tk2dBaseSprite renderSprite = _renderSprite; _renderSprite = (tk2dBaseSprite)(object)Lazy.CreateMeshSpriteObject(renderSprite, renderSprite.WorldCenter, pointMesh: true); Object.Destroy((Object)(object)((Component)renderSprite).gameObject); _renderSprite.usesOverrideMaterial = true; Material material2 = ((BraveBehaviour)_renderSprite).renderer.material; material2.shader = CwaffShaders.ShatterShader; material2.SetFloat("_Progressive", 0f); material2.SetFloat(CwaffVFX._FadeId, 0f); material2.SetFloat("_Amplitude", 0.0625f); material2.SetFloat(CwaffVFX._RandomSeedId, Random.value); } if (_appearOutOfNowhere) { _appearOutOfNowhere = false; Vector2 worldCenter = ((tk2dBaseSprite)_trueSprite).WorldCenter; GameObject gameObject = _slimeData.debris.gameObject; float? fadeOutTime = 0.1f; float? startScale = 1f; float? endScale = 0f; CwaffVFX.SpawnBurst(gameObject, 10, worldCenter, 0f, null, 0f, 2f, CwaffVFX.Vel.Random, CwaffVFX.Rot.Random, 0.5f, fadeOutTime, 0f, null, fadeIn: false, uniform: false, startScale, endScale, null, randomFrame: false, -1, flipX: false, flipY: false, null, null, 1.55f, 0f, null, -1, 0f, 0f, unoccluded: false, copyShaders: true); Jump(0.5f, growIn: true); _renderSprite.scale = new Vector3(0f, 0f, 1f); } Color? queuedOutlineColor = _queuedOutlineColor; if (queuedOutlineColor.HasValue) { Color valueOrDefault = queuedOutlineColor.GetValueOrDefault(); SpriteOutlineManager.AddOutlineToSprite(_renderSprite, valueOrDefault); } } _renderSprite.collection = ((tk2dBaseSprite)_trueSprite).collection; _renderSprite.spriteId = ((tk2dBaseSprite)_trueSprite).spriteId; Vector3 val = ((BraveBehaviour)_trueSprite).transform.position; if (_jumpTimer > 0f) { _jumpTimer = Mathf.Max(0f, _jumpTimer - dtime); _ = ((BraveBehaviour)_trueSprite).transform.position; float num = 1.25f * Mathf.Sin((float)Math.PI * (1f - _jumpTimer / _jumpDuration)); ((BraveBehaviour)_trueSprite).spriteAnimator.UpdateAnimation(dtime); val.y += num; } if (_growTimer > 0f) { _growTimer = Mathf.Max(0f, _growTimer - dtime); float num2 = 1f - _growTimer / _growDuration; _renderSprite.scale = new Vector3(num2, num2, 1f); val -= Vector2Extensions.ToVector3ZUp(_renderSprite.GetRelativePositionFromAnchor((Anchor)1), 0f); val += new Vector3(0.5f * _renderSprite.GetCurrentSpriteDef().untrimmedBoundsDataExtents.x, 0f, 0f); } if (slimeType == SlimyboiType.Dervish || _flightTimer > 0f) { val.y += 0.125f * Mathf.Sin(12f * scaledTimeSinceStartup); } ((BraveBehaviour)_renderSprite).transform.position = dfVectorExtensions.Quantize(val, 0.0625f); if (_projectileIframeTimer == _iframeLength || Mathf.CeilToInt(_projectileIframeTimer * 20f) % 2 == 0) { ((BraveBehaviour)_renderSprite).renderer.enabled = true; } else { ((BraveBehaviour)_renderSprite).renderer.enabled = false; } } private void UpdateSlimeSpecificBehaviors(float dtime) { //IL_005f: 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_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: 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_0136: Unknown result type (might be due to invalid IL or missing references) switch (slimeType) { case SlimyboiType.Rad: HandleGlow(new Color(0.5f, 0.85f, 0.1f), null, 10f, 5f, 10f, 5f, 15f, 0.5f, 1f, 3f); HandleAuraVisuals(); HandleAuraEffect(); break; case SlimyboiType.Fire: HandleGlow(new Color(0.9f, 0.1f, 0.1f), null, 15f, 0f, 8f, 1f, 2f, 0.3f, 1f, 3f); HandleAuraVisuals(); HandleAuraEffect(); break; case SlimyboiType.Crystal: { float num = 10f * (_reflectGlowTimer / 1f); HandleGlow(new Color(0.6f, 0.8f, 0.8f), null, 10f, 0f, 15f, num + 0.1f, num + 3.1f, 0.5f, 1f, 3f); break; } case SlimyboiType.Phosphor: HandleAuraVisuals(7.5f); HandleGlow(new Color(1f, 1f, 0.8f), null, 0f, 3f, 8f, 0f, 0f, 0f, 5f, 5f); if (_buffCooldownTimer != 0f && !TickAndCheck(ref _buffCooldownTimer, dtime)) { break; } _buffCooldownTimer = 0.33f; { foreach (SlimyboiController nearbySlime in GetNearbySlimes(((GameActor)((BraveBehaviour)this).aiActor).CenterPosition, 56.25f, shuffle: true)) { if (((BraveBehaviour)nearbySlime).healthHaver.currentHealth < ((BraveBehaviour)nearbySlime).healthHaver.AdjustedMaxHealth && !nearbySlime.attributes.IsSet(SlimyboiFlags.CantReceiveHealing)) { ApplyHealing(nearbySlime); break; } } break; } case SlimyboiType.Dervish: HandleAuraVisuals(); HandleAuraEffect(); break; case SlimyboiType.Tangle: HandleVineAttack(dtime); break; case SlimyboiType.Gold: HandleAuraVisuals(); HandleAuraEffect(); break; case SlimyboiType.Mosaic: { float num2 = 10f * (_reflectGlowTimer / 1f); HandleGlow(new Color(0.35f, 0.7f, 0.1f), null, 20f, 0f, 10f, num2 + 1f, num2 + 10f, 0.7f, 1f, 3f); break; } case SlimyboiType.Glitch: if (Object.op_Implicit((Object)(object)_renderSprite)) { ((BraveBehaviour)_renderSprite).renderer.material.SetFloat(CwaffVFX._RandomSeedId, Random.value); } break; } } private void HandleVineAttack(float dtime) { //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_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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: 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_022a: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0289: 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_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0290: 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_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_0324: 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_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0313: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_017e: 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_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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) Vector2 worldCenter = _renderSprite.WorldCenter; if (!Object.op_Implicit((Object)(object)_vineMesh)) { _vineMesh = CwaffRopeMesh.Create(Slimybois._SlimeVineVFX, worldCenter, worldCenter, 8, null, RopeSim.StretchPolicy.GROWTEMPORARY); ((tk2dBaseSprite)_vineMesh.sprite).HeightOffGround = -10f; ((tk2dBaseSprite)(object)_vineMesh.sprite).MakeGlowyBetter((float?)7f, (Color?)new Color(0.35f, 0.7f, 0.1f), (float?)10f, 0.8f, (Color?)null, skipSetup: false); } if (TickAndCheck(ref _vineTimer, dtime)) { _vineTarget = null; _vineTargetPos = null; } if (_vineTimer <= 0f) { _vineTimer = 0.5f; Projectile val = null; float num = 25f; ReadOnlyCollection allProjectiles = StaticReferenceManager.AllProjectiles; for (int num2 = allProjectiles.Count - 1; num2 >= 0; num2--) { Projectile val2 = allProjectiles[num2]; if (Object.op_Implicit((Object)(object)val2) && ((Behaviour)val2).isActiveAndEnabled && !(val2.Owner is PlayerController)) { Vector2 val3 = val2.SafeCenter - worldCenter; float sqrMagnitude = ((Vector2)(ref val3)).sqrMagnitude; if (!(sqrMagnitude > num)) { num = sqrMagnitude; val = val2; } } } _vineDirection = (Lazy.CoinFlip() ? 1f : (-1f)); _vineTarget = val; _vineTargetPos = (Object.op_Implicit((Object)(object)val) ? new Vector2?(val.SafeCenter + 0.1f * val.m_currentSpeed * ((Vector2)(ref val.m_currentDirection)).normalized) : ((Vector2?)null)); if (Object.op_Implicit((Object)(object)val)) { ((Component)this).gameObject.PlayOnce("slime_vine_sound"); _vineMesh.ResetToPosition(worldCenter); } } Vector2? vineTargetPos = _vineTargetPos; if (vineTargetPos.HasValue) { Vector2 valueOrDefault = vineTargetPos.GetValueOrDefault(); ((BraveBehaviour)_vineMesh.sprite).renderer.enabled = true; _vineMesh.startPos = worldCenter; float num3 = 0.5f - _vineTimer; if (num3 > 0.1f && Object.op_Implicit((Object)(object)_vineTarget)) { _vineTarget.DieInAir(false, true, true, true); _vineTarget = null; } _vineMesh.startPos = worldCenter; if (num3 < 0.1f) { float num4 = Ease.InOutQuad(num3 / 0.1f); Vector2 val4 = valueOrDefault - worldCenter; Vector2 val5 = ((Vector2)(ref val4)).normalized.Rotate(_vineDirection * 90f); _vineMesh.endPos = Vector2.Lerp(worldCenter, valueOrDefault, num4); CwaffRopeMesh vineMesh = _vineMesh; vineMesh.endPos += 2f * Mathf.Sin(num4 * (float)Math.PI) * val5; } else if (num3 > 0.4f) { _vineMesh.endPos = Vector2.Lerp(valueOrDefault, worldCenter, Ease.InOutQuad((num3 - 0.4f) / 0.1f)); } else { _vineMesh.endPos = valueOrDefault; } } else { ((BraveBehaviour)_vineMesh.sprite).renderer.enabled = false; } } private void ApplyHealing(SlimyboiController sloim, float healAmount = 1f, bool doSound = true) { //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_0021: Unknown result type (might be due to invalid IL or missing references) ((BraveBehaviour)sloim).healthHaver.ApplyHealing(healAmount); SpawnManager.SpawnVFX(VFX.MiniPickup, Vector2.op_Implicit(((GameActor)((BraveBehaviour)sloim).aiActor).CenterPosition), Lazy.RandomEulerZ()); if (doSound) { ((Component)sloim).gameObject.PlayOnce("slime_heal_sound"); } } private static bool TickAndCheck(ref float timer, float dtime) { if (timer <= 0f) { return false; } timer -= dtime; if (timer > 0f) { return false; } timer = 0f; return true; } private void UpdateTimers(float dtime) { //IL_00dd: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) TickAndCheck(ref _projectileIframeTimer, dtime); TickAndCheck(ref _dodgeCooldown, dtime); TickAndCheck(ref _reflectGlowTimer, dtime); if (TickAndCheck(ref _immuneToPoisonTimer, dtime)) { ((BraveBehaviour)this).healthHaver.damageTypeModifiers.Remove(_poisonImmunity); ((GameActor)((BraveBehaviour)this).aiActor).SetResistance((EffectResistanceType)2, 0f); } if (TickAndCheck(ref _immuneToFireTimer, dtime)) { ((BraveBehaviour)this).healthHaver.damageTypeModifiers.Remove(_fireImmunity); ((GameActor)((BraveBehaviour)this).aiActor).SetResistance((EffectResistanceType)1, 0f); } if (TickAndCheck(ref _flightTimer, dtime) && Object.op_Implicit((Object)(object)_owner) && _owner.IsInCombat) { ((GameActor)((BraveBehaviour)this).aiActor).SetIsFlying(false, "Dervish Aura", true, true); if (_chargeBehavior != null) { SlimyboiChargeBehavior chargeBehavior = _chargeBehavior; ((ChargeBehavior)chargeBehavior).m_cachedPathableTiles = (CellTypes)(((ChargeBehavior)chargeBehavior).m_cachedPathableTiles & -5); } if (Object.op_Implicit((Object)(object)_renderSprite)) { SpriteOutlineManager.RemoveOutlineFromSprite(_renderSprite, false); } } if (TickAndCheck(ref _goldTimer, dtime)) { EndGoldInvulnerability(); } if (attributes.IsSet(SlimyboiFlags.PassiveHealthDrain) && TickAndCheck(ref _healthDrainTimer, dtime)) { _healthDrainTimer = 2f; if (slimeType == SlimyboiType.Quantum) { ((BraveBehaviour)this).healthHaver.IsVulnerable = true; ((BraveBehaviour)this).healthHaver.PreventAllDamage = false; } ((BraveBehaviour)this).healthHaver.ApplyDamage(1f, Vector2.zero, "Dehydration", (CoreDamageTypes)0, (DamageCategory)1, true, (PixelCollider)null, false); if (slimeType == SlimyboiType.Quantum) { ((BraveBehaviour)this).healthHaver.IsVulnerable = false; ((BraveBehaviour)this).healthHaver.PreventAllDamage = true; } } } private void BeginGoldInvulnerability() { //IL_0037: 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) ((BraveBehaviour)this).healthHaver.IsVulnerable = false; ((BraveBehaviour)this).healthHaver.PreventAllDamage = true; if (Object.op_Implicit((Object)(object)_renderSprite)) { SpriteOutlineManager.AddOutlineToSprite(_renderSprite, ExtendedColours.paleYellow); } else { _queuedOutlineColor = ExtendedColours.paleYellow; } } private void EndGoldInvulnerability() { ((BraveBehaviour)this).healthHaver.IsVulnerable = true; ((BraveBehaviour)this).healthHaver.PreventAllDamage = false; if (Object.op_Implicit((Object)(object)_renderSprite)) { SpriteOutlineManager.RemoveOutlineFromSprite(_renderSprite, false); } } private void HandleGlow(Color color, Color? lightColor, float flickerRate, float brightness, float glowColorPower, float minGlow, float maxGlow, float sensitivity, float minLightRadius, float maxLightRadius) { //IL_003e: 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_0099: 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) if (!Object.op_Implicit((Object)(object)_renderSprite)) { return; } float num = Mathf.Abs(Mathf.Sin(flickerRate * BraveTime.ScaledTimeSinceStartup)); if (maxGlow > 0f) { tk2dBaseSprite renderSprite = _renderSprite; float? glowAmount = minGlow + (maxGlow - minGlow) * num; Color? glowColor = color; float? glowColorPower2 = glowColorPower; bool didGlowSetup = _didGlowSetup; renderSprite.MakeGlowyBetter(glowAmount, glowColor, glowColorPower2, sensitivity, null, didGlowSetup); _didGlowSetup = true; } if (brightness > 0f) { if (!Object.op_Implicit((Object)(object)_light)) { _light = EasyLight.Create((Vector2?)((GameActor)((BraveBehaviour)this).aiActor).CenterPosition, ((BraveBehaviour)this).transform, (Color?)(lightColor ?? color), -1f, 0f, false, brightness, 0f, 0f, true, false, 30f, 0f, true, true); } _light.SetRadius(minLightRadius + (maxLightRadius - minLightRadius) * num); } } private static ReadOnlyCollection GetNearbySlimes(Vector2 pos, float sqrRadius = 36f, bool shuffle = false) { //IL_000a: 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_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_0042: 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) _TempSlimes.Clear(); float x = pos.x; float y = pos.y; foreach (SlimyboiController activeSlime in SlimyboiManager.ActiveSlimes) { if (Object.op_Implicit((Object)(object)activeSlime)) { Vector2 centerPosition = ((GameActor)((BraveBehaviour)activeSlime).aiActor).CenterPosition; float num = x - centerPosition.x; float num2 = y - centerPosition.y; if (num * num + num2 * num2 <= sqrRadius) { _TempSlimes.Add(activeSlime); } } } if (shuffle) { _TempSlimes.Shuffle(); } return _TempSlimesRO; } private void HandleAuraVisuals(float radius = 6f) { } private void HandleAuraEffect(float radius = 6f) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) foreach (SlimyboiController nearbySlime in GetNearbySlimes(((GameActor)((BraveBehaviour)this).aiActor).CenterPosition, radius * radius)) { if ((Object)(object)nearbySlime != (Object)(object)this) { ApplyAuraEffect(nearbySlime); } } } private void ApplyAuraEffect(SlimyboiController sloim) { //IL_0143: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: 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) switch (slimeType) { case SlimyboiType.Rad: if (sloim.attributes.IsSet(SlimyboiFlags.PoisonImmunity)) { break; } if (sloim._immuneToPoisonTimer <= 0f) { ((BraveBehaviour)sloim).healthHaver.damageTypeModifiers.Add(_poisonImmunity); ((GameActor)((BraveBehaviour)sloim).aiActor).SetResistance((EffectResistanceType)2, 1f); GameActorEffect effectBetter2 = ((BraveBehaviour)sloim).aiActor.GetEffectBetter((EffectResistanceType)2); if (effectBetter2 != null) { ((GameActor)((BraveBehaviour)sloim).aiActor).RemoveEffect(effectBetter2); } } sloim._immuneToPoisonTimer = 2f; break; case SlimyboiType.Fire: if (sloim.attributes.IsSet(SlimyboiFlags.FireImmunity)) { break; } if (sloim._immuneToFireTimer <= 0f) { ((BraveBehaviour)sloim).healthHaver.damageTypeModifiers.Add(_fireImmunity); ((GameActor)((BraveBehaviour)sloim).aiActor).SetResistance((EffectResistanceType)1, 1f); GameActorEffect effectBetter = ((BraveBehaviour)sloim).aiActor.GetEffectBetter((EffectResistanceType)1); if (effectBetter != null) { ((GameActor)((BraveBehaviour)sloim).aiActor).RemoveEffect(effectBetter); } } sloim._immuneToFireTimer = 2f; break; case SlimyboiType.Dervish: if (sloim.attributes.IsSet(SlimyboiFlags.CanFly)) { break; } if (sloim._flightTimer <= 0f) { ((GameActor)((BraveBehaviour)sloim).aiActor).SetIsFlying(true, "Dervish Aura", true, true); if (sloim._chargeBehavior != null) { SlimyboiChargeBehavior chargeBehavior = sloim._chargeBehavior; ((ChargeBehavior)chargeBehavior).m_cachedPathableTiles = (CellTypes)(((ChargeBehavior)chargeBehavior).m_cachedPathableTiles | 4); } if (Object.op_Implicit((Object)(object)sloim._renderSprite)) { SpriteOutlineManager.AddOutlineToSprite(sloim._renderSprite, Color.white); } else { sloim._queuedOutlineColor = Color.white; } } sloim._flightTimer = 2f; break; case SlimyboiType.Gold: if (sloim.slimeType != SlimyboiType.Gold) { if (sloim._goldTimer <= 0f) { sloim.BeginGoldInvulnerability(); } sloim._goldTimer = 2f; } break; } } private void OnCollisionAfterBeingShot(CollisionData data) { //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) SpeculativeRigidbody specRigidbody = ((BraveBehaviour)this).specRigidbody; specRigidbody.OnCollision = (Action)Delegate.Remove(specRigidbody.OnCollision, new Action(OnCollisionAfterBeingShot)); HandleNoLongerFiredFromVacpack(); ((BraveBehaviour)this).knockbackDoer.m_activeKnockbacks.Clear(); ((BraveBehaviour)this).specRigidbody.Velocity = Vector2.zero; OnAttackCollision(data, 2f * ((Vector2)(ref ((BraveBehaviour)this).specRigidbody.Velocity)).magnitude); } public void OnAttackCollision(CollisionData data, float knockback) { //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_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_0050: 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_0076: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) float self = Vector2Extensions.ToAngle(-((BraveBehaviour)this).specRigidbody.Velocity).AddRandomSpread(10f); bool flag = attributes.IsSet(SlimyboiFlags.ExplosiveAttacks); GameObject prefab = (flag ? Slimybois._SlimeExplodeImpactVFX : Slimybois._SlimeImpactVFX); Vector3 position = Vector2.op_Implicit(((CastResult)data).Contact + Lazy.RandomVector(0.25f)); Vector2? val = (flag ? Vector2.zero : self.ToVector(Random.Range(5f, 8f))); Quaternion? rotation = self.EulerZ(); Vector2? velocity = val; float? height = 8f; CwaffVFX.Spawn(prefab, position, rotation, velocity, 0f, null, 0f, null, fadeIn: false, null, null, height, randomFrame: false, -1, flipX: false, flipY: false, null, null, 1.55f, null, -1, null, unoccluded: false, copyShaders: true); ((BraveBehaviour)this).specRigidbody.RegisterTemporaryCollisionException(data.OtherRigidbody, 0.01f, (float?)null); ((Component)this).gameObject.Play(flag ? "slime_explode_attack_sound" : "slime_attack_sound"); ((BraveBehaviour)this).knockbackDoer.ApplyKnockback(((CastResult)data).Normal, knockback, _jumpDuration, false); Jump(); SpeculativeRigidbody otherRigidbody = data.OtherRigidbody; if (otherRigidbody == null) { return; } AIActor aiActor = ((BraveBehaviour)otherRigidbody).aiActor; if (aiActor != null) { if (attributes.IsSet(SlimyboiFlags.AttacksPoison)) { ((GameActor)aiActor).ApplyEffect(Slimybois._SlimePoisonEffect, 1f, (Projectile)null); } if (attributes.IsSet(SlimyboiFlags.AttacksIgnite)) { ((GameActor)aiActor).ApplyEffect(Slimybois._SlimeFireEffect, 1f, (Projectile)null); } if (attributes.IsSet(SlimyboiFlags.AttacksSlow)) { ((GameActor)aiActor).ApplyEffect(Slimybois._SlimeSlowEffect, 1f, (Projectile)null); } if (attributes.IsSet(SlimyboiFlags.ExtraCasingOnKill)) { GameObjectExtensions.GetOrAddComponent(((Component)aiActor).gameObject); } if (attributes.IsSet(SlimyboiFlags.AttacksHealAllies)) { DoGroupHeal(); } } } private void DoGroupHeal() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) float num = 10f; bool flag = false; foreach (SlimyboiController nearbySlime in GetNearbySlimes(((GameActor)((BraveBehaviour)this).aiActor).CenterPosition, 56.25f)) { if (nearbySlime.attributes.IsSet(SlimyboiFlags.CantReceiveHealing)) { continue; } float num2 = ((BraveBehaviour)nearbySlime).healthHaver.AdjustedMaxHealth - ((BraveBehaviour)nearbySlime).healthHaver.currentHealth; if (!(num2 <= 0.01f)) { float num3 = Mathf.Min(num2, num); num -= num3; ApplyHealing(nearbySlime, num3, doSound: false); flag = true; if (num < 0.01f) { break; } } } if (flag) { ((Component)this).gameObject.PlayUnique("slime_mosaic_heal_sound"); _reflectGlowTimer = 1f; } } private void OnDeath(Vector2 vector) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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) DestroyParticleSystem(immediate: true); if (!((GameActor)((BraveBehaviour)this).aiActor).StealthDeath) { if (attributes.IsSet(SlimyboiFlags.ExplodesOnDeath)) { Exploder.DoDefaultExplosion(Vector2.op_Implicit(((GameActor)((BraveBehaviour)this).aiActor).CenterPosition), Vector2.zero, (Action)null, true, (CoreDamageTypes)0, false); } ((Component)this).gameObject.Play(Lazy.CoinFlip() ? "slime_death_sound_a" : "slime_death_sound_b"); GameObject slimeDeathVFX = Slimybois._SlimeDeathVFX; Vector2 centerPosition = ((GameActor)((BraveBehaviour)this).aiActor).CenterPosition; float? startScale = 1f; float? endScale = 0f; CwaffVFX.SpawnBurst(slimeDeathVFX, 6, centerPosition, 0.5f, null, 2f, 2f, CwaffVFX.Vel.Away, CwaffVFX.Rot.Random, 0.5f, null, 0f, null, fadeIn: false, uniform: false, startScale, endScale, null, randomFrame: false, -1, flipX: false, flipY: false, null, null, 1.55f, 0f, null, -1, 0f, 0f, unoccluded: false, copyShaders: true); } } public override void OnDestroy() { DestroyParticleSystem(immediate: true); SlimyboiManager.DeregisterSlime(this); if (Object.op_Implicit((Object)(object)_vineMesh)) { Object.Destroy((Object)(object)((Component)_vineMesh).gameObject); } if (Object.op_Implicit((Object)(object)_aura)) { Object.Destroy((Object)(object)((Component)_aura).gameObject); } if (Object.op_Implicit((Object)(object)_renderSprite)) { Object.Destroy((Object)(object)((Component)_renderSprite).gameObject); } ((BraveBehaviour)this).OnDestroy(); } private void HandleProjetileDodge(Projectile proj) { //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_0025: 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) _projectileIframeTimer = 0.25f; _dodgeCooldown = 1f; Vector2 direction = proj.Direction; _dodgeVector = 2f * ((Vector2)(ref direction)).normalized.Rotate(Random.Range(90f, 270f)); _queuedDodge = true; } private void OnPreRigidbodyCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { //IL_010f: 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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Invalid comparison between Unknown and I4 if (attributes.IsSet(SlimyboiFlags.QuantumInstability)) { if (!Object.op_Implicit((Object)(object)((BraveBehaviour)otherRigidbody).aiActor) || Object.op_Implicit((Object)(object)((Component)((BraveBehaviour)otherRigidbody).aiActor).gameObject.GetComponent())) { PhysicsEngine.SkipCollision = true; } return; } Projectile projectile = ((BraveBehaviour)otherRigidbody).projectile; if (projectile != null) { if (attributes.IsSet(SlimyboiFlags.AbsorbsBullets)) { PhysicsEngine.SkipCollision = true; if (((Behaviour)projectile).isActiveAndEnabled && !(projectile.Owner is PlayerController)) { projectile.DieInAir(false, true, true, true); ApplyHealing(this, 2.5f); _healthDrainTimer = 2f; } } else if (attributes.IsSet(SlimyboiFlags.ReflectsProjectiles)) { PhysicsEngine.SkipCollision = true; if (((Behaviour)projectile).isActiveAndEnabled && !(projectile.Owner is PlayerController)) { ((Component)this).gameObject.PlayUnique("slime_reflect_sound"); PassiveReflectItem.ReflectBullet(projectile, false, (GameActor)(object)_owner, 25f, 1f, 1f, 0f); Vector2 val = projectile.SafeCenter - myRigidbody.UnitCenter; projectile.Direction = ((Vector2)(ref val)).normalized; _reflectGlowTimer = 1f; } } else if (attributes.IsSet(SlimyboiFlags.ProjectileImmunity)) { PhysicsEngine.SkipCollision = true; if (((Behaviour)projectile).isActiveAndEnabled && !(projectile.Owner is PlayerController)) { projectile.DieInAir(false, true, true, true); } } else if (_projectileIframeTimer > 0f) { PhysicsEngine.SkipCollision = true; } else { GameActor owner = projectile.Owner; PlayerController val2 = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val2 != null && Object.op_Implicit((Object)(object)val2) && !((BraveBehaviour)this).aiActor.CanTargetPlayers) { PhysicsEngine.SkipCollision = true; } else if (_dodgeCooldown <= 0f && attributes.IsSet(SlimyboiFlags.DodgesProjectiles)) { PhysicsEngine.SkipCollision = true; HandleProjetileDodge(projectile); } } return; } GameActor gameActor = ((BraveBehaviour)otherRigidbody).gameActor; AIActor val3 = (AIActor)(object)((gameActor is AIActor) ? gameActor : null); if (val3 != null) { if (Object.op_Implicit((Object)(object)((Component)val3).gameObject.GetComponent())) { PhysicsEngine.SkipCollision = true; } } else if (Object.op_Implicit((Object)(object)((Component)otherRigidbody).gameObject.GetComponent())) { PhysicsEngine.SkipCollision = true; } else if (_activelyBeingLaunched) { PhysicsEngine.SkipCollision = true; } else if (attributes.IsSet(SlimyboiFlags.ImmuneToMovingTraps) && ((Component)otherRigidbody).gameObject.GetComponent() != null) { PhysicsEngine.SkipCollision = true; } else { if (!Object.op_Implicit((Object)(object)gameActor)) { return; } PlayerController val4 = (PlayerController)(object)((gameActor is PlayerController) ? gameActor : null); if (val4 == null) { return; } if (!((BraveBehaviour)this).aiActor.CanTargetPlayers) { PhysicsEngine.SkipCollision = true; return; } Gun currentGun = ((GameActor)val4).CurrentGun; if (currentGun != null) { Vacpack component = ((Component)currentGun).gameObject.GetComponent(); if (component != null && component.IsVacuumingSlime(this)) { PhysicsEngine.SkipCollision = true; return; } } if ((int)GameManager.Instance.CurrentGameType != 1) { return; } PlayerController otherPlayer = GameManager.Instance.GetOtherPlayer(val4); if (otherPlayer == null) { return; } Gun currentGun2 = ((GameActor)otherPlayer).CurrentGun; if (currentGun2 != null) { Vacpack component2 = ((Component)currentGun2).gameObject.GetComponent(); if (component2 != null && component2.IsVacuumingSlime(this)) { PhysicsEngine.SkipCollision = true; } } } } } public class SlimyboiChargeBehavior : ChargeBehavior { public float maxRange = 3f; private SlimyboiController _slime; public override void Init(GameObject gameObject, AIActor aiActor, AIShooter aiShooter) { ((BasicAttackBehavior)this).Init(gameObject, aiActor, aiShooter); SpeculativeRigidbody specRigidbody = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody; _slime = ((Component)((BehaviorBase)this).m_aiActor).gameObject.GetComponent(); specRigidbody.OnCollision = (Action)Delegate.Remove(specRigidbody.OnCollision, new Action(base.OnCollision)); specRigidbody.OnCollision = (Action)Delegate.Remove(specRigidbody.OnCollision, new Action(OnOverrideCollision)); specRigidbody.OnCollision = (Action)Delegate.Combine(specRigidbody.OnCollision, new Action(OnOverrideCollision)); base.m_initialized = true; } private void OnOverrideCollision(CollisionData data) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)((ChargeBehavior)this).State == 2) { SpeculativeRigidbody otherRigidbody = data.OtherRigidbody; if (otherRigidbody != null && Object.op_Implicit((Object)(object)((BraveBehaviour)otherRigidbody).aiActor) && Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiActor) && !((BraveBehaviour)((BehaviorBase)this).m_aiActor).healthHaver.IsDead && Object.op_Implicit((Object)(object)_slime)) { _slime.OnAttackCollision(data, 25f); } } ((ChargeBehavior)this).OnCollision(data); } public override BehaviorResult Update() { //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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_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_00b4: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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) //IL_00d9: 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) if (!base.m_initialized) { SpeculativeRigidbody specRigidbody = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody; specRigidbody.OnCollision = (Action)Delegate.Combine(specRigidbody.OnCollision, new Action(base.OnCollision)); base.m_initialized = true; } if (((AttackBehaviorBase)this).IsReady() && Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiActor.TargetRigidbody)) { Vector2 unitCenter = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.UnitCenter; PixelCollider pixelCollider = ((BehaviorBase)this).m_aiActor.TargetRigidbody.GetPixelCollider((ColliderType)2); if (pixelCollider != null) { Vector2 val = unitCenter.ClosestPointOnCollider(pixelCollider); if (base.leadAmount > 0f) { Vector2 val2 = val + ((BehaviorBase)this).m_aiActor.TargetRigidbody.Velocity * 0.75f; val2 = BraveMathCollege.GetPredictedPosition(val, ((BehaviorBase)this).m_aiActor.TargetVelocity, unitCenter, base.chargeSpeed); val = Vector2.Lerp(val, val2, base.leadAmount); } Vector2 val3 = unitCenter - val; float sqrMagnitude = ((Vector2)(ref val3)).sqrMagnitude; if (!(sqrMagnitude <= base.minRange * base.minRange) && !(sqrMagnitude >= maxRange * maxRange)) { if (!string.IsNullOrEmpty(base.primeAnim) || base.primeTime > 0f) { ((ChargeBehavior)this).State = (FireState)1; } else { ((ChargeBehavior)this).State = (FireState)2; } ((BehaviorBase)this).m_updateEveryFrame = true; return (BehaviorResult)4; } return (BehaviorResult)0; } return (BehaviorResult)0; } return (BehaviorResult)0; } } public class SlimyboiSeekBehavior : SeekTargetBehavior { public float CustomMinRange; public override BehaviorResult 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_006f: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 //IL_0025: 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) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_0044: 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_00dd: 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) //IL_016f: Unknown result type (might be due to invalid IL or missing references) SpeculativeRigidbody targetRigidbody = ((BehaviorBase)this).m_aiActor.TargetRigidbody; if (targetRigidbody == null) { if ((int)base.m_state == 1) { ((BehaviorBase)this).m_aiActor.ClearPath(); base.m_state = (State)0; } else if ((int)base.m_state == 2 && ((BehaviorBase)this).m_aiActor.PathComplete) { base.m_state = (State)0; } return (BehaviorResult)0; } Vector2 unitCenter = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.UnitCenter; PixelCollider pixelCollider = targetRigidbody.GetPixelCollider((ColliderType)2); Vector2 val = ((pixelCollider != null) ? unitCenter.ClosestPointOnCollider(pixelCollider) : targetRigidbody.UnitCenter); Vector2 val2 = val - unitCenter; float sqrMagnitude = ((Vector2)(ref val2)).sqrMagnitude; base.m_state = (State)1; if (base.ExternalCooldownSource) { ((BehaviorBase)this).m_aiActor.ClearPath(); return (BehaviorResult)0; } if (sqrMagnitude < CustomMinRange * CustomMinRange) { if (base.m_repathTimer <= 0f) { ((BehaviorBase)this).m_aiActor.PathfindToPosition(targetRigidbody.UnitCenter - (CustomMinRange + 0.5f) * ((Vector2)(ref val2)).normalized, (Vector2?)null, true, (CellValidator)null, (ExtraWeightingFunction)null, (CellTypes?)null, false); } return (BehaviorResult)1; } if (base.StopWhenInRange && sqrMagnitude <= base.CustomRange * base.CustomRange && (!base.LineOfSight || ((BehaviorBase)this).m_aiActor.HasLineOfSightToTarget || (Object.op_Implicit((Object)(object)((BraveBehaviour)targetRigidbody).aiActor) && !targetRigidbody.CollideWithOthers))) { ((BehaviorBase)this).m_aiActor.ClearPath(); return (BehaviorResult)0; } if (base.m_repathTimer <= 0f) { ((BehaviorBase)this).m_aiActor.PathfindToPosition(val, (Vector2?)null, true, (CellValidator)null, (ExtraWeightingFunction)null, (CellTypes?)null, false); base.m_repathTimer = base.PathInterval; } return (BehaviorResult)1; } } public class SlimyboiFollowPlayerBehavior : MovementBehaviorBase { public float PathInterval = 0.5f; public float ComfyDistanceToPlayer = 3f; public float MaxDistanceToPlayer = 5f; private SlimyboiController _sloim; private PlayerController _owner; private float m_repathTimer; private bool _wasCloseToPlayer; public override void Init(GameObject gameObject, AIActor aiActor, AIShooter aiShooter) { ((BehaviorBase)this).Init(gameObject, aiActor, aiShooter); _sloim = gameObject.GetComponent(); _owner = (Object.op_Implicit((Object)(object)_sloim) ? _sloim._owner : null); } public override void Upkeep() { ((MovementBehaviorBase)this).Upkeep(); ((BehaviorBase)this).DecrementTimer(ref m_repathTimer, false); } public override BehaviorResult Update() { //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_0034: 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_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_0097: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_sloim) && Object.op_Implicit((Object)(object)_owner)) { Vector2 centerPosition = ((GameActor)_owner).CenterPosition; Vector2 centerPosition2 = ((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition; Vector2 val = centerPosition - centerPosition2; if (((Vector2)(ref val)).sqrMagnitude < (_wasCloseToPlayer ? (MaxDistanceToPlayer * MaxDistanceToPlayer) : (ComfyDistanceToPlayer * ComfyDistanceToPlayer))) { _wasCloseToPlayer = true; ((BehaviorBase)this).m_aiActor.ClearPath(); return (BehaviorResult)0; } _wasCloseToPlayer = false; if (m_repathTimer <= 0f) { ((BehaviorBase)this).m_aiActor.PathfindToPosition(centerPosition, (Vector2?)null, true, (CellValidator)null, (ExtraWeightingFunction)null, (CellTypes?)null, false); m_repathTimer = PathInterval; } return (BehaviorResult)1; } return (BehaviorResult)0; } } public class SlimyboiTargetingBehavior : TargetBehaviorBase { private const float PLAYER_REFRESH_TIMER = 1f; public float Radius = 10f; public bool LineOfSight = true; public bool ObjectPermanence = true; public float SearchInterval = 0.25f; public bool PauseOnTargetSwitch; public float PauseTime = 0.25f; private float m_losTimer; private float m_coopRefreshSearchTimer; private float m_prevDistToTarget; private PlayerController m_previousPlayer; private SpeculativeRigidbody m_specRigidbody; private BehaviorSpeculator m_behaviorSpeculator; public override void Init(GameObject gameObject, AIActor aiActor, AIShooter aiShooter) { ((BehaviorBase)this).Init(gameObject, aiActor, aiShooter); m_specRigidbody = gameObject.GetComponent(); m_behaviorSpeculator = gameObject.GetComponent(); } public override void Upkeep() { ((BehaviorBase)this).Upkeep(); ((BehaviorBase)this).DecrementTimer(ref m_losTimer, false); ((BehaviorBase)this).DecrementTimer(ref m_coopRefreshSearchTimer, false); } private bool ShouldResetTarget(out bool skipRemainingBehaviors) { //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_010e: 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_0113: 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_0116: 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) skipRemainingBehaviors = false; if (!Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiActor)) { return true; } GameActor playerTarget = m_behaviorSpeculator.PlayerTarget; if (playerTarget == null) { return true; } HealthHaver healthHaver = ((BraveBehaviour)playerTarget).healthHaver; if (playerTarget.IsFalling || (Object.op_Implicit((Object)(object)healthHaver) && (healthHaver.IsDead || healthHaver.PreventAllDamage))) { if (Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiActor)) { ((BehaviorBase)this).m_aiActor.ClearPath(); } skipRemainingBehaviors = true; return true; } if (!ObjectPermanence) { return true; } if (((BehaviorBase)this).m_aiActor.Path != null && !((BehaviorBase)this).m_aiActor.Path.WillReachFinalGoal) { return true; } if (playerTarget.IsStealthed) { return true; } if (Object.op_Implicit((Object)(object)healthHaver) && !healthHaver.IsVulnerable) { return true; } if (GameManager.Instance.AllPlayers.Length > 1 && m_coopRefreshSearchTimer <= 0f) { return true; } if (playerTarget is AIActor) { SpeculativeRigidbody specRigidbody = ((BraveBehaviour)playerTarget).specRigidbody; if (specRigidbody != null) { if (!((Behaviour)specRigidbody).isActiveAndEnabled) { return true; } Vector2 unitCenter = m_specRigidbody.UnitCenter; PixelCollider pixelCollider = specRigidbody.GetPixelCollider((ColliderType)2); Vector2 val = ((pixelCollider != null) ? unitCenter.ClosestPointOnCollider(pixelCollider) : specRigidbody.UnitCenter); Vector2 val2 = unitCenter - val; float sqrMagnitude = ((Vector2)(ref val2)).sqrMagnitude; bool num = m_prevDistToTarget + 9f < sqrMagnitude; m_prevDistToTarget = sqrMagnitude; if (num) { return true; } if (!((BehaviorBase)this).m_aiActor.IsNormalEnemy && Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiActor.CompanionOwner) && ((DungeonPlaceableBehaviour)playerTarget).GetAbsoluteParentRoom() != ((BehaviorBase)this).m_aiActor.CompanionOwner.CurrentRoom) { return true; } return false; } } return false; } public override BehaviorResult Update() { //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_0007: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0305: 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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025c: 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_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) BehaviorResult val = ((BehaviorBase)this).Update(); if ((int)val != 0) { return val; } if (!(m_losTimer > 0f)) { m_losTimer = SearchInterval; if (ShouldResetTarget(out var skipRemainingBehaviors)) { m_behaviorSpeculator.PlayerTarget = null; if (skipRemainingBehaviors) { return (BehaviorResult)1; } } if (!Object.op_Implicit((Object)(object)m_behaviorSpeculator.PlayerTarget)) { PlayerController val2 = GameManager.Instance.GetActivePlayerClosestToPoint(m_specRigidbody.UnitCenter, false); if (Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiActor) && ((BehaviorBase)this).m_aiActor.SuppressTargetSwitch) { val2 = m_previousPlayer; } if (!Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiActor) || (((BehaviorBase)this).m_aiActor.CanTargetPlayers && !((BehaviorBase)this).m_aiActor.CanTargetEnemies)) { if ((Object)(object)val2 == (Object)null) { return (BehaviorResult)0; } m_behaviorSpeculator.PlayerTarget = (GameActor)(object)val2; if (GameManager.Instance.AllPlayers.Length > 1) { m_coopRefreshSearchTimer = 1f; } } else if (((BehaviorBase)this).m_aiActor.CanTargetEnemies && !((BehaviorBase)this).m_aiActor.CanTargetPlayers) { RoomHandler absoluteRoomFromPosition = GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(((BehaviorBase)this).m_aiActor.GridPosition); List list = ((absoluteRoomFromPosition != null) ? absoluteRoomFromPosition.GetActiveEnemies((ActiveEnemyType)0) : null); if (list != null && list.Count > 0) { AIActor val3 = null; float num = -1f; Vector2 unitCenter = m_specRigidbody.UnitCenter; if (!Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiActor) || ((BehaviorBase)this).m_aiActor.IsNormalEnemy || !Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiActor.CompanionOwner) || !((GameActor)((BehaviorBase)this).m_aiActor.CompanionOwner).IsStealthed) { for (int i = 0; i < list.Count; i++) { AIActor val4 = list[i]; if (!Object.op_Implicit((Object)(object)val4) || !val4.IsNormalEnemy || Object.op_Implicit((Object)(object)((Component)val4).gameObject.GetComponent()) || ((GameActor)val4).IsGone || (Object)(object)val4 == (Object)(object)((BehaviorBase)this).m_aiActor || (Object.op_Implicit((Object)(object)((BraveBehaviour)val4).healthHaver) && ((BraveBehaviour)val4).healthHaver.PreventAllDamage)) { continue; } SpeculativeRigidbody specRigidbody = ((BraveBehaviour)val4).specRigidbody; if (specRigidbody != null && ((Behaviour)specRigidbody).isActiveAndEnabled) { PixelCollider pixelCollider = specRigidbody.GetPixelCollider((ColliderType)2); Vector2 val5 = ((pixelCollider != null) ? unitCenter.ClosestPointOnCollider(pixelCollider) : specRigidbody.UnitCenter); Vector2 val6 = unitCenter - val5; float sqrMagnitude = ((Vector2)(ref val6)).sqrMagnitude; if ((!((Object)(object)val3 != (Object)null) || !(sqrMagnitude >= num)) && (((GameActor)((BehaviorBase)this).m_aiActor).IsFlying || !absoluteRoomFromPosition.SeparatedByPit(unitCenter, val5))) { val3 = val4; num = sqrMagnitude; } } } } if (Object.op_Implicit((Object)(object)val3)) { m_behaviorSpeculator.PlayerTarget = (GameActor)(object)val3; m_prevDistToTarget = num; } } } if ((Object)(object)((BehaviorBase)this).m_aiShooter != (Object)null && (Object)(object)m_behaviorSpeculator.PlayerTarget != (Object)null) { ((BehaviorBase)this).m_aiShooter.AimAtPoint(m_behaviorSpeculator.PlayerTarget.CenterPosition); } if (Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiActor) && PauseOnTargetSwitch && ((BehaviorBase)this).m_aiActor.HasBeenEngaged && Object.op_Implicit((Object)(object)m_previousPlayer) && Object.op_Implicit((Object)(object)val2) && (Object)(object)m_previousPlayer != (Object)(object)val2) { ((BraveBehaviour)((BehaviorBase)this).m_aiActor).behaviorSpeculator.AttackCooldown = Mathf.Max(((BraveBehaviour)((BehaviorBase)this).m_aiActor).behaviorSpeculator.AttackCooldown, PauseTime); return (BehaviorResult)2; } m_previousPlayer = val2; if (Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiActor) && !((BehaviorBase)this).m_aiActor.HasBeenEngaged) { ((BehaviorBase)this).m_aiActor.HasBeenEngaged = true; return (BehaviorResult)2; } return (BehaviorResult)1; } return (BehaviorResult)0; } return (BehaviorResult)0; } } public class SlimyboiImmobileInCombatBehavior : OverrideBehaviorBase { private SlimyboiController _sloim; private PlayerController _owner; public override void Init(GameObject gameObject, AIActor aiActor, AIShooter aiShooter) { ((BehaviorBase)this).Init(gameObject, aiActor, aiShooter); _sloim = gameObject.GetComponent(); _owner = (Object.op_Implicit((Object)(object)_sloim) ? _sloim._owner : null); } public override BehaviorResult Update() { if (Object.op_Implicit((Object)(object)_owner) && _owner.IsInCombat && _sloim.attributes.IsSet(SlimyboiFlags.ImmobileInCombat)) { return (BehaviorResult)2; } return (BehaviorResult)0; } } public class SlimyboiDodgeBehavior : OverrideBehaviorBase { private const float _DODGE_TIME = 0.2f; private const int _NUM_AFTERIMAGES = 4; private SlimyboiController _sloim; private int _afterimagesDone; private float _dodgeStartTime; private float _dodgeEndTime; public override void Init(GameObject gameObject, AIActor aiActor, AIShooter aiShooter) { ((BehaviorBase)this).Init(gameObject, aiActor, aiShooter); _sloim = gameObject.GetComponent(); } public override BehaviorResult Update() { //IL_0081: 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_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) if (Object.op_Implicit((Object)(object)_sloim) && _sloim._queuedDodge) { _sloim._queuedDodge = false; _afterimagesDone = 0; _dodgeStartTime = BraveTime.ScaledTimeSinceStartup; _dodgeEndTime = _dodgeStartTime + 0.2f; ((Component)((BehaviorBase)this).m_aiActor).gameObject.PlayUnique("slime_dodge_sound"); SpawnManager.SpawnVFX(GameManager.Instance.Dungeon.dungeonDustups.rollLandDustup, Vector2.op_Implicit(((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition), Lazy.RandomEulerZ()); ((BehaviorBase)this).m_aiActor.BehaviorOverridesVelocity = true; ((BehaviorBase)this).m_aiActor.BehaviorVelocity = 5f * _sloim._dodgeVector; ((BehaviorBase)this).m_updateEveryFrame = true; return (BehaviorResult)4; } return (BehaviorResult)0; } public override ContinuousBehaviorResult ContinuousUpdate() { float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; if (!(scaledTimeSinceStartup >= _dodgeEndTime)) { int num = Mathf.FloorToInt((scaledTimeSinceStartup - _dodgeStartTime) / 0.2f * 4f); if (num > _afterimagesDone) { ((Component)_sloim._renderSprite.DuplicateInWorld()).gameObject.ExpireIn(0.2f, 0.2f, 0.5f); } _afterimagesDone = num; return (ContinuousBehaviorResult)0; } return (ContinuousBehaviorResult)1; } public override void EndContinuousUpdate() { //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) ((BehaviorBase)this).EndContinuousUpdate(); ((BehaviorBase)this).m_aiActor.BehaviorOverridesVelocity = false; ((BehaviorBase)this).m_aiActor.BehaviorVelocity = Vector2.zero; ((BehaviorBase)this).m_updateEveryFrame = false; } } 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 val = (_OverheadPrefabs[data] = data.CwaffCreateOverheadCard(selectCharacter)); value = val; } 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); private static readonly MethodInfo RegisterCharacterForPunchout = typeof(Hooks).GetMethod("RegisterCharacterForPunchout", BindingFlags.Static | BindingFlags.NonPublic); 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.nameShort.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(); CustomCharacter val = obj.AddComponent(); val.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) { spriteIdByName = Collection.GetSpriteIdByName(data.nameInternal + "_minimap_icon_001", -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); RegisterCharacterForPunchout.Invoke(null, new object[1] { val }); 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 RemoveAnimation(this tk2dSpriteAnimator animator, string animName) { _ = Collection; int clipIdByName = animator.Library.GetClipIdByName(animName); if (clipIdByName < 0) { return animator; } int num = animator.Library.clips.Length - 1; animator.Library.clips[clipIdByName] = animator.Library.clips[num]; Array.Resize(ref animator.Library.clips, num); return animator; } public static tk2dSpriteAnimator InitAnimations(this PlayerController pc, CustomCharacterData data, Dictionary fpsDict, List remove = null) { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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); if (remove != null) { foreach (string item in remove) { ((BraveBehaviour)pc).spriteAnimator.RemoveAnimation(item); } } tk2dSpriteAnimationClip[] clips = ((BraveBehaviour)pc).spriteAnimator.Library.clips; List list = new List(); 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; } } tk2dSpriteAnimationClip val4 = collection.AddAnimation(data.nameInternal + "_" + text + "_hand", val.name + "_hand", value, loopStart); if (val4 != null) { list.Add(val4); } tk2dSpriteAnimationClip val5 = collection.AddAnimation(data.nameInternal + "_" + text + "_twohands", val.name + "_twohands", value, loopStart); if (val5 != null) { list.Add(val5); } clips[i] = val3; } int num4 = ((BraveBehaviour)pc).spriteAnimator.Library.clips.Length; int num5 = num4 + list.Count; if (num5 > num4) { Array.Resize(ref ((BraveBehaviour)pc).spriteAnimator.Library.clips, num5); clips = ((BraveBehaviour)pc).spriteAnimator.Library.clips; for (int k = num4; k < num5; k++) { clips[k] = list[k - num4]; } } tk2dSpriteAnimationClip clipByName = ((BraveBehaviour)pc).spriteAnimator.Library.GetClipByName("idle"); ((BraveBehaviour)pc).sprite.SetSprite(clipByName.frames[0].spriteCollection, clipByName.frames[0].spriteId); 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 { 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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 (object)new WaitForSecondsRealtime(1f / 60f); SpriteOutlineManager.RemoveOutlineFromSprite(((BraveBehaviour)enemy).sprite, false); } } public class BossNPC : FancyNPC { public bool hasPreFightDialogue; public bool hasPostFightDialogue; public bool startedFight; public bool finishedFight; private BossController bossController; protected void StartBossFight() { AIActor component = ((Component)this).gameObject.GetComponent(); if ((Object)(object)bossController != (Object)null) { bossController.StartBossFight(component); } else { ETGModConsole.Log((object)"BOSS CONTROLLER SHOULD NEVER BE NULL", false); } ((Component)this).gameObject.GetComponent().TriggerSequence(GameManager.Instance.BestActivePlayer); startedFight = true; } public void SetBossController(BossController bc) { if (bossController == null) { bossController = bc; } } public void FinishBossFight() { ((MonoBehaviour)this).StartCoroutine(FinishBossFight_CR()); IEnumerator FinishBossFight_CR() { AIActor enemy = ((Component)this).gameObject.GetComponent(); Vector3Extensions.GetAbsoluteRoom(((BraveBehaviour)enemy).transform.position).RegisterInteractable((IPlayerInteractable)(object)this); IEnumerator script = DefeatedScript(); while (script.MoveNext()) { yield return script.Current; } Vector3Extensions.GetAbsoluteRoom(((BraveBehaviour)enemy).transform.position).UnsealRoom(); if (!hasPostFightDialogue) { ((BraveBehaviour)enemy).healthHaver.DeathAnimationComplete((tk2dSpriteAnimator)null, (tk2dSpriteAnimationClip)null); } finishedFight = true; } } protected override IEnumerator NPCTalkingScript() { IEnumerator script = (startedFight ? PostFightScript() : PreFightScript()); while (script.MoveNext()) { yield return script.Current; } } protected virtual IEnumerator PreFightScript() { GameManager.Instance.MainCameraController.OverridePosition = ((BraveBehaviour)((BraveBehaviour)this).sprite).transform.localPosition; GameManager.Instance.MainCameraController.SetManualControl(true, true); yield return Prompt("fight this guy", "don't fight this guy"); if (PromptResult() == 0) { StartBossFight(); } } protected virtual IEnumerator DefeatedScript() { yield break; } protected virtual IEnumerator PostFightScript() { yield break; } } public class BuildABoss { private GameObject defaultGunAttachPoint; private BraveBehaviour enemyBehavior; internal Anchor spriteAnchor; public GameObject prefab { get; private set; } public string guid { get; private set; } internal BossController bossController { get; private set; } private BuildABoss() { } public static BuildABoss LetsMakeABoss(string bossname, string guid, string defaultSprite, IntVector2 hitboxSize, string subtitle, string bossCardPath) where T : BraveBehaviour { //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_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_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_007d: 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_0086: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ef: 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_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Expected O, but got Unknown BuildABoss buildABoss = new BuildABoss(); buildABoss.guid = guid; buildABoss.prefab = BossBuilder.BuildPrefab(bossname, buildABoss.guid, defaultSprite, IntVector2.Zero, hitboxSize, false, true); buildABoss.enemyBehavior = (BraveBehaviour)(object)BH.AddSaneDefaultBossBehavior(buildABoss.prefab, bossname, subtitle, bossCardPath); buildABoss.bossController = BossController.NewPrefab(guid); tk2dBaseSprite anySprite = ETGMod.GetAnySprite((BraveBehaviour)(object)buildABoss.prefab.GetComponent()); Bounds bounds = anySprite.GetBounds(); Vector2 val = Vector2.op_Implicit(16f * ((Bounds)(ref bounds)).size); buildABoss.SetDefaultColliders((int)val.x, (int)val.y); GameObject val2 = new GameObject("attach"); val2.transform.parent = ((BraveBehaviour)buildABoss.enemyBehavior.specRigidbody).transform; val2.transform.position = Vector2.op_Implicit(buildABoss.enemyBehavior.specRigidbody.UnitCenter); val2.transform.localPosition = Vector2.op_Implicit(buildABoss.enemyBehavior.specRigidbody.UnitCenter); val2.transform.localScale = new Vector3(-1f, 1f, 1f); buildABoss.defaultGunAttachPoint = ((Component)buildABoss.enemyBehavior.transform.Find("attach")).gameObject; if ((Object)(object)((GameActor)buildABoss.enemyBehavior.aiActor).ShadowObject == (Object)null) { ((GameActor)buildABoss.enemyBehavior.aiActor).ShadowObject = Extensions.RegisterPrefab((GameObject)Object.Instantiate(ResourceCache.Acquire("DefaultShadowSprite"))); } return buildABoss; } public void SetStats(float? health = null, float? weight = null, float? speed = null, float? collisionDamage = null, float? collisionKnockbackStrength = null, float? hitReactChance = null, bool? healthIsNumberOfHits = null, float? invulnerabilityPeriod = null, bool? shareCooldowns = null, Anchor? spriteAnchor = null) { //IL_0183: 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 (health.HasValue) { ((BraveBehaviour)enemyBehavior.aiActor).healthHaver.SetHealthMaximum(health.Value, (float?)null, false); ((BraveBehaviour)enemyBehavior.aiActor).healthHaver.FullHeal(); } if (weight.HasValue) { ((BraveBehaviour)enemyBehavior.aiActor).knockbackDoer.weight = weight.Value; } if (speed.HasValue) { enemyBehavior.aiActor.MovementSpeed = speed.Value; } if (collisionDamage.HasValue) { enemyBehavior.aiActor.CollisionDamage = collisionDamage.Value; } if (collisionKnockbackStrength.HasValue) { enemyBehavior.aiActor.CollisionKnockbackStrength = collisionKnockbackStrength.Value; } if (hitReactChance.HasValue) { ((BraveBehaviour)enemyBehavior.aiActor).aiAnimator.HitReactChance = hitReactChance.Value; } if (healthIsNumberOfHits.HasValue) { ((BraveBehaviour)enemyBehavior.aiActor).healthHaver.healthIsNumberOfHits = healthIsNumberOfHits.Value; } if (invulnerabilityPeriod.HasValue) { ((BraveBehaviour)enemyBehavior.aiActor).healthHaver.invulnerabilityPeriod = invulnerabilityPeriod.Value; ((BraveBehaviour)enemyBehavior.aiActor).healthHaver.usesInvulnerabilityPeriod = invulnerabilityPeriod.Value > 0f; } if (shareCooldowns.HasValue) { enemyBehavior.behaviorSpeculator.AttackBehaviorGroup.ShareCooldowns = shareCooldowns.Value; } this.spriteAnchor = spriteAnchor.GetValueOrDefault(); } public void AddCustomMusic(string name, int loopAt = -1, int rewind = -1) { bossController.SetMusic(name, loopAt, rewind); } public ShootBehavior CreateBulletAttack(bool add = true, float cooldown = 0f, float cooldownVariance = 0f, float attackCooldown = 0f, float globalCooldown = 0f, float initialCooldown = 0.5f, float initialCooldownVariance = 0f, float probability = 1f, int maxUsages = -1, bool requiresLineOfSight = false, float minHealth = 0f, float maxHealth = 1f, float[] healthThresholds = null, bool accumulateHealthThresholds = true, float minRange = 0f, float range = 0f, float minWallDist = 0f, GameObject shootPoint = null, string fireAnim = null, string tellAnim = null, string chargeAnim = null, string finishAnim = null, float lead = 0f, float chargeTime = 0f, bool interruptible = false, bool clearGoop = false, float clearRadius = 2f, string vfx = null, string fireVfx = null, string tellVfx = null, string chargeVfx = null) where T : Script { return this.CreateBulletAttack(add, cooldown, cooldownVariance, attackCooldown, globalCooldown, initialCooldown, initialCooldownVariance, probability, maxUsages, requiresLineOfSight, minHealth, maxHealth, healthThresholds, accumulateHealthThresholds, minRange, range, minWallDist, shootPoint, fireAnim, tellAnim, chargeAnim, finishAnim, lead, chargeTime, interruptible, clearGoop, clearRadius, vfx, fireVfx, tellVfx, chargeVfx); } public M CreateBulletAttack(bool add = true, float cooldown = 0f, float cooldownVariance = 0f, float attackCooldown = 0f, float globalCooldown = 0f, float initialCooldown = 0.5f, float initialCooldownVariance = 0f, float probability = 1f, int maxUsages = -1, bool requiresLineOfSight = false, float minHealth = 0f, float maxHealth = 1f, float[] healthThresholds = null, bool accumulateHealthThresholds = true, float minRange = 0f, float range = 0f, float minWallDist = 0f, GameObject shootPoint = null, string fireAnim = null, string tellAnim = null, string chargeAnim = null, string finishAnim = null, float lead = 0f, float chargeTime = 0f, bool interruptible = false, bool clearGoop = false, float clearRadius = 2f, string vfx = null, string fireVfx = null, string tellVfx = null, string chargeVfx = null) where T : Script where M : ShootBehavior, new() { //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_0195: 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_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Expected O, but got Unknown if ((Object)(object)shootPoint == (Object)null) { shootPoint = defaultGunAttachPoint; } if (healthThresholds == null) { healthThresholds = new float[0]; } bool useVfx = !string.IsNullOrEmpty(vfx) || !string.IsNullOrEmpty(fireVfx) || !string.IsNullOrEmpty(tellVfx) || !string.IsNullOrEmpty(chargeVfx); M val = new M(); ((BasicAttackBehavior)(object)val).Cooldown = cooldown; ((BasicAttackBehavior)(object)val).CooldownVariance = cooldownVariance; ((BasicAttackBehavior)(object)val).AttackCooldown = attackCooldown; ((BasicAttackBehavior)(object)val).GlobalCooldown = globalCooldown; ((BasicAttackBehavior)(object)val).InitialCooldown = initialCooldown; ((BasicAttackBehavior)(object)val).InitialCooldownVariance = initialCooldownVariance; ((BasicAttackBehavior)(object)val).MaxUsages = maxUsages; ((BasicAttackBehavior)(object)val).RequiresLineOfSight = requiresLineOfSight; ((BasicAttackBehavior)(object)val).MinHealthThreshold = minHealth; ((BasicAttackBehavior)(object)val).MaxHealthThreshold = maxHealth; ((BasicAttackBehavior)(object)val).HealthThresholds = healthThresholds; ((BasicAttackBehavior)(object)val).AccumulateHealthThresholds = accumulateHealthThresholds; ((BasicAttackBehavior)(object)val).MinRange = minRange; ((BasicAttackBehavior)(object)val).Range = range; ((BasicAttackBehavior)(object)val).MinWallDistance = minWallDist; ((BasicAttackBehavior)(object)val).targetAreaStyle = null; ((ShootBehavior)val).ShootPoint = shootPoint; ((ShootBehavior)val).BulletScript = (BulletScriptSelector)new CustomBulletScriptSelector(typeof(T)); ((ShootBehavior)val).LeadAmount = lead; ((ShootBehavior)val).ChargeTime = chargeTime; ((ShootBehavior)val).FireAnimation = fireAnim; ((ShootBehavior)val).TellAnimation = tellAnim; ((ShootBehavior)val).ChargeAnimation = chargeAnim; ((ShootBehavior)val).PostFireAnimation = finishAnim; ((ShootBehavior)val).StopDuring = (StopType)2; ((ShootBehavior)val).Uninterruptible = !interruptible; ((ShootBehavior)val).ClearGoop = clearGoop; ((ShootBehavior)val).ClearGoopRadius = clearRadius; ((ShootBehavior)val).UseVfx = useVfx; ((ShootBehavior)val).Vfx = vfx; ((ShootBehavior)val).FireVfx = fireVfx; ((ShootBehavior)val).TellVfx = tellVfx; ((ShootBehavior)val).ChargeVfx = chargeVfx; M val2 = val; if (add) { AttackGroupItem item = new AttackGroupItem { Probability = probability, NickName = typeof(T).AssemblyQualifiedName, Behavior = (AttackBehaviorBase)(object)val2 }; prefab.GetComponent().AttackBehaviorGroup.AttackBehaviors.Add(item); } return val2; } public TeleportBehavior CreateTeleportAttack(bool add = true, float cooldown = 0f, float cooldownVariance = 0f, float attackCooldown = 0f, float globalCooldown = 0f, float initialCooldown = 0f, float initialCooldownVariance = 0f, float probability = 1f, int maxUsages = -1, bool requiresLineOfSight = false, float minHealth = 0f, float maxHealth = 1f, float[] healthThresholds = null, bool accumulateHealthThresholds = true, float minRange = 0f, float range = 0f, float minWallDist = 0f, bool vulnerable = false, bool avoidWalls = false, bool stayOnScreen = false, float minDist = 0f, float maxDist = 0f, float goneTime = 1f, bool onlyIfUnreachable = false, string outAnim = null, string inAnim = null, Type outScript = null, Type inScript = null, Rect? roomBounds = null, GameObject who = null) where T : TeleportBehavior, new() { //IL_0028: 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_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_0160: Unknown result type (might be due to invalid IL or missing references) //IL_014f: 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_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_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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_0247: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Expected O, but got Unknown if (healthThresholds == null) { healthThresholds = new float[0]; } CustomBulletScriptSelector teleportOutBulletScript = (((object)outScript == null || !outScript.IsSubclassOf(typeof(Bullet))) ? ((CustomBulletScriptSelector)null) : new CustomBulletScriptSelector(outScript)); CustomBulletScriptSelector teleportInBulletScript = (((object)inScript == null || !inScript.IsSubclassOf(typeof(Bullet))) ? ((CustomBulletScriptSelector)null) : new CustomBulletScriptSelector(inScript)); T val = new T(); ((BasicAttackBehavior)(object)val).Cooldown = cooldown; ((BasicAttackBehavior)(object)val).CooldownVariance = cooldownVariance; ((BasicAttackBehavior)(object)val).AttackCooldown = attackCooldown; ((BasicAttackBehavior)(object)val).GlobalCooldown = globalCooldown; ((BasicAttackBehavior)(object)val).InitialCooldown = initialCooldown; ((BasicAttackBehavior)(object)val).InitialCooldownVariance = initialCooldownVariance; ((BasicAttackBehavior)(object)val).MaxUsages = maxUsages; ((BasicAttackBehavior)(object)val).RequiresLineOfSight = requiresLineOfSight; ((BasicAttackBehavior)(object)val).MinHealthThreshold = minHealth; ((BasicAttackBehavior)(object)val).MaxHealthThreshold = maxHealth; ((BasicAttackBehavior)(object)val).HealthThresholds = healthThresholds; ((BasicAttackBehavior)(object)val).AccumulateHealthThresholds = accumulateHealthThresholds; ((BasicAttackBehavior)(object)val).MinRange = minRange; ((BasicAttackBehavior)(object)val).Range = range; ((BasicAttackBehavior)(object)val).MinWallDistance = minWallDist; ((BasicAttackBehavior)(object)val).targetAreaStyle = null; ((TeleportBehavior)val).AllowCrossRoomTeleportation = false; ((TeleportBehavior)val).ManuallyDefineRoom = roomBounds.HasValue; object obj = val; Vector2 roomMin; Rect value; if (!roomBounds.HasValue) { roomMin = Vector2.zero; } else { value = roomBounds.Value; roomMin = ((Rect)(ref value)).min; } ((TeleportBehavior)obj).roomMin = roomMin; object obj2 = val; Vector2 roomMax; if (!roomBounds.HasValue) { roomMax = Vector2.zero; } else { value = roomBounds.Value; roomMax = ((Rect)(ref value)).max; } ((TeleportBehavior)obj2).roomMax = roomMax; ((BasicAttackBehavior)(object)val).MaxEnemiesInRoom = 0f; ((TeleportBehavior)val).AttackableDuringAnimation = vulnerable; ((TeleportBehavior)val).AvoidWalls = avoidWalls; ((TeleportBehavior)val).StayOnScreen = stayOnScreen; ((TeleportBehavior)val).MinDistanceFromPlayer = minDist; ((TeleportBehavior)val).MaxDistanceFromPlayer = maxDist; ((TeleportBehavior)val).GoneTime = goneTime; ((TeleportBehavior)val).OnlyTeleportIfPlayerUnreachable = onlyIfUnreachable; ((TeleportBehavior)val).teleportOutAnim = outAnim; ((TeleportBehavior)val).teleportInAnim = inAnim; ((TeleportBehavior)val).teleportOutBulletScript = (BulletScriptSelector)(object)teleportOutBulletScript; ((TeleportBehavior)val).teleportInBulletScript = (BulletScriptSelector)(object)teleportInBulletScript; TeleportBehavior val2 = (TeleportBehavior)(object)val; if (add) { AttackGroupItem item = new AttackGroupItem { Probability = probability, NickName = typeof(T).AssemblyQualifiedName, Behavior = (AttackBehaviorBase)(object)val2 }; if (who == null) { who = prefab; } who.GetComponent().AttackBehaviorGroup.AttackBehaviors.Add(item); } return val2; } public BasicAttackBehavior CreateBasicAttack(bool add = true, float cooldown = 0f, float cooldownVariance = 0f, float attackCooldown = 0f, float globalCooldown = 0f, float initialCooldown = 0.5f, float initialCooldownVariance = 0f, float probability = 1f, int maxUsages = -1, bool requiresLineOfSight = false, float minHealth = 0f, float maxHealth = 1f, float[] healthThresholds = null, bool accumulateHealthThresholds = true, float minRange = 0f, float range = 0f, float minWallDist = 0f) where T : BasicAttackBehavior, new() { //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown if (healthThresholds == null) { healthThresholds = new float[0]; } T val = new T(); ((BasicAttackBehavior)val).Cooldown = cooldown; ((BasicAttackBehavior)val).CooldownVariance = cooldownVariance; ((BasicAttackBehavior)val).AttackCooldown = attackCooldown; ((BasicAttackBehavior)val).GlobalCooldown = globalCooldown; ((BasicAttackBehavior)val).InitialCooldown = initialCooldown; ((BasicAttackBehavior)val).InitialCooldownVariance = initialCooldownVariance; ((BasicAttackBehavior)val).MaxUsages = maxUsages; ((BasicAttackBehavior)val).RequiresLineOfSight = requiresLineOfSight; ((BasicAttackBehavior)val).MinHealthThreshold = minHealth; ((BasicAttackBehavior)val).MaxHealthThreshold = maxHealth; ((BasicAttackBehavior)val).HealthThresholds = healthThresholds; ((BasicAttackBehavior)val).AccumulateHealthThresholds = accumulateHealthThresholds; ((BasicAttackBehavior)val).MinRange = minRange; ((BasicAttackBehavior)val).Range = range; ((BasicAttackBehavior)val).MinWallDistance = minWallDist; ((BasicAttackBehavior)val).targetAreaStyle = null; BasicAttackBehavior val2 = (BasicAttackBehavior)(object)val; if (add) { AttackGroupItem item = new AttackGroupItem { Probability = probability, NickName = typeof(T).AssemblyQualifiedName, Behavior = (AttackBehaviorBase)(object)val2 }; prefab.GetComponent().AttackBehaviorGroup.AttackBehaviors.Add(item); } return val2; } public SimultaneousAttackBehaviorGroup CreateSimultaneousAttack(List attacks, bool add = true, float probability = 1f) { //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_000d: Expected O, but got Unknown //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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown SimultaneousAttackBehaviorGroup val = new SimultaneousAttackBehaviorGroup { AttackBehaviors = attacks }; if (add) { AttackGroupItem item = new AttackGroupItem { Probability = probability, Behavior = (AttackBehaviorBase)(object)val }; prefab.GetComponent().AttackBehaviorGroup.AttackBehaviors.Add(item); } return val; } public SequentialAttackBehaviorGroup CreateSequentialAttack(List attacks, List cooldownOverrides = null, bool add = true, float probability = 1f) { //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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown if (cooldownOverrides != null && cooldownOverrides.Count != attacks.Count) { cooldownOverrides = null; } SequentialAttackBehaviorGroup val = new SequentialAttackBehaviorGroup { AttackBehaviors = attacks, OverrideCooldowns = cooldownOverrides }; if (add) { AttackGroupItem item = new AttackGroupItem { Probability = probability, Behavior = (AttackBehaviorBase)(object)val }; prefab.GetComponent().AttackBehaviorGroup.AttackBehaviors.Add(item); } return val; } public TargetPlayerBehavior TargetPlayer(float radius = 35f, float searchInterval = 0.25f, float pauseTime = 0.25f, bool pauseOnTargetSwitch = false, bool lineOfSight = false, bool objectPermanence = true) { //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_0014: 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_0023: 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_0033: Expected O, but got Unknown TargetPlayerBehavior val = new TargetPlayerBehavior { Radius = radius, LineOfSight = lineOfSight, ObjectPermanence = objectPermanence, SearchInterval = searchInterval, PauseOnTargetSwitch = pauseOnTargetSwitch, PauseTime = pauseTime }; prefab.GetComponent().TargetBehaviors.Add((TargetBehaviorBase)(object)val); return val; } public void MakeInteractible(bool preFight = true, bool postFight = false, bool noOutlines = false, Vector2 talkPointOffset = default(Vector2)) where T : BossNPC { //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_005c: 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 (preFight) { prefab.GetComponent().triggerType = (TriggerType)20; } T val = prefab.AddComponent(); val.hasPreFightDialogue = preFight; val.hasPostFightDialogue = postFight; val.autoFlipSprite = false; val.noOutlines = noOutlines; val.talkPointAdjustment = Vector2.op_Implicit(talkPointOffset); } public void AddNamedVFX(VFXObject vfxobj, string name, Transform transformAnchor = null) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown VFXComplex val = new VFXComplex(); val.effects = (VFXObject[])(object)new VFXObject[1] { vfxobj }; AddNamedVFX(val, name, transformAnchor); } public void AddNamedVFX(VFXComplex complex, string name, Transform transformAnchor = null) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0008: Unknown result type (might be due to invalid IL or missing references) VFXPool val = new VFXPool(); val.type = (VFXPoolType)1; val.effects = (VFXComplex[])(object)new VFXComplex[1] { complex }; AddNamedVFX(val, name, transformAnchor); } public void AddNamedVFX(VFXPool pool, string name, Transform transformAnchor = null) { //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_0043: 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_0056: Expected O, but got Unknown if (enemyBehavior.aiAnimator.OtherVFX == null) { enemyBehavior.aiAnimator.OtherVFX = new List(); } enemyBehavior.aiAnimator.OtherVFX.Add(new NamedVFXPool { name = name, vfxPool = pool, anchorTransform = transformAnchor }); } public void SetDefaultColliders(int width, int height, int xoff = 0, int yoff = 0) { ((BraveBehaviour)enemyBehavior.aiActor).specRigidbody.SetDefaultColliders(width, height, xoff, yoff); } public void InitSpritesFromResourcePath(string spritePath) { //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_002d: Unknown result type (might be due to invalid IL or missing references) enemyBehavior.InitSpritesFromResourcePath(spritePath); Anchor anchor = spriteAnchor; tk2dSpriteDefinition[] spriteDefinitions = ((Component)enemyBehavior).GetComponent().spriteDefinitions; for (int i = 0; i < spriteDefinitions.Length; i++) { spriteDefinitions[i].BetterConstructOffsetsFromAnchor(anchor); } } public void AdjustAnimation(string name, float? fps = null, bool? loop = null, List eventFrames = null, List eventAudio = null, int loopFrame = 0) { enemyBehavior.AdjustAnimation(name, fps, loop, eventFrames, eventAudio, loopFrame); } public void SetIntroAnimations(string introAnim = null, string preIntroAnim = null) { if (introAnim != null) { prefab.GetComponent().introAnim = introAnim; } if (preIntroAnim != null) { prefab.GetComponent().preIntroAnim = preIntroAnim; } } public void AddBossToGameEnemies(string name) { Game.Enemies.Add(name, enemyBehavior.aiActor); } public void AddCustomIntro() where T : SpecificIntroDoer { prefab.AddComponent(); } public void AddBossToFloorPool(Floors floors, float weight = 1f) { prefab.AddBossToFloorPool(this, guid, floors, weight); } public PrototypeDungeonRoom CreateStandaloneBossRoom(int width, int height, bool exitOnBottom) { return prefab.CreateStandaloneBossRoom(this, width, height, exitOnBottom); } } public static class BH { public const string BULLET_KIN_GUID = "01972dee89fc4404a5c408d50007dad5"; private static BossManager theBossMan = null; public static Regex rx_anim = new Regex("^(?:([^_]*?)_)?(.*)_([0-9]+)\\.png$", RegexOptions.IgnoreCase | RegexOptions.Compiled); public static Regex rx_anim_no_ext = new Regex("^(?:([^_]*?)_)?(.*)_([0-9]+)$", RegexOptions.IgnoreCase | RegexOptions.Compiled); public static List Range(int start, int end) { return Enumerable.Range(start, end - start + 1).ToList(); } public static IEnumerator WaitForSecondsInvariant(float time) { for (float elapsed = 0f; elapsed < time; elapsed += GameManager.INVARIANT_DELTA_TIME) { yield return null; } } public static void CopySaneDefaultBehavior(this BehaviorSpeculator self, BehaviorSpeculator other) { self.OverrideBehaviors = other.OverrideBehaviors; self.OtherBehaviors = other.OtherBehaviors; self.InstantFirstTick = other.InstantFirstTick; self.TickInterval = other.TickInterval; self.PostAwakenDelay = other.PostAwakenDelay; self.RemoveDelayOnReinforce = other.RemoveDelayOnReinforce; self.OverrideStartingFacingDirection = other.OverrideStartingFacingDirection; self.StartingFacingDirection = other.StartingFacingDirection; self.SkipTimingDifferentiator = other.SkipTimingDifferentiator; } public static void SetDefaultColliders(this SpeculativeRigidbody self, int width, int height, int xoff = 0, int yoff = 0) { //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_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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0050: Expected O, but got Unknown self.PixelColliders.Clear(); for (int i = 0; i < 2; i++) { self.PixelColliders.Add(new PixelCollider { ColliderGenerationMode = (PixelColliderGeneration)0, CollisionLayer = (CollisionLayer)((i == 0) ? 3 : 2), ManualOffsetX = xoff, ManualOffsetY = yoff, ManualWidth = width, ManualHeight = height }); } } public static T AddSaneDefaultBossBehavior(GameObject prefab, string name, string subtitle, string bossCardPath = "") where T : BraveBehaviour { //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: 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_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0277: 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_0286: Expected O, but got Unknown //IL_02aa: Unknown result type (might be due to invalid IL or missing references) object obj = prefab.AddComponent(); ((BraveBehaviour)((BraveBehaviour)obj).aiActor).healthHaver.PreventAllDamage = false; ((GameActor)((BraveBehaviour)obj).aiActor).HasShadow = false; ((BraveBehaviour)obj).aiActor.IgnoreForRoomClear = false; ((BraveBehaviour)((BraveBehaviour)obj).aiActor).specRigidbody.CollideWithOthers = true; ((BraveBehaviour)((BraveBehaviour)obj).aiActor).specRigidbody.CollideWithTileMap = true; ((BraveBehaviour)obj).aiActor.PreventFallingInPitsEver = true; ((BraveBehaviour)obj).aiActor.procedurallyOutlined = false; ((BraveBehaviour)obj).aiActor.CanTargetPlayers = true; ((BraveBehaviour)obj).aiActor.PreventBlackPhantom = false; ((BraveBehaviour)obj).aiActor.CorpseObject = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5").CorpseObject; ((BraveBehaviour)((BraveBehaviour)obj).aiActor).healthHaver.SetHealthMaximum(1000f, (float?)null, false); ((BraveBehaviour)((BraveBehaviour)obj).aiActor).healthHaver.FullHeal(); ((BraveBehaviour)((BraveBehaviour)obj).aiActor).knockbackDoer.weight = 100f; ((BraveBehaviour)obj).aiActor.MovementSpeed = 1f; ((BraveBehaviour)obj).aiActor.CollisionDamage = 1f; ((BraveBehaviour)((BraveBehaviour)obj).aiActor).aiAnimator.HitReactChance = 0.05f; ((BraveBehaviour)obj).aiActor.CollisionKnockbackStrength = 5f; ((Object)prefab).name = name; string text = "#" + name.Replace(" ", "_").ToUpper(); Databases.Strings.Enemies.Set(text + "_NAME", name); Databases.Strings.Enemies.Set(text + "_SUBTITLE", subtitle); Databases.Strings.Enemies.Set(text + "_QUOTE", string.Empty); ((BraveBehaviour)((BraveBehaviour)obj).aiActor).healthHaver.overrideBossName = text + "_NAME"; ((GameActor)((BraveBehaviour)obj).aiActor).OverrideDisplayName = text + "_NAME"; ((GameActor)((BraveBehaviour)obj).aiActor).ActorName = text + "_NAME"; ((Object)((BraveBehaviour)obj).aiActor).name = text + "_NAME"; GenericIntroDoer val = AddSaneDefaultIntroDoer(prefab); if (!string.IsNullOrEmpty(bossCardPath)) { Texture2D textureFromResource = ResourceExtractor.GetTextureFromResource(bossCardPath, (Assembly)null); val.portraitSlideSettings = new PortraitSlideSettings { bossNameString = text + "_NAME", bossSubtitleString = text + "_SUBTITLE", bossQuoteString = text + "_QUOTE", bossSpritePxOffset = IntVector2.Zero, topLeftTextPxOffset = IntVector2.Zero, bottomRightTextPxOffset = IntVector2.Zero, bgColor = Color.cyan }; val.portraitSlideSettings.bossArtSprite = (Texture)(object)textureFromResource; val.SkipBossCard = false; ((BraveBehaviour)prefab.GetComponent().aiActor).healthHaver.bossHealthBar = (BossBarType)1; } else { val.SkipBossCard = true; ((BraveBehaviour)prefab.GetComponent().aiActor).healthHaver.bossHealthBar = (BossBarType)6; } val.SkipFinalizeAnimation = true; ((BraveBehaviour)val).RegenerateCache(); BehaviorSpeculator component = prefab.GetComponent(); component.CopySaneDefaultBehavior(((BraveBehaviour)EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5")).behaviorSpeculator); component.AttackBehaviorGroup.ShareCooldowns = true; component.AttackBehaviorGroup.AttackBehaviors = new List(); component.TargetBehaviors = new List(); return (T)((obj is T) ? obj : null); } public static GenericIntroDoer AddSaneDefaultIntroDoer(GameObject prefab) { //IL_0009: 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) GenericIntroDoer obj = prefab.AddComponent(); obj.triggerType = (TriggerType)10; obj.specifyIntroAiAnimator = null; obj.initialDelay = 0.15f; obj.cameraMoveSpeed = 14f; obj.introAnim = string.Empty; obj.introDirectionalAnim = string.Empty; obj.continueAnimDuringOutro = false; obj.BossMusicEvent = "Play_Nothing"; obj.PreventBossMusic = false; obj.InvisibleBeforeIntroAnim = false; obj.preIntroAnim = string.Empty; obj.preIntroDirectionalAnim = string.Empty; obj.cameraFocus = null; obj.roomPositionCameraFocus = Vector2.zero; obj.restrictPlayerMotionToRoom = false; obj.fusebombLock = false; obj.AdditionalHeightOffset = 0f; return obj; } public static void AddAnimation(this BraveBehaviour self, tk2dSpriteCollectionData collection, List ids, string name, float fps, bool loop, DirectionType direction = (DirectionType)0) { //IL_0008: 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_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_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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_008a: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown WrapMode val = (WrapMode)((!loop) ? 2 : 0); SpriteBuilder.AddAnimation(self.spriteAnimator, collection, ids, name, val, 15f).fps = fps; DirectionalAnimation val2 = new DirectionalAnimation { Type = direction, Prefix = name, AnimNames = new string[1], Flipped = (FlipType[])(object)new FlipType[1] }; if (name == "idle") { self.aiAnimator.IdleAnimation = val2; return; } AIAnimator aiAnimator = self.aiAnimator; (aiAnimator.OtherAnimations ?? (aiAnimator.OtherAnimations = new List())).Add(new NamedDirectionalAnimation { name = name, anim = val2 }); } public static void AdjustAnimation(this BraveBehaviour self, string name, float? fps = null, bool? loop = null, List eventFrames = null, List eventAudio = null, int loopFrame = 0) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) tk2dSpriteAnimationClip clipByName = self.spriteAnimator.GetClipByName(name); if (clipByName == null) { ETGModConsole.Log((object)("tried to modify sprite " + name + " which does not exist"), false); return; } if (fps.HasValue) { clipByName.fps = fps.Value; } if (loop.HasValue) { clipByName.wrapMode = (WrapMode)((!loop.Value) ? 2 : ((loopFrame > 0) ? 1 : 0)); clipByName.loopStart = loopFrame; } if (eventFrames == null) { return; } for (int i = 0; i < eventFrames.Count; i++) { clipByName.frames[eventFrames[i]].triggerEvent = true; if (eventAudio != null && eventAudio.Count > i) { clipByName.frames[eventFrames[i]].eventAudio = eventAudio[i]; } } } public static void InitSpritesFromResourcePath(this BraveBehaviour self, string resourcePath, int defaultFps = 15) { //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: 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) _ = resourcePath.Replace('/', '.') + "."; Dictionary dictionary = new Dictionary(); string value = resourcePath.Split(new char[1] { '/' }).Last(); foreach (string key in AtlasHelper._PackedTextures.Keys) { if (!key.StartsWith(value)) { continue; } string text = key; foreach (Match item in rx_anim_no_ext.Matches(text)) { _ = item.Groups[1].Value; string value2 = item.Groups[2].Value; string value3 = item.Groups[3].Value; if (!dictionary.ContainsKey(value2)) { dictionary[value2] = new string[0]; } int num = int.Parse(value3); if (num >= dictionary[value2].Length) { string[] array = dictionary[value2]; Array.Resize(ref array, num + 1); dictionary[value2] = array; } dictionary[value2][num] = text; } } tk2dSpriteCollectionData val = SpriteBuilder.ConstructCollection(((Component)self).gameObject, (((Object)((Component)self).gameObject).name + " Collection").Replace(" ", "_"), false); Object.DontDestroyOnLoad((Object)(object)val); int num2 = 0; foreach (KeyValuePair item2 in dictionary) { int start = num2; List list = new List(); string[] value4 = item2.Value; foreach (string text2 in value4) { if (!string.IsNullOrEmpty(text2)) { list.Add(text2); } } AtlasHelper.AddSpritesToCollection(list, val); num2 += list.Count; DirectionType direction = (DirectionType)1; self.AddAnimation(val, Range(start, num2 - 1), item2.Key, defaultFps, loop: true, direction); } } public static void AddObjectToRoom(PrototypeDungeonRoom room, Vector2 position, DungeonPlaceable PlacableContents = null, DungeonPlaceableBehaviour NonEnemyBehaviour = null, string EnemyBehaviourGuid = null, float SpawnChance = 1f, int xOffset = 0, int yOffset = 0, int layer = 0, int PathID = -1, int PathStartNode = 0) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0052: 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_005e: 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_006c: 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_007c: 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_0094: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)room == (Object)null) { return; } if (room.placedObjects == null) { room.placedObjects = new List(); } if (room.placedObjectPositions == null) { room.placedObjectPositions = new List(); } PrototypePlacedObjectData val = new PrototypePlacedObjectData { placeableContents = null, nonenemyBehaviour = null, spawnChance = SpawnChance, unspecifiedContents = null, enemyBehaviourGuid = string.Empty, contentsBasePosition = position, layer = layer, xMPxOffset = xOffset, yMPxOffset = yOffset, fieldData = new List(0), instancePrerequisites = (DungeonPrerequisite[])(object)new DungeonPrerequisite[0], linkedTriggerAreaIDs = new List(0), assignedPathIDx = PathID, assignedPathStartNode = PathStartNode }; if ((Object)(object)PlacableContents != (Object)null) { val.placeableContents = PlacableContents; } else if ((Object)(object)NonEnemyBehaviour != (Object)null) { val.nonenemyBehaviour = NonEnemyBehaviour; } else { if (EnemyBehaviourGuid == null) { return; } val.enemyBehaviourGuid = EnemyBehaviourGuid; } room.placedObjects.Add(val); room.placedObjectPositions.Add(position); } public static WeightedRoom GenerateWeightedRoom(PrototypeDungeonRoom Room, float Weight = 1f, bool LimitedCopies = true, int MaxCopies = 1, DungeonPrerequisite[] AdditionalPrerequisites = null) { //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_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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown if ((Object)(object)Room == (Object)null) { return null; } if (AdditionalPrerequisites == null) { AdditionalPrerequisites = (DungeonPrerequisite[])(object)new DungeonPrerequisite[0]; } return new WeightedRoom { room = Room, weight = Weight, limitedCopies = LimitedCopies, maxCopies = MaxCopies, additionalPrerequisites = AdditionalPrerequisites }; } public static PrototypeDungeonRoom GetGenericBossRoom(int width, int height, bool exitOnBottom) { //IL_000a: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_0031: 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) PrototypeDungeonRoom val = RoomFactory.CreateEmptyRoom(width, height); val.category = (RoomCategory)3; if (exitOnBottom) { val.exitData.exits.Clear(); RoomFactory.AddExit(val, new Vector2((float)(val.Width / 2), 0f), (Direction)4, (ExitType)1); RoomFactory.AddExit(val, new Vector2((float)(val.Width / 2), (float)val.Height), (Direction)0, (ExitType)2); } val.UseCustomMusicState = true; val.OverrideMusicState = (DungeonMusicState)30; val.roomEvents.Add(new RoomEventDefinition((RoomEventTriggerCondition)2, (RoomEventTriggerAction)1)); return val; } public static PrototypeDungeonRoom CreateStandaloneBossRoom(this GameObject self, BuildABoss bb, int width, int height, bool exitOnBottom) { //IL_0037: 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_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_0053: 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_005b: 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) PrototypeDungeonRoom genericBossRoom = GetGenericBossRoom(width, height, exitOnBottom); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f * (float)genericBossRoom.Width, 0.5f * (float)genericBossRoom.Height); tk2dBaseSprite anySprite = ETGMod.GetAnySprite((BraveBehaviour)(object)self.GetComponent()); Vector2 val2 = val - 2f * anySprite.GetRelativePositionFromAnchor(bb.spriteAnchor); AddObjectToRoom(genericBossRoom, dfVectorExtensions.Quantize(val2, 0.0625f), null, null, bb.guid); AddObjectToRoom(genericBossRoom, val, null, (DungeonPlaceableBehaviour)(object)bb.bossController); return genericBossRoom; } public static void AddBossToFloorPool(this GameObject self, BuildABoss bb, string guid, Floors floors = Floors.CASTLEGEON, float weight = 1f) { //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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_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_00d8: 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_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_00f0: 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_00fd: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_0133: 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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: 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_0175: Invalid comparison between Unknown and I4 if ((Object)(object)theBossMan == (Object)null) { theBossMan = GameManager.Instance.BossManager; } ValidTilesets val = (ValidTilesets)Enum.Parse(typeof(ValidTilesets), floors.ToString()); PrototypeDungeonRoom room = self.CreateStandaloneBossRoom(bb, 38, 27, exitOnBottom: false); GenericRoomTable val2 = ScriptableObject.CreateInstance(); ((Object)val2).name = ((Object)self).name + " Boss Table"; val2.includedRooms = new WeightedRoomCollection(); val2.includedRooms.elements = new List { GenerateWeightedRoom(room) }; val2.includedRoomTables = new List(0); IndividualBossFloorEntry val3 = new IndividualBossFloorEntry(); val3.BossWeight = weight; val3.TargetRoomTable = val2; val3.GlobalBossPrerequisites = (DungeonPrerequisite[])(object)new DungeonPrerequisite[1] { new DungeonPrerequisite { prerequisiteOperation = (PrerequisiteOperation)1, prerequisiteType = (PrerequisiteType)3, requiredTileset = val, requireTileset = true, comparisonValue = 1f, encounteredObjectGuid = string.Empty, maxToCheck = (TrackedMaximums)0, requireDemoMode = false, requireCharacter = false, requiredCharacter = (PlayableCharacters)0, requireFlag = false, useSessionStatValue = false, encounteredRoom = null, requiredNumberOfEncounters = -1, saveFlagToCheck = (GungeonFlags)2001, statToCheck = (TrackedStats)57 } }; IndividualBossFloorEntry item = val3; foreach (BossFloorEntry bossFloorDatum in theBossMan.BossFloorData) { if ((bossFloorDatum.AssociatedTilesets & val) > 0) { bossFloorDatum.Bosses.Add(item); } } } public static uint PlayBossMusic(this AIActor aiActor, string musicName, int loopPoint = -1, int rewindAmount = -1) { uint musicEventId = GameManager.Instance.DungeonMusicController.LoopMusic(musicName, loopPoint, rewindAmount); ((BraveBehaviour)aiActor).healthHaver.OnPreDeath += delegate { AkSoundEngine.StopPlayingID(musicEventId, 0, (AkCurveInterpolation)9); }; return musicEventId; } public static uint LoopMusic(this DungeonFloorMusicController musicController, string musicName, int loopPoint, int rewindAmount) { if (musicController.m_coreMusicEventID != 0) { AkSoundEngine.StopPlayingID(musicController.m_coreMusicEventID, 0, (AkCurveInterpolation)9); } uint num = (musicController.m_coreMusicEventID = AkSoundEngine.PostEvent(musicName, ((Component)musicController).gameObject, 1048576u)); if (loopPoint > 0 && rewindAmount > 0) { musicController.LoopMusic(num, musicName, loopPoint, rewindAmount); } return num; } public static void LoopMusic(this DungeonFloorMusicController musicController, uint musicPlayingEventId, string musicName, int loopPoint, int rewindAmount) { ((MonoBehaviour)musicController).StartCoroutine(LoopMusic_CR(musicPlayingEventId, musicName, loopPoint, rewindAmount)); static IEnumerator LoopMusic_CR(uint num, string text, int num3, int num4) { yield return (object)new WaitForSeconds(1f); int num2 = default(int); while ((int)AkSoundEngine.GetSourcePlayPosition(num, ref num2) == 1) { if (num2 >= num3) { AkSoundEngine.SeekOnEvent(text, ((Component)GameManager.Instance.DungeonMusicController).gameObject, num2 - num4); } yield return null; } } } } public class ArmisticeNPC : BossNPC { private bool _talkedOnce; protected override IEnumerator PreFightScript() { audioTag = "Lady"; defaultTalkAnimation = "talk"; defaultPauseAnimation = "calm"; GameManager.Instance.MainCameraController.OverridePosition = ((BraveBehaviour)((BraveBehaviour)this).sprite).transform.localPosition + new Vector3(0f, 2f, 0f); GameManager.Instance.MainCameraController.SetManualControl(true, true); bool num = (int)CustomTrackedStats.ENCOUNTERED_ARMI.Get() == 0; bool flag = !_talkedOnce; if (flag) { _talkedOnce = true; CustomTrackedStats.ENCOUNTERED_ARMI.Increment(); } if (num) { yield return Converse("Hunh...hello there."); yield return Converse("I don't see a lot of people down here."); yield return Converse("Actually, I don't think I've ever seen anyone else down here."); yield return Prompt("Where are we?"); yield return Converse("Technically, we're in the Abbey of the True Gun."); yield return Converse("A more interesting question would be \"when are we?\""); yield return Prompt("Okay... *when* are we?"); yield return Converse("We are suspended in time, at the exact moment the Gungeon was created."); yield return Prompt("How do you know this?"); yield return Converse("I've had ample time to reflect upon the existence of this place, believe me."); yield return Prompt("How did I end up here?", "How did you end up here?"); if (PromptResult() == 0) { yield return Converse("Presumably, the same way I did."); } else { yield return Converse("Presumably, the same way you did."); } yield return Converse("You entered the Gungeon to kill your past, and succeeded."); yield return Converse("You discovered a greater evil lurked within the Gungeon, and banished it."); yield return Converse("Something inexplicable drew you back to the Gungeon."); yield return Converse("You loaded and fired the Gun That Can Kill the Past once more, with no particular purpose in mind."); yield return Converse("...and now you're here, at the birth of the Gungeon."); yield return Converse("It's rather peaceful here, considering none of the Gundead have migrated beyond Bullet Hell yet."); yield return Converse("In my opinion, it's a very nice place to relax and reflect for a while."); yield return Prompt("...I'm sorry, but who are you?"); yield return Converse("Armistice. You can call me Armi if you'd like."); yield return Prompt("Am I stuck here?", "Are you stuck here?"); yield return Converse("Oh, no, we can leave at any time via the usual methods..."); yield return Converse("...taking the elevator in the room behind us.........or dying."); yield return Prompt("Where does the elevator lead?"); yield return Converse("Straight to Bullet Hell, the birthplace of the Gundead."); yield return Converse("It's a lot more crowded there now than it is in the present day."); yield return Converse("A lot harder to fight through as well."); yield return Prompt("...and you mentioned dying?"); yield return Converse("It's as temporary as ever, and very effective for leaving this place."); yield return Converse("Though there isn't much here that can kill you, besides me."); yield return Prompt("Is that a threat?", "You couldn't kill me if you tried!"); if (PromptResult() == 0) { yield return Converse("No, just an observation."); yield return Converse("On the contrary, I come here to get away from all of the fighting the rest of the Gungeon usually demands."); } else { yield return Converse("There's no need for hostility. It's a moot point in any case."); yield return Converse("I come here to get away from all of the fighting the rest of the Gungeon usually demands."); } yield return Converse("And I'm more than happy to share this space with you, should you desire to stay for a while."); yield return Converse("I'd truthfully prefer not to fight another Gungeoneer."); yield return Converse("..."); yield return Converse("Admittedly...your alternative way out of here isn't particularly pleasant for you."); yield return Converse("It's not as if dying here is permanent either."); yield return Converse("So...why not, I suppose we could fight if you'd prefer not going through Bullet Hell."); yield return Prompt("Not right now.", "Let's do it!"); if (PromptResult() == 0) { yield return Converse("Alright. I'm going back to meditating then. Feel free to stay as long as you'd like."); } else { yield return DoFightDialogue(); } } else { if (flag) { yield return Converse("Oh hey, you're back. What's up?"); } else { yield return Converse("Hello again. What's up?"); } yield return Prompt("Is there anything to do here?", "Let's fight!"); if (PromptResult() == 0) { yield return Converse("Not much. Time doesn't pass here, so I like coming here to meditate and relax."); yield return Converse("The walls don't seem to shift in here either. It's looked like this ever since I first came down here."); yield return Converse("...truthfully, this place could really use some decorating."); yield return Converse("Maybe later."); } else { yield return DoFightDialogue(); } } } private IEnumerator DoFightDialogue() { yield return Converse("Alright. Guess relaxation time's over."); yield return Converse("Good luck, you'll need it."); StartBossFight(); } protected override IEnumerator DefeatedScript() { Vector3Extensions.GetAbsoluteRoom(((Component)((BraveBehaviour)this).aiActor).gameObject.transform.position).m_hasGivenReward = true; ((GameActor)((BraveBehaviour)this).aiActor).StealthDeath = true; yield return (object)new WaitForSeconds(1.5f); talkPointAdjustment = Vector2.op_Implicit(new Vector2(-0.375f, 0.125f)); ShowText("Damn. See you around I guess.", 1f); yield return (object)new WaitForSeconds(1.25f); ((Component)this).gameObject.Play("armistice_defeat_teleport_sound"); ((BraveBehaviour)((BraveBehaviour)this).aiActor).aiAnimator.PlayUntilFinished("death", false, (string)null, -1f, false); while (((BraveBehaviour)((BraveBehaviour)this).aiActor).aiAnimator.IsPlaying("death")) { yield return null; } ((BraveBehaviour)((BraveBehaviour)this).aiActor).healthHaver.DeathAnimationComplete((tk2dSpriteAnimator)null, (tk2dSpriteAnimationClip)null); } protected override IEnumerator PostFightScript() { ShowText("Ugh.", 1f); yield break; } } [HarmonyPatch] internal static class ArmisticePatches { private class DidArmisticeDialogue : MonoBehaviour { } private static readonly List> WeightedEnemies = new List>(31) { new Tuple("01972dee89fc4404a5c408d50007dad5", 60), new Tuple("88b6b6a93d4b4234a67844ef4728382c", 30), new Tuple("70216cae6c1346309d86d4a0b4603045", 10), new Tuple("d4a9836f8ab14f3fadd0f597438b1f1f", 7), new Tuple("31a3ea0c54a745e182e22ea54844a82d", 10), new Tuple("c5b11bfc065d417b9c4d03a5e385fe2c", 5), new Tuple("4db03291a12144d69fe940d5a01de376", 12), new Tuple("0239c0680f9f467dbe5c4aab7dd1eca6", 20), new Tuple("e61cab252cfb435db9172adc96ded75f", 9), new Tuple("ed37fa13e0fa4fcf8239643957c51293", 15), new Tuple("7b0b1b6d9ce7405b86b75ce648025dd6", 15), new Tuple("8bb5578fba374e8aae8e10b754e61d62", 10), new Tuple("ec8ea75b557d4e7b8ceeaacdf6f8238c", 8), new Tuple("383175a55879441d90933b5c4e60cf6f", 5), new Tuple("6e972cd3b11e4b429b888b488e308551", 30), new Tuple("8a9e9bedac014a829a48735da6daf3da", 10), new Tuple("d5a7b95774cd41f080e517bea07bf495", 3), new Tuple("ac986dabc5a24adab11d48a4bccf4cb1", 11), new Tuple("c0260c286c8d4538a697c5bf24976ccf", 21), new Tuple("4d37ce3d666b4ddda8039929225b7ede", 21), new Tuple("c0ff3744760c4a2eb0bb52ac162056e6", 30), new Tuple("6f22935656c54ccfb89fca30ad663a64", 10), new Tuple("a400523e535f41ac80a43ff6b06dc0bf", 8), new Tuple("128db2f0781141bcb505d8f00f9e4d47", 15), new Tuple("b54d89f9e802455cbb2b8a96a31e8259", 15), new Tuple("206405acad4d4c33aac6717d184dc8d4", 50), new Tuple("c4fba8def15e47b297865b18e36cbef8", 10), new Tuple("9b2cf2949a894599917d4d391a0b7394", 5), new Tuple("56fb939a434140308b8f257f0f447829", 5), new Tuple("43426a2e39584871b287ac31df04b544", 5), new Tuple("cd4a4b7f612a4ba9a720b9f97c52f38c", 2) }; private static bool StartArmisticeDialogue(TalkDoerLite talker, bool didBulletPickup) { if (Object.op_Implicit((Object)(object)((Component)talker).gameObject.GetComponent())) { return false; } ((Component)talker).gameObject.AddComponent(); List dialogue = (didBulletPickup ? new List { "...hey... ", "You've already killed your past, right?", "Why do you need this bullet?", "Do you still have lingering regrets?" } : new List { "...hey... ", "You're not here to kill your past, right?", "Why do you need this bullet?", "Are you seeking something else?" }); talker.AddNewDialogState("pastRegrets", dialogue, replaceExisting: false, didBulletPickup ? "A few." : "No.", "affirmative", didBulletPickup ? "None at all." : "Yes.", "negative"); talker.AddNewDialogState("affirmative", new List { "I see.", "Off you go then." }); talker.AddNewDialogState("negative", new List { "Interesting... ", "The {wj}gun{w} and {wj}bullet{w} give those with regrets a chance to change their past.", "If you truly have no regrets, what will happen when you fire the {wj}gun{w}?", "... ", "Off you go then." }, replaceExisting: false, null, null, null, null, delegate { if (!didBulletPickup) { GameManager.Instance.BestActivePlayer.AcquirePassiveItemPrefabDirectly(Items.BulletThatCanKillThePast.AsPassive()); } CwaffRunData.Instance.noPastRegrets = true; }); talker.StartDialog("pastRegrets"); return true; } [HarmonyPatch(typeof(BulletThatCanKillThePast), "Pickup")] [HarmonyPrefix] private static void BulletThatCanKillThePastPickupPatch(BulletThatCanKillThePast __instance, PlayerController player) { if (!((GungeonFlags)19000).Get() || !((CharacterSpecificGungeonFlags)1000).Get() || ((PassiveItem)__instance).m_pickedUp) { return; } RoomHandler currentRoom = player.CurrentRoom; if (currentRoom == null) { return; } foreach (IPlayerInteractable roomInteractable in currentRoom.GetRoomInteractables()) { TalkDoerLite val = (TalkDoerLite)(object)((roomInteractable is TalkDoerLite) ? roomInteractable : null); if (val != null && Object.op_Implicit((Object)(object)val) && !(((Object)val).name != "NPC_Blacksmith")) { StartArmisticeDialogue(val, didBulletPickup: true); break; } } } [HarmonyPatch(typeof(TalkDoerLite), "Interact")] [HarmonyPrefix] private static bool TalkDoerLiteInteractPatch(TalkDoerLite __instance, PlayerController interactor) { if (((Object)__instance).name != "NPC_Blacksmith" || !interactor.AllowAlternateArmisticeAccess() || !StartArmisticeDialogue(__instance, didBulletPickup: false)) { return true; } return false; } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyILManipulator] private static void ArkControllerHandleClockhairPatchIL(ILContext il, MethodBase original) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_018b: 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_01cd: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); FieldInfo didShootHellTrigger = original.DeclaringType.GetEnumeratorField("didShootHellTrigger"); if (val.TryGotoNext((MoveType)2, new Func[3] { (Instruction instr) => ILPatternMatchingExt.MatchLdarg(instr, 0), (Instruction instr) => ILPatternMatchingExt.MatchLdarg(instr, 0), (Instruction instr) => ILPatternMatchingExt.MatchLdfld(instr, original.DeclaringType.FullName, didShootHellTrigger.Name) })) { val.CallPrivate(typeof(ArmisticePatches), "NoPastRegrets"); ILLabel nextPastCheck = null; ILLabel afterAllPastChecks = null; if (val.TryGotoNext((MoveType)0, new Func[6] { (Instruction instr) => ILPatternMatchingExt.MatchBr(instr, ref afterAllPastChecks), (Instruction instr) => ILPatternMatchingExt.MatchLdarg(instr, 0), (Instruction instr) => ILPatternMatchingExt.MatchLdfld(instr, original.DeclaringType.FullName, original.DeclaringType.GetEnumeratorField("shotPlayer").Name), (Instruction instr) => ILPatternMatchingExt.MatchLdfld(instr, "characterIdentity"), (Instruction instr) => ILPatternMatchingExt.MatchLdcI4(instr, 7), (Instruction instr) => ILPatternMatchingExt.MatchBneUn(instr, ref nextPastCheck) }) && val.TryGotoNext((MoveType)1, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdarg(instr, 0) })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldfld, original.DeclaringType.GetEnumeratorField("$this")); val.CallPrivate(typeof(ArmisticePatches), "CheckIfShouldGoToNoRegretsPast"); val.Emit(OpCodes.Brtrue, (object)afterAllPastChecks); } } } private static bool AllowAlternateArmisticeAccess(this PlayerController player) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 if (!((GungeonFlags)19000).Get()) { return false; } if ((int)player.characterIdentity == 10) { return false; } if ((int)player.characterIdentity == 9) { return ((GungeonFlags)52000).Get(); } if ((int)player.characterIdentity < 9) { return false; } CustomCharacter component = ((Component)player).gameObject.GetComponent(); if (component == null) { return true; } return !component.hasPast; } private static bool NoPastRegrets(bool oldValue) { if (!oldValue) { return CwaffRunData.Instance.noPastRegrets; } return true; } private static bool CheckIfShouldGoToNoRegretsPast(ArkController ark) { if (!CwaffRunData.Instance.noPastRegrets) { return false; } for (int i = 0; i < GameManager.Instance.AllPlayers.Length; i++) { PlayerController val = GameManager.Instance.AllPlayers[i]; if (((BraveBehaviour)val).healthHaver.IsAlive) { val.IsVisible = true; val.ClearInputOverride("ark"); val.ClearAllInputOverrides(); } } GameManager.Instance.LoadCustomLevel("cg_armisticefloor"); GameUIRoot.Instance.ToggleUICamera(false); return true; } [HarmonyPatch(typeof(RoomHandler), "SealRoom")] [HarmonyPrefix] private static void MaybeSpawnMoreEnemies(RoomHandler __instance, ref bool __state) { __state = !__instance.m_isSealed; } [HarmonyPatch(typeof(RoomHandler), "SealRoom")] [HarmonyPostfix] private static void SpawnMoreEnemies(RoomHandler __instance, bool __state) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Invalid comparison between Unknown and I4 //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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown //IL_0102: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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_01dd: Invalid comparison between Unknown and I4 //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Invalid comparison between Unknown and I4 //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Expected O, but got Unknown if (!__state || (int)GameManager.Instance.Dungeon.tileIndices.tilesetId != 128 || !CwaffRunData.Instance.scrambledBulletHell) { return; } RoomHandler currentRoom = GameManager.Instance.BestActivePlayer.CurrentRoom; if (currentRoom == null || (int)currentRoom.area.PrototypeRoomCategory == 3) { return; } bool flag = default(bool); IntVector2 targetCenter = currentRoom.GetCenteredVisibleClearSpot(2, 2, ref flag, false); if (!flag) { return; } FloodFillUtility.PreprocessContiguousCells(currentRoom, targetCenter, 0); int num = 0; int num2 = Mathf.Clamp(Mathf.Min(currentRoom.area.dimensions.x, currentRoom.area.dimensions.y) / 2, 3, 10); for (int i = 0; i < num2; i++) { string text = WeightedEnemies.WeightedRandom(); AIActor enemyPrefab = EnemyDatabase.GetOrLoadByGuid(text); bool checkContiguous = true; CellValidator val = (CellValidator)delegate(IntVector2 c) { //IL_0008: 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_0076: 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_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_0055: Unknown result type (might be due to invalid IL or missing references) if (checkContiguous && !FloodFillUtility.WasFilled(c)) { return false; } for (int j = 0; j < enemyPrefab.Clearance.x; j++) { for (int k = 0; k < enemyPrefab.Clearance.y; k++) { if (GameManager.Instance.Dungeon.data.isTopWall(c.x + j, c.y + k)) { return false; } if (IntVector2.Distance(targetCenter, c.x + j, c.y + k) < 4f) { return false; } } } return true; }; checkContiguous = true; IntVector2? randomAvailableCell = currentRoom.GetRandomAvailableCell((IntVector2?)enemyPrefab.Clearance, (CellTypes?)enemyPrefab.PathableTiles, false, val); if (!randomAvailableCell.HasValue) { checkContiguous = false; randomAvailableCell = currentRoom.GetRandomAvailableCell((IntVector2?)enemyPrefab.Clearance, (CellTypes?)enemyPrefab.PathableTiles, false, val); } if (randomAvailableCell.HasValue) { AIActor obj = AIActor.Spawn(enemyPrefab, randomAvailableCell.Value, currentRoom, true, (AwakenAnimationType)0, true); num++; obj.HandleReinforcementFallIntoRoom(0f); } } if (num <= 0) { return; } if (currentRoom.area.runtimePrototypeData != null) { bool flag2 = false; for (int num3 = 0; num3 < currentRoom.area.runtimePrototypeData.roomEvents.Count; num3++) { RoomEventDefinition val2 = currentRoom.area.runtimePrototypeData.roomEvents[num3]; if ((int)val2.condition == 2 && (int)val2.action == 1) { flag2 = true; } } if (!flag2) { currentRoom.area.runtimePrototypeData.roomEvents.Add(new RoomEventDefinition((RoomEventTriggerCondition)2, (RoomEventTriggerAction)1)); } } currentRoom.SealRoom(); } } public class MoveAndShootBehavior : ShootBehavior { public override BehaviorResult Update() { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_012a: 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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: 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_01de: Invalid comparison between Unknown and I4 if (((AttackBehaviorBase)this).IsReady()) { if (base.RequiresTarget && (Object)(object)((BasicAttackBehavior)this).m_behaviorSpeculator.TargetRigidbody == (Object)null) { return (BehaviorResult)0; } if (base.UseVfx && !string.IsNullOrEmpty(base.Vfx)) { ((BehaviorBase)this).m_aiAnimator.PlayVfx(base.Vfx, (Vector2?)null, (Vector2?)null, (Vector2?)null); } if (!((BehaviorBase)this).m_gameObject.activeSelf) { ((BehaviorBase)this).m_gameObject.SetActive(true); base.m_beganInactive = true; } if (Object.op_Implicit((Object)(object)((BasicAttackBehavior)this).m_behaviorSpeculator.TargetRigidbody)) { base.m_cachedTargetCenter = ((BasicAttackBehavior)this).m_behaviorSpeculator.TargetRigidbody.GetUnitCenter((ColliderType)2); } if (base.ClearGoop) { ((ShootBehavior)this).SetGoopClearing(true); } ((ShootBehavior)this).state = CwaffShootBehaviorState.Relocating; PrepareToRelocate(); if (base.MoveSpeedModifier != 1f) { base.m_cachedMovementSpeed = ((BehaviorBase)this).m_aiActor.MovementSpeed; AIActor aiActor = ((BehaviorBase)this).m_aiActor; aiActor.MovementSpeed *= base.MoveSpeedModifier; } if (base.LockFacingDirection) { ((BehaviorBase)this).m_aiAnimator.FacingDirection = Vector2Extensions.ToAngle(((BasicAttackBehavior)this).m_behaviorSpeculator.TargetRigidbody.GetUnitCenter((ColliderType)2) - base.m_specRigidbody.GetUnitCenter((ColliderType)2)); ((BehaviorBase)this).m_aiAnimator.LockFacingDirection = true; } if (base.PreventTargetSwitching && Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiActor)) { ((BehaviorBase)this).m_aiActor.SuppressTargetSwitch = true; } ((BehaviorBase)this).m_updateEveryFrame = true; if (base.OverrideBaseAnims && Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiAnimator)) { if (!string.IsNullOrEmpty(base.OverrideIdleAnim)) { ((BehaviorBase)this).m_aiAnimator.OverrideIdleAnimation = base.OverrideIdleAnim; } if (!string.IsNullOrEmpty(base.OverrideMoveAnim)) { ((BehaviorBase)this).m_aiAnimator.OverrideMoveAnimation = base.OverrideMoveAnim; } } if ((int)base.StopDuring != 0 && (int)base.StopDuring != 4) { return (BehaviorResult)4; } return (BehaviorResult)3; } return (BehaviorResult)0; } public override ContinuousBehaviorResult ContinuousUpdate() { //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_000e: 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_0038: Unknown result type (might be due to invalid IL or missing references) if (((ShootBehavior)this).state != CwaffShootBehaviorState.Relocating) { return ((ShootBehavior)this).ContinuousUpdate(); } if (Object.op_Implicit((Object)(object)((BasicAttackBehavior)this).m_behaviorSpeculator.TargetRigidbody)) { base.m_cachedTargetCenter = ((BasicAttackBehavior)this).m_behaviorSpeculator.TargetRigidbody.GetUnitCenter((ColliderType)2); } if (Relocate()) { if (!string.IsNullOrEmpty(base.ChargeAnimation)) { ((BehaviorBase)this).m_aiAnimator.PlayUntilFinished(base.ChargeAnimation, true, (string)null, -1f, false); ((ShootBehavior)this).state = (State)1; } else if (!string.IsNullOrEmpty(base.TellAnimation)) { if (!string.IsNullOrEmpty(base.TellAnimation)) { ((BehaviorBase)this).m_aiAnimator.PlayUntilCancelled(base.TellAnimation, true, (string)null, -1f, false); } else { ((BehaviorBase)this).m_aiAnimator.PlayUntilFinished(base.TellAnimation, true, (string)null, -1f, false); } ((ShootBehavior)this).state = (State)2; if (base.HideGun && Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiShooter)) { ((BehaviorBase)this).m_aiShooter.ToggleGunAndHandRenderers(false, "ShootBulletScript"); } } else { ((ShootBehavior)this).Fire(); } return (ContinuousBehaviorResult)0; } return (ContinuousBehaviorResult)0; } protected internal virtual void PrepareToRelocate(Vector2? overridePos = null) { } protected internal virtual bool Relocate() { return true; } } public class ArmisticeBoss : AIActor { private class ArmisticeMoveAndShootBehavior : MoveAndShootBehavior { private const float _MAX_RELOCATE_TIME = 0.75f; private const float _MIN_RELOCATE_SPEED = 40f; private const float _AFTERIMAGE_RATE = 0.05f; private Rect _roomBounds; private Vector2 _startPos; private Vector2 _targetPos; private Vector2 _targetDelta; private float _travelStartTime; private float _travelEndTime; private float _travelDeltaTime; private Transform _transform; private SpeculativeRigidbody _body; private float _nextAfterimage; private PlayerController _targetPlayer; private void DetermineTarget() { //IL_0006: 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_0029: 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_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_0064: 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_0194: Unknown result type (might be due to invalid IL or missing references) //IL_017e: 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) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0283: 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_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) bool flag = ((GameActor)_targetPlayer).CenterPosition.x < ((Rect)(ref _roomBounds)).center.x; _ = ((GameActor)_targetPlayer).CenterPosition; _ = ((Rect)(ref _roomBounds)).center; bool flag2 = ((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition.x < ((Rect)(ref _roomBounds)).center.x; _ = ((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition; _ = ((Rect)(ref _roomBounds)).center; string text = ((ShootBehavior)this).BulletScript.scriptTypeName.Split(new char[1] { '+' })[1].Split(new char[1] { ',' })[0]; if (text == null) { return; } float num; switch (text.Length) { case 18: switch (text[2]) { case 's': if (text == "LaserBarrageScript") { _targetPos = new Vector2(flag ? ((Rect)(ref _roomBounds)).xMax : ((Rect)(ref _roomBounds)).xMin, ((Rect)(ref _roomBounds)).center.y); } break; case 't': if (text == "MeteorShowerScript") { _targetPos = new Vector2(((Rect)(ref _roomBounds)).xMin + (flag2 ? 0.75f : 0.25f) * ((Rect)(ref _roomBounds)).width, ((Rect)(ref _roomBounds)).center.y + Random.Range(-0.4f, -0.3f) * ((Rect)(ref _roomBounds)).height); } break; case 'g': if (text == "MagicMissileScript") { _targetPos = new Vector2(((Rect)(ref _roomBounds)).xMin + (flag2 ? 0.75f : 0.25f) * ((Rect)(ref _roomBounds)).width, ((Rect)(ref _roomBounds)).center.y + 0.4f * ((Rect)(ref _roomBounds)).height); } break; } break; case 19: if (text == "ClocksTickingScript") { _targetPos = ((Rect)(ref _roomBounds)).center; } break; case 16: if (!(text == "BoneTunnelScript")) { break; } goto IL_0189; case 15: if (!(text == "TrickshotScript")) { break; } goto IL_0189; case 12: if (!(text == "SniperScript")) { break; } goto IL_0189; case 13: if (text == "BoxTrotScript") { _targetPos = new Vector2(((Rect)(ref _roomBounds)).xMin + (flag2 ? 0.75f : 0.25f).AddRandomSpread(0.1f) * ((Rect)(ref _roomBounds)).width, ((Rect)(ref _roomBounds)).center.y + Random.Range(-0.2f, 0.2f) * ((Rect)(ref _roomBounds)).height); } break; case 14: case 17: break; IL_0189: num = Mathf.Clamp(((BraveBehaviour)_targetPlayer).sprite.WorldBottomCenter.y, ((Rect)(ref _roomBounds)).yMin, ((Rect)(ref _roomBounds)).yMax); _targetPos = new Vector2(((Rect)(ref _roomBounds)).xMin + (flag ? 1f : 0f) * ((Rect)(ref _roomBounds)).width, num); break; } } protected internal override void PrepareToRelocate(Vector2? overridePos = null) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_004e: 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_006a: 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_0083: 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_00a8: 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_00b8: Unknown result type (might be due to invalid IL or missing references) _transform = ((BehaviorBase)this).m_gameObject.transform; _body = ((BehaviorBase)this).m_gameObject.GetComponent(); _startPos = Vector2.op_Implicit(_transform.position); _roomBounds = Vector3Extensions.GetAbsoluteRoom(_startPos).GetBoundingRect().Inset(2f); _targetPlayer = GameManager.Instance.GetRandomActivePlayer(); _targetPos = new PathRect(_roomBounds).At(Random.value, Random.value); if (overridePos.HasValue) { _targetPos = overridePos.Value; } else { DetermineTarget(); } _targetDelta = _targetPos - _startPos; _travelStartTime = BraveTime.ScaledTimeSinceStartup; _travelDeltaTime = Mathf.Min(((Vector2)(ref _targetDelta)).magnitude / 40f, 0.75f); _travelEndTime = _travelStartTime + _travelDeltaTime; if (_travelDeltaTime >= BraveTime.DeltaTime) { ((BehaviorBase)this).m_aiAnimator.PlayUntilCancelled("run", true, (string)null, -1f, false); ((BraveBehaviour)((BehaviorBase)this).m_aiActor).sprite.FlipX = _targetPos.x < _startPos.x; } } protected internal override bool Relocate() { //IL_0020: 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_0061: 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_00ba: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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) float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; if (scaledTimeSinceStartup >= _travelEndTime) { ((BraveBehaviour)((BehaviorBase)this).m_aiActor).sprite.FlipX = _transform.position.x > ((Rect)(ref _roomBounds)).center.x; ((BehaviorBase)this).m_aiAnimator.PlayUntilCancelled("idle", true, (string)null, -1f, false); _transform.position = Vector2.op_Implicit(_targetPos); _body.Reinitialize(); return true; } if (scaledTimeSinceStartup >= _nextAfterimage) { ((BraveBehaviour)((BehaviorBase)this).m_aiActor).sprite.SpriteAfterImage(); _nextAfterimage = scaledTimeSinceStartup + 0.05f; } float num = (scaledTimeSinceStartup - _travelStartTime) / _travelDeltaTime; _transform.position = Vector2.op_Implicit(_startPos + num * _targetDelta); _body.Reinitialize(); return false; } } private class SecretBullet : Bullet { private static readonly Color _DefaultTint = new Color(1f, 0.5f, 0.5f, 0.5f); private Color? _tint; private float _emission; private float _emitColorPower; private bool _fancySpawn; private Shader _originalShader; protected int originalLayer = -1; protected GameObject _trail; public SecretBullet(Color? tint = null, float emission = 10f, float emitColorPower = 1.5f, bool fancySpawn = false, string baseProj = "getboned") : base(baseProj, false, false, false) { _tint = tint; _emission = emission; _emitColorPower = emitColorPower; _fancySpawn = fancySpawn; } public void AddTrail(CwaffTrailController trailPrefab, float glow = -1f) { _trail = ((Component)((BraveBehaviour)(object)base.Projectile).AddTrail(trailPrefab)).gameObject; if (glow >= 0f) { _trail.SetGlowiness(glow); } } protected virtual void OnBaseDestruction(Projectile projectile) { //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) if (Object.op_Implicit((Object)(object)_trail)) { _trail.GetComponent().DisconnectFromSpecRigidbody(); _trail = null; } if (originalLayer > -1) { GameObjectExtensions.SetLayerRecursively(((Component)projectile).gameObject, originalLayer); originalLayer = -1; } if (_fancySpawn) { GameObject bulletSpawnVFX = _BulletSpawnVFX; Vector3 position = Vector2.op_Implicit(projectile.SafeCenter); float? startScale = 0.5f; float? endScale = 0.1f; CwaffVFX.Spawn(bulletSpawnVFX, position, null, null, 0f, null, 0f, null, fadeIn: false, startScale, endScale); } tk2dBaseSprite sprite = ((BraveBehaviour)projectile).sprite; if (Object.op_Implicit((Object)(object)sprite) && sprite.usesOverrideMaterial) { sprite.usesOverrideMaterial = false; if (Object.op_Implicit((Object)(object)((BraveBehaviour)sprite).renderer) && Object.op_Implicit((Object)(object)((BraveBehaviour)sprite).renderer.material)) { ((BraveBehaviour)sprite).renderer.material.shader = _originalShader; } } projectile.OnDestruction -= OnBaseDestruction; } public override void Initialize() { //IL_0024: 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_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) base.Projectile.ChangeTintColorShader(0f, (Color)(((??)_tint) ?? _DefaultTint)); base.Projectile.OnDestruction += OnBaseDestruction; if (_fancySpawn) { GameObject bulletSpawnVFX = _BulletSpawnVFX; Vector3 position = Vector2.op_Implicit(base.Projectile.SafeCenter); float? startScale = 0.1f; float? endScale = 1f; Transform transform = ((Component)base.Projectile).gameObject.transform; CwaffVFX.Spawn(bulletSpawnVFX, position, null, null, 0f, null, 0f, null, fadeIn: false, startScale, endScale, null, randomFrame: false, -1, flipX: false, flipY: false, transform); } Material material = ((BraveBehaviour)((BraveBehaviour)base.Projectile).sprite).renderer.material; material.SetFloat(CwaffVFX._EmissivePowerId, _emission); material.SetFloat(CwaffVFX._EmissiveColorPowerId, _emitColorPower); _originalShader = material.shader; ((Bullet)this).Initialize(); } } private abstract class ArmisticeBulletScript : FluidBulletScript { private static readonly string[] _IdleAnims = new string[3] { "idle", "tired", "exhausted" }; protected AIActor theBoss { get; private set; } protected HealthHaver hh { get; private set; } protected Rect roomFullBounds { get; private set; } protected Rect roomBulletBounds { get; private set; } protected Rect roomSlamBounds { get; private set; } public override void Initialize() { //IL_0034: 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_0059: 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_007e: Unknown result type (might be due to invalid IL or missing references) ((Bullet)this).Initialize(); theBoss = ((BraveBehaviour)((Bullet)this).BulletBank).aiActor; hh = ((BraveBehaviour)theBoss).healthHaver; roomFullBounds = ((DungeonPlaceableBehaviour)theBoss).GetAbsoluteParentRoom().GetBoundingRect(); roomBulletBounds = roomFullBounds.Inset(2f, 2f, 4f, 2f); roomSlamBounds = roomFullBounds.Inset(2f, 2.5f, 2f, 1.5f); } public IEnumerator Relocate(Vector2? overridePos = null) { BehaviorBase val = ((BraveBehaviour)((BraveBehaviour)((Bullet)this).BulletBank).aiActor).behaviorSpeculator.ActiveContinuousAttackBehavior; if (val == null) { yield break; } while (true) { AttackBehaviorGroup val2 = (AttackBehaviorGroup)(object)((val is AttackBehaviorGroup) ? val : null); if (val2 == null || val2.CurrentBehavior == null) { break; } val = (BehaviorBase)(object)val2.CurrentBehavior; } if (val is ArmisticeMoveAndShootBehavior amb) { float oldScale = ((Bullet)this).TimeScale; ((Bullet)this).TimeScale = -1f; amb.PrepareToRelocate(overridePos); while (!amb.Relocate()) { yield return ((Bullet)this).Wait(0); } ((Bullet)this).TimeScale = oldScale; } } public int GetPhase() { float num = hh.currentHealth / hh.maximumHealth; if (!(num > 0.67f)) { if (num > 0.34f) { return 1; } return 2; } return 0; } public string IdleForPhase() { return _IdleAnims[GetPhase()]; } public int IntForPhase(int[] ints) { return ints[Mathf.Min(GetPhase(), ints.Length - 1)]; } public float FloatForPhase(float[] floats) { return floats[Mathf.Min(GetPhase(), floats.Length - 1)]; } } private class CrossBulletsScript : ArmisticeBulletScript { internal class CrossBullet : SecretBullet { private const int LIFETIME = 30; private const int VANISHTIME = 120; private Vector2 gravity = Vector2.zero; private Vector2 startVelocity = Vector2.zero; private Vector2 target = Vector2.zero; private Rect roomFullBounds; private bool snapped; public CrossBullet(Vector2 velocity, Vector2 gravity, Vector2 target, Rect roomFullBounds) { //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_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_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_0041: 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_0048: 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: 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_0056: 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) this.gravity = gravity; startVelocity = velocity; this.target = target; this.roomFullBounds = roomFullBounds; } public override void Initialize() { base.Initialize(); ((BraveBehaviour)((Bullet)this).Projectile).specRigidbody.CollideWithTileMap = false; ((BraveBehaviour)((Bullet)this).Projectile).specRigidbody.CollideWithOthers = false; } public override IEnumerator Top() { originalLayer = ((Component)((Bullet)this).Projectile).gameObject.layer; GameObjectExtensions.SetLayerRecursively(((Component)((Bullet)this).Projectile).gameObject, LayerMask.NameToLayer("Unoccluded")); Vector2 newVelocity = startVelocity; float prevTime = BraveTime.ScaledTimeSinceStartup; int i = 0; while (i < 120) { if (i >= 30 && ((Rect)(ref roomFullBounds)).Contains(((Bullet)this).Position)) { ((BraveBehaviour)((Bullet)this).Projectile).specRigidbody.CollideWithTileMap = true; ((BraveBehaviour)((Bullet)this).Projectile).specRigidbody.CollideWithOthers = true; } if (snapped) { yield return ((Bullet)this).Wait(1); } else if (newVelocity.y < 0f) { Vector2 val = target - ((Bullet)this).Position; ((Bullet)this).ChangeDirection(new Direction(Vector2Extensions.ToAngle(val), (DirectionType)1, -1f), 1); ((Bullet)this).ChangeSpeed(new Speed(100f, (SpeedType)0), 1); ((Component)((Bullet)this).Projectile).gameObject.PlayUnique("subtractor_beam_fire_sound"); snapped = true; yield return ((Bullet)this).Wait(1); _trail = ((Component)((BraveBehaviour)(object)((Bullet)this).Projectile).AddTrail(SubtractorBeam._RedTrailPrefab)).gameObject; _trail.SetGlowiness(100f); } else { newVelocity += gravity * (BraveTime.ScaledTimeSinceStartup - prevTime); prevTime = BraveTime.ScaledTimeSinceStartup; ((Bullet)this).ChangeDirection(new Direction(Vector2Extensions.ToAngle(newVelocity), (DirectionType)1, -1f), 1); ((Bullet)this).ChangeSpeed(new Speed(((Vector2)(ref newVelocity)).magnitude, (SpeedType)0), 1); yield return ((Bullet)this).Wait(1); } int num = i + 1; i = num; } ((Bullet)this).Vanish(false); } } private const int BATCHES = 10; private const int BATCHSIZE = 3; private const int COUNT = 30; private const float SPREAD = 9f; private const float GRAVITY = 200f; private const float BASESPEED = 70f; private const float STRIKESPEED = 100f; private const int SHOTDELAY = 3; private PathRect bounds; protected override List BuildChain() { //IL_0002: 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_0037: Unknown result type (might be due to invalid IL or missing references) bounds = new PathRect(base.roomSlamBounds); return Run(SprayBullets(new Vector2(0.5f, 1f))).And(SprayBullets(new Vector2(-0.5f, 1f))).Finish(); } private IEnumerator SprayBullets(Vector2 startDir) { //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) Vector2 target = bounds.At(0.5f, 0.2f); Vector2 gravity = new Vector2(0f, -200f); Speed s = new Speed(70f, (SpeedType)0); Offset o = Offset.OverridePosition(((GameActor)base.theBoss).CenterPosition); ((Component)base.theBoss).gameObject.Play("armistice_laugh_2"); int b = 0; int i = 0; while (i < 30) { Vector2 val = (70f * ((Vector2)(ref startDir)).normalized).Rotate(Random.Range(-9f, 9f)); Direction val2 = new Direction(Vector2Extensions.ToAngle(val).Clamp180(), (DirectionType)1, -1f); ((Bullet)this).Fire(o, val2, s, (Bullet)(object)new CrossBullet(val, gravity, target + Lazy.RandomVector(2f * Random.value), base.roomFullBounds)); int num = b + 1; b = num; if (num % 3 == 0) { yield return ((Bullet)this).Wait(3); } num = i + 1; i = num; } } } private class ClocksTickingScript : ArmisticeBulletScript { internal class ClocksTickingBullet : SecretBullet { private const float _REST_TIME = 0.35f; internal const float _SPAWN_RADIUS = 32f; private ClocksTickingScript _parent; private Vector2 _spawnCenter; private float _spawnTime; private float _spawnRadius; private float _restRadius; private float _spawnAngle; private float _rps; public ClocksTickingBullet(ClocksTickingScript parent, Vector2 spawnCenter, float spawnTime, float spawnRadius, float restRadius, float spawnAngle, float rps) : base(null, 10f, 1.5f, fancySpawn: true) { //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) _parent = parent; _spawnCenter = spawnCenter; _spawnTime = spawnTime; _spawnRadius = spawnRadius; _restRadius = restRadius; _spawnAngle = spawnAngle; _rps = rps; ((Bullet)this).ManualControl = true; ((Bullet)this).TimeScale = -1f; ((Bullet)this).EndOnBlank = true; } public override void Initialize() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown base.Initialize(); SpeculativeRigidbody specRigidbody = ((BraveBehaviour)((Bullet)this).Projectile).specRigidbody; specRigidbody.CollideWithTileMap = false; 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)otherRigidbody) || !Object.op_Implicit((Object)(object)((Component)otherRigidbody).gameObject.GetComponent())) { PhysicsEngine.SkipCollision = true; } } public override IEnumerator Top() { float topTime = BraveTime.ScaledTimeSinceStartup; while (true) { float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; float num = scaledTimeSinceStartup - topTime; float num2 = scaledTimeSinceStartup - _spawnTime; if (num2 > 6f) { break; } float num3 = _restRadius; if (num < 0.35f) { num3 += (1f - Ease.OutCubic(num / 0.35f)) * (_spawnRadius - _restRadius); } float num4 = 360f * num2 * _rps; ((Bullet)this).Position = _spawnCenter + (_spawnAngle + num4).ToVector(num3); yield return ((Bullet)this).Wait(1); } float vanishTime = BraveTime.ScaledTimeSinceStartup + 0.5f * Random.value; while (BraveTime.ScaledTimeSinceStartup < vanishTime) { yield return ((Bullet)this).Wait(1); } ((Bullet)this).Vanish(true); } } private const float _LIFETIME = 6f; private const float _GAP = 1.4f; private float _time; protected override List BuildChain() { ((Component)((BraveBehaviour)((Bullet)this).BulletBank).aiActor).gameObject.Play("armistice_clocks_ticking_sound"); ((Bullet)this).EndOnBlank = true; int phase = GetPhase(); FluidBulletInfo fluidBulletInfo = Run(Attack(14f, -0.85f, 70f, playSounds: false)); if (phase >= 1) { fluidBulletInfo = fluidBulletInfo.And(Attack(11f, -0.625f, 90f, playSounds: false)); } if (phase >= 2) { fluidBulletInfo = fluidBulletInfo.And(Attack(8f, -0.3f, 110f, playSounds: true)); } return fluidBulletInfo.And(Flood(14f, 0.15f, -90f, 0.75f)).Finish(); } private IEnumerator Flood(float radius, float rps, float offAngle, float spawnRps) { int iStart = Mathf.FloorToInt(radius / 1.4f); int iEnd = Mathf.FloorToInt(18.571428f); float start = BraveTime.ScaledTimeSinceStartup; Rect val = base.roomFullBounds; Vector2 center = ((Rect)(ref val)).center; float baseAngle = (Vector2Extensions.ToAngle(center - ((GameActor)GameManager.Instance.BestActivePlayer).CenterPosition) + offAngle).Clamp360(); int curBand = 0; while (curBand < 40) { _time = BraveTime.ScaledTimeSinceStartup; float num = 360f * (_time - start) * rps; int num2 = Mathf.CeilToInt(40f * (_time - start) * spawnRps); if (curBand >= num2) { yield return ((Bullet)this).Wait(1); continue; } int num3 = curBand + 1; curBand = num3; float num4 = curBand * 9; for (int i = iStart; i <= iEnd; i++) { float restRadius = (float)i * 1.4f; Vector2 val2 = center + (baseAngle + num4 + num).ToVector(32f); ((Bullet)this).Fire(Offset.OverridePosition(val2), new Direction(0f, (DirectionType)1, -1f), new Speed(0f, (SpeedType)0), (Bullet)(object)new ClocksTickingBullet(this, center, start, 32f, restRadius, baseAngle + num4, rps)); } } } private IEnumerator Attack(float radius, float rps, float offAngle, bool playSounds) { float start = BraveTime.ScaledTimeSinceStartup; int count = Mathf.FloorToInt(radius / 1.4f); Rect val = base.roomFullBounds; Vector2 center = ((Rect)(ref val)).center; float baseAngle = (Vector2Extensions.ToAngle(center - ((GameActor)GameManager.Instance.BestActivePlayer).CenterPosition) + offAngle).Clamp360(); int i = 1; while (i <= count) { _time = BraveTime.ScaledTimeSinceStartup; float restRadius = 1.4f * (float)i; float num = 360f * (_time - start) * rps; ((Bullet)this).Fire(Offset.OverridePosition(center + (baseAngle + num).ToVector(32f)), new Direction(0f, (DirectionType)1, -1f), new Speed(0f, (SpeedType)0), (Bullet)(object)new ClocksTickingBullet(this, center, start, 32f, restRadius, baseAngle, rps)); yield return ((Bullet)this).Wait(3); int num2 = i + 1; i = num2; } float endTime = start + 6f; float nextSound = _time; int c = 0; while (_time < endTime) { yield return ((Bullet)this).Wait(1); _time = BraveTime.ScaledTimeSinceStartup; if (playSounds && _time >= nextSound) { nextSound += 1f / 3f; ((Component)((BraveBehaviour)((Bullet)this).BulletBank).aiActor).gameObject.Play($"ticking_clock_{c % 8 + 1}"); int num2 = c + 1; c = num2; } } } } private class WalledInScript : ArmisticeBulletScript { private const int _STREAMS = 50; private const int _WALLSIZE = 25; private const int _ITERS = 25; private const float _FRAMES = 180f; private const float _MINSPEED = 50f; private const float _MAXSPEED = 100f; private const float _DLTSPEED = 50f; private PathLine _bounds; protected override List BuildChain() { //IL_0002: 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) _bounds = new PathRect(base.roomFullBounds.Inset(2f, 1f)).Top(); FluidBulletInfo fluidBulletInfo = Run(Attack(0, 50f)); for (int i = 1; i <= 25; i++) { float num = Ease.OutQuad((float)i / 50f); fluidBulletInfo = fluidBulletInfo.And(Attack(i, 50f + 50f * num), (int)(num * 180f)); } for (int num2 = 24; num2 >= 1; num2--) { float num3 = Ease.OutQuad((float)(50 - num2) / 50f); fluidBulletInfo = fluidBulletInfo.And(Attack(num2, 50f + 50f * num3), (int)(num3 * 180f)); } return fluidBulletInfo.Finish(); } private IEnumerator Attack(int end, float speed) { ((Component)((BraveBehaviour)((Bullet)this).BulletBank).aiActor).gameObject.Play("gradius_blaster_sound"); Direction val = new Direction(270f, (DirectionType)1, -1f); Speed val2 = new Speed(speed, (SpeedType)0); int num = Mathf.Max(end - 25, 0); float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; Color value = Color.HSVToRGB(scaledTimeSinceStartup - (float)(int)scaledTimeSinceStartup, 1f, 1f); for (int i = num; i <= end; i++) { float num2 = (float)i / 50f; ((Bullet)this).Fire(Offset.OverridePosition(_bounds.At(num2)), val, val2, (Bullet)(object)new SecretBullet(value, 100f, 0.5f)); ((Bullet)this).Fire(Offset.OverridePosition(_bounds.At(1f - num2)), val, val2, (Bullet)(object)new SecretBullet(value, 100f, 0.5f)); } yield break; } } private class BoneTunnelScript : ArmisticeBulletScript { internal class BoneTunnelBullet : SecretBullet { private float _targetY; private float _startY; public BoneTunnelBullet(float targetY) { _targetY = targetY; } public override void Initialize() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) base.Initialize(); ((Bullet)this).TimeScale = -1f; _startY = ((Bullet)this).Position.y; ((BraveBehaviour)((Bullet)this).Projectile).specRigidbody.CollideWithTileMap = false; } public override IEnumerator Top() { float lifeTime = 0f; float yOffset = _startY - _targetY; float prevTime = BraveTime.ScaledTimeSinceStartup; while (lifeTime < 0.3f) { lifeTime += BraveTime.ScaledTimeSinceStartup - prevTime; prevTime = BraveTime.ScaledTimeSinceStartup; float t = Mathf.Clamp01(lifeTime / 0.3f); ((Bullet)this).Position = Vector2Extensions.WithY(((Bullet)this).Position, _startY - Ease.OutCubic(t) * yOffset); yield return ((Bullet)this).Wait(1); } ((Bullet)this).Position = Vector2Extensions.WithY(((Bullet)this).Position, _targetY); ((BraveBehaviour)((Bullet)this).Projectile).specRigidbody.CollideWithTileMap = true; } } private const float _YOFFSET = 10f; private const float _CONVERGE_TIME = 0.3f; private const float SPEED = 58f; protected override List BuildChain() { return Run(Attack()).Finish(); } private IEnumerator Attack() { int gap = IntForPhase(new int[3] { 6, 5, 4 }); int noGap = IntForPhase(new int[3] { 2, 3, 4 }); yield return ((Bullet)this).Wait(15); PathRect pathRect = new PathRect(base.roomFullBounds.Inset(0f, 0.25f)); Speed sspeed = new Speed(58f, (SpeedType)0); Vector2 centerPosition = ((GameActor)GameManager.Instance.BestActivePlayer).CenterPosition; float x = ((BraveBehaviour)((Bullet)this).BulletBank).aiActor.Position.x; Rect val = base.roomFullBounds; bool flag = x > ((Rect)(ref val)).center.x; Direction dir = new Direction(flag ? 180f : 0f, (DirectionType)1, -1f); PathLine wall = (flag ? pathRect.Right() : pathRect.Left()); float wallOff = (flag ? (-2.5f) : 2.5f); int gapPos = Mathf.RoundToInt(50f * ((centerPosition.y - wall.start.y) / (wall.end.y - wall.start.y))); int numWaves = 60 + Random.Range(0, 10); int i = 0; while (i < numWaves) { bool flag2 = i < numWaves - noGap; float num = Mathf.Clamp01(0.1f * (float)(numWaves - i)); for (int j = 0; j <= 50; j++) { if (!flag2 || Mathf.Abs(j - gapPos) >= gap) { float t = (float)j / 50f; Vector2 val2 = wall.At(t) + new Vector2(wallOff * Random.value, 0f); float num2 = num * ((j > gapPos) ? 10f : (-10f)); ((Bullet)this).Fire(Offset.OverridePosition(val2 + new Vector2(0f, num2)), dir, sspeed, (Bullet)(object)new BoneTunnelBullet(val2.y)); } } ((Component)((BraveBehaviour)((Bullet)this).BulletBank).aiActor).gameObject.Play($"armistice_bullet_storm_sound_{1 + i % 4}"); int num3; if (gapPos <= gap) { num3 = gapPos + 1; gapPos = num3; } else if (gapPos >= 50 - gap) { num3 = gapPos - 1; gapPos = num3; } else { gapPos += (Lazy.CoinFlip() ? 1 : (-1)); } yield return ((Bullet)this).Wait(5); num3 = i + 1; i = num3; } } } private class DanceMonkeyScript : ArmisticeBulletScript { internal class DanceMonkeyBullet : SecretBullet { private const float LERP_FACTOR = 10f; private float _startAngle; private float _radius; private Vector2 _center; private float _holdRadius; private int _holdFrames; private float _rps; private float _spawnTime; public DanceMonkeyBullet(Vector2 center, float holdRadius, int holdFrames, float rps, float spawnTime) { //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) _center = center; _holdRadius = holdRadius; _holdFrames = holdFrames; _rps = rps; _spawnTime = spawnTime; ((Bullet)this).ManualControl = true; } public override void Initialize() { base.Initialize(); } public override IEnumerator Top() { _ = ((Bullet)this).Position; Vector2 val = ((Bullet)this).Position - _center; _startAngle = Vector2Extensions.ToAngle(val); _radius = ((Vector2)(ref val)).magnitude; ((BraveBehaviour)((Bullet)this).Projectile).specRigidbody.CollideWithTileMap = false; int i = 0; while (i < _holdFrames) { float num = BraveTime.ScaledTimeSinceStartup - _spawnTime; float self = _startAngle + num * 360f * _rps; if (Mathf.Abs(_radius - _holdRadius) > 0.0125f) { _radius = Lazy.SmoothestLerp(_radius, _holdRadius, 10f); } else { _radius = _holdRadius; } ((Bullet)this).Position = _center + self.ToVector(_radius); yield return ((Bullet)this).Wait(1); int num2 = i + 1; i = num2; } ((Bullet)this).ManualControl = false; ((BraveBehaviour)((Bullet)this).Projectile).specRigidbody.CollideWithTileMap = true; ((Bullet)this).ChangeDirection(new Direction(Vector2Extensions.ToAngle(_center - ((Bullet)this).Position).AddRandomSpread(12f), (DirectionType)1, -1f), 1); ((Bullet)this).ChangeSpeed(new Speed(100f, (SpeedType)0), 1); yield return ((Bullet)this).Wait(1); _trail = ((Component)((BraveBehaviour)(object)((Bullet)this).Projectile).AddTrail(SubtractorBeam._RedTrailPrefab)).gameObject; _trail.SetGlowiness(100f); } } protected override List BuildChain() { return Run(Attack()).Finish(); } private IEnumerator Attack() { PlayerController pc = GameManager.Instance.BestActivePlayer; int i = 0; while (i < 5 && Object.op_Implicit((Object)(object)pc)) { Vector2 centerPosition = ((GameActor)pc).CenterPosition; float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; float num = 360f * Random.value; for (int j = 0; j < 17; j++) { ((Bullet)this).Fire(Offset.OverridePosition(centerPosition + (num + 21.17647f * (float)j).ToVector(10f)), (Bullet)(object)new DanceMonkeyBullet(centerPosition, 3f, 40, 3f, scaledTimeSinceStartup)); } yield return ((Bullet)this).Wait(60); int num2 = i + 1; i = num2; } } } private class PendulumScript : ArmisticeBulletScript { internal class PendulumBullet : SecretBullet { private PendulumScript _parent; private Vector2 _relPos; public PendulumBullet(PendulumScript parent, Vector2 relPos) { //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) _parent = parent; _relPos = relPos; ((Bullet)this).ManualControl = true; } public override void Initialize() { base.Initialize(); ((BraveBehaviour)((Bullet)this).Projectile).specRigidbody.CollideWithTileMap = false; } public override IEnumerator Top() { while (_parent != null && _parent._active) { ((Bullet)this).Position = _parent._ballCenter + _relPos; yield return ((Bullet)this).Wait(1); } ((Bullet)this).Vanish(false); } } private Vector2 _ballCenter; private bool _active; protected override List BuildChain() { return Run(Attack()).Finish(); } private IEnumerator Attack() { PlayerController bestActivePlayer = GameManager.Instance.BestActivePlayer; Rect val = base.roomFullBounds; Vector2 center = ((Rect)(ref val)).center; bool backswing = ((GameActor)bestActivePlayer).CenterPosition.x < center.x; bool onTop = ((GameActor)bestActivePlayer).CenterPosition.y < center.y; PathRect pathRect = new PathRect(base.roomFullBounds.Inset(2f, 0f)); Vector2 left = pathRect.At(0f, 0.5f); Vector2 right = pathRect.At(1f, 0.5f); float ybase = right.y; float width = right.x - left.x; _ballCenter = (backswing ? right : left); _active = true; for (int i = 0; i < 5; i++) { float magnitude = (float)(i + 1) * 0.4f; int num = 5 + i * 4; for (int j = 0; j < num; j++) { Vector2 val2 = (360f / (float)num * (float)j).ToVector(magnitude); PendulumBullet pendulumBullet = new PendulumBullet(this, val2); ((Bullet)this).Fire(Offset.OverridePosition(_ballCenter + val2), (Bullet)(object)pendulumBullet); } } int i2 = 0; while (i2 < 11) { Speed crashSpeed = new Speed((float)(5 + 2 * i2), (SpeedType)0); int swingFrames = 60 - 3 * i2; int num5; for (int j2 = 0; j2 <= swingFrames; j2 = num5) { float num2 = Ease.InCubic((float)j2 / (float)swingFrames); float num3 = Mathf.Sin((float)Math.PI / 2f * num2); float num4 = (onTop ? (-1f) : 1f) * -10f * Mathf.Sin((float)Math.PI * num3); if (backswing) { _ballCenter = new Vector2(right.x - num3 * width, ybase + num4); } else { _ballCenter = new Vector2(left.x + num3 * width, ybase + num4); } yield return ((Bullet)this).Wait(1); num5 = j2 + 1; } _ballCenter = (backswing ? left : right); float num6 = (backswing ? 270f : 90f) + 4.5f * Random.value; for (int k = 0; k < 20; k++) { float num7 = num6 + (float)k * 9f; ((Bullet)this).Fire(Offset.OverridePosition(_ballCenter + num7.ToVector(2f)), new Direction(num7, (DirectionType)1, -1f), crashSpeed, (Bullet)(object)new SecretBullet()); } backswing = !backswing; yield return ((Bullet)this).Wait(5); num5 = i2 + 1; i2 = num5; } _active = false; } } private class BoxTrotScript : ArmisticeBulletScript { internal class BoxTrotTurret : SecretBullet { private const float _BEAM_TIME = 0.5f; private PathRect _path; private float _offset; private float _top; private float _bottom; private GameObject _sightline; private Transform _transform; private float _lastAngle = 361f; public BoxTrotTurret(PathRect path, float offset, float top, float bottom) : base(null, 10f, 1.5f, fancySpawn: false, "turret") { _path = path; _offset = offset; _top = top; _bottom = bottom; } public override void Initialize() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown base.Initialize(); tk2dBaseSprite sprite = ((BraveBehaviour)((Bullet)this).Projectile).sprite; sprite.usesOverrideMaterial = true; ((BraveBehaviour)sprite).renderer.material.shader = ShaderCache.Acquire("Brave/PlayerShader"); SpeculativeRigidbody specRigidbody = ((BraveBehaviour)((Bullet)this).Projectile).specRigidbody; specRigidbody.OnPreTileCollision = (OnPreTileCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreTileCollision, (Delegate?)new OnPreTileCollisionDelegate(OnPreTileCollision)); } private void OnPreTileCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, Tile tile, PixelCollider tilePixelCollider) { myRigidbody.CollideWithTileMap = false; PhysicsEngine.SkipCollision = true; if (!((Bullet)this).ManualControl) { Deploy(); } } protected override void OnBaseDestruction(Projectile projectile) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown base.OnBaseDestruction(projectile); if (Object.op_Implicit((Object)(object)((BraveBehaviour)projectile).specRigidbody)) { SpeculativeRigidbody specRigidbody = ((BraveBehaviour)projectile).specRigidbody; specRigidbody.OnPreTileCollision = (OnPreTileCollisionDelegate)Delegate.Remove((Delegate?)(object)specRigidbody.OnPreTileCollision, (Delegate?)new OnPreTileCollisionDelegate(OnPreTileCollision)); } if (Object.op_Implicit((Object)(object)_sightline)) { Object.Destroy((Object)(object)_sightline); _sightline = null; } } private void ManualUpdate() { //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_000f: Unknown result type (might be due to invalid IL or missing references) Rect rect = _path.rect; if (!((Rect)(ref rect)).Contains(((Bullet)this).Position)) { Deploy(); } } private void Deploy() { //IL_0008: 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) _offset = _path.InverseAt(((Bullet)this).Position); ((Bullet)this).Position = _path.At(_offset); ((Bullet)this).TimeScale = -1f; ((Bullet)this).ManualControl = true; ((Component)((Bullet)this).Projectile).gameObject.Play("armistice_laser_deploy_sound"); } private void DrawBeamToWall(float startTime, Vector2 center) { //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_0060: 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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_00e9: 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_01b0: 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_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) float num = Ease.OutCubic(Mathf.Clamp01((BraveTime.ScaledTimeSinceStartup - startTime) / 0.5f)); float x = ((Bullet)this).Position.x; float y = ((Bullet)this).Position.y; float num2 = ((!(y < _bottom) || !(y > _top)) ? ((y < center.y) ? 90f : 270f) : ((x < center.x) ? 0f : 180f)); if (_lastAngle > 360f) { _lastAngle = num2; } float b = _lastAngle.RelAngleTo(num2); _lastAngle = (_lastAngle + Lazy.SmoothestLerp(0f, b, 10f)) % 360f; if (!Object.op_Implicit((Object)(object)_sightline)) { _sightline = VFX.CreateLaserSight(Vector2.op_Implicit(_transform.position), 1f, 2f, _lastAngle, Color.red, 50f); _sightline.transform.parent = _transform; } int num3 = CollisionMask.LayerToMask((CollisionLayer)6); RaycastResult val = default(RaycastResult); if (!PhysicsEngine.Instance.Raycast(((Bullet)this).Projectile.SafeCenter, _lastAngle.ToVector(), 999f, ref val, true, false, num3, (CollisionLayer?)null, false, (Func)null, (SpeculativeRigidbody)null)) { RaycastResult.Pool.Free(ref val); return; } float num4 = num * 16f * val.Distance; _ = ((CastResult)val).Contact; RaycastResult.Pool.Free(ref val); tk2dTiledSprite component = _sightline.GetComponent(); ((BraveBehaviour)component).renderer.enabled = true; component.dimensions = new Vector2(num4, 2f); _sightline.transform.rotation = _lastAngle.EulerZ(); _sightline.transform.localPosition = Vector2.op_Implicit(Vector2.zero); ((tk2dBaseSprite)component).ForceRotationRebuild(); ((tk2dBaseSprite)component).UpdateZDepth(); } public override IEnumerator Top() { while (!((Bullet)this).ManualControl) { ManualUpdate(); yield return ((Bullet)this).Wait(1); } float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; float nextShootTime = scaledTimeSinceStartup + 0.5f; float startTime = scaledTimeSinceStartup; _ = ((Bullet)this).Position; Vector2 center = _path.At(0.5f, 0.5f); bool?[] oldSideH = new bool?[2]; bool?[] oldSideV = new bool?[2]; _transform = ((Component)((Bullet)this).Projectile).gameObject.transform; while (true) { yield return ((Bullet)this).Wait(1); scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; _ = ((Bullet)this).Position; float num = 0.2f * (scaledTimeSinceStartup - startTime); ((Bullet)this).Position = _path.At((_offset + num) % 1f); DrawBeamToWall(startTime, center); ((Bullet)this).Projectile.SetRotation(_lastAngle); if (nextShootTime > scaledTimeSinceStartup) { continue; } float y = ((Bullet)this).Position.y; bool flag = y < _bottom && y > _top; PlayerController[] allPlayers = GameManager.Instance.AllPlayers; foreach (PlayerController val in allPlayers) { int playerIDX = val.PlayerIDX; if (playerIDX >= 0 && playerIDX <= 1) { Vector2 centerPosition = ((GameActor)val).CenterPosition; bool flag3; if (flag) { bool flag2 = centerPosition.y < ((Bullet)this).Position.y; flag3 = (oldSideH[playerIDX] ?? flag2) != flag2; oldSideH[playerIDX] = flag2; } else { bool flag4 = centerPosition.x < ((Bullet)this).Position.x; flag3 = (oldSideV[playerIDX] ?? flag4) != flag4; oldSideV[playerIDX] = flag4; } if (flag3) { float num2 = ((!flag) ? ((((Bullet)this).Position.y < center.y) ? 90f : 270f) : ((((Bullet)this).Position.x < center.x) ? 0f : 180f)); ((Bullet)this).Fire(Offset.OverridePosition(((Bullet)this).Position), new Direction(num2, (DirectionType)1, -1f), new Speed(50f, (SpeedType)0), (Bullet)(object)new BoxTrotBullet()); GameObject muzzleVFXTurret = _MuzzleVFXTurret; Vector3 position = Vector2.op_Implicit(((Bullet)this).Position); Quaternion? rotation = num2.EulerZ(); Color? emissiveColor = Color.white; float? startScale = 0.5f; Transform transform = ((BraveBehaviour)((Bullet)this).Projectile).transform; CwaffVFX.Spawn(muzzleVFXTurret, position, rotation, null, 0f, null, 0.5f, emissiveColor, fadeIn: false, startScale, null, null, randomFrame: false, -1, flipX: false, flipY: false, transform); nextShootTime = scaledTimeSinceStartup + 0.5f; } } } } } } internal class BoxTrotBullet : SecretBullet { public override void Initialize() { base.Initialize(); ((Component)((Bullet)this).Projectile).gameObject.Play("armistice_turret_fire_sound"); _trail = ((Component)((BraveBehaviour)(object)((Bullet)this).Projectile).AddTrail(SubtractorBeam._RedTrailPrefab)).gameObject; _trail.SetGlowiness(100f); } } protected override List BuildChain() { ((Bullet)this).TimeScale = -1f; return Run(Attack()).Finish(); } private IEnumerator Attack() { int numTurrets = IntForPhase(new int[3] { 3, 4, 5 }); float timeBetweenShots = FloatForPhase(new float[3] { 0.5f, 0.35f, 0.2f }); AIActor boss = ((BraveBehaviour)((Bullet)this).BulletBank).aiActor; Rect bounds = base.roomFullBounds.Inset(0.5f, 1.25f, 2f, 1f); float top = ((Rect)(ref bounds)).yMin + 0.1f; float bottom = ((Rect)(ref bounds)).yMax - 0.1f; PathRect path = new PathRect(bounds); List bullets = new List(); int i = 0; while (i < numTurrets) { bool flag = ((Component)boss).gameObject.transform.position.x > ((Rect)(ref bounds)).center.x; ((BraveBehaviour)boss).sprite.FlipX = flag; Vector2 val = Vector2.op_Implicit(((Component)boss).gameObject.transform.position + GunBarrelOffset(flag)); BoxTrotTurret boxTrotTurret = new BoxTrotTurret(path, 0f, top, bottom); bullets.Add(boxTrotTurret); float num = (flag ? 180f : 0f).AddRandomSpread(15f); ((Bullet)this).Fire(Offset.OverridePosition(val), new Direction(num, (DirectionType)1, -1f), new Speed(50f, (SpeedType)0), (Bullet)(object)boxTrotTurret); ((Component)boss).gameObject.Play("armistice_launch_turret_sound"); GameObject muzzleVFXBullet = _MuzzleVFXBullet; Vector3 position = Vector2.op_Implicit(val); Quaternion? rotation = num.EulerZ(); Color? emissiveColor = ExtendedColours.vibrantOrange; CwaffVFX.Spawn(muzzleVFXBullet, position, rotation, null, 0f, null, 10f, emissiveColor, fadeIn: false, null, null, null, randomFrame: false, -1, flipX: false, flipY: false, null, null, 8f); ((BraveBehaviour)boss).aiAnimator.PlayUntilFinished("attack_snipe", false, (string)null, -1f, false); while (((BraveBehaviour)boss).spriteAnimator.IsPlaying("attack_snipe")) { yield return ((Bullet)this).Wait(1); } ((BraveBehaviour)boss).aiAnimator.PlayUntilCancelled(IdleForPhase(), false, (string)null, -1f, false); float nextShot = BraveTime.ScaledTimeSinceStartup + timeBetweenShots; while (BraveTime.ScaledTimeSinceStartup < nextShot) { yield return ((Bullet)this).Wait(1); } if (i < numTurrets - 1) { ((BraveBehaviour)boss).aiAnimator.PlayUntilCancelled("ready", false, (string)null, -1f, false); while (((BraveBehaviour)boss).spriteAnimator.IsPlaying("ready")) { yield return ((Bullet)this).Wait(1); } } int num2 = i + 1; i = num2; } float endTime = BraveTime.ScaledTimeSinceStartup + 6f; while (BraveTime.ScaledTimeSinceStartup < endTime) { bool flag2 = true; for (int j = 0; j < numTurrets; j++) { if (Object.op_Implicit((Object)(object)((Bullet)bullets[j]).Projectile) && !((Bullet)bullets[j]).IsEnded && !((Bullet)bullets[j]).Destroyed) { flag2 = false; } } if (flag2) { break; } yield return ((Bullet)this).Wait(1); } for (int k = 0; k < numTurrets; k++) { if (Object.op_Implicit((Object)(object)((Bullet)bullets[k]).Projectile)) { ((Bullet)bullets[k]).Vanish(false); } } } } private class LaserBarrageScript : ArmisticeBulletScript { protected override List BuildChain() { return Run(Attack()).Finish(); } private IEnumerator Attack() { int num = IntForPhase(new int[3] { 5, 10, 15 }); int totalIters = 24 + num; PlayerController pc = GameManager.Instance.GetRandomActivePlayer(); AIActor actor = ((BraveBehaviour)((Bullet)this).BulletBank).aiActor; Transform t = ((Component)actor).gameObject.transform; float x = t.position.x; Rect val = base.roomFullBounds; bool flag = x > ((Rect)(ref val)).center.x; Vector2 shootPoint = Vector2.op_Implicit(t.position + GunBarrelOffset(flag)); Offset shootOff = Offset.OverridePosition(shootPoint); float shootAngle = (flag ? 180f : 0f); float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; int i = 0; while (i < totalIters) { float num2 = Mathf.Min((float)i / 24f, 1f); float num3 = 0.5f * Mathf.Lerp(1f, 0.15f, num2); if (i % 2 == 0) { float num4 = Mathf.Lerp(10f, 25f, num2); Speed val2 = new Speed(num4, (SpeedType)0); for (int j = 0; j < 23; j++) { float num5 = shootAngle.AddRandomSpread(70f); ((Bullet)this).Fire(shootOff, new Direction(num5, (DirectionType)1, -1f), val2, (Bullet)(object)new SecretBullet()); if (j % 3 == 0) { CwaffVFX.SpawnDebris(_BasicFlak, Vector2.op_Implicit(shootPoint), num5.AddRandomSpread(8f), 0.3f * num4, 0.6f * num4, null, t, randomFrame: true, -1, 20f); } } ((Component)actor).gameObject.PlayUnique("armistice_gun_sound"); GameObject muzzleVFXBullet = _MuzzleVFXBullet; Vector3 position = Vector2.op_Implicit(shootPoint); Quaternion? rotation = shootAngle.EulerZ(); Color? emissiveColor = ExtendedColours.vibrantOrange; CwaffVFX.Spawn(muzzleVFXBullet, position, rotation, null, 0f, null, 10f, emissiveColor, fadeIn: false, null, null, null, randomFrame: false, -1, flipX: false, flipY: false, null, null, 8f); } else { float num6 = Vector2Extensions.ToAngle(((GameActor)pc).CenterPosition - shootPoint); SecretBullet secretBullet = new SecretBullet(Color.cyan); ((Bullet)this).Fire(shootOff, new Direction(num6, (DirectionType)1, -1f), new Speed(50f, (SpeedType)0), (Bullet)(object)secretBullet); secretBullet.AddTrail(_LaserTrailPrefab, 100f); ((Component)actor).gameObject.PlayUnique("armistice_electro_sound"); GameObject muzzleVFXElectro = _MuzzleVFXElectro; Vector3 position2 = Vector2.op_Implicit(shootPoint); Quaternion? rotation2 = num6.EulerZ(); Color? emissiveColor = ExtendedColours.vibrantOrange; CwaffVFX.Spawn(muzzleVFXElectro, position2, rotation2, null, 0f, null, 10f, emissiveColor, fadeIn: false, null, null, null, randomFrame: false, -1, flipX: false, flipY: false, null, null, 8f); CwaffVFX.SpawnBurst(_LaserFlakVFX, 3, shootPoint, 0.5f, num6.AddRandomSpread(3f).ToVector(12f), 0f, 8f, CwaffVFX.Vel.Away, CwaffVFX.Rot.Random, 0f, null, 400f); } float nextShot = scaledTimeSinceStartup + num3; while (scaledTimeSinceStartup < nextShot) { yield return ((Bullet)this).Wait(1); scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; } int num7 = i + 1; i = num7; } } } private class MeteorShowerScript : ArmisticeBulletScript { internal class MeteorShowerBullet : SecretBullet { private static ExplosionData _Explosion; private Rect _bounds; private bool _exploded; public MeteorShowerBullet(Rect bounds) : base(null, 10f, 1.5f, fancySpawn: false, "warhead") { //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) _bounds = bounds; _exploded = false; } public override void Initialize() { base.Initialize(); SpeculativeRigidbody specRigidbody = ((BraveBehaviour)((Bullet)this).Projectile).specRigidbody; specRigidbody.CollideWithOthers = false; specRigidbody.CollideWithTileMap = false; AddTrail(_WarheadTrailPrefab, 1f); tk2dBaseSprite sprite = ((BraveBehaviour)((Bullet)this).Projectile).sprite; sprite.usesOverrideMaterial = true; ((BraveBehaviour)sprite).renderer.material.shader = ShaderCache.Acquire("Brave/PlayerShader"); } protected override void OnBaseDestruction(Projectile projectile) { //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_0071: 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_00a6: 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_011f: Unknown result type (might be due to invalid IL or missing references) base.OnBaseDestruction(projectile); if (_exploded) { if (_Explosion == null) { _Explosion = Explosions.ExplosiveRounds.With(100f, 10f, 0f, 1.5f, preventPlayerForce: false, shake: false); _Explosion.doDamage = true; _Explosion.damageToPlayer = 0.5f; _Explosion.effect = null; } Exploder.Explode(Vector2.op_Implicit(projectile.SafeCenter), _Explosion, Vector2.zero, (Action)null, true, (CoreDamageTypes)0, false); Lazy.ScorchGroundAt(projectile.SafeCenter); ((Component)projectile).gameObject.Play("armistice_warhead_explode_sound"); CwaffVFX.Spawn(_ExplosionVFX, Vector2.op_Implicit(projectile.SafeCenter)); GameObject smokeVFX = _SmokeVFX; Vector2 safeCenter = projectile.SafeCenter; float? fadeOutTime = 0.5f; CwaffVFX.SpawnBurst(smokeVFX, 20, safeCenter, 2f, null, 0f, 4f, CwaffVFX.Vel.Random, CwaffVFX.Rot.Random, 0.5f, fadeOutTime); } } public override IEnumerator Top() { float fallTime = (GameManager.IsTurboMode ? 0.75f : 0.975f); CameraController cam = GameManager.Instance.MainCameraController; while (cam.PointIsVisible(((Bullet)this).Position)) { yield return ((Bullet)this).Wait(1); } float num = 0.5f + Random.value * 0.5f; float waitEnd = BraveTime.ScaledTimeSinceStartup + num; while (BraveTime.ScaledTimeSinceStartup < waitEnd) { yield return ((Bullet)this).Wait(1); } PlayerController bestActivePlayer = GameManager.Instance.BestActivePlayer; Vector2 target = (Object.op_Implicit((Object)(object)bestActivePlayer) ? ((GameActor)bestActivePlayer).CenterPosition : new PathRect(_bounds.Inset(3f)).At(Random.value, Random.value)); if (Object.op_Implicit((Object)(object)bestActivePlayer)) { target += fallTime * (Ease.InCubic(Random.value) * ((GameActor)bestActivePlayer).Velocity) + Lazy.RandomVector(2f * Ease.InCubic(Random.value)); if (!((Rect)(ref _bounds)).Contains(target)) { target = BraveMathCollege.ClosestPointOnRectangle(target, ((Rect)(ref _bounds)).min, ((Rect)(ref _bounds)).size); } } ((Bullet)this).TimeScale = -1f; ((Bullet)this).ManualControl = true; ((BraveBehaviour)((BraveBehaviour)((Bullet)this).Projectile).sprite).transform.rotation = 270f.EulerZ(); GameObject sigil = SpawnManager.SpawnVFX(VFX.MasterySigil, Vector2.op_Implicit(target), (1080f * BraveTime.ScaledTimeSinceStartup).EulerZ(), true); sigil.ExpireIn(fallTime); ((Component)((Bullet)this).Projectile).gameObject.Play("armistice_warhead_fall_sound"); float fallStart = BraveTime.ScaledTimeSinceStartup; float fallEnd = fallStart + fallTime; while (BraveTime.ScaledTimeSinceStartup < fallEnd && !((Bullet)this).IsEnded && !((Bullet)this).Destroyed) { float num2 = 1f - (BraveTime.ScaledTimeSinceStartup - fallStart) / fallTime; ((Bullet)this).Position = target + new Vector2(0f, num2 * 100f); if (Object.op_Implicit((Object)(object)sigil)) { sigil.transform.rotation = (1080f * BraveTime.ScaledTimeSinceStartup).EulerZ(); sigil.transform.localScale = num2 * Vector3.one; } yield return ((Bullet)this).Wait(1); } if (Object.op_Implicit((Object)(object)sigil)) { Object.Destroy((Object)(object)sigil); } ((Bullet)this).Position = target; _exploded = true; ((Bullet)this).Vanish(true); } } private bool _fired; protected override List BuildChain() { return Run(Attack()).Finish(); } private void OnFired(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frame) { if (animator.CurrentFrame >= 5 && clip.name.Contains("skyshot")) { animator.AnimationEventTriggered = (Action)Delegate.Remove(animator.AnimationEventTriggered, new Action(OnFired)); _fired = true; } } private IEnumerator Attack() { int volleySize = IntForPhase(new int[3] { 5, 7, 9 }); AIActor boss = ((BraveBehaviour)((Bullet)this).BulletBank).aiActor; Transform transform = ((Component)boss).gameObject.transform; float x = transform.position.x; Rect val = base.roomFullBounds; bool flag = x > ((Rect)(ref val)).center.x; ((BraveBehaviour)boss).sprite.FlipX = flag; Vector2 shootPoint = Vector2.op_Implicit(transform.position + GunBarrelHighOffset(((BraveBehaviour)boss).sprite.FlipX)); float baseShootAngle = (flag ? 123f : 57f); MeteorShowerBullet lastBulletFired = null; int i = 0; while (i < 10) { _fired = false; tk2dSpriteAnimator spriteAnimator = ((BraveBehaviour)boss).spriteAnimator; spriteAnimator.AnimationEventTriggered = (Action)Delegate.Combine(spriteAnimator.AnimationEventTriggered, new Action(OnFired)); ((BraveBehaviour)boss).aiAnimator.PlayUntilFinished("skyshot", false, (string)null, -1f, false); while (!_fired) { yield return ((Bullet)this).Wait(1); } for (int j = 0; j < volleySize; j++) { float num = baseShootAngle.AddRandomSpread(2f * (float)volleySize); lastBulletFired = new MeteorShowerBullet(base.roomFullBounds); ((Bullet)this).Fire(Offset.OverridePosition(shootPoint), new Direction(num, (DirectionType)1, -1f), new Speed(50f, (SpeedType)0), (Bullet)(object)lastBulletFired); GameObject missileFlak = _MissileFlak; Vector3 position = Vector2.op_Implicit(shootPoint); float rotation = num.AddRandomSpread(35f); Transform transform2 = ((Component)boss).gameObject.transform; CwaffVFX.SpawnDebris(missileFlak, position, rotation, 6f, 15f, null, transform2, randomFrame: true, -1, 20f); } ((Component)boss).gameObject.Play("armistice_gun_sound"); GameObject muzzleVFXBullet = _MuzzleVFXBullet; Vector3 position2 = Vector2.op_Implicit(shootPoint); Quaternion? rotation2 = baseShootAngle.EulerZ(); Color? emissiveColor = ExtendedColours.vibrantOrange; CwaffVFX.Spawn(muzzleVFXBullet, position2, rotation2, null, 0f, null, 10f, emissiveColor, fadeIn: false, null, null, null, randomFrame: false, -1, flipX: false, flipY: false, null, null, 8f); while (((BraveBehaviour)boss).aiAnimator.IsPlaying("skyshot")) { yield return ((Bullet)this).Wait(1); } int num2 = i + 1; i = num2; } while (lastBulletFired != null && !((Bullet)lastBulletFired).IsEnded && !((Bullet)lastBulletFired).Destroyed) { yield return ((Bullet)this).Wait(1); } } } private class TrickshotScript : ArmisticeBulletScript { private tk2dSlicedSprite _dangerZone; private List _lines; private static readonly int _RayMask = CollisionMask.LayerToMask((CollisionLayer)6); private static readonly Color[] _Colors = (Color[])(object)new Color[3] { Color.cyan, Color.red, Color.green }; protected override List BuildChain() { return Run(Attack()).Finish(); } private static Vector2 Contact(Vector2 pos, Vector2 dir) { //IL_0002: 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_0043: 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) Vector2 result = default(Vector2); RaycastResult val = default(RaycastResult); if (PhysicsEngine.Instance.Raycast(pos, dir, 999f, ref val, true, false, _RayMask, (CollisionLayer?)null, false, (Func)null, (SpeculativeRigidbody)null)) { result = ((CastResult)val).Contact; } RaycastResult.Pool.Free(ref val); return result; } public override void OnForceEnded() { ((Bullet)this).OnForceEnded(); if (Object.op_Implicit((Object)(object)_dangerZone)) { Object.Destroy((Object)(object)((Component)_dangerZone).gameObject); _dangerZone = null; } } private IEnumerator Attack() { ((Bullet)this).TimeScale = -1f; int numAttacks = IntForPhase(new int[3] { 12, 15, 18 }) + (GameManager.IsTurboMode ? 3 : 0); int num = numAttacks / 3; float minBlinkTime = FloatForPhase(new float[3] { 0.07f, 0.06f, 0.05f }) + (GameManager.IsTurboMode ? 0f : 0.01f); float attackGap = FloatForPhase(new float[3] { 0.4f, 0.35f, 0.3f }); float minAttackGap = FloatForPhase(new float[3] { 0.15f, 0.1375f, 0.125f }) + (GameManager.IsTurboMode ? 0f : 0.1f); PlayerController pc = GameManager.Instance.BestActivePlayer; Vector2 centerPosition = ((GameActor)pc).CenterPosition; AIActor boss = ((BraveBehaviour)((Bullet)this).BulletBank).aiActor; Vector2 shootPoint = Vector2.op_Implicit(((Component)boss).gameObject.transform.position + GunBarrelOffset(((BraveBehaviour)boss).sprite.FlipX)); _dangerZone = BossShared.DoomZone(shootPoint, centerPosition, 1f, -1f, 1, null, rise: false); _dangerZone.TileStretchedSprites = true; _dangerZone.SetBorder(1f / 3f, 0f, 1f / 3f, 0f); int orangeId = VFX.Collection.GetSpriteIdByName((((GameActor)boss).CenterPosition.x < ((GameActor)pc).CenterPosition.x) ? "reticle_caution_small" : "reticle_caution_small_inverted"); int blueId = VFX.Collection.GetSpriteIdByName("reticle_safe_small"); List tricks = new List(4); for (int i = 0; i < num; i++) { tricks.Add(Random.Range(3 * i, 3 * (i + 1))); } int num2; for (int a = 0; a < numAttacks; num2 = a + 1, a = num2) { bool trickery = tricks.Contains(a); ((BraveBehaviour)_dangerZone).renderer.enabled = true; ((tk2dBaseSprite)_dangerZone).SetSprite(trickery ? blueId : orangeId); ((tk2dBaseSprite)(object)_dangerZone).SetGlowiness(100f); float t = 1f - Mathf.Clamp01((float)a / 5f); float blinkTime = minBlinkTime + (0.125f - minBlinkTime) * t; ((BraveBehaviour)boss).aiAnimator.PlayUntilCancelled("ready", false, (string)null, -1f, false); bool preRolled = pc.IsDodgeRolling; float wait; for (int i2 = 0; i2 < 3; i2 = num2) { ((BraveBehaviour)_dangerZone).renderer.enabled = true; ((Component)((BraveBehaviour)((Bullet)this).BulletBank).aiActor).gameObject.Play("armistice_danger_beep_sound"); wait = BraveTime.ScaledTimeSinceStartup + blinkTime; while (BraveTime.ScaledTimeSinceStartup < wait) { if (!pc.IsDodgeRolling) { preRolled = false; } _dangerZone.Retarget(shootPoint, ((GameActor)pc).CenterPosition); yield return ((Bullet)this).Wait(1); } ((BraveBehaviour)_dangerZone).renderer.enabled = false; wait = BraveTime.ScaledTimeSinceStartup + blinkTime; while (BraveTime.ScaledTimeSinceStartup < wait) { if (!pc.IsDodgeRolling) { preRolled = false; } yield return ((Bullet)this).Wait(1); } num2 = i2 + 1; } float delay = minAttackGap + (attackGap - minAttackGap) * t; if (trickery) { bool shouldFire = false; wait = BraveTime.ScaledTimeSinceStartup + delay; while (BraveTime.ScaledTimeSinceStartup < wait) { if (preRolled && !pc.IsDodgeRolling) { preRolled = false; } if (!preRolled && pc.IsDodgeRolling) { shouldFire = true; break; } yield return ((Bullet)this).Wait(1); } if (!shouldFire) { continue; } ((Component)boss).gameObject.Play("armistice_laugh_2"); while (pc.IsDodgeRolling && !((BraveBehaviour)pc).healthHaver.IsVulnerable) { yield return ((Bullet)this).Wait(1); } } ((BraveBehaviour)boss).aiAnimator.PlayUntilFinished("attack_snipe", false, (string)null, -1f, false); for (int j = -1; j <= 1; j++) { float num3 = Vector2Extensions.ToAngle(((GameActor)pc).CenterPosition - shootPoint); if (j != 0) { Vector2 val = (num3 + (float)j * 90f).ToVector(); num3 = Vector2Extensions.ToAngle(((GameActor)pc).CenterPosition + val - shootPoint); } SecretBullet secretBullet = new SecretBullet(Color.cyan); ((Bullet)this).Fire(Offset.OverridePosition(shootPoint), new Direction(num3, (DirectionType)1, -1f), new Speed(200f, (SpeedType)0), (Bullet)(object)secretBullet); secretBullet.AddTrail(_TrickshotTrailPrefab, 100f); ((Component)boss).gameObject.PlayUnique("armistice_trickshot_sound"); GameObject muzzleVFXSnipe = _MuzzleVFXSnipe; Vector3 position = Vector2.op_Implicit(shootPoint); Quaternion? rotation = num3.EulerZ(); Color? emissiveColor = ExtendedColours.vibrantOrange; CwaffVFX.Spawn(muzzleVFXSnipe, position, rotation, null, 0f, null, 10f, emissiveColor, fadeIn: false, null, null, null, randomFrame: false, -1, flipX: false, flipY: false, null, null, 8f); CwaffVFX.SpawnBurst(_LaserFlakVFX, 3, shootPoint, 0.5f, num3.AddRandomSpread(3f).ToVector(16f), 0f, 12f, CwaffVFX.Vel.Away, CwaffVFX.Rot.Random, 0f, null, 400f); } wait = BraveTime.ScaledTimeSinceStartup + delay; while (BraveTime.ScaledTimeSinceStartup < wait) { if (!((BraveBehaviour)boss).aiAnimator.IsPlaying("attack_snipe")) { ((BraveBehaviour)boss).aiAnimator.PlayUntilCancelled("ready", false, (string)null, -1f, false); } yield return ((Bullet)this).Wait(1); } } ((BraveBehaviour)boss).aiAnimator.PlayUntilCancelled(IdleForPhase(), false, (string)null, -1f, false); Object.Destroy((Object)(object)((Component)_dangerZone).gameObject); _dangerZone = null; } private IEnumerator AttackOld() { if (_lines == null) { int num = 33; _lines = new List(num); for (int i = 0; i <= num; i++) { _lines.Add(Geometry.Create(Geometry.Shape.LINE)); } } AIActor boss = ((BraveBehaviour)((Bullet)this).BulletBank).aiActor; Rect val = base.roomFullBounds; Vector2 min = ((Rect)(ref val)).min; val = base.roomFullBounds; Vector2 pos = min + 0.25f * ((Rect)(ref val)).size; float left = Contact(pos, Vector2.left).x; float y = Contact(pos, Vector2.down).y; float right = Contact(pos, Vector2.right).x; float y2 = Contact(pos, Vector2.up).y; Rect trueBounds = new Rect(left, y, right - left, y2 - y); while (this != null) { Vector2 val2 = Vector2.op_Implicit(((Component)boss).gameObject.transform.position + GunBarrelOffset(((BraveBehaviour)boss).sprite.FlipX)); Vector2 val3 = ((GameActor)GameManager.Instance.BestActivePlayer).CenterPosition - val2; Vector2 normalized = ((Vector2)(ref val3)).normalized; Vector2 val4 = default(Vector2); int num2 = 0; for (int j = -1; j <= 1; j++) { Vector2 val5 = normalized.Rotate((float)j * 10f); Vector2 val6 = val2; Color value = _Colors[num2]; for (int k = 0; k <= 10; k++) { BraveMathCollege.LineSegmentRectangleIntersection(val6 + val5 / 32f, val6 + 100f * val5, ((Rect)(ref trueBounds)).min, ((Rect)(ref trueBounds)).max, ref val4); _lines[11 * num2 + k].Place(value, val6, val4); val6 = val4; if (Mathf.Abs(val4.x - left) < 0.01f || Mathf.Abs(val4.x - right) < 0.01f) { ((Vector2)(ref val5))..ctor(0f - val5.x, val5.y); } else { ((Vector2)(ref val5))..ctor(val5.x, 0f - val5.y); } } num2++; } yield return ((Bullet)this).Wait(1); } } } private class MagicMissileScript : ArmisticeBulletScript { internal class MagicMissileBullet : SecretBullet { private static ExplosionData _SmallExplosion = null; private static ExplosionData _LargeExplosion = null; private bool _orbiting; private bool _canBeDestroyed; private float _orbitRadius; private Rect _bounds; private EasyLight _light; private float _lastVFXTime; private static readonly Color[] _LightColors = (Color[])(object)new Color[5] { Color.Lerp(Color.green, Color.white, 0.5f), Color.Lerp(Color.yellow, Color.white, 0.5f), Color.Lerp(ExtendedColours.orange, Color.white, 0.5f), Color.Lerp(Color.red, Color.white, 0.5f), Color.Lerp(Color.red, Color.white, 0.15f) }; private PlayerController pc; public MagicMissileBullet(float orbitRadius, Rect bounds) : base(null, 10f, 1.5f, fancySpawn: false, "magicmissile") { //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) _orbitRadius = orbitRadius; _bounds = bounds; } public override void Initialize() { base.Initialize(); ((BraveBehaviour)((Bullet)this).Projectile).specRigidbody.CollideWithTileMap = false; ((Bullet)this).TimeScale = -1f; if (_SmallExplosion == null) { _SmallExplosion = Explosions.ExplosiveRounds.With(40f, 10f, 0f, 1.5f, preventPlayerForce: false, shake: false); _LargeExplosion = Explosions.DefaultLarge.With(200f, 30f, 0f, 3f); _LargeExplosion.doDamage = true; _LargeExplosion.damageToPlayer = 0.5f; } } private void DoVFX(float rate, Vector2? pos = null, float? dir = null) { //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) //IL_0038: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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) float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; if (!(_lastVFXTime + rate > scaledTimeSinceStartup)) { _lastVFXTime = scaledTimeSinceStartup; float? num = dir; float num2; if (!num.HasValue) { Quaternion rotation = ((BraveBehaviour)((Bullet)this).Projectile).transform.rotation; num2 = ((Quaternion)(ref rotation)).eulerAngles.z + 180f; } else { num2 = num.GetValueOrDefault(); } float self = num2; string text = ((rate > 0f) ? "armistice_missile_smoke_sound" : "armistice_missile_smoke_sound_short"); if (rate > 0f) { ((Component)((Bullet)this).Projectile).gameObject.PlayOnce(text); } else { ((MonoBehaviour)(object)((Bullet)this).Projectile).LoopSoundIf(play: true, text); } CwaffVFX.Spawn(_MissileSmokeVFX, Vector2.op_Implicit((Vector2)(((??)pos) ?? ((BraveBehaviour)((Bullet)this).Projectile).sprite.WorldCenterLeft())), self.EulerZ(), self.ToVector(0.1f * ((Bullet)this).Speed), 0.25f, 0.25f); } } private IEnumerator BeepBeep() { bool glow = false; MagicMissileBullet magicMissileBullet = this; Transform transform = ((BraveBehaviour)((Bullet)this).Projectile).transform; Color? val = ExtendedColours.vibrantOrange; magicMissileBullet._light = EasyLight.Create((Vector2?)null, transform, val, -1f, 2f, false, 10f, 0f, 0f, true, false, 30f, 0f, true, true); int p = 0; while (p < 5) { _light.SetColor(_LightColors[p]); int num; for (int i = 0; i < 8; i = num) { glow = !glow; if (glow) { ((Component)((BraveBehaviour)((Bullet)this).BulletBank).aiActor).gameObject.Play("armistice_missile_beep_sound"); _light.TurnOn(); } else { _light.TurnOff(false); } float wait = BraveTime.ScaledTimeSinceStartup + (0.21f - (float)p * 0.03f); while (BraveTime.ScaledTimeSinceStartup < wait) { DoVFX(0.2f); yield return true; } num = i + 1; } num = p + 1; p = num; } } public override IEnumerator Top() { pc = GameManager.Instance.BestActivePlayer; Projectile proj = ((Bullet)this).Projectile; proj.collidesWithProjectiles = true; proj.collidesOnlyWithPlayerProjectiles = true; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)proj).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreRigidbodyCollision)); proj.UpdateCollisionMask(); bool doneBeeping = false; IEnumerator beepCr = BeepBeep(); Vector3Extensions.WithAlpha(Color.green, 0.5f); float prevTime = BraveTime.ScaledTimeSinceStartup; while (!_orbiting) { Vector2 val = ((GameActor)pc).CenterPosition - ((Bullet)this).Position; float num = BraveTime.ScaledTimeSinceStartup - prevTime; float speed = ((Bullet)this).Speed; float direction = ((Bullet)this).Direction; float num2 = direction.RelAngleTo(Vector2Extensions.ToAngle(val)); float num3 = Mathf.Lerp(180f, 60f, Mathf.InverseLerp(2f, 60f, speed)); float num4 = Mathf.Sign(num2) * Mathf.Min(num3 * num, Mathf.Abs(num2)); float num5 = Mathf.Clamp(Mathf.Lerp(60f, 2f, 1f - Ease.InQuad(1f - Mathf.Min(Mathf.Abs(num2) / 90f, 1f))), speed - 60f * num, speed + 20f * num); float num6 = direction + num4; DoVFX(1f / num5); ((Bullet)this).ChangeSpeed(new Speed(num5, (SpeedType)0), 1); ((Bullet)this).ChangeDirection(new Direction(num6, (DirectionType)1, -1f), 1); if (!beepCr.MoveNext()) { doneBeeping = true; break; } prevTime = BraveTime.ScaledTimeSinceStartup; yield return ((Bullet)this).Wait(1); } ((Bullet)this).ManualControl = true; proj.collidesWithProjectiles = false; proj.UpdateCollisionMask(); float zipStart = BraveTime.ScaledTimeSinceStartup; float zipEnd = zipStart + 0.85f.AddRandomSpread(0.1f); float decelStart = zipEnd - 0.25f; float angleTotal = 0f; float lastAngle = Vector2Extensions.ToAngle(((Bullet)this).Position - ((GameActor)pc).CenterPosition); float now = BraveTime.ScaledTimeSinceStartup; while (!doneBeeping) { float num7 = BraveTime.ScaledTimeSinceStartup - now; now = BraveTime.ScaledTimeSinceStartup; bool flag = now >= zipEnd; if (flag) { num7 -= now - zipEnd; } Vector2 centerPosition = ((GameActor)pc).CenterPosition; Vector2 val2 = ((Bullet)this).Position - centerPosition; float num8 = Mathf.Lerp(360f, 2880f, Mathf.Clamp01((now - zipStart) / 1f)); float num9 = ((now >= decelStart) ? Ease.OutQuad(Mathf.Clamp01((now - decelStart) / 0.25f)) : 0f); if (num9 > 0f) { num8 = Mathf.Lerp(2880f, 0f, num9); } float num10 = Vector2Extensions.ToAngle(val2); float magnitude = Lazy.SmoothestLerp(((Vector2)(ref val2)).magnitude, _orbitRadius, 5f); float num11 = num7 * num8; float num12 = num10 + num11; ((Bullet)this).Position = centerPosition + num12.ToVector(magnitude); ((Bullet)this).Direction = 90f + num12 + 90f * num9; angleTotal += num11; while (angleTotal >= 13f) { angleTotal -= 13f; lastAngle += 13f; DoVFX(0f, centerPosition + lastAngle.ToVector(magnitude), lastAngle - 90f); } if (flag) { break; } yield return ((Bullet)this).Wait(1); } Vector2Extensions.ToAngle(((Bullet)this).Position - ((GameActor)pc).CenterPosition); ((Bullet)this).ManualControl = false; ((Bullet)this).ChangeSpeed(new Speed(0.01f, (SpeedType)0), 1); _canBeDestroyed = true; proj.collidesWithProjectiles = true; proj.UpdateCollisionMask(); while (!doneBeeping && beepCr.MoveNext()) { if (!((Rect)(ref _bounds)).Contains(((Bullet)this).Position)) { ((Bullet)this).Position = Lazy.SmoothestLerp(((Bullet)this).Position, ((GameActor)pc).CenterPosition, 3f); } ((Bullet)this).Direction = Vector2Extensions.ToAngle(((GameActor)pc).CenterPosition - ((Bullet)this).Position); yield return ((Bullet)this).Wait(1); } CwaffTrailController.Spawn(_WarheadTrailPrefab, ((Bullet)this).Position, ((GameActor)pc).CenterPosition); Vector3 val3 = Vector2.op_Implicit(((GameActor)pc).CenterPosition); ExplosionData largeExplosion = _LargeExplosion; Vector2 val4 = ((GameActor)pc).CenterPosition - ((Bullet)this).Position; Exploder.Explode(val3, largeExplosion, ((Vector2)(ref val4)).normalized, (Action)null, true, (CoreDamageTypes)0, false); Lazy.ScorchGroundAt(((GameActor)pc).CenterPosition); ((Bullet)this).Vanish(false); } private void OnPreRigidbodyCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { //IL_0026: 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_0037: 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) Projectile component = ((Component)otherRigidbody).gameObject.GetComponent(); if (component != null && component.Owner is PlayerController) { if (_canBeDestroyed) { Exploder.Explode(Vector2.op_Implicit(((Bullet)this).Position), _SmallExplosion, default(Vector2), (Action)null, true, (CoreDamageTypes)0, false); ((Bullet)this).Vanish(false); } else if (!_orbiting) { _orbiting = true; PhysicsEngine.SkipCollision = true; component.DieInAir(false, true, true, false); } } } protected override void OnBaseDestruction(Projectile projectile) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)_light)) { ((Component)_light).gameObject.transform.parent = null; Object.Destroy((Object)(object)((Component)_light).gameObject); } SpeculativeRigidbody specRigidbody = ((BraveBehaviour)projectile).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Remove((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreRigidbodyCollision)); base.OnBaseDestruction(projectile); } } private bool _fired; protected override List BuildChain() { return Run(Attack()).Finish(); } private void OnFired(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frame) { if (animator.CurrentFrame >= 4 && clip.name.Contains("crouch")) { animator.AnimationEventTriggered = (Action)Delegate.Remove(animator.AnimationEventTriggered, new Action(OnFired)); _fired = true; } } private IEnumerator Attack() { AIActor boss = ((BraveBehaviour)((Bullet)this).BulletBank).aiActor; int numMissiles = IntForPhase(new int[3] { 4, 5, 6 }); List mms = new List(numMissiles); int n = 0; while (n < numMissiles) { if (n > 0) { _fired = false; while (((BraveBehaviour)boss).spriteAnimator.IsPlaying("crouch")) { yield return ((Bullet)this).Wait(1); } ((BraveBehaviour)boss).spriteAnimator.ClipFps = FloatForPhase(new float[3] { 16f, 24f, 32f }); ((BraveBehaviour)boss).aiAnimator.PlayUntilFinished("reload", false, (string)null, -1f, false); while (((BraveBehaviour)boss).spriteAnimator.IsPlaying("reload")) { yield return ((Bullet)this).Wait(1); } ((BraveBehaviour)boss).spriteAnimator.ClipFps = 0f; ((BraveBehaviour)boss).aiAnimator.PlayUntilFinished("crouch", false, (string)null, -1f, false); } tk2dSpriteAnimator spriteAnimator = ((BraveBehaviour)boss).spriteAnimator; spriteAnimator.AnimationEventTriggered = (Action)Delegate.Combine(spriteAnimator.AnimationEventTriggered, new Action(OnFired)); while (!_fired) { yield return ((Bullet)this).Wait(1); } Vector2 val = Vector2.op_Implicit(((Component)boss).gameObject.transform.position + GunBarrelLowOffset(((BraveBehaviour)boss).sprite.FlipX)); MagicMissileBullet magicMissileBullet = new MagicMissileBullet(6f + 1f * (float)n, base.roomBulletBounds); mms.Add(magicMissileBullet); bool flipX = ((BraveBehaviour)boss).sprite.FlipX; float num = (flipX ? 180f : 0f); ((Bullet)this).Fire(Offset.OverridePosition(val), new Direction(num, (DirectionType)1, -1f), new Speed(60f, (SpeedType)0), (Bullet)(object)magicMissileBullet); ((Component)boss).gameObject.Play("armistice_missile_launch_sound"); int specificFrame; for (int i = 0; i < 6; i++) { GameObject missileFlak = _MissileFlak; Vector3 position = Vector2.op_Implicit(val); float rotation = num.AddRandomSpread(35f); Transform transform = ((Component)boss).gameObject.transform; specificFrame = i; CwaffVFX.SpawnDebris(missileFlak, position, rotation, 3f, 9f, null, transform, randomFrame: false, specificFrame, 20f); } GameObject muzzleVFXBullet = _MuzzleVFXBullet; Vector3 position2 = Vector2.op_Implicit(val); Quaternion? rotation2 = num.EulerZ(); Color? emissiveColor = ExtendedColours.vibrantOrange; CwaffVFX.Spawn(muzzleVFXBullet, position2, rotation2, null, 0f, null, 10f, emissiveColor, fadeIn: false, null, null, null, randomFrame: false, -1, flipX: false, flipY: false, null, null, 8f); CwaffVFX.SpawnBurst(_MissileSmokeVFX, 15, val + new Vector2(flipX ? (-0.75f) : 0.75f, 0f), 1f, (Vector2?)new Vector2(flipX ? (-6f) : 6f, 0f), 0f, 3f, CwaffVFX.Vel.Random, CwaffVFX.Rot.Velocity, 0.5f, (float?)0.5f, 0f, (Color?)null, fadeIn: false, uniform: false, (float?)null, (float?)null, (float?)null, randomFrame: false, -1, flipX: false, flipY: false, (Transform)null, (Color?)null, 1.55f, 0f, (tk2dSpriteCollectionData)null, -1, 0f, 0f, unoccluded: false, copyShaders: false); specificFrame = n + 1; n = specificFrame; } ((BraveBehaviour)boss).spriteAnimator.ClipFps = 0f; n = 0; while (n < numMissiles) { while (!((Bullet)mms[n]).IsEnded && !((Bullet)mms[n]).Destroyed) { yield return ((Bullet)this).Wait(1); } int specificFrame = n + 1; n = specificFrame; } } } private class RunaroundScript : ArmisticeBulletScript { protected override List BuildChain() { ((Bullet)this).TimeScale = -1f; return Run(Relocate()).Then(Relocate()).Then(Relocate()).Finish(); } } private class SniperScript : ArmisticeBulletScript { private class VelSnapshot { public Vector2 velocity; public float expireTime; } private const float _VEL_SMOOTH_TIME = 0.5f; private const int _VEL_BUFFER_SIZE = 200; private static VelSnapshot[] _Velocities = new VelSnapshot[200]; protected override List BuildChain() { return Run(Attack()).Finish(); } private IEnumerator Attack() { for (int i = 0; i < 200; i++) { _Velocities[i] = new VelSnapshot(); } PlayerController pc = GameManager.Instance.GetRandomActivePlayer(); AIActor actor = ((BraveBehaviour)((Bullet)this).BulletBank).aiActor; Transform transform = ((Component)actor).gameObject.transform; float x = transform.position.x; Rect val = base.roomFullBounds; bool facingLeft = x > ((Rect)(ref val)).center.x; Vector2 shootPoint = Vector2.op_Implicit(transform.position + GunBarrelOffset(facingLeft)); Offset shootOff = Offset.OverridePosition(shootPoint); Vector2 accumVel = default(Vector2); float startTime = BraveTime.ScaledTimeSinceStartup; float endTime = startTime + 9f; float prevTime = startTime; float lastFireTime = startTime; int firstValidVel = 0; int nextValidVel = 0; int spread = IntForPhase(new int[3] { 2, 3, 4 }); ((BraveBehaviour)actor).aiAnimator.PlayUntilCancelled("attack_basic", false, (string)null, -1f, false); tk2dSpriteAnimator spriteAnim = ((BraveBehaviour)actor).spriteAnimator; for (float num = startTime; num < endTime; num = BraveTime.ScaledTimeSinceStartup) { Vector2 val2 = (num - prevTime) * ((GameActor)pc).Velocity.ZeroIfNan(); accumVel += val2; _Velocities[nextValidVel].velocity = val2; _Velocities[nextValidVel].expireTime = num + 0.5f; nextValidVel = (nextValidVel + 1) % 200; for (int num2 = firstValidVel; num2 != nextValidVel; num2 = (num2 + 1) % 200) { firstValidVel = num2; if (_Velocities[num2].expireTime > num) { break; } accumVel -= _Velocities[num2].velocity; } prevTime = num; Vector2 targetVelocity = 2f * accumVel; float t = (num - startTime) / 9f; float num3 = Mathf.Lerp(0.5f, 0.06f, Ease.OutCubic(t)); float num4 = Mathf.Lerp(40f, 15f, Ease.OutCubic(t)); spriteAnim.ClipFps = 4f / num3; Lazy.DeterminePerfectAngleToShootAt(shootPoint, ((GameActor)pc).CenterPosition, targetVelocity, num4, out var shootAngle, out var _); if (num >= lastFireTime + num3) { lastFireTime = num; ((Component)actor).gameObject.PlayUnique("armistice_gun_spread_sound"); for (int j = -spread; j <= spread; j++) { ((Bullet)this).Fire(shootOff, new Direction(shootAngle + 5f * (float)j, (DirectionType)1, -1f), new Speed(num4, (SpeedType)0), (Bullet)(object)new SecretBullet()); if (j % 2 == 0) { GameObject basicFlak = _BasicFlak; Vector3 position = Vector2.op_Implicit(shootPoint); float rotation = shootAngle.AddRandomSpread(4f); Transform transform2 = ((Component)actor).gameObject.transform; CwaffVFX.SpawnDebris(basicFlak, position, rotation, 0.3f * num4, 0.6f * num4, null, transform2, randomFrame: true, -1, 20f); } } GameObject muzzleVFXBullet = _MuzzleVFXBullet; Vector3 position2 = Vector2.op_Implicit(shootPoint); Quaternion? rotation2 = (facingLeft ? 180f : 0f).AddRandomSpread(10f).EulerZ(); Color? emissiveColor = ExtendedColours.vibrantOrange; CwaffVFX.Spawn(muzzleVFXBullet, position2, rotation2, null, 0f, null, 10f, emissiveColor, fadeIn: false, null, null, null, randomFrame: false, -1, flipX: false, flipY: false, null, null, 8f); CwaffVFX.SpawnBurst(_MissileSmokeVFX, 5, shootPoint + new Vector2(facingLeft ? (-1f) : 1f, 0f), 1f, (Vector2?)new Vector2(facingLeft ? (-3f) : 3f, 0f), 0f, 1.5f, CwaffVFX.Vel.Random, CwaffVFX.Rot.Velocity, 0.6f, (float?)0.6f, 0f, (Color?)null, fadeIn: false, uniform: false, (float?)null, (float?)null, (float?)null, randomFrame: false, -1, flipX: false, flipY: false, (Transform)null, (Color?)null, 1.55f, 0f, (tk2dSpriteCollectionData)null, -1, 0f, 0f, unoccluded: false, copyShaders: false); } yield return ((Bullet)this).Wait(1); } spriteAnim.ClipFps = 0f; ((BraveBehaviour)actor).aiAnimator.PlayUntilCancelled(IdleForPhase(), false, (string)null, -1f, false); } } private class BirthShaderHandler : MonoBehaviour { private Material mat; private int coordsId; private void Start() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown mat = new Material(CwaffShaders.BirthShader); mat.SetTexture("_NoiseTex", (Texture)(object)CwaffShaders.StarNoiseTexture); mat.SetFloat("_Emission", 300f); mat.SetFloat("_FlashSpeed", 0.02f); mat.SetFloat("_Density", 0.02f); coordsId = Shader.PropertyToID("_CamXYWH"); Update(); TurnOn(); } private void Update() { //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_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_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_002e: 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_0041: 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_004d: Unknown result type (might be due to invalid IL or missing references) CameraController mainCameraController = GameManager.Instance.MainCameraController; Vector2 minVisiblePoint = mainCameraController.MinVisiblePoint; Vector2 val = mainCameraController.MaxVisiblePoint - minVisiblePoint; mat.SetVector(coordsId, new Vector4(0.0625f * minVisiblePoint.x, 0.0625f * minVisiblePoint.y, val.x, val.y)); } internal void TurnOn() { Pixelator.Instance.RegisterAdditionalRenderPass(mat); } internal void TurnOff() { Pixelator.Instance.DeregisterAdditionalRenderPass(mat); } } private class BossBehavior : BraveBehaviour { private static GameObject _ParticleSystem = null; internal ParticleSystem _ps; private static readonly Color _CalmRed = Color.Lerp(Color.red, Color.white, 0.15f); private static readonly Color _CalmBlue = Color.Lerp(Color.cyan, Color.white, 0.15f); private Color? _lastParticleColor; private int _lastDustFrame = -1; private HealthHaver _hh; private bool _inCombat; private static GameObject MakeParticleSystem(Color particleColor) { //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_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_0097: 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_00c4: 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_00dc: 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) //IL_00ec: 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_0105: Expected O, but got Unknown //IL_013d: 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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: 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_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Expected O, but got Unknown //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: 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_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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_0200: 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_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_0226: 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_0231: Unknown result type (might be due to invalid IL or missing references) //IL_023c: 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_024a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Expected O, but got Unknown //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0372: 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_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Expected O, but got Unknown //IL_0415: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(((Component)Items.CombinedRifle.AsGun().alternateVolley.projectiles[0].projectiles[0]).GetComponent().ParticleSystemToSpawn).RegisterPrefab(); ParticleSystem component = val.GetComponent(); float num = 2f; MainModule main = component.main; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).duration = 3600f; ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(1f); ((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(0.0625f); ((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)1; ((MainModule)(ref main)).startRotation = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).startRotation3D = false; ((MainModule)(ref main)).startRotationMultiplier = 0f; ((MainModule)(ref main)).maxParticles = 200; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(particleColor); ((MainModule)(ref main)).emitterVelocityMode = (ParticleSystemEmitterVelocityMode)0; ForceOverLifetimeModule forceOverLifetime = component.forceOverLifetime; ((ForceOverLifetimeModule)(ref forceOverLifetime)).enabled = false; VelocityOverLifetimeModule velocityOverLifetime = component.velocityOverLifetime; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)0; AnimationCurve val2 = new AnimationCurve(); val2.AddKey(0f, 5f); val2.AddKey(1f, 5f); MinMaxCurve val3 = default(MinMaxCurve); ((MinMaxCurve)(ref val3))..ctor(1f, val2); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).z = val3; MinMaxCurve x = (((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = val3); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = x; float num2 = (((VelocityOverLifetimeModule)(ref velocityOverLifetime)).zMultiplier = 1f); float xMultiplier = (((VelocityOverLifetimeModule)(ref velocityOverLifetime)).yMultiplier = num2); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).xMultiplier = xMultiplier; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).xMultiplier = 0f; RotationOverLifetimeModule rotationOverLifetime = component.rotationOverLifetime; ((RotationOverLifetimeModule)(ref rotationOverLifetime)).enabled = false; RotationBySpeedModule rotationBySpeed = component.rotationBySpeed; ((RotationBySpeedModule)(ref rotationBySpeed)).enabled = false; Gradient val5 = new Gradient(); val5.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(particleColor, 0f), new GradientColorKey(particleColor, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[3] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(1f, 0.9f), new GradientAlphaKey(0.01f, 1f) }); ColorOverLifetimeModule colorOverLifetime = component.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val5); EmissionModule emission = component.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(50f); ParticleSystemRenderer component2 = val.GetComponent(); ((Renderer)component2).material.SetFloat("_InvFade", 3f); ((Renderer)component2).material.SetFloat("_EmissionGain", 0.5f); ((Renderer)component2).material.SetColor("_EmissionColor", particleColor); ((Renderer)component2).material.SetColor("_DiffuseColor", particleColor); ((Renderer)component2).sortingLayerName = "Foreground"; SizeOverLifetimeModule sizeOverLifetime = component.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; AnimationCurve val6 = new AnimationCurve(); val6.AddKey(0f, 1f); val6.AddKey(0.5f, 1f); val6.AddKey(1f, 0f); ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1.5f, val6); ShapeModule shape = component.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)12; ((ShapeModule)(ref shape)).randomDirectionAmount = 0f; ((ShapeModule)(ref shape)).alignToDirection = false; ((ShapeModule)(ref shape)).scale = Vector3.one; ((ShapeModule)(ref shape)).radiusThickness = 1f; ((ShapeModule)(ref shape)).radiusMode = (ParticleSystemShapeMultiModeValue)0; ((ShapeModule)(ref shape)).length = 2f; ((ShapeModule)(ref shape)).position = new Vector3(-0.5f, 0f, 0f); ((ShapeModule)(ref shape)).radius = 1f; ((ShapeModule)(ref shape)).rotation = Vector3.up; ((ShapeModule)(ref shape)).arc = 360f; ((ShapeModule)(ref shape)).arcMode = (ParticleSystemShapeMultiModeValue)0; ((ShapeModule)(ref shape)).arcSpeed = MinMaxCurve.op_Implicit(num); ((ShapeModule)(ref shape)).meshShapeType = (ParticleSystemMeshShapeType)0; InheritVelocityModule inheritVelocity = component.inheritVelocity; ((InheritVelocityModule)(ref inheritVelocity)).enabled = true; ((InheritVelocityModule)(ref inheritVelocity)).mode = (ParticleSystemInheritVelocityMode)1; ((InheritVelocityModule)(ref inheritVelocity)).curveMultiplier = 1f; AnimationCurve val7 = new AnimationCurve(); val7.AddKey(0f, 1f); val7.AddKey(1f, 1f); ((InheritVelocityModule)(ref inheritVelocity)).curve = new MinMaxCurve(1f, val7); return val; } private void Start() { //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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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) ((BraveBehaviour)((BraveBehaviour)this).aiActor).bulletBank.Bullets.Add(_MainBullet); ((BraveBehaviour)((BraveBehaviour)this).aiActor).bulletBank.Bullets.Add(_TurretBullet); ((BraveBehaviour)((BraveBehaviour)this).aiActor).bulletBank.Bullets.Add(_WarheadBullet); ((BraveBehaviour)((BraveBehaviour)this).aiActor).bulletBank.Bullets.Add(_MagicMissileBullet); ((BraveBehaviour)((BraveBehaviour)this).aiActor).healthHaver.forcePreventVictoryMusic = true; _hh = ((BraveBehaviour)((BraveBehaviour)this).aiActor).healthHaver; ((BraveBehaviour)((BraveBehaviour)this).aiActor).healthHaver.OnPreDeath += OnPreDeath; if ((Object)(object)_ParticleSystem == (Object)null) { _ParticleSystem = MakeParticleSystem(_CalmRed); } GameObject val = Object.Instantiate(_ParticleSystem); val.transform.position = Vector2.op_Implicit(((BraveBehaviour)((BraveBehaviour)this).aiActor).sprite.WorldBottomCenter); val.transform.parent = ((Component)this).gameObject.transform; val.transform.localRotation = Quaternion.identity; _ps = val.GetComponent(); _ps.Stop(); _ps.Clear(); ((BraveBehaviour)((BraveBehaviour)this).aiActor).aiAnimator.PlayUntilCancelled("calm", false, (string)null, -1f, false); CwaffRunData.Instance.scrambledBulletHell = true; new GameObject("birth shader handler", new Type[1] { typeof(BirthShaderHandler) }); CwaffDungeons.PlayCustomFloorMusicDelayed(0.5f); } internal void FinishedIntro() { _inCombat = true; } private void OnPreDeath(Vector2 _) { _inCombat = false; GameManager.Instance.DungeonMusicController.LoopMusic("clocktowers", 210239, 182080); ((BraveBehaviour)((BraveBehaviour)this).aiActor).aiAnimator.PlayUntilCancelled("defeat", false, (string)null, -1f, false); CameraController mainCameraController = GameManager.Instance.MainCameraController; mainCameraController.OverrideZoomScale = 1f; mainCameraController.LockToRoom = false; mainCameraController.UseOverridePlayerOnePosition = false; mainCameraController.UseOverridePlayerTwoPosition = false; CustomTrackedStats.DEFEATED_ARMI.Increment(); CustomDungeonFlags.HAS_DEFEATED_ARMI.Set(); } private void SetParticleColor(Color? colorMaybe = null) { //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_0049: 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_0059: 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_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_0077: 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_0088: 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_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_00b4: 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_00e3: 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_00fa: Unknown result type (might be due to invalid IL or missing references) if (!colorMaybe.HasValue) { if (_ps.isPlaying) { _ps.Stop(); if (!_lastParticleColor.HasValue) { _ps.Clear(); } } return; } Color value = colorMaybe.Value; Color? lastParticleColor = _lastParticleColor; Color val = value; if (!lastParticleColor.HasValue || lastParticleColor.GetValueOrDefault() != val) { MainModule main = _ps.main; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(value); ColorOverLifetimeModule colorOverLifetime = _ps.colorOverLifetime; MinMaxGradient color = ((ColorOverLifetimeModule)(ref colorOverLifetime)).color; GradientColorKey[] colorKeys = ((MinMaxGradient)(ref color)).gradient.colorKeys; for (int i = 0; i < colorKeys.Length; i++) { colorKeys[i].color = value; } ParticleSystemRenderer component = ((Component)_ps).gameObject.GetComponent(); ((Renderer)component).material.SetColor("_EmissionColor", value); ((Renderer)component).material.SetColor("_DiffuseColor", value); _lastParticleColor = value; } if (!_ps.isPlaying) { _ps.Play(); } } private void LateUpdate() { //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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) if (BraveTime.DeltaTime == 0f || !_inCombat) { return; } float num = _hh.currentHealth / _hh.maximumHealth; if (num < 0.34f) { if (((BraveBehaviour)((BraveBehaviour)this).aiActor).aiAnimator.OverrideIdleAnimation != "exhausted") { ((BraveBehaviour)((BraveBehaviour)this).aiActor).aiAnimator.OverrideIdleAnimation = "exhausted"; } } else if (num < 0.67f && ((BraveBehaviour)((BraveBehaviour)this).aiActor).aiAnimator.OverrideIdleAnimation != "tired") { ((BraveBehaviour)((BraveBehaviour)this).aiActor).aiAnimator.OverrideIdleAnimation = "tired"; } tk2dSpriteAnimator spriteAnimator = ((BraveBehaviour)this).spriteAnimator; tk2dSpriteAnimationClip currentClip = spriteAnimator.CurrentClip; if (currentClip.name == "run" && spriteAnimator.CurrentFrame != _lastDustFrame) { SpawnDust(Vector2.op_Implicit(((BraveBehaviour)this).transform.position)); _lastDustFrame = spriteAnimator.CurrentFrame; } if (currentClip.name == "defeat" && spriteAnimator.CurrentFrame < 4) { spriteAnimator.ClipFps = 24f; } else { spriteAnimator.ClipFps = 0f; } string name = currentClip.name; Color? particleColor = ((name == "calm") ? new Color?(_CalmRed) : ((!(name == "breathe")) ? ((Color?)null) : new Color?(_CalmBlue))); SetParticleColor(particleColor); } } private class ArmisticeIntro : SpecificIntroDoer { public override void PlayerWalkedIn(PlayerController player, List animators) { //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) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) Rect val = ((DungeonPlaceableBehaviour)((BraveBehaviour)this).aiActor).GetAbsoluteParentRoom().GetBoundingRect().Inset(8f); foreach (AttackGroupItem attackBehavior in ((Component)((BraveBehaviour)this).aiActor).GetComponent().AttackBehaviorGroup.AttackBehaviors) { if (attackBehavior.Behavior is TeleportBehavior) { AttackBehaviorBase behavior = attackBehavior.Behavior; AttackBehaviorBase obj = ((behavior is TeleportBehavior) ? behavior : null); ((TeleportBehavior)obj).ManuallyDefineRoom = true; ((TeleportBehavior)obj).roomMin = ((Rect)(ref val)).min; ((TeleportBehavior)obj).roomMax = ((Rect)(ref val)).max; } } CameraController mainCameraController = GameManager.Instance.MainCameraController; mainCameraController.OverrideZoomScale = 0.5f; mainCameraController.LockToRoom = true; mainCameraController.UseOverridePlayerOnePosition = true; mainCameraController.OverridePlayerOnePosition = ((Rect)(ref val)).center; mainCameraController.UseOverridePlayerTwoPosition = true; mainCameraController.OverridePlayerTwoPosition = ((Rect)(ref val)).center; } public override void EndIntro() { ((Component)((BraveBehaviour)this).aiActor).GetComponent().FinishedIntro(); } } public const string BOSS_GUID = "Armistice"; internal const string BOSS_NAME = "Armistice"; private const string SUBTITLE = "Tranquil Gungeoneer"; private const string SPRITE_PATH = "CwaffingTheGungy/Resources/Bosses/armistice"; internal const float TIRED_THRES = 0.67f; internal const float EXHAUSTED_THRES = 0.34f; private static Entry _MainBullet; private static Entry _TurretBullet; private static Entry _WarheadBullet; private static Entry _MagicMissileBullet; internal static GameObject _BulletSpawnVFX; internal static GameObject _MuzzleVFXBullet; internal static GameObject _MuzzleVFXElectro; internal static GameObject _MuzzleVFXTurret; internal static GameObject _MuzzleVFXSnipe; internal static GameObject _ExplosionVFX; internal static GameObject _SmokeVFX; internal static GameObject _MissileSmokeVFX; internal static GameObject _MissileFlak; internal static GameObject _BasicFlak; internal static GameObject _LaserFlakVFX; internal static CwaffTrailController _LaserTrailPrefab; internal static CwaffTrailController _TrickshotTrailPrefab; internal static CwaffTrailController _WarheadTrailPrefab; private const int _ARMISTICE_HP = 150; public static PrototypeDungeonRoom ArmisticeBossRoom; private static Vector3 GunBarrelOffset(bool facingLeft) { //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) return 0.0625f * new Vector3(facingLeft ? (-36f) : 36f, 23f, 0f); } private static Vector3 GunBarrelHighOffset(bool facingLeft) { //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) return 0.0625f * new Vector3(facingLeft ? (-15f) : 15f, 48f, 0f); } private static Vector3 GunBarrelLowOffset(bool facingLeft) { //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) return 0.0625f * new Vector3(facingLeft ? (-29f) : 29f, 18f, 0f); } public static void Init() { //IL_0012: 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) BuildABoss buildABoss = BuildABoss.LetsMakeABoss("Armistice", "Armistice", "CwaffingTheGungy/Resources/Bosses/armistice/armistice_idle_001", new IntVector2(8, 9), "Tranquil Gungeoneer", "CwaffingTheGungy/Resources/armistice_bosscard_alt.png"); buildABoss.SetStats(150f, 200f, 0.4f, 0f, hitReactChance: 0.05f, collisionKnockbackStrength: 0f, healthIsNumberOfHits: true, invulnerabilityPeriod: 1f, shareCooldowns: false, spriteAnchor: (Anchor)1); buildABoss.InitSpritesFromResourcePath("CwaffingTheGungy/Resources/Bosses/armistice"); buildABoss.AdjustAnimation("attack_basic", 16f, true); buildABoss.AdjustAnimation("attack_snipe", 16f, false); buildABoss.AdjustAnimation("breathe", 2f, true); buildABoss.AdjustAnimation("calm", 8f, true); buildABoss.AdjustAnimation("crouch", 16f, false, new List(1) { 4 }, new List(1) { "armistice_missile_launch_sound" }); buildABoss.AdjustAnimation("death", 15f, false); buildABoss.AdjustAnimation("defeat", 3f, true, null, null, 4); buildABoss.AdjustAnimation("exhausted", 4f, true); buildABoss.AdjustAnimation("idle", 16f, true); buildABoss.AdjustAnimation("ready", 16f, false); buildABoss.AdjustAnimation("reload", 16f, false, new List(2) { 6, 12 }, new List(2) { "armistice_reload_sound_a", "armistice_reload_sound_b" }); buildABoss.AdjustAnimation("run", 40f, true, new List(2) { 4, 8 }, new List(2) { "armistice_step_sound", "armistice_step_sound" }); buildABoss.AdjustAnimation("skyshot", 30f, false, new List(1) { 5 }); buildABoss.AdjustAnimation("talk", 8f, true); buildABoss.AdjustAnimation("teleport_in", 9f, false); buildABoss.AdjustAnimation("teleport_out", 9f, false); buildABoss.AdjustAnimation("tired", 6f, true); buildABoss.SetIntroAnimations("idle", "idle"); buildABoss.SetDefaultColliders(30, 40, -15, 2); buildABoss.AddCustomIntro(); buildABoss.MakeInteractible(preFight: true, postFight: true, noOutlines: true, new Vector2(-0.375f, 0.25f)); buildABoss.TargetPlayer(); buildABoss.AddCustomMusic("collapse", 320576, 225251); buildABoss.CreateBulletAttack(add: true, 3f, 0f, 0.5f, 0f, 0.5f, 0f, 1f, -1, requiresLineOfSight: false, 0f, 1f, null, accumulateHealthThresholds: true, 0f, 0f, 0f, null, "breathe", "teleport_out", null, "teleport_in", 0f, 0f, interruptible: true); buildABoss.CreateBulletAttack(add: true, 3f, 0f, 0.5f, 0f, 5f, 0f, 1f, -1, requiresLineOfSight: false, 0f, 1f, null, accumulateHealthThresholds: true, 0f, 0f, 0f, null, "calm", null, null, null, 0f, 0f, interruptible: true); buildABoss.CreateBulletAttack(add: true, 3f, 0f, 0.5f, 0f, 0.5f, 0f, 1f, -1, requiresLineOfSight: false, 0f, 1f, null, accumulateHealthThresholds: true, 0f, 0f, 0f, null, "attack_snipe", "ready", null, null, 0f, 0f, interruptible: true); buildABoss.CreateBulletAttack(add: true, 3f, 0f, 0.5f, 0f, 0.5f, 0f, 1f, -1, requiresLineOfSight: false, 0f, 1f, null, accumulateHealthThresholds: true, 0f, 0f, 0f, null, "attack_basic", "ready", null, null, 0f, 0f, interruptible: true); buildABoss.CreateBulletAttack(add: true, 3f, 0f, 0.5f, 0f, 0.5f, 0f, 1f, -1, requiresLineOfSight: false, 0f, 1f, null, accumulateHealthThresholds: true, 0f, 0f, 0f, null, "skyshot", "reload", null, null, 0f, 0f, interruptible: true); buildABoss.CreateBulletAttack(add: true, 3f, 0f, 0.5f, 0f, 0.5f, 0f, 1f, -1, requiresLineOfSight: false, 0f, 1f, null, accumulateHealthThresholds: true, 0f, 0f, 0f, null, "idle", null, null, null, 0f, 0f, interruptible: true); buildABoss.CreateBulletAttack(add: true, 3f, 0f, 0.5f, 0f, 0.5f, 0f, 1f, -1, requiresLineOfSight: false, 0f, 1f, null, accumulateHealthThresholds: true, 0f, 0f, 0f, null, "crouch", "reload", null, null, 0f, 0f, interruptible: true); buildABoss.CreateBulletAttack(add: true, 3f, 0f, 0.5f, 0f, 0.5f, 0f, 1f, -1, requiresLineOfSight: false, 0f, 1f, null, accumulateHealthThresholds: true, 0f, 0f, 0f, null, null, "reload", null, null, 0f, 0f, interruptible: true); buildABoss.AddBossToGameEnemies("cg:armisticeboss"); ArmisticeBossRoom = buildABoss.CreateStandaloneBossRoom(40, 30, exitOnBottom: true); ArmisticeBossRoom.usesProceduralDecoration = false; ArmisticeBossRoom.usesProceduralLighting = false; int[] array = new int[4] { 0, 10, 19, 29 }; foreach (int num in array) { int[] array2 = new int[4] { 4, 14, 25, 35 }; foreach (int num2 in array2) { ArmisticeBossRoom.FullCellData[num2 + num * 40].containsManuallyPlacedLight = true; } } InitPrefabs(); } private static void InitPrefabs() { //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Expected O, but got Unknown //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_04cc: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Expected O, but got Unknown //IL_0526: Unknown result type (might be due to invalid IL or missing references) //IL_052b: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_0559: Expected O, but got Unknown //IL_05a6: Unknown result type (might be due to invalid IL or missing references) //IL_05b2: Unknown result type (might be due to invalid IL or missing references) //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_05ce: Unknown result type (might be due to invalid IL or missing references) //IL_05d9: Unknown result type (might be due to invalid IL or missing references) //IL_05e0: Unknown result type (might be due to invalid IL or missing references) //IL_05ec: Unknown result type (might be due to invalid IL or missing references) //IL_05fc: Expected O, but got Unknown _BulletSpawnVFX = VFX.Create("armistice_bulet_spawn_vfx", 60f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _MuzzleVFXBullet = VFX.Create("muzzle_armistice_bullet", 60f, loops: false, -1, 1f, (Anchor)3, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _MuzzleVFXElectro = VFX.Create("muzzle_armistice_electro", 60f, loops: false, -1, 1f, (Anchor)3, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _MuzzleVFXTurret = VFX.Create("muzzle_armistice_turret", 60f, loops: false, -1, 1f, (Anchor)3, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _MuzzleVFXSnipe = VFX.Create("muzzle_armistice_snipe", 60f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _ExplosionVFX = VFX.Create("armistice_warhead_explosion_vfx", 30f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _SmokeVFX = VFX.Create("armistice_warhead_smoke", 16f, loops: false, -1, 0.5f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _LaserFlakVFX = VFX.Create("armistice_laser_flak", 30f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _MissileSmokeVFX = VFX.Create("armistice_missile_smoke_vfx", 60f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _LaserTrailPrefab = VFX.CreateSpriteTrailObject("armistice_laser_trail", 60, null, -1f, 1f / 60f, 1f, destroyOnEmpty: true); _TrickshotTrailPrefab = VFX.CreateSpriteTrailObject("armistice_trickshot_trail_a", 60, null, -1f, 1f / 60f, 1f, destroyOnEmpty: true); _WarheadTrailPrefab = VFX.CreateSpriteTrailObject("armistice_warhead_smoke_trail", 60, null, -1f, 1f / 60f, 1f, destroyOnEmpty: true); Entry bullet = ((BraveBehaviour)EnemyDatabase.GetOrLoadByGuid("1bc2a07ef87741be90c37096910843ab")).bulletBank.GetBullet("reversible"); Projectile component = bullet.BulletObject.ClonePrefab().GetComponent(); ((Object)((Component)component).gameObject).name = "armistice base projectile"; _MainBullet = new Entry(bullet) { Name = "getboned", PlayAudio = false, BulletObject = ((Component)component).gameObject, MuzzleFlashEffects = VFX.VFXPoolNone() }; Projectile val = Items._38Special.CloneProjectile(); ((Object)((Component)val).gameObject).name = "armistice turret projectile"; val.AddDefaultAnimation(AnimatedBullet.Create("armistice_turret", 30, (Anchor)4), 0, overwriteExisting: true); _TurretBullet = new Entry(bullet) { Name = "turret", PlayAudio = false, BulletObject = ((Component)val).gameObject, MuzzleFlashEffects = VFX.VFXPoolNone() }; Projectile val2 = Items._38Special.CloneProjectile(); ((Object)((Component)val2).gameObject).name = "armistice warhead projectile"; val2.AddDefaultAnimation(AnimatedBullet.Create("armistice_warhead", 2, (Anchor)4), 0, overwriteExisting: true); _WarheadBullet = new Entry(bullet) { Name = "warhead", PlayAudio = false, BulletObject = ((Component)val2).gameObject, MuzzleFlashEffects = VFX.VFXPoolNone() }; Projectile val3 = Items._38Special.CloneProjectile(); ((Object)((Component)val3).gameObject).name = "armistice magic missile projectile"; val3.shouldFlipHorizontally = false; val3.shouldFlipVertically = false; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)val3).specRigidbody; specRigidbody.UpdateCollidersOnRotation = true; specRigidbody.UpdateCollidersOnScale = true; val3.AddDefaultAnimation(AnimatedBullet.Create("armistice_magic_missile_b", 30, (Anchor)4, 1f, anchorsChangeColliders: false, fixesScales: false, (IntVector2?)new IntVector2(16, 7), (IntVector2?)new IntVector2(8, 0), firstFrameIsReference: true), 0, overwriteExisting: true); _MagicMissileBullet = new Entry(bullet) { Name = "magicmissile", PlayAudio = false, BulletObject = ((Component)val3).gameObject, MuzzleFlashEffects = VFX.VFXPoolNone() }; _MissileFlak = Lazy.EasyDebris("armistice_missile_flak"); _BasicFlak = Lazy.EasyDebris("armistice_basic_flak"); } private static void SpawnDust(Vector2 where) { //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_001a: Unknown result type (might be due to invalid IL or missing references) SpawnManager.SpawnVFX(GameManager.Instance.Dungeon.dungeonDustups.rollLandDustup, Vector2.op_Implicit(where), Lazy.RandomEulerZ()); } } internal static class BossShared { private static GameObject _NapalmReticle; internal static void Init() { _NapalmReticle = ResourceManager.LoadAssetBundle("shared_auto_002").LoadAsset("NapalmStrikeReticle").ClonePrefab(); ((tk2dBaseSprite)_NapalmReticle.GetComponent()).SetSprite(VFX.Collection, VFX.Collection.GetSpriteIdByName("reticle_white")); Object.Destroy((Object)(object)_NapalmReticle.GetComponent()); } internal static tk2dSlicedSprite DoomZone(Vector2 start, Vector2 target, float width, float lifetime = -1f, int growthTime = 1, string sprite = null, bool rise = true) { //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_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_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_007d: 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_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_00a0: Unknown result type (might be due to invalid IL or missing references) Vector2 self = target - start; GameObject val = Object.Instantiate(_NapalmReticle); GameObjectExtensions.SetLayerRecursively(val, LayerMask.NameToLayer("FG_Critical")); tk2dSlicedSprite component = val.GetComponent(); if (sprite != null) { ((tk2dBaseSprite)component).SetSprite(VFX.Collection, VFX.Collection.GetSpriteIdByName(sprite)); } component.dimensions = 16f * new Vector2(((Vector2)(ref self)).magnitude / (float)growthTime, width); ((BraveBehaviour)component).transform.localRotation = self.EulerZ(); ((BraveBehaviour)component).transform.position = Vector2.op_Implicit(start + 0.5f * width * ((Vector2)(ref self)).normalized.Rotate(-90f)); ((MonoBehaviour)component).StartCoroutine(Lengthen(component, ((Vector2)(ref self)).magnitude, growthTime, rise)); if (lifetime > 0f) { val.ExpireIn(lifetime); } return component; static IEnumerator Lengthen(tk2dSlicedSprite quad, float targetLength, int numFrames, bool flag) { float scaleFactor = 16f * targetLength / (float)numFrames; int i = 1; while (i <= numFrames) { quad.dimensions = Vector2Extensions.WithX(quad.dimensions, scaleFactor * (float)i); ((tk2dBaseSprite)quad).UpdateZDepth(); yield return null; int num = i + 1; i = num; } if (flag) { ((Component)quad).gameObject.AddComponent().NumRisers = 3; } } } internal static void Retarget(this tk2dSlicedSprite quad, Vector2 start, Vector2 target) { //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_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_0022: 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_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_0050: 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_0071: 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) bool usesOverrideMaterial = ((tk2dBaseSprite)quad).usesOverrideMaterial; Material material = (usesOverrideMaterial ? ((BraveBehaviour)quad).renderer.material : null); Vector2 self = target - start; quad.dimensions = Vector2Extensions.WithX(quad.dimensions, 16f * ((Vector2)(ref self)).magnitude); ((BraveBehaviour)quad).transform.localRotation = self.EulerZ(); float num = quad.dimensions.y / 16f; ((BraveBehaviour)quad).transform.position = Vector2.op_Implicit(start + 0.5f * num * ((Vector2)(ref self)).normalized.Rotate(-90f)); ((tk2dBaseSprite)quad).UpdateZDepth(); if (usesOverrideMaterial) { ((BraveBehaviour)quad).renderer.material = material; } } } public class SansNPC : BossNPC { private bool _talkedOnce; protected override IEnumerator PreFightScript() { GameManager.Instance.MainCameraController.OverridePosition = ((BraveBehaviour)((BraveBehaviour)this).sprite).transform.localPosition; GameManager.Instance.MainCameraController.SetManualControl(true, true); defaultAudioEvent = "sans_laugh"; if (!_talkedOnce) { yield return Converse("hey kid, how'd you manage to find me?", "idle", "idle"); yield return Converse("this place ain't exactly easy to get to", "idle_glance", "idle_glance"); yield return Converse("that bello guy tip you off, or you just get here by luck?", "idle", "idle"); yield return Converse("...eh, doesn't matter", "shrug_glance", "shrug_glance"); yield return Converse("seems like you have some cool toys on you", "idle", "idle"); yield return Converse("since you're here, wanna try my little test?", "idle_glance", "idle_glance"); yield return Converse("if you can manage to land a few hits on me, i'll tell you a secret", "shrug", "shrug"); yield return Converse("i don't have any guns on me, but i'll try to make it interesting", "idle", "idle"); yield return Converse("and don't feel the need to hold back, i can handle myself", "shrug", "shrug"); yield return Converse("whaddaya say, kid?", "idle_glance", "idle_glance"); _talkedOnce = true; } else { yield return Converse("hey kid, change your mind?", "idle", "idle"); } SetAnimation("idle"); yield return Prompt("let's go!", "not right now"); if (PromptResult() == 0) { yield return Converse("alright, show me what you got kid", "idle", "idle"); yield return Converse("and remember, don't hold back", "shrug", "shrug"); yield return Converse("...cause I won't be", "idle_empty", "idle_empty"); ((Component)((BraveBehaviour)this).aiActor).gameObject.Play("sans_stop_all"); StartBossFight(); } else { yield return Converse("alright, suit yourself", "shrug_calm", "shrug_calm"); yield return Converse("i'll be here if you change your mind", "idle", "idle"); SetAnimation("idle"); } } protected override IEnumerator DefeatedScript() { ShowText("good stuff, kid. come here", 1f); yield return (object)new WaitForSeconds(1f); } protected override IEnumerator PostFightScript() { GameManager.Instance.MainCameraController.OverridePosition = ((BraveBehaviour)((BraveBehaviour)this).sprite).transform.localPosition; GameManager.Instance.MainCameraController.SetManualControl(true, true); yield return Converse("you really got me, kid", "shrug", "shrug"); yield return Converse("the item in that chest is all yours", "idle", "idle"); yield return Converse("as for that secret...", "idle", "idle"); yield return Converse("have you ever come across a {wj}Normal{w} gun?", "idle", "idle"); yield return Converse("i don't mean a standard or ordinary gun, but a {wj}Normal{w} gun", "shrug_calm", "shrug_calm"); yield return Converse("i've heard if you drop a {wj}Normal{w} gun inside a triangle of 3 other guns...", "idle", "idle"); yield return Converse("something cool might happen depending on the combined strength of the guns", "idle_glance", "idle_glance"); yield return Converse("if something cool DOES happen, try using a blank", "idle", "idle"); yield return Converse("and if nothing happens, maybe try dropping some stronger guns", "shrug", "shrug"); yield return Converse("what, you think i'm making all of this up?", "idle", "idle"); yield return Converse("eh, could be", "idle_glance", "idle_glance"); yield return Converse("let's do this again some time", "shrug", "shrug"); SetAnimation("idle"); } } public class SansBoss : AIActor { private class BossBehavior : BraveBehaviour { private HeatIndicatorController aura; private void Start() { ((BraveBehaviour)((BraveBehaviour)this).aiActor).bulletBank.Bullets.Add(_BoneBullet); ((BraveBehaviour)((BraveBehaviour)this).aiActor).healthHaver.forcePreventVictoryMusic = true; ((BraveBehaviour)((BraveBehaviour)this).aiActor).healthHaver.OnPreDeath += OnPreDeath; CwaffDungeons.PlayCustomFloorMusicDelayed(0.5f); } private void OnPreDeath(Vector2 _) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) FlipSpriteIfNecessary(false); GameManager.Instance.DungeonMusicController.LoopMusic("sans", 48800, 48800); if (Object.op_Implicit((Object)(object)aura) && Object.op_Implicit((Object)(object)((Component)aura).gameObject)) { Object.Destroy((Object)(object)((Component)aura).gameObject); } aura = null; bool flag = default(bool); Lazy.SpawnChestWithSpecificItem(Lazy.Pickup(), GameManager.Instance.PrimaryPlayer.CurrentRoom.GetCenteredVisibleClearSpot(2, 2, ref flag, false), (ItemQuality)5); CustomTrackedStats.DEFEATED_SKEL.Increment(); CustomDungeonFlags.HAS_DEFEATED_SKEL.Set(); } private void LateUpdate() { //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_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_0087: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) if (BraveTime.DeltaTime == 0f) { return; } FlipSpriteIfNecessary(); if (!((Object)(object)aura == (Object)null)) { Transform transform = ((BraveBehaviour)((BraveBehaviour)this).sprite).transform; transform.localPosition += Vector3Extensions.WithY(Vector3.zero, (float)Mathf.CeilToInt(4f * Mathf.Sin(4f * BraveTime.ScaledTimeSinceStartup)) / 16f); ((BraveBehaviour)this).aiActor.PathfindToPosition(((BraveBehaviour)GameManager.Instance.PrimaryPlayer).specRigidbody.UnitCenter, (Vector2?)null, true, (CellValidator)null, (ExtraWeightingFunction)null, (CellTypes?)null, false); if (Lazy.CoinFlip()) { SpawnDust(((BraveBehaviour)this).specRigidbody.UnitCenter + Lazy.RandomVector(Random.Range(0.3f, 1.25f))); } } } private void FlipSpriteIfNecessary(bool? overrideFlip = null) { //IL_003b: 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_0076: 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_008a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)((BraveBehaviour)this).sprite) && Object.op_Implicit((Object)(object)((BraveBehaviour)this).specRigidbody)) { PlayerController bestActivePlayer = GameManager.Instance.BestActivePlayer; if (bestActivePlayer != null) { ((BraveBehaviour)this).sprite.FlipX = overrideFlip ?? (((GameActor)bestActivePlayer).CenterPosition.x < ((BraveBehaviour)this).specRigidbody.UnitBottomCenter.x); ((BraveBehaviour)((BraveBehaviour)this).sprite).transform.localPosition = Vector2Extensions.ToVector3ZisY(dfVectorExtensions.Quantize(((BraveBehaviour)this).specRigidbody.UnitBottomCenter, 0.0625f), 0f); ((BraveBehaviour)this).sprite.UpdateZDepth(); } } } public void FinishedIntro() { //IL_0020: 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_0049: 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) if (!((Object)(object)aura != (Object)null)) { aura = ((GameObject)Object.Instantiate(ResourceCache.Acquire("Global VFX/HeatIndicator"), Vector2Extensions.ToVector3ZisY(((GameActor)((BraveBehaviour)this).aiActor).CenterPosition, 0f), Quaternion.identity, ((BraveBehaviour)((BraveBehaviour)((BraveBehaviour)this).aiActor).sprite).transform)).GetComponent(); aura.CurrentColor = Color.white; aura.IsFire = true; aura.CurrentRadius = 2f; } } } private class SansIntro : SpecificIntroDoer { private bool _processedEncounter; public override void PlayerWalkedIn(PlayerController player, List animators) { //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) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) Rect val = ((DungeonPlaceableBehaviour)((BraveBehaviour)this).aiActor).GetAbsoluteParentRoom().GetBoundingRect().Inset(8f); foreach (AttackGroupItem attackBehavior in ((Component)((BraveBehaviour)this).aiActor).GetComponent().AttackBehaviorGroup.AttackBehaviors) { if (attackBehavior.Behavior is TeleportBehavior) { AttackBehaviorBase behavior = attackBehavior.Behavior; AttackBehaviorBase obj = ((behavior is TeleportBehavior) ? behavior : null); ((TeleportBehavior)obj).ManuallyDefineRoom = true; ((TeleportBehavior)obj).roomMin = ((Rect)(ref val)).min; ((TeleportBehavior)obj).roomMax = ((Rect)(ref val)).max; } } } public override void EndIntro() { if (!_processedEncounter) { _processedEncounter = true; CustomTrackedStats.ENCOUNTERED_SKEL.Increment(); } ((Component)((BraveBehaviour)this).aiActor).GetComponent().FinishedIntro(); } } private class SecretBullet : Bullet { private Color? tint; public SecretBullet(Color? tint = null) : base("getboned", false, false, false) { this.tint = tint; } public override void Initialize() { //IL_0038: 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) base.Projectile.ChangeTintColorShader(0f, (Color)(((??)tint) ?? new Color(1f, 0.5f, 0.5f, 0.5f))); ((Bullet)this).Initialize(); } } private class SineBullet : SecretBullet { private float amplitude = 1f; private float freq = 1f; private float phase; private float? rotationOverride; private float lifetime; public SineBullet(float amplitude, float freq, float phase = 0f, float? rotationOverride = null) { this.amplitude = amplitude; this.freq = freq; this.phase = phase; this.rotationOverride = rotationOverride; } public override IEnumerator Top() { ((Component)((Bullet)this).Projectile).gameObject.Play("Play_WPN_spacerifle_shot_01"); Vector2 startSpeed = ((Bullet)(object)this).RealVelocity(); float self = ((rotationOverride ?? Vector2Extensions.ToAngle(startSpeed)) + 90f).Clamp180(); Vector2 amp = amplitude * self.ToVector(); Vector2 anchorPos = ((Bullet)this).Position - Mathf.Sin(phase) * amp; float adjfreq = freq * 2f * (float)Math.PI; ((Bullet)this).ChangeSpeed(new Speed(0f, (SpeedType)0), 1); while (true) { lifetime += BraveTime.DeltaTime; anchorPos += startSpeed; Vector2 position = ((Bullet)this).Position; float num = Mathf.Sin(adjfreq * lifetime + phase); ((Bullet)this).Position = anchorPos + num * amp; ((Bullet)this).ChangeDirection(new Direction(Vector2Extensions.ToAngle(((Bullet)this).Position - position), (DirectionType)1, -1f), 1); yield return ((Bullet)this).Wait(1); } } } private abstract class SecretBulletScript : FluidBulletScript { protected AIActor theBoss { get; private set; } protected Rect roomFullBounds { get; private set; } protected Rect roomBulletBounds { get; private set; } protected Rect roomSlamBounds { get; private set; } public override void Initialize() { //IL_0023: 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_0048: 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_006d: Unknown result type (might be due to invalid IL or missing references) ((Bullet)this).Initialize(); theBoss = ((BraveBehaviour)((Bullet)this).BulletBank).aiActor; roomFullBounds = ((DungeonPlaceableBehaviour)theBoss).GetAbsoluteParentRoom().GetBoundingRect(); roomBulletBounds = roomFullBounds.Inset(2f, 2f, 4f, 2f); roomSlamBounds = roomFullBounds.Inset(2f, 2.5f, 2f, 1.5f); } } private class OrangeAndBlueScript : SecretBulletScript { internal class OrangeAndBlueBullet : SecretBullet { private bool orange; public OrangeAndBlueBullet(bool orange) : base(orange ? orangeColor : blueColor) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) this.orange = orange; } public override IEnumerator Top() { SpeculativeRigidbody specRigidbody = ((BraveBehaviour)((Bullet)this).Projectile).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreCollision)); yield return ((Bullet)this).Wait(180); ((Bullet)this).Vanish(false); } private void OnPreCollision(SpeculativeRigidbody me, PixelCollider myPixelCollider, SpeculativeRigidbody other, PixelCollider otherPixelCollider) { if (((Bullet)this).Destroyed) { return; } GameActor gameActor = ((BraveBehaviour)other).gameActor; PlayerController val = (PlayerController)(object)((gameActor is PlayerController) ? gameActor : null); if (val != null) { bool flag = dfStringExtensions.Contains(((BraveBehaviour)val).spriteAnimator.CurrentClip.name, "idle", true); if (orange != flag) { PhysicsEngine.SkipCollision = true; } } } } private static readonly string orangeReticle = "reticle_orange"; private static readonly string blueReticle = "reticle_blue"; private static readonly Color orangeColor = new Color(1f, 0.75f, 0f, 0.5f); private static readonly Color blueColor = new Color(0.15f, 0.65f, 1f, 0.5f); private const int COUNT = 32; private const int WAVES = 5; private const int BATCH = 8; private const float SPEED = 50f; private const float LENIENCE = 30f; private const float COOLDOWN = 30f; protected override List BuildChain() { return Run(DoTheThing(Lazy.CoinFlip())).Then(DoTheThing(Lazy.CoinFlip())).Then(DoTheThing(Lazy.CoinFlip())).Finish(); } private IEnumerator DoTheThing(bool orange) { PlayerController target = GameManager.Instance.GetRandomActivePlayer(); ((Component)base.theBoss).gameObject.Play("undertale_eyeflash"); Vector2 ppos = ((GameActor)target).CenterPosition; for (float num = 1f; num <= 4f; num += 1f) { BossShared.DoomZone(ppos - num * 0.5f * Vector2.right, ppos + num * 0.5f * Vector2.right, num, 0.5f, 1, orange ? orangeReticle : blueReticle); } List points = new PathRect(base.roomBulletBounds).SampleUniform(32); yield return ((Bullet)this).Wait(30f); int wave = 0; while (wave < 5) { if (!Object.op_Implicit((Object)(object)target)) { target = GameManager.Instance.GetRandomActivePlayer(); } ((Component)base.theBoss).gameObject.Play("Play_WPN_spacerifle_shot_01"); ppos = ((GameActor)target).CenterPosition; int count = 0; int num2; foreach (Vector2 item in points) { ((Bullet)this).Fire(Offset.OverridePosition(item), new Direction(Vector2Extensions.ToAngle(ppos + Lazy.RandomAngle().ToVector(3f) - item), (DirectionType)1, -1f), new Speed(50f, (SpeedType)0), (Bullet)(object)new OrangeAndBlueBullet(orange)); num2 = count + 1; count = num2; if (num2 % 8 == 0) { yield return ((Bullet)this).Wait(1); } } num2 = wave + 1; wave = num2; } yield return ((Bullet)this).Wait(30f); } } private class SineWaveScript : SecretBulletScript { private const int COUNT = 50; protected override List BuildChain() { ((Component)base.theBoss).gameObject.Play("sans_laugh"); return Run(DoTheThing()).And(DoTheThing(reverse: true)).And(DoTheThing(reverse: false, inverse: true)).And(DoTheThing(reverse: true, inverse: true)) .Finish(); } private IEnumerator DoTheThing(bool reverse = false, bool inverse = false) { PathLine pathLine = (inverse ? new PathRect(base.roomBulletBounds).Right() : new PathRect(base.roomBulletBounds).Left()); int i = 0; foreach (Vector2 item in pathLine.SampleUniform(50, reverse ? 0.9f : 0.1f, reverse ? 0.1f : 0.9f)) { ((Bullet)this).Fire(Offset.OverridePosition(item), new Direction(inverse ? 180f : 0f, (DirectionType)1, -1f), new Speed(20f, (SpeedType)0), (Bullet)(object)new SineBullet(3f, reverse ? (-1f) : 1f, (float)(reverse ? (-i) : i) * 0.1f, 0f)); yield return ((Bullet)this).Wait(5); int num = i + 1; i = num; } } } private class WiggleWaveScript : SecretBulletScript { private const int COUNT = 57; protected override List BuildChain() { ((Component)base.theBoss).gameObject.Play("sans_laugh"); int version = (Lazy.CoinFlip() ? 1 : 2); return Run(DoTheThing(0f, version)).And(DoTheThing(0.25f, version)).And(DoTheThing(0.5f, version)).And(DoTheThing(0.75f, version)) .Finish(); } private IEnumerator DoTheThing(float start, int version) { Vector2 centerPosition = ((GameActor)base.theBoss).CenterPosition; PathCircle theCircle = new PathCircle(centerPosition, 2f); int i = 0; int waitTime = ((version == 1) ? 5 : 4); foreach (Vector2 item in theCircle.SampleUniform(57, start, start + ((version == 1) ? 1f : 2f))) { ((Bullet)this).Fire(Offset.OverridePosition(item), new Direction(theCircle.AngleTo(item), (DirectionType)1, -1f), new Speed(12f, (SpeedType)0), (Bullet)(object)new SineBullet(3f, 0.5f)); yield return ((Bullet)this).Wait(waitTime); if (version == 2) { int num = i + 1; i = num; if (num % 5 == 0) { yield return ((Bullet)this).Wait(30); } } } } } private class WallSlamScript : SecretBulletScript { internal class GravityBullet : SecretBullet { private const int LIFETIME = 30; private const int VANISHTIME = 120; private Vector2 gravity = Vector2.zero; private bool skipCollisions = true; private Vector2 startVelocity = Vector2.zero; private Rect roomFullBounds; public GravityBullet(Vector2 velocity, Vector2 gravity, Rect roomFullBounds) { //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_0013: 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_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_0034: 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_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) this.gravity = gravity; startVelocity = velocity; this.roomFullBounds = roomFullBounds; } public override void Initialize() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown base.Initialize(); skipCollisions = true; ((Bullet)this).Projectile.BulletScriptSettings.surviveTileCollisions = true; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)((Bullet)this).Projectile).specRigidbody; specRigidbody.OnPreTileCollision = (OnPreTileCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreTileCollision, (Delegate?)(OnPreTileCollisionDelegate)delegate { if (skipCollisions) { PhysicsEngine.SkipCollision = true; } }); } public override IEnumerator Top() { ((Component)((Bullet)this).Projectile).gameObject.Play("Play_WPN_spacerifle_shot_01"); Vector2 newVelocity = startVelocity; int i = 0; while (i < 120) { if (i >= 30 && skipCollisions && ((Rect)(ref roomFullBounds)).Contains(((Bullet)this).Position)) { skipCollisions = false; ((Bullet)this).Projectile.BulletScriptSettings.surviveTileCollisions = false; } newVelocity += gravity; ((Bullet)this).ChangeDirection(new Direction(Vector2Extensions.ToAngle(newVelocity), (DirectionType)1, -1f), 1); ((Bullet)this).ChangeSpeed(new Speed(((Vector2)(ref newVelocity)).magnitude, (SpeedType)0), 1); yield return ((Bullet)this).Wait(1); int num = i + 1; i = num; } ((Bullet)this).Vanish(false); } } private const int COUNT = 10; private const float SPREAD = 9f; private const float GRAVITY = 1f; private const float VELOCITY = 20f; private const float BASESPEED = 20f; private const int SHOTDELAY = 3; private const int SLAMS = 5; private const int SLAMDELAY = 60; private const int TELEDELAY = 20; private const int MERCYTIME = 5; private PathRect slamBoundsPath; protected override List BuildChain() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) slamBoundsPath = new PathRect(base.roomSlamBounds); bool flag = Lazy.CoinFlip(); FluidBulletInfo fluidBulletInfo = Run(TeleportToCenter()).Then(DoTheThing((!Lazy.CoinFlip()) ? (flag ? "down" : "right") : (flag ? "up" : "left"))); for (int i = 1; i < 5; i++) { flag = !flag; fluidBulletInfo = fluidBulletInfo.And(DoTheThing(Lazy.CoinFlip() ? (flag ? "up" : "left") : (flag ? "down" : "right")), i * 60); } return fluidBulletInfo.Finish(); } private IEnumerator TeleportToCenter() { ((Component)base.theBoss).gameObject.Play("teledasher"); ((BraveBehaviour)base.theBoss).aiAnimator.PlayUntilFinished("teleport_out", false, (string)null, -1f, false); while (((BraveBehaviour)base.theBoss).aiAnimator.IsPlaying("teleport_out")) { yield return ((Bullet)this).Wait(1); } Vector2 oldPos = Vector3Extensions.XY(base.theBoss.Position); ((BraveBehaviour)base.theBoss).specRigidbody.CollideWithOthers = false; ((GameActor)base.theBoss).IsGone = true; ((BraveBehaviour)((BraveBehaviour)base.theBoss).sprite).renderer.enabled = false; yield return ((Bullet)this).Wait(20); ((BraveBehaviour)base.theBoss).specRigidbody.CollideWithOthers = true; ((GameActor)base.theBoss).IsGone = false; ((BraveBehaviour)((BraveBehaviour)base.theBoss).sprite).renderer.enabled = true; Rect val = base.roomFullBounds; Vector2 val2 = ((Rect)(ref val)).center - ((BraveBehaviour)base.theBoss).sprite.GetRelativePositionFromAnchor((Anchor)4); Vector2 val3 = val2 - oldPos; for (int i = 0; i < 10; i++) { SpawnDust(oldPos + (float)i / 10f * val3 + Lazy.RandomVector(Random.Range(0.3f, 1.25f))); } ((BraveBehaviour)base.theBoss).transform.position = Vector2.op_Implicit(val2); ((BraveBehaviour)base.theBoss).specRigidbody.Reinitialize(); ((Component)base.theBoss).gameObject.Play("teledasher"); ((BraveBehaviour)base.theBoss).aiAnimator.PlayUntilFinished("teleport_in", false, (string)null, -1f, false); while (((BraveBehaviour)base.theBoss).aiAnimator.IsPlaying("teleport_in")) { yield return ((Bullet)this).Wait(1); } yield return ((Bullet)this).Wait(5); } private IEnumerator DoTheThing(string direction) { PathLine segment = (direction.Equals("up") ? slamBoundsPath.Top() : (direction.Equals("down") ? slamBoundsPath.Bottom() : (direction.Equals("left") ? slamBoundsPath.Left() : ((!direction.Equals("right")) ? slamBoundsPath.Top() : slamBoundsPath.Right())))); Vector2 target = segment.At(0.5f); PlayerController p1 = GameManager.Instance.BestActivePlayer; PlayerController p2 = GameManager.Instance.GetOtherPlayer(p1); if (!Object.op_Implicit((Object)(object)p2) || ((BraveBehaviour)p2).healthHaver.IsDead) { p2 = p1; } Vector2 delta = target - ((GameActor)p1).CenterPosition; Vector2 delta2 = target - ((GameActor)p2).CenterPosition; Vector2 gravity = 1f * ((Vector2)(ref delta)).normalized; Vector2 gravity2 = 1f * ((Vector2)(ref delta2)).normalized; Vector2 val = target - ((GameActor)base.theBoss).CenterPosition; Vector2 gravityB = 1f * ((Vector2)(ref val)).normalized; Vector2 baseVel = -20f * gravityB; Speed s = new Speed(20f, (SpeedType)0); Offset o = Offset.OverridePosition(((GameActor)base.theBoss).CenterPosition); ((Component)base.theBoss).gameObject.Play("sans_laugh"); int i = 0; while (i < 10) { Vector2 val2 = baseVel.Rotate(Random.Range(-9f, 9f)); Direction val3 = new Direction(Vector2Extensions.ToAngle(val2).Clamp180(), (DirectionType)1, -1f); ((Bullet)this).Fire(o, val3, s, (Bullet)(object)new GravityBullet(val2, gravityB, base.roomFullBounds)); yield return ((Bullet)this).Wait(3); int num = i + 1; i = num; } int collisionmask = CollisionMask.LayerToMask((CollisionLayer)2, (CollisionLayer)3, (CollisionLayer)4); Vector2[] finalPos = (Vector2[])(object)new Vector2[2] { Vector2.zero, Vector2.zero }; int framesToReachTarget = Mathf.FloorToInt(Mathf.Sqrt(2f * Mathf.Min(((Vector2)(ref delta)).magnitude, ((Vector2)(ref delta2)).magnitude) / 1f)); if ((Object)(object)p1 == (Object)(object)p2) { p2 = null; } p1.SetInputOverride("comeonandslam"); p1.ForceStopDodgeRoll(); ((BraveBehaviour)p1).specRigidbody.AddCollisionLayerIgnoreOverride(collisionmask); ((BraveBehaviour)p1).specRigidbody.Velocity = Vector2.zero; if (Object.op_Implicit((Object)(object)p2)) { p2.SetInputOverride("comeonandslam"); p2.ForceStopDodgeRoll(); ((BraveBehaviour)p2).specRigidbody.AddCollisionLayerIgnoreOverride(collisionmask); ((BraveBehaviour)p2).specRigidbody.Velocity = Vector2.zero; } i = 0; while (i < framesToReachTarget) { SpeculativeRigidbody specRigidbody = ((BraveBehaviour)p1).specRigidbody; specRigidbody.Velocity += gravity; Position position = ((BraveBehaviour)p1).specRigidbody.Position; Vector2 pixelVector = ((Position)(ref position)).GetPixelVector2(); Vector2 val4 = pixelVector + ((BraveBehaviour)p1).specRigidbody.Velocity; if (BraveMathCollege.LineSegmentRectangleIntersection(pixelVector, val4, segment.start, segment.end, ref finalPos[0])) { break; } ((BraveBehaviour)p1).transform.position = Vector2.op_Implicit(val4); ((BraveBehaviour)p1).specRigidbody.Reinitialize(); if (Object.op_Implicit((Object)(object)p2)) { SpeculativeRigidbody specRigidbody2 = ((BraveBehaviour)p2).specRigidbody; specRigidbody2.Velocity += gravity2; position = ((BraveBehaviour)p2).specRigidbody.Position; Vector2 pixelVector2 = ((Position)(ref position)).GetPixelVector2(); Vector2 val5 = pixelVector2 + ((BraveBehaviour)p2).specRigidbody.Velocity; if (BraveMathCollege.LineSegmentRectangleIntersection(pixelVector2, val5, segment.start, segment.end, ref finalPos[1])) { break; } ((BraveBehaviour)p2).transform.position = Vector2.op_Implicit(val5); ((BraveBehaviour)p2).specRigidbody.Reinitialize(); } yield return ((Bullet)this).Wait(1); int num = i + 1; i = num; } ((BraveBehaviour)p1).specRigidbody.RemoveCollisionLayerIgnoreOverride(collisionmask); ((BraveBehaviour)p1).specRigidbody.Velocity = Vector2.zero; ((BraveBehaviour)p1).transform.position = Vector2.op_Implicit((finalPos[0] != Vector2.zero) ? finalPos[0] : target); ((BraveBehaviour)p1).specRigidbody.Reinitialize(); if (Object.op_Implicit((Object)(object)p2)) { ((BraveBehaviour)p2).specRigidbody.RemoveCollisionLayerIgnoreOverride(collisionmask); ((BraveBehaviour)p2).specRigidbody.Velocity = Vector2.zero; ((BraveBehaviour)p2).transform.position = Vector2.op_Implicit((finalPos[1] != Vector2.zero) ? finalPos[1] : target); ((BraveBehaviour)p2).specRigidbody.Reinitialize(); } yield return ((Bullet)this).Wait(1); ((Component)p1).gameObject.Play("undertale_damage"); p1.ClearInputOverride("comeonandslam"); if (Object.op_Implicit((Object)(object)p2)) { p2.ClearInputOverride("comeonandslam"); } GameManager.Instance.MainCameraController.DoScreenShake(new ScreenShakeSettings(0.5f, 6f, 0.5f, 0f), (Vector2?)null, false); } } private class ChainBulletScript : SecretBulletScript { public class ChainBullet : SecretBullet { public override IEnumerator Top() { ((Component)((Bullet)this).Projectile).gameObject.Play("Play_WPN_spacerifle_shot_01"); yield break; } } private const int PHASES = 3; private const int STREAMSPERPHASE = 5; private const int PHASEDELAY = 20; private const int SHOTSPERSTREAM = 12; private const int SHOTDELAY = 5; private const int SHOTSPEED = 20; private const float MINDIST = 12f; protected override List BuildChain() { return Run(DoTheThing()).Finish(); } private IEnumerator DoTheThing() { PlayerController target = GameManager.Instance.GetRandomActivePlayer(); int i = 0; while (i < 3) { if (!Object.op_Implicit((Object)(object)target)) { target = GameManager.Instance.GetRandomActivePlayer(); } ((Component)base.theBoss).gameObject.Play("sans_laugh"); Vector2 ppos = ((GameActor)target).CenterPosition; List spawnPoints = new List(5); List shotAngles = new List(5); int num; for (int s = 0; s < 5; s = num) { Vector2 val = base.roomBulletBounds.RandomPointOnPerimeter(); while (true) { Vector2 val2 = ppos - val; if (!(((Vector2)(ref val2)).magnitude < 12f)) { break; } val = base.roomBulletBounds.RandomPointOnPerimeter(); } spawnPoints.Add(val); shotAngles.Add(Vector2Extensions.ToAngle(ppos - val).Clamp180()); BossShared.DoomZone(val, spawnPoints[s].RaycastToWall(shotAngles[s], base.roomFullBounds), 1f, 1f / 3f, 10); ((Component)target).gameObject.Play("Play_OBJ_turret_set_01"); yield return ((Bullet)this).Wait(5); num = s + 1; } for (int s = 0; s < 12; s = num) { for (int j = 0; j < 5; j++) { ((Bullet)this).Fire(Offset.OverridePosition(spawnPoints[j]), new Direction(shotAngles[j], (DirectionType)1, -1f), new Speed(20f, (SpeedType)0), (Bullet)(object)new ChainBullet()); } yield return ((Bullet)this).Wait(5); num = s + 1; } yield return ((Bullet)this).Wait(20); num = i + 1; i = num; } } } private class SquareBulletScript : SecretBulletScript { public class SquareBullet : SecretBullet { private int goFrames; private int waitFrames; public SquareBullet(int goFrames = 30, int waitFrames = 60) { this.waitFrames = waitFrames; this.goFrames = goFrames; } public override IEnumerator Top() { ((Component)((Bullet)this).Projectile).gameObject.Play("Play_WPN_spacerifle_shot_01"); yield return ((Bullet)this).Wait(goFrames); float initSpeed = ((Bullet)this).Speed; ((Bullet)this).ChangeSpeed(new Speed(0f, (SpeedType)0), 1); yield return ((Bullet)this).Wait(waitFrames); ((Bullet)this).ChangeSpeed(new Speed(initSpeed, (SpeedType)0), 1); ((Bullet)this).ChangeDirection(new Direction(((Bullet)(object)this).DirToNearestPlayer(), (DirectionType)1, -1f), 1); ((Component)((Bullet)this).Projectile).gameObject.Play("Play_WPN_spacerifle_shot_01"); yield return ((Bullet)this).Wait(120); ((Bullet)this).Vanish(false); } } private const int SIDES = 5; private const int COUNTPERSIDE = 3; private const float SPREAD = 0.5f; private const float SPEED = 25f; private const int GOFRAMES = 15; private const int SHOTDELAY = 4; private const int SIDEDELAY = 8; private const float SIDESPAN = 72f; private const float SPREADSPAN = 36f; private const float OFFSET = 1f; private const int FINALDELAY = 100; protected override List BuildChain() { return Run(DoTheThing()).Finish(); } private IEnumerator DoTheThing() { float initAngle = Lazy.RandomAngle(); int i = 0; while (i < 5) { float sideAngle = (initAngle + (float)i * 72f).Clamp180(); int num; for (int j = 0; j < 3; j = num) { float self = sideAngle + 36f * ((1f + (float)j) / 4f - 0.5f); ((Bullet)this).Fire(Offset.OverridePosition(((GameActor)base.theBoss).CenterPosition), new Direction(self.Clamp180(), (DirectionType)1, -1f), new Speed(25f, (SpeedType)0), (Bullet)(object)new SquareBullet(15, 100)); yield return ((Bullet)this).Wait(4); num = j + 1; } yield return ((Bullet)this).Wait(8); num = i + 1; i = num; } yield return ((Bullet)this).Wait(60); } } private class HesitantBulletWallScript : SecretBulletScript { public class HesitantBullet : SecretBullet { private int waitFrames; public HesitantBullet(int waitFrames = 60) { this.waitFrames = waitFrames; } public override IEnumerator Top() { ((Component)((Bullet)this).Projectile).gameObject.Play("Play_OBJ_turret_set_01"); float initSpeed = ((Bullet)this).Speed; ((Bullet)this).ChangeSpeed(new Speed(0f, (SpeedType)0), waitFrames); yield return ((Bullet)this).Wait(waitFrames); ((Bullet)this).ChangeSpeed(new Speed(initSpeed * 2f, (SpeedType)0), 1); ((Component)((Bullet)this).Projectile).gameObject.Play("Play_WPN_spacerifle_shot_01"); yield return ((Bullet)this).Wait(120); ((Bullet)this).Vanish(false); } } private const int COUNT = 10; private const int WAIT = 60; private const int SPAWN_DELAY = 5; private const float WALLWIDTH = 10f; private const float DISTANCE = 7f; private const float SPEED = 10f; private const float SPACING = 1f; protected override List BuildChain() { return Run(DoTheThing()).Finish(); } private IEnumerator DoTheThing() { Vector2 centerPosition = ((GameActor)GameManager.Instance.GetRandomActivePlayer()).CenterPosition; Vector2 val; Vector2 val2; do { val = Lazy.RandomAngle().ToVector(); val2 = centerPosition + 7f * val; } while (((Bullet)this).IsPointInTile(val2)); List list = val2.TangentLine(centerPosition, 10f).SampleUniform(10); Direction towardsPlayerDirection = new Direction(Vector2Extensions.ToAngle(-val).Clamp180(), (DirectionType)1, -1f); foreach (Vector2 item in list) { ((Bullet)this).Fire(Offset.OverridePosition(item), towardsPlayerDirection, new Speed(10f, (SpeedType)0), (Bullet)(object)new HesitantBullet()); yield return ((Bullet)this).Wait(5); } } } private class OrbitBulletScript : SecretBulletScript { public class OrbitBullet : SecretBullet { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static OnPreTileCollisionDelegate <>9__12_0; internal void b__12_0(SpeculativeRigidbody _, PixelCollider _, Tile _, PixelCollider _) { PhysicsEngine.SkipCollision = true; } } private Vector2 center; private float radius; private float captureAngle; private float framesToApproach; private float degreesToOrbit; private float framesToOrbit; private int delay; private Vector2 initialTarget; private Vector2 delta; private const float SPEED = 60f; private const int DELAY = 60; public OrbitBullet(Vector2 center, float radius, float captureAngle, float framesToApproach, float degreesToOrbit, float framesToOrbit, int delay) { //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) this.center = center; this.radius = radius; this.captureAngle = captureAngle; this.framesToApproach = framesToApproach; this.degreesToOrbit = degreesToOrbit; this.framesToOrbit = framesToOrbit; this.delay = delay; } public override void Initialize() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0058: 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_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) //IL_008a: 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_009b: 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_00b6: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //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_0047: Expected O, but got Unknown base.Initialize(); ((Bullet)this).Projectile.BulletScriptSettings.surviveTileCollisions = true; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)((Bullet)this).Projectile).specRigidbody; OnPreTileCollisionDelegate onPreTileCollision = specRigidbody.OnPreTileCollision; object obj = <>c.<>9__12_0; if (obj == null) { OnPreTileCollisionDelegate val = delegate { PhysicsEngine.SkipCollision = true; }; <>c.<>9__12_0 = val; obj = (object)val; } specRigidbody.OnPreTileCollision = (OnPreTileCollisionDelegate)Delegate.Combine((Delegate?)(object)onPreTileCollision, (Delegate?)obj); initialTarget = center + radius * captureAngle.ToVector(); delta = initialTarget - ((Bullet)this).Position; ((Bullet)this).ChangeDirection(new Direction(Vector2Extensions.ToAngle(delta), (DirectionType)1, -1f), 1); ((Bullet)this).ChangeSpeed(new Speed(0f, (SpeedType)0), 1); } public override IEnumerator Top() { yield return ((Bullet)this).Wait(delay); ((Bullet)this).ChangeSpeed(new Speed(60f * ((Vector2)(ref delta)).magnitude / (framesToApproach + 1f), (SpeedType)0), 1); yield return ((Bullet)this).Wait(framesToApproach); float degreesPerFrame = degreesToOrbit / framesToOrbit; float curAngle = captureAngle; float oldSpeed = ((Bullet)this).Speed; ((Bullet)this).UpdatePosition(); ((Bullet)this).ChangeSpeed(new Speed(0f, (SpeedType)0), 1); ((Bullet)this).UpdateVelocity(); int i = 0; while ((float)i < framesToOrbit) { yield return ((Bullet)this).Wait(1); curAngle = (curAngle + degreesPerFrame).Clamp180(); Vector2 val = center + radius * curAngle.ToVector(); ((Bullet)this).ChangeDirection(new Direction(Vector2Extensions.ToAngle(val - ((Bullet)this).Position), (DirectionType)1, -1f), 1); ((Bullet)this).Position = val; int num = i + 1; i = num; } ((Component)((Bullet)this).Projectile).gameObject.Play("Play_WPN_spacerifle_shot_01"); ((Bullet)this).ChangeSpeed(new Speed(oldSpeed, (SpeedType)0), 1); yield return ((Bullet)this).Wait(60); ((Bullet)this).Vanish(false); } } private const float ROTATIONS = 5f; private const int COUNT = 37; private const float OUTER_RADIUS = 8f; private const float INNER_RADIUS = 1f; private const int SPAWN_GAP = 2; private const float SPIRAL = 1f; private const float ANGLE_DELTA = 48.648647f; private const float APPROACH_FRAMES = 12f; private const float ORBIT_FRAMES = 60f; protected override List BuildChain() { return Run(DoTheThing()).Finish(); } private IEnumerator DoTheThing() { Vector2 playerpos = ((GameActor)GameManager.Instance.GetRandomActivePlayer()).CenterPosition; for (int j = 0; j < 37; j++) { if (j % 2 == 0) { ((Component)base.theBoss).gameObject.Play("Play_OBJ_turret_set_01"); } yield return ((Bullet)this).Wait(2); float num = ((float)j * 48.648647f).Clamp180(); float num2 = 1f + (float)j * 1f / 37f; Vector2 val = playerpos + num2 * num.ToVector() + 8f * (num - 90f).ToVector(); Bullet val2 = (Bullet)(object)new OrbitBullet(playerpos, num2, num, 12f, 360f, 60f, 2 * (37 - j)); ((Bullet)this).Fire(Offset.OverridePosition(val), val2); } } } private class CeilingBulletsScript : SecretBulletScript { private const int COUNT = 16; private const int SPAWN_DELAY = 4; protected override List BuildChain() { bool flag = Lazy.CoinFlip(); return Run(Laugh(10f)).And(DoTheThing(15f, flag, warn: true)).And(DoTheThing(15f, !flag, warn: true), 64).And(DoTheThing(30f, flag), 10) .And(DoTheThing(30f, !flag), 74) .Then(Laugh(10f)) .And(DoTheThing(15f, flag, warn: true)) .And(DoTheThing(15f, !flag, warn: true), 64) .And(DoTheThing(45f, flag), 20) .And(DoTheThing(45f, !flag), 84) .Finish(); } private IEnumerator Laugh(float delay) { ((Component)base.theBoss).gameObject.Play("sans_laugh"); yield return ((Bullet)this).Wait(delay); } private IEnumerator DoTheThing(float speed, bool reverse = false, bool warn = false) { Rect val = base.roomBulletBounds; float num = ((Rect)(ref val)).width / 16f; float angle = (reverse ? 90f : (-90f)); List points = new List(); for (float num2 = (reverse ? 0.75f : 0.25f); num2 < 16f; num2 += 1f) { val = base.roomBulletBounds; float num3 = ((Rect)(ref val)).xMin + num2 * num; float num4; if (!reverse) { val = base.roomBulletBounds; num4 = ((Rect)(ref val)).yMax; } else { val = base.roomBulletBounds; num4 = ((Rect)(ref val)).yMin; } points.Add(new Vector2(num3, num4)); } int i = 0; while (i < points.Count) { if (warn) { BossShared.DoomZone(points[i], points[i].RaycastToWall(angle, base.roomBulletBounds), 1f, 1.0666667f, 20); if (i % 2 == 0) { ((Component)base.theBoss).gameObject.Play("undertale_pullback"); } } yield return ((Bullet)this).Wait(4); int num5 = i + 1; i = num5; } i = 0; while (i < points.Count) { ((Bullet)this).Fire(Offset.OverridePosition(points[i]), new Direction(angle, (DirectionType)1, -1f), new Speed(speed, (SpeedType)0), (Bullet)(object)new SecretBullet()); if (i % 2 == 1) { ((Component)base.theBoss).gameObject.Play("Play_WPN_spacerifle_shot_01"); } yield return ((Bullet)this).Wait(4); int num5 = i + 1; i = num5; } } } private class CustomTeleportBehavior : TeleportBehavior { private bool teleported; private Vector2 oldPos = Vector2.zero; private Vector2 newPos = Vector2.zero; public override ContinuousBehaviorResult ContinuousUpdate() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 //IL_00f4: 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_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_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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00a7: 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_00ba: 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) //IL_00c0: 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) if ((int)((TeleportBehavior)this).State == 1) { if (!teleported) { ((Component)((BehaviorBase)this).m_aiActor).gameObject.Play("teledasher"); oldPos = Vector3Extensions.XY(((BehaviorBase)this).m_aiActor.Position); } teleported = true; } else if ((int)((TeleportBehavior)this).State == 4) { if (teleported) { ((Component)((BehaviorBase)this).m_aiActor).gameObject.Play("teledasher"); newPos = Vector3Extensions.XY(((BehaviorBase)this).m_aiActor.Position); Vector2 val = newPos - oldPos; for (int i = 0; i < 10; i++) { SpawnDust(oldPos + (float)i / 10f * val + Lazy.RandomVector(Random.Range(0.3f, 1.25f))); } } teleported = false; } return ((TeleportBehavior)this).ContinuousUpdate(); } } public const string BOSS_GUID = "Sans Boss"; internal const string BOSS_NAME = "Sans Gundertale"; private const string SUBTITLE = "Introducing..."; private const string SPRITE_PATH = "CwaffingTheGungy/Resources/Bosses/sans"; private static Entry _BoneBullet; private const int _SANS_HP = 60; public static PrototypeDungeonRoom SansBossRoom; private const string SOUND_SPAWN = "Play_OBJ_turret_set_01"; private const string SOUND_SPAWN_QUIET = "undertale_pullback"; private const string SOUND_SHOOT = "Play_WPN_spacerifle_shot_01"; private const string SOUND_TELEPORT = "teledasher"; public static void Init() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: 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) BuildABoss buildABoss = BuildABoss.LetsMakeABoss("Sans Gundertale", "Sans Boss", "CwaffingTheGungy/Resources/Bosses/sans/sans_idle_1", new IntVector2(8, 9), "Introducing...", "CwaffingTheGungy/Resources/sans_bosscard.png"); float? health = 60f; float? weight = 200f; float? speed = 0.4f; float? collisionDamage = 0f; float? hitReactChance = 0.05f; float? collisionKnockbackStrength = 0f; bool? healthIsNumberOfHits = true; float? invulnerabilityPeriod = 1f; Anchor? spriteAnchor = (Anchor)1; buildABoss.SetStats(health, weight, speed, collisionDamage, collisionKnockbackStrength, hitReactChance, healthIsNumberOfHits, invulnerabilityPeriod, null, spriteAnchor); buildABoss.InitSpritesFromResourcePath("CwaffingTheGungy/Resources/Bosses/sans"); buildABoss.AdjustAnimation("idle", 8f, true); buildABoss.AdjustAnimation("idle_glance", 8f, true); buildABoss.AdjustAnimation("idle_empty", 8f, true); buildABoss.AdjustAnimation("shrug", 8f, true); buildABoss.AdjustAnimation("shrug_calm", 8f, true); buildABoss.AdjustAnimation("shrug_glance", 8f, true); buildABoss.AdjustAnimation("idle_cloak", 12f, true); buildABoss.AdjustAnimation("decloak", 6f, false); buildABoss.AdjustAnimation("teleport_in", 60f, false); buildABoss.AdjustAnimation("teleport_out", 60f, false); buildABoss.SetIntroAnimations("idle", "idle"); buildABoss.SetDefaultColliders(15, 30, -7, 2); buildABoss.AddCustomIntro(); buildABoss.MakeInteractible(preFight: true, postFight: true); buildABoss.TargetPlayer(); buildABoss.AddCustomMusic("electromegalo", 152512, 137141); buildABoss.CreateTeleportAttack(add: true, 0.26f, 0f, 0.15f, 0f, 0f, 0f, 3f, -1, requiresLineOfSight: false, 0f, 1f, null, accumulateHealthThresholds: true, 0f, 0f, 0f, vulnerable: false, avoidWalls: false, stayOnScreen: false, 0f, 0f, 0.25f, onlyIfUnreachable: false, "teleport_out", "teleport_in"); buildABoss.CreateBulletAttack(add: true, 0.25f, 0f, 0.15f, 0f, 0.5f, 0f, 1f, -1, requiresLineOfSight: false, 0f, 1f, null, accumulateHealthThresholds: true, 0f, 0f, 0f, null, "laugh"); buildABoss.CreateBulletAttack(add: true, 0.25f, 0f, 0.15f, 0f, 0.5f, 0f, 1f, -1, requiresLineOfSight: false, 0f, 1f, null, accumulateHealthThresholds: true, 0f, 0f, 0f, null, "throw_up"); buildABoss.CreateBulletAttack(add: true, 0.25f, 0f, 0.15f, 0f, 0.5f, 0f, 1f, -1, requiresLineOfSight: false, 0f, 1f, null, accumulateHealthThresholds: true, 0f, 0f, 0f, null, "throw_down"); buildABoss.CreateBulletAttack(add: true, 0.25f, 0f, 0.15f, 0f, 0.5f, 0f, 1f, -1, requiresLineOfSight: false, 0f, 1f, null, accumulateHealthThresholds: true, 0f, 0f, 0f, null, "throw_left"); buildABoss.CreateBulletAttack(add: true, 0.25f, 0f, 0.15f, 0f, 0.5f, 0f, 1f, -1, requiresLineOfSight: false, 0f, 1f, null, accumulateHealthThresholds: true, 0f, 0f, 0f, null, "throw_right"); buildABoss.CreateBulletAttack(add: true, 0.25f, 0f, 0.15f, 0f, 0.5f, 0f, 1f, -1, requiresLineOfSight: false, 0f, 1f, null, accumulateHealthThresholds: true, 0f, 0f, 0f, null, "laugh"); buildABoss.CreateBulletAttack(add: true, 0.25f, 0f, 0.15f, 0f, 0.5f, 0f, 1f, -1, requiresLineOfSight: false, 0f, 1f, null, accumulateHealthThresholds: true, 0f, 0f, 0f, null, "throw_right"); buildABoss.CreateBulletAttack(add: true, 0.25f, 0f, 0.15f, 0f, 0.5f, 0f, 1f, -1, requiresLineOfSight: false, 0f, 1f, null, accumulateHealthThresholds: true, 0f, 0f, 0f, null, "throw_right"); buildABoss.CreateBulletAttack(add: true, 0.25f, 0f, 0.15f, 0f, 0.5f, 0f, 1f, -1, requiresLineOfSight: false, 0f, 1f, null, accumulateHealthThresholds: true, 0f, 0f, 0f, null, "throw_right"); buildABoss.AddBossToGameEnemies("cg:sansboss"); SansBossRoom = buildABoss.CreateStandaloneBossRoom(38, 27, exitOnBottom: false); InitPrefabs(); } private static void InitPrefabs() { //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_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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown Projectile val = Items.HegemonyRifle.CloneProjectile(); _BoneBullet = new Entry(((BraveBehaviour)EnemyDatabase.GetOrLoadByGuid("1bc2a07ef87741be90c37096910843ab")).bulletBank.GetBullet("reversible")) { Name = "getboned", PlayAudio = false, BulletObject = ((Component)val).gameObject.ClonePrefab(), MuzzleFlashEffects = Lazy.GunDefaultProjectile(29).hitEffects.overrideMidairDeathVFX.CreatePoolFromVFXGameObject() }; } private static void SpawnDust(Vector2 where) { //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_001a: Unknown result type (might be due to invalid IL or missing references) SpawnManager.SpawnVFX(GameManager.Instance.Dungeon.dungeonDustups.rollLandDustup, Vector2.op_Implicit(where), Lazy.RandomEulerZ()); } } public class FluidBulletInfo { private static int nextAutoId = 0; private static LinkedList lastLayer = new LinkedList(); private static LinkedList curLayer = new LinkedList(); private static List theChain = new List(); public readonly int id; public List runsAfter; public List runsBefore; public bool finished; public IEnumerator script; public int waitFrames; private FluidBulletScript manager; public FluidBulletInfo(IEnumerator script, FluidBulletScript manager) { nextAutoId = 0; id = nextAutoId++; Initialize(script, manager); } private FluidBulletInfo(IEnumerator script, FluidBulletInfo parent) { id = nextAutoId++; Initialize(script, parent.manager); } private void Initialize(IEnumerator script, FluidBulletScript manager) { this.script = script; finished = false; waitFrames = 1; runsAfter = new List(); runsBefore = new List(); this.manager = manager; } public static FluidBulletInfo Run(FluidBulletScript manager, IEnumerator script) { lastLayer = new LinkedList(); curLayer = new LinkedList(); theChain = new List(); FluidBulletInfo fluidBulletInfo = new FluidBulletInfo(script, manager); curLayer.AddLast(fluidBulletInfo); theChain.Add(fluidBulletInfo); return fluidBulletInfo; } public FluidBulletInfo And(IEnumerator script, int withDelay = 0) { if (nextAutoId != id + 1) { ETGModConsole.Log((object)"HEY! Don't abuse Then() and And() outside of a fluent method chain!", false); return null; } FluidBulletInfo fluidBulletInfo = new FluidBulletInfo(script, this); for (LinkedListNode linkedListNode = lastLayer.First; linkedListNode != null; linkedListNode = linkedListNode.Next) { linkedListNode.Value.runsBefore.Add(fluidBulletInfo.id); fluidBulletInfo.runsAfter.Add(linkedListNode.Value.id); } fluidBulletInfo.waitFrames = 1 + withDelay; curLayer.AddLast(fluidBulletInfo); theChain.Add(fluidBulletInfo); return fluidBulletInfo; } public FluidBulletInfo Then(IEnumerator script, int withDelay = 0) { lastLayer = curLayer; curLayer = new LinkedList(); return And(script, withDelay); } public List Finish() { return theChain; } } public abstract class FluidBulletScript : Script { protected abstract List BuildChain(); public FluidBulletInfo Run(IEnumerator script) { return FluidBulletInfo.Run(this, script); } public sealed override IEnumerator Top() { List allScripts = BuildChain(); LinkedList activeScripts = new LinkedList(); for (int i = 0; i < allScripts.Count; i++) { if (allScripts[i].id != i) { ETGModConsole.Log((object)"HEY! You have a bad ID, do it right next time!", false); yield break; } if (allScripts[i].runsAfter.Count == 0) { activeScripts.AddLast(i); } } while (activeScripts.Count > 0) { for (LinkedListNode linkedListNode = activeScripts.First; linkedListNode != null; linkedListNode = linkedListNode.Next) { FluidBulletInfo fluidBulletInfo = allScripts[linkedListNode.Value]; if (--fluidBulletInfo.waitFrames <= 0) { if (fluidBulletInfo.script.MoveNext()) { fluidBulletInfo.waitFrames = (int)fluidBulletInfo.script.Current; } else { foreach (int item in fluidBulletInfo.runsBefore) { allScripts[item].runsAfter.Remove(fluidBulletInfo.id); if (allScripts[item].runsAfter.Count == 0) { activeScripts.AddLast(item); } } fluidBulletInfo.finished = true; activeScripts.Remove(linkedListNode); } } } yield return ((Bullet)this).Wait(1); } } } public abstract class PathShape { public abstract Vector2 At(float t); public List SampleUniform(int numPoints, float start = 0f, float end = 1f) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) List list = new List(); float num = (end - start) / (float)(numPoints + 1); for (int i = 1; i <= numPoints; i++) { float num2 = start + (float)i * num; list.Add(At(num2 % 1f)); } return list; } public List SampleUniformInclusive(int numPoints, float start = 0f, float end = 1f) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) List list = new List(); float num = (end - start) / (float)numPoints; for (int i = 0; i < numPoints; i++) { float num2 = start + (float)i * num; list.Add(At(num2 % 1f)); } return list; } } public class PathLine : PathShape { public Vector2 start { get; private set; } public Vector2 end { get; private set; } public PathLine(Vector2 start, Vector2 end) { //IL_0007: 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) this.start = start; this.end = end; } public PathLine(float x1, float y1, float x2, float y2) { //IL_0009: 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) start = new Vector2(x1, y1); end = new Vector2(x2, y2); } public override Vector2 At(float t) { //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_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) return (1f - t) * start + t * end; } public PathLine Stretch(float t) { //IL_0006: 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_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_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) //IL_0037: 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_003a: 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_0045: 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) //IL_004d: Unknown result type (might be due to invalid IL or missing references) Vector2 val = 0.5f * (end + start); Vector2 val2 = 0.5f * (end - start); return new PathLine(val - t * val2, val + t * val2); } } public class PathPolyLine : PathShape { public List points { get; private set; } public List cumulativeLength { get; private set; } public List offsets { get; private set; } public PathPolyLine(params Vector2[] points) { //IL_0060: 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) if (points.Length >= 2) { this.points = points.ToList(); cumulativeLength = new List(this.points.Count); cumulativeLength[0] = 0f; for (int i = 1; i < this.points.Count; i++) { List list = cumulativeLength; int index = i; float num = cumulativeLength[i - 1]; Vector2 val = this.points[i] - this.points[i - 1]; list[index] = num + ((Vector2)(ref val)).magnitude; } offsets = new List(this.points.Count); for (int j = 0; j < this.points.Count; j++) { offsets[j] = cumulativeLength[j] / cumulativeLength[this.points.Count - 1]; } } } public override Vector2 At(float t) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_009c: 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_00a6: Unknown result type (might be due to invalid IL or missing references) if (t <= 0f) { return points[0]; } if (t >= 1f) { return points[points.Count - 1]; } int i; for (i = 1; offsets[i] < t; i++) { } float num = (t - offsets[i - 1]) / (offsets[i] - offsets[i - 1]); return (1f - num) * points[i - 1] + num * points[i]; } } public class PathRect : PathShape { public Rect rect { get; private set; } public PathRect(Rect r) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) rect = r; } public PathLine Top() { //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_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_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_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) Rect val = rect; float xMin = ((Rect)(ref val)).xMin; val = rect; float yMax = ((Rect)(ref val)).yMax; val = rect; float xMax = ((Rect)(ref val)).xMax; val = rect; return new PathLine(xMin, yMax, xMax, ((Rect)(ref val)).yMax); } public PathLine Bottom() { //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_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_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_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) Rect val = rect; float xMin = ((Rect)(ref val)).xMin; val = rect; float yMin = ((Rect)(ref val)).yMin; val = rect; float xMax = ((Rect)(ref val)).xMax; val = rect; return new PathLine(xMin, yMin, xMax, ((Rect)(ref val)).yMin); } public PathLine Left() { //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_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_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_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) Rect val = rect; float xMin = ((Rect)(ref val)).xMin; val = rect; float yMin = ((Rect)(ref val)).yMin; val = rect; float xMin2 = ((Rect)(ref val)).xMin; val = rect; return new PathLine(xMin, yMin, xMin2, ((Rect)(ref val)).yMax); } public PathLine Right() { //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_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_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_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) Rect val = rect; float xMax = ((Rect)(ref val)).xMax; val = rect; float yMin = ((Rect)(ref val)).yMin; val = rect; float xMax2 = ((Rect)(ref val)).xMax; val = rect; return new PathLine(xMax, yMin, xMax2, ((Rect)(ref val)).yMax); } public override Vector2 At(float t) { //IL_0001: 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) return rect.PointOnPerimeter(t); } public Vector2 At(float x, float y) { //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_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_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_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) //IL_003e: Unknown result type (might be due to invalid IL or missing references) Rect val = rect; float xMin = ((Rect)(ref val)).xMin; val = rect; float num = xMin + x * ((Rect)(ref val)).width; val = rect; float yMin = ((Rect)(ref val)).yMin; val = rect; return new Vector2(num, yMin + y * ((Rect)(ref val)).height); } public float InverseAt(Vector2 p) { //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) return rect.InversePointOnPerimeter(p); } } public class PathArc : PathShape { private const float TWOPI = (float)Math.PI * 2f; private float angleDelta; public Vector2 center { get; private set; } public float radius { get; private set; } public float startAngle { get; private set; } public float endAngle { get; private set; } public PathArc(Vector2 center, float radius, float startAngle, float endAngle) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) this.center = center; this.radius = radius; this.startAngle = startAngle.Clamp360(); this.endAngle = endAngle.Clamp360(); angleDelta = (this.endAngle - this.startAngle + 360f) % 360f; if (angleDelta == 0f) { angleDelta = 360f; } } public override Vector2 At(float t) { //IL_0001: 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_002a: Unknown result type (might be due to invalid IL or missing references) return center + radius * (startAngle + t * angleDelta).ToVector(); } } public class PathCircle : PathArc { public PathCircle(Vector2 center, float radius) : base(center, radius, 0f, 360f) { }//IL_0001: Unknown result type (might be due to invalid IL or missing references) public PathLine TangentLine(float angle, float length) { //IL_0001: 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_0021: 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_0034: 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_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_003c: 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) Vector2 val = base.center + base.radius * angle.ToVector(); Vector2 val2 = (angle + 90f).ToVector(); return new PathLine(val - val2, val + val2); } public float AngleTo(Vector2 p) { //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_0007: Unknown result type (might be due to invalid IL or missing references) return Vector2Extensions.ToAngle(p - base.center); } } public class PathCurve : PathShape { public Vector2 p0 { get; private set; } public Vector2 p1 { get; private set; } public Vector2 p2 { get; private set; } public Vector2 p3 { get; private set; } public PathCurve(Vector2 p0, Vector2 p1, Vector2 p2, Vector2 p3, bool rawControlPoints = false) { //IL_0007: 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_0015: 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_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_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_003e: 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_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_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_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_006a: 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_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) //IL_007c: 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_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_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_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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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) this.p0 = p0; this.p1 = p1; this.p2 = p2; this.p3 = p3; if (!rawControlPoints) { Vector2 val = -5f * p0 + 18f * p1 - 9f * p2 + 2f * p3; Vector2 val2 = -5f * p3 + 18f * p2 - 9f * p1 + 2f * p0; this.p1 = val / 6f; this.p2 = val2 / 6f; } } public PathCurve(Vector2 p0, Vector2 pmid, Vector2 p3, bool rawControlPoints = false) : this(p0, pmid, pmid, p3, rawControlPoints) { }//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_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) public override Vector2 At(float t) { //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_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_002e: 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_0049: 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_005e: Unknown result type (might be due to invalid IL or missing references) float num = 1f - t; return num * num * num * p0 + 3f * num * num * t * p1 + 3f * num * t * t * p2 + t * t * t * p3; } } public static class PathHelpers { public static float ApproximatePerimeterOfEllipse(float a, float b) { float num = (a - b) / (a + b); float num2 = 3f * num * num; return (float)Math.PI * (a + b) * (1f + num2 / (10f + Mathf.Sqrt(4f - num2))); } public static Rect GetRoomBoundingRect() { //IL_000f: 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) return ((DungeonPlaceableBehaviour)GameManager.Instance.BestActivePlayer).GetAbsoluteParentRoom().GetBoundingRect().Inset(2f, 2f, 4f, 2f); } public static PathLine TangentLine(this Vector2 self, Vector2 other, float length) { //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_000e: 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_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_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_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_002e: 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) float num = 0.5f * length; Vector2 val = self - other; Vector2 val2 = num * ((Vector2)(ref val)).normalized.Rotate(90f); return new PathLine(self - val2, self + val2); } } public static class BulletPatterns { public static List SortByX(this List self, bool reverse = false) { return (reverse ? self.OrderByDescending((Vector2 v) => v.x) : self.OrderBy((Vector2 v) => v.x)).ToList(); } public static List SortByY(this List self, bool reverse = false) { return (reverse ? self.OrderByDescending((Vector2 v) => v.y) : self.OrderBy((Vector2 v) => v.y)).ToList(); } public static List SortByDistance(this List self, Vector2 other, bool reverse = false) { //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) return (reverse ? self.OrderByDescending(delegate(Vector2 v) { //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_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) Vector2 val = v - other; return ((Vector2)(ref val)).magnitude; }) : self.OrderBy(delegate(Vector2 v) { //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_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) Vector2 val = v - other; return ((Vector2)(ref val)).magnitude; })).ToList(); } public static List SortByAngle(this List self, Vector2 other, float startAngle = 0f, bool reverse = false) { //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 (reverse ? self.OrderByDescending((Vector2 v) => (startAngle + Vector2Extensions.ToAngle(v - other)).Clamp360()) : self.OrderBy((Vector2 v) => (startAngle + Vector2Extensions.ToAngle(v - other)).Clamp360())).ToList(); } public static List MirrorHorizontally(this List points, float mirrorX) { //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_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_0028: Unknown result type (might be due to invalid IL or missing references) List list = new List(points); foreach (Vector2 point in points) { list.Add(Vector2Extensions.WithX(point, 2f * mirrorX - point.x)); } return list; } public static List MirrorVertically(this List points, float mirrorY) { //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_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_0028: Unknown result type (might be due to invalid IL or missing references) List list = new List(points); foreach (Vector2 point in points) { list.Add(Vector2Extensions.WithY(point, 2f * mirrorY - point.y)); } return list; } public static List MirrorAcrossPoint(this List points, Vector2 mirrorPoint, float angle) { //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_001f: 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_0025: Unknown result type (might be due to invalid IL or missing references) List list = new List(points); foreach (Vector2 point in points) { list.Add(2f * mirrorPoint - point); } return list; } public static IEnumerator WaitFrames(this Bullet bullet, int frames) { yield return bullet.Wait(frames); } public static IEnumerator AccelerateInCurrentDirection(this Bullet bullet, float accel, int forFrames = -1) { int i = 0; while (i != forFrames) { bullet.Speed += accel; bullet.UpdateVelocity(); yield return bullet.Wait(1); int num = i + 1; i = num; } } public static IEnumerator Accelerate(this Bullet bullet, Vector2 accelVec, int forFrames = -1) { //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) int i = 0; while (i != forFrames) { bullet.Velocity += accelVec; bullet.UpdateVelocity(); yield return bullet.Wait(1); int num = i + 1; i = num; } } public static IEnumerator AccelerateTowardsPoint(this Bullet bullet, float accel, Vector2 point, int forFrames = -1, bool gravitate = false) { //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) Vector2 val = point - bullet.Position; Vector2 accelVec = accel * ((Vector2)(ref val)).normalized; int i = 0; while (i != forFrames) { bullet.Velocity += accelVec; bullet.UpdateVelocity(); yield return bullet.Wait(1); if (gravitate) { val = point - bullet.Position; accelVec = accel * ((Vector2)(ref val)).normalized; } int num = i + 1; i = num; } } public static IEnumerator GravitateTowardsPoint(this Bullet bullet, float accel, Vector2 point, int forFrames = -1) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return bullet.AccelerateTowardsPoint(accel, point, forFrames, gravitate: true); } public static IEnumerator AccelerateWithTrajectoryThroughPoint(this Bullet bullet, Vector2 point, int framesToReachPoint) { //IL_0005: 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_000c: 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_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) //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_0033: Unknown result type (might be due to invalid IL or missing references) Vector2 accelVec = 2f * (point - bullet.Position - bullet.Velocity * (float)framesToReachPoint) / (float)(framesToReachPoint * framesToReachPoint); return bullet.Accelerate(accelVec, framesToReachPoint); } public static IEnumerator AccelerateWithTrajectoryThroughTwoPoints(this Bullet bullet, Vector2 pointA, int framesA, Vector2 pointB, int framesB) { //IL_0005: 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_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_001c: 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) //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_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_004d: Unknown result type (might be due to invalid IL or missing references) bullet.Velocity = ((float)(framesA * framesA) * (pointB - bullet.Position) - (float)(framesB * framesB) * (pointA - bullet.Position)) / (float)(framesA * framesB * (framesA - framesB)); bullet.UpdateVelocity(); return bullet.AccelerateWithTrajectoryThroughPoint(pointB, framesB); } public static IEnumerator MoveTangentToPlayer(this Bullet bullet, PlayerController player = null) { if (player == null) { player = GameManager.Instance.BestActivePlayer; } Vector2 centerPosition = ((GameActor)player).CenterPosition; float num = Vector2Extensions.ToAngle(bullet.Velocity); Vector2 position = bullet.Position; Vector2 val = position + 1000f * bullet.Velocity; Vector2 val2 = centerPosition + 500f * (num + 90f).ToVector(); Vector2 val3 = centerPosition + 500f * (num - 90f).ToVector(); Vector2 val4 = default(Vector2); if (BraveUtility.LineIntersectsLine(position, val, val2, val3, ref val4)) { Vector2 val5 = val4 - position; int num2 = Mathf.CeilToInt(((Vector2)(ref val5)).magnitude / ((Vector2)(ref bullet.Velocity)).magnitude); yield return bullet.Wait(num2); } } public static IEnumerator OrbitPointAtCurrentRadiusAndVelocity(this Bullet bullet) { yield break; } } public static class Cubic { public static List InterpolateXY(List points, int count) { //IL_0029: 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_010c: Unknown result type (might be due to invalid IL or missing references) double[] array = new double[points.Count]; double[] array2 = new double[points.Count]; for (int i = 0; i < points.Count; i++) { array[i] = points[i].x; array2[i] = points[i].y; } int num = array.Length; double[] array3 = new double[num]; for (int j = 1; j < num; j++) { double num2 = array[j] - array[j - 1]; double num3 = array2[j] - array2[j - 1]; double num4 = Math.Sqrt(num2 * num2 + num3 * num3); array3[j] = array3[j - 1] + num4; } double meanDistance = array3.Last() / (double)(count - 1); double[] xInterp = (from x in Enumerable.Range(0, count) select (double)x * meanDistance).ToArray(); double[] array4 = Interpolate(array3, array, xInterp); double[] array5 = Interpolate(array3, array2, xInterp); List list = new List(); for (int num5 = 0; num5 < array4.Length; num5++) { list.Add(new Vector2((float)array4[num5], (float)array5[num5])); } return list; } private static double[] Interpolate(double[] xOrig, double[] yOrig, double[] xInterp) { FitMatrix(xOrig, yOrig, out var a, out var b); double[] array = new double[xInterp.Length]; for (int i = 0; i < array.Length; i++) { int j; for (j = 0; j < xOrig.Length - 2 && !(xInterp[i] <= xOrig[j + 1]); j++) { } double num = xOrig[j + 1] - xOrig[j]; double num2 = (xInterp[i] - xOrig[j]) / num; double num3 = (1.0 - num2) * yOrig[j] + num2 * yOrig[j + 1] + num2 * (1.0 - num2) * (a[j] * (1.0 - num2) + b[j] * num2); array[i] = num3; } return array; } private static void FitMatrix(double[] x, double[] y, out double[] a, out double[] b) { int num = x.Length; a = new double[num - 1]; b = new double[num - 1]; double[] array = new double[num]; double[] array2 = new double[num]; double[] array3 = new double[num]; double[] array4 = new double[num]; double num2 = x[1] - x[0]; array4[0] = 1.0 / num2; array3[0] = 2.0 * array4[0]; array[0] = 3.0 * (y[1] - y[0]) / (num2 * num2); double num4; for (int i = 1; i < num - 1; i++) { num2 = x[i] - x[i - 1]; double num3 = x[i + 1] - x[i]; array2[i] = 1.0 / num2; array4[i] = 1.0 / num3; array3[i] = 2.0 * (array2[i] + array4[i]); num4 = y[i] - y[i - 1]; double num5 = y[i + 1] - y[i]; array[i] = 3.0 * (num4 / (num2 * num2) + num5 / (num3 * num3)); } num2 = x[num - 1] - x[num - 2]; num4 = y[num - 1] - y[num - 2]; array2[num - 1] = 1.0 / num2; array3[num - 1] = 2.0 * array2[num - 1]; array[num - 1] = 3.0 * (num4 / (num2 * num2)); double[] array5 = new double[num]; array5[0] = array4[0] / array3[0]; for (int j = 1; j < num; j++) { array5[j] = array4[j] / (array3[j] - array5[j - 1] * array2[j]); } double[] array6 = new double[num]; array6[0] = array[0] / array3[0]; for (int k = 1; k < num; k++) { array6[k] = (array[k] - array6[k - 1] * array2[k]) / (array3[k] - array5[k - 1] * array2[k]); } double[] array7 = new double[num]; array7[num - 1] = array6[num - 1]; for (int num6 = num - 2; num6 >= 0; num6--) { array7[num6] = array6[num6] - array5[num6] * array7[num6 + 1]; } for (int l = 1; l < num; l++) { num2 = x[l] - x[l - 1]; num4 = y[l] - y[l - 1]; a[l - 1] = array7[l - 1] * num2 - num4; b[l - 1] = (0.0 - array7[l]) * num2 + num4; } } } public class FloorPuzzleRoomController : MonoBehaviour { internal static readonly List _FloorPuzzleRooms = new List(); internal static readonly string _GUID = "floor_puzzle_controller"; private const float MAX_TIME_BETWEEN_TRIGGERS = 0.1f; private const int BASE_PUZZLE_SIZE = 9; internal FloorPuzzleTile _last; internal bool _puzzleSucceeded; internal bool _puzzleStarted; internal PlayerController _puzzleDoer; private float _dirtyCheaterTimer; private bool _puzzleFailed; private List _children = new List(); private List _tilesCollidedThisFrame = new List(); private FloorPuzzleTile _entry; private FloorPuzzleTile _exit; private RoomHandler _room; private int _puzzleSize; public static void Init() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) Lazy.RegisterEasyRATPlaceable(_GUID); FloorPuzzleTile.Init(); _FloorPuzzleRooms.Add(RoomFactory.BuildNewRoomFromResource("CwaffingTheGungy/Resources/Rooms/floor_puzzle.newroom", (Assembly)null).room); } private void Start() { //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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 //IL_0088: 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_00cb: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 //IL_00fa: 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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_0178: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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) _puzzleSize = 9; ValidTilesets tilesetId = GameManager.Instance.Dungeon.tileIndices.tilesetId; if ((int)tilesetId == 2 || (int)tilesetId == 1) { _puzzleSize--; } else if ((int)tilesetId != 16 && (int)tilesetId != 32 && (int)tilesetId != 4) { _puzzleSize++; } _puzzleSize += new int[3] { -1, 0, 1 }.ChooseRandom(); float num = 0.5f * (float)(_puzzleSize - 1); _room = Vector3Extensions.GetAbsoluteRoom(((Component)this).transform.position); CellArea area = _room.area; LinkedList linkedList = FloorPuzzleGenerator.GeneratePuzzleOfSize(_puzzleSize, _puzzleSize); HashSet hashSet = new HashSet(linkedList); IntVector2 value = linkedList.First.Value; IntVector2 value2 = linkedList.Last.Value; IntVector2 val = default(IntVector2); for (int i = 0; i < _puzzleSize; i++) { for (int j = 0; j < _puzzleSize; j++) { GameObject obj = Object.Instantiate(FloorPuzzleTile.Prefab); obj.transform.position = Vector2.op_Implicit(area.UnitCenter + 1.5f * new Vector2((float)i - num, (float)j - num)); FloorPuzzleTile component = obj.GetComponent(); ((IntVector2)(ref val))..ctor(i, j); component.Setup(this, val, !hashSet.Contains(val)); if (i == value.x && j == value.y) { component._type = FloorPuzzleTile.TileType.ENTRY; _entry = component; } else if (i == value2.x && j == value2.y) { component._type = FloorPuzzleTile.TileType.EXIT; _exit = component; } _children.Add(component); } } _entry._animator.defaultClipId = _entry._animator.GetClipIdByName("goal"); _entry._animator.Pause(); } internal void ResetTimers() { _dirtyCheaterTimer = 0f; } internal void Fail() { if (!_puzzleFailed) { _puzzleFailed = true; ((Component)this).gameObject.Play("puzzle_fail"); } } internal bool Failed() { return _puzzleFailed; } private void HandleQueuedTileCollisions() { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_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_0066: Unknown result type (might be due to invalid IL or missing references) PlayerController puzzleDoer = _puzzleDoer; if (!Object.op_Implicit((Object)(object)puzzleDoer)) { return; } Vector2 unitCenter = ((BraveBehaviour)puzzleDoer).specRigidbody.UnitCenter; FloorPuzzleTile floorPuzzleTile = _tilesCollidedThisFrame[0]; Vector2 val = unitCenter - floorPuzzleTile._trigger.UnitCenter; float num = ((Vector2)(ref val)).sqrMagnitude; for (int i = 1; i < _tilesCollidedThisFrame.Count; i++) { val = unitCenter - _tilesCollidedThisFrame[i]._trigger.UnitCenter; float sqrMagnitude = ((Vector2)(ref val)).sqrMagnitude; if (!(sqrMagnitude >= num)) { num = sqrMagnitude; floorPuzzleTile = _tilesCollidedThisFrame[i]; } } floorPuzzleTile.HandleCollision(); _tilesCollidedThisFrame.Clear(); if (!_puzzleStarted) { _puzzleDoer = null; } } internal void StartPuzzle() { _puzzleStarted = true; _exit._animator.PlayFromFrame("goal", 0); _exit._animator.Pause(); foreach (FloorPuzzleTile child in _children) { if (!((Object)(object)child == (Object)(object)_entry) && !((Object)(object)child == (Object)(object)_exit) && child._type != FloorPuzzleTile.TileType.WALL) { child._animator.PlayFromFrame("startup", 0); child._animator.Resume(); } } } private void Update() { if (_puzzleSucceeded) { return; } if (_tilesCollidedThisFrame.Count > 0) { HandleQueuedTileCollisions(); } if (!_puzzleStarted) { return; } _dirtyCheaterTimer += BraveTime.DeltaTime; if (_dirtyCheaterTimer < 0.1f) { return; } foreach (FloorPuzzleTile child in _children) { child.Reset(); } _entry._animator.PlayFromFrame("goal", 0); _entry._animator.Pause(); _last = null; _puzzleStarted = false; _puzzleDoer = null; if (_puzzleFailed) { _puzzleFailed = false; } else { ((Component)this).gameObject.Play("puzzle_fail"); } } internal void CollidedWithTileThisFrame(FloorPuzzleTile tile, PlayerController pc) { if ((Object)(object)_puzzleDoer == (Object)null) { _puzzleDoer = pc; } else if ((Object)(object)_puzzleDoer != (Object)(object)pc) { return; } _tilesCollidedThisFrame.Add(tile); } private Chest GetChestForPuzzleDifficulty() { //IL_0022: 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_0034: 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_0026: 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_002e: 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) int puzzleSize = _puzzleSize; ItemQuality val = (ItemQuality)((puzzleSize < 8) ? ((ItemQuality)1) : (puzzleSize switch { 8 => 2, 9 => 3, 10 => 4, _ => 5, })); ItemQuality val2 = val; return GameManager.Instance.RewardManager.GetTargetChestPrefab(val2); } internal bool CheckSuccess() { //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_0069: 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_0087: Unknown result type (might be due to invalid IL or missing references) if (_puzzleSucceeded || _puzzleFailed) { return false; } foreach (FloorPuzzleTile child in _children) { if (!child._active) { return false; } } _puzzleSucceeded = true; IntVector2 bestRewardLocation = _room.GetBestRewardLocation(new IntVector2(2, 1), (RewardLocationStyle)0, true); if (GameStatsManager.Instance.IsRainbowRun) { LootEngine.SpawnBowlerNote(GameManager.Instance.RewardManager.BowlerNoteChest, ((IntVector2)(ref bestRewardLocation)).ToCenterVector2(), _room, true); } else { Chest val = Chest.Spawn(GetChestForPuzzleDifficulty(), bestRewardLocation, _room, false); if (val != null) { val.RegisterChestOnMinimap(_room); val.ForceUnlock(); } } ((Component)this).gameObject.Play("puzzle_solve"); return true; } } public class FloorPuzzleTile : MonoBehaviour { public enum TileType { NORMAL, WALL, ENTRY, EXIT } private const float LEEWAY = 0.1f; public static GameObject Prefab; internal bool _active; internal TileType _type; internal PixelCollider _trigger; internal tk2dSpriteAnimator _animator; private FloorPuzzleRoomController _controller; private SpeculativeRigidbody _body; private tk2dSprite _sprite; private float _triggerTimer; private IntVector2 _tileIndex; public static void Init() { Prefab = VFX.Create("puzzle_tile_square", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); Prefab.AutoRigidBody((CollisionLayer)10); Prefab.AddComponent(); Prefab.AddAnimation("wall", "pressedplate_broken", 30f, loops: false, -1, (Anchor)4); Prefab.AddAnimation("goal", "pressedplate_goal", 30f, loops: false, -1, (Anchor)4); Prefab.AddAnimation("press", "pressedplate_presseddown_first", 30f, loops: false, -1, (Anchor)4); Prefab.AddAnimation("repress", "pressedplate_presseddown_second", 30f, loops: false, -1, (Anchor)4); Prefab.AddAnimation("unpress", "pressedplate_pressedup_first", 30f, loops: false, -1, (Anchor)4); Prefab.AddAnimation("startup", "pressedplate_startup", 30f, loops: false, -1, (Anchor)4); Prefab.AddAnimation("fail", "pressedplate_turnred", 30f, loops: false, -1, (Anchor)4); Prefab.AddAnimation("reset_red", "pressedplate_presseddown_reset_red", 10f, loops: false, -1, (Anchor)4); Prefab.AddAnimation("reset_green", "pressedplate_presseddown_reset_green", 10f, loops: false, -1, (Anchor)4); Prefab.AddAnimation("reset_white", "pressedplate_presseddown_reset_white", 10f, loops: false, -1, (Anchor)4); } public void Setup(FloorPuzzleRoomController controller, IntVector2 tileIndex, bool isWall) { //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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown _controller = controller; _tileIndex = tileIndex; _sprite = ((Component)this).gameObject.GetComponent(); ((tk2dBaseSprite)_sprite).usesOverrideMaterial = true; ((BraveBehaviour)_sprite).renderer.material.shader = ShaderCache.Acquire("Brave/PlayerShader"); ((tk2dBaseSprite)_sprite).HeightOffGround = -4f; ((tk2dBaseSprite)_sprite).UpdateZDepth(); _animator = ((Component)this).gameObject.GetComponent(); _animator.defaultClipId = _animator.GetClipIdByName(isWall ? "wall" : "startup"); _animator.Pause(); _body = ((Component)this).gameObject.GetComponent(); _trigger = _body.PixelColliders[0]; if (isWall) { _type = TileType.WALL; _active = true; _trigger.IsTrigger = false; } else { _trigger.IsTrigger = true; SpeculativeRigidbody body = _body; body.OnTriggerCollision = (OnTriggerDelegate)Delegate.Combine((Delegate?)(object)body.OnTriggerCollision, (Delegate?)new OnTriggerDelegate(OnTriggerCollision)); } } private void OnTriggerCollision(SpeculativeRigidbody specRigidbody, SpeculativeRigidbody sourceSpecRigidbody, CollisionData collisionData) { if (Object.op_Implicit((Object)(object)_controller) && !_controller._puzzleSucceeded && _type != TileType.WALL) { PlayerController component = ((Component)specRigidbody).gameObject.GetComponent(); if (component != null) { _controller.CollidedWithTileThisFrame(this, component); } } } public void HandleCollision() { //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) _controller.ResetTimers(); if (_controller.Failed() || (!_controller._puzzleStarted && _type != TileType.ENTRY)) { return; } if (_active) { if ((Object)(object)_controller._last != (Object)(object)this && _triggerTimer >= 0.1f) { if (Object.op_Implicit((Object)(object)_controller._last)) { _controller._last._animator.Resume(); _controller._last._animator.PlayFromFrame("unpress", 0); } _animator.Resume(); _animator.PlayFromFrame("repress", 0); _controller.Fail(); } _triggerTimer = 0f; return; } _active = true; _animator.Resume(); _animator.PlayFromFrame("press", 0); if (Object.op_Implicit((Object)(object)_controller._last)) { _controller._last._animator.Resume(); _controller._last._animator.PlayFromFrame("unpress", 0); if (IntVector2.ManhattanDistance(_controller._last._tileIndex, _tileIndex) > 1) { _controller._last._animator.PlayFromFrame("fail", 0); _controller.Fail(); return; } } _controller._last = this; if (_type == TileType.ENTRY) { _controller.StartPuzzle(); } if (_controller.CheckSuccess()) { _animator.QueueAnimation("unpress"); } else if (_type == TileType.EXIT) { _controller._last._animator.PlayFromFrame("fail", 0); _controller.Fail(); } else { ((Component)this).gameObject.Play("puzzle_tile_step_sound"); } } internal void Reset() { if (_type != TileType.WALL) { _active = false; _animator.Resume(); if (_animator.IsPlaying("fail") || _animator.IsPlaying("repress")) { _animator.PlayFromFrame("reset_red", 0); } else if (_animator.IsPlaying("unpress")) { _animator.PlayFromFrame("reset_green", 0); } else { _animator.PlayFromFrame("reset_white", 0); } } } private void Update() { _triggerTimer += BraveTime.DeltaTime; } } internal static class FloorPuzzleGenerator { public static LinkedList GeneratePuzzleOfSize(int width = 9, int height = 9, float targetCoverage = 0.75f) { //IL_0019: 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_0033: 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_0041: 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: 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_011f: 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_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_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_01a6: 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_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: 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_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: 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_01fa: 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_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: 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_0216: 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_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0234: 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_0248: 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_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0267: 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_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) IntVector2 val = default(IntVector2); ((IntVector2)(ref val))..ctor(Random.Range(0, width), 0); IntVector2 val2 = new IntVector2(Random.Range(0, width), height - 1); LinkedList linkedList = new LinkedList(); HashSet hashSet = new HashSet(); linkedList.AddLast(val); hashSet.Add(val); int num = val.x; int num2 = val.y; int num3 = val2.y - val.y; int num4 = val2.x - val.x; List list = new List(); for (int i = 0; i < Math.Abs(num3); i++) { list.Add((num3 > 0) ? 'U' : 'D'); } for (int j = 0; j < Math.Abs(num4); j++) { list.Add((num4 > 0) ? 'R' : 'L'); } list.Shuffle(); using (List.Enumerator enumerator = list.GetEnumerator()) { IntVector2 val3 = default(IntVector2); while (enumerator.MoveNext()) { switch (enumerator.Current) { case 'D': num2--; break; case 'U': num2++; break; case 'L': num--; break; case 'R': num++; break; } ((IntVector2)(ref val3))..ctor(num, num2); linkedList.AddLast(val3); hashSet.Add(val3); } } int num5 = 1000; while (num5 > 0) { int count = linkedList.Count; int num6 = Random.Range(0, count - 1); LinkedListNode linkedListNode = linkedList.First; for (int k = 0; k < num6; k++) { linkedListNode = linkedListNode.Next; } LinkedListNode next = linkedListNode.Next; IntVector2 value = linkedListNode.Value; IntVector2 value2 = next.Value; IntVector2 val4 = ((new IntVector2(value2.x - value.x, value2.y - value.y).y == 0) ? new IntVector2(0, Lazy.CoinFlip() ? 1 : (-1)) : new IntVector2(Lazy.CoinFlip() ? 1 : (-1), 0)); IntVector2 val5 = value + val4; IntVector2 val6 = value2 + val4; if (val5.x < 0 || val5.x >= width || val5.y < 0 || val5.y >= height || val6.x < 0 || val6.x >= width || val6.y < 0 || val6.y >= height || hashSet.Contains(val5) || hashSet.Contains(val6)) { num5--; continue; } linkedList.AddAfter(linkedListNode, val5); linkedList.AddBefore(next, val6); hashSet.Add(val5); hashSet.Add(val6); if ((float)hashSet.Count / (float)(height * width) >= targetCoverage) { break; } } return linkedList; } } public class ShufflePuzzleRoomController : MonoBehaviour { internal enum State { LOADING, PRESTART, SHUFFLING, PLAYERWAIT, COMPLETED } private class SwappyThing : MonoBehaviour, IPlayerInteractable { internal const float _OUTLINE_OFFSET = 0.1f; internal int _index = -1; internal int _contentsId = -1; internal tk2dSprite _sprite; internal SpeculativeRigidbody _body; internal CwaffTrailController _trail; private tk2dSprite _itemSprite; private ShufflePuzzleRoomController _controller; private PickupObject _contents; public void Setup(ShufflePuzzleRoomController controller, int index, PickupObject contents) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown _controller = controller; _index = index; _contentsId = contents.PickupObjectId; _contents = contents; _sprite = ((Component)this).gameObject.GetComponent(); _trail = ((BraveBehaviour)(object)_sprite).AddTrail(Uppskeruvel._SoulTrailPrefab); _trail.useBody = false; _body = ((Component)this).gameObject.GetComponent(); SpeculativeRigidbody body = _body; body.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)body.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreRigidbodyCollision)); tk2dSprite component = ((Component)contents).gameObject.GetComponent(); _itemSprite = Lazy.SpriteObject(((tk2dBaseSprite)component).collection, ((tk2dBaseSprite)component).spriteId); ((BraveBehaviour)_itemSprite).renderer.enabled = false; } private void OnPreRigidbodyCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { if (_controller._puzzleStarted && _controller._state != State.PLAYERWAIT) { PhysicsEngine.SkipCollision = true; } } public void Relocate(Vector2 pos) { //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_0029: Unknown result type (might be due to invalid IL or missing references) if (!((BraveBehaviour)_sprite).renderer.enabled) { ((BraveBehaviour)_sprite).renderer.enabled = true; SpriteOutlineManager.AddOutlineToSprite((tk2dBaseSprite)(object)_sprite, Color.black, 0.1f, 0f, (OutlineType)0); } ((tk2dBaseSprite)_sprite).PlaceAtPositionByAnchor(Vector2.op_Implicit(pos), (Anchor)4); ((tk2dBaseSprite)_sprite).UpdateZDepth(); } public void Interact(PlayerController player) { //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_0061: 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_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) SpriteOutlineManager.RemoveOutlineFromSprite((tk2dBaseSprite)(object)_sprite, false); if (!_controller._puzzleStarted) { _controller.StartPuzzle(player); } else if (!((Object)(object)player != (Object)(object)_controller._puzzleDoer)) { Vector2 val = Vector3Extensions.XY(((tk2dBaseSprite)_itemSprite).GetCurrentSpriteDef().boundsDataExtents); LootEngine.SpawnItem(((Component)_contents).gameObject, Vector2.op_Implicit(((tk2dBaseSprite)_sprite).WorldCenter - val), Vector2.up, 1f, true, false, false); _controller.EndPuzzle(); } } public void UpdateItemRenderer(Vector2 pos, float scale = 1f) { //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_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_0023: Unknown result type (might be due to invalid IL or missing references) if (!((BraveBehaviour)_itemSprite).renderer.enabled) { ((BraveBehaviour)_itemSprite).renderer.enabled = true; LootEngine.DoDefaultItemPoof(pos, false, _index > 0); } ((tk2dBaseSprite)_itemSprite).scale = scale * Vector3.one; ((tk2dBaseSprite)(object)_itemSprite).PlaceAtScaledPositionByAnchor(Vector2.op_Implicit(pos), (Anchor)4); ((tk2dBaseSprite)_itemSprite).UpdateZDepth(); } public void AddOutlineToItem() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) SpriteOutlineManager.AddOutlineToSprite((tk2dBaseSprite)(object)_itemSprite, Color.black, 2f, 0f, (OutlineType)0); ((tk2dBaseSprite)_itemSprite).UpdateZDepth(); } public void RemoveItemRenderer() { Object.Destroy((Object)(object)((Component)_itemSprite).gameObject); } public float GetDistanceToPoint(Vector2 point) { //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) if (!Object.op_Implicit((Object)(object)this) || !Object.op_Implicit((Object)(object)_sprite)) { return 1000f; } return Vector2.Distance(point, ((tk2dBaseSprite)_sprite).WorldCenter); } public float GetOverrideMaxDistance() { return -1f; } public string GetAnimationState(PlayerController interactor, out bool shouldBeFlipped) { shouldBeFlipped = false; return string.Empty; } public void OnEnteredRange(PlayerController interactor) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)this)) { SpriteOutlineManager.RemoveOutlineFromSprite((tk2dBaseSprite)(object)_sprite, false); SpriteOutlineManager.AddOutlineToSprite((tk2dBaseSprite)(object)_sprite, Color.white, 0.1f, 0f, (OutlineType)0); ((tk2dBaseSprite)_sprite).UpdateZDepth(); } } public void OnExitRange(PlayerController interactor) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)this)) { SpriteOutlineManager.RemoveOutlineFromSprite((tk2dBaseSprite)(object)_sprite, false); SpriteOutlineManager.AddOutlineToSprite((tk2dBaseSprite)(object)_sprite, Color.black, 0.1f, 0f, (OutlineType)0); ((tk2dBaseSprite)_sprite).UpdateZDepth(); } } } private const string PUZZLE_STRING = "doing a puzzle"; internal static readonly List _ShufflePuzzleRooms = new List(); internal static readonly string _GUID = "shuffle_puzzle_controller"; internal static GameObject _PuzzleBagPrefab = null; internal bool _puzzleStarted; internal PlayerController _puzzleDoer; private State _state; private RoomHandler _room; private Vector2 _swapCenter; private float _swapRadius = 4f; private int _numSwappables = 7; private List _swappies = new List(); private int _intQuality; private int _prizePos; public static void Init() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) Lazy.RegisterEasyRATPlaceable(_GUID); _ShufflePuzzleRooms.Add(RoomFactory.BuildNewRoomFromResource("CwaffingTheGungy/Resources/Rooms/shuffle_puzzle.newroom", (Assembly)null).room); _PuzzleBagPrefab = VFX.Create("puzzle_bag", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _PuzzleBagPrefab.AutoRigidBody((CollisionLayer)6); } private void Start() { //IL_0007: 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_002c: 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_0045: 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_0089: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected I4, but got Unknown //IL_00ab: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_0087: 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_0186: Unknown result type (might be due to invalid IL or missing references) _room = Vector3Extensions.GetAbsoluteRoom(((Component)this).transform.position); _swapCenter = dfVectorExtensions.Quantize(_room.area.UnitCenter, 0.0625f) + new Vector2(0f, 1f / 32f); float value = Random.value; ItemQuality val = ((value > 0.95f) ? ((ItemQuality)5) : ((value > 0.85f) ? ((ItemQuality)4) : ((value > 0.65f) ? ((ItemQuality)3) : ((!(value > 0.35f)) ? ((ItemQuality)1) : ((ItemQuality)2))))); ItemQuality val2 = val; _intQuality = (int)val2; _numSwappables = 4 + _intQuality; PickupObject component = GameManager.Instance.PrimaryPlayer.GetRandomChestRewardOfQuality(val2).GetComponent(); PassiveItem val3 = Items.Junk.AsPassive(); _prizePos = Random.Range(0, _numSwappables); for (int i = 0; i < _numSwappables; i++) { tk2dSprite component2 = _PuzzleBagPrefab.Instantiate(Vector2.op_Implicit(_swapCenter)).GetComponent(); ((tk2dBaseSprite)component2).UpdateZDepth(); SwappyThing swappyThing = ((Component)component2).gameObject.AddComponent(); (360f * (float)i / (float)_numSwappables).ToVector(_swapRadius); swappyThing.Setup(this, i, (PickupObject)((i == _prizePos) ? ((object)component) : ((object)val3))); swappyThing.Relocate(_swapCenter); _swappies.Add(swappyThing); if (i == 0) { _room.RegisterInteractable((IPlayerInteractable)(object)swappyThing); SpriteOutlineManager.AddOutlineToSprite((tk2dBaseSprite)(object)component2, Color.black, 0.1f, 0f, (OutlineType)0); } else { ((BraveBehaviour)component2).renderer.enabled = false; } } } private IEnumerator DoShuffle() { int num = 25 + 5 * _intQuality; float minSwapTime = 0.3f - 0.05f * (float)_intQuality; float rotspeed = 0f; float rotation = 0f; float rotdir = 1f; float swapTimer = 0f; int swapIndexOne = -1; int swapIndexTwo = -1; bool doingSwap = false; int swapsLeft = num; for (float elapsed = 0f; elapsed < 1f; elapsed += BraveTime.DeltaTime) { float num2 = 1f - elapsed / 1f; float num3 = 1f - num2 * num2 * num2; for (int i = 0; i < _numSwappables; i++) { _swappies[i].Relocate(_swapCenter + (360f * ((float)i / (float)_numSwappables) + rotation).ToVector(num3 * _swapRadius)); } yield return null; } for (int j = 0; j < _numSwappables; j++) { _swappies[j].UpdateItemRenderer(_swapCenter + (360f * ((float)j / (float)_numSwappables) + rotation).ToVector(2f + _swapRadius)); _swappies[j].AddOutlineToItem(); } yield return (object)new WaitForSeconds(1.5f); for (float elapsed = 0f; elapsed < 1f; elapsed += BraveTime.DeltaTime) { float num4 = 1f - elapsed / 1f; float magnitude = num4 * 2f + _swapRadius; for (int k = 0; k < _numSwappables; k++) { _swappies[k].UpdateItemRenderer(_swapCenter + (360f * ((float)k / (float)_numSwappables) + rotation).ToVector(magnitude), num4); } yield return null; } yield return (object)new WaitForSeconds(0.5f); _ = BraveTime.DeltaTime; float swapTime = 0.4f; while (swapsLeft > 0) { yield return null; float deltaTime = BraveTime.DeltaTime; rotspeed += 40f * rotdir * deltaTime; if (rotspeed > 120f) { rotspeed = 120f; } else if (rotspeed < -120f) { rotspeed = -120f; } rotation = (rotation + rotspeed * deltaTime) % 360f; if (!doingSwap) { swapTimer += deltaTime; if (swapTimer >= 0.1f) { swapTimer = 0f; doingSwap = true; ((Component)this).gameObject.Play("puzzle_item_swap_sound"); swapIndexOne = (Lazy.CoinFlip() ? _prizePos : Random.Range(0, _numSwappables)); swapIndexTwo = (swapIndexOne + Random.Range(2, _numSwappables - 1)) % _numSwappables; } } else { swapTimer += deltaTime; if (swapTimer >= swapTime) { swapTimer = 0f; doingSwap = false; SwappyThing value = _swappies[swapIndexOne]; _swappies[swapIndexOne] = _swappies[swapIndexTwo]; _swappies[swapIndexTwo] = value; swapIndexOne = -1; swapIndexTwo = -1; int num5 = swapsLeft - 1; swapsLeft = num5; swapTime = Mathf.Max(minSwapTime, swapTime - 0.01f); } } for (int l = 0; l < _numSwappables; l++) { Vector2 val = _swapCenter + (360f * ((float)l / (float)_numSwappables) + rotation).ToVector(_swapRadius); if (l != swapIndexOne && l != swapIndexTwo) { _swappies[l].Relocate(val); continue; } Vector2 val2 = _swapCenter + (360f * ((float)((l != swapIndexOne) ? swapIndexOne : swapIndexTwo) / (float)_numSwappables) + rotation).ToVector(_swapRadius); float num6 = swapTimer / swapTime; Vector2 val3 = Vector2.Lerp(val, val2, num6); float num7 = Mathf.Min(num6, 1f - num6); Vector2 val4 = val2 - val; Vector2 val5 = num7 * ((Vector2)(ref val4)).normalized.Rotate(90f); _swappies[l].Relocate(val3 + val5); } } rotdir = ((!(rotspeed > 0f)) ? 1 : (-1)); while (rotdir * rotspeed < 0f) { yield return null; float deltaTime = BraveTime.DeltaTime; rotspeed += 120f * rotdir * deltaTime; rotation = (rotation + rotspeed * deltaTime) % 360f; for (int m = 0; m < _numSwappables; m++) { Vector2 pos = _swapCenter + (360f * ((float)m / (float)_numSwappables) + rotation).ToVector(_swapRadius); _swappies[m].Relocate(pos); } } _state = State.PLAYERWAIT; _puzzleDoer.ClearInputOverride("doing a puzzle"); for (int n = 0; n < _numSwappables; n++) { _room.RegisterInteractable((IPlayerInteractable)(object)_swappies[n]); ((BraveBehaviour)_swappies[n]._trail).transform.parent = null; Object.Destroy((Object)(object)((Component)_swappies[n]._trail).gameObject); _swappies[n]._body.Reinitialize(); PlayerController[] allPlayers = GameManager.Instance.AllPlayers; foreach (PlayerController val6 in allPlayers) { if (Object.op_Implicit((Object)(object)val6) && Object.op_Implicit((Object)(object)((BraveBehaviour)val6).specRigidbody)) { _swappies[n]._body.RegisterGhostCollisionException(((BraveBehaviour)val6).specRigidbody); } } } } private void StartPuzzle(PlayerController puzzleDoer) { if (!_puzzleStarted) { _puzzleDoer = puzzleDoer; _puzzleDoer.SetInputOverride("doing a puzzle"); _room.DeregisterInteractable((IPlayerInteractable)(object)_swappies[0]); _puzzleStarted = true; _state = State.SHUFFLING; ((Component)this).gameObject.Play("shuffle_puzzle_start_sound"); ((MonoBehaviour)this).StartCoroutine(DoShuffle()); } } private void EndPuzzle() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (_state == State.PLAYERWAIT) { _state = State.COMPLETED; for (int i = 0; i < _numSwappables; i++) { _room.DeregisterInteractable((IPlayerInteractable)(object)_swappies[i]); LootEngine.DoDefaultItemPoof(((tk2dBaseSprite)_swappies[i]._sprite).WorldCenter, false, i > 0); Object.Destroy((Object)(object)((Component)_swappies[i]).gameObject); } } } } public static class Extensions { internal struct SoundRateData { private GameObject go; private string sound; private float nextSoundTime; private static readonly List _SoundTimes = new List(); internal SoundRateData(GameObject gameObject, string soundName, float next) { go = gameObject; sound = soundName; nextSoundTime = next; } internal static bool PlayRateLimited(GameObject g, string sound, float soundRate = 0f) { int count = _SoundTimes.Count; float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; int num = count; bool flag = true; int num2 = 0; while (num2 < num) { SoundRateData soundRateData = _SoundTimes[num2]; if (!Object.op_Implicit((Object)(object)soundRateData.go) || soundRateData.nextSoundTime <= scaledTimeSinceStartup) { _SoundTimes[num2] = _SoundTimes[--num]; continue; } if (sound == soundRateData.sound) { flag = false; } num2++; } if (num < count) { _SoundTimes.RemoveRange(num, count - num); } if (flag) { _SoundTimes.Add(new SoundRateData(g, sound, scaledTimeSinceStartup + soundRate)); } return flag; } } [HarmonyPatch(typeof(PlayerController), "AcquirePassiveItem")] private class PlayerControllerAcquirePassiveItemPatch { [HarmonyILManipulator] private static void PlayerControllerAcquirePassiveItemIL(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.MatchLdstr(instr, "Play_OBJ_passive_get_01") })) { val.CallPrivate(typeof(PlayerControllerAcquirePassiveItemPatch), "AdjustPickupSound"); } } private static string AdjustPickupSound(string oldSound) { if (!_SuppressNextPassivePickupSound) { return oldSound; } _SuppressNextPassivePickupSound = false; return string.Empty; } } private class UnresolvedLootData { public PickupObject pickup; public Type type; public float multiplier; } private static readonly List _Indices = new List(); private const int _ROOM_PIXEL_FUDGE_FACTOR = 8; internal static tk2dSpriteCollectionData _GunCollection = null; private static FieldInfo _AlexandriaShopItemBaseShopField = null; private static int _nextDebris = 0; private static bool _SuppressNextPassivePickupSound = false; private static string _SearchString = null; private static List _RefEnemies = new List(); private static readonly ReadOnlyCollection _ReadOnlyEnemies = new ReadOnlyCollection(_RefEnemies); private static readonly List _Steps = new List(); private static float _LastCameraCacheTime; private static Vector2 _CachedCameraMin; private static Vector2 _CachedCameraMax; private static Dictionary _EnemyNames = new Dictionary(); private static readonly List _NoIgnores = Enumerable.Empty().ToList(); private static GameObject _MiniBlankVFX = null; private static GameObject _BlankVFX = null; private static readonly List _UnresolvedLootChances = new List(); private static readonly List[] _HatOverrides = new List[2] { new List(), new List() }; private static readonly string[] _OriginalHat = new string[2]; private static Dictionary _UnresolvedDualWields = new Dictionary(); private static List _DeadKeys = new List(); private static List _TempBehavs = new List(); private static LinkedList _FrontierCells = new LinkedList(); private static Dictionary> _PitMaps = new Dictionary>(); private static Dictionary _PitCounts = new Dictionary(); public static void ExpireIn(this GameObject self, float seconds, float fadeFor = 0f, float startAlpha = 1f, bool shrink = false) { GameObjectExtensions.GetOrAddComponent(self).ExpireIn(seconds, fadeFor, startAlpha, shrink); } public static Rect Inset(this Rect self, float topInset, float rightInset, float bottomInset, float leftInset) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) return new Rect(((Rect)(ref self)).x + leftInset, ((Rect)(ref self)).y + bottomInset, ((Rect)(ref self)).width - leftInset - rightInset, ((Rect)(ref self)).height - bottomInset - topInset); } public static Rect Inset(this Rect self, float xInset, float yInset) { //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) return self.Inset(yInset, xInset, yInset, xInset); } public static Rect Inset(this Rect self, float inset) { //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) return self.Inset(inset, inset, inset, inset); } public static Vector2 RandomPointOnPerimeter(this Rect self) { //IL_0000: 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 self.PointOnPerimeter(Random.Range(0f, 1f)); } public static Vector2 PointOnPerimeter(this Rect self, float t) { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) float num = ((Rect)(ref self)).width + ((Rect)(ref self)).height; float num2 = t * 2f * num; Vector2 result = default(Vector2); if (num2 < ((Rect)(ref self)).width) { ((Vector2)(ref result))..ctor(((Rect)(ref self)).xMin + num2, ((Rect)(ref self)).yMin); } else if (num2 < num) { ((Vector2)(ref result))..ctor(((Rect)(ref self)).xMax, ((Rect)(ref self)).yMin + num2 - ((Rect)(ref self)).width); } else if (num2 - num < ((Rect)(ref self)).width) { ((Vector2)(ref result))..ctor(((Rect)(ref self)).xMax - (num2 - num), ((Rect)(ref self)).yMax); } else { ((Vector2)(ref result))..ctor(((Rect)(ref self)).xMin, ((Rect)(ref self)).yMax - (num2 - num - ((Rect)(ref self)).width)); } return result; } public static float InversePointOnPerimeter(this Rect self, Vector2 p) { //IL_0010: 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_001f: 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_0025: 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_0039: 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_005f: 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_0099: Unknown result type (might be due to invalid IL or missing references) float num = ((Rect)(ref self)).width + ((Rect)(ref self)).height; Vector2 val = BraveMathCollege.ClosestPointOnRectangle(p, ((Rect)(ref self)).min, ((Rect)(ref self)).size); if (val.y == ((Rect)(ref self)).yMin) { return 0.5f * ((val.x - ((Rect)(ref self)).xMin) / num); } if (val.x == ((Rect)(ref self)).xMax) { return 0.5f * ((val.y - ((Rect)(ref self)).yMin + ((Rect)(ref self)).width) / num); } if (val.y == ((Rect)(ref self)).yMax) { return 0.5f + 0.5f * ((((Rect)(ref self)).xMax - val.x) / num); } return 0.5f + 0.5f * ((((Rect)(ref self)).yMax - val.y + ((Rect)(ref self)).width) / num); } public static Vector2 RaycastToWall(this Vector2 self, float angle, Rect theWall) { //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_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_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_0021: 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_002b: 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) //IL_0044: Unknown result type (might be due to invalid IL or missing references) Vector2 positiveInfinity = Vector2.positiveInfinity; BraveMathCollege.LineSegmentRectangleIntersection(self + 1000f * angle.ToVector(), self, ((Rect)(ref theWall)).position, ((Rect)(ref theWall)).position + ((Rect)(ref theWall)).size, ref positiveInfinity); return positiveInfinity; } public static GameObject RegisterPrefab(this GameObject self, bool deactivate = true, bool markFake = true, bool dontUnload = true, bool activate = false) { if (activate) { self.gameObject.SetActive(true); } else if (deactivate) { self.gameObject.SetActive(false); } if (markFake) { FakePrefab.MarkAsFakePrefab(self.gameObject); } if (dontUnload) { Object.DontDestroyOnLoad((Object)(object)self); } return self; } public static T RegisterPrefab(this T self, bool deactivate = true, bool markFake = true, bool dontUnload = true) where T : Component { ((Component)self).gameObject.RegisterPrefab(deactivate, markFake, dontUnload); return self; } public static GameObject ClonePrefab(this GameObject self, bool deactivate = true, bool markFake = true, bool dontUnload = true) { return Object.Instantiate(self).RegisterPrefab(deactivate, markFake, dontUnload).gameObject; } public static T ClonePrefab(this T self, bool deactivate = true, bool markFake = true, bool dontUnload = true) where T : Component { bool activeSelf = ((Component)self).gameObject.activeSelf; if (activeSelf) { ((Component)self).gameObject.SetActive(false); } T component = Object.Instantiate(((Component)self).gameObject).RegisterPrefab(deactivate, markFake, dontUnload).GetComponent(); if (activeSelf) { ((Component)self).gameObject.SetActive(true); } return component; } public static Vector2 ToVector(this float self, float magnitude = 1f) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) float num = self * ((float)Math.PI / 180f); return new Vector2(magnitude * Mathf.Cos(num), magnitude * Mathf.Sin(num)); } public static Vector3 ToVector3(this float self, float magnitude = 1f) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) float num = self * ((float)Math.PI / 180f); return new Vector3(magnitude * Mathf.Cos(num), magnitude * Mathf.Sin(num), 0f); } public static Vector2 Rotate(this Vector2 self, float rotation) { //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_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_001c: 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_0028: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Quaternion.Euler(0f, 0f, rotation) * Vector2.op_Implicit(self); return new Vector2(val.x, val.y); } public static float ClampAbsolute(this float self, float absoluteMax) { if (!(self < 0f - absoluteMax)) { if (!(self > absoluteMax)) { return self; } return absoluteMax; } return 0f - absoluteMax; } public static float Clamp180(this float self) { self %= 360f; if (self < -180f) { self += 360f; } else if (self > 180f) { self -= 360f; } return self; } public static float Clamp360(this float self) { self %= 360f; if (self < 0f) { self += 360f; } return self; } public static float RelAngleTo(this float angle, float other) { float num = (other - angle) % 360f; if (num < -180f) { num += 360f; } else if (num > 180f) { num -= 360f; } return num; } public static float AbsAngleTo(this float angle, float other) { float num = (other - angle) % 360f; if (num < -180f) { num += 360f; } else if (num > 180f) { num -= 360f; } if (!(num < 0f)) { return num; } return 0f - num; } public static bool IsNearAngle(this float angle, float other, float tolerance) { float num = (other - angle) % 360f; if (num < -180f) { num += 360f; } else if (num > 180f) { num -= 360f; } if (0f - tolerance <= num) { return num <= tolerance; } return false; } public static bool IsNearAngle(this Vector2 v, float other, float tolerance) { //IL_0001: 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) float num = (other - Mathf.Atan2(v.y, v.x) * 57.29578f) % 360f; if (num < -180f) { num += 360f; } else if (num > 180f) { num -= 360f; } if (0f - tolerance <= num) { return num <= tolerance; } return false; } public static float DirToNearestPlayer(this Bullet self) { //IL_0006: 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) //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_0027: Unknown result type (might be due to invalid IL or missing references) Vector2 val = ((GameActor)GameManager.Instance.GetPlayerClosestToPoint(self.Position)).CenterPosition - self.Position; return Mathf.Atan2(val.y, val.x) * 57.29578f; } public static Vector2 RealVelocity(this Bullet self) { //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) return self.Speed / 64f * self.Direction.ToVector(); } public static Quaternion EulerZ(this float self) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return Quaternion.Euler(0f, 0f, self); } public static Quaternion EulerZ(this Vector2 self) { //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_0021: Unknown result type (might be due to invalid IL or missing references) return Quaternion.Euler(0f, 0f, Mathf.Atan2(self.y, self.x) * 57.29578f); } public static Gun LoopAnimation(this Gun gun, string animationName, int loopStart = 0) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) ((Component)gun).GetComponent().GetClipByName(animationName).wrapMode = (WrapMode)1; ((Component)gun).GetComponent().GetClipByName(animationName).loopStart = loopStart; return gun; } public static Projectile SetHorizontalImpactVFX(this Projectile p, VFXPool vfx) { p.hitEffects.tileMapHorizontal = vfx; p.hitEffects.deathTileMapHorizontal = vfx; return p; } public static void SetHorizontalImpactVFX(this Gun gun, VFXPool vfx) { foreach (ProjectileModule projectile in gun.Volley.projectiles) { foreach (Projectile projectile2 in projectile.projectiles) { projectile2.SetHorizontalImpactVFX(vfx); } } } public static Projectile SetVerticalImpactVFX(this Projectile p, VFXPool vfx) { p.hitEffects.tileMapVertical = vfx; p.hitEffects.deathTileMapVertical = vfx; return p; } public static void SetVerticalImpactVFX(this Gun gun, VFXPool vfx) { foreach (ProjectileModule projectile in gun.Volley.projectiles) { foreach (Projectile projectile2 in projectile.projectiles) { projectile2.SetVerticalImpactVFX(vfx); } } } public static Projectile SetEnemyImpactVFX(this Projectile p, VFXPool vfx) { p.hitEffects.enemy = vfx; p.hitEffects.deathEnemy = vfx; return p; } public static void SetEnemyImpactVFX(this Gun gun, VFXPool vfx) { foreach (ProjectileModule projectile in gun.Volley.projectiles) { foreach (Projectile projectile2 in projectile.projectiles) { projectile2.SetEnemyImpactVFX(vfx); } } } public static Projectile SetAirImpactVFX(this Projectile p, GameObject vfx, bool alwaysUseMidair = false) { p.hitEffects.suppressMidairDeathVfx = false; p.hitEffects.overrideMidairDeathVFX = vfx; p.hitEffects.alwaysUseMidair = alwaysUseMidair; return p; } public static Projectile SetAirImpactVFX(this Projectile p, VFXPool vfx, bool alwaysUseMidair = false) { p.hitEffects.suppressMidairDeathVfx = false; p.hitEffects.overrideMidairDeathVFX = vfx.effects[0].effects[0].effect; p.hitEffects.alwaysUseMidair = alwaysUseMidair; return p; } public static void SetAirImpactVFX(this Gun gun, VFXPool vfx) { foreach (ProjectileModule projectile in gun.Volley.projectiles) { foreach (Projectile projectile2 in projectile.projectiles) { projectile2.SetAirImpactVFX(vfx); } } } public static Projectile SetAllImpactVFX(this Projectile p, VFXPool vfx) { p.SetHorizontalImpactVFX(vfx); p.SetVerticalImpactVFX(vfx); p.SetEnemyImpactVFX(vfx); p.SetAirImpactVFX(vfx); return p; } public static void SetAllImpactVFX(this Gun gun, VFXPool vfx) { foreach (ProjectileModule projectile in gun.Volley.projectiles) { foreach (Projectile projectile2 in projectile.projectiles) { projectile2.SetAllImpactVFX(vfx); } } } public static Projectile ClearAllImpactVFX(this Projectile p) { //IL_0030: 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) p.hitEffects.alwaysUseMidair = true; p.hitEffects.suppressMidairDeathVfx = true; p.hitEffects.HasProjectileDeathVFX = false; p.hitEffects.tileMapHorizontal.type = (VFXPoolType)0; p.hitEffects.tileMapVertical.type = (VFXPoolType)0; p.hitEffects.overrideEarlyDeathVfx = null; p.hitEffects.enemy = null; p.hitEffects.deathEnemy = null; p.hitEffects.deathAny = null; p.hitEffects.tileMapHorizontal.effects = null; p.hitEffects.tileMapVertical.effects = null; return p; } public static void ClearAllImpactVFX(this Gun gun) { foreach (ProjectileModule projectile in gun.Volley.projectiles) { foreach (Projectile projectile2 in projectile.projectiles) { projectile2.ClearAllImpactVFX(); } } } public static Projectile CopyAllImpactVFX(this Projectile p, Projectile otherP) { //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: Expected O, but got Unknown //IL_000d: Expected O, but got Unknown ProjectileImpactVFXPool val = new ProjectileImpactVFXPool(); ProjectileImpactVFXPool val2 = val; p.hitEffects = val; ProjectileImpactVFXPool hitEffects = otherP.hitEffects; val2.alwaysUseMidair = hitEffects.alwaysUseMidair; val2.tileMapHorizontal = hitEffects.tileMapHorizontal; val2.deathTileMapHorizontal = hitEffects.deathTileMapHorizontal; val2.tileMapVertical = hitEffects.tileMapVertical; val2.deathTileMapVertical = hitEffects.deathTileMapVertical; val2.enemy = hitEffects.enemy; val2.deathEnemy = hitEffects.deathEnemy; val2.suppressMidairDeathVfx = hitEffects.suppressMidairDeathVfx; val2.overrideMidairDeathVFX = hitEffects.overrideMidairDeathVFX; val2.midairInheritsRotation = hitEffects.midairInheritsRotation; val2.midairInheritsVelocity = hitEffects.midairInheritsVelocity; val2.midairInheritsFlip = hitEffects.midairInheritsFlip; val2.overrideMidairZHeight = hitEffects.overrideMidairZHeight; val2.overrideEarlyDeathVfx = hitEffects.overrideEarlyDeathVfx; val2.HasProjectileDeathVFX = hitEffects.HasProjectileDeathVFX; val2.CenterDeathVFXOnProjectile = hitEffects.CenterDeathVFXOnProjectile; val2.suppressHitEffectsIfOffscreen = hitEffects.suppressHitEffectsIfOffscreen; return p; } public static Projectile CopyAllImpactVFX(this Projectile p, Items other) { PickupObject obj = ItemHelper.Get(other); p.CopyAllImpactVFX(((Gun)((obj is Gun) ? obj : null)).DefaultModule.projectiles[0]); return p; } public static bool IsHostile(this AIActor e, bool canBeDead = false, bool canBeNeutral = false) { if (!Object.op_Implicit((Object)(object)e) || !((Behaviour)e).isActiveAndEnabled) { return false; } HealthHaver healthHaver = ((BraveBehaviour)e).healthHaver; if (Object.op_Implicit((Object)(object)e) && !((GameActor)e).IsGone && e.IsNormalEnemy && e.IsWorthShootingAt && (canBeNeutral || !e.IsHarmlessEnemy) && Object.op_Implicit((Object)(object)healthHaver) && (canBeDead || healthHaver.IsAlive)) { return !healthHaver.isPlayerCharacter; } return false; } public static bool IsHostileAndNotABoss(this AIActor e, bool canBeDead = false, bool canBeNeutral = false) { if (!Object.op_Implicit((Object)(object)e) || !((Behaviour)e).isActiveAndEnabled) { return false; } HealthHaver healthHaver = ((BraveBehaviour)e).healthHaver; if (Object.op_Implicit((Object)(object)e) && !((GameActor)e).IsGone && e.IsNormalEnemy && e.IsWorthShootingAt && (canBeNeutral || !e.IsHarmlessEnemy) && Object.op_Implicit((Object)(object)healthHaver) && !healthHaver.IsBoss && !healthHaver.IsSubboss && (canBeDead || healthHaver.IsAlive)) { return !healthHaver.isPlayerCharacter; } return false; } public static bool IsABoss(this AIActor e, bool canBeDead = false) { if (!Object.op_Implicit((Object)(object)e) || !((Behaviour)e).isActiveAndEnabled) { return false; } HealthHaver healthHaver = ((BraveBehaviour)e).healthHaver; if (Object.op_Implicit((Object)(object)healthHaver) && (healthHaver.IsBoss || healthHaver.IsSubboss)) { if (!canBeDead) { return healthHaver.IsAlive; } return true; } return false; } public static void SetAlpha(this GameObject g, float a) { if (Object.op_Implicit((Object)(object)g)) { g.GetComponent()?.SetAlpha(a); } } public static void SetAlpha(this Component c, float a) { if (Object.op_Implicit((Object)(object)c) && Object.op_Implicit((Object)(object)c.gameObject)) { c.gameObject.GetComponent()?.SetAlpha(a); } } public static void SetAlphaImmediate(this GameObject g, float a) { if (!Object.op_Implicit((Object)(object)g)) { return; } Renderer component = g.GetComponent(); if (component != null) { component.SetAlpha(a); tk2dSpriteAnimator component2 = g.GetComponent(); if (component2 != null) { component2.LateUpdate(); } } } public static void SetAlphaImmediate(this Component c, float a) { if (!Object.op_Implicit((Object)(object)c) || !Object.op_Implicit((Object)(object)c.gameObject)) { return; } Renderer component = c.gameObject.GetComponent(); if (component != null) { component.SetAlpha(a); tk2dSpriteAnimator component2 = c.gameObject.GetComponent(); if (component2 != null) { component2.LateUpdate(); } } } public static void SetGlowiness(this GameObject g, float a) { g.GetComponent()?.SetGlowiness(a); } public static void SetGlowiness(this tk2dBaseSprite sprite, float glowAmount, Color? glowColor = null, Color? overrideColor = null, bool? clampBrightness = null, float? glowColorPower = null) { //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) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00cc: Unknown result type (might be due to invalid IL or missing references) sprite.usesOverrideMaterial = true; Material material = ((BraveBehaviour)sprite).renderer.material; if (glowColor.HasValue) { Color valueOrDefault = glowColor.GetValueOrDefault(); material.shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTiltedCutoutEmissive"); material.SetFloat(CwaffVFX._EmissiveColorPowerId, glowColorPower ?? 1.55f); material.SetColor(CwaffVFX._EmissiveColorId, valueOrDefault); } else { material.shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTintableTiltedCutoutEmissive"); } if (clampBrightness.HasValue) { if (!clampBrightness.Value) { material.DisableKeyword("BRIGHTNESS_CLAMP_ON"); material.EnableKeyword("BRIGHTNESS_CLAMP_OFF"); } else { material.DisableKeyword("BRIGHTNESS_CLAMP_OFF"); material.EnableKeyword("BRIGHTNESS_CLAMP_ON"); } } material.SetFloat(CwaffVFX._EmissivePowerId, glowAmount); if (overrideColor.HasValue) { Color valueOrDefault2 = overrideColor.GetValueOrDefault(); material.SetColor(CwaffVFX._OverrideColorId, valueOrDefault2); } } public static void MakeGlowyBetter(this tk2dBaseSprite sprite, float? glowAmount = null, Color? glowColor = null, float? glowColorPower = null, float sensitivity = 0.5f, Color? overrideColor = null, bool skipSetup = false) { Material material = ((BraveBehaviour)sprite).renderer.material; if (!skipSetup) { sprite.usesOverrideMaterial = true; } material.MakeGlowyBetter(glowAmount, glowColor, glowColorPower, sensitivity, overrideColor, skipSetup); } public static void MakeGlowyBetter(this Material newMat, float? glowAmount = null, Color? glowColor = null, float? glowColorPower = null, float sensitivity = 0.5f, Color? overrideColor = null, bool skipSetup = false) { //IL_0103: 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) if (!skipSetup) { newMat.shader = ShaderCache.Acquire("Brave/LitCutoutUber_ColorEmissive"); newMat.DisableKeyword("BRIGHTNESS_CLAMP_OFF"); newMat.EnableKeyword("BRIGHTNESS_CLAMP_ON"); newMat.DisableKeyword("EMISSIVE_OFF"); newMat.EnableKeyword("EMISSIVE_ON"); newMat.DisableKeyword("TINTING_OFF"); newMat.EnableKeyword("TINTING_ON"); newMat.DisableKeyword("PALETTE_ON"); newMat.EnableKeyword("PALETTE_OFF"); newMat.SetFloat(CwaffVFX._PerpendicularId, 1f); newMat.SetFloat(CwaffVFX._CutoffId, 0.5f); newMat.SetFloat(CwaffVFX._ValueMinId, 0.7f); newMat.SetFloat(CwaffVFX._ValueMaxId, 0.97f); } newMat.SetFloat(CwaffVFX._SensitivityId, sensitivity); if (glowAmount.HasValue) { newMat.SetFloat(CwaffVFX._EmissivePowerId, glowAmount.Value); } if (glowColorPower.HasValue) { newMat.SetFloat(CwaffVFX._EmissiveColorPowerId, glowColorPower.Value); } if (glowColor.HasValue) { newMat.SetColor(CwaffVFX._EmissiveColorId, glowColor.Value); } if (overrideColor.HasValue) { newMat.SetColor(CwaffVFX._OverrideColorId, overrideColor.Value); } } public static float AddRandomSpread(this float angle, float spread) { return angle + (Lazy.CoinFlip() ? 1f : (-1f)) * spread * Random.value; } public static IEnumerable AllItems(this PlayerController player) { if (!Object.op_Implicit((Object)(object)player)) { yield break; } foreach (PassiveItem passiveItem in player.passiveItems) { yield return (PickupObject)(object)passiveItem; } foreach (PlayerItem activeItem in player.activeItems) { yield return (PickupObject)(object)activeItem; } foreach (Gun allGun in player.inventory.AllGuns) { yield return (PickupObject)(object)allGun; } } public static bool HasPassive(this PlayerController p) where T : PassiveItem { for (int i = 0; i < p.passiveItems.Count; i++) { if (p.passiveItems[i] is T) { return true; } } return false; } public static bool HasPassive(this PlayerController p, int id) { for (int i = 0; i < p.passiveItems.Count; i++) { if (((PickupObject)p.passiveItems[i]).PickupObjectId == id) { return true; } } return false; } public static bool HasActive(this PlayerController p) where T : PlayerItem { for (int i = 0; i < p.activeItems.Count; i++) { if (p.activeItems[i] is T) { return true; } } return false; } public static bool HasActive(this PlayerController p, int id) { for (int i = 0; i < p.activeItems.Count; i++) { if (((PickupObject)p.activeItems[i]).PickupObjectId == id) { return true; } } return false; } public static bool HasGun(this PlayerController p) where T : Gun { for (int i = 0; i < p.inventory.AllGuns.Count; i++) { if (p.inventory.AllGuns[i] is T) { return true; } } return false; } public static bool HasGun(this PlayerController p, int id) { for (int i = 0; i < p.inventory.AllGuns.Count; i++) { if (((PickupObject)p.inventory.AllGuns[i]).PickupObjectId == id) { return true; } } return false; } public static T GetPassive(this PlayerController p) where T : PassiveItem { for (int i = 0; i < p.passiveItems.Count; i++) { PassiveItem obj = p.passiveItems[i]; T val = (T)(object)((obj is T) ? obj : null); if (val != null) { return val; } } return default(T); } public static PassiveItem GetPassive(this PlayerController p, int id) { for (int i = 0; i < p.passiveItems.Count; i++) { if (((PickupObject)p.passiveItems[i]).PickupObjectId == id) { return p.passiveItems[i]; } } return null; } public static T GetActive(this PlayerController p) where T : PlayerItem { for (int i = 0; i < p.activeItems.Count; i++) { PlayerItem obj = p.activeItems[i]; T val = (T)(object)((obj is T) ? obj : null); if (val != null) { return val; } } return default(T); } public static PlayerItem GetActive(this PlayerController p, int id) { for (int i = 0; i < p.activeItems.Count; i++) { if (((PickupObject)p.activeItems[i]).PickupObjectId == id) { return p.activeItems[i]; } } return null; } public static T GetGun(this PlayerController p) where T : GunBehaviour { for (int i = 0; i < p.inventory.AllGuns.Count; i++) { T component = ((Component)p.inventory.AllGuns[i]).gameObject.GetComponent(); if (component != null) { return component; } } return default(T); } public static Gun GetGun(this PlayerController p, int id) { for (int i = 0; i < p.inventory.AllGuns.Count; i++) { if (((PickupObject)p.inventory.AllGuns[i]).PickupObjectId == id) { return p.inventory.AllGuns[i]; } } return null; } public static float Clamp(this float f, float min = 0f, float max = 1f) { if (!(f < min)) { if (!(f > max)) { return f; } return max; } return min; } public static int NumHitsFromDeath(this PlayerController player) { float num = ((BraveBehaviour)player).healthHaver.Armor; if (!player.ForceZeroHealthState) { num += 2f * ((BraveBehaviour)player).healthHaver.GetCurrentHealth(); } return Mathf.RoundToInt(num); } public static bool InBossRoom(this PlayerController player) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 return (int)((DungeonPlaceableBehaviour)player).GetAbsoluteParentRoom().area.PrototypeRoomCategory == 3; } public static void Shuffle(this IList ts) { int count = ts.Count; int num = count - 1; for (int i = 0; i < num; i++) { int index = Random.Range(i, count); T value = ts[i]; ts[i] = ts[index]; ts[index] = value; } } public static IEnumerable InRandomOrder(this ReadOnlyCollection self) { int count = self.Count; _Indices.Clear(); for (int i = 0; i < count; i++) { _Indices.Add(i); } _Indices.Shuffle(); foreach (int index in _Indices) { yield return self[index]; } } public static T Advance(this IEnumerator self) { if (!self.MoveNext()) { return default(T); } return self.Current; } public static List CopyAndShuffle(this List list) { List list2 = new List(); foreach (T item in list) { list2.Add(item); } list2.Shuffle(); return list2; } public static int QualityGrade(this PickupObject pickup) { //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_0007: 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_0023: Expected I4, but got Unknown ItemQuality quality = pickup.quality; return (quality - 1) switch { 4 => 5, 3 => 4, 2 => 3, 1 => 2, 0 => 1, _ => 0, }; } public static PickupObject HighestQualityItem(this List pickups) where T : PickupObject { if (pickups == null || pickups.Count == 0) { return null; } PickupObject val = (PickupObject)(object)pickups[0]; foreach (T pickup in pickups) { PickupObject val2 = (PickupObject)(object)pickup; if (val2.QualityGrade() > val.QualityGrade()) { val = val2; } } return val; } public static T ChooseRandom(this T[] source) { if (source.Length == 0) { return default(T); } return source[Random.Range(0, source.Length)]; } public static T ChooseRandom(this List source) { if (source == null || source.Count == 0) { return default(T); } return source[Random.Range(0, source.Count)]; } public static T ChooseRandom(this ReadOnlyCollection source) { if (source == null || source.Count == 0) { return default(T); } return source[Random.Range(0, source.Count)]; } public static T ChooseRandom() where T : Enum { Array values = Enum.GetValues(typeof(T)); return (T)values.GetValue(Random.Range(0, values.Length)); } public static bool NewWaveOfEnemiesIsSpawning(this RoomHandler room) { foreach (AIActor item in room.SafeGetEnemiesInRoom()) { if (!((Behaviour)item).isActiveAndEnabled || !((GameActor)item).IsValid || !item.HasBeenAwoken) { return true; } } return false; } public static bool HasLineOfSight(this Vector2 start, Vector2 target) { //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_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) Vector2 val = target - start; RaycastResult val2 = default(RaycastResult); bool num = PhysicsEngine.Instance.Raycast(start, val, ((Vector2)(ref val)).magnitude, ref val2, true, false, int.MaxValue, (CollisionLayer?)null, false, (Func)null, (SpeculativeRigidbody)null); RaycastResult.Pool.Free(ref val2); return !num; } public static Gun ClearDefaultAudio(this Gun gun) { gun.gunSwitchGroup = Items.Banana.AsGun().gunSwitchGroup; gun.PreventNormalFireAudio = true; gun.OverrideNormalFireAudioEvent = ""; return gun; } public static Gun SetGunAudio(this Gun gun, string name = null, string audio = "", int frame = 0) { tk2dSpriteAnimationFrame obj = ((BraveBehaviour)gun).spriteAnimator.GetClipByName(name).frames[frame]; obj.triggerEvent = !string.IsNullOrEmpty(audio); obj.eventAudio = audio; return gun; } public static Gun SetGunAudio(this Gun gun, string name = null, string audio = "", params int[] frames) { foreach (int frame in frames) { gun.SetGunAudio(name, audio, frame); } return gun; } public static Gun SetFireAudio(this Gun gun, string audio = "", int frame = 0) { return gun.SetGunAudio(gun.shootAnimation, audio, frame); } public static Gun SetFireAudio(this Gun gun, string audio = "", params int[] frames) { foreach (int frame in frames) { gun.SetFireAudio(audio, frame); } return gun; } public static Gun SetReloadAudio(this Gun gun, string audio = "", int frame = 0) { return gun.SetGunAudio(gun.reloadAnimation, audio, frame); } public static Gun SetReloadAudio(this Gun gun, string audio = "", params int[] frames) { foreach (int frame in frames) { gun.SetGunAudio(gun.reloadAnimation, audio, frame); } return gun; } public static Gun SetChargeAudio(this Gun gun, string audio = "", int frame = 0) { return gun.SetGunAudio(gun.chargeAnimation, audio, frame); } public static Gun SetChargeAudio(this Gun gun, string audio = "", params int[] frames) { foreach (int frame in frames) { gun.SetGunAudio(gun.chargeAnimation, audio, frame); } return gun; } public static Gun SetIdleAudio(this Gun gun, string audio = "", int frame = 0) { return gun.SetGunAudio(gun.idleAnimation, audio, frame); } public static Gun SetIdleAudio(this Gun gun, string audio = "", params int[] frames) { foreach (int frame in frames) { gun.SetGunAudio(gun.idleAnimation, audio, frame); } return gun; } public static Gun SetMuzzleVFX(this Gun gun, string resPath = null, float fps = 60f, bool loops = false, float scale = 1f, Anchor anchor = (Anchor)3, bool orphaned = false, float emissivePower = -1f, float emissiveColorPower = -1f, Color? emissiveColor = null, bool continuous = false, bool unlit = true, float lightStrength = 0f, float lightRange = 0f, Color? lightColor = null, float emissiveSensitivity = 0.5f) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(resPath)) { gun.muzzleFlashEffects = null; return gun; } bool orphaned2 = orphaned; bool unlit2 = unlit; gun.muzzleFlashEffects = VFX.CreatePool(resPath, fps, loops, -1, scale, anchor, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)0, emissivePower, emissiveColor, orphaned2, attached: true, unlit2, lightStrength, lightRange, lightColor, emissiveColorPower, 0f, emissiveSensitivity); gun.usesContinuousMuzzleFlash = continuous; return gun; } public static Gun SetMuzzleVFX(this Gun gun, Items gunToCopyFrom, bool onlyCopyBasicEffects = true) { Gun val = gunToCopyFrom.AsGun(); if (!Object.op_Implicit((Object)(object)val)) { return gun; } gun.muzzleFlashEffects = val.muzzleFlashEffects; if (onlyCopyBasicEffects) { return gun; } gun.usesContinuousMuzzleFlash = val.usesContinuousMuzzleFlash; gun.finalMuzzleFlashEffects = val.finalMuzzleFlashEffects; gun.CriticalMuzzleFlashEffects = val.CriticalMuzzleFlashEffects; return gun; } public static Gun SetMuzzleVFX(this Gun gun, VFXPool muzzleVFX) { gun.muzzleFlashEffects = muzzleVFX; return gun; } public static Gun SetCasing(this Gun gun, Items otherGun) { gun.shellCasing = otherGun.AsGun().shellCasing; return gun; } public static Rect GetRoomPixelBorder(this RoomHandler room) { //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_003b: 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_005e: Unknown result type (might be due to invalid IL or missing references) Rect boundingRect = room.GetBoundingRect(); return Inset(new Rect(16f * ((Rect)(ref boundingRect)).xMin, 16f * ((Rect)(ref boundingRect)).yMin, 16f * ((Rect)(ref boundingRect)).width, 16f * ((Rect)(ref boundingRect)).height), 1f, 1f, 8f, 1f).Inset(8f); } public static bool FullyWithinRoom(this PlayerController pc, RoomHandler room = null) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) return ((BraveBehaviour)pc).specRigidbody.PixelColliders[0].FullyWithin((room ?? pc.CurrentRoom).GetRoomPixelBorder()); } public static bool ForceConstrainToRoom(this PlayerController pc, RoomHandler room) { //IL_0006: 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_0024: 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) //IL_0037: 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_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) //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_008a: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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) //IL_00b3: 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_00dd: 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_00e4: 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) //IL_00ec: 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_0108: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_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) _ = ((BraveBehaviour)pc).specRigidbody.Position; PixelCollider val = ((BraveBehaviour)pc).specRigidbody.PixelColliders[0]; Rect roomPixelBorder = room.GetRoomPixelBorder(); bool flag = false; Vector2 val2 = Vector3Extensions.XY(((BraveBehaviour)pc).transform.position); if ((float)val.MinX < ((Rect)(ref roomPixelBorder)).xMin) { IntVector2 val3 = new IntVector2(1, 0) * (int)(((Rect)(ref roomPixelBorder)).xMin - (float)val.MinX); val2 += PhysicsEngine.PixelToUnit(val3); flag = true; } else if ((float)val.MaxX > ((Rect)(ref roomPixelBorder)).xMax) { IntVector2 val4 = new IntVector2(1, 0) * (int)(((Rect)(ref roomPixelBorder)).xMax - (float)val.MaxX); val2 += PhysicsEngine.PixelToUnit(val4); flag = true; } if ((float)val.MinY < ((Rect)(ref roomPixelBorder)).yMin) { IntVector2 val5 = new IntVector2(0, 1) * (int)(((Rect)(ref roomPixelBorder)).yMin - (float)val.MinY); val2 += PhysicsEngine.PixelToUnit(val5); flag = true; } else if ((float)val.MaxY > ((Rect)(ref roomPixelBorder)).yMax) { IntVector2 val6 = new IntVector2(0, 1) * (int)(((Rect)(ref roomPixelBorder)).yMax - (float)val.MaxY); val2 += PhysicsEngine.PixelToUnit(val6); flag = true; } if (flag) { ((BraveBehaviour)pc).transform.position = Vector2.op_Implicit(val2); ((BraveBehaviour)pc).specRigidbody.Reinitialize(); } return flag; } public static bool FullyWithin(this PixelCollider self, Rect other) { //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_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) //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) float num = self.MinX; float num2 = self.MinY; IntVector2 dimensions = self.Dimensions; float num3 = ((IntVector2)(ref dimensions)).X; dimensions = self.Dimensions; return Extensions.FullyWithin(new Rect(num, num2, num3, (float)((IntVector2)(ref dimensions)).Y), other); } public static bool FullyWithin(this Rect self, Rect other) { bool num = ((Rect)(ref self)).xMin > ((Rect)(ref other)).xMin && ((Rect)(ref self)).xMax < ((Rect)(ref other)).xMax; bool flag = ((Rect)(ref self)).yMin > ((Rect)(ref other)).yMin && ((Rect)(ref self)).yMax < ((Rect)(ref other)).yMax; return num && flag; } public static Gun SetAttributes(this Gun gun, ItemQuality quality, GunClass gunClass, float reloadTime, int ammo, Items audioFrom = Items.Banana, bool defaultAudio = false, bool infiniteAmmo = false, bool canGainAmmo = true, bool canReloadNoMatterAmmo = false, bool? doesScreenShake = null, int? idleFps = null, int? shootFps = null, int? reloadFps = null, int? chargeFps = null, int? introFps = null, string fireAudio = null, string reloadAudio = null, string introAudio = null, int loopChargeAt = -1, int loopReloadAt = -1, int loopFireAt = -1, Items? muzzleFrom = null, bool modulesAreTiers = false, string muzzleVFX = null, int muzzleFps = 60, float muzzleScale = 1f, Anchor muzzleAnchor = (Anchor)3, float muzzleEmission = -1f, Color? muzzleEmissionColor = null, float muzzleEmissionColorPower = -1f, bool muzzleLit = false, float muzzleLightStrength = 0f, float muzzleLightRange = 0f, Color? muzzleLightColor = null, IntVector2? carryOffset = null, bool preventRotation = false, float curse = 0f, bool continuousFire = false, bool dynamicBarrelOffsets = false, bool banFromBlessedRuns = false, bool rampUpFireRate = false, float rampUpFactor = 0f, bool suppressReloadAnim = false, GunHandedness handedness = (GunHandedness)0, bool autoPlay = true, bool attacksThroughWalls = false, bool suppressReloadLabel = false, float percentSpeedWhileCharging = 1f, bool onlyUsesIdleInWeaponBox = false, bool continuousFireAnimation = false, bool preventRollingWhenCharging = false, float percentSpeedWhileFiring = 1f, float smoothReload = -1f, bool canAttackWhileRolling = false, bool isStarterGun = false, float percentSpeedWhileReloading = 1f, bool preventDuctTape = false, float muzzleEmissionSensitivity = 0.5f, bool preventVolleyModifications = false, bool undroppableStarter = false) { //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_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_0036: 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_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_034b: Unknown result type (might be due to invalid IL or missing references) CwaffGun component = ((Component)gun).gameObject.GetComponent(); ((PickupObject)gun).quality = quality; gun.reloadTime = reloadTime; gun.gunClass = gunClass; gun.SetBaseMaxAmmo(ammo); gun.CurrentAmmo = gun.GetBaseMaxAmmo(); gun.gunHandedness = handedness; gun.preventRotation = preventRotation; gun.gunSwitchGroup = audioFrom.AsGun().gunSwitchGroup; gun.InfiniteAmmo = infiniteAmmo; gun.CanGainAmmo = canGainAmmo; gun.CanReloadNoMatterAmmo = canReloadNoMatterAmmo; gun.Volley.ModulesAreTiers = modulesAreTiers; gun.GainsRateOfFireAsContinueAttack = rampUpFireRate; gun.CanAttackThroughObjects = attacksThroughWalls; gun.OnlyUsesIdleInWeaponBox = onlyUsesIdleInWeaponBox; gun.StarterGunForAchievement = isStarterGun; ((PickupObject)gun).PreventStartingOwnerFromDropping = undroppableStarter; if (rampUpFireRate) { gun.RateOfFireMultiplierAdditionPerSecond = rampUpFactor; } gun.doesScreenShake = doesScreenShake ?? gun.doesScreenShake; ((BraveBehaviour)gun).spriteAnimator.playAutomatically = autoPlay; if (!defaultAudio) { gun.ClearDefaultAudio(); } if (banFromBlessedRuns) { AlexandriaTags.SetTag((PickupObject)(object)gun, "exclude_blessed"); } if (continuousFire) { gun.usesContinuousFireAnimation = true; gun.LoopAnimation(gun.shootAnimation); } if (continuousFireAnimation) { component.continuousFireAnimation = true; } if (smoothReload >= 0f) { component.useSmoothReload = true; component.smoothReloadOffset = smoothReload; } component.canAttackWhileRolling = canAttackWhileRolling; component.preventDuctTape = preventDuctTape; component.preventVolleyModifications = preventVolleyModifications; component.percentSpeedWhileCharging = percentSpeedWhileCharging; component.percentSpeedWhileReloading = percentSpeedWhileReloading; component.percentSpeedWhileFiring = percentSpeedWhileFiring; if (dynamicBarrelOffsets) { CwaffGun.SetUpDynamicBarrelOffsets(gun); } if (suppressReloadLabel) { component.suppressReloadLabel = true; } if (preventRollingWhenCharging) { component.preventRollingWhenCharging = true; } if (curse != 0f) { gun.AddStatToGun(((StatType)14).Add(curse)); } if (carryOffset.HasValue) { gun.carryPixelOffset = carryOffset.Value; } if (idleFps.HasValue) { GunExt.SetAnimationFPS(gun, gun.GetOriginalIdleAnimationName(), idleFps.Value); } if (shootFps.HasValue) { GunExt.SetAnimationFPS(gun, gun.shootAnimation, shootFps.Value); } if (reloadFps.HasValue) { int valueOrDefault = reloadFps.GetValueOrDefault(); if (valueOrDefault == -2) { GunExt.SetAnimationFPS(gun, gun.reloadAnimation, (int)((float)((BraveBehaviour)gun).spriteAnimator.GetClipByName(gun.reloadAnimation).frames.Length / gun.reloadTime)); } else { GunExt.SetAnimationFPS(gun, gun.reloadAnimation, valueOrDefault); } } if (chargeFps.HasValue) { GunExt.SetAnimationFPS(gun, gun.chargeAnimation, chargeFps.Value); } if (introFps.HasValue) { GunExt.SetAnimationFPS(gun, gun.introAnimation, introFps.Value); } if (fireAudio != null) { gun.SetFireAudio(fireAudio); } if (reloadAudio != null) { gun.SetReloadAudio(reloadAudio); } if (introAudio != null) { gun.SetGunAudio(gun.introAnimation, introAudio); } if (loopChargeAt >= 0) { gun.LoopAnimation(gun.chargeAnimation, loopChargeAt); } if (loopReloadAt >= 0) { gun.LoopAnimation(gun.reloadAnimation, loopReloadAt); } if (loopFireAt >= 0) { gun.LoopAnimation(gun.shootAnimation, loopFireAt); } if (muzzleFrom.HasValue) { gun.SetMuzzleVFX(muzzleFrom.Value); } else if (muzzleVFX == null) { gun.SetMuzzleVFX(null, 60f, loops: false, 1f, (Anchor)3); } else { float fps = muzzleFps; Color? emissiveColor = muzzleEmissionColor; gun.SetMuzzleVFX(muzzleVFX, fps, loops: false, muzzleScale, muzzleAnchor, orphaned: false, muzzleEmission, muzzleEmissionColorPower, emissiveColor, continuous: false, !muzzleLit, muzzleLightStrength, muzzleLightRange, muzzleLightColor, muzzleEmissionSensitivity); } if (suppressReloadAnim) { gun.SuppressReloadAnimations(); } return gun; } public static Projectile AttachTrail(this Projectile target, string spriteName, int fps = -1, string startAnim = null, float timeTillAnimStart = -1f, float cascadeTimer = -1f, float softMaxLength = -1f, bool destroyOnEmpty = false, GameObject dispersalPrefab = null, Vector2? boneSpawnOffset = null, float? emissivePower = null, float? emissiveColorPower = null, Color? emissiveColor = null) { //IL_008d: 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_0092: Unknown result type (might be due to invalid IL or missing references) CwaffTrailController cwaffTrailController = VFX.CreateSpriteTrailObject(spriteName, fps, startAnim, timeTillAnimStart, cascadeTimer, softMaxLength, destroyOnEmpty, dispersalPrefab); ((Component)cwaffTrailController).gameObject.SetActive(true); ((Component)cwaffTrailController).gameObject.transform.parent = ((BraveBehaviour)target).transform; if (emissivePower.HasValue || emissiveColorPower.HasValue || emissiveColor.HasValue) { tk2dBaseSprite component = ((Component)cwaffTrailController).gameObject.GetComponent(); float? glowAmount = emissivePower; float? glowColorPower = emissiveColorPower; component.MakeGlowyBetter(glowAmount, emissiveColor, glowColorPower); } cwaffTrailController.boneSpawnOffset = (Vector2)(((??)boneSpawnOffset) ?? Vector2.zero); return target; } public static CwaffTrailController AddTrail(this BraveBehaviour target, CwaffTrailController trail) { GameObject obj = Object.Instantiate(((Component)trail).gameObject); obj.transform.parent = target.transform; return obj.GetComponent(); } public static void SetRotation(this Projectile p, float angle) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) p.m_transform.eulerAngles = new Vector3(0f, 0f, angle); } public static tk2dSpriteAnimationClip SetUpAnimation(this tk2dBaseSprite sprite, string animationName, float fps, WrapMode wrapMode = (WrapMode)2, bool copyMaterialSettings = false) { //IL_0025: 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) tk2dSpriteCollectionData collection = sprite.collection; tk2dSpriteDefinition val = collection.spriteDefinitions[sprite.spriteId]; tk2dSpriteAnimator spriteAnimator = ((BraveBehaviour)sprite).spriteAnimator; List list = AtlasHelper.AddSpritesToCollection(ResMap.Get(animationName), collection).AsRange(); if (copyMaterialSettings) { Material material = val.material; foreach (int item in list) { collection.spriteDefinitions[item].CopyMaterialProps(material); } } return SpriteBuilder.AddAnimation(spriteAnimator, collection, list, animationName, wrapMode, fps); } public static void AddSpecialAnimation(this AIActor actor, string spriteBaseName, string animName, float fps, bool loop = true, bool copyMaterialSettings = true, IntVector2 pixelOffset = default(IntVector2)) { //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_0027: 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_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_0100: 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_0103: Invalid comparison between Unknown and I4 //IL_00a5: 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_00af: 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_0116: 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_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_012e: Expected O, but got Unknown //IL_0130: Expected O, but got Unknown //IL_00bf: 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_00d6: Unknown result type (might be due to invalid IL or missing references) tk2dBaseSprite sprite = ((BraveBehaviour)actor).sprite; DirectionType val = Lazy.AutoDetectDirectionFromSpriteName(spriteBaseName); if ((int)val == 0) { Lazy.RuntimeWarn("failed to get animations for " + spriteBaseName); return; } SingleAnimation[] array = DirectionalAnimation.m_combined[val]; int num = array.Length; string[] array2 = new string[num]; _ = sprite.collection; AIAnimator aiAnimator = ((BraveBehaviour)sprite).aiAnimator; if (aiAnimator.OtherAnimations == null) { aiAnimator.OtherAnimations = new List(); } for (int i = 0; i < num; i++) { string animationName = (string.IsNullOrEmpty(array[i].suffix) ? spriteBaseName : (spriteBaseName + "_" + array[i].suffix)); tk2dSpriteAnimationClip val2 = sprite.SetUpAnimation(animationName, fps, (WrapMode)0, copyMaterialSettings); array2[i] = val2.name; if (pixelOffset != default(IntVector2)) { val2.OffsetAllFrames(new Vector2(0.0625f * (float)pixelOffset.x, 0.0625f * (float)pixelOffset.y)); } } NamedDirectionalAnimation item = new NamedDirectionalAnimation { name = animName, anim = new DirectionalAnimation { Prefix = (((int)val == 1) ? spriteBaseName : animName), AnimNames = array2, Type = val, Flipped = (FlipType[])(object)new FlipType[num] } }; ((BraveBehaviour)sprite).aiAnimator.OtherAnimations.Add(item); } public static void PlaceAtScaledPositionByAnchor(this tk2dBaseSprite sprite, Vector3 position, Anchor anchor) { //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_0010: 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_0018: 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_0028: 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_0040: 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_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 = Vector3Extensions.XY(((BraveBehaviour)sprite).transform.localScale); Vector2 relativePositionFromAnchor = sprite.GetRelativePositionFromAnchor(anchor); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(val.x * relativePositionFromAnchor.x, val.y * relativePositionFromAnchor.y); ((BraveBehaviour)sprite).transform.position = position - Vector2Extensions.ToVector3ZUp(val2, 0f); } public static void PlaceAtRotatedPositionByAnchor(this tk2dBaseSprite sprite, Vector3 position, Anchor anchor) { //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_0010: 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_0018: 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_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_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_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_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_0052: 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_005a: 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_0065: Unknown result type (might be due to invalid IL or missing references) Vector2 val = Vector3Extensions.XY(((BraveBehaviour)sprite).transform.localScale); Vector2 relativePositionFromAnchor = sprite.GetRelativePositionFromAnchor(anchor); Vector2 val2 = Vector2.op_Implicit(((BraveBehaviour)sprite).transform.rotation * Vector2.op_Implicit(new Vector2(val.x * relativePositionFromAnchor.x, val.y * relativePositionFromAnchor.y))); ((BraveBehaviour)sprite).transform.position = position - Vector2Extensions.ToVector3ZUp(val2, 0f); } public static T Pop(this List items) { T result = items[items.Count - 1]; items.RemoveAt(items.Count - 1); return result; } public static void FullyRefreshBehaviors(this BehaviorSpeculator self) { self.m_behaviors.Clear(); self.RefreshBehaviors(); } public static ProjectileModule SetupCustomAmmoClip(this ProjectileModule mod, GunData b) { mod.SetupCustomAmmoClip(((PickupObject)b.gun).EncounterNameOrDisplayName.InternalName()); return mod; } public static ProjectileModule SetupCustomAmmoClip(this ProjectileModule mod, string clipname) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) mod.ammoType = (AmmoType)14; mod.customAmmoType = Lazy.SetupCustomAmmoClip(clipname); return mod; } public static bool PlayerWillDieFromHit(this HealthHaver hh, ModifyDamageEventArgs data) { if ((object)data == EventArgs.Empty || data.ModifiedDamage <= 0f || !hh.IsVulnerable) { return false; } if (hh.Armor > 1f || hh.GetCurrentHealth() > data.ModifiedDamage) { return false; } if (hh.Armor == 1f && hh.GetCurrentHealth() > 0f) { return false; } return true; } public static void RemoveShader(this GameObject g, Shader shader) { if (!Object.op_Implicit((Object)(object)g)) { return; } MeshRenderer component = g.GetComponent(); if (component == null) { return; } Material[] sharedMaterials = ((Renderer)component).sharedMaterials; List list = new List(); for (int i = 0; i < sharedMaterials.Length; i++) { if ((Object)(object)sharedMaterials[i].shader != (Object)(object)shader) { list.Add(sharedMaterials[i]); } } ((Renderer)component).sharedMaterials = list.ToArray(); } public static Material GetOrAddShader(this GameObject g, Shader shader, bool atBeginning = true) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)g)) { MeshRenderer component = g.GetComponent(); if (component != null) { Material[] array = ((Renderer)component).sharedMaterials; for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i].shader == (Object)(object)shader) { return array[i]; } } Array.Resize(ref array, array.Length + 1); Material val = new Material(shader); val.SetTexture("_MainTex", array[0].GetTexture("_MainTex")); if (atBeginning) { for (int num = array.Length - 1; num > 1; num--) { array[num] = array[num - 1]; } array[1] = val; } else { array[^1] = val; } ((Renderer)component).sharedMaterials = array; return val; } } return null; } public static Material AddShader(this Renderer renderer, Shader shader, bool atBeginning = true) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown Material[] array = renderer.sharedMaterials; Array.Resize(ref array, array.Length + 1); Material val = new Material(shader); val.SetTexture("_MainTex", array[0].GetTexture("_MainTex")); if (atBeginning) { for (int num = array.Length - 1; num > 1; num--) { array[num] = array[num - 1]; } array[1] = val; } else { array[^1] = val; } renderer.sharedMaterials = array; return val; } public static bool IsPositionElectrified(this DeadlyDeadlyGoopManager goopManager, Vector2 position) { //IL_0000: 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_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_0018: Unknown result type (might be due to invalid IL or missing references) IntVector2 key = Vector2Extensions.ToIntVector2(position / DeadlyDeadlyGoopManager.GOOP_GRID_SIZE, (VectorConversions)0); if (goopManager.m_goopedCells.TryGetValue(key, out var value) && value.remainingLifespan > goopManager.goopDefinition.fadePeriod) { return value.IsElectrified; } return false; } public static IEnumerable EmptyIfNull(this IEnumerable enumerable) { return enumerable ?? Enumerable.Empty(); } public static List GetBarrelOffsetsForAnimation(this Gun gun, string animationName) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) if (_GunCollection == null) { _GunCollection = ((BraveBehaviour)gun).sprite.collection; } tk2dSpriteAnimationClip clipByName = ((Component)gun).GetComponent().GetClipByName(animationName); List list = new List(clipByName.frames.Length); for (int i = 0; i < clipByName.frames.Length; i++) { int index = _GunCollection.SpriteIDsWithAttachPoints.IndexOf(clipByName.frames[i].spriteId); AttachPoint[] attachPoints = _GunCollection.SpriteDefinedAttachPoints[index].attachPoints; foreach (AttachPoint val in attachPoints) { if (val.name == "Casing") { list.Add(val.position); } } } return list; } public static bool FiredForFreeOld(this Projectile proj, Gun gun, ProjectileModule mod) { GameActor owner = proj.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null && val.InfiniteAmmo.Value) { return true; } if (mod.ammoCost != 0 && !gun.InfiniteAmmo) { return gun.LocalInfiniteAmmo; } return true; } public static T AddComponent(this Component component) where T : MonoBehaviour { return component.gameObject.AddComponent(); } public static T GetOrAddComponent(this Component component) where T : MonoBehaviour { GameObject gameObject = component.gameObject; if (gameObject != null) { T component2 = gameObject.GetComponent(); if (component2 != null) { return component2; } return gameObject.AddComponent(); } return default(T); } public static string InternalName(this string s) { return s.Replace("-", "").Replace(".", "").Replace(":", "") .Replace("'", "") .Replace(" ", "_") .ToLower(); } public static string InternalSpriteName(this Gun gun) { return gun.gunName.InternalName(); } public static void RenderInFrontOfPlayer(this Gun gun) { GameActor currentOwner = gun.CurrentOwner; PlayerController val = (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null); if (val != null && (!(val.m_currentGunAngle >= 25f) || !(val.m_currentGunAngle <= 155f))) { gun.GetSprite().HeightOffGround = 0.075f; gun.GetSprite().UpdateZDepth(); } } public static void SetFrame(this Projectile projectile, int frame) { ((BraveBehaviour)projectile).spriteAnimator.deferNextStartClip = true; ((BraveBehaviour)projectile).spriteAnimator.SetFrame(frame); ((BraveBehaviour)projectile).spriteAnimator.Stop(); } public static void SetupDBStrings(this string key, List values) { StringDBTable core = Databases.Strings.Core; foreach (string value in values) { ToolsCharApi.AddComplex(core, key, value); } } public static GenericLootTable ToLootTable(this List ids) { GenericLootTable val = FancyShopBuilder.CreateLootTable(); foreach (int id in ids) { LootUtility.AddItemToPool(val, id, 1f); } return val; } public static List ShiftAll(this IEnumerable vecList, Vector3 shift) { //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_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_0019: Unknown result type (might be due to invalid IL or missing references) List list = new List(); foreach (Vector3 vec in vecList) { list.Add(vec + shift); } return list; } public static CustomShopItemController GetTargetedItemByPlayer(this CustomShopController shop, PlayerController player) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown if ((object)_AlexandriaShopItemBaseShopField == null) { _AlexandriaShopItemBaseShopField = typeof(CustomShopItemController).GetField("m_baseParentShop", BindingFlags.Instance | BindingFlags.NonPublic); } IPlayerInteractable lastInteractionTarget = player.m_lastInteractionTarget; if (lastInteractionTarget == null) { return null; } CustomShopItemController val = (CustomShopItemController)(object)((lastInteractionTarget is CustomShopItemController) ? lastInteractionTarget : null); if (val == null) { return null; } if ((Object)(CustomShopController)_AlexandriaShopItemBaseShopField.GetValue(val) != (Object)(object)shop) { return null; } return val; } public static Vector2 LerpDirectAndNaturalVelocity(this Vector2 position, Vector2 target, Vector2 naturalVelocity, float accel, float lerpFactor) { //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_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_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: 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_0034: Unknown result type (might be due to invalid IL or missing references) Vector2 val = target - position; Vector2 b = naturalVelocity + accel * ((Vector2)(ref val)).normalized; return Lazy.SmoothestLerp((((Vector2)(ref naturalVelocity)).magnitude + accel) * ((Vector2)(ref val)).normalized, b, lerpFactor); } public static IEnumerable DebrisWithinCone(this Vector2 start, float squareReach, float angle, float spread, int limit = -1, bool allowJunk = 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) int total = StaticReferenceManager.AllDebris.Count; if (total == 0) { yield break; } int next = 0; int last = total; if (limit > 0 && limit < total) { next = _nextDebris % total; last = (next + limit) % total; } _ = angle; _ = spread; _ = angle; _ = spread; while (next != last) { if (next == total) { next = 0; if (next == last) { break; } } DebrisObject val = StaticReferenceManager.AllDebris[next]; if (Object.op_Implicit((Object)(object)val) && ((Behaviour)val).isActiveAndEnabled && val.HasBeenTriggered && ((!val.IsPickupObject && (int)((EphemeralObject)val).Priority != 0) || (allowJunk && val.IsPickupObject && ((Component)val).GetComponent().PickupObjectId == 127))) { Vector2 val2 = (Object.op_Implicit((Object)(object)((BraveBehaviour)val).sprite) ? ((BraveBehaviour)val).sprite.WorldCenter : Vector3Extensions.XY(((Component)val).gameObject.transform.position)) - start; if (!(((Vector2)(ref val2)).sqrMagnitude > squareReach) && Vector2Extensions.ToAngle(val2).IsNearAngle(angle, spread)) { yield return val; } } int num = next + 1; next = num; } _nextDebris = last; } public static VFXPool EnemyImpactPool(this Items item, int proj = 0) { return item.AsGun().DefaultModule.projectiles[proj].hitEffects.enemy; } public static VFXPool HorizontalImpactPool(this Items item, int proj = 0) { return item.AsGun().DefaultModule.projectiles[proj].hitEffects.tileMapHorizontal; } public static VFXPool VerticalImpactPool(this Items item, int proj = 0) { return item.AsGun().DefaultModule.projectiles[proj].hitEffects.tileMapVertical; } public static GameObject EnemyImpactVFX(this Items item, int proj = 0) { return item.AsGun().DefaultModule.projectiles[proj].hitEffects.enemy.effects[0].effects[0].effect; } public static GameObject HorizontalImpactVFX(this Items item, int proj = 0) { return item.AsGun().DefaultModule.projectiles[proj].hitEffects.tileMapHorizontal.effects[0].effects[0].effect; } public static GameObject VerticalImpactVFX(this Items item, int proj = 0) { return item.AsGun().DefaultModule.projectiles[proj].hitEffects.tileMapVertical.effects[0].effects[0].effect; } public static GameObject AirImpactVFX(this Items item, int proj = 0) { return item.AsGun().DefaultModule.projectiles[proj].hitEffects.overrideMidairDeathVFX; } public static void SafeDestroy(this GameObject g) { if (Object.op_Implicit((Object)(object)g)) { Object.Destroy((Object)(object)g); } } public static void SafeDestroy(this T c) where T : Component { if (Object.op_Implicit((Object)(object)c)) { Object.Destroy((Object)(object)c); } } public static void SafeDestroyAll(this List objects) { for (int i = 0; i < objects.Count; i++) { objects[i].SafeDestroy(); } objects.Clear(); } public static int WeightedRandom(this List weights) { //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_003e: 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) int num = Random.Range(0, weights.Sum((IntVector2 item) => item.y)); foreach (IntVector2 weight in weights) { if ((num -= weight.y) < 0) { return weight.x; } } return 0; } public static int WeightedRandom(this List weights) { //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_0042: 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) float num = Random.Range(0f, weights.Sum((Vector2 item) => item.y)); foreach (Vector2 weight in weights) { if ((num -= weight.y) < 0f) { return (int)weight.x; } } return 0; } public static T WeightedRandom(this List> weights) { int num = Random.Range(0, weights.Sum((Tuple item) => item.Second)); foreach (Tuple weight in weights) { if ((num -= weight.Second) < 0) { return weight.First; } } return weights[0].First; } public static T SafeFirst(this List c) { if (c != null && c.Count != 0) { return c[0]; } return default(T); } public static Projectile FirstValidChargeProjectile(this ProjectileModule mod) { List chargeProjectiles = mod.chargeProjectiles; if (chargeProjectiles == null) { return null; } foreach (ChargeProjectile item in chargeProjectiles) { Projectile projectile = item.Projectile; if (projectile != null) { return projectile; } } return null; } public static bool InsideWall(this SpeculativeRigidbody body) { return PhysicsEngine.Instance.OverlapCast(body, (List)null, true, false, (int?)null, (int?)null, false, (Vector2?)null, (Func)null, (SpeculativeRigidbody[])null); } public static bool MoveTowardsTargetOrWall(this SpeculativeRigidbody body, Vector2 start, Vector2 target, int steps = 10) { //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_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_000f: 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_001c: 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_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_002d: 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_0066: 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_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) Vector2 val = (target - start) / (float)steps; Vector2 val2 = start; tk2dSprite component = ((Component)body).GetComponent(); for (int i = 0; i < steps; i++) { Vector2 val3 = start + (float)i * val; ((tk2dBaseSprite)component).PlaceAtPositionByAnchor(Vector2.op_Implicit(val3), (Anchor)4); body.Reinitialize(); if (body.InsideWall()) { ((Component)body).gameObject.transform.position = Vector2.op_Implicit(val2); body.Reinitialize(); return false; } val2 = val3; } return true; } public static void ResetStun(this BehaviorSpeculator bs, float duration, bool createVFX = true) { bs.EndStun(); bs.Stun(duration, createVFX); } public static float DamageMult(this PlayerController p) { return p.stats.GetStatValue((StatType)5); } public static float BossDamageMult(this PlayerController p) { return p.stats.GetStatValue((StatType)22); } public static float AccuracyMult(this PlayerController p) { return p.stats.GetStatValue((StatType)2); } public static float ProjSpeedMult(this PlayerController p) { return p.stats.GetStatValue((StatType)6); } public static float KnockbackMult(this PlayerController p) { return p.stats.GetStatValue((StatType)12); } public static float RangeMult(this PlayerController p) { return p.stats.GetStatValue((StatType)26); } public static float ChargeMult(this PlayerController p) { return p.stats.GetStatValue((StatType)25); } public static float FireRateMult(this PlayerController p) { return p.stats.GetStatValue((StatType)1); } public static float ReloadRateMult(this PlayerController p) { return p.stats.GetStatValue((StatType)10); } public static float Curse(this PlayerController p) { return p.stats.GetStatValue((StatType)14); } public static float Coolness(this PlayerController p) { return p.stats.GetStatValue((StatType)4); } public static bool Overlaps(this tk2dBaseSprite a, tk2dBaseSprite b) { //IL_0006: 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_0017: 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_002d: 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_003e: 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_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_005f: Unknown result type (might be due to invalid IL or missing references) return IntVector2.AABBOverlap(Vector2Extensions.ToIntVector2(((BraveBehaviour)a).sprite.WorldBottomLeft, (VectorConversions)2), Vector2Extensions.ToIntVector2(((BraveBehaviour)a).sprite.WorldTopRight - ((BraveBehaviour)a).sprite.WorldBottomLeft, (VectorConversions)2), Vector2Extensions.ToIntVector2(((BraveBehaviour)b).sprite.WorldBottomLeft, (VectorConversions)2), Vector2Extensions.ToIntVector2(((BraveBehaviour)b).sprite.WorldTopRight - ((BraveBehaviour)b).sprite.WorldBottomLeft, (VectorConversions)2)); } public static int RoundWeighted(this float amount) { if (!((double)Random.value <= (double)amount - Math.Truncate(amount))) { return Mathf.FloorToInt(amount); } return Mathf.CeilToInt(amount); } public static BasicBeamController SetupBeamSprites(this Projectile projectile, string spriteName, int fps, int impactFps = -1, int endFps = -1, int startFps = -1, int chargeFps = -1, int dissipateFps = -1, int muzzleFps = -1, bool loopCharge = true) { return projectile.FixedGenerateBeamPrefab(ResMap.Get(spriteName + "_mid"), fps, ResMap.Get(spriteName + "_impact", quietFailure: true), (impactFps > 0) ? impactFps : fps, ResMap.Get(spriteName + "_end", quietFailure: true), (endFps > 0) ? endFps : fps, ResMap.Get(spriteName + "_start", quietFailure: true), (startFps > 0) ? startFps : fps, glows: false, canTelegraph: false, null, -1, null, -1, null, -1, 1f, canDissipate: false, chargeVFXAnimationPaths: ResMap.Get(spriteName + "_charge", quietFailure: true), beamChargeFPS: (chargeFps > 0) ? chargeFps : fps, loopCharge: loopCharge, muzzleVFXAnimationPaths: ResMap.Get(spriteName + "_muzzle", quietFailure: true), beamMuzzleFPS: (muzzleFps > 0) ? muzzleFps : fps, beamDissipateAnimationPaths: ResMap.Get(spriteName + "_dissipate", quietFailure: true), beamDissipateFPS: (dissipateFps > 0) ? dissipateFps : fps); } public static AttachPoint[] AttachPointsForClip(this Gun gun, string clipName, int frame = 0) { if (Lazy._GunSpriteCollection == null) { Lazy._GunSpriteCollection = ((BraveBehaviour)gun).sprite.collection; } tk2dSpriteAnimationClip clipByName = ((Component)gun).GetComponent().GetClipByName(clipName); if (clipByName == null) { return null; } int spriteId = clipByName.frames[frame].spriteId; int index = Lazy._GunSpriteCollection.SpriteIDsWithAttachPoints.IndexOf(spriteId); return Lazy._GunSpriteCollection.SpriteDefinedAttachPoints[index].attachPoints; } public static GameObject Instantiate(this GameObject original, Vector3? position = null, Quaternion? rotation = null, Anchor? anchor = null, bool quantize = true) { //IL_0014: 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_0019: 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_0031: 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_0050: 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_006d: 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) Vector3 val = (Vector3)(((??)position) ?? Vector3.zero); GameObject val2 = Object.Instantiate(original, val, (Quaternion)(((??)rotation) ?? Quaternion.identity)); if (anchor.HasValue) { tk2dBaseSprite component = val2.GetComponent(); if (component != null) { component.PlaceAtPositionByAnchor(val, anchor.Value); if (quantize) { ((BraveBehaviour)component).transform.position = dfVectorExtensions.Quantize(((BraveBehaviour)component).transform.position, 0.0625f); } SpeculativeRigidbody component2 = val2.GetComponent(); if (component2 != null) { component2.Reinitialize(); } } } return val2; } public static void PickFrame(this tk2dSpriteAnimator animator, int frame = -1) { tk2dSpriteAnimationFrame[] frames = (animator.currentClip ?? animator.DefaultClip).frames; animator.playAutomatically = false; animator.SetSprite(frames[0].spriteCollection, frames[(frame >= 0) ? frame : Random.Range(0, frames.Length)].spriteId); animator.Pause(); } public static void PickFrame(this GameObject g, int frame = -1) { g.GetComponent().PickFrame(frame); } public static void PickFrame(this Component c, int frame = -1) { c.GetComponent().PickFrame(frame); } public static void PickFrame(this Projectile p, int frame = -1) { ((BraveBehaviour)p).spriteAnimator.PickFrame(frame); } public static bool Play(this GameObject g, string sound, float soundRate = 0f) { if (soundRate > 0f && !SoundRateData.PlayRateLimited(g, sound, soundRate)) { return false; } AkSoundEngine.PostEvent(sound, g); return true; } public static bool PlayOnce(this GameObject g, string sound, float soundRate = 0f) { if (soundRate > 0f && !SoundRateData.PlayRateLimited(g, sound, soundRate)) { return false; } AkSoundEngine.PostEvent(sound + "_stop", g); AkSoundEngine.PostEvent(sound, g); return true; } public static bool PlayUnique(this GameObject g, string sound, float soundRate = 0f) { if (soundRate > 0f && !SoundRateData.PlayRateLimited(g, sound, soundRate)) { return false; } AkSoundEngine.PostEvent(sound + "_stop_all", g); AkSoundEngine.PostEvent(sound, g); return true; } public static bool Stop(this GameObject g, string sound) { AkSoundEngine.PostEvent(sound + "_stop", g); return true; } public static Vector2 LargerComponent(this Vector2 v) { //IL_0000: 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_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_0018: 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) if (!(Mathf.Abs(v.x) > Mathf.Abs(v.y))) { return Vector2Extensions.WithX(v, 0f); } return Vector2Extensions.WithY(v, 0f); } public static Vector2 SmallerComponent(this Vector2 v) { //IL_0000: 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_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_0018: 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) if (!(Mathf.Abs(v.x) < Mathf.Abs(v.y))) { return Vector2Extensions.WithX(v, 0f); } return Vector2Extensions.WithY(v, 0f); } public static GunType FindGun(this PlayerController p) where GunType : MonoBehaviour { List allGuns = p.inventory.AllGuns; for (int num = allGuns.Count - 1; num >= 0; num--) { GunType component = ((Component)allGuns[num]).gameObject.GetComponent(); if (component != null) { return component; } } return default(GunType); } public static Gun FindBaseGun(this PlayerController p) where GunType : MonoBehaviour { List allGuns = p.inventory.AllGuns; for (int num = allGuns.Count - 1; num >= 0; num--) { if (((Component)allGuns[num]).gameObject.GetComponent() != null) { return allGuns[num]; } } return null; } public static void SetSpeed(this Projectile p, float newSpeed) { p.baseData.speed = newSpeed; p.UpdateSpeed(); } public static void MultiplySpeed(this Projectile p, float factor) { ProjectileData baseData = p.baseData; baseData.speed *= factor; p.UpdateSpeed(); } public static void Accelerate(this Projectile p, float accel) { ProjectileData baseData = p.baseData; baseData.speed += accel * p.LocalDeltaTime; p.UpdateSpeed(); } public static void ApplyFriction(this Projectile p, float friction) { ProjectileData baseData = p.baseData; baseData.speed *= Mathf.Pow(friction, p.LocalDeltaTime * 60f); p.UpdateSpeed(); } public static void SynchronizeReloadAcrossAllModules(this Gun gun) { if (!gun.m_moduleData[gun.DefaultModule].needsReload) { return; } foreach (ProjectileModule projectile in gun.Volley.projectiles) { gun.m_moduleData[projectile].needsReload = true; } } public static Vector2 HoverAt(this Vector2 pos, float amplitude = 1f, float frequency = 6.28f, float offset = 0f, float phase = 0f) { //IL_0000: 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_0020: Unknown result type (might be due to invalid IL or missing references) return new Vector2(pos.x, pos.y + offset + amplitude * Mathf.Sin(phase + frequency * BraveTime.ScaledTimeSinceStartup)); } public static Vector3 HoverAt(this Vector3 pos, float amplitude = 1f, float frequency = 6.28f, float offset = 0f, float phase = 0f) { //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_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) return Vector2Extensions.ToVector3ZisY(Vector3Extensions.XY(pos).HoverAt(amplitude, frequency, offset, phase), 0f); } public static SpeculativeRigidbody AutoRigidBody(this GameObject g, CollisionLayer clayer = (CollisionLayer)6, bool canBePushed = false, float height = 1f, bool keepExistingColliders = false, IntVector2? bodyDims = null, bool useUntrimmedBounds = false) { //IL_001b: 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_0020: 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_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) //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_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_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_0069: 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_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_0098: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_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_00df: 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) //IL_00ef: 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_00f8: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown SpeculativeRigidbody orAddComponent = GameObjectExtensions.GetOrAddComponent(g); tk2dBaseSprite component = g.GetComponent(); Bounds val = (useUntrimmedBounds ? component.GetUntrimmedBounds() : component.GetBounds()); IntVector2 val2 = Vector2Extensions.ToIntVector2(16f * Vector3Extensions.XY(((Bounds)(ref val)).size), (VectorConversions)2); IntVector2 val3 = Vector2Extensions.ToIntVector2(16f * Vector3Extensions.XY(((Bounds)(ref val)).min), (VectorConversions)2); int num = val3.x; int y = val3.y; int x = val2.x; int manualHeight = Mathf.CeilToInt(height * (float)val2.y); if (bodyDims.HasValue) { IntVector2 valueOrDefault = bodyDims.GetValueOrDefault(); num = (num + x - valueOrDefault.x) / 2; x = valueOrDefault.x; manualHeight = valueOrDefault.y; } if (!keepExistingColliders) { orAddComponent.PixelColliders = new List(); } orAddComponent.PixelColliders.Add(new PixelCollider { ColliderGenerationMode = (PixelColliderGeneration)0, ManualOffsetX = num, ManualOffsetY = y, ManualWidth = x, ManualHeight = manualHeight, CollisionLayer = clayer, Enabled = true, IsTrigger = false }); orAddComponent.CanBePushed = canBePushed; return orAddComponent; } public static SpeculativeRigidbody AutoRigidBody(this GameObject g, List clayers, bool canBePushed = false, float height = 1f, bool keepExistingColliders = false, IntVector2? bodyDims = null, bool useUntrimmedBounds = false) { //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_0016: Unknown result type (might be due to invalid IL or missing references) bool flag = true; SpeculativeRigidbody result = null; foreach (CollisionLayer clayer in clayers) { result = g.AutoRigidBody(clayer, canBePushed, height, !flag, bodyDims, useUntrimmedBounds); flag = false; } return result; } public static int GetChargeLevel(this Gun gun, ProjectileModule mod = null) { if (mod == null) { mod = gun.DefaultModule; } if (mod.chargeProjectiles == null) { return -1; } return mod.chargeProjectiles.IndexOf(mod.GetChargeProjectile(gun.m_moduleData[mod].chargeTime)); } public static void QuickUpdateGunAnimations(this Gun gun) { tk2dSpriteCollectionData weaponCollection = Databases.Items.WeaponCollection; List list = new List(); gun.idleAnimation = gun.QuickUpdateAnimationAddClipsLater("idle", weaponCollection, returnToIdle: false, list); gun.dodgeAnimation = gun.QuickUpdateAnimationAddClipsLater("dodge", weaponCollection, returnToIdle: false, list); gun.introAnimation = gun.QuickUpdateAnimationAddClipsLater("intro", weaponCollection, returnToIdle: true, list); gun.emptyAnimation = gun.QuickUpdateAnimationAddClipsLater("empty", weaponCollection, returnToIdle: false, list); gun.shootAnimation = gun.QuickUpdateAnimationAddClipsLater("fire", weaponCollection, returnToIdle: true, list); gun.reloadAnimation = gun.QuickUpdateAnimationAddClipsLater("reload", weaponCollection, returnToIdle: true, list); gun.chargeAnimation = gun.QuickUpdateAnimationAddClipsLater("charge", weaponCollection, returnToIdle: false, list); gun.outOfAmmoAnimation = gun.QuickUpdateAnimationAddClipsLater("out_of_ammo", weaponCollection, returnToIdle: false, list); gun.dischargeAnimation = gun.QuickUpdateAnimationAddClipsLater("discharge", weaponCollection, returnToIdle: false, list); gun.finalShootAnimation = gun.QuickUpdateAnimationAddClipsLater("final_fire", weaponCollection, returnToIdle: true, list); gun.emptyReloadAnimation = gun.QuickUpdateAnimationAddClipsLater("empty_reload", weaponCollection, returnToIdle: true, list); gun.criticalFireAnimation = gun.QuickUpdateAnimationAddClipsLater("critical_fire", weaponCollection, returnToIdle: true, list); gun.enemyPreFireAnimation = gun.QuickUpdateAnimationAddClipsLater("enemy_pre_fire", weaponCollection, returnToIdle: false, list); gun.alternateShootAnimation = gun.QuickUpdateAnimationAddClipsLater("alternate_shoot", weaponCollection, returnToIdle: true, list); gun.alternateReloadAnimation = gun.QuickUpdateAnimationAddClipsLater("alternate_reload", weaponCollection, returnToIdle: true, list); gun.alternateIdleAnimation = gun.QuickUpdateAnimationAddClipsLater("alternate_idle", weaponCollection, returnToIdle: false, list); if (list.Count != 0) { gun.DefaultSpriteID = list[0].frames[0].spriteId; gun.GetSprite().SetSprite(weaponCollection, gun.DefaultSpriteID); } } public static string QuickUpdateAnimationAddClipsLater(this Gun gun, string name, tk2dSpriteCollectionData collection, bool returnToIdle = false, List clipsToAddLater = null) { //IL_001f: 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_002b: 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_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_0051: Expected O, but got Unknown string text = ((Object)gun).name + "_" + name; List list = ResMap.Get(text, quietFailure: true); if (list == null) { return null; } tk2dSpriteAnimationClip val = new tk2dSpriteAnimationClip { name = text, fps = 15f, wrapMode = (WrapMode)(returnToIdle ? 2 : 0), frames = collection.CreateAnimationFrames(list) }; ((BraveBehaviour)gun).spriteAnimator.Library.clips[Lazy._CurrentGunClips++] = val; clipsToAddLater?.Add(val); return text; } public static tk2dSpriteAnimationFrame[] CreateAnimationFrames(this tk2dSpriteCollectionData collection, List frameNames) { //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_0037: Expected O, but got Unknown tk2dSpriteAnimationFrame[] array = (tk2dSpriteAnimationFrame[])(object)new tk2dSpriteAnimationFrame[frameNames.Count]; for (int i = 0; i < array.Length; i++) { array[i] = new tk2dSpriteAnimationFrame { spriteCollection = collection, spriteId = collection.spriteNameLookupDict[frameNames[i]] }; } return array; } public static string QuickUpdateGunAnimation(this Gun gun, string name, tk2dSpriteCollectionData collection = null, bool returnToIdle = false, int fps = -1, string audio = null) { if (collection == null) { collection = Databases.Items.WeaponCollection; } string text = gun.QuickUpdateAnimationAddClipsLater(name, collection, returnToIdle); if (string.IsNullOrEmpty(text)) { return null; } if (fps >= 0) { GunExt.SetAnimationFPS(gun, text, fps); } if (audio != null) { gun.SetGunAudio(text, audio); } return text; } public static void BetterConstructOffsetsFromAnchor(this tk2dSpriteDefinition def, Anchor anchor, Vector2? scale = null, bool fixesScale = false, bool changesCollider = true) { //IL_001a: 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_001f: 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_003d: Invalid comparison between Unknown and I4 //IL_0023: 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_0034: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Invalid comparison between Unknown and I4 //IL_0082: 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_0077: Invalid comparison between Unknown and I4 //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Invalid comparison between Unknown and I4 //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Invalid comparison between Unknown and I4 //IL_0063: 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_005d: Invalid comparison between Unknown and I4 //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Invalid comparison between Unknown and I4 //IL_0099: 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: Invalid comparison between Unknown and I4 //IL_00ef: 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_0097: Invalid comparison between Unknown and I4 //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Invalid comparison between Unknown and I4 //IL_012c: 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_00f8: Invalid comparison between Unknown and I4 //IL_0137: 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_0131: Invalid comparison between Unknown and I4 //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Invalid comparison between Unknown and I4 //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Invalid comparison between Unknown and I4 //IL_0116: 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_0110: Invalid comparison between Unknown and I4 //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Invalid comparison between Unknown and I4 //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Invalid comparison between Unknown and I4 //IL_0153: 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_014d: Invalid comparison between Unknown and I4 //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Invalid comparison between Unknown and I4 Vector2 val = (Vector2)(((??)scale) ?? Vector3Extensions.XY(def.untrimmedBoundsDataExtents)); if (fixesScale) { val -= Vector3Extensions.XY(def.position0); } float num = 0f; if ((int)anchor == 1 || (int)anchor == 4 || (int)anchor == 7) { num = 0f - 0.5f * val.x; } else if ((int)anchor == 2 || (int)anchor == 5 || (int)anchor == 8) { num = 0f - val.x; } float num2 = 0f; if ((int)anchor == 3 || (int)anchor == 4 || (int)anchor == 3) { num2 = 0f - 0.5f * val.y; } else if ((int)anchor == 6 || (int)anchor == 7 || (int)anchor == 8) { num2 = 0f - val.y; } def.ShiftBy(new Vector3(dfNumberExtensions.Quantize(num, 0.0625f, (VectorConversions)1), dfNumberExtensions.Quantize(num2, 0.0625f, (VectorConversions)1), 0f)); if (changesCollider && def.colliderVertices != null && def.colliderVertices.Length != 0) { float num3 = 0f; if ((int)anchor == 0 || (int)anchor == 3 || (int)anchor == 6) { num3 = val.x / 2f; } else if ((int)anchor == 2 || (int)anchor == 5 || (int)anchor == 8) { num3 = 0f - val.x / 2f; } float num4 = 0f; if ((int)anchor == 0 || (int)anchor == 1 || (int)anchor == 2) { num4 = val.y / 2f; } else if ((int)anchor == 6 || (int)anchor == 7 || (int)anchor == 8) { num4 = 0f - val.y / 2f; } ref Vector3 reference = ref def.colliderVertices[0]; reference += new Vector3(dfNumberExtensions.Quantize(num3, 0.0625f, (VectorConversions)1), dfNumberExtensions.Quantize(num4, 0.0625f, (VectorConversions)1), 0f); } } public static void ScaleBy(this tk2dSpriteDefinition def, float scale) { //IL_0002: 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_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_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_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_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_004a: 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_0055: 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_006e: 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_0080: 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) def.position0 *= scale; def.position1 *= scale; def.position2 *= scale; def.position3 *= scale; def.boundsDataCenter *= scale; def.boundsDataExtents *= scale; def.untrimmedBoundsDataCenter *= scale; def.untrimmedBoundsDataExtents *= scale; } public static void ShiftBy(this tk2dSpriteDefinition def, Vector3 offset, bool changesCollider = false) { //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_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_0019: 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_0026: 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_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_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_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_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_0055: 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_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_0092: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) def.position0 += offset; def.position1 += offset; def.position2 += offset; def.position3 += offset; def.boundsDataCenter += offset; def.untrimmedBoundsDataCenter += offset; if (def.colliderVertices != null && def.colliderVertices.Length != 0 && changesCollider) { ref Vector3 reference = ref def.colliderVertices[0]; reference += offset; } } public static List AsRange(this IntVector2 vec) { //IL_0000: 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_0027: Unknown result type (might be due to invalid IL or missing references) int x = vec.x; List list = new List(vec.y); for (int i = 0; i < vec.y; i++) { list.Add(x++); } return list; } public static void StopCollidingWithPlayers(this Projectile p) { p.collidesWithPlayer = false; foreach (PixelCollider pixelCollider in ((BraveBehaviour)p).specRigidbody.PixelColliders) { pixelCollider.CollisionLayerIgnoreOverride |= CollisionMask.LayerToMask((CollisionLayer)0); } } public static void SpawnInInstantly(this AIActor enemy, bool isReinforcement = true) { enemy.HasDonePlayerEnterCheck = true; enemy.IsInReinforcementLayer = isReinforcement; enemy.ToggleRenderers(true); enemy.OnEngaged(isReinforcement); ((BraveBehaviour)enemy).aiAnimator.EndAnimation(); } public static void MakeHolographic(this tk2dBaseSprite sprite, bool green = false) { sprite.usesOverrideMaterial = true; ((BraveBehaviour)sprite).renderer.material.shader = ShaderCache.Acquire("Brave/Internal/HologramShader"); if (green) { ((BraveBehaviour)sprite).renderer.material.SetFloat("_IsGreen", 1f); } } public static Gun AddFlippedCarryPixelOffsets(this Gun gun, IntVector2 offset, IntVector2 flippedOffset, IntVector2? offsetPilot = null, IntVector2? flippedOffsetPilot = null, IntVector2? offsetConvict = null, IntVector2? flippedOffsetConvict = null, IntVector2? offsetRobot = null, IntVector2? flippedOffsetRobot = null, IntVector2? offsetNinja = null, IntVector2? flippedOffsetNinja = null, IntVector2? offsetCosmonaut = null, IntVector2? flippedOffsetCosmonaut = null, IntVector2? offsetSoldier = null, IntVector2? flippedOffsetSoldier = null, IntVector2? offsetGuide = null, IntVector2? flippedOffsetGuide = null, IntVector2? offsetCoopCultist = null, IntVector2? flippedOffsetCoopCultist = null, IntVector2? offsetBullet = null, IntVector2? flippedOffsetBullet = null, IntVector2? offsetEevee = null, IntVector2? flippedOffsetEevee = null, IntVector2? offsetGunslinger = null, IntVector2? flippedOffsetGunslinger = null) { //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_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) gun.carryPixelOffset = offset; FlippedCarryPixelOffset.AddTo(gun, offset, flippedOffset, offsetPilot, flippedOffsetPilot, offsetConvict, flippedOffsetConvict, offsetRobot, flippedOffsetRobot, offsetNinja, flippedOffsetNinja, offsetCosmonaut, flippedOffsetCosmonaut, offsetSoldier, flippedOffsetSoldier, offsetGuide, flippedOffsetGuide, offsetCoopCultist, flippedOffsetCoopCultist, offsetBullet, flippedOffsetBullet, offsetEevee, flippedOffsetEevee, offsetGunslinger, flippedOffsetGunslinger); return gun; } private static FakeItem AcquireFakeItem(this PlayerController player, GameObject prefab) { FakeItem component = Object.Instantiate(prefab).GetComponent(); EncounterTrackable component2 = ((Component)component).GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { component2.DoNotificationOnEncounter = false; } ((PassiveItem)component).suppressPickupVFX = true; _SuppressNextPassivePickupSound = true; ((PickupObject)component).Pickup(player); return component; } public static T AcquireFakeItem(this PlayerController player) where T : FakeItem { return player.AcquireFakeItem(((Component)FakeItem.Get()).gameObject) as T; } public static FakeItem AcquireFakeItem(this PlayerController player, int id) { return player.AcquireFakeItem(((Component)FakeItem.Get(id)).gameObject); } public static void AcquireSilently(this PlayerController player, int id) { _SuppressNextPassivePickupSound = true; ? val = player; PickupObject byId = PickupObjectDatabase.GetById(id); ((PlayerController)val).AcquirePassiveItemPrefabDirectly((PassiveItem)(object)((byId is PassiveItem) ? byId : null)); } public static void SpawnShrapnel(this Projectile p, GameObject shrapnelVFX, int shrapnelCount = 10, float shrapnelMinVelocity = 20f, float shrapnelMaxVelocity = 25f, float shrapnelLifetime = 0.2f) { //IL_000d: 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_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) //IL_0022: 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_003a: 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) tk2dSpriteDefinition currentSpriteDef = ((BraveBehaviour)p).sprite.GetCurrentSpriteDef(); Vector2 val = Vector2.op_Implicit(currentSpriteDef.position3 - currentSpriteDef.position0); Vector2 basePosition = Vector2.op_Implicit(((BraveBehaviour)p).transform.position); float positionVariance = 0.5f * Mathf.Min(val.x, val.y); float velocityVariance = shrapnelMaxVelocity - shrapnelMinVelocity; float? fadeOutTime = shrapnelLifetime; CwaffVFX.SpawnBurst(shrapnelVFX, shrapnelCount, basePosition, positionVariance, null, shrapnelMinVelocity, velocityVariance, CwaffVFX.Vel.Away, CwaffVFX.Rot.Random, shrapnelLifetime, fadeOutTime); } private static bool EnumeratorFieldFinder(FieldInfo f) { string name = f.Name; if (name == _SearchString) { return true; } if (name[0] != '<') { return false; } int num = name.IndexOf('>'); int length = _SearchString.Length; if (num > 0 && num - 1 == length) { return string.Compare(name, 1, _SearchString, 0, length) == 0; } return false; } public static FieldInfo GetEnumeratorField(this Type t, string s) { _SearchString = s; return AccessTools.GetDeclaredFields(t).Find(EnumeratorFieldFinder); } public static string GetEnumeratorFieldName(this Type t, string s) { return t.GetEnumeratorField(s).Name; } public static VariableDefinition DeclareLocal(this ILContext il) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown VariableDefinition val = new VariableDefinition(il.Import(typeof(T))); il.Body.Variables.Add(val); return val; } public static void AddAnimationEvent(this GameObject g, Action action, int frame, string sound) { tk2dSpriteAnimator component = g.GetComponent(); if (component != null) { if (action != null) { component.AnimationEventTriggered = (Action)Delegate.Combine(component.AnimationEventTriggered, action); } tk2dSpriteAnimationFrame obj = component.DefaultClip.frames[frame]; obj.triggerEvent = true; obj.eventAudio = sound; } } public static void AddSound(this tk2dSpriteAnimationFrame f, string sound) { f.triggerEvent = true; f.eventAudio = sound; } public static void IncreaseCurse(this PlayerController player, float curse = 1f, bool updateStats = true) { player.ownerlessStatModifiers.Add(((StatType)14).Add(curse)); if (updateStats) { player.stats.RecalculateStats(player, false, false); } } public static string GetOriginalIdleAnimationName(this Gun gun) { return gun.InternalSpriteName() + "_idle"; } public static float OriginalDirection(this Projectile p) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) return Vector2Extensions.ToAngle(Vector3Extensions.XY(((BraveBehaviour)p).transform.right)); } public static tk2dBaseSprite DuplicateInWorld(this tk2dBaseSprite osprite, Texture2D optionalPalette = null, bool copyShader = false) { //IL_0074: 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_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) tk2dBaseSprite val = (tk2dBaseSprite)(object)Lazy.SpriteObject(osprite.collection, osprite.spriteId); if (copyShader) { ((BraveBehaviour)val).renderer.material.shader = ((BraveBehaviour)osprite).renderer.material.shader; ((BraveBehaviour)val).renderer.material.CopyPropertiesFromMaterial(((BraveBehaviour)osprite).renderer.material); } val.FlipX = osprite.FlipX; val.FlipY = osprite.FlipY; ((BraveBehaviour)val).transform.localScale = ((BraveBehaviour)osprite).transform.localScale; ((BraveBehaviour)val).transform.rotation = ((BraveBehaviour)osprite).transform.rotation; val.PlaceAtRotatedPositionByAnchor(Vector2.op_Implicit(osprite.WorldCenter), (Anchor)4); val.HeightOffGround = osprite.HeightOffGround; val.depthUsesTrimmedBounds = osprite.depthUsesTrimmedBounds; val.SortingOrder = osprite.SortingOrder; val.renderLayer = osprite.renderLayer; val.UpdateZDepth(); if ((Object)(object)optionalPalette != (Object)null) { Material material = ((BraveBehaviour)val).renderer.material; val.usesOverrideMaterial = true; if (!material.HasProperty("_PaletteTex")) { material.shader = ((BraveBehaviour)osprite).renderer.material.shader; } if (material.HasProperty("_UsePalette")) { material.SetFloat("_UsePalette", 1f); } material.SetTexture("_PaletteTex", (Texture)(object)optionalPalette); } return val; } public static tk2dBaseSprite DuplicateInWorld(this AIActor actor, bool copyShader = false) { return ((BraveBehaviour)actor).sprite.DuplicateInWorld(actor.optionalPalette, copyShader); } public static tk2dMeshSprite DuplicateInWorldAsMesh(this tk2dBaseSprite osprite, bool pointMesh = true, Texture2D optionalPalette = null) { //IL_0002: 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_0015: Unknown result type (might be due to invalid IL or missing references) tk2dMeshSprite obj = Lazy.CreateMeshSpriteObject(osprite, osprite.WorldCenter, pointMesh, optionalPalette); ((tk2dBaseSprite)obj).PlaceAtPositionByAnchor(Vector2.op_Implicit(osprite.WorldCenter), (Anchor)4); ((tk2dBaseSprite)obj).HeightOffGround = osprite.HeightOffGround; ((tk2dBaseSprite)obj).depthUsesTrimmedBounds = osprite.depthUsesTrimmedBounds; ((tk2dBaseSprite)obj).SortingOrder = osprite.SortingOrder; ((tk2dBaseSprite)obj).renderLayer = osprite.renderLayer; ((tk2dBaseSprite)obj).UpdateZDepth(); return obj; } public static tk2dMeshSprite DuplicateInWorldAsMesh(this AIActor actor, bool pointMesh = true) { return ((BraveBehaviour)actor).sprite.DuplicateInWorldAsMesh(pointMesh, actor.optionalPalette); } public static void SetOptionalPalette(this tk2dSprite sprite, Texture2D optionalPalette) { Material material = ((BraveBehaviour)sprite).renderer.material; ((tk2dBaseSprite)sprite).usesOverrideMaterial = true; material.SetFloat("_UsePalette", 1f); material.SetTexture("_PaletteTex", (Texture)(object)optionalPalette); } public static void FreezeAndLaunchWithDelay(this Projectile p, float delay, float speed, string sound = null) { ((MonoBehaviour)p).StartCoroutine(FreezeAndLaunchWithDelay_CR(p, delay, speed, sound)); static IEnumerator FreezeAndLaunchWithDelay_CR(Projectile val, float num, float speed2, string text = null) { val.Speed = 0.001f; yield return (object)new WaitForSeconds(num); val.Speed = speed2; if (text != null) { ((Component)val).gameObject.Play(text); } } } public static float DistanceToOwner(this Projectile p) { //IL_0013: 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_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) if (Object.op_Implicit((Object)(object)p.Owner)) { Vector2 val = p.Owner.CenterPosition - p.SafeCenter; return ((Vector2)(ref val)).magnitude; } return -1f; } public static float AngleFromOwner(this Projectile p) { //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_001e: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)p.Owner)) { return Vector2Extensions.ToAngle(p.SafeCenter - p.Owner.CenterPosition); } return -1f; } public static string GetEvenlySpacedIdleAnimation(this PlayerController pc, float a) { float num = Mathf.Abs(a); string text = ((!(num < 60f) && !(num > 120f)) ? ((a > 0f) ? "idle_backward" : "idle_forward") : ((a > 0f) ? "idle_bw" : "idle")); if (pc.UseArmorlessAnim) { text += "_armorless"; } return text; } public static void CorrectForWalls(this SpeculativeRigidbody body, bool andRigidBodies = false) { //IL_004b: 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_0055: 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_006d: 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_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) //IL_0089: 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_009d: Unknown result type (might be due to invalid IL or missing references) if (!PhysicsEngine.Instance.OverlapCast(body, (List)null, true, andRigidBodies, (int?)null, (int?)null, false, (Vector2?)null, (Func)null, (SpeculativeRigidbody[])(object)new SpeculativeRigidbody[0])) { return; } DungeonData data = GameManager.Instance.Dungeon.data; Vector2 val = Vector3Extensions.XY(((BraveBehaviour)body).transform.position); IntVector2[] cardinalsAndOrdinals = IntVector2.CardinalsAndOrdinals; for (int i = 1; i <= 200; i++) { for (int j = 0; j < cardinalsAndOrdinals.Length; j++) { Vector2 val2 = val + PhysicsEngine.PixelToUnit(cardinalsAndOrdinals[j] * i); if (data.CheckInBoundsAndValid(Vector2Extensions.ToIntVector2(val2, (VectorConversions)0))) { ((BraveBehaviour)body).transform.position = Vector2.op_Implicit(val2); body.Reinitialize(); if (!PhysicsEngine.Instance.OverlapCast(body, (List)null, true, andRigidBodies, (int?)null, (int?)null, false, (Vector2?)null, (Func)null, (SpeculativeRigidbody[])(object)new SpeculativeRigidbody[0])) { return; } } } } Debug.LogError((object)"FREEZE AVERTED! TELL CAPTAIN PRETZEL! (you're welcome) 147"); } public static int PullOutOfWall(this SpeculativeRigidbody body, IntVector2 pushDirection, bool forceAtLeastOne = false) { //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_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_0054: 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_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_0065: Unknown result type (might be due to invalid IL or missing references) if (!forceAtLeastOne && !PhysicsEngine.Instance.OverlapCast(body, (List)null, true, false, (int?)null, (int?)null, false, (Vector2?)null, (Func)null, (SpeculativeRigidbody[])(object)new SpeculativeRigidbody[0])) { return 0; } Vector2 val = Vector3Extensions.XY(((BraveBehaviour)body).transform.position); for (int i = 1; i <= 200; i++) { ((BraveBehaviour)body).transform.position = Vector2.op_Implicit(val + PhysicsEngine.PixelToUnit(pushDirection * i)); body.Reinitialize(); if (!PhysicsEngine.Instance.OverlapCast(body, (List)null, true, false, (int?)null, (int?)null, false, (Vector2?)null, (Func)null, (SpeculativeRigidbody[])(object)new SpeculativeRigidbody[0])) { return i; } } Debug.LogError((object)"FREEZE AVERTED! TELL CAPTAIN PRETZEL! (you're welcome) 147"); return -1; } public static int PushAgainstWalls(this SpeculativeRigidbody body, IntVector2 pushDirection) { //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_0045: 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_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_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_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_00ba: 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) if (PhysicsEngine.Instance.OverlapCast(body, (List)null, true, false, (int?)null, (int?)null, false, (Vector2?)null, (Func)null, (SpeculativeRigidbody[])(object)new SpeculativeRigidbody[0])) { return 0; } Vector2 val = Vector3Extensions.XY(((BraveBehaviour)body).transform.position); for (int i = 1; i <= 64; i++) { ((BraveBehaviour)body).transform.position = Vector2.op_Implicit(val + PhysicsEngine.PixelToUnit(pushDirection * i)); body.Reinitialize(); if (PhysicsEngine.Instance.OverlapCast(body, (List)null, true, false, (int?)null, (int?)null, false, (Vector2?)null, (Func)null, (SpeculativeRigidbody[])(object)new SpeculativeRigidbody[0])) { i--; ((BraveBehaviour)body).transform.position = Vector2.op_Implicit(val + PhysicsEngine.PixelToUnit(pushDirection * i)); body.Reinitialize(); return i; } } Debug.LogError((object)"FREEZE AVERTED! TELL CAPTAIN PRETZEL! (you're welcome) 148"); return -1; } public static bool IsAgainstWall(this SpeculativeRigidbody body, IntVector2 pushDirection, int pixels = 1) { //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_0045: 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_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) //IL_005e: 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_00a6: Unknown result type (might be due to invalid IL or missing references) if (PhysicsEngine.Instance.OverlapCast(body, (List)null, true, false, (int?)null, (int?)null, false, (Vector2?)null, (Func)null, (SpeculativeRigidbody[])(object)new SpeculativeRigidbody[0])) { return true; } Vector2 val = Vector3Extensions.XY(((BraveBehaviour)body).transform.position); ((BraveBehaviour)body).transform.position = Vector2.op_Implicit(val + PhysicsEngine.PixelToUnit(pushDirection * pixels)); body.Reinitialize(); bool result = PhysicsEngine.Instance.OverlapCast(body, (List)null, true, false, (int?)null, (int?)null, false, (Vector2?)null, (Func)null, (SpeculativeRigidbody[])(object)new SpeculativeRigidbody[0]); ((BraveBehaviour)body).transform.position = Vector2.op_Implicit(val); body.Reinitialize(); return result; } public static Gun AsGun(this Items item) { PickupObject obj = ItemHelper.Get(item); return (Gun)(object)((obj is Gun) ? obj : null); } public static PlayerItem AsActive(this Items item) { PickupObject obj = ItemHelper.Get(item); return (PlayerItem)(object)((obj is PlayerItem) ? obj : null); } public static PassiveItem AsPassive(this Items item) { PickupObject obj = ItemHelper.Get(item); return (PassiveItem)(object)((obj is PassiveItem) ? obj : null); } public static Gun AddReticle(this Gun gun, GameObject reticleVFX, float reticleAlpha = 1f, float fadeInTime = 0f, float fadeOutTime = 0f, bool smoothLerp = false, float maxDistance = -1f, float controllerScale = 1f, float rotateSpeed = 0f, CwaffReticle.Visibility visibility = CwaffReticle.Visibility.DEFAULT, bool aimFromPlayerCenter = false, bool background = false) where T : CwaffReticle { T val = ((Component)gun).gameObject.AddComponent(); val.reticleVFX = reticleVFX; val.reticleAlpha = reticleAlpha; val.fadeInTime = fadeInTime; val.fadeOutTime = fadeOutTime; val.smoothLerp = smoothLerp; val.aimFromPlayerCenter = aimFromPlayerCenter; val.maxDistance = maxDistance; val.controllerScale = controllerScale; val.rotateSpeed = rotateSpeed; val.visibility = visibility; val.background = background; return gun; } public static bool IsActuallyOubiletteEntranceRoom(this SpeculativeRigidbody body) { return ((Object)body).name.StartsWith("secret exit collider"); } public static bool IsEffectivelyOutOfBounds(this PlayerController player) { return false; } public static ReadOnlyCollection SafeGetEnemiesInRoom(this RoomHandler room) { _RefEnemies.Clear(); if (room != null) { room.GetActiveEnemies((ActiveEnemyType)0, ref _RefEnemies); } return _ReadOnlyEnemies; } public static void AddUnique(this List list, T item) { if (!list.Contains(item)) { list.Add(item); } } public static bool WouldCollideWithEnemy(this Projectile projectile, float angle, bool accountForWalls = true, bool pixelPerfect = false, int outset = 0) { //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_0010: 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_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) //IL_0035: 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_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_003f: 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_00ae: 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_009f: Unknown result type (might be due to invalid IL or missing references) Vector2 val = Vector3Extensions.XY(((BraveBehaviour)projectile).transform.position); Vector2 normal; IntVector2 pixelsToMove = (accountForWalls ? PhysicsEngine.UnitToPixel(val.ToNearestWall(out normal, angle) - val) : PhysicsEngine.UnitToPixel(angle.ToVector(20f))); PixelCollider primaryPixelCollider = ((BraveBehaviour)projectile).specRigidbody.PrimaryPixelCollider; foreach (AIActor allNearbyEnemy in val.GetAllNearbyEnemies(100f, !accountForWalls)) { if (allNearbyEnemy.IsHostile(canBeDead: false, canBeNeutral: true) && Object.op_Implicit((Object)(object)((BraveBehaviour)allNearbyEnemy).specRigidbody)) { PixelCollider hitboxPixelCollider = ((BraveBehaviour)allNearbyEnemy).specRigidbody.HitboxPixelCollider; if ((!accountForWalls || val.HasLineOfSight(hitboxPixelCollider.UnitCenter)) && primaryPixelCollider.FastLinearCast(hitboxPixelCollider, pixelsToMove, pixelPerfect, outset)) { return true; } } } return false; } public static bool WouldCollideWithPlayer(this Projectile projectile, float angle, bool accountForWalls = true, bool pixelPerfect = false, int outset = 0) { //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_0010: 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_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) //IL_0035: 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_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_003f: 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_0087: 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) Vector2 val = Vector3Extensions.XY(((BraveBehaviour)projectile).transform.position); Vector2 normal; IntVector2 pixelsToMove = (accountForWalls ? PhysicsEngine.UnitToPixel(val.ToNearestWall(out normal, angle) - val) : PhysicsEngine.UnitToPixel(angle.ToVector(20f))); PixelCollider primaryPixelCollider = ((BraveBehaviour)projectile).specRigidbody.PrimaryPixelCollider; PlayerController[] allPlayers = GameManager.Instance.AllPlayers; foreach (PlayerController val2 in allPlayers) { if (Object.op_Implicit((Object)(object)val2) && !val2.IsGhost) { PixelCollider hitboxPixelCollider = ((BraveBehaviour)val2).specRigidbody.HitboxPixelCollider; if ((!accountForWalls || val.HasLineOfSight(hitboxPixelCollider.UnitCenter)) && primaryPixelCollider.FastLinearCast(hitboxPixelCollider, pixelsToMove, pixelPerfect, outset)) { return true; } } } return false; } public static bool FastLinearCast(this PixelCollider myCollider, PixelCollider otherCollider, IntVector2 pixelsToMove, bool pixelPerfect = false, int outset = 0) { //IL_0000: 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) PhysicsEngine.PixelMovementGenerator(pixelsToMove, _Steps); return myCollider.FastLinearCast(otherCollider, pixelsToMove, _Steps, pixelPerfect, outset); } public static bool FastLinearCast(this PixelCollider myCollider, PixelCollider otherCollider, IntVector2 pixelsToMove, List stepList, bool pixelPerfect = false, int outset = 0) { //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_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_0018: 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_005e: 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_0065: 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_0035: 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_004e: 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_0058: 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_0081: 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_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_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_0095: 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_009d: 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_00ac: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_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_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) //IL_00e9: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: 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_0123: 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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) if (!myCollider.Enabled) { return false; } if (otherCollider.DirectionIgnorer != null && otherCollider.DirectionIgnorer(pixelsToMove)) { return false; } IntVector2 val = myCollider.m_position; IntVector2 val2 = myCollider.m_dimensions; if (outset > 0) { val -= new IntVector2(outset, outset); val2 += new IntVector2(2 * outset, 2 * outset); } IntVector2 val3 = IntVector2.Zero; IntVector2 val4 = otherCollider.m_position - val; for (int i = 0; i < stepList.Count; i++) { IntVector2 deltaPos = stepList[i].deltaPos; IntVector2 val5 = val + val3 + deltaPos; if (!IntVector2.AABBOverlap(val5, val2, otherCollider.Position, otherCollider.Dimensions)) { val3 += deltaPos; continue; } if (!pixelPerfect) { return true; } IntVector2 val6 = IntVector2.Max(IntVector2.Zero, otherCollider.Position - val5); IntVector2 val7 = IntVector2.Min(val2 - IntVector2.One, otherCollider.UpperRight - val5); for (int j = val6.x; j <= val7.x; j++) { for (int k = val6.y; k <= val7.y; k++) { if (myCollider.m_bestPixels[j, k]) { IntVector2 val8 = new IntVector2(j, k) - val4 + val3 + deltaPos; if (val8.x >= 0 && val8.x < otherCollider.Dimensions.x && val8.y >= 0 && val8.y < otherCollider.Dimensions.y && otherCollider[val8]) { return true; } } } } val3 += deltaPos; } return false; } public static bool FiredForFree(this Projectile p) { return ((Component)p).gameObject.GetComponent()?.firedForFree ?? false; } public static bool SecondaryReloadPressed(this PlayerController player) { if (CwaffConfig._SecondaryReload == CwaffConfig.SecondaryReloadKey.None) { return false; } InputDevice device = ((PlayerActionSet)BraveInput.GetInstanceForPlayer(player.PlayerIDX).ActiveActions).Device; if (device == null) { return false; } if (CwaffConfig._SecondaryReload == CwaffConfig.SecondaryReloadKey.Left) { return ((OneAxisInputControl)device.LeftStickButton).WasPressed; } if (CwaffConfig._SecondaryReload == CwaffConfig.SecondaryReloadKey.Right) { return ((OneAxisInputControl)device.RightStickButton).WasPressed; } return false; } public static bool OnScreen(this Vector2 pos) { //IL_0040: 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_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_0021: 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_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_0052: 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_0076: Unknown result type (might be due to invalid IL or missing references) if (_LastCameraCacheTime != BraveTime.ScaledTimeSinceStartup) { _CachedCameraMin = Vector2.op_Implicit(BraveUtility.ViewportToWorldpoint(Vector2.zero, (ViewportType)1)); _CachedCameraMax = Vector2.op_Implicit(BraveUtility.ViewportToWorldpoint(Vector2.one, (ViewportType)1)); _LastCameraCacheTime = BraveTime.ScaledTimeSinceStartup; } if (pos.x < _CachedCameraMin.x || pos.x > _CachedCameraMax.x || pos.y < _CachedCameraMin.y || pos.y > _CachedCameraMax.y) { return false; } return true; } public static bool OnScreen(this Vector2 pos, float leeway) { //IL_0040: 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_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_0021: 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_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_0054: 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_007c: Unknown result type (might be due to invalid IL or missing references) if (_LastCameraCacheTime != BraveTime.ScaledTimeSinceStartup) { _CachedCameraMin = Vector2.op_Implicit(BraveUtility.ViewportToWorldpoint(Vector2.zero, (ViewportType)1)); _CachedCameraMax = Vector2.op_Implicit(BraveUtility.ViewportToWorldpoint(Vector2.one, (ViewportType)1)); _LastCameraCacheTime = BraveTime.ScaledTimeSinceStartup; } if (pos.x < _CachedCameraMin.x - leeway || pos.x > _CachedCameraMax.x + leeway || pos.y < _CachedCameraMin.y - leeway || pos.y > _CachedCameraMax.y + leeway) { return false; } return true; } public static bool OnScreen(this Vector3 pos) { //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) return Vector3Extensions.XY(pos).OnScreen(); } public static bool OnScreen(this Vector3 pos, float leeway) { //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) return Vector3Extensions.XY(pos).OnScreen(leeway); } public static void FlashVFXAbovePlayer(this PlayerController player, GameObject vfx, string sound = null, float time = 1f, bool glowAndFade = false, float glowAmount = 5f) { //IL_0007: 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_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) GameObject val = SpawnManager.SpawnVFX(vfx, Vector2.op_Implicit(((BraveBehaviour)player).sprite.WorldTopCenter + new Vector2(0f, 0.5f)), Quaternion.identity); GameObjectExtensions.SetLayerRecursively(val, LayerMask.NameToLayer("Unoccluded")); val.transform.parent = ((BraveBehaviour)player).transform; if (glowAndFade) { val.AddComponent().Setup(0.15f, 0.2f, time, 0.2f, 0.15f, glowAmount); } else { val.ExpireIn(time); } if (sound != null) { ((Component)player).gameObject.Play(sound); } } public static void CreateDummyPath(this PathMover pathMover) { //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_0015: 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_002c: 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) //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_003f: Expected O, but got Unknown //IL_0040: 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_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_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_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_007f: 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) Vector2 val = Vector2.op_Implicit(((Component)pathMover).gameObject.transform.position); RoomHandler absoluteRoom = Vector3Extensions.GetAbsoluteRoom(val); IntVector2 val2 = Vector2Extensions.ToIntVector2(val - ((IntVector2)(ref absoluteRoom.area.basePosition)).ToVector2(), (VectorConversions)2); SerializedPath val3 = new SerializedPath(val2); val3.AddPosition(val2); val3.wrapMode = (SerializedPathWrapMode)0; SerializedPathNode value = val3.nodes[0]; value.placement = (SerializedNodePlacement)0; val3.nodes[0] = value; value = val3.nodes[1]; value.placement = (SerializedNodePlacement)0; val3.nodes[1] = value; pathMover.RoomHandler = absoluteRoom; pathMover.Path = val3; pathMover.PathStartNode = 0; } public static void ArcTowards(this tk2dBaseSprite sprite, float animLength, tk2dBaseSprite targetSprite, bool useBottom = false, float minScale = 0.4f, float vanishPercent = 0.5f) { ((MonoBehaviour)sprite).StartCoroutine(ArcTowards_CR(sprite, animLength, targetSprite, useBottom, minScale, vanishPercent)); static IEnumerator ArcTowards_CR(tk2dBaseSprite val, float num, tk2dBaseSprite val3, bool flag, float num5, float num2) { Vector2 startPosition = val.WorldCenter; float loopLength = num * num2; for (float elapsed = 0f; elapsed < loopLength; elapsed += BraveTime.DeltaTime) { if (!Object.op_Implicit((Object)(object)val)) { break; } float num3 = Ease.OutCubic(Mathf.Clamp01(elapsed / loopLength)); Vector2 val2 = new Vector2(0f, 2f * Mathf.Sin((float)Math.PI * num3)) + Vector2.Lerp(startPosition, flag ? val3.WorldBottomCenter : val3.WorldCenter, num3); float num4 = 1f - (1f - num5) * num3; ((BraveBehaviour)val).transform.localScale = new Vector3(num4, num4, 1f); val.PlaceAtScaledPositionByAnchor(Vector2.op_Implicit(val2), (Anchor)4); ((BraveBehaviour)val).renderer.SetAlpha(1f - loopLength); yield return null; } Object.Destroy((Object)(object)((Component)val).gameObject); } } public static void AddSynergyModules(this Gun gun, Synergy s, params ProjectileModule[] modules) { //IL_0013: 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_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_0024: 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_0033: Expected O, but got Unknown ((Component)gun).gameObject.AddComponent().synergies = (VolleyModificationSynergyData[])(object)new VolleyModificationSynergyData[1] { new VolleyModificationSynergyData { RequiredSynergy = s.Synergy(), AddsModules = true, ModulesToAdd = modules } }; } public static void AddSynergyFinalProjectile(this Gun gun, Synergy s, Projectile newFinal, string clipName, int num = 1) { //IL_0013: 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_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_0024: 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_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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown ((Component)gun).gameObject.AddComponent().synergies = (VolleyModificationSynergyData[])(object)new VolleyModificationSynergyData[1] { new VolleyModificationSynergyData { RequiredSynergy = s.Synergy(), SetsNumberFinalProjectiles = true, AddsNewFinalProjectile = true, NewFinalProjectile = newFinal, NewFinalProjectileAmmoType = Lazy.SetupCustomAmmoClip(clipName), NumberFinalProjectiles = num } }; } public static string GetUnmodifiedDisplayName(this Gun gun) { EncounterTrackable encounterTrackable = ((BraveBehaviour)gun).encounterTrackable; if (encounterTrackable == null) { return string.Empty; } JournalEntry journalData = encounterTrackable.m_journalData; if (journalData == null) { return string.Empty; } return journalData.GetPrimaryDisplayName(false); } public static bool JumpToNext(this ILCursor cursor, Func match, int times = 1) { for (int i = 0; i < times; i++) { if (!cursor.TryGotoNext((MoveType)2, new Func[1] { match })) { return false; } } return true; } public static bool JumpBeforeNext(this ILCursor cursor, Func match, int times = 1) { for (int i = 0; i < times; i++) { if (!cursor.TryGotoNext((MoveType)0, new Func[1] { match })) { return false; } } return true; } public static string AmmonomiconName(this string guid) { if (_EnemyNames.TryGetValue(guid, out var value)) { return value; } AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); if (orLoadByGuid == null) { return _EnemyNames[guid] = string.Empty; } EncounterTrackable encounterTrackable = ((BraveBehaviour)orLoadByGuid).encounterTrackable; if (encounterTrackable == null) { Dictionary enemyNames = _EnemyNames; string obj = ((GameActor)orLoadByGuid).ActorName ?? string.Empty; string result = obj; enemyNames[guid] = obj; return result; } JournalEntry journalData = encounterTrackable.journalData; if (journalData == null) { Dictionary enemyNames2 = _EnemyNames; string obj2 = ((GameActor)orLoadByGuid).ActorName ?? string.Empty; string result = obj2; enemyNames2[guid] = obj2; return result; } if (string.IsNullOrEmpty(journalData.PrimaryDisplayName)) { Dictionary enemyNames3 = _EnemyNames; string obj3 = ((GameActor)orLoadByGuid).ActorName ?? string.Empty; string result = obj3; enemyNames3[guid] = obj3; return result; } if (journalData.PrimaryDisplayName[0] != '#') { return _EnemyNames[guid] = journalData.PrimaryDisplayName; } return _EnemyNames[guid] = StringTableManager.GetEnemiesString(journalData.PrimaryDisplayName, -1); } public static string AmmonomiconName(this AIActor enemy) { return enemy.EnemyGuid.AmmonomiconName(); } public static void ApplyShader(this AIActor enemy, Action shaderFunc, bool includeHands = true, bool includeGun = false) { shaderFunc(((BraveBehaviour)enemy).sprite); if (includeGun) { Gun currentGun = ((GameActor)enemy).CurrentGun; if (currentGun != null) { shaderFunc(((BraveBehaviour)currentGun).sprite); } } if (includeHands) { for (int i = 0; i < ((BraveBehaviour)enemy).transform.childCount; i++) { tk2dSprite component = ((Component)((BraveBehaviour)enemy).transform.GetChild(i)).GetComponent(); if (component != null) { shaderFunc((tk2dBaseSprite)(object)component); } } } if ((Object)(object)enemy.optionalPalette != (Object)null) { Material material = ((BraveBehaviour)((BraveBehaviour)enemy).sprite).renderer.material; if (material.HasProperty("_UsePalette")) { material.SetFloat("_UsePalette", 1f); } if (material.HasProperty("_PaletteTex")) { material.SetTexture("_PaletteTex", (Texture)(object)enemy.optionalPalette); } } } public static GoopPositionData GoopData(this Vector2 pos) { //IL_0000: 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_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_0017: 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) IntVector2 key = Vector2Extensions.ToIntVector2(pos / DeadlyDeadlyGoopManager.GOOP_GRID_SIZE, (VectorConversions)0); if (!DeadlyDeadlyGoopManager.allGoopPositionMap.TryGetValue(key, out var value)) { return null; } if (!value.m_goopedCells.TryGetValue(key, out var value2)) { return null; } return value2; } public static GoopPositionData GoopData(this Vector2 pos, out GoopDefinition goopDef) { //IL_0003: 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_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_001a: 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) goopDef = null; IntVector2 key = Vector2Extensions.ToIntVector2(pos / DeadlyDeadlyGoopManager.GOOP_GRID_SIZE, (VectorConversions)0); if (!DeadlyDeadlyGoopManager.allGoopPositionMap.TryGetValue(key, out var value)) { return null; } if (!value.m_goopedCells.TryGetValue(key, out var value2)) { return null; } goopDef = value.goopDefinition; return value2; } public static ExplosionData With(this ExplosionData effect, float force = 100f, float debrisForce = 10f, float damage = 10f, float radius = 0.5f, bool preventPlayerForce = false, bool shake = true) { //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_0014: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0063: 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_0072: 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) //IL_008c: 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_009e: 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_00b7: Expected O, but got Unknown return new ExplosionData { forceUseThisRadius = true, pushRadius = radius, damageRadius = radius, damageToPlayer = 0f, doDamage = (damage > 0f), damage = damage, doDestroyProjectiles = false, doForce = (force > 0f || debrisForce > 0f), force = force, debrisForce = debrisForce, preventPlayerForce = preventPlayerForce, explosionDelay = 0.01f, usesComprehensiveDelay = false, doScreenShake = shake, playDefaultSFX = true, ignoreList = _NoIgnores, effect = effect.effect, ss = effect.ss }; } public static ExplosionData Clone(this ExplosionData effect) { //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_0011: 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_0029: 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_0041: 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: 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_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) //IL_0089: 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_00a1: 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_00b9: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown return new ExplosionData { forceUseThisRadius = effect.forceUseThisRadius, pushRadius = effect.pushRadius, damageRadius = effect.damageRadius, damageToPlayer = effect.damageToPlayer, doDamage = effect.doDamage, damage = effect.damage, doDestroyProjectiles = effect.doDestroyProjectiles, doForce = effect.doForce, force = effect.force, debrisForce = effect.debrisForce, preventPlayerForce = effect.preventPlayerForce, explosionDelay = effect.explosionDelay, usesComprehensiveDelay = effect.usesComprehensiveDelay, doScreenShake = effect.doScreenShake, playDefaultSFX = effect.playDefaultSFX, ignoreList = effect.ignoreList, effect = effect.effect, ss = effect.ss }; } public static ExplosionData Scale(this ExplosionData effect, float scalar) { //IL_0049: 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) ExplosionData obj = effect.Clone(); obj.forceUseThisRadius = true; obj.pushRadius *= scalar; obj.damageRadius *= scalar; obj.effect = effect.effect.ClonePrefab(); Transform transform = obj.effect.transform; transform.localScale *= scalar; return obj; } public static Projectile AudioEvent(this Projectile proj, string audio = "", int frame = 0) { tk2dSpriteAnimationFrame obj = ((BraveBehaviour)((BraveBehaviour)proj).sprite).spriteAnimator.DefaultClip.frames[frame]; obj.triggerEvent = !string.IsNullOrEmpty(audio); obj.eventAudio = audio; return proj; } public static int FirstGE(this T[] vals, T val) where T : IComparable { for (int i = 0; i < vals.Length; i++) { if (val.CompareTo(vals[i]) >= 0) { return i; } } return vals.Length; } public static int FirstGT(this T[] vals, T val) where T : IComparable { for (int i = 0; i < vals.Length; i++) { if (val.CompareTo(vals[i]) > 0) { return i; } } return vals.Length; } public static int FirstLE(this T[] vals, T val) where T : IComparable { for (int i = 0; i < vals.Length; i++) { if (val.CompareTo(vals[i]) <= 0) { return i; } } return vals.Length; } public static int FirstLT(this T[] vals, T val) where T : IComparable { for (int i = 0; i < vals.Length; i++) { if (val.CompareTo(vals[i]) < 0) { return i; } } return vals.Length; } public static void SetOwnerAndStats(this Projectile p, GameActor owner, bool updateCollisions = true) { p.Owner = owner; p.SetNewShooter(((BraveBehaviour)owner).specRigidbody); PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (updateCollisions) { p.collidesWithPlayer = !Object.op_Implicit((Object)(object)val); p.collidesWithEnemies = Object.op_Implicit((Object)(object)val); } if (Object.op_Implicit((Object)(object)val)) { ProjectileData baseData = p.baseData; baseData.damage *= val.DamageMult(); ProjectileData baseData2 = p.baseData; baseData2.range *= val.RangeMult(); ProjectileData baseData3 = p.baseData; baseData3.force *= val.KnockbackMult(); ProjectileData baseData4 = p.baseData; baseData4.speed *= val.ProjSpeedMult(); } } public static bool HasCollisionLayerOverride(this SpeculativeRigidbody body, int mask) { for (int i = 0; i < body.PixelColliders.Count; i++) { if ((body.PixelColliders[i].CollisionLayerCollidableOverride & mask) == mask) { return true; } } return false; } public static bool HasCollisionLayerIgnoreOverride(this SpeculativeRigidbody body, int mask) { for (int i = 0; i < body.PixelColliders.Count; i++) { if ((body.PixelColliders[i].CollisionLayerIgnoreOverride & mask) == mask) { return true; } } return false; } public static string DefaultClipName(this tk2dSpriteAnimator animator) { if (!Object.op_Implicit((Object)(object)animator)) { return "no animator"; } if (animator.DefaultClip == null) { return "no default clip"; } if (animator.DefaultClip.frames == null || animator.DefaultClip.frames.Length == 0) { return "no default clip frames"; } tk2dSpriteAnimationFrame val = animator.DefaultClip.frames[0]; if (!Object.op_Implicit((Object)(object)val.spriteCollection)) { return "no sprite collection"; } return val.spriteCollection.spriteDefinitions[val.spriteId].name; } public static Vector2 RandomPosInCurrentRoom(this PlayerController player) { //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_0030: 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) if (!Object.op_Implicit((Object)(object)player)) { player = GameManager.Instance.BestActivePlayer; } RoomHandler currentRoom = player.CurrentRoom; if (currentRoom == null) { return ((GameActor)player).CenterPosition; } IntVector2 randomVisibleClearSpot = currentRoom.GetRandomVisibleClearSpot(2, 2); return ((IntVector2)(ref randomVisibleClearSpot)).ToVector2(); } public static bool TryGetValue(this ListDictionary d, K key, out V value) { if (d.Contains(key)) { value = (V)d[key]; return true; } value = default(V); return false; } public static void DoColorfulMiniBlank(this PlayerController user, Color color, Vector2? position = null) { //IL_0015: 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_001a: 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_002a: 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_0087: 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_00d2: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown Vector2 val = (Vector2)(((??)position) ?? ((GameActor)user).CenterPosition); new GameObject("silencer").AddComponent().TriggerSilencer(val, 20f, 5f, (GameObject)null, 0f, 3f, 3f, 3f, 30f, 3f, 0.25f, user, true, false); if (_MiniBlankVFX == null) { _MiniBlankVFX = (GameObject)BraveResources.Load("Global VFX/BlankVFX_Ghost", ".prefab"); } GameObject obj = Object.Instantiate(_MiniBlankVFX, Vector2Extensions.ToVector3ZUp(val, val.y), Quaternion.identity); tk2dSprite componentInChildren = obj.GetComponentInChildren(); ((tk2dBaseSprite)componentInChildren).usesOverrideMaterial = true; ((BraveBehaviour)componentInChildren).renderer.material.shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTintableTiltedCutoutEmissive"); ((BraveBehaviour)componentInChildren).renderer.material.SetColor(CwaffVFX._OverrideColorId, Vector3Extensions.WithAlpha(color, 0.25f)); Object.Destroy((Object)(object)obj, 1f); user.DoVibration((Time)10, (Strength)20); } public static void DoColorfulBlank(this PlayerController user, Color color, Vector2? position = null) { //IL_0015: 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_001a: 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_002a: 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_0087: 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_00d2: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown Vector2 val = (Vector2)(((??)position) ?? ((GameActor)user).CenterPosition); new GameObject("silencer").AddComponent().TriggerSilencer(val, 50f, 25f, (GameObject)null, 0.15f, 0.2f, 50f, 10f, 140f, 15f, 0.5f, user, true, false); if (_BlankVFX == null) { _BlankVFX = (GameObject)BraveResources.Load("Global VFX/BlankVFX", ".prefab"); } GameObject obj = Object.Instantiate(_BlankVFX, Vector2Extensions.ToVector3ZUp(val, val.y), Quaternion.identity); tk2dSprite componentInChildren = obj.GetComponentInChildren(); ((tk2dBaseSprite)componentInChildren).usesOverrideMaterial = true; ((BraveBehaviour)componentInChildren).renderer.material.shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTintableTiltedCutoutEmissive"); ((BraveBehaviour)componentInChildren).renderer.material.SetColor(CwaffVFX._OverrideColorId, Vector3Extensions.WithAlpha(color, 0.25f)); Object.Destroy((Object)(object)obj, 1f); user.DoVibration((Time)10, (Strength)20); } public static GameObject Attach(this GameObject go, Action predicate = null, bool allowDuplicates = false) where T : MonoBehaviour { T obj = (allowDuplicates ? go.gameObject.AddComponent() : GameObjectExtensions.GetOrAddComponent(go.gameObject)); predicate?.Invoke(obj); return go; } public static T InitComponent(this GameObject go, Action predicate = null, bool allowDuplicates = false) where T : MonoBehaviour { T val = (allowDuplicates ? go.gameObject.AddComponent() : GameObjectExtensions.GetOrAddComponent(go.gameObject)); predicate?.Invoke(val); return val; } public static tk2dSpriteAnimationClip AddAnimation(this tk2dSpriteCollectionData coll, string spriteName, string animName = null, float fps = 4f, int loopStart = 0, Anchor? adjustToAnchor = null) { //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_001e: 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_0036: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //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_00a0: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) List list = ResMap.Get(spriteName, quietFailure: true); if (list == null) { return null; } tk2dSpriteAnimationClip val = new tk2dSpriteAnimationClip { name = (animName ?? spriteName), fps = fps, frames = (tk2dSpriteAnimationFrame[])(object)new tk2dSpriteAnimationFrame[list.Count], loopStart = loopStart, wrapMode = (WrapMode)((loopStart > 0) ? 1 : ((loopStart != 0) ? 2 : 0)) }; bool hasValue = adjustToAnchor.HasValue; Anchor valueOrDefault = adjustToAnchor.GetValueOrDefault(); for (int i = 0; i < list.Count; i++) { int spriteIdByName = coll.GetSpriteIdByName(list[i]); if (hasValue) { coll.spriteDefinitions[spriteIdByName].BetterConstructOffsetsFromAnchor(valueOrDefault); } val.frames[i] = new tk2dSpriteAnimationFrame { spriteId = spriteIdByName, spriteCollection = coll }; } return val; } public static bool WillDefinitelyFall(this GameActor actor) { //IL_0002: 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_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_0042: 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_007d: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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) //IL_00c0: 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_0172: Unknown result type (might be due to invalid IL or missing references) Rect val = default(Rect); ((Rect)(ref val)).min = PhysicsEngine.PixelToUnitMidpoint(((BraveBehaviour)actor).specRigidbody.PrimaryPixelCollider.LowerLeft); ((Rect)(ref val)).max = PhysicsEngine.PixelToUnitMidpoint(((BraveBehaviour)actor).specRigidbody.PrimaryPixelCollider.UpperRight); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(val); actor.ModifyPitVectors(ref val2); Dungeon dungeon = GameManager.Instance.Dungeon; bool flag = dungeon.ShouldReallyFall(Vector2.op_Implicit(((Rect)(ref val2)).min)); bool flag2 = dungeon.ShouldReallyFall(new Vector3(((Rect)(ref val2)).xMax, ((Rect)(ref val2)).yMin)); bool flag3 = dungeon.ShouldReallyFall(new Vector3(((Rect)(ref val2)).xMin, ((Rect)(ref val2)).yMax)); bool flag4 = dungeon.ShouldReallyFall(Vector2.op_Implicit(((Rect)(ref val2)).max)); bool flag5 = dungeon.ShouldReallyFall(Vector2.op_Implicit(((Rect)(ref val2)).center)); if (!(flag || flag2 || flag3 || flag4 || flag5)) { return false; } flag |= dungeon.data.isWall((int)((Rect)(ref val2)).xMin, (int)((Rect)(ref val2)).yMin); flag2 |= dungeon.data.isWall((int)((Rect)(ref val2)).xMax, (int)((Rect)(ref val2)).yMin); flag3 |= dungeon.data.isWall((int)((Rect)(ref val2)).xMin, (int)((Rect)(ref val2)).yMax); flag4 |= dungeon.data.isWall((int)((Rect)(ref val2)).xMax, (int)((Rect)(ref val2)).yMax); flag5 |= dungeon.data.isWall((int)((Rect)(ref val2)).center.x, (int)((Rect)(ref val2)).center.y); return flag && flag2 && flag3 && flag4 && flag5; } public static bool NearPit(this Vector2 pos) { //IL_0010: 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_0018: 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_0023: 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_0038: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Invalid comparison between Unknown and I4 DungeonData data = GameManager.Instance.Dungeon.data; IntVector2 val = Vector2Extensions.ToIntVector2(pos, (VectorConversions)0); IntVector2 val2 = default(IntVector2); for (int i = val.x - 1; i <= val.x + 1; i++) { for (int j = val.y - 1; j <= val.y + 1; j++) { ((IntVector2)(ref val2))..ctor(i, j); if (data.CheckInBoundsAndValid(val2)) { CellData val3 = data[val2]; if (val3 != null && (int)val3.type == 4) { return true; } } } } return false; } public static bool InBounds(this Vector2 pos, bool wallsOk = false) { //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_0007: 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_0021: 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_0038: 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_0053: 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_005f: Invalid comparison between Unknown and I4 IntVector2 val = Vector2Extensions.ToIntVector2(pos, (VectorConversions)0); DungeonData data = GameManager.Instance.Dungeon.data; if (val.x >= 0 && val.x < data.Width && val.y >= 0 && val.y < data.Height) { if (data[val] != null) { if (!wallsOk) { return (int)data[val].type != 1; } return true; } return false; } return false; } public static tk2dSpriteAnimationClip DefaultAnimation(this GameObject vfx) { return vfx.GetComponent().library.clips[0]; } public static void CallPrivate(this ILCursor cursor, Type t, string name) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) cursor.Emit(OpCodes.Call, (MethodBase)t.GetMethod(name, BindingFlags.Static | BindingFlags.NonPublic)); } public static void AddStatToGun(this Gun item, StatModifier modifier) { if (item.passiveStatModifiers == null) { item.passiveStatModifiers = (StatModifier[])(object)new StatModifier[0]; } Array.Resize(ref item.passiveStatModifiers, item.passiveStatModifiers.Length + 1); item.passiveStatModifiers[item.passiveStatModifiers.Length - 1] = modifier; } public static Gun UpdateAnimationFPS(this Gun gun, string animation, int fps) { GunExt.SetAnimationFPS(gun, animation, fps); return gun; } public static void PlayIfNotPlaying(this tk2dSpriteAnimator animator, string anim) { if (!animator.IsPlaying(anim)) { animator.Play(anim); } } public static T IncreaseLootChance(this T pickup, int pickupId, float multiplier) where T : PickupObject { //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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown PickupObject val = (PickupObject)(object)pickup; if (val.associatedItemChanceMods == null) { val.associatedItemChanceMods = (LootModData[])(object)new LootModData[0]; } int num = ((PickupObject)pickup).associatedItemChanceMods.Length; Array.Resize(ref ((PickupObject)pickup).associatedItemChanceMods, num + 1); ((PickupObject)pickup).associatedItemChanceMods[num] = new LootModData { AssociatedPickupId = pickupId, DropRateMultiplier = multiplier }; return pickup; } public static T IncreaseLootChance(this T pickup, Type pickupType, float multiplier) where T : PickupObject { _UnresolvedLootChances.Add(new UnresolvedLootData { pickup = (PickupObject)(object)pickup, type = pickupType, multiplier = multiplier }); return pickup; } internal static void ResolveModdedLootChances(this GameManager gm) { //IL_004e: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown foreach (UnresolvedLootData unresolvedLootChance in _UnresolvedLootChances) { PickupObject pickup; PickupObject obj = (pickup = unresolvedLootChance.pickup); if (pickup.associatedItemChanceMods == null) { pickup.associatedItemChanceMods = (LootModData[])(object)new LootModData[0]; } int num = obj.associatedItemChanceMods.Length; Array.Resize(ref obj.associatedItemChanceMods, num + 1); obj.associatedItemChanceMods[num] = new LootModData { AssociatedPickupId = Lazy.PickupId(unresolvedLootChance.type), DropRateMultiplier = unresolvedLootChance.multiplier }; } _UnresolvedLootChances.Clear(); } public static bool HeadingTowardPlayer(this Projectile proj, PlayerController player) { //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_0013: 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_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) if (!(proj.Direction == Vector2.zero)) { return Vector2Extensions.ToAngle(proj.Direction).IsNearAngle(Vector2Extensions.ToAngle(((GameActor)player).CenterPosition - proj.SafeCenter), 90f); } return true; } public static float LazyInverseLerp(this Vector2 c, Vector2 a, Vector2 b) { //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_000f: 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_0016: Unknown result type (might be due to invalid IL or missing references) Vector2 val = c - a; float sqrMagnitude = ((Vector2)(ref val)).sqrMagnitude; val = b - a; return Mathf.Sqrt(sqrMagnitude / ((Vector2)(ref val)).sqrMagnitude); } public static GameObject MakeChainLightingVFX(this GameObject vfx) { GameObject obj = ((Component)Game.Items["shock_rounds"]).GetComponent().ChainLightningVFX.ClonePrefab(deactivate: false); obj.GetComponent().Library = vfx.GetComponent().Library; obj.GetComponent().DefaultClipId = vfx.GetComponent().DefaultClipId; ((tk2dBaseSprite)obj.GetComponent()).SetSprite(vfx.DefaultAnimation().frames[0].spriteCollection, vfx.DefaultAnimation().frames[0].spriteId); return obj; } public static tk2dSpriteDefinition CopyMaterialProps(this tk2dSpriteDefinition def, Material mat) { Texture mainTexture = def.material.mainTexture; def.material.CopyPropertiesFromMaterial(mat); def.material.mainTexture = mainTexture; def.material.shader = mat.shader; return def; } public static GameObject GetRandomChestRewardOfQuality(this PlayerController player, ItemQuality quality) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) RewardManager rewardManager = GameManager.Instance.RewardManager; return rewardManager.GetItemForPlayer(player, Lazy.CoinFlip() ? rewardManager.ItemsLootTable : rewardManager.GunsLootTable, quality, (List)null, false, (Random)null, false, (List)null, false, (RewardSource)0); } public static bool Mastered(this Projectile proj, bool mustBeActiveGun = false) where T : CwaffGun { if (!Object.op_Implicit((Object)(object)proj)) { return false; } GameActor owner = proj.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val == null) { return false; } if (!mustBeActiveGun) { return val.GetGun()?.Mastered ?? false; } Gun currentGun = ((GameActor)val).CurrentGun; if (currentGun == null) { return false; } return ((Component)currentGun).gameObject.GetComponent()?.Mastered ?? false; } public static void ResetPiercing(this Projectile p, bool resetHitCount = true) { p.m_hasPierced = false; if (resetHitCount) { p.m_healthHaverHitCount = 0; } } public static float SpriteRadius(this AIActor enemy) { //IL_002b: 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).sprite)) { return -1f; } return 0.5f * ((BraveBehaviour)enemy).sprite.GetCurrentSpriteDef().boundsDataExtents.MaxComponent(); } public static float SpritePixelRadius(this AIActor enemy) { //IL_002b: 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).sprite)) { return -1f; } return 8f * ((BraveBehaviour)enemy).sprite.GetCurrentSpriteDef().boundsDataExtents.MaxComponent(); } public static float MaxComponent(this Vector2 v) { //IL_0000: 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) return Mathf.Max(v.x, v.y); } public static float MaxComponent(this Vector3 v) { //IL_0008: 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_001a: Unknown result type (might be due to invalid IL or missing references) return Mathf.Max(new float[3] { v.x, v.y, v.z }); } public static void OverrideHat(this PlayerController player, Hat newHat, bool doPoof = true) { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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) HatController component = ((Component)player).gameObject.GetComponent(); if (component == null) { return; } Hat val = HatUtility.CurrentHat(player); if (val != null) { if (_HatOverrides[player.PlayerIDX].Count == 0) { _OriginalHat[player.PlayerIDX] = val.hatName; } if (_OriginalHat[player.PlayerIDX] != newHat.hatName && !_HatOverrides[player.PlayerIDX].Contains(newHat.hatName)) { _HatOverrides[player.PlayerIDX].Add(newHat.hatName); } } else { _HatOverrides[player.PlayerIDX].Add(newHat.hatName); } component.SetHat(newHat); if (doPoof) { LootEngine.DoDefaultItemPoof(((BraveBehaviour)player).sprite.WorldBottomCenter + new Vector2(0f, 1f), false, false); } } public static void ClearHatOverride(this PlayerController player, Hat hatToRemove, bool doPoof = true) { //IL_00b9: 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_00cd: Unknown result type (might be due to invalid IL or missing references) HatController component = ((Component)player).gameObject.GetComponent(); if (component != null && _HatOverrides[player.PlayerIDX].Remove(hatToRemove.hatName)) { Hat currentHat = component.CurrentHat; if (currentHat != null && currentHat.hatName == hatToRemove.hatName) { component.RemoveCurrentHat(); } string text = null; if (_HatOverrides[player.PlayerIDX].Count > 0) { text = _HatOverrides[player.PlayerIDX].Last(); } else { text = _OriginalHat[player.PlayerIDX]; _OriginalHat[player.PlayerIDX] = null; } if (text != null && Hatabase.Hats.TryGetValue(HatUtility.GetDatabaseFriendlyHatName(text), out var value)) { component.SetHat(value); } if (doPoof) { LootEngine.DoDefaultItemPoof(((BraveBehaviour)player).sprite.WorldBottomCenter + new Vector2(0f, 1f), false, false); } } } public static void DoPostProcessBeamSafe(this PlayerController player, BeamController beam) { ((MonoBehaviour)player).StartCoroutine(DoPostProcessBeamSafe_CR(player, beam)); static IEnumerator DoPostProcessBeamSafe_CR(PlayerController val, BeamController val2) { yield return null; if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val2)) { val.DoPostProcessBeam(val2); } } } public static Vector2 WorldCenterRight(this tk2dBaseSprite sprite) { //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_0012: 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: 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) return Vector3Extensions.XY(((BraveBehaviour)sprite).transform.position) + sprite.GetRelativePositionFromAnchor((Anchor)5).Rotate(((BraveBehaviour)sprite).transform.eulerAngles.z); } public static Vector2 WorldCenterLeft(this tk2dBaseSprite sprite) { //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_0012: 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: 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) return Vector3Extensions.XY(((BraveBehaviour)sprite).transform.position) + sprite.GetRelativePositionFromAnchor((Anchor)3).Rotate(((BraveBehaviour)sprite).transform.eulerAngles.z); } public static Gun AddDualWieldSynergy(this Gun gun, Synergy dualWieldSynergy) { //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_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) if (!_UnresolvedDualWields.TryGetValue(dualWieldSynergy, out var value)) { _UnresolvedDualWields[dualWieldSynergy] = gun; return gun; } DualWieldSynergyProcessor obj = ((Component)gun).gameObject.AddComponent(); obj.SynergyToCheck = dualWieldSynergy.Synergy(); obj.PartnerGunID = ((PickupObject)value).PickupObjectId; DualWieldSynergyProcessor obj2 = ((Component)value).gameObject.AddComponent(); obj2.SynergyToCheck = dualWieldSynergy.Synergy(); obj2.PartnerGunID = ((PickupObject)gun).PickupObjectId; _UnresolvedDualWields.Remove(dualWieldSynergy); return gun; } public static void StopFiringImmediately(this PlayerController pc) { BraveInput instanceForPlayer = BraveInput.GetInstanceForPlayer(pc.PlayerIDX); if (instanceForPlayer == null) { return; } while (instanceForPlayer.GetButtonDown((GungeonActionType)8)) { instanceForPlayer.ConsumeButtonDown((GungeonActionType)8); if (instanceForPlayer.GetButtonUp((GungeonActionType)8)) { instanceForPlayer.ConsumeButtonUp((GungeonActionType)8); } } if (instanceForPlayer.GetButton((GungeonActionType)8)) { instanceForPlayer.ConsumeAll((GungeonActionType)8); } } public static int GetFlagCount(this PlayerController pc, Type flag) { if (PassiveItem.ActiveFlagItems.TryGetValue(pc, out var value)) { if (!value.TryGetValue(flag, out var value2)) { return 0; } return value2; } return 0; } public static IEnumerable Children(this Transform t) { int numChildren = t.childCount; int i = 0; while (i < numChildren) { yield return t.GetChild(i); int num = i + 1; i = num; } } public static Projectile RemoveAnimator(this Projectile proj) { tk2dSprite componentInChildren = ((Component)proj).gameObject.GetComponentInChildren(); GameObject gameObject = ((Component)componentInChildren).gameObject; tk2dSpriteAnimator component = gameObject.GetComponent(); tk2dSpriteAnimationFrame val = component.DefaultClip.frames[0]; ((tk2dBaseSprite)componentInChildren).SetSprite(val.spriteCollection, val.spriteId); Object.DestroyImmediate((Object)(object)component); Object.DestroyImmediate((Object)(object)gameObject.GetComponent()); return proj; } public static void SetAmmoAndClearUICache(this Gun gun, int newAmmo) { gun.CurrentAmmo = 0; GameActor owner = gun.m_owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null) { GameUIAmmoController ammoControllerForPlayerID = GameUIRoot.Instance.GetAmmoControllerForPlayerID(val.PlayerIDX); for (int i = 0; i < ammoControllerForPlayerID.m_cachedModuleShotsRemaining.Count; i++) { ammoControllerForPlayerID.m_cachedModuleShotsRemaining[i] = 0; } } } public static T BanFromCoop(this T item) where T : PickupObject { EncounterTrackable encounterTrackable = ((BraveBehaviour)(object)item).encounterTrackable; if (encounterTrackable == null) { return item; } EncounterTrackable val = encounterTrackable; if (val.m_prerequisites == null) { val.m_prerequisites = (DungeonPrerequisite[])(object)new DungeonPrerequisite[0]; } int num = encounterTrackable.m_prerequisites.Length; Array.Resize(ref encounterTrackable.m_prerequisites, num + 1); encounterTrackable.m_prerequisites[num] = (DungeonPrerequisite)(object)new CwaffPrerequisite { prerequisite = CwaffPrerequisites.NOT_COOP_MODE_PREREQUISITE }; return item; } public static void AllowFallingIntoPits(this GameObject g) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) DebrisObject orAddComponent = GameObjectExtensions.GetOrAddComponent(g); orAddComponent.accurateDebris = false; orAddComponent.PreventFallingInPits = false; orAddComponent.animatePitFall = true; orAddComponent.Trigger(Vector3.zero, 0f, 0f); } public static string SafeEncounterNameOrDisplayName(this PickupObject pickup) { if (!Object.op_Implicit((Object)(object)pickup) || !Object.op_Implicit((Object)(object)((Component)pickup).gameObject)) { return string.Empty; } EncounterTrackable component = ((Component)pickup).gameObject.GetComponent(); if (component != null) { string modifiedDisplayName = component.GetModifiedDisplayName(); if (modifiedDisplayName != null && !string.IsNullOrEmpty(modifiedDisplayName)) { return modifiedDisplayName.Replace("\n", " "); } } return (pickup.itemName ?? string.Empty).Replace("\n", " "); } public static string IfNullOrEmpty(this string s, string defaultString) { if (string.IsNullOrEmpty(s)) { return defaultString; } return s; } public static Vector2 GoopToWorldPosition(this IntVector2 goopPos) { //IL_0008: 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_0021: 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) float gOOP_GRID_SIZE = DeadlyDeadlyGoopManager.GOOP_GRID_SIZE; return ((IntVector2)(ref goopPos)).ToVector2() * gOOP_GRID_SIZE + new Vector2(0.5f * gOOP_GRID_SIZE, 0.5f * gOOP_GRID_SIZE); } public static IntVector2 WorldToGoopPosition(this Vector2 worldPos) { //IL_0000: 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_000c: Unknown result type (might be due to invalid IL or missing references) return Vector2Extensions.ToIntVector2(worldPos / DeadlyDeadlyGoopManager.GOOP_GRID_SIZE, (VectorConversions)2); } public static float SmoothRotateTo(this float oldRotation, float newRotation, float r, float t = 0.5f) { float num = oldRotation.RelAngleTo(newRotation); if (Mathf.Abs(num) < t) { return newRotation; } return (oldRotation + Lazy.SmoothestLerp(0f, num, r)).Clamp360(); } public static Projectile DefaultProjectile(this Items gunid) { PickupObject byId = PickupObjectDatabase.GetById((int)gunid); return ((Gun)((byId is Gun) ? byId : null)).DefaultModule.projectiles[0]; } public static ParticleSystem SetColor(this ParticleSystem ps, Color c) { //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_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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0023: 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_002e: 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_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_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_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_0083: 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_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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00c8: 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_0123: Unknown result type (might be due to invalid IL or missing references) MainModule main = ps.main; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(c); Gradient val = new Gradient(); val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(c, 0f), new GradientColorKey(c, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[5] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(0.5f, 0.25f), new GradientAlphaKey(0.15f, 0.5f), new GradientAlphaKey(0.01f, 0.75f), new GradientAlphaKey(1f, 1f) }); ColorOverLifetimeModule colorOverLifetime = ps.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val); ParticleSystemRenderer component = ((Component)ps).gameObject.GetComponent(); ((Renderer)component).material.SetFloat("_InvFade", 3f); ((Renderer)component).material.SetFloat("_EmissionGain", 0.1f); ((Renderer)component).material.SetColor("_EmissionColor", c); ((Renderer)component).material.SetColor("_DiffuseColor", c); ((Renderer)component).sortingLayerName = "Foreground"; return ps; } [Conditional("DEBUG")] public static void DrawDebugHitbox(this SpeculativeRigidbody body, Color? color = null, Color? color2 = null) { //IL_0112: 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_0109: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_017d: 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_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: 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_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) Transform val = ((Component)body).gameObject.transform.Find("debug hitbox rectangle"); if (val == null) { val = ((Component)Geometry.Create(Geometry.Shape.RECTANGLE)).gameObject.transform; ((Object)((Component)val).gameObject).name = "debug hitbox rectangle"; val.parent = ((Component)body).gameObject.transform; } Transform val2 = ((Component)body).gameObject.transform.Find("debug hitbox hline"); if (val2 == null) { val2 = ((Component)Geometry.Create(Geometry.Shape.LINE)).gameObject.transform; ((Object)((Component)val2).gameObject).name = "debug hitbox hline"; val2.parent = ((Component)body).gameObject.transform; } Transform val3 = ((Component)body).gameObject.transform.Find("debug hitbox vline"); if (val3 == null) { val3 = ((Component)Geometry.Create(Geometry.Shape.LINE)).gameObject.transform; ((Object)((Component)val3).gameObject).name = "debug hitbox vline"; val3.parent = ((Component)body).gameObject.transform; } PixelCollider primaryPixelCollider = body.PrimaryPixelCollider; ((Component)val).gameObject.GetComponent().Place((Color)(((??)color) ?? Vector3Extensions.WithAlpha(Color.magenta, 0.5f)), dfVectorExtensions.Quantize(primaryPixelCollider.UnitTopLeft, 0.0625f, (VectorConversions)2), dfVectorExtensions.Quantize(primaryPixelCollider.UnitBottomRight, 0.0625f, (VectorConversions)2)); Vector2 val4 = Vector2.op_Implicit(val.parent.position); ((Component)val2).gameObject.GetComponent().Place((Color)(((??)color2) ?? Vector3Extensions.WithAlpha(Color.cyan, 0.5f)), val4 + Vector2.left, val4 + Vector2.right); ((Component)val3).gameObject.GetComponent().Place((Color)(((??)color2) ?? Vector3Extensions.WithAlpha(Color.cyan, 0.5f)), val4 + Vector2.down, val4 + Vector2.up); } [Conditional("DEBUG")] public static void DebugColliders(this SpeculativeRigidbody body) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < body.PixelColliders.Count; i++) { PixelCollider val = body.PixelColliders[i]; Console.WriteLine($" collider {i} enabled {val.Enabled} | mode {val.ColliderGenerationMode} | x {val.ManualOffsetX} | y {val.ManualOffsetY} | w {val.ManualWidth} | h {val.ManualHeight}"); } } public static Vector2 ZeroIfNan(this Vector2 v) { //IL_0000: 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_0024: 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_001a: Unknown result type (might be due to invalid IL or missing references) if (!float.IsNaN(v.x) && !float.IsNaN(v.y)) { return v; } return default(Vector2); } public static void Set(this GungeonFlags flag) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) GameStatsManager.Instance.SetFlag(flag, true); } public static void Unset(this GungeonFlags flag) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) GameStatsManager.Instance.SetFlag(flag, false); } public static bool Get(this GungeonFlags flag) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return GameStatsManager.Instance.GetFlag(flag); } public static void Set(this CharacterSpecificGungeonFlags flag) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) GameStatsManager.Instance.SetCharacterSpecificFlag(flag, true); } public static void Unset(this CharacterSpecificGungeonFlags flag) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) GameStatsManager.Instance.SetCharacterSpecificFlag(flag, false); } public static bool Get(this CharacterSpecificGungeonFlags flag) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return GameStatsManager.Instance.GetCharacterSpecificFlag(flag); } public static void OffsetAllFrames(this tk2dSpriteAnimationClip clip, Vector2 offset) { //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) tk2dSpriteAnimationFrame[] frames = clip.frames; foreach (tk2dSpriteAnimationFrame val in frames) { val.spriteCollection.spriteDefinitions[val.spriteId].ShiftBy(Vector2.op_Implicit(offset)); } } public static IEnumerator PhaseOut(this tk2dBaseSprite sprite, Vector2 direction, float amplitude, float frequency, float lifetime) { //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) Material mat = ((BraveBehaviour)sprite).renderer.material; for (float elapsed = 0f; elapsed < lifetime; elapsed += BraveTime.DeltaTime) { mat.SetFloat("_Fade", 1f - elapsed / lifetime); Transform transform = ((BraveBehaviour)sprite).transform; transform.position += Vector2Extensions.ToVector3ZUp(amplitude * Mathf.Sin(frequency * elapsed) * BraveTime.DeltaTime * direction, 0f); yield return null; } Object.Destroy((Object)(object)((Component)sprite).gameObject); } public static void ApplyShader(this tk2dBaseSprite sprite, Shader shader, Texture2D optionalPalette = null) { sprite.usesOverrideMaterial = true; Material material = ((BraveBehaviour)sprite).renderer.material; material.shader = shader; bool flag = (Object)(object)optionalPalette != (Object)null; material.SetFloat("_UsePalette", flag ? 1f : 0f); if (flag) { material.SetTexture("_PaletteTex", (Texture)(object)optionalPalette); } } public static IntVector2 QuantizeRound(this IntVector2 v, int scale) { //IL_0000: 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_0020: Unknown result type (might be due to invalid IL or missing references) return new IntVector2(Mathf.RoundToInt((float)(v.x / scale)) * scale, Mathf.RoundToInt((float)(v.y / scale)) * scale); } public static IntVector2 QuantizeTileRound(this Vector2 v, int scale) { //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_0007: 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) return Vector2Extensions.ToIntVector2(dfVectorExtensions.FloorToInt(v), (VectorConversions)2).QuantizeRound(scale); } public static void ApplyContinuousSourcedKnockback(this AIActor enemy, GameObject source, Dictionary activeKbs, Vector2 velocity, bool overwrite = false) { //IL_0014: 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_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_0061: 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_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_0056: 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_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) KnockbackDoer knockbackDoer = ((BraveBehaviour)enemy).knockbackDoer; if (knockbackDoer == null) { return; } float magnitude = ((Vector2)(ref velocity)).magnitude; ActiveKnockbackData val = knockbackDoer.ApplySourcedKnockback(velocity, magnitude, source, false); ActiveKnockbackData value; if (val != null) { activeKbs[enemy] = val; } else if (activeKbs.TryGetValue(enemy, out value)) { Vector2 val2 = ((Vector2)(ref velocity)).normalized * (magnitude / (knockbackDoer.weight / 10f)); if (overwrite) { value.knockback = val2; } else { value.knockback = Lazy.MaxMagnitude(value.knockback, val2); } value.initialKnockback = value.knockback; value.elapsedTime = 0f; } } public static void CleanupKnockbackData(this Dictionary kbDict) { foreach (KeyValuePair item in kbDict) { if (!Object.op_Implicit((Object)(object)item.Key)) { _DeadKeys.Add(item.Key); } } foreach (AIActor deadKey in _DeadKeys) { kbDict.Remove(deadKey); } _DeadKeys.Clear(); } public static tk2dSprite DecoupleSpriteFromCollider(this SpeculativeRigidbody body) { //IL_0011: 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) tk2dSprite component = ((Component)body).gameObject.GetComponent(); tk2dSprite obj = new GameObject("decoupled sprite").AddComponent(); ((tk2dBaseSprite)obj).SetSprite(((tk2dBaseSprite)component).hasOffScreenCachedUpdate ? ((tk2dBaseSprite)component).offScreenCachedCollection : ((tk2dBaseSprite)component).collection, ((tk2dBaseSprite)component).hasOffScreenCachedUpdate ? ((tk2dBaseSprite)component).offScreenCachedID : ((tk2dBaseSprite)component).spriteId); ((BraveBehaviour)obj).renderer.material.shader = ((BraveBehaviour)component).renderer.material.shader; ((BraveBehaviour)component).renderer.enabled = false; ((BraveBehaviour)obj).transform.position = ((BraveBehaviour)component).transform.position; ((BraveBehaviour)obj).transform.parent = ((BraveBehaviour)component).transform; return obj; } public static void OverrideShader(this tk2dBaseSprite sprite, Shader shader, Texture2D optionalPalette = null) { sprite.usesOverrideMaterial = true; Material material = ((BraveBehaviour)sprite).renderer.material; material.shader = shader; if ((Object)(object)optionalPalette != (Object)null) { material.SetFloat("_UsePalette", 1f); material.SetTexture("_PaletteTex", (Texture)(object)optionalPalette); } } public static bool InDifferentRoomThanOwner(this CompanionController companionController) { //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_003e: 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) AIActor aiActor = ((BraveBehaviour)companionController).aiActor; if (aiActor == null) { return false; } Vector2 centerPosition = ((GameActor)aiActor).CenterPosition; PlayerController owner = companionController.m_owner; if (owner != null) { RoomHandler currentRoom = owner.CurrentRoom; if (currentRoom != null) { return currentRoom != Vector3Extensions.GetAbsoluteRoom(centerPosition); } } return !GameManager.Instance.MainCameraController.PointIsVisible(centerPosition, 0.4f); } public static Vector2 GetRandomPointOnBody(this AIActor enemy) { //IL_0015: 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_003a: 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_004d: 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) if (!Object.op_Implicit((Object)(object)enemy) || !Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).sprite)) { return Vector2.zero; } SpeculativeRigidbody specRigidbody = ((BraveBehaviour)enemy).specRigidbody; if (specRigidbody == null || specRigidbody.HitboxPixelCollider == null) { return ((GameActor)enemy).CenterPosition; } Vector2 unitCenter = specRigidbody.HitboxPixelCollider.UnitCenter; Bounds bounds = ((BraveBehaviour)enemy).sprite.GetBounds(); return unitCenter + Lazy.RandomVector(((Bounds)(ref bounds)).extents.x * Random.Range(0.15f, 0.5f)); } public static float AimAngleFromCenterOfScreen(this PlayerController player) { //IL_004f: 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_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_006b: 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_0071: 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_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_001a: 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_0026: Unknown result type (might be due to invalid IL or missing references) if (!player.IsKeyboardAndMouse()) { Vector2 vector = ((TwoAxisInputControl)player.m_activeActions.Aim).Vector; if (vector != Vector2.zero) { return Vector2Extensions.ToAngle(vector); } return Vector2Extensions.ToAngle(Vector3Extensions.XY(player.m_cachedAimDirection)); } CameraController mainCameraController = GameManager.Instance.MainCameraController; Vector2 val = 0.5f * (mainCameraController.MinVisiblePoint + mainCameraController.MaxVisiblePoint); return Vector2Extensions.ToAngle(Vector3Extensions.XY(player.unadjustedAimPoint) - val); } public static void RemoveDeadKeys(this Dictionary self) where K : MonoBehaviour { foreach (K key in self.Keys) { if (!Object.op_Implicit((Object)(object)key)) { _TempBehavs.Add((MonoBehaviour)(object)key); } } foreach (MonoBehaviour tempBehav in _TempBehavs) { self.Remove((K)(object)((tempBehav is K) ? tempBehav : null)); } _TempBehavs.Clear(); } public static T GetMinimum(this List self, Func lessThan) { if (self.Count == 0) { return default(T); } T val = self[0]; for (int i = 1; i < self.Count; i++) { val = (lessThan(self[i], val) ? self[i] : val); } return val; } public static Vector2 Endpoint(this BasicBeamController beam) { //IL_0001: 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_000c: 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_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) Vector2 origin = ((BeamController)beam).Origin; Vector2 direction = ((BeamController)beam).Direction; return origin + ((Vector2)(ref direction)).normalized * beam.m_currentBeamDistance; } public static T[] GetBackingArray(this List list) { return (T[])typeof(List).GetField("_items", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(list); } public static void ClearTableSlides(this PlayerController player) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) player.m_dodgeRollState = (DodgeRollState)3; player.m_hasFiredWhileSliding = false; player.TablesDamagedThisSlide.Clear(); player.IsSlidingOverSurface = false; player.m_dodgeRollTimer = 0f; player.ToggleHandRenderers(true, "dodgeroll"); player.ToggleGunRenderers(true, "dodgeroll"); player.m_handlingQueuedAnimation = false; } public static void DoSwingVFX(this Gun gun, bool reverse = false) { //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_0010: 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) Vector2 val = Vector2.op_Implicit(gun.SecondaryHandAttachPoint.position); for (int i = 0; i < 9; i++) { tk2dBaseSprite val2 = ((BraveBehaviour)gun).sprite.DuplicateInWorld(null, copyShader: true); float num = (reverse ? ((float)i * 20f) : (180f - (float)i * 20f)); ((BraveBehaviour)val2).transform.RotateAround(Vector2.op_Implicit(val), Vector3.forward, val2.FlipY ? (0f - num) : num); float num2 = 0.35f * ((float)(i + 1) / 9f); ((Component)val2).gameObject.ExpireIn(num2, num2); } } public static tk2dSpriteAnimationClip DodgeRollClipForDirection(this PlayerController player, Vector2 direction) { //IL_0000: 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_0018: Unknown result type (might be due to invalid IL or missing references) if (Mathf.Abs(direction.x) < 0.1f) { return ((BraveBehaviour)player).spriteAnimator.GetClipByName(((!(direction.y > 0.1f)) ? "dodge" : "dodge_bw") + ((!player.UseArmorlessAnim) ? string.Empty : "_armorless")); } return ((BraveBehaviour)player).spriteAnimator.GetClipByName(((!(direction.y > 0.1f)) ? "dodge_left" : "dodge_left_bw") + ((!player.UseArmorlessAnim) ? string.Empty : "_armorless")); } public static Vector2 ClosestPointOnCollider(this Vector2 pos, PixelCollider collider) { //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_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_0025: 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_0031: 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) Vector2 unitBottomLeft = collider.UnitBottomLeft; Vector2 unitTopRight = collider.UnitTopRight; return new Vector2(Mathf.Clamp(pos.x, unitBottomLeft.x, unitTopRight.x), Mathf.Clamp(pos.y, unitBottomLeft.y, unitTopRight.y)); } private static Dictionary BuildPitMap(RoomHandler room) { //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_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_0068: 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_0087: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Invalid comparison between Unknown and I4 //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Invalid comparison between Unknown and I4 //IL_00be: 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_00e3: 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) //IL_00ec: 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_00f6: 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_0114: 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_012b: Unknown result type (might be due to invalid IL or missing references) Dictionary dictionary = (_PitMaps[room] = new Dictionary()); Dictionary dictionary3 = dictionary; int num = 0; int num2 = 0; DungeonData data = GameManager.Instance.Dungeon.data; CellData[][] cellData = data.cellData; foreach (IntVector2 roomCell in room.roomCells) { if (dictionary3.ContainsKey(roomCell)) { continue; } dictionary3[roomCell] = -1; _FrontierCells.AddLast(roomCell); int num3 = 0; while (_FrontierCells.First != null) { IntVector2 value = _FrontierCells.First.Value; _FrontierCells.RemoveFirst(); CellData obj = cellData[value.x][value.y]; if ((int)obj.type == 4) { num++; } if ((int)obj.type != 2) { continue; } dictionary3[value] = num2; num3++; IntVector2[] cardinals = IntVector2.Cardinals; foreach (IntVector2 val in cardinals) { IntVector2 val2 = value + val; if (data.CheckInBounds(val2.x, val2.y) && room.rawRoomCells.Contains(val2) && !dictionary3.ContainsKey(val2)) { dictionary3[val2] = -1; _FrontierCells.AddLast(val2); } } } if (num3 > 0) { num2++; } } _PitCounts[room] = num; return dictionary3; } public static bool SeparatedByPit(this RoomHandler room, Vector2 a, Vector2 b) { //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_001d: 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_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_0034: Unknown result type (might be due to invalid IL or missing references) if (!_PitMaps.TryGetValue(room, out var value)) { value = BuildPitMap(room); } IntVector2 key = Vector2Extensions.ToIntVector2(a, (VectorConversions)0); IntVector2 key2 = Vector2Extensions.ToIntVector2(b, (VectorConversions)0); if (!value.TryGetValue(key, out var value2)) { return true; } if (!value.TryGetValue(key2, out var value3)) { return true; } return value2 != value3; } public static float GetPitCoverage(this RoomHandler room) { if (!_PitMaps.TryGetValue(room, out var value)) { value = BuildPitMap(room); } return (float)_PitCounts[room] / (float)room.roomCells.Count; } public static void AddMultiple(this List list, T item, int count) { for (int num = count; num > 0; num--) { list.Add(item); } } public static bool IsUnclearedCombatRoom(this RoomHandler room) { if (room == null || !room.EverHadEnemies || room.activeEnemies == null) { return false; } for (int i = 0; i < room.activeEnemies.Count; i++) { if (Object.op_Implicit((Object)(object)room.activeEnemies[i]) && !room.activeEnemies[i].IgnoreForRoomClear) { return true; } } return false; } public static int EstimateValue(this Chest chest) { LootData lootTable = chest.lootTable; if (lootTable == null) { return 3; } float num = lootTable.S_Chance + lootTable.A_Chance + lootTable.B_Chance + lootTable.C_Chance + lootTable.D_Chance; if (num == 0f) { return 3; } int num2 = Mathf.RoundToInt((5f * lootTable.S_Chance + 4f * lootTable.A_Chance + 3f * lootTable.B_Chance + 2f * lootTable.C_Chance + 1f * lootTable.D_Chance) / num); if (num2 <= 0) { return 3; } return num2; } public static GameActorEffect GetEffectBetter(this AIActor actor, EffectResistanceType resistanceType) { //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_0018: Expected I4, but got Unknown //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) string text = (resistanceType - 1) switch { 1 => "poison", 0 => "fire", 2 => "freeze", 3 => "charm", _ => string.Empty, }; for (int i = 0; i < ((GameActor)actor).m_activeEffects.Count; i++) { if (((GameActor)actor).m_activeEffects[i].resistanceType == resistanceType || ((GameActor)actor).m_activeEffects[i].effectIdentifier == text) { return ((GameActor)actor).m_activeEffects[i]; } } return null; } } public class Kevlar { private class PreventMultipleInsuranceShopSpawns : MonoBehaviour { private void Start() { _SpawnedThisRun = true; } } private class UpdateInsuranceSpritesToMatchCharacter : MonoBehaviour { private void Start() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)((Component)this).gameObject) || !Object.op_Implicit((Object)(object)((Component)this).gameObject.transform)) { return; } Transform parent = ((Component)this).gameObject.transform.parent; if (parent == null) { return; } foreach (Transform item in parent) { Transform val = item; if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)((Component)val).gameObject)) { continue; } CustomShopItemController[] componentsInChildren = ((Component)val).gameObject.GetComponentsInChildren(); if (componentsInChildren == null || componentsInChildren.Length == 0) { continue; } CustomShopItemController[] array = componentsInChildren; foreach (CustomShopItemController val2 in array) { if (val2.item is InsurancePolicy) { ((BraveBehaviour)val2).sprite.SetSprite(InsurancePolicy.GetSpriteIdForCharacter()); } } } } } internal static bool _SpawnedThisRun; public static void Init() { //IL_00c0: 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_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_00ef: 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_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) CwaffEvents.OnCleanStart = (Action)Delegate.Combine(CwaffEvents.OnCleanStart, (Action)delegate { _SpawnedThisRun = false; }); List shopItems = new List { Lazy.PickupId() }; bool flag = CwaffConfig._Gunfig.Value("Shop Spawning Behaviour") == "Classic"; List moddedItems = new List(); float spawnChanceEachRun = (flag ? 1f : 0.33f); FancyShopBuilder.SpawnCondition prequisiteValidator = (flag ? new FancyShopBuilder.SpawnCondition(PlayerHasGoodItem) : null); int? idleFps = 2; int? talkFps = 8; Vector3? talkPointOffset = Vector2.op_Implicit(0.0625f * new Vector2(26f, 66f)); Vector3? npcPosition = Vector2.op_Implicit(0.0625f * new Vector2(37f, 80f)); List itemPositions = ShopAPI.defaultItemPositions.ShiftAll(Vector2.op_Implicit(0.0625f * new Vector2(22f, 20f))); bool exactlyOncePerRun = !flag; List genericDialog = new List { "Hath ye no desire to be heir to yourself? For a price, I will make it so.", "Ye hath died before, as willt ye soon again. Maketh it, then, into a profitable affair!", "I ply ye to sign a contract. Idle talk procures no favours." }; List stopperDialog = new List { "Hath ye no desire to be heir to yourself? For a price, I will make it so.", "Ye hath died before, as willt ye soon again. Maketh it, then, into a profitable affair!", "I ply ye to sign a contract. Idle talk procures no favours." }; List purchaseDialog = new List { "Suffer me not to wait!", "Thankee, ye gentleman... or gentlewoman?", "We shall meet again, when ye art a worm's nest.", "No need for foppish forms. A deal struck is a deal honoured.", "God buy ye! ...Lest I might.", "Fare thee well.", "Pray remember me." }; List stolenDialog = new List { "A pick-purse!", "Begone with thine practices, foul shifter!", "Go your ways, caitiff!", "Go your ways, thy foul dandy-pratt!", "I baffle thine robberies!" }; List noSaleDialog = new List { "I cry ye mercy? Ye hath not the balsam for this trade.", "Crave not what ye cannot afford.", "Be no addle-pot.", "Fallen upon ebb-waters, I see?", "I accept no fiddler's pay." }; List introDialog = new List { "Greetings, fellow well-met.", "Good morrow.", "Be at peace!" }; List attackedDialog = new List { "Cease this senseless affray!", "Returneth to the bedlam from whence thou came!", "Caitiff!", "Idle hussy!", "Cur! Dog-bolt!", "Sirrah! Cease this at once!", "Hell and devil confound thee!" }; FancyShopData fancyShopData = FancyShopBuilder.MakeFancyShop("kevlar", shopItems, "CwaffingTheGungy/Resources/Rooms/insurance.newroom", moddedItems, spawnChanceEachRun, null, idleFps, talkFps, loopTalk: false, CwaffPrerequisites.INSURANCE_PREREQUISITE, prequisiteValidator, null, genericDialog, stopperDialog, purchaseDialog, stolenDialog, noSaleDialog, introDialog, attackedDialog, allowDupes: true, allowExcluded: true, 0f, talkPointOffset, npcPosition, itemPositions, exactlyOncePerRun, 127, 1f, canBeRobbed: true, flipTowardsPlayer: false); fancyShopData.AddParentedAnimationToShopFixed(ResMap.Get("kevlar_bow"), 8f, "purchase"); fancyShopData.AddParentedAnimationToShopFixed(ResMap.Get("kevlar_offended"), 8f, "stolen"); fancyShopData.SetShotAnimation(ResMap.Get("kevlar_offended"), 8f); fancyShopData.shop.AddComponent(); fancyShopData.shop.AddComponent(); } private static bool PlayerHasGoodItem(SpawnConditions conds) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Invalid comparison between Unknown and I4 //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Invalid comparison between Unknown and I4 //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Invalid comparison between Unknown and I4 if (_SpawnedThisRun) { return false; } if (CwaffPrerequisite.OnFirstFloor(conds)) { return false; } foreach (PickupObject item in GameManager.Instance.PrimaryPlayer.AllItems()) { if ((int)item.quality == 5 || (int)item.quality == 4) { return true; } } if ((int)GameManager.Instance.CurrentGameType != 1) { return false; } foreach (PickupObject item2 in GameManager.Instance.SecondaryPlayer.AllItems()) { if ((int)item2.quality == 5 || (int)item2.quality == 4) { return true; } } return false; } } public class Cammy { internal static GenericLootTable _CompanionTable; public static void Init() { //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) List shopItems = new List { 300, 492, 249, 632, 442, 645, 301, 664, 818, 318, 461, 451, 491, 232, 607, 572, 580, 338 }; List moddedItems = new List { "nn:molotov_buddy", "nn:baby_good_chance_kin", "nn:potto", "nn:peanut", "nn:dark_prince", "nn:diode", "nn:drone", "nn:greg_the_egg", "nn:fun_guy", "nn:baby_good_det", "nn:angry_spirit", "nn:gusty", "nn:scroll_of_exact_knowledge", "nn:lil_munchy", "nn:hapulon", "nn:cubud", "kp:penguin", "kp:blue_balloon", "kp:b.f.o.", "kp:squire", "kp:baby_good_cannon_kin", "ck:pet_rock", "ck:guunther", "ex:baby_good_hammer", "ex:baby_sitter", "kts:baby_good_blob", "kts:capture_sphere", "lg:strange_root", "bb:baby_good_shellicopter", "psog:baby_good_candle", "ski:baby_good_dodogama", "cg:amethyst_shard", "cg:scalding_jelly", "cg:chew_toy" }; bool flag = CwaffConfig._Gunfig.Value("Shop Spawning Behaviour") == "Classic"; float spawnChanceEachRun = (flag ? 1f : 0.33f); int allowedTilesets = (flag ? 2 : 127); FancyShopBuilder.SpawnCondition spawnCondition = (flag ? new FancyShopBuilder.SpawnCondition(CwaffPrerequisite.OnFirstFloor) : null); int? num = 6; int? num2 = 4; FancyShopData obj = FancyShopBuilder.MakeFancyShop(talkPointOffset: Vector2.op_Implicit(0.0625f * new Vector2(19f, 52f)), npcPosition: Vector2.op_Implicit(0.0625f * new Vector2(0f, 44f)), carpetOffset: 0.0625f * new Vector2(-23f, 0f), idleFps: num, talkFps: num2, loopTalk: true, spawnPrerequisite: CwaffPrerequisites.COMPANION_SHOP_PREREQUISITE, prequisiteValidator: spawnCondition, voice: null, itemPositions: ShopAPI.defaultItemPositions.ShiftAll(Vector2.op_Implicit(0.0625f * new Vector2(-25f, 0f))), npcName: "cammy", shopItems: shopItems, roomPath: "CwaffingTheGungy/Resources/Rooms/petshop.newroom", moddedItems: moddedItems, spawnChanceEachRun: spawnChanceEachRun, genericDialog: new List { "Aren't they just precious!?", "Bunch of cuties these ones!", "Just look at them!" }, stopperDialog: new List { "Aren't they just precious!?", "Bunch of cuties these ones!", "Just look at them!" }, purchaseDialog: new List { "I'm sure you'll take great care of them! :D", "They look happy to be with you! :D", "Thank you so much friend! :D" }, stolenDialog: null, noSaleDialog: new List { "Ah you're a bit short on shells.", "I wish I could just give them away, but I have little mouths to feed!", "Sorry friend. D:" }, introDialog: new List { "Please consider adopting one of these beautiful babies!", "Lots of lovely little companions looking for a home!", "Welcome to the companion shop!" }, attackedDialog: new List { "Please be careful!!!", "Yikes!!!", "Aahhhh!!!" }, allowDupes: false, allowExcluded: false, mainPoolChance: 0f, exactlyOncePerRun: true, allowedTilesets: allowedTilesets, costModifier: 0.7f, canBeRobbed: false, flipTowardsPlayer: false); _CompanionTable = obj.loot; obj.AddParentedAnimationToShopFixed(ResMap.Get("cammy_excited"), 10f, "purchase"); obj.AddParentedAnimationToShopFixed(ResMap.Get("cammy_sad"), 4f, "denied"); obj.AddParentedAnimationToShopFixed(ResMap.Get("cammy_sad"), 4f, "stolen"); } } public class Bart { internal static GenericLootTable _BarterTable; internal const float _BARTER_RADIUS = 6f; internal const float _BARTER_RADIUS_SQR = 36f; public static void Init() { //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) //IL_00e2: 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_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_0125: 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) CwaffEvents.OnAllModsLoaded = (Action)Delegate.Combine(CwaffEvents.OnAllModsLoaded, new Action(SetupBarterTable)); List shopItems = new List(); List moddedItems = new List(); "#BARTER_SHOP_SIGN".SetupDBStrings(new List { "HOW TO BARTER:\n\ndrop an item whose quality is\nat least the quality shown on\nthe item you wish to trade for." }); bool flag = CwaffConfig._Gunfig.Value("Shop Spawning Behaviour") == "Classic"; float spawnChanceEachRun = (flag ? 1f : 0.33f); int allowedTilesets = (flag ? 17 : 127); FancyShopBuilder.SpawnCondition prequisiteValidator = (flag ? new FancyShopBuilder.SpawnCondition(OnSecondOrThirdFloor) : null); int? idleFps = 6; int? talkFps = 6; Vector3? talkPointOffset = Vector2.op_Implicit(0.0625f * new Vector2(32f, 51f)); Vector3? npcPosition = Vector2.op_Implicit(0.0625f * new Vector2(-15f, 76f)); List itemPositions = ShopAPI.defaultItemPositions.ShiftAll(Vector2.op_Implicit(0.0625f * new Vector2(-25f, 16f))); List genericDialog = new List { "My trash is your treasure.", "Finders keepers.", "Not one for small talk." }; List stopperDialog = new List { "My trash is your treasure.", "Finders keepers.", "Not one for small talk." }; List purchaseDialog = new List { "Been a pleasure.", "Have a good one.", "Done deal." }; List stolenDialog = new List { "I'll remember that.", "Hope you're happy.", "That's not yours." }; List noSaleDialog = new List { "Give me something better.", "Not interested.", "For that?" }; List introDialog = new List { "I'll take that off your hands.", "Let's make a deal.", "What do you have for me?" }; List attackedDialog = new List { "Rude.", "Please stop.", "Enough." }; Func customCanBuy = CanBarterWithItemOnGround; Func removeCurrency = DestroyBarteredItem; Func customPrice = GetPriceFromQuality; Func onPurchase = OnPurchase; Func onSteal = OnSteal; FancyShopData fancyShopData = FancyShopBuilder.MakeFancyShop("bart", shopItems, "CwaffingTheGungy/Resources/Rooms/barter.newroom", moddedItems, spawnChanceEachRun, null, idleFps, talkFps, loopTalk: true, CwaffPrerequisites.BARTER_SHOP_PREREQUISITE, prequisiteValidator, null, genericDialog, stopperDialog, purchaseDialog, stolenDialog, noSaleDialog, introDialog, attackedDialog, allowDupes: false, allowExcluded: false, 0f, talkPointOffset, npcPosition, itemPositions, exactlyOncePerRun: true, allowedTilesets, 1f, canBeRobbed: true, flipTowardsPlayer: false, customCanBuy, removeCurrency, customPrice, onPurchase, onSteal); _BarterTable = fancyShopData.loot; fancyShopData.SetShotAnimation(ResMap.Get("bart_shot"), 1f); fancyShopData.shop.AddComponent(); fancyShopData.shop.AddComponent(); } public static bool OnSecondOrThirdFloor(SpawnConditions conds) { string dungeonSceneName = GameManager.Instance.GetLastLoadedLevelDefinition().dungeonSceneName; if (dungeonSceneName == "tt5") { return true; } if (dungeonSceneName == "tt_mines") { return true; } return false; } internal static void SetupBarterTable() { foreach (PickupObject @object in ((ObjectDatabase)(object)PickupObjectDatabase.Instance).Objects) { if (Object.op_Implicit((Object)(object)@object)) { int num = @object.QualityGrade(); if (num >= 1 && num != 5 && !@object.ShouldBeExcludedFromShops) { LootUtility.AddItemToPool(_BarterTable, @object.PickupObjectId, 1f); } } } } internal static PickupObject ExactlyOneBarterableItemNearby(PlayerController player) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) PickupObject val = null; foreach (IPlayerInteractable unassignedInteractableObject in RoomHandler.unassignedInteractableObjects) { if (unassignedInteractableObject is ShopItemController) { continue; } PickupObject val2 = (PickupObject)(object)((unassignedInteractableObject is PickupObject) ? unassignedInteractableObject : null); if (val2 != null && Object.op_Implicit((Object)(object)val2) && ((Behaviour)val2).isActiveAndEnabled && Object.op_Implicit((Object)(object)((Component)val2).gameObject) && ((Component)val2).gameObject.activeInHierarchy && val2.CanBeSold && Object.op_Implicit((Object)(object)((BraveBehaviour)val2).sprite) && Vector3Extensions.GetAbsoluteRoom(((BraveBehaviour)val2).sprite.WorldCenter) == player.CurrentRoom) { if ((Object)(object)val != (Object)null) { return null; } val = val2; } } return val; } internal static bool CanBarterWithItemOnGround(CustomShopController shop, PlayerController player, int price) { PickupObject val = ExactlyOneBarterableItemNearby(player); if (val == null) { return false; } CustomShopItemController targetedItemByPlayer = shop.GetTargetedItemByPlayer(player); if (targetedItemByPlayer == null) { return false; } if (player.HasActive()) { return val.QualityGrade() >= targetedItemByPlayer.item.QualityGrade(); } return val.QualityGrade() > targetedItemByPlayer.item.QualityGrade(); } internal static int DestroyBarteredItem(CustomShopController shop, PlayerController player, int price) { //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) PickupObject val = ExactlyOneBarterableItemNearby(player); if (val == null) { return 0; } RoomHandler.unassignedInteractableObjects.Remove((IPlayerInteractable)(object)((val is IPlayerInteractable) ? val : null)); Lazy.DoSmokeAt(Vector2.op_Implicit(((BraveBehaviour)val).sprite.WorldCenter)); Object.Destroy((Object)(object)((Component)val).gameObject); return 0; } internal static int GetPriceFromQuality(CustomShopController shop, CustomShopItemController item, PickupObject pickup) { return 1; } internal static bool OnPurchase(PlayerController player, PickupObject pickup, int price) { return false; } internal static bool OnSteal(PlayerController player, PickupObject pickup, int price) { return false; } } public class BarterShopController : MonoBehaviour { private static readonly List _ExtantShops = new List(); private CustomShopController _shop; private void Start() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) _shop = ((Component)this).GetComponent(); foreach (IPlayerInteractable interactableObject in Vector3Extensions.GetAbsoluteRoom(((BraveBehaviour)_shop).transform.position).interactableObjects) { Component val = (Component)(object)((interactableObject is Component) ? interactableObject : null); if (val != null && ((Object)val.gameObject).name.Contains("Sign")) { val.gameObject.GetComponent().TemporarilyInvulnerable = true; break; } } _ExtantShops.Add(this); UpdatePrices(); } private void OnDestroy() { _ExtantShops.Remove(this); } public static void UpdateBarterShopPrices() { foreach (BarterShopController extantShop in _ExtantShops) { extantShop.UpdatePrices(); } } private void UpdatePrices() { //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_004b: 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: Expected I4, but got Unknown bool flag = Lazy.AnyoneHasActive(); foreach (ShopItemController itemController in ((BaseShopController)_shop).m_itemControllers) { CustomShopItemController val = (CustomShopItemController)(object)((itemController is CustomShopItemController) ? itemController : null); if (val != null && Object.op_Implicit((Object)(object)val.item)) { ItemQuality quality = val.item.quality; switch (quality - 1) { case 3: val.customPriceSprite = (flag ? "barter_a_icon" : "barter_s_icon"); break; case 2: val.customPriceSprite = (flag ? "barter_b_icon" : "barter_a_icon"); break; case 1: val.customPriceSprite = (flag ? "barter_c_icon" : "barter_b_icon"); break; case 0: val.customPriceSprite = (flag ? "barter_d_icon" : "barter_c_icon"); break; } } } } } public class Don : FancyNPC { private enum State { FIRST_MEETING_EVER, FIRST_MEETING_RUN, LATER_MEETING_RUN, READY_FOR_PIZZA_TIME, ENEMIES_ON_FLOOR, INCAPABLE_OF_DELIVERY, COOP_MODE, NEED_FULL_MAP, PIZZA_TIME_FAILED, PIZZA_TIME_PARTIAL, PIZZA_TIME_SUCCESS, PIZZA_TIME_TIMEOUT, PIZZA_TIME_RUINED, NO_DELIVERIES_FINISHED, SOME_DELIVERIES_FINISHED, ALL_DELIVERIES_FINISHED } private const float _DON_CHANCE_PER_RUN = 0.06f; private static int _EncountersThisRun = 0; private bool _talked; private bool _didCheckin; private RoomHandler _room; public static FancyNPC _NPC; private static readonly List> _EntryStrings = new List>(6) { new Tuple("Exactly 7 pepperonis per quadrant...good, good.", "idle"), new Tuple("Mushrooms sliced to precisely 35 millimeters thick...good, good.", "idle"), new Tuple("Pizza sauce heated in a medium saucepan for 8 minutes at 91 degrees centigrade...good, good.", "idle"), new Tuple("Cheese melted until hue is fulvous with a 0.1% margin of error...good, good.", "idle"), new Tuple("This cheese is AMBER, it's supposed to be FULVOUS!", "shout"), new Tuple("These acute folds will never do. They're called pizza BOXES not pizza SQUARE FRUSTUMS!", "shout") }; public static void Init() { //IL_0162: Unknown result type (might be due to invalid IL or missing references) _NPC = FancyNPC.Setup("don", new List { "don_idle", "don_talk", "don_gesture", "don_shout", "don_cry", "don_celebrate" }).GetComponent(); _NPC.SetAnimationFPS("talk", 6f); _NPC.SetAnimationFPS("gesture", 6f); _NPC.SetAnimationFPS("shout", 9f); _NPC.lockCamera = true; _NPC.defaultAudioEvents = new List(3) { "don_voice_1", "don_voice_2", "don_voice_3" }; _NPC.voiceRate = 0.1f; _NPC.alwaysReturnToIdle = false; VFX.Create("pizza_box_decor", 2f, loops: true, -1, 1f, (Anchor)1, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1).RegisterEasyRATPlaceable("pizza_box"); PrototypeDungeonRoom room = FancyShopBuilder.BuildNewRoomFromResourceWithoutRegistering("CwaffingTheGungy/Resources/Rooms/pizza.newroom").room; SetUpDonsRoom(room, forDomino: false); SetUpDonsRoom(room, forDomino: true); } private static void SetUpDonsRoom(PrototypeDungeonRoom donRoom, bool forDomino) { string text = (forDomino ? "Don's Other Pizza Shop Room" : "Don's Pizza Shop Room"); FancyShopBuilder.InjectRoomIntoUniquePool(donRoom, text, new List { (FlowModifierPlacementType)1 }, 0f, new List(1) { (DungeonPrerequisite)(object)new CwaffPrerequisite { prerequisite = (forDomino ? CwaffPrerequisites.HAVE_DOMINO.SetupPrerequisite(CwaffPrerequisite.HaveDomino) : CwaffPrerequisites.NO_DOMINO.SetupPrerequisite(CwaffPrerequisite.NoHaveDomino)) } }, text, 1f, forDomino ? 1f : 0.06f, forDomino ? null : ((Component)_NPC).gameObject, 0f, 3.25f, !forDomino, (forDomino || !C.DEBUG_BUILD) ? 127 : 2); } protected override void Start() { //IL_0012: 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_002d: Unknown result type (might be due to invalid IL or missing references) base.Start(); ((BraveBehaviour)this).transform.position = dfVectorExtensions.Quantize(((BraveBehaviour)this).transform.position, 0.0625f); List componentsInRoom = (_room = Vector3Extensions.GetAbsoluteRoom(((BraveBehaviour)this).transform.position)).GetComponentsInRoom(); for (int num = componentsInRoom.Count - 1; num >= 0; num--) { MinorBreakable val = componentsInRoom[num]; if (!(((Object)((Component)val).gameObject).name != "Kitchen_Counter(Clone)")) { val.OnlyBrokenByCode = true; } } PizzaTimeController._DonNPC = this; CwaffEvents.OnChangedRooms = (Action)Delegate.Combine(CwaffEvents.OnChangedRooms, new Action(OnChangedRooms)); } private void OnChangedRooms(PlayerController controller, RoomHandler oldRoom, RoomHandler newRoom) { PizzaTimeController.CheckAnyRoomsStillOccupied(); if (newRoom == _room) { Tuple val = _EntryStrings.ChooseRandom(); ShowText(val.First, 3f); SetAnimation(val.Second); } } public override void OnDestroy() { CwaffEvents.OnChangedRooms = (Action)Delegate.Remove(CwaffEvents.OnChangedRooms, new Action(OnChangedRooms)); ((BraveBehaviour)this).OnDestroy(); } private static void ClearEncountersThisRun() { CwaffEvents.OnCleanStart = (Action)Delegate.Remove(CwaffEvents.OnCleanStart, new Action(ClearEncountersThisRun)); _EncountersThisRun = 0; } private State DetermineTalkingState(PlayerController interactor) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 if ((int)GameManager.Instance.CurrentGameType == 1) { return State.COOP_MODE; } bool num = (int)CustomTrackedStats.ENCOUNTERED_DON.Get() == 0; bool flag = _EncountersThisRun == 0; bool flag2 = !_talked; if (flag2) { CustomTrackedStats.ENCOUNTERED_DON.Increment(); } if (++_EncountersThisRun == 1) { CwaffEvents.OnCleanStart = (Action)Delegate.Remove(CwaffEvents.OnCleanStart, new Action(ClearEncountersThisRun)); CwaffEvents.OnCleanStart = (Action)Delegate.Combine(CwaffEvents.OnCleanStart, new Action(ClearEncountersThisRun)); } _talked = true; if (num) { return State.FIRST_MEETING_EVER; } if (flag) { return State.FIRST_MEETING_RUN; } if (flag2) { return State.LATER_MEETING_RUN; } if (PizzaTimeController._PizzaTimeHappening) { if (PizzaTimeController._CurDeliveries == 0) { return State.NO_DELIVERIES_FINISHED; } if (PizzaTimeController._CurDeliveries == PizzaTimeController._MaxDeliveries) { return State.ALL_DELIVERIES_FINISHED; } return State.SOME_DELIVERIES_FINISHED; } if (PizzaTimeController._PizzaTimeAttemptedThisFloor) { if (PizzaTimeController._RuinedEquipment) { return State.PIZZA_TIME_RUINED; } if (PizzaTimeController._CurDeliveries == 0) { return State.PIZZA_TIME_FAILED; } if (PizzaTimeController._TimerExpired) { return State.PIZZA_TIME_TIMEOUT; } if (PizzaTimeController._CurDeliveries == PizzaTimeController._MaxDeliveries) { return State.PIZZA_TIME_SUCCESS; } return State.PIZZA_TIME_PARTIAL; } if (interactor.IsGunLocked || interactor.inventory.GunLocked.Value) { return State.INCAPABLE_OF_DELIVERY; } if (!GameManager.Instance.Dungeon.AllRoomsVisited) { return State.NEED_FULL_MAP; } if (PizzaTimeController.CheckAnyRoomsStillOccupied()) { return State.ENEMIES_ON_FLOOR; } return State.READY_FOR_PIZZA_TIME; } private IEnumerator ScriptFIRST_MEETING_EVER() { yield return Converse("UNACCEPTABLE!", "shout"); yield return Converse("9 PEPPERONIS IN ONE QUADRANT?! THAT'S THE DEVIL'S WORK!", "shout"); yield return Converse("...", "idle"); yield return Converse("...*sniff*...why can't anyone follow a simple pizza recipe?", "cry"); yield return Converse("Oh...oh a customer!", "cry"); yield return Converse("Wait...no...you're not here to order are you?", "idle"); yield return Converse("Actually, i don't believe we've met before.", "idle"); yield return Converse("Mi name is Don Mino, but most people around here call mi Papa Don.", "idle"); yield return Converse("And this...this is mi pizza kitchen.", "idle"); yield return Converse("Mi beautiful pizza kitchen.", "cry"); yield return Converse("...*sniff*...", "cry"); yield return Converse("...ahem, excuse mi for getting a touch emotional.", "cry"); yield return Converse("If you'll allow an old man to tell a story.", "cry"); yield return Converse("Ever since i was a little boi, i've always dreamed of opening mi own pizza kitchen.", "talk", "gesture"); yield return Converse("Mi father owned a pizza kitchen,", "talk", "gesture"); yield return Converse("and his father owned a pizza kitchen,", "talk", "gesture"); yield return Converse("and HIS father owned a pizza kitchen,", "talk", "gesture"); yield return Converse("and HIS father...", "talk", "gesture"); yield return Converse("...well, he was actually a leatherworker, but that's besides the point...", "talk", "gesture"); yield return Converse("...because HIS father owned a pizza kitchen!", "shout"); yield return Converse("Pizza making is in mi blood, don't you see?", "talk", "gesture"); yield return Converse("Alas...nobody here seems to share mi passion for the pizzas.", "cry"); yield return Converse("Not a single soul I've hired has shown the art of pizza crafting the care and respect it deserves.", "cry"); yield return Converse("Just the other day, i had to fire someone for grating cheese incorrectly.", "talk", "gesture"); yield return Converse("They grated the mozzarella cheese with the parmasean cheese grater.", "talk", "gesture"); yield return Converse("CAN YOU BELIEVE IT?! THE PARMASEAN GRATER.", "shout"); yield return Converse("Getting trace shreds of parmasean on a pristine mozzarella brick prior to baking, why...", "talk", "gesture"); yield return Converse("...it ruins the entire integrity of the cheese foundation.", "cry"); yield return Converse("...*sniff*...anyway...", "cry"); yield return Converse("As you can see I'm a little short-staffed at the moment.", "idle"); yield return Converse("I can manage the pizza-making mi self, but the deliveries...oh, the Gungeon's a dangerous place for a simple pizza maker like mi.", "idle"); yield return Converse("I've never held any weapon strong than a pizza peel in my life, and the Gundead are swarming everywhere!", "idle"); yield return Converse("Although...", "idle"); yield return Converse("...", "idle"); yield return Converse("...between you and mi, the Bullet Kin are mi best customers!", "idle"); yield return Converse("They won't come anywhere near mi shop while their cohorts are around, but they love to order delivery while off duty.", "idle"); yield return Converse("Since I'm needed in here making the pizzas, I rely on help from adventurers like yourself to make sure mi pizzas make their way to stomachs in need.", "idle"); yield return Converse("BUT!", "talk", "gesture"); yield return GiveInstructions(); } private IEnumerator ScriptFIRST_MEETING_RUN() { yield return Converse("Oh, welcome back, mi slightly inept protege.", "idle"); yield return Converse("Do you need a refresher on the art of pizza delivery?", "idle"); yield return Prompt("Nope.", "Yes please."); if (PromptResult() == 0) { yield return PrepareForPizzaTime(); } else { yield return GiveInstructions(); } } private IEnumerator ScriptLATER_MEETING_RUN() { yield return Converse("Ah, mi protege", "idle"); yield return Converse("The Bullet Kin are unusually hungry today. Which means there is much pizza to be made and delivered!", "idle"); yield return PrepareForPizzaTime(); } private IEnumerator ScriptREADY_FOR_PIZZA_TIME() { yield return Converse("Well then....", "idle"); yield return Converse("There are poor, hungry Bullet Kin out there, counting on us...", "idle"); yield return Converse("...counting on YOU...", "talk", "gesture"); yield return Converse("...to deliver them fresh, hot, immaculately crafted pizza at a reasonable price.", "idle"); yield return Converse("Can I count on you to perform this sacred duty, mi protege?", "idle"); yield return Prompt("Not right now.", "Of course!"); if (PromptResult() == 1) { yield return Converse("Wonderful!", "idle"); yield return Converse("Your shift starts...", "idle"); yield return Converse("10 SECONDS AGO...GET MOVING!", "shout"); PizzaTimeController.StartPizzaTime(Interactor()); } else { yield return Converse("THEN GET OUTTA MI KITCHEN! I HAVE PIZZAS TO MAKE!", "shout"); } Reset(); } private IEnumerator ScriptENEMIES_ON_FLOOR() { yield return Converse("I'm afraid the Gundead are still on duty, which means there's nobody to order mi pizzas.", "idle"); yield return Converse("Come back once they've all been dealt with!", "talk", "gesture"); Reset(); } private IEnumerator ScriptINCAPABLE_OF_DELIVERY() { yield return Converse("It doesn't seem like you're capable of holding a pizza peel at the moment.", "idle"); yield return Converse("Come back once you're prepared to wield the sacred instrument!", "talk", "gesture"); Reset(); } private IEnumerator ScriptNEED_FULL_MAP() { yield return Converse("That look in your eyes tells me you have incomplete knowledge of your delivery route.", "idle"); yield return Converse("Come back once you've learned the lay of the land!", "talk", "gesture"); Reset(); } private IEnumerator ScriptCOOP_MODE() { yield return Converse("I'm not looking for multiple pizza deliverers right now.", "idle"); yield return Converse("Come back once you're by yourself!", "talk", "gesture"); Reset(); } private IEnumerator ScriptPIZZA_TIME_FAILED() { if (!_didCheckin) { yield return Converse("...", "idle"); yield return Converse("...", "idle"); yield return Converse("YOU THINK PIZZA DELIVERY IS SOME KIND OF GAME!", "shout"); yield return Converse("Every day I labor tirelessly over a hot oven to make the finest pizzas this Gungeon has ever seen.", "cry"); yield return Converse("And YOU!", "shout"); yield return Converse("YOU let EVERY SINGLE ONE of them go to waste!", "shout"); yield return Converse("Get out of my kitchen! NOW!", "shout"); Interactor().IncreaseCurse(3f); _didCheckin = true; } else { yield return Converse("Get out of my kitchen! NOW!", "shout"); } } private IEnumerator ScriptPIZZA_TIME_PARTIAL() { if ((float)PizzaTimeController._CurDeliveries / (float)PizzaTimeController._MaxDeliveries >= 0.5f) { yield return BonusDialogue(); } else { yield return Converse("Please...leave me be....", "cry"); } } private IEnumerator ScriptPIZZA_TIME_SUCCESS() { yield return BonusDialogue(); } private IEnumerator ScriptPIZZA_TIME_TIMEOUT() { if (!_didCheckin) { yield return Converse("Well well well, if it isn't mi sluggish protege. You certainly took your time delivering all of those pizzas.", "talk", "gesture"); yield return Converse("And you couldn't even be bothered to return for equipment polishing and inspection?", "cry"); yield return Converse("The labor for refurbishing that equipment is coming out of your wages!", "shout"); _didCheckin = true; } yield return Converse("Until next time, mi slothlike protege.", "talk", "gesture"); } private IEnumerator ScriptPIZZA_TIME_RUINED() { if (!_didCheckin) { yield return Converse("YOU FOOL! YOU'VE SOILED MI PIZZA DELIVERY EQUIPMENT!", "talk", "shout"); yield return Converse("It's going to take ages to get those scuff marks out of the peel.", "cry"); yield return Converse("The labor for refurbishing that equipment is coming out of your wages!", "shout"); _didCheckin = true; } yield return Converse("Until next time, mi careless protege.", "talk", "gesture"); } private IEnumerator ScriptNO_DELIVERIES_FINISHED() { yield return Converse("WHY ARE YOU STILL HERE?! PERFORM YOUR SACRED DUTY!", "shout"); Reset(); } private IEnumerator ScriptSOME_DELIVERIES_FINISHED() { yield return Converse("Have you finished your route?"); yield return Prompt("Not yet.", "I'm done!"); if (PromptResult() == 0) { yield return Converse("THEN GET BACK OUT THERE AND PERFORM YOUR SACRED DUTY!", "shout"); Reset(); } else { yield return ReturnToPost(); } } private IEnumerator ScriptALL_DELIVERIES_FINISHED() { PizzaTimeController.EndPizzaTime(); yield return Converse("Wonderful, mi protege!", "celebrate"); yield return Converse("All of mi customers are satisfied.", "celebrate"); yield return Converse("I will sleep well tonight knowing all of mi customers have full bellies.", "celebrate"); yield return Converse("Take your daily wages and tips, plus this extra bonus as a personal token of thanks.", "celebrate"); PizzaTimeController.HandleDeliverySuccess(); yield return Converse("Until next time, mi protege.", "celebrate"); } private IEnumerator ScriptUNKNOWN() { yield return BonusDialogue(); } private IEnumerator GiveInstructions() { do { yield return Converse("Delivering pizzas is an art that takes a lifetime to master.", "talk", "gesture"); yield return Converse("First, the pizzas must be delivered fresh out of the oven.", "talk", "gesture"); yield return Converse("\"Thirty minutes or less\"?! Even five minutes is far too long!", "shout"); yield return Converse("Second, the pizzas must not be touched once they are baked.", "talk", "gesture"); yield return Converse("They must be gently scooped onto a peel and flung directly to the customer's hands.", "talk", "gesture"); yield return Converse("The only one handling the pizza after it's cooked must be the one eating it!", "talk", "gesture"); yield return Converse("Finally, pizza delivery is a sacred task. It must be performed without hesitation or distraction.", "talk", "gesture"); yield return Converse("One must know the delivery route. One must commit to the delivery route. And most importantly...", "talk", "gesture"); yield return Converse("...one must RETURN from the delivery route in a timely matter for equipment inspection and polishing.", "talk", "gesture"); yield return Converse("Did you get all that?", "idle"); yield return Prompt("One more time please.", "Understood!"); } while (PromptResult() != 1); yield return PrepareForPizzaTime(); } private IEnumerator ReturnToPost() { PizzaTimeController.EndPizzaTime(); float num = (float)PizzaTimeController._CurDeliveries / (float)PizzaTimeController._MaxDeliveries; if (num >= 0.9f) { yield return Converse("Well...", "idle"); yield return Converse("You missed a few customers, But at least it seems most of mi pizzas found themselves a loving stomach to call home.", "talk", "gesture"); yield return Converse("Take your daily wages and tips.", "idle"); PizzaTimeController.HandleDeliverySuccess(); yield return Converse("Until next time, mi relatively ineffective protege.", "talk", "gesture"); Reset(); } else if (num >= 0.5f) { yield return Converse("Well...", "idle"); yield return Converse("You missed far too many customers, which is completely unacceptable!", "shout"); yield return Converse("So many wasted pizzas with nowhere to call home.", "cry"); yield return Converse("Take your daily wages and be off!", "shout"); PizzaTimeController.HandleDeliverySuccess(); yield return Converse("Until next time, mi highly ineffective protege.", "talk", "gesture"); Reset(); } else { yield return Converse("*sniff*", "cry"); yield return Converse("You've sullied the entire profession of pizza delivery.", "cry"); yield return Converse("Mi pizzas have no home. Mi disappointment has no words.", "cry"); yield return Converse("Please...leave me be....", "cry"); PizzaTimeController.HandleDeliverySuccess(); } } private IEnumerator PrepareForPizzaTime() { PlayerController val = Interactor(); if (val.IsGunLocked || val.inventory.GunLocked.Value) { yield return ScriptINCAPABLE_OF_DELIVERY(); } else if (!Lazy.AllRoomsVisited()) { yield return ScriptNEED_FULL_MAP(); } else if (PizzaTimeController.CheckAnyRoomsStillOccupied()) { yield return ScriptENEMIES_ON_FLOOR(); } else { yield return ScriptREADY_FOR_PIZZA_TIME(); } } private IEnumerator BonusDialogue() { switch (Random.Range(0, 3)) { case 0: yield return Converse("Sometimes I think the Gungeon may not have been the best place to open mi pizza kitchen.", "idle"); yield return Converse("But it was very affordable, and at the very least, it's much better than the last place I rented.", "idle"); yield return Converse("The owner was never there, the lighting was horrendous, and there were these scary animatronics that I swear moved around when you weren't looking.", "idle"); yield return Converse("Truly terrifying.", "cry"); break; case 1: yield return Converse("Anyone can come up with a pizza recipe, but do you know what the real secret ingredients are to a perfect pizza?", "talk", "gesture"); yield return Converse("Blood, sweat, and tears!", "shout"); yield return Converse("Specificially...", "idle"); yield return Converse("Three milliliters of blood in the pizza sauce from lightly knicking one's thumb slicing the tomatoes.", "talk", "gesture"); yield return Converse("Eight droplets of sweat to give the mozzarella that extra salty taste.", "talk", "gesture"); yield return Converse("And tears from 30 seconds of light sobbing to moisten the pizza dough to the perfect consistency.", "talk", "gesture"); break; default: yield return Converse("I have many a fond memory of workin in mi father Don's pizza kitchen as a child.", "idle"); yield return Converse("...huh? Yes, mi father was also named Don. As was his father, and HIS father, and HIS father.", "idle"); yield return Converse("We were a poor family you see. We could only afford one name.", "cry"); break; } Reset(); } protected override IEnumerator NPCTalkingScript() { yield return DetermineTalkingState(Interactor()) switch { State.FIRST_MEETING_EVER => ScriptFIRST_MEETING_EVER(), State.FIRST_MEETING_RUN => ScriptFIRST_MEETING_RUN(), State.LATER_MEETING_RUN => ScriptLATER_MEETING_RUN(), State.READY_FOR_PIZZA_TIME => ScriptREADY_FOR_PIZZA_TIME(), State.ENEMIES_ON_FLOOR => ScriptENEMIES_ON_FLOOR(), State.INCAPABLE_OF_DELIVERY => ScriptINCAPABLE_OF_DELIVERY(), State.NEED_FULL_MAP => ScriptNEED_FULL_MAP(), State.COOP_MODE => ScriptCOOP_MODE(), State.PIZZA_TIME_FAILED => ScriptPIZZA_TIME_FAILED(), State.PIZZA_TIME_PARTIAL => ScriptPIZZA_TIME_PARTIAL(), State.PIZZA_TIME_SUCCESS => ScriptPIZZA_TIME_SUCCESS(), State.PIZZA_TIME_TIMEOUT => ScriptPIZZA_TIME_TIMEOUT(), State.PIZZA_TIME_RUINED => ScriptPIZZA_TIME_RUINED(), State.NO_DELIVERIES_FINISHED => ScriptNO_DELIVERIES_FINISHED(), State.SOME_DELIVERIES_FINISHED => ScriptSOME_DELIVERIES_FINISHED(), State.ALL_DELIVERIES_FINISHED => ScriptALL_DELIVERIES_FINISHED(), _ => ScriptUNKNOWN(), }; } public override float GetOverrideMaxDistance() { return 2f; } } public class C { public static readonly bool DEBUG_BUILD = false; public const string MOD_NAME = "GungeonCraft"; public const string MOD_INT_NAME = "CwaffingTheGungy"; public const string MOD_VERSION = "1.32.3"; public const string MOD_GUID = "pretzel.etg.cwaff"; public const string MOD_PREFIX = "cg"; public static readonly Color MOD_COLOR = new Color(0.67f, 1f, 0.67f); public const float PIXELS_PER_TILE = 16f; public const float PIXELS_PER_CELL = 64f; public const float FPS = 60f; public const float FRAME = 1f / 60f; public const float PIXEL_SIZE = 0.0625f; } public static class ResMap { private static Dictionary> _ResMap = new Dictionary>(); public static List Get(string resource, bool quietFailure = false) { if (_ResMap.TryGetValue(resource, out var value)) { return value; } if (!quietFailure) { ETGModConsole.Log((object)("failed to retrieve \"" + resource + "\" from resmap"), false); } return null; } public static bool Has(string resource) { return _ResMap.ContainsKey(resource); } public static List Base(this List paths) { List list = new List(); foreach (string path in paths) { list.Add(path.Substring(path.LastIndexOf("/") + 1)); } return list; } public static void Build() { Dictionary dictionary = new Dictionary(); foreach (string key2 in AtlasHelper._PackedTextures.Keys) { int num = key2.Length - 1; char c = key2[num]; if (c < '0' || c > '9') { _ResMap[key2] = new List { key2 }; continue; } int num2 = 0; int num3 = 1; while (c >= '0' && c <= '9') { num2 += num3 * (c - 48); num3 *= 10; c = key2[--num]; } if (key2[num] == '_') { num--; } string key = key2.Substring(0, num + 1); if (!dictionary.ContainsKey(key)) { dictionary[key] = new string[num2]; } if (num2 > dictionary[key].Length) { string[] array = dictionary[key]; Array.Resize(ref array, num2); dictionary[key] = array; } dictionary[key][num2 - 1] = key2; } foreach (KeyValuePair item in dictionary) { _ResMap[item.Key] = new List(item.Value); } dictionary = null; } } public static class Dissect { private static List _Bundles = new List { "shared_auto_001", "shared_auto_002", "shared_base_001", "brave_resources_001", "enemies_base_001", "encounters_base_001", "dungeons/base_castle", "dungeons/base_sewer", "dungeons/base_gungeon", "dungeons/base_cathedral", "dungeons/base_mines", "dungeons/base_resourcefulrat", "dungeons/base_catacombs", "dungeons/base_forge", "dungeons/base_bullethell" }; public static void DumpComponents(this GameObject g, bool recursive = true, int indent = 0) { ETGModConsole.Log((object)(string.Empty.PadLeft(indent) + "components in " + ((Object)g).name), false); Component[] components = g.GetComponents(typeof(object)); foreach (Component val in components) { ETGModConsole.Log((object)(" " + ((object)val).GetType().Name), false); } if (!recursive) { return; } foreach (Transform item in g.transform.Children()) { ((Component)item).gameObject.DumpComponents(recursive: true, indent + 1); } } public static void DumpFieldsAndProperties(this T o) { FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo fieldInfo in fields) { Console.WriteLine($"field {fieldInfo.Name} = {fieldInfo.GetValue(o)}"); } foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(o)) { Console.WriteLine(" prop {0} = {1}", property.Name, property.GetValue(o)); } } public static void CompareFieldsAndProperties(T o1, T o2) { FieldInfo[] fields = typeof(T).GetFields(); foreach (FieldInfo fieldInfo in fields) { try { if (fieldInfo.GetValue(o1) == null) { if (fieldInfo.GetValue(o2) != null) { goto IL_0068; } } else if (fieldInfo.GetValue(o2) == null || !fieldInfo.GetValue(o1).Equals(fieldInfo.GetValue(o2))) { goto IL_0068; } goto end_IL_001b; IL_0068: Console.WriteLine($"field {fieldInfo.Name} = {fieldInfo.GetValue(o1)} -> {fieldInfo.GetValue(o2)}"); end_IL_001b:; } catch (Exception) { Console.WriteLine(" prop {0} = {1} -> {2}", fieldInfo.Name, "ERROR", "ERROR"); } } foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(o1)) { try { if (property.GetValue(o1) == null) { if (property.GetValue(o2) != null) { goto IL_0136; } } else if (property.GetValue(o2) == null || !property.GetValue(o1).Equals(property.GetValue(o2))) { goto IL_0136; } goto end_IL_00e4; IL_0136: Console.WriteLine(" prop {0} = {1} -> {2}", property.Name, property.GetValue(o1), property.GetValue(o2)); end_IL_00e4:; } catch (Exception) { Console.WriteLine(" prop {0} = {1} -> {2}", property.Name, "ERROR", "ERROR"); } } } public static void PrintSpriteCollectionNames(tk2dSpriteCollectionData theCollection) { for (int i = 0; i < theCollection.spriteDefinitions.Length; i++) { ETGModConsole.Log((object)theCollection.spriteDefinitions[i].name, false); } } public static string DumpILInstruction(this Instruction 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) //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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 //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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Invalid comparison between Unknown and I4 //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_00b0: 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) try { return ((object)c).ToString(); } catch { } try { OpCode opCode = c.OpCode; OperandType operandType = ((OpCode)(ref opCode)).OperandType; if (((int)operandType == 0 || (int)operandType == 15) ? true : false) { object operand = c.Operand; ILLabel val = (ILLabel)((operand is ILLabel) ? operand : null); if (val != null) { object arg = c.Offset; opCode = c.OpCode; return $"IL_{arg:x4}: {((OpCode)(ref opCode)).Name} IL_{val.Target.Offset:x4}"; } } opCode = c.OpCode; if ((int)((OpCode)(ref opCode)).OperandType == 10 && c.Operand is IEnumerable source) { object arg2 = c.Offset; opCode = c.OpCode; return string.Format("IL_{0:x4}: {1} {2}", arg2, ((OpCode)(ref opCode)).Name, string.Join(", ", source.Select((ILLabel x) => x.Target.Offset.ToString("x4")).ToArray())); } } catch { } return "This shouldn't be happening"; } public static void DumpIL(this ILCursor cursor) { //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) Enumerator enumerator = cursor.Instrs.GetEnumerator(); try { while (enumerator.MoveNext()) { _ = enumerator.Current; } } finally { ((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } } public static GameObject FindDefaultResource(string name) { foreach (string bundle in _Bundles) { try { GameObject val = ResourceManager.LoadAssetBundle(bundle).LoadAsset(name); if ((Object)(object)val == (Object)null) { continue; } return val; } catch (Exception) { ETGModConsole.Log((object)("failed to load bundle " + bundle), false); } } ETGModConsole.Log((object)(" could not find asset " + name + " in any bundle!"), false); return null; } } public static class AudioResourceLoader { public unsafe static void AutoloadFromAssembly() { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) Assembly executingAssembly = Assembly.GetExecutingAssembly(); string name = executingAssembly.GetName().Name; string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); uint num3 = default(uint); foreach (string text in manifestResourceNames) { int num = text.Length - ".bnk".Length; if (text.LastIndexOf(".bnk") != num) { continue; } int num2 = text.LastIndexOf('.', num - 1) + 1; string text2 = name + ":" + text.Substring(num2, num - num2); using Stream stream = executingAssembly.GetManifestResourceStream(text); byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); fixed (byte* ptr = array) { AkSoundEngine.LoadAndDecodeBankFromMemory((IntPtr)ptr, (uint)array.Length, false, text2, false, ref num3); } } } } public static class Ease { public static float Linear(float t) { return t; } public static float InQuad(float t) { return t * t; } public static float OutQuad(float t) { return 1f - InQuad(1f - t); } public static float InOutQuad(float t) { if ((double)t < 0.5) { return InQuad(t * 2f) / 2f; } return 1f - InQuad((1f - t) * 2f) / 2f; } public static float InCubic(float t) { return t * t * t; } public static float OutCubic(float t) { return 1f - InCubic(1f - t); } public static float InOutCubic(float t) { if ((double)t < 0.5) { return InCubic(t * 2f) / 2f; } return 1f - InCubic((1f - t) * 2f) / 2f; } public static float InQuart(float t) { return t * t * t * t; } public static float OutQuart(float t) { return 1f - InQuart(1f - t); } public static float InOutQuart(float t) { if ((double)t < 0.5) { return InQuart(t * 2f) / 2f; } return 1f - InQuart((1f - t) * 2f) / 2f; } public static float InQuint(float t) { return t * t * t * t * t; } public static float OutQuint(float t) { return 1f - InQuint(1f - t); } public static float InOutQuint(float t) { if ((double)t < 0.5) { return InQuint(t * 2f) / 2f; } return 1f - InQuint((1f - t) * 2f) / 2f; } public static float InSine(float t) { return (float)(0.0 - Math.Cos((double)t * Math.PI / 2.0)); } public static float OutSine(float t) { return (float)Math.Sin((double)t * Math.PI / 2.0); } public static float InOutSine(float t) { return (float)(Math.Cos((double)t * Math.PI) - 1.0) / -2f; } public static float InExpo(float t) { return (float)Math.Pow(2.0, 10f * (t - 1f)); } public static float OutExpo(float t) { return 1f - InExpo(1f - t); } public static float InOutExpo(float t) { if ((double)t < 0.5) { return InExpo(t * 2f) / 2f; } return 1f - InExpo((1f - t) * 2f) / 2f; } public static float InCirc(float t) { return 0f - ((float)Math.Sqrt(1f - t * t) - 1f); } public static float OutCirc(float t) { return 1f - InCirc(1f - t); } public static float InOutCirc(float t) { if ((double)t < 0.5) { return InCirc(t * 2f) / 2f; } return 1f - InCirc((1f - t) * 2f) / 2f; } public static float InElastic(float t) { return 1f - OutElastic(1f - t); } public static float OutElastic(float t) { float num = 0.3f; return (float)Math.Pow(2.0, -10f * t) * (float)Math.Sin((double)(t - num / 4f) * (Math.PI * 2.0) / (double)num) + 1f; } public static float InOutElastic(float t) { if ((double)t < 0.5) { return InElastic(t * 2f) / 2f; } return 1f - InElastic((1f - t) * 2f) / 2f; } public static float InBack(float t) { float num = 1.70158f; return t * t * ((num + 1f) * t - num); } public static float OutBack(float t) { return 1f - InBack(1f - t); } public static float InOutBack(float t) { if ((double)t < 0.5) { return InBack(t * 2f) / 2f; } return 1f - InBack((1f - t) * 2f) / 2f; } public static float InBounce(float t) { return 1f - OutBounce(1f - t); } public static float OutBounce(float t) { float num = 2.75f; float num2 = 7.5625f; if (t < 1f / num) { return num2 * t * t; } if (t < 2f / num) { t -= 1.5f / num; return num2 * t * t + 0.75f; } if ((double)t < 2.5 / (double)num) { t -= 2.25f / num; return num2 * t * t + 0.9375f; } t -= 2.625f / num; return num2 * t * t + 63f / 64f; } public static float InOutBounce(float t) { if ((double)t < 0.5) { return InBounce(t * 2f) / 2f; } return 1f - InBounce((1f - t) * 2f) / 2f; } } public class TradingGuide : CwaffActive { public static string ItemName = "Trading Guide"; public static string ShortDescription = "Deal, or No Deal?"; public static string LongDescription = "Improves deals at the Barter Shop, and allows the player to barter their items at any shop. Items can be bartered by targeting a shop item, dropping an item of equal or higher quality on the ground, and using the Trading Guide."; public static string Lore = "An illustrated compendium listing the values of the various commodities found within the Gungeon, as assessed by a panel of 'independent experts.' Both the independence and expertise of these panel members are up for dispute, but what's certain is the exorbitant prices are only taken at face value by the shopowners referencing them to sell Gungeoneers a Klobbe for 56 casings."; private IPlayerInteractable _barterTargetIx; private int _barterTargetId = -1; private PickupObject _barterTarget; private PickupObject _barterOffer; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PlayerItem obj = Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)1; obj.consumable = false; ItemBuilder.SetCooldownType(obj, (CooldownType)0, 1f); } public override void Pickup(PlayerController player) { base.Pickup(player); BarterShopController.UpdateBarterShopPrices(); } public override void OnPreDrop(PlayerController player) { ((PlayerItem)this).OnPreDrop(player); BarterShopController.UpdateBarterShopPrices(); } public override void OnDestroy() { BarterShopController.UpdateBarterShopPrices(); ((PlayerItem)this).OnDestroy(); } public override bool CanBeUsed(PlayerController user) { IPlayerInteractable lastInteractionTarget = user.m_lastInteractionTarget; if (lastInteractionTarget == null) { return false; } ShopItemController val = (ShopItemController)(object)((lastInteractionTarget is ShopItemController) ? lastInteractionTarget : null); if (val != null && Object.op_Implicit((Object)(object)val.item)) { _barterTarget = val.item; } else { CustomShopItemController val2 = (CustomShopItemController)(object)((lastInteractionTarget is CustomShopItemController) ? lastInteractionTarget : null); if (val2 == null || !Object.op_Implicit((Object)(object)val2.item)) { return false; } _barterTarget = val2.item; } PickupObject val3 = Bart.ExactlyOneBarterableItemNearby(user); if (val3 == null) { return false; } if (val3.QualityGrade() < _barterTarget.QualityGrade()) { return false; } _barterTargetId = _barterTarget.PickupObjectId; _barterTargetIx = lastInteractionTarget; _barterOffer = val3; return ((PlayerItem)this).CanBeUsed(user); } public override void DoEffect(PlayerController player) { //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_barterOffer)) { return; } IPlayerInteractable barterTargetIx = _barterTargetIx; CustomShopItemController val = (CustomShopItemController)(object)((barterTargetIx is CustomShopItemController) ? barterTargetIx : null); if (val != null) { ((ShopItemController)val).pickedUp = !val.item.PersistsOnPurchase; LootEngine.GivePrefabToPlayer(((Component)val.item).gameObject, player); if (val.OnPurchase != null) { val.OnPurchase(player, val.item, 0); } if ((Object)(object)((ShopItemController)val).m_baseParentShop != (Object)null) { ((ShopItemController)val).m_baseParentShop.PurchaseItem((ShopItemController)(object)val, true, true); } player.HandleItemPurchased((ShopItemController)(object)val); if (!val.item.PersistsOnPurchase) { GameUIRoot.Instance.DeregisterDefaultLabel(((BraveBehaviour)val).transform); } AkSoundEngine.PostEvent("Play_OBJ_item_purchase_01", ((Component)val).gameObject); } else { IPlayerInteractable barterTargetIx2 = _barterTargetIx; ShopItemController val2 = (ShopItemController)(object)((barterTargetIx2 is ShopItemController) ? barterTargetIx2 : null); if (val2 != null) { val2.pickedUp = !val2.item.PersistsOnPurchase; LootEngine.GivePrefabToPlayer(((Component)val2.item).gameObject, player); if ((Object)(object)val2.m_parentShop != (Object)null) { val2.m_parentShop.PurchaseItem(val2, true, true); } if ((Object)(object)val2.m_baseParentShop != (Object)null) { val2.m_baseParentShop.PurchaseItem(val2, true, true); } player.HandleItemPurchased(val2); if (!val2.item.PersistsOnPurchase) { GameUIRoot.Instance.DeregisterDefaultLabel(((BraveBehaviour)val2).transform); } AkSoundEngine.PostEvent("Play_OBJ_item_purchase_01", ((Component)val2).gameObject); } } List unassignedInteractableObjects = RoomHandler.unassignedInteractableObjects; PickupObject barterOffer = _barterOffer; unassignedInteractableObjects.Remove((IPlayerInteractable)(object)((barterOffer is IPlayerInteractable) ? barterOffer : null)); Lazy.DoSmokeAt(Vector2.op_Implicit(((BraveBehaviour)_barterOffer).sprite.WorldCenter)); Object.Destroy((Object)(object)((Component)_barterOffer).gameObject); } } public class PogoStick : CwaffDodgeRollActiveItem { [HarmonyPatch] private static class PlayerControllerHandleGunAttachPointInternalPatch { [HarmonyPatch(typeof(PlayerController), "HandleGunAttachPointInternal")] private static void Postfix(PlayerController __instance, Gun targetGun, bool isSecondary) { //IL_0009: 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_0024: 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) Transform gunAttachPoint = __instance.gunAttachPoint; gunAttachPoint.localPosition = Vector3Extensions.WithY(gunAttachPoint.localPosition, gunAttachPoint.localPosition.y + ((BraveBehaviour)((BraveBehaviour)__instance).sprite).transform.localPosition.y); } } [HarmonyPatch(typeof(PlayerController), "AdjustInputVector")] private class PlayerControllerAdjustInputVectorPatch { private static void Postfix(PlayerController __instance, Vector2 rawInput, float cardinalMagnetAngle, float ordinalMagnetAngle, ref Vector2 __result) { //IL_001f: 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) PogoStick active = __instance.GetActive(); if (active != null && active._active && active._lastMovingDown) { __result *= active._phase; } } } [HarmonyPatch] private static class GenericIntroDoerTriggerSequencePatch { [HarmonyPatch(typeof(GenericIntroDoer), "TriggerSequence")] [HarmonyPatch(typeof(GatlingGullIntroDoer), "TriggerSequence")] private static void Prefix(PlayerController enterer) { if (Object.op_Implicit((Object)(object)enterer)) { enterer.GetActive()?.Deactivate(); } } } public static string ItemName = "Pogo Stick"; public static string ShortDescription = "Bounce Mode"; public static string LongDescription = "Rides or dismounts a pogo stick upon use. Holding the dodge roll button while riding the pogo stick charges a super bounce. Releasing the dodge roll button launches the player towards their current aim point as indicated by a targeting reticle. Landing on an enemy with a super bounce deals massive damage, triggers a mini blank effect, and rebounds the player towards their aim point with slightly reduced velocity. Grants an extra active item slot."; public static string Lore = "Rogo's trusty pogo, versatile as both a weapon and a mode of transportation. He never goes anywhere without it."; public static GameObject PogoPrefab = null; private const string POGO_ATTACH_POINT = "Pogo Attach Point"; internal PlayerController _owner; internal bool _active; internal tk2dSprite _attachedPogoSprite; internal bool _inFrontOfPlayer; private GameObject _attachedPogo; private float _bounceTimer; private PogoDodgeRoll _dodgeRoller; private static readonly Vector2 _OFFSET = new Vector2(0f, -0.5f); private float _phase; private float _lastY; private bool _lastMovingDown = true; internal PogoDodgeRoll.State _state { get { if (!Object.op_Implicit((Object)(object)_dodgeRoller)) { return PogoDodgeRoll.State.INACTIVE; } return _dodgeRoller._state; } set { if (Object.op_Implicit((Object)(object)_dodgeRoller)) { _dodgeRoller._state = value; } } } public static void Init() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) PlayerItem obj = Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore, hideFromAmmonomicon: false, 1f); ((PickupObject)obj).quality = (ItemQuality)(-100); ((PickupObject)obj).PreventStartingOwnerFromDropping = true; obj.consumable = false; ItemBuilder.SetCooldownType(obj, (CooldownType)0, 0.5f); ((Component)obj).gameObject.AddComponent(); ItemBuilder.AddPassiveStatModifier((PickupObject)(object)obj, (StatType)8, 1f, (ModifyMethod)0); PogoPrefab = VFX.Create("pogo_stick_vfx", 2f, loops: true, -1, 1f, (Anchor)1, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } public override CustomDodgeRoll CustomDodgeRoll() { if (!Object.op_Implicit((Object)(object)_dodgeRoller)) { _dodgeRoller = ((Component)this).gameObject.GetComponent(); ((CustomDodgeRoll)_dodgeRoller).IsEnabled = false; } return (CustomDodgeRoll)(object)_dodgeRoller; } public override bool CanBeUsed(PlayerController user) { if (((PlayerItem)this).CanBeUsed(user)) { return _state == PogoDodgeRoll.State.INACTIVE; } return false; } public override void Pickup(PlayerController player) { _owner = player; if (!Object.op_Implicit((Object)(object)_dodgeRoller)) { _dodgeRoller = ((Component)this).gameObject.GetComponent(); } ((CustomDodgeRoll)_dodgeRoller).IsEnabled = false; ((PlayerItem)this).Pickup(player); } public override void OnPreDrop(PlayerController player) { Deactivate(); player.OnNewFloorLoaded = (Action)Delegate.Remove(player.OnNewFloorLoaded, new Action(OnNewFloorLoaded)); _owner = null; ((PlayerItem)this).OnPreDrop(player); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)_owner)) { PlayerController owner = _owner; owner.OnNewFloorLoaded = (Action)Delegate.Remove(owner.OnNewFloorLoaded, new Action(OnNewFloorLoaded)); } Deactivate(); ((PlayerItem)this).OnDestroy(); } private void OnNewFloorLoaded(PlayerController controller) { Deactivate(); } public override void DoEffect(PlayerController player) { ((PlayerItem)this).DoEffect(player); _owner = player; if (!Object.op_Implicit((Object)(object)_dodgeRoller)) { _dodgeRoller = ((Component)this).gameObject.GetComponent(); ((CustomDodgeRoll)_dodgeRoller).IsEnabled = false; } if (_active) { Deactivate(); } else { Activate(player); } } private void Activate(PlayerController player) { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) ((BraveBehaviour)player).sprite.SpriteChanged += HandlePlayerSpriteChanged; player.OnNewFloorLoaded = (Action)Delegate.Remove(player.OnNewFloorLoaded, new Action(OnNewFloorLoaded)); player.OnNewFloorLoaded = (Action)Delegate.Combine(player.OnNewFloorLoaded, new Action(OnNewFloorLoaded)); _attachedPogo = Object.Instantiate(PogoPrefab, ((BraveBehaviour)((BraveBehaviour)player).sprite).transform); HandlePlayerSpriteChanged(((BraveBehaviour)player).sprite); _attachedPogoSprite = _attachedPogo.GetComponent(); ((tk2dBaseSprite)_attachedPogoSprite).usesOverrideMaterial = true; ((BraveBehaviour)_attachedPogoSprite).renderer.material.shader = ShaderCache.Acquire("Brave/PlayerShader"); SpriteOutlineManager.AddOutlineToSprite((tk2dBaseSprite)(object)_attachedPogoSprite, Color.black); player.AdditionalCanDodgeRollWhileFlying.AddOverride(ItemName, (float?)null); _bounceTimer = 0f; ((CustomDodgeRoll)_dodgeRoller).IsEnabled = true; _active = true; } private void Deactivate() { //IL_0044: 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) PlayerController owner = _owner; if (owner != null) { if (Object.op_Implicit((Object)(object)((BraveBehaviour)owner).sprite)) { ((BraveBehaviour)owner).sprite.SpriteChanged -= HandlePlayerSpriteChanged; ((BraveBehaviour)((BraveBehaviour)owner).sprite).transform.localPosition = Vector3Extensions.WithY(((BraveBehaviour)((BraveBehaviour)owner).sprite).transform.localPosition, 0f); } owner.AdditionalCanDodgeRollWhileFlying.RemoveOverride(ItemName); } if (Object.op_Implicit((Object)(object)_attachedPogo)) { _attachedPogo.transform.parent = null; Object.Destroy((Object)(object)_attachedPogo); } _attachedPogo = null; _attachedPogoSprite = null; if (Object.op_Implicit((Object)(object)_dodgeRoller)) { ((CustomDodgeRoll)_dodgeRoller).IsEnabled = false; } _active = false; } public override void Update() { ((PlayerItem)this).Update(); if (Object.op_Implicit((Object)(object)_owner) && ((GameActor)_owner).IsFalling) { Deactivate(); } } private void LateUpdate() { //IL_00c9: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_owner) || ((BraveBehaviour)_owner).healthHaver.IsDead) { Deactivate(); } else { if (!_active || !Object.op_Implicit((Object)(object)_attachedPogo) || !Object.op_Implicit((Object)(object)_attachedPogoSprite) || !Object.op_Implicit((Object)(object)((BraveBehaviour)_attachedPogoSprite).renderer)) { return; } if (!Object.op_Implicit((Object)(object)((BraveBehaviour)_owner).sprite) || !((BraveBehaviour)((BraveBehaviour)_owner).sprite).renderer.enabled) { ((BraveBehaviour)_attachedPogoSprite).renderer.enabled = false; return; } ((BraveBehaviour)_attachedPogoSprite).renderer.enabled = true; UpdatePogo(((BraveBehaviour)_owner).sprite); float y = ((BraveBehaviour)((BraveBehaviour)_owner).sprite).transform.localPosition.y; bool flag = y < _lastY; _lastY = y; if (flag == _lastMovingDown) { return; } _lastMovingDown = flag; if (!flag) { ((Component)_owner).gameObject.Play("rogo_bounce_sound"); if (_state == PogoDodgeRoll.State.WAITING) { _state = PogoDodgeRoll.State.CHARGING; _bounceTimer = 0f; _phase = 0f; } } } } private void HandlePlayerSpriteChanged(tk2dBaseSprite newPlayerSprite) { UpdatePogo(newPlayerSprite, updateTimer: false); } private void UpdatePogo(tk2dBaseSprite playerSprite, bool updateTimer = true) { //IL_0077: 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_00bb: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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_00f8: 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_0102: 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_0125: 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_015a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_owner) && Object.op_Implicit((Object)(object)_attachedPogo)) { if (updateTimer && _state < PogoDodgeRoll.State.CHARGING) { _bounceTimer += BraveTime.DeltaTime; _phase = Mathf.Abs(Mathf.Sin(7f * _bounceTimer)); } float num = 0.25f * _phase; if (_state != PogoDodgeRoll.State.BOUNCING) { ((BraveBehaviour)playerSprite).transform.localPosition = Vector3Extensions.WithY(((BraveBehaviour)playerSprite).transform.localPosition, num); playerSprite.UpdateZDepth(); } _inFrontOfPlayer = _owner.m_currentGunAngle > 155f || _owner.m_currentGunAngle < 25f; Vector2 val = dfVectorExtensions.Quantize(playerSprite.WorldBottomCenter, 0.0625f, (VectorConversions)1); string name = playerSprite.CurrentSprite.name; if (playerSprite.FlipX && name.Contains("back_right")) { val += new Vector2(0.0625f, 0f); } else if (!playerSprite.FlipX && name.Contains("front_right")) { val += new Vector2(0.0625f, 0f); } _attachedPogo.transform.position = Vector2Extensions.ToVector3ZisY(val + _OFFSET, _inFrontOfPlayer ? 0.85f : 1.5f); } } } public class PogoDodgeRoll : CustomDodgeRoll { internal enum State { INACTIVE, WAITING, CHARGING, BOUNCING, LANDING } [HarmonyPatch] private static class PlayerControllerGetBaseAnimationNamePatch { [HarmonyPatch(typeof(PlayerController), "GetBaseAnimationName")] [HarmonyILManipulator] private static void PlayerControllerGetBaseAnimationNameIL(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.MatchCallvirt(instr, "get_IsFlying") })) { val.Emit(OpCodes.Ldarg_0); val.CallPrivate(typeof(PlayerControllerGetBaseAnimationNamePatch), "CheckIsOnPogoStick"); } } private static bool CheckIsOnPogoStick(bool wasTrue, PlayerController player) { if (wasTrue) { return true; } return player.GetActive()?._active ?? false; } } internal State _state; private PogoStick _pogo; private PlayerController _pogoOwner; private Geometry _chargeRadius; private Geometry _chargeTarget; private StatModifier _noSpeed = ((StatType)0).Mult(0f); private int _pogoKnockbackId = -1; private bool _didStomp; private static readonly int _IgnoreCollisions = CollisionMask.LayerToMask((CollisionLayer)4, (CollisionLayer)2, (CollisionLayer)3); private static readonly int _IgnoreProjectiles = CollisionMask.LayerToMask((CollisionLayer)4); public override bool dodgesProjectiles => false; public override Priority priority => (Priority)3; public override bool canDodgeInPlace => true; public override bool lockedDirection => false; public override float bufferWindow => 0.5f; public override bool takesContactDamage => _state < State.BOUNCING; public override bool isAirborne => _state >= State.BOUNCING; public override float overrideRollDamage { get { if (_state < State.BOUNCING) { return -1f; } return 100f; } } private void EnsurePogo() { if (!Object.op_Implicit((Object)(object)_pogo) || !Object.op_Implicit((Object)(object)_pogoOwner)) { _pogo = ((Component)this).gameObject.GetComponent(); if (Object.op_Implicit((Object)(object)_pogo)) { _pogoOwner = _pogo._owner; } } } private static float GetHeight(float velocity, float gravity, float time) { return velocity * time - 0.5f * gravity * time * time; } protected override IEnumerator ContinueDodgeRoll() { EnsurePogo(); if (!Object.op_Implicit((Object)(object)_pogo) || !Object.op_Implicit((Object)(object)_pogoOwner) || _state != State.INACTIVE) { yield break; } if (!Object.op_Implicit((Object)(object)_chargeRadius)) { _chargeRadius = Geometry.Create(Geometry.Shape.FILLEDCIRCLE); } if (!Object.op_Implicit((Object)(object)_chargeTarget)) { _chargeTarget = Geometry.Create(Geometry.Shape.FILLEDCIRCLE); } _state = State.WAITING; ((CustomDodgeRoll)this)._owner.lockedDodgeRollDirection = Vector2.zero; ((CustomDodgeRoll)this)._owner.OnReceivedDamage += OnReceivedDamage; ((CustomDodgeRoll)this)._owner.ownerlessStatModifiers.AddUnique(_noSpeed); ((CustomDodgeRoll)this)._owner.stats.RecalculateStats(((CustomDodgeRoll)this)._owner, false, false); ((Component)this).gameObject.Play("ignizol_lift_sound"); float radius = 0f; Vector2 target = ((GameActor)((CustomDodgeRoll)this)._owner).CenterPosition; float vfxTimer = 0.25f; float elapsed = 0f; Vector2 val; while (((CustomDodgeRoll)this)._dodgeButtonHeld) { vfxTimer -= BraveTime.DeltaTime; if (vfxTimer < 0f) { vfxTimer = 0.25f; DoGroundParticles(((BraveBehaviour)((CustomDodgeRoll)this)._owner).sprite.WorldBottomCenter); } float num = 1f - Mathf.Clamp01(elapsed / 1.25f); radius = 12f * (1f - num * num); Vector2 centerPosition = ((GameActor)((CustomDodgeRoll)this)._owner).CenterPosition; float num2 = radius; val = Vector3Extensions.XY(((CustomDodgeRoll)this)._owner.unadjustedAimPoint) - ((BraveBehaviour)((CustomDodgeRoll)this)._owner).sprite.WorldCenter; target = centerPosition + num2 * ((Vector2)(ref val)).normalized; Geometry chargeTarget = _chargeTarget; Color? color = Vector3Extensions.WithAlpha(Color.cyan, 0.15f); Vector2? pos = target; float? radius2 = 1f; chargeTarget.Place(color, pos, null, radius2); yield return null; elapsed += BraveTime.DeltaTime; } ((CustomDodgeRoll)this)._owner.OnReceivedDamage -= OnReceivedDamage; if (radius < 1f) { yield break; } while (_state == State.WAITING) { yield return null; } target -= Vector3Extensions.XY(Vector3.Scale(Vector2.op_Implicit(((BraveBehaviour)((CustomDodgeRoll)this)._owner).sprite.GetRelativePositionFromAnchor((Anchor)1)), ((BraveBehaviour)((CustomDodgeRoll)this)._owner).sprite.scale)); bool flag = false; Vector2 velocity = default(Vector2); bool delayInvulnerability = false; HealthHaver hh = ((BraveBehaviour)((CustomDodgeRoll)this)._owner).healthHaver; do { _state = State.BOUNCING; ((GameActor)((CustomDodgeRoll)this)._owner).SetIsFlying(true, PogoStick.ItemName, false, false); if (hh.vulnerable) { hh.TriggerInvulnerabilityPeriod(0.6f); } else { delayInvulnerability = true; } ((BraveBehaviour)((CustomDodgeRoll)this)._owner).specRigidbody.AddCollisionLayerIgnoreOverride(_IgnoreCollisions); int originalLayer = ((Component)((CustomDodgeRoll)this)._owner).gameObject.layer; GameObjectExtensions.SetLayerRecursively(((Component)((CustomDodgeRoll)this)._owner).gameObject, LayerMask.NameToLayer("Unoccluded")); Vector2 val2 = Vector2.op_Implicit(((BraveBehaviour)((CustomDodgeRoll)this)._owner).transform.position); if (!flag) { velocity = (target - val2) / 0.5f; } else { float num3 = ((Vector2)(ref velocity)).magnitude * 0.75f; val = Vector3Extensions.XY(((CustomDodgeRoll)this)._owner.unadjustedAimPoint) - ((BraveBehaviour)((CustomDodgeRoll)this)._owner).sprite.WorldCenter; velocity = num3 * ((Vector2)(ref val)).normalized; } KnockbackDoer kb = ((BraveBehaviour)((CustomDodgeRoll)this)._owner).knockbackDoer; _pogoKnockbackId = kb.ApplyContinuousKnockback(((Vector2)(ref velocity)).normalized, ((Vector2)(ref velocity)).magnitude * 0.1f * kb.weight); Transform spriteTransform = ((BraveBehaviour)((BraveBehaviour)((CustomDodgeRoll)this)._owner).sprite).transform; ((Component)this).gameObject.Play("rogo_charge_bounce_sound"); for (elapsed = 0f; elapsed < 0.5f; elapsed += BraveTime.DeltaTime) { spriteTransform.localPosition = Vector3Extensions.WithY(spriteTransform.localPosition, GetHeight(25f, 100f, elapsed)); yield return null; if (delayInvulnerability && hh.vulnerable) { delayInvulnerability = false; hh.TriggerInvulnerabilityPeriod(0.6f - elapsed); } } kb.EndContinuousKnockback(_pogoKnockbackId); _pogoKnockbackId = -1; GameObjectExtensions.SetLayerRecursively(((Component)((CustomDodgeRoll)this)._owner).gameObject, originalLayer); _state = State.LANDING; _didStomp = false; CwaffEvents.OnWillApplyRollDamage = (Action)Delegate.Combine(CwaffEvents.OnWillApplyRollDamage, new Action(TimeFreezeOnPogoStomp)); ((CustomDodgeRoll)this)._owner.OnRolledIntoEnemy += DoPogoStomp; ((BraveBehaviour)((CustomDodgeRoll)this)._owner).specRigidbody.RemoveCollisionLayerIgnoreOverride(_IgnoreCollisions); ((BraveBehaviour)((CustomDodgeRoll)this)._owner).specRigidbody.AddCollisionLayerIgnoreOverride(_IgnoreProjectiles); for (elapsed = 0f; elapsed < 0.05f; elapsed += BraveTime.DeltaTime) { yield return null; if (delayInvulnerability && hh.vulnerable) { delayInvulnerability = false; hh.TriggerInvulnerabilityPeriod(0.1f - elapsed); } } CwaffEvents.OnWillApplyRollDamage = (Action)Delegate.Remove(CwaffEvents.OnWillApplyRollDamage, new Action(TimeFreezeOnPogoStomp)); ((CustomDodgeRoll)this)._owner.OnRolledIntoEnemy -= DoPogoStomp; ((GameActor)((CustomDodgeRoll)this)._owner).SetIsFlying(false, PogoStick.ItemName, false, false); ((BraveBehaviour)((CustomDodgeRoll)this)._owner).specRigidbody.RemoveCollisionLayerIgnoreOverride(_IgnoreProjectiles); ((CustomDodgeRoll)this)._owner.ClearTableSlides(); flag = true; } while (_didStomp); } private static void TimeFreezeOnPogoStomp(PlayerController controller, AIActor actor) { StickyFrictionManager.Instance.RegisterCustomStickyFriction(0.5f, 0f, true, false); } private void DoPogoStomp(PlayerController pc, AIActor actor) { //IL_002d: 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) ((Component)pc).gameObject.PlayOnce("rogo_stomp_sound"); ((BraveBehaviour)pc).specRigidbody.RegisterGhostCollisionException(((BraveBehaviour)actor).specRigidbody); Lazy.DoMicroBlankAt(((BraveBehaviour)pc).sprite.WorldBottomCenter, pc); DoGroundParticles(((GameActor)actor).CenterPosition); _didStomp = true; } private static void DoGroundParticles(Vector2 pos) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) GameObject earthClod = Groundhog._EarthClod; float? fadeOutTime = 0.25f; float? startScale = 1f; float? endScale = 0.1f; CwaffVFX.SpawnBurst(earthClod, 10, pos, 1f, null, 0f, 3f, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.None, 0.5f, fadeOutTime, 0f, null, fadeIn: false, uniform: true, startScale, endScale, null, randomFrame: true); } private void OnReceivedDamage(PlayerController controller) { ((CustomDodgeRoll)this).FinishDodgeRoll(false); } protected override void FinishDodgeRoll(bool aborted = false) { //IL_0011: 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) Transform transform = ((BraveBehaviour)((BraveBehaviour)((CustomDodgeRoll)this)._owner).sprite).transform; transform.localPosition = Vector3Extensions.WithY(transform.localPosition, 0f); CwaffEvents.OnWillApplyRollDamage = (Action)Delegate.Remove(CwaffEvents.OnWillApplyRollDamage, new Action(TimeFreezeOnPogoStomp)); if (_pogoKnockbackId > -1) { ((BraveBehaviour)((CustomDodgeRoll)this)._owner).knockbackDoer.EndContinuousKnockback(_pogoKnockbackId); _pogoKnockbackId = -1; } ((GameActor)((CustomDodgeRoll)this)._owner).SetIsFlying(false, PogoStick.ItemName, false, false); ((CustomDodgeRoll)this)._owner.ClearTableSlides(); ((CustomDodgeRoll)this)._owner.OnReceivedDamage -= OnReceivedDamage; ((CustomDodgeRoll)this)._owner.OnRolledIntoEnemy -= DoPogoStomp; ((BraveBehaviour)((CustomDodgeRoll)this)._owner).specRigidbody.RemoveCollisionLayerIgnoreOverride(_IgnoreCollisions); ((CustomDodgeRoll)this)._owner.ownerlessStatModifiers.Remove(_noSpeed); ((CustomDodgeRoll)this)._owner.stats.RecalculateStats(((CustomDodgeRoll)this)._owner, false, false); _chargeRadius.Disable(); _chargeTarget.Disable(); _state = State.INACTIVE; } private void OnDestroy() { if (Object.op_Implicit((Object)(object)_chargeRadius)) { Object.Destroy((Object)(object)((Component)_chargeRadius).gameObject); } } } public class AmazonPrimer : CwaffActive { public static string ItemName = "Amazon Primer"; public static string ShortDescription = "Cancel Any* Time!"; public static string LongDescription = "Begins a Primer subscription when consumed. Primer subscription drains 5 casings per combat encounter, but doubles fire rate and projectile speed and slightly boosts damage. Per-room subscription cost increases by 5 casings each floor. Cannot be activated with fewer than 25 casings."; public static string Lore = "Once upon a time, money couldn't buy firearm proficiency, and gun-toting peasants needed to practice things often described using buzzwords such as \"aiming,\" \"timing,\" and \"strategy\". Fortunately, the stone ages are behind us, and for a low** fee, you too can join the dozens of happy*** Primers and shoot with the best of them!\n\n*(any time you run out of money, your subscription will be automatically cancelled for your convenience)\n\n**(low fee increases as you descend lower into the Gungeon)\n\n***(happiness is subjective and relative)"; internal static GameObject _PrimeLogo; public static void Init() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) ((PickupObject)Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore)).quality = (ItemQuality)4; _PrimeLogo = VFX.Create("prime_logo_overhead", 2f, loops: true, -1, 1f, (Anchor)1, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 100f); FakeItem.Create(); } public override bool CanBeUsed(PlayerController user) { return GameManager.Instance.PrimaryPlayer.carriedConsumables.Currency >= 25; } public override void DoEffect(PlayerController user) { user.AcquireFakeItem().Setup(); } } public class PrimerSubscription : FakeItem { internal const int _PRIME_SUB_COST = 5; internal const int _FLOOR_INFLATION = 5; private PlayerController _primer; private StatModifier[] _primeBenefits; private int _currentCost = 5; public void Setup() { _primer = ((PassiveItem)this).Owner; PlayerController primer = _primer; primer.OnEnteredCombat = (Action)Delegate.Combine(primer.OnEnteredCombat, new Action(AnyPrimers)); _primer.OnRoomClearEvent += ThanksForPriming; GameManager.Instance.OnNewLevelFullyLoaded += Inflation; _primeBenefits = (StatModifier[])(object)new StatModifier[4] { ((StatType)1).Mult(2f), ((StatType)6).Mult(2f), ((StatType)5).Mult(1.25f), ((StatType)22).Mult(1.25f) }; DoPrimeVFX(); } private void Inflation() { _currentCost += 5; } private void AnyPrimers() { if (GameManager.Instance.PrimaryPlayer.carriedConsumables.Currency < _currentCost) { PlayerController primer = _primer; primer.OnEnteredCombat = (Action)Delegate.Remove(primer.OnEnteredCombat, new Action(AnyPrimers)); _primer.OnRoomClearEvent -= ThanksForPriming; GameManager.Instance.OnNewLevelFullyLoaded -= Inflation; ((Component)_primer).gameObject.Play("prime_ran_out"); Lazy.CustomNotification("Primer Expired", "Thanks for Trying Amazon Primer", ((BraveBehaviour)Lazy.Pickup()).sprite); Object.Destroy((Object)(object)((Component)_primer.DropPassiveItem((PassiveItem)(object)this)).gameObject); return; } PlayerConsumables carriedConsumables = GameManager.Instance.PrimaryPlayer.carriedConsumables; carriedConsumables.Currency -= _currentCost; StatModifier[] primeBenefits = _primeBenefits; foreach (StatModifier item in primeBenefits) { _primer.ownerlessStatModifiers.Add(item); } _primer.stats.RecalculateStats(_primer, false, false); DoPrimeVFX(); } private void ThanksForPriming(PlayerController player) { if (!((Object)(object)player != (Object)(object)_primer)) { StatModifier[] primeBenefits = _primeBenefits; foreach (StatModifier item in primeBenefits) { _primer.ownerlessStatModifiers.Remove(item); } _primer.stats.RecalculateStats(_primer, false, false); } } private void DoPrimeVFX() { _primer.FlashVFXAbovePlayer(AmazonPrimer._PrimeLogo, "prime_sound"); } public override void MidGameSerialize(List data) { ((PickupObject)this).MidGameSerialize(data); data.Add(_currentCost); } public override void MidGameDeserialize(List data) { ((PassiveItem)this).MidGameDeserialize(data); _currentCost = (int)data[0]; Setup(); } } public class WeightedRobes : CwaffActive, ILabelItem { internal enum EnemyType { MOOK, MINIBOSS, BOSS } [HarmonyPatch(typeof(GameUIItemController), "UpdateItem")] private class RestoreSensibleLabelPatch { private static void Postfix(GameUIItemController __instance, PlayerItem current, List items) { //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) if (!(current is ILabelItem)) { Transform transform = ((Component)__instance.ItemCountLabel).gameObject.transform; transform.localPosition = Vector3Extensions.WithY(transform.localPosition, 0.0148148155f); } } } public static string ItemName = "Weighted Robes"; public static string ShortDescription = "Hide Your Power Level"; public static string LongDescription = "Toggles weighted training when used. Each room cleared while weighted training is active increases the player's training level. Fire rate, reload speed, and movement speed are reduced proportional to training level while training is active, and increased proportional to training level while training is inactive. Bosses and minibosses increase training level more than normal enemies."; public static string Lore = "These garments once belonged to King Triggolo, a nemesis-turned-ally of the great Gunsoku. Triggolo would often wear these robes during lesser gunfights to make them more physically difficult, allowing him to build speed and strength in preparation for more serious gunfights. He also had a habit of forgetting to remove them before said serious gunfights, leading to several injuries that could have been easily avoided."; private const int _MAX_TRAINING = 50; private const float _FIRERATE = 0.5f; private const float _RELOAD = -0.5f; private const float _MOVEMENT = 2f; private static int _InactiveId; private static int _ActiveId; internal static GameObject _TrainingVFX; internal static GameObject _TrainedVFX; private PlayerController _owner; private bool _active; private StatModifier[] weightedStats; private int[] _trainingDone = new int[2]; private StatModifier[][] trainingStats = new StatModifier[2][]; private EnemyType _strongestKilled; private static readonly Color _TrainingGreen = new Color(0.11764706f, 1f, 0.11764706f); private static readonly Color _TrainingRed = new Color(1f, 0.11764706f, 0.11764706f); public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PlayerItem obj = Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)2; obj.consumable = false; ItemBuilder.SetCooldownType(obj, (CooldownType)0, 0.5f); _InactiveId = ((BraveBehaviour)obj).sprite.spriteId; _ActiveId = ((BraveBehaviour)obj).sprite.collection.GetSpriteIdByName("weighted_robes_active_icon"); _TrainingVFX = VFX.Create("status_arrow_down", 2f, loops: true, -1, 1f, (Anchor)1, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 100f); _TrainedVFX = VFX.Create("status_arrow_up", 2f, loops: true, -1, 1f, (Anchor)1, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 100f); } public string GetLabel() { //IL_003d: 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 (!Object.op_Implicit((Object)(object)_owner)) { return string.Empty; } Transform transform = ((Component)GameUIRoot.Instance.itemControllers[_owner.PlayerIDX].ItemCountLabel).gameObject.transform; transform.localPosition = Vector3Extensions.WithY(transform.localPosition, 0.27f); return $"[color #dd6666]{(int)(100f * (float)_trainingDone[_owner.PlayerIDX] / 50f)}%[/color]"; } public override void Pickup(PlayerController player) { base.Pickup(player); _owner = player; player.OnEnteredCombat = (Action)Delegate.Combine(player.OnEnteredCombat, new Action(OnEnteredCombat)); player.OnRoomClearEvent += DidSomeTraining; player.OnKilledEnemyContext += MaybeKilledBoss; if (weightedStats == null) { weightedStats = (StatModifier[])(object)new StatModifier[3] { ((StatType)1).Add(0f), ((StatType)10).Add(0f), ((StatType)0).Add(0f) }; } int playerIDX = player.PlayerIDX; if (trainingStats[playerIDX] == null) { trainingStats[playerIDX] = (StatModifier[])(object)new StatModifier[3] { ((StatType)1).Add(0f), ((StatType)10).Add(0f), ((StatType)0).Add(0f) }; player.ownerlessStatModifiers.AddRange(trainingStats[playerIDX]); player.stats.RecalculateStats(player, false, false); } } private void OnEnteredCombat() { if (_active && Object.op_Implicit((Object)(object)_owner)) { ((MonoBehaviour)_owner).StartCoroutine(DoTraining_CR(_owner, active: true)); } } private void MaybeKilledBoss(PlayerController player, HealthHaver enemy) { if (enemy.IsBoss) { _strongestKilled = EnemyType.BOSS; } else if (enemy.IsSubboss && _strongestKilled != EnemyType.BOSS) { _strongestKilled = EnemyType.MINIBOSS; } } public override void OnPreDrop(PlayerController player) { _owner = null; player.OnRoomClearEvent -= DidSomeTraining; player.OnKilledEnemyContext -= MaybeKilledBoss; ((PlayerItem)this).OnPreDrop(player); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)_owner)) { _owner.OnRoomClearEvent -= DidSomeTraining; _owner.OnKilledEnemyContext -= MaybeKilledBoss; } ((PlayerItem)this).OnDestroy(); } private void Train(PlayerController player, int trainingDone) { if (_active) { if (player.HasSynergy(Synergy.GUN_SOHAN)) { trainingDone *= 3; } int playerIDX = player.PlayerIDX; _trainingDone[playerIDX] = Mathf.Min(_trainingDone[playerIDX] + trainingDone, 50); ((MonoBehaviour)player).StartCoroutine(DoTraining_CR(player, active: false)); UpdateTrainingStats(player); } } private void DidSomeTraining(PlayerController player) { Train(player, _strongestKilled switch { EnemyType.BOSS => 10, EnemyType.MINIBOSS => 5, _ => 1, }); _strongestKilled = EnemyType.MOOK; } private void UpdateTrainingStats(PlayerController player) { StatModifier[] array = trainingStats[player.PlayerIDX]; float num = (float)_trainingDone[player.PlayerIDX] / 50f; array[0].amount = num * 0.5f; array[1].amount = num * -0.5f; array[2].amount = num * 2f; weightedStats[0].amount = -2f * array[0].amount; weightedStats[1].amount = -2f * array[1].amount; weightedStats[2].amount = -2f * array[2].amount; player.stats.RecalculateStats(player, false, false); } public override bool CanBeUsed(PlayerController player) { if (!player.IsInCombat) { return ((PlayerItem)this).CanBeUsed(player); } return false; } public override void DoEffect(PlayerController player) { if (!((Object)(object)player != (Object)(object)_owner)) { _active = !_active; ((PickupObject)this).CanBeDropped = !_active; ((PlayerItem)this).passiveStatModifiers = (_active ? weightedStats : null); ((BraveBehaviour)this).sprite.SetSprite(_active ? _ActiveId : _InactiveId); ((MonoBehaviour)player).StartCoroutine(DoTraining_CR(player, _active)); player.stats.RecalculateStats(player, false, false); } } public static IEnumerator DoTraining_CR(PlayerController player, bool active) { if (active) { player.FlashVFXAbovePlayer(_TrainingVFX, "statdown", 0f, glowAndFade: true); } else { player.FlashVFXAbovePlayer(_TrainedVFX, "statup", 0f, glowAndFade: true); } SpriteOutlineManager.RemoveOutlineFromSprite(((BraveBehaviour)player).sprite, false); Material[] array = player.SetOverrideShader(CwaffShaders.UnlitDigitizeShader); foreach (Material obj in array) { obj.SetTexture(CwaffVFX._BinaryTexId, (Texture)(object)(active ? CwaffShaders.PowerdownTexture : CwaffShaders.PowerupTexture)); obj.SetColor(CwaffVFX._ColorId, active ? _TrainingRed : _TrainingGreen); obj.SetFloat(CwaffVFX._BinarizeProgressId, 0.5f); obj.SetFloat(CwaffVFX._ColorizeProgressId, 1f); obj.SetFloat(CwaffVFX._FadeProgressId, 0f); obj.SetFloat(CwaffVFX._ScrollSpeedId, active ? 3f : (-3f)); } yield return (object)new WaitForSeconds(1f); player.ClearOverrideShader(); SpriteOutlineManager.AddOutlineToSprite(((BraveBehaviour)player).sprite, Color.black); } } public class GungeonitePickaxe : CwaffActive { public delegate void FloorEdgeBorderDelegate(TK2DDungeonAssembler assembler, CellData cellData, Dungeon dungeon, tk2dTileMap map, int x, int y); public delegate void BuildForChunkDelegate(tk2dTileMap tileMap, SpriteChunk chunk, bool useColor, bool skipPrefabs, int baseX, int baseY, LayerInfo layerData); public static string ItemName = "Gungeonite Pickaxe"; public static string ShortDescription = "So We Back in the Mines"; public static string LongDescription = "TBD"; public static string Lore = "TBD"; private const int _ADD_WALL_DEPTH = 4; internal static VFXPool _VFXDustPoof; internal static HashSet _RebuiltChunks = new HashSet(); private static readonly List _NeighborDirs = new List { IntVector2.Right, IntVector2.UpRight, IntVector2.Up, IntVector2.UpLeft, IntVector2.Left, IntVector2.DownLeft, IntVector2.Down, IntVector2.DownRight }; private const float _MAX_DIST = 5f; private static int _ChunksBuilt = 0; private static float _ChunkBuildMsTotal = 0f; internal static float _LastUpdateTime = 0f; internal static IntVector2 _LastChunk = IntVector2.Zero; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PlayerItem obj = Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)1; obj.consumable = false; ((PickupObject)obj).CanBeDropped = true; ItemBuilder.SetCooldownType(obj, (CooldownType)0, 0.5f); _VFXDustPoof = ((Component)Items.Drill.AsActive()).GetComponent().VFXDustPoof; } private static void BuildForChunkSanityCheck(BuildForChunkDelegate orig, tk2dTileMap tileMap, SpriteChunk chunk, bool useColor, bool skipPrefabs, int baseX, int baseY, LayerInfo layerData) { Stopwatch stopwatch = Stopwatch.StartNew(); orig(tileMap, chunk, useColor, skipPrefabs, baseX, baseY, layerData); stopwatch.Stop(); _ChunksBuilt++; _ChunkBuildMsTotal += stopwatch.ElapsedMilliseconds; } private static void BuildFloorEdgeBorderTilesSanityCheck(FloorEdgeBorderDelegate orig, TK2DDungeonAssembler assembler, CellData current, Dungeon d, tk2dTileMap map, int ix, int iy) { if (Lazy.AnyoneHasActive()) { MyBuildFloorEdgeBorderTiles(assembler, current, d, map, ix, iy); } else { orig(assembler, current, d, map, ix, iy); } } private static void MyBuildFloorEdgeBorderTiles(TK2DDungeonAssembler assembler, CellData current, Dungeon d, tk2dTileMap map, int ix, int iy) { //IL_0006: 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_0023: Invalid comparison between Unknown and I4 //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Invalid comparison between Unknown and I4 //IL_0091: 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_00e7: Invalid comparison between Unknown and I4 //IL_013d: 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_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Invalid comparison between Unknown and I4 //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) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: 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_01d0: Unknown result type (might be due to invalid IL or missing references) ETGModConsole.Log((object)$"called BuildFloorEdgeBorderTiles() from starting position {current.position}", false); if ((int)current.type != 2 && !d.data.isFaceWallLower(ix, iy)) { return; } TileIndexGrid val = d.roomMaterialDefinitions[current.cellVisualData.roomVisualTypeIndex].roomFloorBorderGrid; if ((int)d.tileIndices.tilesetId == 1024 && current.cellVisualData.IsFacewallForInteriorTransition) { val = d.roomMaterialDefinitions[current.cellVisualData.InteriorTransitionIndex].exteriorFacadeBorderGrid; } if (!((Object)(object)val != (Object)null)) { return; } if ((int)current.diagonalWallType == 0 || !d.data.isFaceWallLower(ix, iy)) { List cellNeighbors = d.data.GetCellNeighbors(current, true); bool[] array = new bool[8]; for (int i = 0; i < array.Length; i++) { if (cellNeighbors[i] != null) { array[i] = (int)cellNeighbors[i].type == 1 && !d.data.isTopWall(cellNeighbors[i].position.x, cellNeighbors[i].position.y + 1) && (int)cellNeighbors[i].diagonalWallType == 0; ETGModConsole.Log((object)$" starting neighbor at {cellNeighbors[i].position}", false); ETGModConsole.Log((object)$" checking neighbor's neighbor at {cellNeighbors[i].position + IntVector2.Up}", false); bool flag = cellNeighbors[i].isSecretRoomCell || (d.data[cellNeighbors[i].position + IntVector2.Up].IsTopWall() && d.data[cellNeighbors[i].position + IntVector2.Up].isSecretRoomCell); ETGModConsole.Log((object)$" finishing neighbor {cellNeighbors[i].position}", false); array[i] = array[i] || flag != current.isSecretRoomCell; } } int indexGivenEightSides = val.GetIndexGivenEightSides(array); if (indexGivenEightSides != -1) { map.Layers[GlobalDungeonData.decalLayerIndex].SetTile(current.positionInTilemap.x, current.positionInTilemap.y, indexGivenEightSides); } } else { int indexByWeight = val.quadNubs.GetIndexByWeight(); if (indexByWeight != -1) { map.Layers[GlobalDungeonData.decalLayerIndex].SetTile(current.positionInTilemap.x, current.positionInTilemap.y, indexByWeight); } } } private static void AddNeighboringWalls(Dungeon d, RoomHandler r, IntVector2 pos, int timesToRecurse, bool firstLayer = true) { //IL_0006: 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_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_0030: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0056: 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_006c: 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_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_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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) CellData val = d.data[pos]; if (val == null) { return; } foreach (IntVector2 neighborDir in _NeighborDirs) { IntVector2 val2 = pos + neighborDir; if (d.data[val2] == null) { CellData val3 = new CellData(val2, (CellType)1); d.data.cellData[val2.x][val2.y] = val3; d.data[val2] = val3; ((CellVisualData)(ref val3.cellVisualData)).CopyFrom(val.cellVisualData); val3.positionInTilemap = val.positionInTilemap + neighborDir; val3.parentArea = null; val3.parentRoom = null; val3.nearestRoom = val.nearestRoom ?? val.parentRoom; val3.occlusionData.overrideOcclusion = false; d.ConstructWallAtPosition(val2.x, val2.y, true); } if (timesToRecurse > 0) { AddNeighboringWalls(d, r, val2, timesToRecurse - 1, firstLayer: false); } } } public override void Update() { //IL_0012: 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) //IL_0020: 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_0049: 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_0057: 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_006c: 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) ((PlayerItem)this).Update(); PlayerController lastOwner = ((PlayerItem)this).LastOwner; if (lastOwner != null) { IntVector2 val = Vector2Extensions.ToIntVector2(((GameActor)lastOwner).CenterPosition, (VectorConversions)0); IntVector2 val2 = default(IntVector2); ((IntVector2)(ref val2))..ctor(Mathf.FloorToInt((float)val.x / 32f), Mathf.FloorToInt((float)val.y / 32f)); if (!(val2 == _LastChunk)) { _LastChunk = val2; RebuildAdjacentChunks(GameManager.Instance.Dungeon.MainTilemap, val2.x, val2.y); } } } public static void RebuildAdjacentChunks(tk2dTileMap tilemap, int chunkX, int chunkY) { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) ETGModConsole.Log((object)$"is main tilemap? {(Object)(object)tilemap == (Object)(object)GameManager.Instance.Dungeon.MainTilemap}", false); ETGModConsole.Log((object)$" rebuilding chunks around {chunkX} , {chunkY}", false); int num = Math.Max(0, chunkX - 1); int num2 = Math.Max(0, chunkY - 1); int num3 = Math.Min(tilemap.Layers[0].numColumns - 1, chunkX + 1); int num4 = Math.Min(tilemap.Layers[0].numRows - 1, chunkY + 1); int numLayers = tilemap.data.NumLayers; bool flag = false; for (int i = num2; i <= num4; i++) { for (int j = num; j <= num3; j++) { new IntVector2(j, i); ETGModConsole.Log((object)$" marking chunk at {j},{i} as dirty", false); for (int k = 0; k < numLayers; k++) { tilemap.Layers[k].GetChunk(j, i).Dirty = true; } flag = true; } } if (flag) { tilemap.Build((BuildFlags)0); } } public override void DoEffect(PlayerController user) { //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_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_0083: 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_00d9: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_00f6: 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_0108: 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) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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) //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_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Invalid comparison between Unknown and I4 //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: 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_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0222: 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_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) ETGModConsole.Log((object)$"built {_ChunksBuilt} in {_ChunkBuildMsTotal} ms == {_ChunkBuildMsTotal / (float)_ChunksBuilt} ms / chunk", false); _ChunksBuilt = 0; _ChunkBuildMsTotal = 0f; Dungeon dungeon = GameManager.Instance.Dungeon; TransformExtensions.PositionVector2(((BraveBehaviour)user).transform); IntVector2 val = Vector2Extensions.ToIntVector2(((BraveBehaviour)user).specRigidbody.PrimaryPixelCollider.UnitBottomCenter, (VectorConversions)0); if (!GameManager.Instance.Dungeon.data.CheckInBoundsAndValid(val)) { ETGModConsole.Log((object)"we're out of bounds!", false); return; } CellData val2 = dungeon.data[val]; if (val2 == null) { ETGModConsole.Log((object)"our current cell doesn't exist!", false); return; } RoomHandler currentRoom = user.CurrentRoom; if (currentRoom == null) { ETGModConsole.Log((object)"not in a room!", false); return; } float num = user.m_currentGunAngle.Clamp180(); IntVector2 val3 = val; val3 = ((Mathf.Abs(num) < 45f) ? (val3 + IntVector2.Right) : ((!(Mathf.Abs(num) > 135f)) ? (val3 + ((num > 0f) ? IntVector2.Up : IntVector2.Down)) : (val3 + IntVector2.Left))); ETGModConsole.Log((object)$"we are in a cell at {val2.position} of type {val2.type}", false); if (!GameManager.Instance.Dungeon.data.CheckInBoundsAndValid(val3)) { ETGModConsole.Log((object)" out of bounds!", false); return; } CellData val4 = dungeon.data[val3]; if (val4 == null) { ETGModConsole.Log((object)" null facing cell data!", false); return; } if ((int)val4.type != 1) { ETGModConsole.Log((object)" facing a non-wall!", false); return; } ETGModConsole.Log((object)$" facing cell at {val4.position} is type {val4.type}", false); dungeon.data.ClearCachedCellData(); AddNeighboringWalls(dungeon, currentRoom, val3, 4); val4.breakable = true; val4.occlusionData.overrideOcclusion = true; val4.occlusionData.cellOcclusionDirty = true; tk2dTileMap val5 = dungeon.DestroyWallAtPosition(val3.x, val3.y, true); _VFXDustPoof.SpawnAtPosition(((IntVector2)(ref val3)).ToCenterVector3((float)val3.y), 0f, (Transform)null, (Vector2?)null, (Vector2?)null, (float?)null, false, (SpawnMethod)null, (tk2dBaseSprite)null, false); Pixelator.Instance.MarkOcclusionDirty(); Pixelator.Instance.ProcessOcclusionChange(val, 1f, currentRoom, false); if (Object.op_Implicit((Object)(object)val5)) { val5.Build((BuildFlags)2); } ((Component)GameManager.Instance).gameObject.Play("Play_OBJ_rock_break_01"); ((Component)GameManager.Instance).gameObject.Play("Play_OBJ_stone_crumble_01"); DeadlyDeadlyGoopManager.ReinitializeData(); } public static void RebuildTilemapFixed(tk2dTileMap targetTilemap) { //IL_000b: 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_0061: Unknown result type (might be due to invalid IL or missing references) RenderMeshBuilder.CurrentCellXOffset = Mathf.RoundToInt(targetTilemap.renderData.transform.position.x); RenderMeshBuilder.CurrentCellYOffset = Mathf.RoundToInt(targetTilemap.renderData.transform.position.y); targetTilemap.Build(); targetTilemap.renderData.transform.position = new Vector3((float)RenderMeshBuilder.CurrentCellXOffset, (float)RenderMeshBuilder.CurrentCellYOffset, (float)RenderMeshBuilder.CurrentCellYOffset); RenderMeshBuilder.CurrentCellXOffset = 0; RenderMeshBuilder.CurrentCellYOffset = 0; } public static void MyBuild(tk2dTileMap tileMap) { IEnumerator enumerator = DeferredBuild(tileMap); while (enumerator.MoveNext()) { } } public static IEnumerator DeferredBuild(tk2dTileMap tileMap) { if (!((Object)(object)tileMap.data != (Object)null) || !((Object)(object)tileMap.spriteCollection != (Object)null)) { yield break; } if (tileMap.data.tilePrefabs == null) { tileMap.data.tilePrefabs = (GameObject[])(object)new GameObject[tileMap.SpriteCollectionInst.Count]; } else if (tileMap.data.tilePrefabs.Length != tileMap.SpriteCollectionInst.Count) { Array.Resize(ref tileMap.data.tilePrefabs, tileMap.SpriteCollectionInst.Count); } BuilderUtil.InitDataStore(tileMap); if (Object.op_Implicit((Object)(object)tileMap.SpriteCollectionInst)) { tileMap.SpriteCollectionInst.InitMaterialIds(); } bool flag = true; Dictionary dictionary = new Dictionary(); if (tileMap.layers != null) { for (int i = 0; i < tileMap.layers.Length; i++) { Layer val = tileMap.layers[i]; if (val != null && (Object)(object)val.gameObject != (Object)null) { dictionary[val] = val.gameObject.activeSelf; } } } if (flag) { tileMap.ClearSpawnedInstances(); } BuilderUtil.CreateRenderData(tileMap, false, dictionary); SpriteChunk.s_roomChunks = new Dictionary>(); if (Application.isPlaying && (Object)(object)GameManager.Instance.Dungeon != (Object)null && GameManager.Instance.Dungeon.data != null && (Object)(object)GameManager.Instance.Dungeon.MainTilemap == (Object)(object)tileMap) { List rooms = GameManager.Instance.Dungeon.data.rooms; if (rooms != null && rooms.Count > 0) { for (int j = 0; j < tileMap.data.Layers.Length; j++) { if (!tileMap.data.Layers[j].overrideChunkable) { continue; } for (int k = 0; k < rooms.Count; k++) { if (!SpriteChunk.s_roomChunks.ContainsKey(tileMap.data.Layers[j])) { SpriteChunk.s_roomChunks.Add(tileMap.data.Layers[j], new List()); } SpriteChunk val2 = new SpriteChunk(rooms[k].area.basePosition.x + tileMap.data.Layers[j].overrideChunkXOffset, rooms[k].area.basePosition.y + tileMap.data.Layers[j].overrideChunkYOffset, rooms[k].area.basePosition.x + rooms[k].area.dimensions.x + tileMap.data.Layers[j].overrideChunkXOffset, rooms[k].area.basePosition.y + rooms[k].area.dimensions.y + tileMap.data.Layers[j].overrideChunkYOffset); val2.roomReference = rooms[k]; string prototypeRoomName = rooms[k].area.PrototypeRoomName; tileMap.Layers[j].CreateOverrideChunk(val2); BuilderUtil.CreateOverrideChunkData(val2, tileMap, j, prototypeRoomName); SpriteChunk.s_roomChunks[tileMap.data.Layers[j]].Add(val2); } } } } flag = false; IEnumerator BuildTracker = RenderMeshBuilder.Build(tileMap, false, flag); while (BuildTracker.MoveNext()) { yield return null; } flag = false; if (tileMap.isGungeonTilemap) { BuilderUtil.SpawnAnimatedTiles(tileMap, flag); } tk2dSpriteDefinition firstValidDefinition = tileMap.SpriteCollectionInst.FirstValidDefinition; if (firstValidDefinition != null && (int)firstValidDefinition.physicsEngine == 1) { ColliderBuilder2D.Build(tileMap, flag); } else { ColliderBuilder3D.Build(tileMap, flag); } BuilderUtil.SpawnPrefabs(tileMap, flag); Layer[] layers = tileMap.layers; for (int l = 0; l < layers.Length; l++) { layers[l].ClearDirtyFlag(); } if (tileMap.colorChannel != null) { tileMap.colorChannel.ClearDirtyFlag(); } if (Object.op_Implicit((Object)(object)tileMap.SpriteCollectionInst)) { tileMap.spriteCollectionKey = tileMap.SpriteCollectionInst.buildKey; } } } public class ChamberJammer : CwaffActive { public static string ItemName = "Chamber Jammer"; public static string ShortDescription = "Jam it All"; public static string LongDescription = "Reduces the current gun's max ammo to its current ammo (max 90% reduction), and multiplies the gun's damage by (old max ammo) / (new max ammo)."; public static string Lore = "A demonic bullet that once resided inside the chamber of a Jammed's gun. These bullets grow to fill the empty space in whatever chamber they find themselves inside, and infuse their dark energies into any ammunition within their host gun's chamber. Two notable effects of this infusion are 1) an increased potency of all fired bullets and 2) an ominous aura radiating from the host gun. Fortunately, you can hear whispers coming from inside the chamber assuring you that the ominous aura is nothing you need to worry about."; public static void Init() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) ((PickupObject)Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore)).quality = (ItemQuality)2; FakeItem.Create(); } public override bool CanBeUsed(PlayerController user) { Gun currentGun = ((GameActor)user).CurrentGun; if (currentGun == null) { return false; } if (Object.op_Implicit((Object)(object)((Component)currentGun).gameObject.GetComponent())) { return false; } if (currentGun.InfiniteAmmo || currentGun.CurrentAmmo == 0 || !((PickupObject)currentGun).CanActuallyBeDropped(user)) { return false; } if ((float)currentGun.CurrentAmmo / (float)currentGun.AdjustedMaxAmmo > 0.9f) { return false; } return ((PlayerItem)this).CanBeUsed(user); } public override void DoEffect(PlayerController user) { //IL_0079: 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_008e: 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) Gun currentGun = ((GameActor)user).CurrentGun; if (currentGun != null && !currentGun.InfiniteAmmo && currentGun.CurrentAmmo != 0 && ((PickupObject)currentGun).CanActuallyBeDropped(user)) { float percentAmmoToLose = Mathf.Min(0.9f, 1f - (float)currentGun.CurrentAmmo / (float)currentGun.AdjustedMaxAmmo); ((Component)currentGun).gameObject.AddComponent().Setup(percentAmmoToLose); user.AcquireFakeItem().Setup(user.PlayerIDX, ((PickupObject)currentGun).PickupObjectId, percentAmmoToLose); GlobalSparksDoer.DoRadialParticleBurst(400, Vector2Extensions.ToVector3ZisY(((BraveBehaviour)user).sprite.WorldBottomLeft, 0f), Vector2Extensions.ToVector3ZisY(((BraveBehaviour)user).sprite.WorldTopRight, 0f), 360f, 20f, 0f, (float?)null, (float?)null, (Color?)null, (SparksType)1); ((Component)user).gameObject.Play("chamber_eater_activate_sound"); } } } internal class UsedChamberJammer : FakeItem { private static List _ActiveJammers = new List(); private int _playerId; private int _gunId; private float _percentAmmoToLose; public void Setup(int playerId, int gunId, float percentAmmoToLose) { _playerId = playerId; _gunId = gunId; _percentAmmoToLose = percentAmmoToLose; DoJamEffect(); } private void DoJamEffect() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 PlayerController val = GameManager.Instance.PrimaryPlayer; if ((int)GameManager.Instance.CurrentGameType == 1 && val.PlayerIDX != _playerId) { val = GameManager.Instance.SecondaryPlayer; } Gun val2 = null; foreach (Gun allGun in val.inventory.AllGuns) { if (((PickupObject)allGun).PickupObjectId == _gunId) { val2 = allGun; break; } } if (Object.op_Implicit((Object)(object)val2)) { ((Component)val2).gameObject.AddComponent().Setup(_percentAmmoToLose); val2.SetBaseMaxAmmo(Mathf.CeilToInt((1f - _percentAmmoToLose) * (float)val2.GetBaseMaxAmmo())); float num = 1f / (1f - _percentAmmoToLose); ItemBuilder.AddCurrentGunStatModifier(val2, (StatType)5, num, (ModifyMethod)1); val.stats.RecalculateStats(val, false, false); } } public override void OnDestroy() { _ActiveJammers.Remove(this); ((PassiveItem)this).OnDestroy(); } public override void Pickup(PlayerController player) { base.Pickup(player); _ActiveJammers.Add(this); } public override void MidGameSerialize(List data) { ((PickupObject)this).MidGameSerialize(data); data.Add(_ActiveJammers.IndexOf(this)); data.Add(_playerId); data.Add(_gunId); data.Add(_percentAmmoToLose); } public override void MidGameDeserialize(List data) { ((PassiveItem)this).MidGameDeserialize(data); if ((int)data[0] == _ActiveJammers.IndexOf(this)) { _playerId = (int)data[1]; _gunId = (int)data[2]; _percentAmmoToLose = (float)data[3]; DoJamEffect(); } } } public class ChamberEatenProjectileParticles : MonoBehaviour { public Projectile _projectile; public PlayerController _owner; public int _particlesToSpawn; public void Setup(int particlesToSpawn) { _projectile = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); _particlesToSpawn = particlesToSpawn; } private void Update() { //IL_0025: 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) //IL_0040: 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_005d: 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) if (Object.op_Implicit((Object)(object)_projectile) && !(Random.value > 0.35f)) { Vector3 val = Vector2Extensions.ToVector3ZisY(((BraveBehaviour)_projectile).sprite.WorldBottomLeft, 0f); Vector3 val2 = Vector2Extensions.ToVector3ZisY(((BraveBehaviour)_projectile).sprite.WorldTopRight, 0f); GlobalSparksDoer.DoRandomParticleBurst(_particlesToSpawn, val, val2, Vector2Extensions.ToVector3ZisY(Lazy.RandomVector(), 0f), 0f, 1f, (float?)null, (float?)null, (Color?)null, (SparksType)1); } } } public class ChamberJammedBehavior : MonoBehaviour { private static Shader _FakePhantomShader = null; private static Color _FakePhantomRed = new Color(1f, 0.2f, 0.2f); public Gun _gun; public float _percentAmmoEaten; public int _particlesToSpawn; public void Setup(float percentAmmoToLose) { _gun = ((Component)this).GetComponent(); _percentAmmoEaten = percentAmmoToLose; _particlesToSpawn = Mathf.CeilToInt(percentAmmoToLose * 10f); Gun gun = _gun; gun.PostProcessProjectile = (Action)Delegate.Combine(gun.PostProcessProjectile, new Action(OnFired)); if (_FakePhantomShader == null) { _FakePhantomShader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTintableTiltedCutoutEmissive"); } } private void Update() { //IL_0025: 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) //IL_0040: 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_005d: 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) if (Object.op_Implicit((Object)(object)_gun) && !(Random.value > 0.1f)) { Vector3 val = Vector2Extensions.ToVector3ZisY(((BraveBehaviour)_gun).sprite.WorldBottomLeft, 0f); Vector3 val2 = Vector2Extensions.ToVector3ZisY(((BraveBehaviour)_gun).sprite.WorldTopRight, 0f); GlobalSparksDoer.DoRandomParticleBurst(_particlesToSpawn, val, val2, Vector2Extensions.ToVector3ZisY(Lazy.RandomVector(), 0f), 0f, 1f, (float?)null, (float?)null, (Color?)null, (SparksType)1); } } private void LateUpdate() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) Material material = ((BraveBehaviour)((BraveBehaviour)_gun).sprite).renderer.material; if (!((Object)(object)material.shader == (Object)(object)_FakePhantomShader)) { material.shader = _FakePhantomShader; material.SetColor(CwaffVFX._OverrideColorId, _FakePhantomRed); material.SetFloat(CwaffVFX._EmissivePowerId, 30f); } } private void OnFired(Projectile p) { GameObjectExtensions.GetOrAddComponent(((Component)p).gameObject).Setup(_particlesToSpawn); } } public class ChamberEaterAmmoDisplay : CustomAmmoDisplay { private const float _DRAIN_TIME = 1f; private Gun _gun; private PlayerController _owner; private float _startMaxAmmo; private int _displayedMaxAmmo; private bool _ammoDrainCompleted; public void Setup(float percentAmmoToLose) { _gun = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor currentOwner = _gun.CurrentOwner; owner = (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null); _startMaxAmmo = _gun.AdjustedMaxAmmo; ((MonoBehaviour)this).StartCoroutine(DrainAmmo(percentAmmoToLose)); } private IEnumerator DrainAmmo(float percentAmmoToLose) { for (float elapsed = 0f; elapsed < 1f; elapsed += BraveTime.DeltaTime) { float num = elapsed / 1f; float num2 = _startMaxAmmo * percentAmmoToLose * num; _displayedMaxAmmo = Mathf.FloorToInt(_startMaxAmmo - num2); yield return null; } _ammoDrainCompleted = true; } public override bool DoCustomAmmoDisplay(GameUIAmmoController uic) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_owner) || !Object.op_Implicit((Object)(object)_gun) || _ammoDrainCompleted || (Object)(object)((GameActor)_owner).CurrentGun != (Object)(object)_gun) { Object.Destroy((Object)(object)this); return false; } uic.SetAmmoCountLabelColor(Color.red); uic.GunAmmoCountLabel.Text = $"{_gun.CurrentAmmo}/{_displayedMaxAmmo}"; return true; } } public class BulletThatCanKillTheFuture : CwaffActive { [HarmonyPatch(typeof(AIActor), "Start")] private class MemorializeFuturelessEnemiesPatch { private static bool Prefix(AIActor __instance) { if (!Object.op_Implicit((Object)(object)CwaffRunData.Instance)) { return true; } string btcktfEnemyGuid = CwaffRunData.Instance.btcktfEnemyGuid; if (string.IsNullOrEmpty(btcktfEnemyGuid) || __instance.EnemyGuid != btcktfEnemyGuid) { return true; } Memorialize(__instance); Object.Destroy((Object)(object)((Component)__instance).gameObject); return false; } } public static string ItemName = "Bullet That Can Kill the Future"; public static string ShortDescription = "Seriously, Don't Miss"; public static string LongDescription = "Any enemy shot with Bullet That Can Kill the Future will not spawn for the rest of the run."; public static string Lore = "Very little is known about this bullet, as few know it exists at all. It was originally given to Bello by a mysterious blue-clad skeleton, who claims to have found it behind the Hero Shrine in the Keep of the Lead Lord. It's almost as if it's calling out to be fired."; internal static string _BelloItemHint = "A blue-clad skeleton stopped by earlier for some armor. I saw him walk behind the Hero Shrine and haven't seen him since."; internal static tk2dBaseSprite _Sprite = null; internal static bool _BulletSpawnedThisRun = false; internal static Texture2D _EeveeTexture = null; private PlayerController _owner; public static void Init() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) PlayerItem obj = Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)(-50); _Sprite = ((BraveBehaviour)obj).sprite; CwaffEvents.OnRunStartFromAnyFloor = (Action)Delegate.Combine(CwaffEvents.OnRunStartFromAnyFloor, new Action(ResetBTCKTF)); CwaffEvents.OnNewFloorFullyLoaded = (Action)Delegate.Combine(CwaffEvents.OnNewFloorFullyLoaded, new Action(SpawnFutureBullet)); ToolsCharApi.AddComplex(Databases.Strings.Core, "#SHOP_RUNBASEDMULTILINE_STOPPER", _BelloItemHint); _EeveeTexture = ResourceManager.LoadAssetBundle("shared_auto_001").LoadAsset("nebula_reducednoise"); } private static void ResetBTCKTF(PlayerController arg1, PlayerController arg2, GameMode arg3) { _BulletSpawnedThisRun = false; } private static void SpawnFutureBullet() { //IL_003a: 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) //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_007f: Unknown result type (might be due to invalid IL or missing references) if (_BulletSpawnedThisRun || HeckedMode._HeckedModeStatus == HeckedMode.Hecked.Retrashed) { return; } foreach (AdvancedShrineController allAdvancedShrineController in StaticReferenceManager.AllAdvancedShrineControllers) { if (allAdvancedShrineController.IsLegendaryHeroShrine) { Vector3 val = ((BraveBehaviour)allAdvancedShrineController).transform.position + Vector2Extensions.ToVector3ZisY(new Vector2(((BraveBehaviour)allAdvancedShrineController).sprite.GetCurrentSpriteDef().position3.x / 2f, 6f), 0f); GameObject gameObject = ((Component)LootEngine.SpawnItem(((Component)Lazy.Pickup()).gameObject, val, Vector2.zero, 0f, true, false, false)).gameObject; PickupObject component = gameObject.GetComponent(); component.IgnoredByRat = true; component.ClearIgnoredByRatFlagOnPickup = false; ((MonoBehaviour)component).StartCoroutine(DelayedRemoveBulletFromMinimap(gameObject)); _BulletSpawnedThisRun = true; } } } private static IEnumerator DelayedRemoveBulletFromMinimap(GameObject futureBulletObject) { yield return null; futureBulletObject.GetComponent().GetRidOfMinimapIcon(); } public override void Pickup(PlayerController player) { base.Pickup(player); _owner = player; } public override void OnPreDrop(PlayerController player) { _owner = null; ((PlayerItem)this).OnPreDrop(player); } public override bool CanBeUsed(PlayerController user) { if (user.IsInCombat && user.CurrentRoom.IsSealed && !user.InBossRoom() && !user.CurrentRoom.NewWaveOfEnemiesIsSpawning()) { return ((PlayerItem)this).CanBeUsed(user); } return false; } private static List CheckForValidEnemies(PlayerController player) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) List list = new List(); foreach (AIActor allNearbyEnemy in ((GameActor)player).CenterPosition.GetAllNearbyEnemies(100f, ignoreWalls: true, includeDead: false, includeGone: false, includeInvulnerable: true)) { if (!allNearbyEnemy.IsABoss()) { list.Add(allNearbyEnemy); } } return list; } public override void DoEffect(PlayerController user) { ((PlayerItem)this).DoEffect(user); ((MonoBehaviour)user).StartCoroutine(Futureless(user)); } private static Vector2 GetTargetClockhairPosition(BraveInput input, Vector2 currentClockhairPosition) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_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) //IL_0022: 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_0067: 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_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_0088: 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_008e: Unknown result type (might be due to invalid IL or missing references) Vector2 val = ((!input.IsKeyboardAndMouse(false)) ? (currentClockhairPosition + ((TwoAxisInputControl)input.ActiveActions.Aim).Vector * 10f * BraveTime.DeltaTime) : (Vector3Extensions.XY(GameManager.Instance.MainCameraController.Camera.ScreenToWorldPoint(Input.mousePosition)) + new Vector2(0.375f, -0.25f))); Vector2 val2 = Vector2.Max(GameManager.Instance.MainCameraController.MinVisiblePoint, val); return Vector2.Min(GameManager.Instance.MainCameraController.MaxVisiblePoint, val2); } private static void PointGunAtClockhair(PlayerController interactor, Transform clockhairTransform) { //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_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_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_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) Vector2 centerPosition = ((GameActor)interactor).CenterPosition; Vector2 val = Vector3Extensions.XY(clockhairTransform.position) - centerPosition; float num = BraveMathCollege.Atan2Degrees(val); num = dfNumberExtensions.Quantize(num, 3f); ((GameActor)interactor).GunPivot.rotation = Quaternion.Euler(0f, 0f, num); interactor.ForceIdleFacePoint(val, false); } public static void FreezeInPlace(SpeculativeRigidbody myRigidbody) { //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) myRigidbody.Velocity = Vector2.zero; } private static IEnumerator Futureless(PlayerController interactor) { Pixelator.Instance.DoFinalNonFadedLayer = true; Pixelator.Instance.DoRenderGBuffer = true; interactor.SetInputOverride(ItemName); ((BraveBehaviour)interactor).specRigidbody.CollideWithTileMap = false; ((BraveBehaviour)interactor).specRigidbody.CollideWithOthers = false; ((BraveBehaviour)interactor).specRigidbody.Velocity = Vector2.zero; ((BraveBehaviour)interactor).knockbackDoer.SetImmobile(true, ItemName); PlayerController otherPlayer = GameManager.Instance.GetOtherPlayer(interactor); if (Object.op_Implicit((Object)(object)otherPlayer)) { otherPlayer.SetInputOverride(ItemName); ((BraveBehaviour)otherPlayer).specRigidbody.CollideWithTileMap = false; ((BraveBehaviour)otherPlayer).specRigidbody.CollideWithOthers = false; ((BraveBehaviour)otherPlayer).specRigidbody.Velocity = Vector2.zero; ((BraveBehaviour)otherPlayer).knockbackDoer.SetImmobile(true, ItemName); } NoDamageBlankPatch.ForceNextBlankToDoNoDamage = true; interactor.ForceBlank(25f, 0.5f, true, false, (Vector2?)null, false, -1f); Dictionary frozenEnemies = new Dictionary(); foreach (AIActor item in CheckForValidEnemies(interactor)) { if (!((BraveBehaviour)item).healthHaver.IsDead && Object.op_Implicit((Object)(object)((BraveBehaviour)item).specRigidbody)) { frozenEnemies[item] = item.State; item.State = (ActorState)0; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)item).specRigidbody; specRigidbody.OnPreMovement = (Action)Delegate.Combine(specRigidbody.OnPreMovement, new Action(FreezeInPlace)); if (Object.op_Implicit((Object)(object)((BraveBehaviour)item).knockbackDoer)) { ((BraveBehaviour)item).knockbackDoer.SetImmobile(true, ItemName); } } } Transform clockhairTransform = ((GameObject)Object.Instantiate(BraveResources.Load("Clockhair", ".prefab"))).transform; ClockhairController clockhair = ((Component)clockhairTransform).GetComponent(); float elapsed = 0f; float duration = clockhair.ClockhairInDuration; Vector3 clockhairTargetPosition = Vector2.op_Implicit(((GameActor)interactor).CenterPosition); Vector3 clockhairStartPosition = Vector2.op_Implicit(((GameActor)interactor).CenterPosition); ((BraveBehaviour)clockhair).renderer.enabled = true; ((BraveBehaviour)clockhair).spriteAnimator.alwaysUpdateOffscreen = true; ((BraveBehaviour)clockhair).spriteAnimator.Play("clockhair_intro"); clockhair.hourAnimator.Play("hour_hand_intro"); clockhair.minuteAnimator.Play("minute_hand_intro"); clockhair.secondAnimator.Play("second_hand_intro"); BraveInput currentInput = BraveInput.GetInstanceForPlayer(interactor.PlayerIDX); while (elapsed < duration) { elapsed += Mathf.Max(0.05f, GameManager.INVARIANT_DELTA_TIME); float num = elapsed / duration; float num2 = Mathf.SmoothStep(0f, 1f, num); clockhairTargetPosition = Vector2.op_Implicit(GetTargetClockhairPosition(currentInput, Vector2.op_Implicit(clockhairTargetPosition))); Vector3 val = Vector3.Slerp(clockhairStartPosition, clockhairTargetPosition, num2); clockhairTransform.position = Vector3Extensions.WithZ(val, 0f); if (num > 0.5f) { ((BraveBehaviour)clockhair).renderer.enabled = true; } if (num > 0.75f) { ((Component)clockhair.hourAnimator).GetComponent().enabled = true; ((Component)clockhair.minuteAnimator).GetComponent().enabled = true; ((Component)clockhair.secondAnimator).GetComponent().enabled = true; GameCursorController.CursorOverride.SetOverride(ItemName, true, (float?)null); } ((BraveBehaviour)clockhair).sprite.UpdateZDepth(); PointGunAtClockhair(interactor, clockhairTransform); yield return null; } clockhair.SetMotionType(1f); float shotTargetTime = 0f; float holdDuration = 4f; Vector3 lastJitterAmount = Vector3.zero; bool m_isPlayingChargeAudio = false; while (true) { ((BraveBehaviour)clockhair).transform.position = ((BraveBehaviour)clockhair).transform.position - lastJitterAmount; ((BraveBehaviour)clockhair).transform.position = Vector2.op_Implicit(GetTargetClockhairPosition(currentInput, Vector3Extensions.XY(((BraveBehaviour)clockhair).transform.position))); ((BraveBehaviour)clockhair).sprite.UpdateZDepth(); clockhair.SetMotionType(-10f); if (((OneAxisInputControl)currentInput.ActiveActions.UseItemAction).IsPressed || ((OneAxisInputControl)currentInput.ActiveActions.ShootAction).IsPressed) { if (!m_isPlayingChargeAudio) { m_isPlayingChargeAudio = true; ((Component)interactor).gameObject.Play("Play_OBJ_pastkiller_charge_01"); } shotTargetTime += BraveTime.DeltaTime; } else { shotTargetTime = Mathf.Max(0f, shotTargetTime - BraveTime.DeltaTime * 3f); if (m_isPlayingChargeAudio) { m_isPlayingChargeAudio = false; ((Component)interactor).gameObject.Play("Stop_OBJ_pastkiller_charge_01"); } } if ((((OneAxisInputControl)currentInput.ActiveActions.UseItemAction).WasReleased || ((OneAxisInputControl)currentInput.ActiveActions.ShootAction).WasReleased) && shotTargetTime > holdDuration && !GameManager.Instance.IsPaused) { break; } if (shotTargetTime > 0f) { float num3 = Mathf.Lerp(0f, 0.35f, shotTargetTime / holdDuration); float num4 = 0.5f; float num5 = Mathf.Lerp(4f, 7f, shotTargetTime / holdDuration); clockhair.UpdateDistortion(num3, num4, num5); float num6 = Mathf.Lerp(2f, 0.25f, shotTargetTime / holdDuration); clockhair.UpdateDesat(true, num6); shotTargetTime = Mathf.Min(holdDuration + 0.25f, shotTargetTime + BraveTime.DeltaTime); float num7 = Mathf.Lerp(0f, 0.5f, (shotTargetTime - 1f) / (holdDuration - 1f)); Vector3 val2 = Vector2Extensions.ToVector3ZUp(Random.insideUnitCircle * num7, 0f); BraveInput.DoSustainedScreenShakeVibration(shotTargetTime / holdDuration * 0.8f); ((BraveBehaviour)clockhair).transform.position = ((BraveBehaviour)clockhair).transform.position + val2; lastJitterAmount = val2; clockhair.SetMotionType(Mathf.Lerp(-10f, -2400f, shotTargetTime / holdDuration)); } else { lastJitterAmount = Vector3.zero; clockhair.UpdateDistortion(0f, 0f, 0f); clockhair.UpdateDesat(false, 0f); shotTargetTime = 0f; BraveInput.DoSustainedScreenShakeVibration(0f); } PointGunAtClockhair(interactor, clockhairTransform); yield return null; } AIActor val3 = null; float num8 = 8f; foreach (AIActor key in frozenEnemies.Keys) { if (Object.op_Implicit((Object)(object)key) && Object.op_Implicit((Object)(object)((BraveBehaviour)key).healthHaver) && !((BraveBehaviour)key).healthHaver.IsDead && Object.op_Implicit((Object)(object)((BraveBehaviour)key).specRigidbody)) { key.State = frozenEnemies[key]; SpeculativeRigidbody specRigidbody2 = ((BraveBehaviour)key).specRigidbody; specRigidbody2.OnPreMovement = (Action)Delegate.Remove(specRigidbody2.OnPreMovement, new Action(FreezeInPlace)); if (Object.op_Implicit((Object)(object)((BraveBehaviour)key).knockbackDoer)) { ((BraveBehaviour)key).knockbackDoer.SetImmobile(false, ItemName); } float num9 = Vector2.Distance(TransformExtensions.PositionVector2(((BraveBehaviour)clockhair).transform), TransformExtensions.PositionVector2(((BraveBehaviour)key).transform)); if (num9 < num8) { val3 = key; num8 = num9; } } } float num10 = Vector2.Distance(TransformExtensions.PositionVector2(((BraveBehaviour)clockhair).transform), ((GameActor)interactor).CenterPosition); bool killedOwnFuture = num10 < Mathf.Min(2f, num8); if (!killedOwnFuture && (Object)(object)val3 != (Object)null) { CwaffRunData.Instance.btcktfEnemyGuid = val3.EnemyGuid; Lazy.CustomNotification("Future Erased", val3.GetActorName(), _Sprite); Items.MagicLamp.AsGun().DefaultModule.projectiles[0].hitEffects.overrideMidairDeathVFX.CreatePoolFromVFXGameObject().SpawnAtPosition(Vector2Extensions.ToVector3ZisY(((GameActor)val3).CenterPosition, -1f), 0f, (Transform)null, (Vector2?)null, (Vector2?)null, (float?)(-0.05f), false, (SpawnMethod)null, (tk2dBaseSprite)null, false); foreach (AIActor allEnemy in StaticReferenceManager.AllEnemies) { if (!(allEnemy.EnemyGuid != val3.EnemyGuid) && allEnemy.IsHostileAndNotABoss()) { Memorialize(allEnemy); Object.Destroy((Object)(object)((Component)allEnemy).gameObject); } } ((BraveBehaviour)val3).healthHaver.ApplyDamage(10000f, Vector2.zero, "Future Bullet", (CoreDamageTypes)1, (DamageCategory)5, false, (PixelCollider)null, true); } else if (!killedOwnFuture) { Lazy.CustomNotification("You Missed", "Better Luck Next Time", _Sprite); } BraveInput.DoSustainedScreenShakeVibration(0f); BraveInput.DoVibrationForAllPlayers((Time)20, (Strength)30); ((MonoBehaviour)clockhair).StartCoroutine(clockhair.WipeoutDistortionAndFade(0.5f)); GameObjectExtensions.SetLayerRecursively(((Component)clockhair).gameObject, LayerMask.NameToLayer("Unoccluded")); Pixelator.Instance.FadeToColor(1f, Color.white, true, 0.2f); Pixelator.Instance.DoRenderGBuffer = false; ((BraveBehaviour)clockhair).spriteAnimator.Play("clockhair_fire"); ((Component)clockhair.hourAnimator).GetComponent().enabled = false; ((Component)clockhair.minuteAnimator).GetComponent().enabled = false; ((Component)clockhair.secondAnimator).GetComponent().enabled = false; yield return null; interactor.ClearInputOverride(ItemName); ((BraveBehaviour)interactor).specRigidbody.CollideWithTileMap = true; ((BraveBehaviour)interactor).specRigidbody.CollideWithOthers = true; ((BraveBehaviour)interactor).knockbackDoer.SetImmobile(false, ItemName); if (Object.op_Implicit((Object)(object)otherPlayer)) { otherPlayer.ClearInputOverride(ItemName); ((BraveBehaviour)otherPlayer).specRigidbody.CollideWithTileMap = true; ((BraveBehaviour)otherPlayer).specRigidbody.CollideWithOthers = true; ((BraveBehaviour)otherPlayer).knockbackDoer.SetImmobile(false, ItemName); } GameCursorController.CursorOverride.RemoveOverride(ItemName); Pixelator.Instance.DoFinalNonFadedLayer = false; if (!killedOwnFuture) { yield return (object)new WaitForSeconds(0.5f); Object.Destroy((Object)(object)((Component)clockhair).gameObject); yield break; } Object.Destroy((Object)(object)((Component)clockhair).gameObject); yield return (object)new WaitForSeconds(0.25f); CwaffRunData.Instance.nameOfPreviousFloor = GameManager.Instance.GetLastLoadedLevelDefinition().dungeonSceneName; GameManager.Instance.OnNewLevelFullyLoaded += ForceElevatorToReturnToPreviousFloor; GameManager.Instance.LoadCustomLevel("cg_sansfloor"); } private static void ForceElevatorToReturnToPreviousFloor() { GameManager.Instance.OnNewLevelFullyLoaded -= ForceElevatorToReturnToPreviousFloor; ElevatorDepartureController[] array = Object.FindObjectsOfType(); for (int i = 0; i < array.Length; i++) { array[i].UsesOverrideTargetFloor = false; } GameManager.Instance.InjectedLevelName = CwaffRunData.Instance.nameOfPreviousFloor; } public static void Memorialize(AIActor enemy) { //IL_0000: 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) tk2dSprite val = new GameObject().AddComponent(); Lazy.GetCollectionAndIdForBestIdleAnimation(enemy, out var spriteCol, out var spriteId); ((tk2dBaseSprite)val).SetSprite(spriteCol, spriteId); ((tk2dBaseSprite)val).FlipX = ((BraveBehaviour)enemy).sprite.FlipX; ((tk2dBaseSprite)val).PlaceAtPositionByAnchor(((BraveBehaviour)((BraveBehaviour)enemy).sprite).transform.position, (Anchor)(((tk2dBaseSprite)val).FlipX ? 2 : 0)); ((MonoBehaviour)val).StartCoroutine(Flicker(val)); } public static IEnumerator Flicker(tk2dSprite gsprite) { ((BraveBehaviour)gsprite).renderer.enabled = true; ((tk2dBaseSprite)gsprite).OverrideMaterialMode = (SpriteMaterialOverrideMode)2; ((tk2dBaseSprite)gsprite).usesOverrideMaterial = true; ((BraveBehaviour)gsprite).renderer.material.shader = ShaderCache.Acquire("Brave/Internal/GlitchEevee"); ((BraveBehaviour)gsprite).renderer.material.SetTexture("_EeveeTex", (Texture)(object)_EeveeTexture); ((BraveBehaviour)gsprite).renderer.material.SetFloat("_WaveIntensity", 0.9f); ((BraveBehaviour)gsprite).renderer.material.SetFloat("_ColorIntensity", 0.95f); ((BraveBehaviour)gsprite).renderer.sharedMaterial.shader = ShaderCache.Acquire("Brave/Internal/GlitchEevee"); ((BraveBehaviour)gsprite).renderer.sharedMaterial.SetTexture("_EeveeTex", (Texture)(object)_EeveeTexture); ((BraveBehaviour)gsprite).renderer.sharedMaterial.SetFloat("_WaveIntensity", 0.9f); ((BraveBehaviour)gsprite).renderer.sharedMaterial.SetFloat("_ColorIntensity", 0.95f); ((tk2dBaseSprite)gsprite).color = Vector3Extensions.WithAlpha(AfterImageHelpers.afterImageGray, 0.5f); ((Behaviour)gsprite).enabled = true; ((tk2dBaseSprite)gsprite).UpdateZDepth(); while (Object.op_Implicit((Object)(object)gsprite)) { yield return (object)new WaitForSeconds(0.05f); ((BraveBehaviour)gsprite).renderer.enabled = true; yield return null; ((BraveBehaviour)gsprite).renderer.enabled = false; } } } [HarmonyPatch] internal static class NoDamageBlankPatch { internal static bool ForceNextBlankToDoNoDamage; [HarmonyPatch(typeof(SilencerInstance), "TriggerSilencer")] [HarmonyPrefix] private static void MaybeForceNoDamageBlank(SilencerInstance __instance) { if (ForceNextBlankToDoNoDamage) { __instance.ForceNoDamage = true; ForceNextBlankToDoNoDamage = false; } } } public class Frisbee : CwaffActive { public static string ItemName = "Frisbee"; public static string ShortDescription = "Well-inspired"; public static string LongDescription = "Launches a disc that bounces between walls indefinitely until caught or entering another room. Passively reflects bullets while in flight. Can reveal secret rooms. Rolling onto the disc allows the player to ride the disc, disabling guns but granting immunity to projectiles."; public static string Lore = "A toy fit for children, dogs, and blobs of all ages. Its sturdy construction and inexplicable propensity for infinite flight open up all sorts of possibilities such as...well...maybe it'd be more fun to figure them out for yourself."; private const float GRAB_RANGE = 2f; private const float GRAB_RANGE_SQR = 4f; internal static GameObject _FrisbeePrefab = null; private PlayerController _owner; private FrisbeeBehaviour _frisbee; private FrisbeeBehaviour.State _state { get { if (!Object.op_Implicit((Object)(object)_frisbee)) { return FrisbeeBehaviour.State.INACTIVE; } return _frisbee._state; } } public static void Init() { //IL_0021: 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) //IL_00ec: 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_00fb: 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_010b: 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_011c: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown PlayerItem obj = Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)1; obj.consumable = false; obj.usableDuringDodgeRoll = true; ItemBuilder.SetCooldownType(obj, (CooldownType)0, 0.2f); _FrisbeePrefab = VFX.Create("frisbee_vfx", 8f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _FrisbeePrefab.AddComponent(); SpeculativeRigidbody val = _FrisbeePrefab.AddComponent(); val.CanBePushed = true; val.CollideWithTileMap = true; val.CollideWithOthers = true; val.ReflectProjectiles = true; val.PixelColliders = new List(); for (int i = 0; i < 2; i++) { val.PixelColliders.Add(new PixelCollider { ColliderGenerationMode = (PixelColliderGeneration)0, ManualOffsetX = -7, ManualOffsetY = -7, ManualWidth = 14, ManualHeight = 14, CollisionLayer = (CollisionLayer)((i == 0) ? 4 : 15), Enabled = true, IsTrigger = false }); } } public override void DoEffect(PlayerController user) { //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) switch (_state) { case FrisbeeBehaviour.State.INACTIVE: if (!Object.op_Implicit((Object)(object)_frisbee)) { _frisbee = _FrisbeePrefab.Instantiate(Vector2.op_Implicit(((GameActor)user).CenterPosition)).GetComponent(); } _frisbee.Launch(user); break; case FrisbeeBehaviour.State.FLYING: case FrisbeeBehaviour.State.DROPPED: _frisbee.Catch(); break; case FrisbeeBehaviour.State.RIDDEN: break; } } public override bool CanBeUsed(PlayerController user) { //IL_003b: 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_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_0068: 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) if (!((PlayerItem)this).CanBeUsed(user)) { return false; } Vector2 val; switch (_state) { case FrisbeeBehaviour.State.INACTIVE: return true; case FrisbeeBehaviour.State.FLYING: val = ((tk2dBaseSprite)((Component)_frisbee).GetComponent()).WorldCenter - ((GameActor)user).CenterPosition; return ((Vector2)(ref val)).sqrMagnitude < 4f; case FrisbeeBehaviour.State.RIDDEN: return false; case FrisbeeBehaviour.State.DROPPED: val = ((tk2dBaseSprite)((Component)_frisbee).GetComponent()).WorldCenter - ((GameActor)user).CenterPosition; return ((Vector2)(ref val)).sqrMagnitude < 4f; case FrisbeeBehaviour.State.COOLDOWN: return false; default: return true; } } public override void Update() { ((PlayerItem)this).Update(); ((PickupObject)this).CanBeDropped = _state == FrisbeeBehaviour.State.INACTIVE; } public override void Pickup(PlayerController player) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown _owner = player; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_owner).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Remove((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreRigidbodyCollision)); SpeculativeRigidbody specRigidbody2 = ((BraveBehaviour)_owner).specRigidbody; specRigidbody2.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody2.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreRigidbodyCollision)); base.Pickup(player); } private void OnPreRigidbodyCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { if (_state == FrisbeeBehaviour.State.RIDDEN) { Projectile component = ((Component)otherRigidbody).GetComponent(); if (component != null && !(component.Owner is PlayerController)) { PassiveReflectItem.ReflectBullet(component, true, ((BraveBehaviour)myRigidbody).gameActor, 30f, 1f, 1f, 0f); PhysicsEngine.SkipCollision = true; } } } public override void OnPreDrop(PlayerController player) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)_owner)) { SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_owner).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Remove((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreRigidbodyCollision)); } _owner = null; ((PlayerItem)this).OnPreDrop(player); } public override void OnDestroy() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)_owner)) { SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_owner).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Remove((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreRigidbodyCollision)); } ((PlayerItem)this).OnDestroy(); } } public class FrisbeeBehaviour : MonoBehaviour { public enum State { INACTIVE, FLYING, RIDDEN, DROPPED, COOLDOWN } private const float _FRISBEE_SPEED = 20f; private const float _SOUND_RATE = 0.16f; internal State _state; private PlayerController _owner; private PlayerController _rider; private SpeculativeRigidbody _body; private int _framesSinceLastCollision = 9999; private void Awake() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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 //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown _body = ((Component)this).GetComponent(); _body.AddCollisionLayerOverride(CollisionMask.LayerToMask((CollisionLayer)5)); SpeculativeRigidbody body = _body; body.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)body.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreRigidbodyCollision)); SpeculativeRigidbody body2 = _body; body2.OnRigidbodyCollision = (OnRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)body2.OnRigidbodyCollision, (Delegate?)new OnRigidbodyCollisionDelegate(OnRigidbodyCollision)); SpeculativeRigidbody body3 = _body; body3.OnTileCollision = (OnTileCollisionDelegate)Delegate.Combine((Delegate?)(object)body3.OnTileCollision, (Delegate?)new OnTileCollisionDelegate(OnTileCollision)); } private void OnRigidbodyCollision(CollisionData rigidbodyCollision) { //IL_001d: 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) if (_framesSinceLastCollision < 2) { Catch(); return; } _framesSinceLastCollision = 0; PhysicsEngine.PostSliceVelocity = 20f * dfNumberExtensions.Quantize(Vector2Extensions.ToAngle(((CastResult)rigidbodyCollision).Normal), 90f, (VectorConversions)2).ToVector(); ((Component)this).gameObject.PlayOnce("frisbee_bounce_sound"); } private void Start() { ((tk2dBaseSprite)((Component)this).GetComponent()).HeightOffGround = 0.4f; _body.AddCollisionLayerOverride(CollisionMask.LayerToMask((CollisionLayer)6)); } private void OnTileCollision(CollisionData tileCollision) { //IL_0057: 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_0033: Unknown result type (might be due to invalid IL or missing references) if (_framesSinceLastCollision < 2) { Catch(); return; } _framesSinceLastCollision = 0; if (Object.op_Implicit((Object)(object)_owner) && _state == State.FLYING && Vector3Extensions.GetAbsoluteRoom(_body.UnitCenter) != _owner.CurrentRoom) { Catch(); return; } PhysicsEngine.PostSliceVelocity = 20f * dfNumberExtensions.Quantize(Vector2Extensions.ToAngle(((CastResult)tileCollision).Normal), 90f, (VectorConversions)2).ToVector(); ((Component)this).gameObject.PlayOnce("frisbee_bounce_sound"); } private void OnPreRigidbodyCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { //IL_003b: 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_006b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)((BraveBehaviour)otherRigidbody).majorBreakable) && ((BraveBehaviour)otherRigidbody).majorBreakable.IsSecretDoor) { ((Component)otherRigidbody).gameObject.Play("Play_OBJ_wall_reveal_01"); ((BraveBehaviour)otherRigidbody).majorBreakable.ApplyDamage(1E+10f, Vector2.zero, false, true, true); ((BraveBehaviour)otherRigidbody).majorBreakable.ApplyDamage(1E+10f, Vector2.zero, false, true, true); ((BraveBehaviour)otherRigidbody).majorBreakable.ApplyDamage(1E+10f, Vector2.zero, false, true, true); } if (Object.op_Implicit((Object)(object)((BraveBehaviour)otherRigidbody).minorBreakable)) { PhysicsEngine.SkipCollision = true; } else if (Object.op_Implicit((Object)(object)((Component)otherRigidbody).GetComponent())) { PhysicsEngine.SkipCollision = true; } else if (Object.op_Implicit((Object)(object)((Component)otherRigidbody).GetComponent())) { PhysicsEngine.SkipCollision = true; } else if (Object.op_Implicit((Object)(object)((Component)otherRigidbody).GetComponent())) { PhysicsEngine.SkipCollision = true; } else if (Object.op_Implicit((Object)(object)((BraveBehaviour)otherRigidbody).transform.parent)) { DungeonDoorController component = ((Component)((BraveBehaviour)otherRigidbody).transform.parent).GetComponent(); if (component != null) { if (!component.IsOpen && !component.isLocked && _state == State.RIDDEN) { component.Open(false); } if (component.IsOpen) { PhysicsEngine.SkipCollision = true; } } } Projectile component2 = ((Component)otherRigidbody).GetComponent(); if (component2 != null && !(component2.Owner is PlayerController)) { PassiveReflectItem.ReflectBullet(component2, true, (GameActor)(object)_owner, 30f, 1f, 1f, 0f); PhysicsEngine.SkipCollision = true; } else if (_state == State.FLYING) { PlayerController component3 = ((Component)otherRigidbody).GetComponent(); if (component3 != null && component3.IsDodgeRolling) { HopOn(component3); } } } private void HopOn(PlayerController pc) { //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) _state = State.RIDDEN; _rider = pc; if (Object.op_Implicit((Object)(object)((BraveBehaviour)pc).knockbackDoer)) { ((BraveBehaviour)pc).knockbackDoer.ClearContinuousKnockbacks(); } if (pc.IsDodgeRolling) { pc.ForceStopDodgeRoll(); } pc.CurrentInputState = (PlayerInputState)4; ((BraveBehaviour)pc).knockbackDoer.ClearContinuousKnockbacks(); ((BraveBehaviour)pc).specRigidbody.Velocity = Vector2.zero; ((GameActor)pc).FallingProhibited = true; pc.IsGunLocked = true; _body.RegisterCarriedRigidbody(((BraveBehaviour)pc).specRigidbody); UpdateRider(); } public void Launch(PlayerController user) { //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_002e: 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) _owner = user; Vector2 vector = ((TwoAxisInputControl)user.m_activeActions.Move).Vector; float self = dfNumberExtensions.Quantize((((Vector2)(ref vector)).sqrMagnitude > 0.1f) ? Vector2Extensions.ToAngle(vector) : user.m_currentGunAngle, 90f, (VectorConversions)2); _state = State.FLYING; _body.CorrectForWalls(); _body.Velocity = self.ToVector(20f); ((Component)this).gameObject.PlayOnce("frisbee_throw_sound"); } public void Catch() { //IL_0087: Unknown result type (might be due to invalid IL or missing references) PlayerController rider = _rider; if (rider != null) { rider.m_overrideGunAngle = null; rider.forceAimPoint = null; rider.ClearInputOverride(Frisbee.ItemName); ((GameActor)rider).FallingProhibited = false; rider.IsGunLocked = false; _body.DeregisterCarriedRigidbody(((BraveBehaviour)rider).specRigidbody); if (!((BraveBehaviour)rider).healthHaver.IsDead) { ((BraveBehaviour)rider).specRigidbody.CorrectForWalls(andRigidBodies: true); rider.CurrentInputState = (PlayerInputState)0; rider.ForceStartDodgeRoll(); } } _state = State.COOLDOWN; _rider = null; LootEngine.DoDefaultItemPoof(_body.UnitBottomCenter, false, false); Object.Destroy((Object)(object)((Component)this).gameObject); } private void Update() { //IL_0048: 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_00be: Unknown result type (might be due to invalid IL or missing references) if (_state != State.FLYING && _state != State.RIDDEN) { return; } _framesSinceLastCollision++; ((Component)this).gameObject.Play("frisbee_spin_sound_alt", 0.16f); ((BraveBehaviour)((Component)this).GetComponent()).transform.localRotation = AngleFromFrisbeeAnimation().EulerZ(); if (_state != State.RIDDEN || !Object.op_Implicit((Object)(object)_rider)) { return; } if (((BraveBehaviour)_rider).healthHaver.IsDead) { Catch(); return; } GungeonActions activeActions = BraveInput.GetInstanceForPlayer(_rider.PlayerIDX).ActiveActions; if (((OneAxisInputControl)activeActions.DodgeRollAction).WasPressed && !_rider.WasPausedThisFrame) { Vector2 vector = ((TwoAxisInputControl)activeActions.Move).Vector; if (!(((Vector2)(ref vector)).magnitude <= 0.1f) && !_rider.IsEffectivelyOutOfBounds()) { Catch(); } } } private void LateUpdate() { UpdateRider(); } private void UpdateRider() { //IL_004d: 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_005d: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_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_00de: 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_00ed: Unknown result type (might be due to invalid IL or missing references) if (_state == State.RIDDEN && Object.op_Implicit((Object)(object)_rider) && !((BraveBehaviour)_rider).healthHaver.IsDead) { float num = AngleFromFrisbeeAnimation(); _rider.m_overrideGunAngle = num; _rider.forceAimPoint = ((GameActor)_rider).CenterPosition + num.ToVector(); ((BraveBehaviour)_rider).spriteAnimator.PlayFromFrame(_rider.GetEvenlySpacedIdleAnimation(num), 0); ((BraveBehaviour)_rider).spriteAnimator.UpdateAnimation(GameManager.INVARIANT_DELTA_TIME); ((BraveBehaviour)_rider).transform.position = Vector2.op_Implicit(dfVectorExtensions.Quantize(((tk2dBaseSprite)((Component)this).GetComponent()).WorldCenter + Vector3Extensions.XY(((BraveBehaviour)_rider).transform.position) - Vector3Extensions.XY(_rider.SpriteBottomCenter), 0.0625f)); ((BraveBehaviour)_rider).specRigidbody.Reinitialize(); } } private float AngleFromFrisbeeAnimation() { return (720f * BraveTime.ScaledTimeSinceStartup).Clamp180(); } } [HarmonyPatch(typeof(FlippableCover), "GetFlipDirection")] internal static class FlippableCoverPatch { private static bool Prefix(FlippableCover __instance, SpeculativeRigidbody flipperRigidbody, ref Direction __result) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 PlayerController component = ((Component)flipperRigidbody).GetComponent(); if (component == null) { return true; } if ((int)component.CurrentInputState != 4) { return true; } __result = (Direction)0; return false; } } public class GunPowderer : CwaffActive { public static string ItemName = "Gun Powderer"; public static string ShortDescription = "Mortar and Pistol"; public static string LongDescription = "Converts the nearest dropped gun to 1-5 spread ammo boxes, depending on its quality and remaining ammo percentage."; public static string Lore = "The art of gun powdering is relatively modern, despite the required implements all being rather primitive. This is perhaps because ammunition was in much higher supply in the Gungeon's early days, and powdering was largely unnecessary. Nowadays, resourceful Gungeoneers understand the value of smashing up their old and unused guns for ammo, and one can only hope they will eventually understand they wouldn't need so much ammo in the first place if they didn't miss 90% of their shots."; private const float _MAX_DIST = 5f; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PlayerItem obj = Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)3; obj.consumable = false; ItemBuilder.SetCooldownType(obj, (CooldownType)0, 2f); } public override void DoEffect(PlayerController user) { //IL_0045: 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_0050: 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) Gun val = null; float num = 5f; foreach (DebrisObject allDebri in StaticReferenceManager.AllDebris) { if (!allDebri.IsPickupObject) { continue; } PickupObject componentInChildren = ((Component)allDebri).GetComponentInChildren(); if (componentInChildren == null) { continue; } Gun component = ((Component)componentInChildren).GetComponent(); if (component != null) { Vector2 val2 = ((BraveBehaviour)component).sprite.WorldCenter - ((GameActor)user).CenterPosition; float magnitude = ((Vector2)(ref val2)).magnitude; if (!(magnitude >= num)) { val = component; num = magnitude; } } } if (Object.op_Implicit((Object)(object)val)) { ConvertGunToAmmo(val); } } private void ConvertGunToAmmo(Gun gun) { //IL_0035: 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_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_0064: 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) float num = (float)gun.CurrentAmmo / (float)gun.AdjustedMaxAmmo; int num2 = Mathf.Clamp(Mathf.Min(((PickupObject)(object)gun).QualityGrade(), Mathf.CeilToInt(num * 5f)), 1, 5); Vector2 worldCenter = ((BraveBehaviour)gun).sprite.WorldCenter; Lazy.DoSmokeAt(Vector2.op_Implicit(worldCenter)); Object.Destroy((Object)(object)((Component)gun).gameObject); for (int i = 1; i <= num2; i++) { float self = (float)i * (360f / (float)num2); ((MonoBehaviour)this).StartCoroutine(SpawnSomeAmmo(worldCenter + self.ToVector(1.5f), 0.25f * (float)i)); } } private IEnumerator SpawnSomeAmmo(Vector2 pos, float delay) { //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) yield return (object)new WaitForSeconds(delay); LootEngine.SpawnItem(((Component)ItemHelper.Get(Items.PartialAmmo)).gameObject, Vector2.op_Implicit(pos), Vector2.zero, 0f, true, true, false); } } public class BottledAbyss : CwaffActive { private class Voidyboi : MonoBehaviour { private float _scale; private RoomHandler _room; private Vector2 _pos; private bool _doStun; private IEnumerator Start() { ((Component)this).gameObject.transform.localScale = Vector3.one; _pos = Vector2.op_Implicit(((Component)this).gameObject.transform.position); _room = Vector3Extensions.GetAbsoluteRoom(_pos); PlayerController[] allPlayers = GameManager.Instance.AllPlayers; for (int i = 0; i < allPlayers.Length; i++) { if (allPlayers[i].HasSynergy(Synergy.SUNKEN_EYE)) { _doStun = true; } } for (float elapsed = 0f; elapsed < 2f; elapsed += BraveTime.DeltaTime) { float num = elapsed / 2f; _scale = 20f * num * num; ((MonoBehaviour)(object)this).LoopSoundIf(num > 0.5f, "sound_of_the_abyss_calling"); yield return null; } for (float elapsed = 0f; elapsed < 7f; elapsed += BraveTime.DeltaTime) { ((MonoBehaviour)(object)this).LoopSoundIf(play: true, "sound_of_the_abyss_calling"); yield return null; } for (float elapsed = 0f; elapsed < 1f; elapsed += BraveTime.DeltaTime) { float num2 = elapsed / 1f; _scale = 20f * (1f - num2 * num2); ((MonoBehaviour)(object)this).LoopSoundIf(num2 < 0.5f, "sound_of_the_abyss_calling"); yield return null; } allPlayers = GameManager.Instance.AllPlayers; for (int i = 0; i < allPlayers.Length; i++) { ((GameActor)allPlayers[i]).SetIsFlying(false, ItemName, false, false); } Object.Destroy((Object)(object)((Component)this).gameObject); } private void Update() { //IL_001c: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Invalid comparison between Unknown and I4 //IL_0177: 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) //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) ((Component)this).gameObject.transform.localScale = new Vector3(_scale, _scale, 1f); if (_room == null) { return; } float num = Mathf.Max(0f, 0.5f * _scale - 2.5f); if (num == 0f) { return; } float num2 = num * num; foreach (AIActor allNearbyEnemy in Vector3Extensions.XY(((Component)this).gameObject.transform.position).GetAllNearbyEnemies(num, ignoreWalls: true, includeDead: true, includeGone: false, includeInvulnerable: true, limitToCurrentRoom: false, includeHarmless: true)) { if (((GameActor)allNearbyEnemy).IsFalling || !((GameActor)allNearbyEnemy).IsGrounded || !allNearbyEnemy.HasBeenEngaged || (int)allNearbyEnemy.State != 2) { continue; } HealthHaver healthHaver = ((BraveBehaviour)allNearbyEnemy).healthHaver; if (healthHaver == null || healthHaver.IsBoss || healthHaver.IsSubboss || ((BraveBehaviour)allNearbyEnemy).specRigidbody == null) { continue; } if (_doStun) { BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)allNearbyEnemy).behaviorSpeculator; if (behaviorSpeculator != null && !behaviorSpeculator.ImmuneToStun) { behaviorSpeculator.Stun(0.1f, true); } } ((GameActor)allNearbyEnemy).ForceFall(); } PlayerController[] allPlayers = GameManager.Instance.AllPlayers; foreach (PlayerController val in allPlayers) { if (Object.op_Implicit((Object)(object)val) && !((GameActor)val).IsFalling && !((GameActor)val).FallingProhibited && !((GameActor)val).IsFlying && !val.IsGhost && ((GameActor)val).QueryGroundedFrame() && Object.op_Implicit((Object)(object)((BraveBehaviour)val).specRigidbody)) { Vector2 val2 = _pos - ((BraveBehaviour)val).specRigidbody.UnitBottomCenter; if (!(((Vector2)(ref val2)).sqrMagnitude > num2)) { ((GameActor)val).ForceFall(); ((GameActor)val).SetIsFlying(true, ItemName, false, false); } } } } } public static string ItemName = "Bottled Abyss"; public static string ShortDescription = "Stares Back"; public static string LongDescription = "Summons a void under the player that expands to consume all grounded enemies (and players) in a large radius after a brief delay. Does not affect bosses or inanimate objects."; public static string Lore = "A bottle that at first glance contains nothing inside of it, but upon further inspection contains even less. It is highly recommended that any attempt to open the bottle be quickly followed up with running away as fast as possible."; private const float _EXPAND_TIME = 2f; private const float _HOLD_TIME = 7f; private const float _COLLAPSE_TIME = 1f; private const float _MAX_SCALE = 20f; internal static GameObject _VoidPrefab = null; internal static GameObject _VoidSplashVFX = null; public static void Init() { //IL_0021: 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_0054: Expected O, but got Unknown //IL_0094: 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) PlayerItem obj = Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)2; obj.consumable = false; ItemBuilder.SetCooldownType(obj, (CooldownType)2, 3f); _VoidPrefab = Extensions.ClonePrefab((GameObject)BraveResources.Load("Global Prefabs/VFX_ParadoxPortal", ".prefab")); Object.Destroy((Object)(object)_VoidPrefab.GetComponent()); _VoidPrefab.AddComponent(); Material material = ((Renderer)_VoidPrefab.GetComponent()).material; material.SetTexture("_PortalTex", (Texture)null); material.SetColor("_EdgeColor", Color.black); material.SetFloat("_RotSpeed", 120f); material.SetFloat("_Parallax", 40f); material.SetFloat("_Cutoff", 10f); material.SetFloat("_SSMag", 40f); material.SetFloat("_LSMag", 40f); material.SetFloat("_HoleEdgeDepth", 0.02f); material.SetColor("_Magnitudes", 0.05f * Color.white); material.SetFloat("_UVDistCutoff", 0.4f); _VoidSplashVFX = VFX.Create("void_splash_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } public override bool CanBeUsed(PlayerController user) { if (((PlayerItem)this).CanBeUsed(user)) { return user.IsInCombat; } return false; } public override void DoEffect(PlayerController user) { //IL_0008: 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_00b5: Unknown result type (might be due to invalid IL or missing references) GameObject voidSplashVFX = _VoidSplashVFX; Vector2 centerPosition = ((GameActor)user).CenterPosition; float? endScale = 0.1f; CwaffVFX.SpawnBurst(voidSplashVFX, 30, centerPosition, 1f, null, 8f, 4f, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.Random, 0.4f, null, 0f, null, fadeIn: false, uniform: false, null, endScale); ((Component)user).gameObject.Play("sound_of_opening_the_abyss"); Object.Instantiate(_VoidPrefab, Vector2.op_Implicit(((GameActor)user).CenterPosition), Quaternion.identity); } } public class BorrowedTime : CwaffActive { public static string ItemName = "Borrowed Time"; public static string ShortDescription = "Mafuba"; public static string LongDescription = "Captures all non-jammed, non-boss enemies in a room. Using in an empty combat room will release all captured enemies, with a chance for enemies to spawn Jammed. All captured enemies will be forcibly released in boss rooms. Cannot be dropped while enemies are captured."; public static string Lore = "The first Gungeoneer to discover this hourglass believed they had stumbled upon an incomprehensibly powerful artifact, when in fact it was quite the opposite: a dangerous failure of a prototype thrown out and forgotten about by the Sorceress. The poor Gungeoneer couldn't believe their luck as they breezed through room after room, only to reach the Trigger Twins and find themselves fighting far more than the 2 oversized Bullet Kin they signed up for...."; internal static int _EmptyId; internal static int _FullId; internal static VFXPool _MafubaVFX = null; internal const float _RESPAWN_AS_JAMMED_CHANCE = 0.1f; private List _borrowedEnemies = new List(); private PlayerController _owner; private RoomHandler _lastCheckedRoom; private bool _isBossPresent; private bool _roomCanHaveEnemies = true; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PlayerItem obj = Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)2; ((PickupObject)(object)obj).AddToShop(ModdedShopType.TimeTrader); ItemBuilder.SetCooldownType(obj, (CooldownType)0, 2f); obj.consumable = false; _EmptyId = ((BraveBehaviour)obj).sprite.spriteId; _FullId = ((BraveBehaviour)obj).sprite.collection.GetSpriteIdByName("borrowed_time_full_icon"); _MafubaVFX = Items.MagicLamp.AsGun().DefaultModule.projectiles[0].hitEffects.overrideMidairDeathVFX.CreatePoolFromVFXGameObject(); } public override void Pickup(PlayerController player) { _owner = player; base.Pickup(player); } public override void OnPreDrop(PlayerController player) { if (_roomCanHaveEnemies && _borrowedEnemies.Count > 0) { ((MonoBehaviour)_owner).StartCoroutine(ReapWhatYouSow(this, _owner, _borrowedEnemies)); } _owner = null; ((PlayerItem)this).OnPreDrop(player); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)_owner)) { ((MonoBehaviour)_owner).StartCoroutine(ReapWhatYouSow(this, _owner, _borrowedEnemies)); } ((PlayerItem)this).OnDestroy(); } public override void Update() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Invalid comparison between Unknown and I4 //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Invalid comparison between Unknown and I4 ((PlayerItem)this).Update(); if (Object.op_Implicit((Object)(object)_owner) && _owner.CurrentRoom != _lastCheckedRoom) { RoomHandler val = (_lastCheckedRoom = _owner.CurrentRoom); _roomCanHaveEnemies = val != null && val.EverHadEnemies && !val.area.IsProceduralRoom && ((int)val.area.PrototypeRoomCategory == 2 || (int)val.area.PrototypeRoomCategory == 1); bool isBossPresent = _isBossPresent; _isBossPresent = CheckIfBossIsPresent(); if (_isBossPresent && !isBossPresent && _borrowedEnemies.Count > 0) { ((MonoBehaviour)_owner).StartCoroutine(ReapWhatYouSow(this, _owner, _borrowedEnemies)); } } } public override bool CanBeUsed(PlayerController user) { if (!user.InExitCell && _roomCanHaveEnemies) { return ((PlayerItem)this).CanBeUsed(user); } return false; } private static IEnumerator ReapWhatYouSow(BorrowedTime bt, PlayerController reaper, List enemies) { if (enemies.Count == 0) { yield break; } while (GameManager.IsBossIntro) { yield return null; } if (Object.op_Implicit((Object)(object)reaper)) { RoomHandler room = reaper.CurrentRoom; if (room != null) { int enemiesToSpawn = enemies.Count; PickupObject obj = ItemHelper.Get(Items.ChestTeleporter); GameObject tpvfx = ((ChestTeleporterItem)((obj is ChestTeleporterItem) ? obj : null)).TeleportVFX; for (int i = 0; i < enemiesToSpawn; i++) { IntVector2 randomVisibleClearSpot = room.GetRandomVisibleClearSpot(2, 2); AIActor val = AIActor.Spawn(((BraveBehaviour)EnemyDatabase.GetOrLoadByGuid(enemies[i])).aiActor, randomVisibleClearSpot, GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(randomVisibleClearSpot), true, (AwakenAnimationType)0, true); if (Random.value <= 0.1f) { val.BecomeBlackPhantom(); } PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(((BraveBehaviour)val).specRigidbody, (int?)null, false); ((Component)reaper).gameObject.Play("Play_OBJ_chestwarp_use_01"); SpawnManager.SpawnVFX(tpvfx, Vector2.op_Implicit(((GameActor)val).CenterPosition), Quaternion.identity, true); yield return (object)new WaitForSeconds(0.05f); } if (!room.IsSealed) { room.SealRoom(); GameManager.Instance.DungeonMusicController.SwitchToActiveMusic((DungeonMusicState?)null); } if (Object.op_Implicit((Object)(object)bt)) { bt._borrowedEnemies.Clear(); ((PickupObject)bt).CanBeDropped = true; ((BraveBehaviour)bt).sprite.SetSprite(_EmptyId); } yield break; } } if (!Object.op_Implicit((Object)(object)reaper)) { ETGModConsole.Log((object)"Borrowed Time failed by activating without an owner, tell Captain Pretzel", false); } else { ETGModConsole.Log((object)"Borrowed Time failed by activating without a valid room, tell Captain Pretzel", false); } } private bool CheckIfBossIsPresent() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_owner)) { return ((GameActor)_owner).CenterPosition.GetAllNearbyEnemies().Any((AIActor enemy) => ((BraveBehaviour)enemy).healthHaver.IsBoss); } return false; } public override void DoEffect(PlayerController user) { //IL_001e: 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) //IL_00c0: 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_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) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) if (_isBossPresent) { return; } RoomHandler absoluteParentRoom = ((DungeonPlaceableBehaviour)user).GetAbsoluteParentRoom(); if (absoluteParentRoom == null || absoluteParentRoom != _lastCheckedRoom) { return; } ReadOnlyCollection allNearbyEnemies = ((GameActor)user).CenterPosition.GetAllNearbyEnemies(); if (allNearbyEnemies.Count == 0) { if (_borrowedEnemies.Count > 0 && ((DungeonPlaceableBehaviour)user).GetAbsoluteParentRoom() != null) { ((MonoBehaviour)user).StartCoroutine(ReapWhatYouSow(this, user, _borrowedEnemies)); } return; } ((BraveBehaviour)this).sprite.SetSprite(_FullId); ((Component)this).gameObject.Play("borrowed_time_capture_sound"); for (int num = allNearbyEnemies.Count - 1; num >= 0; num--) { AIActor val = allNearbyEnemies[num]; if (!val.IsABoss() && !val.IsBlackPhantom) { Vector2 centerPosition = ((GameActor)val).CenterPosition; for (int i = 0; i < 7; i++) { _MafubaVFX.SpawnAtPosition(Vector2Extensions.ToVector3ZisY(centerPosition + ((float)i * 360f / 7f).ToVector(0.75f), -1f), 0f, (Transform)null, (Vector2?)null, (Vector2?)null, (float?)(-0.05f), false, (SpawnMethod)null, (tk2dBaseSprite)null, false); } val.EraseFromExistence(true); _borrowedEnemies.Add(val.EnemyGuid); } } if (_borrowedEnemies.Count > 0) { ((PickupObject)this).CanBeDropped = false; } } public override void MidGameSerialize(List data) { ((PickupObject)this).MidGameSerialize(data); data.Add(_borrowedEnemies.Count); foreach (string borrowedEnemy in _borrowedEnemies) { data.Add(borrowedEnemy); } } public override void MidGameDeserialize(List data) { ((PickupObject)this).MidGameDeserialize(data); int num = 0; int num2 = (int)data[num++]; for (int i = 0; i < num2; i++) { _borrowedEnemies.Add((string)data[num++]); } ((BraveBehaviour)this).sprite.SetSprite((num2 > 0) ? _FullId : _EmptyId); } } public class StackOfTorches : CwaffActive { public static string ItemName = "Stack of Torches"; public static string ShortDescription = "Back in the Mines"; public static string LongDescription = "Places a torch in front of the player, which has several effects: 1) Placing a torch guarantees at most one additional wave of enemies will spawn in the current room. 2) The first four torches placed in a room have a 25%, 50%, 75%, and 100% chance of preventing ALL additional waves of enemies from spawning. 3) Each placed torch has a 60% chance of brightening up a room under the darkness effect. 4) Each placed torch increases the chance of finding treasure on room clear by 5%, with 20 torches guaranteeing a chest."; public static string Lore = "An absolute staple in any adventurer's inventory. These state-of-the-art torches come pre-bundled, pre-lit, pre-mounted, and pre-used, having been yanked straight off the Gungeon's walls. Their lack of resilience towards bullets is matched only by their embarrassingly high susceptibility to singular drops of water. Even so, their warm, radiant glow provides a reassuring sense of safety."; private const float _MAX_WALL_DIST = 1.6f; private const float _CHANCE_TO_END_DARK_ROOM = 0.6f; private const float _REWARD_CHANCE_PER_TORCH = 0.05f; internal static Dictionary _TorchesInRoom = new Dictionary(); private static GameObject _TorchPrefab = null; private static GameObject _TorchPurplePrefab = null; private static GameObject _TorchBluePrefab = null; private static GameObject _TorchSidePrefab = null; private static GameObject _SconcePrefab = null; private static List _Torches = null; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PlayerItem obj = Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)1; ((PickupObject)(object)obj).AddToShop(ModdedShopType.Rusty); ItemBuilder.SetCooldownType(obj, (CooldownType)3, 0.1f); obj.numberOfUses = 64; _TorchPrefab = Dissect.FindDefaultResource("DefaultTorch"); _TorchPurplePrefab = Dissect.FindDefaultResource("DefaultTorchPurple"); _TorchBluePrefab = Dissect.FindDefaultResource("DefaultTorchBlue"); _TorchSidePrefab = Dissect.FindDefaultResource("DefaultTorchSide"); _SconcePrefab = Dissect.FindDefaultResource("Sconce_Light"); _Torches = new List { _TorchPrefab, _TorchPurplePrefab, _TorchBluePrefab, _TorchSidePrefab }; } private static void SpawnAdditionalRoomRewardBasedOnTorchCount(RoomHandler room) { //IL_002d: 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) //IL_0067: 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) if (!_TorchesInRoom.ContainsKey(room)) { return; } float num = 0.05f * (float)_TorchesInRoom[room]; if (Random.value > num) { return; } IntVector2 bestRewardLocation = room.GetBestRewardLocation(new IntVector2(2, 1), (RewardLocationStyle)0, true); if (GameStatsManager.Instance.IsRainbowRun) { LootEngine.SpawnBowlerNote(GameManager.Instance.RewardManager.BowlerNoteChest, ((IntVector2)(ref bestRewardLocation)).ToCenterVector2(), room, true); return; } Chest val = room.SpawnRoomRewardChest((WeightedGameObjectCollection)null, bestRewardLocation); if (val != null) { val.ForceUnlock(); } } public override void DoEffect(PlayerController user) { //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_001e: 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_0021: 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_002b: 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_0047: 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_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_0062: Unknown result type (might be due to invalid IL or missing references) float currentGunAngle = user.m_currentGunAngle; Vector2 val = ((GameActor)user).CenterPosition.ToNearestWall(currentGunAngle); Vector2 val2 = val - ((GameActor)user).CenterPosition; if (((Vector2)(ref val2)).magnitude > 1.6f) { GameObject original = _Torches.ChooseRandom(); Vector3? position = Vector2.op_Implicit(((GameActor)user).CenterPosition + 1.6f * ((Vector2)(ref val2)).normalized); Anchor? anchor = (Anchor)4; original.Instantiate(position, null, anchor); ((Component)this).gameObject.Play("mc_torch_place"); } else { GameObject sconcePrefab = _SconcePrefab; Vector3? position2 = Vector2.op_Implicit(val); Anchor? anchor = (Anchor)1; sconcePrefab.Instantiate(position2, null, anchor); ((Component)this).gameObject.Play("mc_lantern_place"); } RoomHandler room = user.CurrentRoom; if (room == null) { return; } if (!_TorchesInRoom.ContainsKey(room)) { _TorchesInRoom[room] = 0; } int num = ++_TorchesInRoom[room]; List remainingReinforcementLayers = room.remainingReinforcementLayers; if (remainingReinforcementLayers != null) { int num2 = remainingReinforcementLayers.Count; while (num2 > 1) { room.remainingReinforcementLayers.RemoveAt(--num2); } if (num2 > 0 && 0.25f * (float)num >= Random.value) { room.ClearReinforcementLayers(); } } if (room.IsDarkAndTerrifying && Random.value <= 0.6f) { room.EndTerrifyingDarkRoom(1f, 0.1f, 1f, "Play_ENM_lighten_world_01"); } if (num == 1) { RoomHandler obj = room; obj.OnEnemiesCleared = (Action)Delegate.Combine(obj.OnEnemiesCleared, (Action)delegate { SpawnAdditionalRoomRewardBasedOnTorchCount(room); }); } } } public class ChestScanner : CwaffActive { public static string ItemName = "Chest Scanner"; public static string ShortDescription = "Try Before You Buy"; public static string LongDescription = "Reveals the contents of a single unopened chest in the current room. Subsequently destroying chests nullifies any revealed contents. Reusable."; public static string Lore = "The tricky thing about most chests in the Gungeon is that their contents are seemingly not determined until they are opened, making scanning them a largely fruitless endeavor. Similar to an over-eager child on Christmas Eve, this handy little device operates by shaking chests at a sub-atomic level, tricking them into thinking they've been opened before using half-century old x-ray technologies to determine their contents."; private PlayerController _owner; private Chest _nearestChest; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PlayerItem obj = Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)2; ItemBuilder.SetCooldownType(obj, (CooldownType)0, 1f); obj.consumable = false; } public override void Pickup(PlayerController player) { _owner = player; base.Pickup(player); } public override void OnPreDrop(PlayerController player) { _owner = null; ((PlayerItem)this).OnPreDrop(player); } public override bool CanBeUsed(PlayerController user) { if (!((PlayerItem)this).CanBeUsed(user)) { return false; } _nearestChest = null; foreach (Chest item in StaticReferenceManager.AllChests.EmptyIfNull()) { if (Object.op_Implicit((Object)(object)item) && !item.IsOpen && !item.IsBroken && ((DungeonPlaceableBehaviour)item).GetAbsoluteParentRoom() == user.CurrentRoom && !Object.op_Implicit((Object)(object)((Component)item).gameObject.GetComponent())) { _nearestChest = item; return true; } } return false; } public override void DoEffect(PlayerController user) { if (Object.op_Implicit((Object)(object)_nearestChest)) { _nearestChest.DetermineContents(user, 0); ((Component)_nearestChest).gameObject.AddComponent(); } } } public class ScannedChest : MonoBehaviour { private List _pickups = new List(); private List _offsets = new List(); private Vector2 _basePos = Vector2.op_Implicit(Vector3.zero); private Chest _chest; private IEnumerator Start() { _basePos = ((tk2dBaseSprite)((Component)this).GetComponent()).WorldTopCenter + new Vector2(0f, 1f); _chest = ((Component)this).GetComponent(); RoomHandler room = ((DungeonPlaceableBehaviour)_chest).GetAbsoluteParentRoom(); room.DeregisterInteractable((IPlayerInteractable)(object)_chest); tk2dSprite sprite = ((Component)_chest).GetComponent(); bool oldOverrideMaterial = ((tk2dBaseSprite)sprite).usesOverrideMaterial; Shader oldShader = ((BraveBehaviour)sprite).renderer.material.shader; ((tk2dBaseSprite)(object)sprite).MakeHolographic(); ((Component)this).gameObject.Play("gun_synthesizer_activate_sound"); yield return (object)new WaitForSeconds(0.75f); ((tk2dBaseSprite)sprite).usesOverrideMaterial = oldOverrideMaterial; ((BraveBehaviour)sprite).renderer.material.shader = oldShader; room.RegisterInteractable((IPlayerInteractable)(object)_chest); int num = 0; float num2 = 0f; foreach (PickupObject item in _chest.contents.EmptyIfNull()) { tk2dSprite val = Lazy.SpriteObject(((BraveBehaviour)item).sprite.collection, ((BraveBehaviour)item).sprite.spriteId); ((Component)(object)val).SetAlpha(0.5f); _pickups.Add(((Component)val).gameObject); _offsets.Add(new Vector2(num2, 0f)); num2 += 0.25f + ((tk2dBaseSprite)val).GetCurrentSpriteDef().boundsDataExtents.x; num++; } num2 *= 0.5f; for (int i = 0; i < _offsets.Count; i++) { _offsets[i] = new Vector2(_offsets[i].x - num2, 0f); } } private void Update() { //IL_0055: 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_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_007e: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_chest) || _chest.IsOpen || _chest.IsBroken) { Object.Destroy((Object)(object)this); return; } int num = 0; foreach (GameObject pickup in _pickups) { ((tk2dBaseSprite)pickup.GetComponent()).PlaceAtPositionByAnchor(Vector2.op_Implicit(_offsets[num++] + _basePos.HoverAt(0.15f, 4f)), (Anchor)0); } } private void OnDestroy() { _pickups.SafeDestroyAll(); } } public class Cuppajoe : CwaffActive { public static string ItemName = "Cuppajoe"; public static string ShortDescription = "Not A Morning Person"; public static string LongDescription = "Dramatically increases rate of fire, reload speed, movement speed, and dodge roll speed for 12 seconds, but dramatically decreases these stats for 8 seconds afterwards."; public static string Lore = "Coffee is something of a miracle beverage, letting you move faster, react quicker, focus harder, aim better, think better, learn better, practice more effectively, earn more money, heal all your illnesses, find true love, cure cancer, achieve world peace, end world hunger, open your third eye, see the future, reach nirvana, rule the galaxy, observe the multiverse...and it tastes good. Coffee's great isn't it!? Have another cup!!"; private Caffeination _caffeine; private PlayerController _owner; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PlayerItem obj = Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)1; obj.consumable = false; ItemBuilder.SetCooldownType(obj, (CooldownType)0, 8f); } public override void Pickup(PlayerController player) { _owner = player; _caffeine = GameObjectExtensions.GetOrAddComponent(((Component)player).gameObject); base.Pickup(player); } public override void OnPreDrop(PlayerController player) { _owner = null; _caffeine = null; ((PlayerItem)this).OnPreDrop(player); } public override bool CanBeUsed(PlayerController user) { if (Object.op_Implicit((Object)(object)_caffeine)) { return _caffeine._state == Caffeination.State.NEUTRAL; } return true; } public override void DoEffect(PlayerController user) { _caffeine.AnotherCup(); ((PlayerItem)this).m_activeDuration = (user.HasSynergy(Synergy.CAFFEINE_ADDICTION) ? 9f : 12f); ((PlayerItem)this).m_activeElapsed = 0f; ((PlayerItem)this).IsCurrentlyActive = true; } public override void Update() { ((PlayerItem)this).Update(); if (Object.op_Implicit((Object)(object)_owner) && ((PlayerItem)this).IsCurrentlyActive && ((PlayerItem)this).m_activeElapsed >= ((PlayerItem)this).m_activeDuration) { ((PlayerItem)this).IsCurrentlyActive = false; ((PlayerItem)this).CurrentTimeCooldown = (_owner.HasSynergy(Synergy.CAFFEINE_ADDICTION) ? 3f : 8f); } } } internal class Caffeination : MonoBehaviour { internal enum State { NEUTRAL, CAFFEINATED, CRASHED } [HarmonyPatch] private class CuppajoeAnimationPatch { [HarmonyPatch(typeof(PlayerController), "GetBaseAnimationName")] private static bool Prefix(PlayerController __instance, Vector2 v, float gunAngle, bool invertThresholds, bool forceTwoHands, ref string __result) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) Caffeination component = ((Component)__instance).GetComponent(); if (component == null || component._state != State.CAFFEINATED) { return true; } __result = GetCaffeinatedAnimationName(__instance, v, gunAngle, invertThresholds, forceTwoHands); return false; } } internal const float _BOOST_TIME = 12f; internal const float _CRASH_TIME = 8f; internal const float _ADDICTED_BOOST_TIME = 9f; internal const float _ADDICTED_CRASH_TIME = 3f; private PlayerController _owner; private StatModifier[] _caffeineBuffs; private StatModifier[] _crashNerfs; internal State _state; private void Start() { _owner = ((Component)this).GetComponent(); _caffeineBuffs = (StatModifier[])(object)new StatModifier[4] { ((StatType)1).Mult(1.5f), ((StatType)28).Mult(1.5f), ((StatType)0).Mult(1.5f), ((StatType)10).Mult(0.75f) }; _crashNerfs = (StatModifier[])(object)new StatModifier[4] { ((StatType)1).Mult(0.65f), ((StatType)28).Mult(0.75f), ((StatType)0).Mult(0.65f), ((StatType)10).Mult(1.5f) }; } private void Update() { float num = 1f; if (_state == State.CAFFEINATED) { num = ((((Vector2)(ref ((BraveBehaviour)_owner).specRigidbody.Velocity)).sqrMagnitude > 1f) ? 4f : 2.5f); } else if (_state == State.CRASHED) { num = 0.5f; } ((BraveBehaviour)_owner).spriteAnimator.ClipFps = ((BraveBehaviour)_owner).spriteAnimator.CurrentClip.fps * num; } public void AnotherCup() { if (_state == State.NEUTRAL) { ((MonoBehaviour)_owner).StartCoroutine(AnotherCup_CR()); } IEnumerator AnotherCup_CR() { bool addicted = _owner.HasSynergy(Synergy.CAFFEINE_ADDICTION); ((Component)_owner).gameObject.Play("coffee_drink_sound"); _state = State.CAFFEINATED; StatModifier[] caffeineBuffs = _caffeineBuffs; foreach (StatModifier item in caffeineBuffs) { _owner.ownerlessStatModifiers.Add(item); } _owner.stats.RecalculateStats(_owner, false, false); yield return (object)new WaitForSeconds(addicted ? 9f : 12f); _state = State.CRASHED; caffeineBuffs = _caffeineBuffs; foreach (StatModifier item2 in caffeineBuffs) { _owner.ownerlessStatModifiers.Remove(item2); } caffeineBuffs = _crashNerfs; foreach (StatModifier item3 in caffeineBuffs) { _owner.ownerlessStatModifiers.Add(item3); } _owner.stats.RecalculateStats(_owner, false, false); yield return (object)new WaitForSeconds(addicted ? 3f : 8f); _state = State.NEUTRAL; caffeineBuffs = _crashNerfs; foreach (StatModifier item4 in caffeineBuffs) { _owner.ownerlessStatModifiers.Remove(item4); } _owner.stats.RecalculateStats(_owner, false, false); } } private static string GetCaffeinatedAnimationName(PlayerController pc, Vector2 v, float gunAngle, bool invertThresholds = false, bool forceTwoHands = false) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 //IL_016c: 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) string empty = string.Empty; bool flag = (Object)(object)((GameActor)pc).CurrentGun != (Object)null; if (flag && (int)((GameActor)pc).CurrentGun.Handedness == 4) { forceTwoHands = true; } if ((int)GameManager.Instance.CurrentLevelOverrideState == 4) { flag = false; } float num = 155f; float num2 = 25f; if (invertThresholds) { num = -155f; num2 -= 50f; } float num3 = 120f; float num4 = 60f; float num5 = -60f; float num6 = -120f; bool flag2 = gunAngle <= num && gunAngle >= num2; if (invertThresholds) { flag2 = gunAngle <= num || gunAngle >= num2; } if (pc.IsGhost) { if (flag2) { if (gunAngle < num3 && gunAngle >= num4) { empty = "ghost_idle_back"; } else { float num7 = 105f; empty = ((!(Mathf.Abs(gunAngle) > num7)) ? "ghost_idle_back_right" : "ghost_idle_back_left"); } } else if (gunAngle <= num5 && gunAngle >= num6) { empty = "ghost_idle_front"; } else { float num8 = 105f; empty = ((!(Mathf.Abs(gunAngle) > num8)) ? "ghost_idle_right" : "ghost_idle_left"); } } else if (((GameActor)pc).IsFlying) { empty = ((!flag2) ? ((gunAngle <= num5 && gunAngle >= num6) ? ((!pc.RenderBodyHand) ? "jetpack_down" : "jetpack_down_hand") : ((!pc.RenderBodyHand) ? "jetpack_right" : "jetpack_right_hand")) : ((!(gunAngle < num3) || !(gunAngle >= num4)) ? "jetpack_right_bw" : "jetpack_up")); } else if (v == Vector2.zero || pc.IsStationary) { empty = (pc.IsPetting ? "pet" : (flag2 ? ((!(gunAngle < num3) || !(gunAngle >= num4)) ? (((!forceTwoHands && flag) || pc.ForceHandless) ? "run_right" : "run_right_twohands") : (((forceTwoHands || !flag) && !pc.ForceHandless) ? "run_right_twohands" : ((!pc.RenderBodyHand) ? "run_right" : "run_right_hand"))) : ((!(gunAngle <= num5) || !(gunAngle >= num6)) ? (((forceTwoHands || !flag) && !pc.ForceHandless) ? "run_right_twohands" : ((!pc.RenderBodyHand) ? "run_right" : "run_right_hand")) : (((forceTwoHands || !flag) && !pc.ForceHandless) ? "run_down_twohands" : ((!pc.RenderBodyHand) ? "run_down" : "run_down_hand"))))); } else if (flag2) { string text = (((!forceTwoHands && flag) || pc.ForceHandless) ? "run_right_bw" : "run_right_bw_twohands"); if (gunAngle < num3 && gunAngle >= num4) { text = (((forceTwoHands || !flag) && !pc.ForceHandless) ? "run_up_twohands" : ((!pc.RenderBodyHand) ? "run_up" : "run_up_hand")); } empty = text; } else { string text2 = "run_right"; if (gunAngle <= num5 && gunAngle >= num6) { text2 = "run_down"; } if ((forceTwoHands || !flag) && !pc.ForceHandless) { text2 += "_twohands"; } else if (pc.RenderBodyHand) { text2 += "_hand"; } empty = text2; } if (pc.UseArmorlessAnim && !pc.IsGhost) { empty += "_armorless"; } return empty; } } public class IceCream : CwaffActive { public static string ItemName = "Ice Cream"; public static string ShortDescription = "Frozen Treat to Warm the Heart"; public static string LongDescription = "When used near an enemy with a gun, replaces their gun with ice cream. Enemies with ice cream are non-hostile, and will seek out other enemies with guns and try to share their ice cream."; public static string Lore = "The ice cream sundae is happiness in dairy format -- an irresistible, timeless classic that needs no introduction or explanation. Getting it into the hands of a frenzied Gundead may prove difficult, but that difficulty is more than made up for by the friendships you'll make by going through the effort of doing it anyway. :>"; internal static GameObject _HeartVFX; public static void Init() { //IL_0021: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) PlayerItem obj = Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)2; obj.consumable = false; ItemBuilder.SetCooldownType(obj, (CooldownType)0, 15f); Color? emissiveColour = Color.magenta; _HeartVFX = VFX.Create("heart_vfx", 18f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 1f, emissiveColour); EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5").AddSpecialAnimation("bullet_smile", "smile", 2f); } public override bool CanBeUsed(PlayerController user) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) foreach (AIActor allNearbyEnemy in ((GameActor)user).CenterPosition.GetAllNearbyEnemies(2.5f)) { if (HappyIceCreamHaver.NeedsIceCream(allNearbyEnemy)) { return ((PlayerItem)this).CanBeUsed(user); } } return false; } public override void DoEffect(PlayerController user) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) foreach (AIActor allNearbyEnemy in ((GameActor)user).CenterPosition.GetAllNearbyEnemies(2.5f)) { if (HappyIceCreamHaver.NeedsIceCream(allNearbyEnemy)) { HappyIceCreamHaver.ShareIceCream(allNearbyEnemy); } } } } public class IceCreamGun : CwaffGun { public static string ItemName = "Ice Cream Gun"; public static string ShortDescription = ":>"; public static string LongDescription = "EYE KEEM! 'v'"; public static string Lore = "EYYYYYEEEE KEEEEEMM"; 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 HappyIceCreamHaver : MonoBehaviour { internal const float _SHARE_RANGE = 2.5f; internal const float _SHARE_RANGE_SQUARED = 6.25f; internal const float _SEEK_PLAYER_RANGE_SQUARED = 16f; private const float _TARGET_SWITCH_RATE = 1f; private AIActor _enemy; private static int _IceCreamGunId = -1; private void Start() { _enemy = ((Component)this).GetComponent(); _enemy.CollisionDamage = 0f; _enemy.CollisionKnockbackStrength = 10f; _enemy.IgnoreForRoomClear = true; AdjustBehaviors(); HealthHaver healthHaver = ((BraveBehaviour)_enemy).healthHaver; if (healthHaver != null) { healthHaver.IsVulnerable = false; healthHaver.TriggerInvulnerabilityPeriod(999999f); } if (_enemy.EnemyGuid == "01972dee89fc4404a5c408d50007dad5") { ((BraveBehaviour)_enemy).aiAnimator.OverrideIdleAnimation = "smile"; } ((Component)this).gameObject.Play("ice_cream_shared"); } private void AdjustBehaviors() { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)((BraveBehaviour)_enemy).aiShooter)) { BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)((BraveBehaviour)_enemy).aiShooter).behaviorSpeculator; if (behaviorSpeculator != null) { behaviorSpeculator.AttackBehaviors = new List(); behaviorSpeculator.OverrideBehaviors = new List(); behaviorSpeculator.OtherBehaviors = new List(); TargetPourSoulsWithoutIceCreamBehavior targetPourSoulsWithoutIceCreamBehavior = new TargetPourSoulsWithoutIceCreamBehavior(); targetPourSoulsWithoutIceCreamBehavior.Radius = 100f; targetPourSoulsWithoutIceCreamBehavior.LineOfSight = false; targetPourSoulsWithoutIceCreamBehavior.ObjectPermanence = true; targetPourSoulsWithoutIceCreamBehavior.SearchInterval = 1f; targetPourSoulsWithoutIceCreamBehavior.PauseOnTargetSwitch = false; targetPourSoulsWithoutIceCreamBehavior.PauseTime = 0f; ((BehaviorBase)targetPourSoulsWithoutIceCreamBehavior).Init(((Component)_enemy).gameObject, ((BraveBehaviour)_enemy).aiActor, ((BraveBehaviour)_enemy).aiShooter); behaviorSpeculator.TargetBehaviors = new List { (TargetBehaviorBase)(object)targetPourSoulsWithoutIceCreamBehavior }; SeekTargetBehavior val = new SeekTargetBehavior(); val.ExternalCooldownSource = false; ((RangedMovementBehavior)val).SpecifyRange = false; val.StopWhenInRange = true; val.CustomRange = 2f; val.LineOfSight = false; val.ReturnToSpawn = false; val.PathInterval = 0.5f; ((BehaviorBase)val).Init(((Component)_enemy).gameObject, ((BraveBehaviour)_enemy).aiActor, ((BraveBehaviour)_enemy).aiShooter); behaviorSpeculator.MovementBehaviors = new List { (MovementBehaviorBase)(object)val }; behaviorSpeculator.FullyRefreshBehaviors(); } } } private void Update() { //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_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_0098: Unknown result type (might be due to invalid IL or missing references) ((GameActor)_enemy).CurrentGun.preventRotation = true; ((BraveBehaviour)((GameActor)_enemy).CurrentGun).sprite.HeightOffGround = 0.2f; if (!_enemy.CanTargetEnemies) { _enemy.CanTargetEnemies = true; } if (!_enemy.CanTargetPlayers) { _enemy.CanTargetPlayers = true; } AIShooter aiShooter = ((BraveBehaviour)_enemy).aiShooter; if (aiShooter == null) { return; } aiShooter.ForceGunOnTop = true; GameActor playerTarget = ((BraveBehaviour)_enemy).behaviorSpeculator.PlayerTarget; AIActor val = (AIActor)(object)((playerTarget is AIActor) ? playerTarget : null); if (val == null) { aiShooter.OverrideAimPoint = ((GameActor)GameManager.Instance.BestActivePlayer).CenterPosition; return; } aiShooter.OverrideAimPoint = Vector3Extensions.XY(((BraveBehaviour)val).transform.position); Vector2 val2 = ((GameActor)_enemy).CenterPosition - ((GameActor)val).CenterPosition; if (((Vector2)(ref val2)).sqrMagnitude < 6.25f && NeedsIceCream(val)) { ShareIceCream(val); } } internal static bool NeedsIceCream(AIActor enemy) { if (!Object.op_Implicit((Object)(object)enemy) || !Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).aiShooter) || !Object.op_Implicit((Object)(object)((BraveBehaviour)((BraveBehaviour)enemy).aiShooter).behaviorSpeculator)) { return false; } if (((BraveBehaviour)((BraveBehaviour)enemy).aiShooter).behaviorSpeculator.AttackBehaviors == null) { return false; } if (Object.op_Implicit((Object)(object)((Component)enemy).GetComponent())) { return false; } if (!enemy.IsHostileAndNotABoss()) { return false; } foreach (AttackBehaviorBase attackBehavior in ((BraveBehaviour)((BraveBehaviour)enemy).aiShooter).behaviorSpeculator.AttackBehaviors) { if (attackBehavior is ShootGunBehavior) { return true; } } return false; } internal static void ShareIceCream(AIActor enemy) { //IL_0034: 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_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_0052: Unknown result type (might be due to invalid IL or missing references) if (_IceCreamGunId < 0) { _IceCreamGunId = Lazy.PickupId(); } enemy.ReplaceGun((Items)_IceCreamGunId); ((Component)enemy).gameObject.AddComponent(); GameObject obj = SpawnManager.SpawnVFX(IceCream._HeartVFX, Vector2.op_Implicit(((BraveBehaviour)enemy).sprite.WorldTopCenter + new Vector2(0f, 1f)), Quaternion.identity, true); ((tk2dBaseSprite)obj.GetComponent()).HeightOffGround = 1f; obj.transform.parent = ((BraveBehaviour)((BraveBehaviour)enemy).sprite).transform; obj.AddComponent().Setup(0.25f, 0.5f, 0f, 0.5f, 0.25f); } } public class TargetPourSoulsWithoutIceCreamBehavior : TargetBehaviorBase { public float Radius = 10f; public bool LineOfSight = true; public bool ObjectPermanence = true; public float SearchInterval = 0.25f; public bool PauseOnTargetSwitch; public float PauseTime = 0.25f; private float m_losTimer; private SpeculativeRigidbody m_specRigidbody; private BehaviorSpeculator m_behaviorSpeculator; public override void Init(GameObject gameObject, AIActor aiActor, AIShooter aiShooter) { ((BehaviorBase)this).Init(gameObject, aiActor, aiShooter); m_specRigidbody = gameObject.GetComponent(); m_behaviorSpeculator = gameObject.GetComponent(); } public override void Start() { } public override void Upkeep() { ((BehaviorBase)this).Upkeep(); ((BehaviorBase)this).DecrementTimer(ref m_losTimer, false); } public override BehaviorResult Update() { //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_0007: 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_006d: Unknown result type (might be due to invalid IL or missing references) BehaviorResult val = ((BehaviorBase)this).Update(); if ((int)val != 0) { return val; } if (!(m_losTimer > 0f)) { m_losTimer = SearchInterval; m_behaviorSpeculator.PlayerTarget = NearestEnemyThatReallyNeedsIceCream(((BehaviorBase)this).m_aiActor); if (Object.op_Implicit((Object)(object)m_behaviorSpeculator.PlayerTarget) && Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiShooter)) { ((BehaviorBase)this).m_aiShooter.AimAtPoint(m_behaviorSpeculator.PlayerTarget.CenterPosition); } return (BehaviorResult)1; } return (BehaviorResult)0; } internal static GameActor NearestEnemyThatReallyNeedsIceCream(AIActor iceCreamHaver) { //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_000f: 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_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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00af: 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) Vector2 centerPosition = ((GameActor)iceCreamHaver).CenterPosition; GameActor val = null; float num = 9999f; Vector2 val2; foreach (AIActor allNearbyEnemy in centerPosition.GetAllNearbyEnemies(100f, ignoreWalls: false)) { if ((Object)(object)allNearbyEnemy == (Object)(object)iceCreamHaver || !HappyIceCreamHaver.NeedsIceCream(allNearbyEnemy)) { continue; } val2 = centerPosition - ((GameActor)allNearbyEnemy).CenterPosition; float sqrMagnitude = ((Vector2)(ref val2)).sqrMagnitude; if (!(sqrMagnitude > num)) { if (sqrMagnitude < 6.25f) { HappyIceCreamHaver.ShareIceCream(allNearbyEnemy); continue; } num = sqrMagnitude; val = (GameActor)(object)allNearbyEnemy; } } if (Object.op_Implicit((Object)(object)val)) { return val; } PlayerController bestActivePlayer = GameManager.Instance.BestActivePlayer; Vector2 centerPosition2 = ((GameActor)bestActivePlayer).CenterPosition; val2 = centerPosition - centerPosition2; if (((Vector2)(ref val2)).sqrMagnitude < 16f) { return (GameActor)(object)bestActivePlayer; } return (GameActor)(object)iceCreamHaver; } } public class EmergencySiren : CwaffActive { public static string ItemName = "Emergency Siren"; public static string ShortDescription = "WEE WOO! WEE WOO!"; public static string LongDescription = "Opens sealed combat doors and renders enemies harmless until leaving a room. Any room unsealed in this way does not count as visited, and enemies will respawn if it is revisited later. Cannot be used in a room if the player has fired a gun or if any enemy has otherwise taken damage."; public static string Lore = "Despite their hostility towards adventurers, even the Gundead understand and abide by the Geneva conventions, and will immediately cease fire in the presence of emergency personnel. As impersonating a medical professional is already dangerously close to violating the Geneva conventions, it would be wise not to press your luck trying to take advantage of the cease-fire by sneaking in a few shots. Besides, only a real monster would attempt something like that anyway."; private static StatModifier[] _EmergencyMods = null; internal static GameObject _SirenVFX; private RoomHandler _roomToReset; private bool _anyEnemyInRoomDied; private bool _anyGunFiredInRoom; private PlayerController _owner; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PlayerItem obj = Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)2; obj.consumable = false; ItemBuilder.SetCooldownType(obj, (CooldownType)1, 300f); _EmergencyMods = (StatModifier[])(object)new StatModifier[1] { ((StatType)0).Mult(2f) }; _SirenVFX = VFX.Create("siren", 36f, loops: true, -1, 0.75f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 50f); } public override void Pickup(PlayerController player) { base.Pickup(player); _owner = player; player.OnEnteredCombat = (Action)Delegate.Combine(player.OnEnteredCombat, new Action(OnEnteredCombat)); player.PostProcessProjectile += OnFired; player.PostProcessBeam += OnBeamFired; } public override void OnPreDrop(PlayerController player) { player.PostProcessProjectile -= OnFired; player.PostProcessBeam -= OnBeamFired; player.OnEnteredCombat = (Action)Delegate.Remove(player.OnEnteredCombat, new Action(OnEnteredCombat)); _owner = null; ((PlayerItem)this).OnPreDrop(player); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)_owner)) { _owner.PostProcessProjectile -= OnFired; _owner.PostProcessBeam -= OnBeamFired; PlayerController owner = _owner; owner.OnEnteredCombat = (Action)Delegate.Remove(owner.OnEnteredCombat, new Action(OnEnteredCombat)); } ((PlayerItem)this).OnDestroy(); } private void OnFired(Projectile p, float f) { _anyGunFiredInRoom = true; } private void OnBeamFired(BeamController beam) { _anyGunFiredInRoom = true; } private void OnEnemyKilled(Vector2 v) { _anyEnemyInRoomDied = true; } private void OnEnteredCombat() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_owner) || _owner.CurrentRoom == null) { return; } _anyEnemyInRoomDied = false; _anyGunFiredInRoom = false; foreach (AIActor allNearbyEnemy in ((GameActor)_owner).CenterPosition.GetAllNearbyEnemies(100f, ignoreWalls: true, includeDead: false, includeGone: true, includeInvulnerable: true, limitToCurrentRoom: true, includeHarmless: true)) { ((BraveBehaviour)allNearbyEnemy).healthHaver.OnPreDeath += OnEnemyKilled; } } public override void Update() { ((PlayerItem)this).Update(); if (Object.op_Implicit((Object)(object)_owner) && _owner.IsFiring) { _anyGunFiredInRoom = true; } } public override bool CanBeUsed(PlayerController user) { if (Object.op_Implicit((Object)(object)user)) { RoomHandler currentRoom = user.CurrentRoom; if (currentRoom != null) { if (_roomToReset != null || _anyEnemyInRoomDied || _anyGunFiredInRoom || user.InBossRoom() || currentRoom.area == null || currentRoom.area.IsProceduralRoom || !user.IsInCombat || !currentRoom.IsSealed || !currentRoom.EverHadEnemies) { return false; } if (currentRoom.NewWaveOfEnemiesIsSpawning()) { return false; } return ((PlayerItem)this).CanBeUsed(user); } } return false; } public override void DoEffect(PlayerController user) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) RoomHandler currentRoom = user.CurrentRoom; currentRoom.UnsealRoom(); foreach (AIActor allNearbyEnemy in ((GameActor)user).CenterPosition.GetAllNearbyEnemies(100f, ignoreWalls: true, includeDead: false, includeGone: true, includeInvulnerable: true)) { if (Object.op_Implicit((Object)(object)((BraveBehaviour)allNearbyEnemy).behaviorSpeculator)) { ((BraveBehaviour)allNearbyEnemy).behaviorSpeculator.InterruptAndDisable(); } if (Object.op_Implicit((Object)(object)((BraveBehaviour)allNearbyEnemy).knockbackDoer)) { ((BraveBehaviour)allNearbyEnemy).knockbackDoer.SetImmobile(true, "emergency_siren"); } if (Object.op_Implicit((Object)(object)((BraveBehaviour)allNearbyEnemy).healthHaver)) { ((BraveBehaviour)allNearbyEnemy).healthHaver.IsVulnerable = false; ((BraveBehaviour)allNearbyEnemy).healthHaver.TriggerInvulnerabilityPeriod(999999f); } if (Object.op_Implicit((Object)(object)((BraveBehaviour)allNearbyEnemy).specRigidbody)) { ((BraveBehaviour)allNearbyEnemy).specRigidbody.CollideWithOthers = false; ((BraveBehaviour)allNearbyEnemy).specRigidbody.CollideWithTileMap = false; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)allNearbyEnemy).specRigidbody; specRigidbody.OnPreMovement = (Action)Delegate.Combine(specRigidbody.OnPreMovement, (Action)delegate(SpeculativeRigidbody b) { //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) b.Velocity = Vector2.zero; }); } allNearbyEnemy.State = (ActorState)0; } ReadOnlyCollection allProjectiles = StaticReferenceManager.AllProjectiles; for (int num = allProjectiles.Count - 1; num >= 0; num--) { if (Object.op_Implicit((Object)(object)allProjectiles[num])) { allProjectiles[num].DieInAir(false, true, true, false); } } _roomToReset = currentRoom; ((PlayerItem)this).passiveStatModifiers = _EmergencyMods; user.stats.RecalculateStats(user, false, false); ((MonoBehaviour)user).StartCoroutine(AwaitRoomChange(user)); } private IEnumerator AwaitRoomChange(PlayerController user) { GameObject v = SpawnManager.SpawnVFX(_SirenVFX, Vector2.op_Implicit(((BraveBehaviour)user).sprite.WorldTopCenter + new Vector2(0f, 0.75f)), Quaternion.identity); v.transform.parent = ((BraveBehaviour)user).transform; while (user.CurrentRoom == _roomToReset) { Lazy.PlaySoundUntilDeathOrTimeout("siren_sound", v, 0.1f); yield return null; } Object.Destroy((Object)(object)v); ResetPredefinedRoomForEmergency(_roomToReset); FixDoorsInRoom(_roomToReset); ((PlayerItem)this).passiveStatModifiers = null; user.stats.RecalculateStats(user, false, false); _roomToReset = null; } private static void ForceDoorClosed(DungeonDoorController door) { door.m_wasOpenWhenSealed = false; door.hasEverBeenOpen = false; InteractableDoorController component = ((Component)door).GetComponent(); if (component != null) { component.m_hasOpened = false; component.OpensAutomaticallyOnUnlocked = false; } if (door.SupportsSubsidiaryDoors && Object.op_Implicit((Object)(object)door.subsidiaryDoor)) { ForceDoorClosed(door.subsidiaryDoor); } door.Close(); } private static void FixDoorsInRoom(RoomHandler room) { foreach (DungeonDoorController connectedDoor in room.connectedDoors) { ForceDoorClosed(connectedDoor); } foreach (RoomHandler connectedRoom in room.connectedRooms) { foreach (DungeonDoorController connectedDoor2 in connectedRoom.connectedDoors) { ForceDoorClosed(connectedDoor2); } } } public static void ResetPredefinedRoomForEmergency(RoomHandler room) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_05ef: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Invalid comparison between Unknown and I4 //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Unknown result type (might be due to invalid IL or missing references) if (GameManager.Instance.PrimaryPlayer.CurrentRoom == room || (int)room.visibility == 0 || GameManager.Instance.InTutorial || room.area.IsProceduralRoom) { return; } if (room.activeEnemies != null) { for (int num = room.activeEnemies.Count - 1; num >= 0; num--) { AIActor val = room.activeEnemies[num]; if (Object.op_Implicit((Object)(object)val)) { if (Object.op_Implicit((Object)(object)((BraveBehaviour)val).behaviorSpeculator)) { ((BraveBehaviour)val).behaviorSpeculator.InterruptAndDisable(); } if (((BraveBehaviour)val).healthHaver.IsBoss && ((BraveBehaviour)val).healthHaver.IsAlive) { ((BraveBehaviour)val).healthHaver.EndBossState(false); } Object.Destroy((Object)(object)((Component)val).gameObject); } } room.activeEnemies.Clear(); } foreach (TalkDoerLite item in room.GetComponentsInRoom()) { ((BraveBehaviour)item).SendPlaymakerEvent("resetRoomLikeDarkSouls"); } if (room.bossTriggerZones != null) { for (int i = 0; i < room.bossTriggerZones.Count; i++) { room.bossTriggerZones[i].HasTriggered = false; } } if (room.remainingReinforcementLayers != null) { room.remainingReinforcementLayers.Clear(); } room.visibility = (VisibilityStatus)3; room.PreventStandardRoomReward = true; Vector2 val6 = default(Vector2); for (int j = -1; j < room.area.runtimePrototypeData.additionalObjectLayers.Count; j++) { if (j != -1 && room.area.runtimePrototypeData.additionalObjectLayers[j].layerIsReinforcementLayer) { PrototypeRoomObjectLayer val2 = room.area.runtimePrototypeData.additionalObjectLayers[j]; if (val2.numberTimesEncounteredRequired > 0) { if ((Object)(object)room.area.prototypeRoom != (Object)null) { if (GameStatsManager.Instance.QueryRoomEncountered(room.area.prototypeRoom.GUID) < val2.numberTimesEncounteredRequired) { continue; } } else if (room.area.runtimePrototypeData != null && GameStatsManager.Instance.QueryRoomEncountered(room.area.runtimePrototypeData.GUID) < val2.numberTimesEncounteredRequired) { continue; } } if (!(val2.probability < 1f) || !(Random.value > val2.probability)) { if (room.remainingReinforcementLayers == null) { room.remainingReinforcementLayers = new List(); } if (room.area.runtimePrototypeData.additionalObjectLayers[j].placedObjects.Count > 0) { room.remainingReinforcementLayers.Add(room.area.runtimePrototypeData.additionalObjectLayers[j]); } } continue; } List list = ((j != -1) ? room.area.runtimePrototypeData.additionalObjectLayers[j].placedObjects : room.area.runtimePrototypeData.placedObjects); List list2 = ((j != -1) ? room.area.runtimePrototypeData.additionalObjectLayers[j].placedObjectBasePositions : room.area.runtimePrototypeData.placedObjectPositions); for (int k = 0; k < list.Count; k++) { PrototypePlacedObjectData val3 = list[k]; if (val3.spawnChance < 1f && Random.value > val3.spawnChance) { continue; } GameObject val4 = null; IntVector2 val5 = Vector2Extensions.ToIntVector2(list2[k], (VectorConversions)2); if ((Object)(object)val3.placeableContents != (Object)null) { val4 = val3.placeableContents.InstantiateObject(room, val5, true, false); } if ((Object)(object)val3.nonenemyBehaviour != (Object)null) { DungeonPlaceableBehaviour nonenemyBehaviour = val3.nonenemyBehaviour; val4 = (((int)GameManager.Instance.CurrentLevelOverrideState != 2 || !((Object)(object)((Component)nonenemyBehaviour).GetComponent() != (Object)null)) ? nonenemyBehaviour.InstantiateObjectOnlyActors(room, val5, false) : nonenemyBehaviour.InstantiateObject(room, val5, false)); } if (!string.IsNullOrEmpty(val3.enemyBehaviourGuid)) { val4 = ((DungeonPlaceableBehaviour)EnemyDatabase.GetOrLoadByGuid(val3.enemyBehaviourGuid)).InstantiateObjectOnlyActors(room, val5, false); } if ((Object)(object)val4 != (Object)null) { AIActor component = val4.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { if (Object.op_Implicit((Object)(object)((BraveBehaviour)component).healthHaver) && ((BraveBehaviour)component).healthHaver.IsBoss) { component.HasDonePlayerEnterCheck = true; } if (component.EnemyGuid == GlobalEnemyGuids.GripMaster) { Object.Destroy((Object)(object)((Component)component).gameObject); continue; } } if (val3.xMPxOffset != 0 || val3.yMPxOffset != 0) { ((Vector2)(ref val6))..ctor((float)val3.xMPxOffset * 0.0625f, (float)val3.yMPxOffset * 0.0625f); val4.transform.position = val4.transform.position + Vector2Extensions.ToVector3ZUp(val6, 0f); } IPlayerInteractable[] interfacesInChildren = GameObjectExtensions.GetInterfacesInChildren(val4); for (int l = 0; l < interfacesInChildren.Length; l++) { room.interactableObjects.Add(interfacesInChildren[l]); } room.HandleFields(val3, val4); val4.transform.parent = room.hierarchyParent; } if (val3.linkedTriggerAreaIDs != null && val3.linkedTriggerAreaIDs.Count > 0 && (Object)(object)val4 != (Object)null) { for (int m = 0; m < val3.linkedTriggerAreaIDs.Count; m++) { int key = val3.linkedTriggerAreaIDs[m]; if (room.eventTriggerMap != null && room.eventTriggerMap.ContainsKey(key)) { room.eventTriggerMap[key].AddGameObject(val4); } } } if (val3.assignedPathIDx != -1 && Object.op_Implicit((Object)(object)val4)) { PathMover component2 = val4.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.Path = room.area.runtimePrototypeData.paths[val3.assignedPathIDx]; component2.PathStartNode = val3.assignedPathStartNode; component2.RoomHandler = room; } } } } Pixelator.Instance.ProcessOcclusionChange(IntVector2.Zero, 0f, room, false); } } public class GlassAmmoBox : CwaffActive { public static string ItemName = "Glass Ammo Box"; public static string ShortDescription = "Infinite Ammo?"; public static string LongDescription = "Grants a single gun infinite ammo, but reduces the gun's ammo to zero upon taking damage while using it or dropping it on the ground."; public static string Lore = "A magical wellspring of ammo whose bounty is matched only by its fragility. Though it gets its name from its glasslike appearance, in reality the box of ammo is held together by something even more brittle and fragile -- the hopes and prayers of hundreds of ammo-starved Gungeoneers forced to fight the Dragun with their rusty budget-grade weaponry."; internal static GameObject _GlassVFX = null; public static void Init() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) PlayerItem obj = Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore); ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)3, 1f); ((PickupObject)obj).quality = (ItemQuality)2; _GlassVFX = VFX.Create("glass_shard_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } public override bool CanBeUsed(PlayerController user) { Gun currentGun = ((GameActor)user).CurrentGun; if (currentGun == null) { return false; } if (currentGun.InfiniteAmmo || currentGun.LocalInfiniteAmmo || currentGun.AdjustedMaxAmmo <= 0) { return false; } if (Object.op_Implicit((Object)(object)((Component)currentGun).gameObject.GetComponent())) { return false; } return ((PlayerItem)this).CanBeUsed(user); } public override void DoEffect(PlayerController user) { Gun currentGun = ((GameActor)user).CurrentGun; if (currentGun != null) { ((Component)currentGun).gameObject.AddComponent().Setup(user); } } internal static void RestoreMidGameData(PlayerController p) { int playerIDX = p.PlayerIDX; List list = CwaffRunData.Instance.glassGunIds[playerIDX]; foreach (Gun allGun in p.inventory.AllGuns) { if (list.Contains(((PickupObject)allGun).PickupObjectId)) { ((Component)allGun).gameObject.AddComponent().Setup(p); } } } } public class GlassAmmoGun : MonoBehaviour { private PlayerController _owner; private Gun _gun; private Shader _originalShader; public void Setup(PlayerController owner) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_0121: Unknown result type (might be due to invalid IL or missing references) _owner = owner; _gun = ((Component)this).gameObject.GetComponent(); _gun.GainAmmo(((GameActor)owner).CurrentGun.AdjustedMaxAmmo); _gun.ForceImmediateReload(false); _gun.InfiniteAmmo = true; CwaffRunData.Instance.glassGunIds[_owner.PlayerIDX].AddUnique(((PickupObject)_gun).PickupObjectId); ((BraveBehaviour)_owner).healthHaver.OnDamaged -= new OnDamagedEvent(ShatterOnDamaged); ((BraveBehaviour)_owner).healthHaver.OnDamaged += new OnDamagedEvent(ShatterOnDamaged); Gun gun = _gun; gun.OnDropped = (Action)Delegate.Remove(gun.OnDropped, new Action(OnDropped)); Gun gun2 = _gun; gun2.OnDropped = (Action)Delegate.Combine(gun2.OnDropped, new Action(OnDropped)); if (!MidGameSaveData.IsInitializingPlayerData) { ((Component)_owner).gameObject.Play("glass_assemble_sound"); } GameObject glassVFX = GlassAmmoBox._GlassVFX; Vector2 centerPosition = ((GameActor)_owner).CenterPosition; float? startScale = 1f; float? endScale = 0.1f; CwaffVFX.SpawnBurst(glassVFX, 50, centerPosition, 6f, null, 0f, 15f, CwaffVFX.Vel.InwardToCenter, CwaffVFX.Rot.Random, 0.4f, null, 0f, null, fadeIn: false, uniform: false, startScale, endScale, null, randomFrame: true); } private void OnDropped() { Gun gun = _gun; gun.OnDropped = (Action)Delegate.Remove(gun.OnDropped, new Action(OnDropped)); ShatterInternal(dropped: true); } private void LateUpdate() { //IL_0086: 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) if (Object.op_Implicit((Object)(object)_gun) && Object.op_Implicit((Object)(object)((BraveBehaviour)_gun).sprite)) { Material material = ((BraveBehaviour)((BraveBehaviour)_gun).sprite).renderer.material; if (!((Object)(object)material.shader == (Object)(object)CwaffShaders.GoldShader)) { _originalShader = material.shader; ((BraveBehaviour)_gun).sprite.usesOverrideMaterial = true; material.shader = CwaffShaders.GoldShader; material.SetColor("_GoldColor", new Color(0.5f, 1f, 1f)); material.SetColor("_SheenColor", new Color(0.5f, 1f, 1f)); material.SetFloat("_GoldNorm", 0f); material.SetFloat("_SheenAngle", 0f); material.SetFloat("_SheenWidth", 1.5f); material.SetFloat("_SheenSpacing", 0f); material.SetFloat("_SheenStrength", 0.25f); material.SetFloat("_SheenEmission", 3f); material.SetFloat("_SheenSpeed", 1.5f); } } } private void ShatterOnDamaged(float resultValue, float maxValue, CoreDamageTypes damageTypes, DamageCategory damageCategory, Vector2 damageDirection) { ShatterInternal(); } private void ShatterInternal(bool dropped = false) { //IL_0051: 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_0139: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)_owner) && (dropped || !((Object)(object)((GameActor)_owner).CurrentGun != (Object)(object)_gun))) { ((Component)_owner).gameObject.Play("glass_shatter_sound"); GameObject glassVFX = GlassAmmoBox._GlassVFX; Vector2 centerPosition = ((GameActor)_owner).CenterPosition; float? startScale = 1f; float? endScale = 0.1f; CwaffVFX.SpawnBurst(glassVFX, 50, centerPosition, 1f, null, 6f, 2f, CwaffVFX.Vel.Away, CwaffVFX.Rot.Random, 0.6f, null, 0f, null, fadeIn: false, uniform: false, startScale, endScale, null, randomFrame: true); _gun.InfiniteAmmo = false; _gun.SetAmmoAndClearUICache(0); Gun gun = _gun; gun.OnDropped = (Action)Delegate.Remove(gun.OnDropped, new Action(OnDropped)); ((BraveBehaviour)_owner).healthHaver.OnDamaged -= new OnDamagedEvent(ShatterOnDamaged); CwaffRunData.Instance.glassGunIds[_owner.PlayerIDX].Remove(((PickupObject)_gun).PickupObjectId); Object.Destroy((Object)(object)this); } } private void OnDestroy() { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)_gun)) { if ((Object)(object)_originalShader != (Object)null) { ((BraveBehaviour)((BraveBehaviour)_gun).sprite).renderer.material.shader = _originalShader; } Gun gun = _gun; gun.OnDropped = (Action)Delegate.Remove(gun.OnDropped, new Action(OnDropped)); } if (Object.op_Implicit((Object)(object)_owner) && Object.op_Implicit((Object)(object)((BraveBehaviour)_owner).healthHaver)) { ((BraveBehaviour)_owner).healthHaver.OnDamaged -= new OnDamagedEvent(ShatterOnDamaged); } } } [HarmonyPatch] public static class GlassAmmoBoxPatches { [HarmonyPatch(typeof(OnGunDamagedModifier), "OnReceivedDamage")] [HarmonyPrefix] private static bool OnGunDamagedModifierOnReceivedDamagePatch(OnGunDamagedModifier __instance, PlayerController player) { if (!Object.op_Implicit((Object)(object)__instance.m_gun) || ((PickupObject)__instance.m_gun).PickupObjectId != 540) { return true; } return !player.HasSynergy(Synergy.BULLETPROOF_GLASS); } } public class BulletbotImplant : CwaffActive { private class UsedBulletbotImplant : FakeItem { [HarmonyPatch(typeof(CompanionItem), "CreateCompanion")] private class CreateCompanionPatch { private static void Postfix(CompanionItem __instance, PlayerController owner) { if (!Object.op_Implicit((Object)(object)__instance.m_extantCompanion)) { return; } AIActor component = __instance.m_extantCompanion.GetComponent(); if (component == null || Object.op_Implicit((Object)(object)((Component)component).GetComponent())) { return; } foreach (UsedBulletbotImplant activeImplant in _ActiveImplants) { if (Object.op_Implicit((Object)(object)activeImplant) && !activeImplant._armed && !(activeImplant._companionGuid != component.EnemyGuid)) { activeImplant.ArmCompanion(component); break; } } } } [HarmonyPatch(typeof(CompanionItem), "DestroyCompanion")] private class DestroyCompanionPatch { private static void Prefix(CompanionItem __instance) { GameObject extantCompanion = __instance.m_extantCompanion; if (extantCompanion == null || !Object.op_Implicit((Object)(object)extantCompanion)) { return; } AIActor component = extantCompanion.GetComponent(); if (component == null) { return; } foreach (UsedBulletbotImplant activeImplant in _ActiveImplants) { if (Object.op_Implicit((Object)(object)activeImplant) && activeImplant._armed && (!Object.op_Implicit((Object)(object)activeImplant._companion) || !((Object)(object)activeImplant._companion != (Object)(object)component))) { activeImplant._companion = null; activeImplant._armed = false; } } } } private static List _ActiveImplants = new List(); private AIActor _companion; private string _companionGuid; private Items _gunId; private bool _armed; private bool _deserialized; public void Setup(AIActor companion, Items gunId) { _companionGuid = companion.EnemyGuid; _gunId = gunId; ArmCompanion(companion); ((Component)((PassiveItem)this).Owner).gameObject.Play("gun_synthesizer_activate_sound"); } public override void OnDestroy() { _ActiveImplants.Remove(this); GameManager.Instance.OnNewLevelFullyLoaded -= OnNewLevelFullyLoaded; ((PassiveItem)this).OnDestroy(); } public override void Pickup(PlayerController player) { base.Pickup(player); GameManager.Instance.OnNewLevelFullyLoaded -= OnNewLevelFullyLoaded; GameManager.Instance.OnNewLevelFullyLoaded += OnNewLevelFullyLoaded; _ActiveImplants.Add(this); } public override void MidGameSerialize(List data) { ((PickupObject)this).MidGameSerialize(data); data.Add(_ActiveImplants.IndexOf(this)); data.Add(_companionGuid); data.Add((int)_gunId); } public override void MidGameDeserialize(List data) { ((PassiveItem)this).MidGameDeserialize(data); if ((int)data[0] == _ActiveImplants.IndexOf(this)) { _companionGuid = (string)data[1]; _gunId = (Items)(int)data[2]; _deserialized = true; } } private void ArmCompanion(AIActor companion) { if (!_armed) { Gun replacementGun = _gunId.AsGun(); AIShooter obj = companion.EnableGunShooting(replacementGun); obj.ArmToTheTeeth(replacementGun); obj.Initialize(); _companion = companion; _armed = true; _deserialized = false; } } private static void OnNewLevelFullyLoaded() { foreach (UsedBulletbotImplant activeImplant in _ActiveImplants) { activeImplant._companion = null; activeImplant._armed = false; if (!activeImplant._deserialized) { continue; } foreach (AIActor companion in ((PassiveItem)activeImplant).Owner.companions) { if (!(companion.EnemyGuid != activeImplant._companionGuid) && !Object.op_Implicit((Object)(object)((Component)companion).GetComponent())) { activeImplant.ArmCompanion(companion); break; } } } } } public static string ItemName = "Bulletbot Implant"; public static string ShortDescription = "Loyal Gunpanions"; public static string LongDescription = "Grants the nearest unarmed companion a random gun and the ability to fire it at nearby enemies. Quadruples the chance of finding companions while held."; public static string Lore = "A microchip designed to rewire the neurons and DNA of its host to instantaneously train them in the art of armed combat. Conventional wisdom posits that if you give a dog a gun, he'll bark at it all day, but if you teach a dog to gun, he'll fight by your side for the rest of his life."; private const float _COMPANION_CHANCE_MULT = 4f; private AIActor _nearestCompanion; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PlayerItem obj = Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)4; obj.consumable = false; obj.canStack = false; ItemBuilder.SetCooldownType(obj, (CooldownType)2, 10f); ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)3, 1f); ((PickupObject)(object)obj).AddToShop(ModdedShopType.Handy); FakeItem.Create(); } public override void OnFirstPickup(PlayerController player) { base.OnFirstPickup(player); foreach (WeightedGameObject element in Cammy._CompanionTable.defaultItemDrops.elements) { this.IncreaseLootChance(element.pickupId, 4f); } } public override bool CanBeUsed(PlayerController user) { //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_007c: 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) _nearestCompanion = null; if (!((PlayerItem)this).CanBeUsed(user)) { return false; } if (user.IsGunLocked) { return false; } Gun currentGun = ((GameActor)user).CurrentGun; if (currentGun == null) { return false; } if (!((PickupObject)currentGun).CanBeDropped) { return false; } if (user.companions == null) { return false; } Vector2 centerPosition = ((GameActor)user).CenterPosition; float num = 9999f; foreach (AIActor companion in user.companions) { if (Object.op_Implicit((Object)(object)((Component)companion).GetComponent()) && !Object.op_Implicit((Object)(object)((BraveBehaviour)companion).aiShooter)) { Vector2 val = centerPosition - ((GameActor)companion).CenterPosition; float sqrMagnitude = ((Vector2)(ref val)).sqrMagnitude; if (!(sqrMagnitude > num)) { num = sqrMagnitude; _nearestCompanion = companion; } } } return Object.op_Implicit((Object)(object)_nearestCompanion); } public override void DoEffect(PlayerController user) { if (Object.op_Implicit((Object)(object)_nearestCompanion)) { Items gunId = (Items)HeckedMode.HeckedModeGunWhiteList.ChooseRandom(); user.AcquireFakeItem().Setup(_nearestCompanion, gunId); } } } public class KalibersJustice : CwaffActive { public static string ItemName = "Kaliber's Justice"; public static string ShortDescription = "Knows What You Need"; public static string LongDescription = "Gives one or more items based on what the player currently needs most, but may take away items the player has in excess. Reward quality scales with the quality and quantity of items lost."; public static string Lore = "Praying to Kaliber for assistance is something of a mixed bag, even among her followers. On the one hand, she tends to be highly responsive to prayers and considerate of one's present situation when choosing her mode of assistance. On the flipside, she is less than thrilled by the modern trend of praying to her only when in need something, and has been known to make the equally modern decision of treating her blessings as business transactions and taking as much as she gives. Still, she has been known to freely offer her aid to those who remain humble."; private float _lastUse; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PlayerItem obj = Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)3; obj.consumable = false; ItemBuilder.SetCooldownType(obj, (CooldownType)1, 1000f); } public override bool CanBeUsed(PlayerController user) { if (user.IsGunLocked) { return false; } if (BraveTime.ScaledTimeSinceStartup - _lastUse < 1f) { return false; } return ((PlayerItem)this).CanBeUsed(user); } public override void DoEffect(PlayerController user) { _lastUse = BraveTime.ScaledTimeSinceStartup; List itemNeeds = GetItemNeeds(user); List list = new List(); List list2 = new List(); List list3 = new List(); List list4 = new List(); List list5 = new List(); foreach (Need item in itemNeeds) { switch (item.status) { case NeedStatus.Minimal: list.Add(item); break; case NeedStatus.Lacking: list2.Add(item); break; case NeedStatus.Enough: list3.Add(item); break; case NeedStatus.Plenty: list4.Add(item); break; case NeedStatus.Excessive: list5.Add(item); break; } } if (list.Count > 0) { if (list.Count > 2) { DoBigTrade(user, null, list); } else if (list5.Count > 0) { DoBigTrade(user, list5, list); } else if (list.Count > 1) { DoBigTrade(user, null, list); } else if (list4.Count > 0) { DoModerateTrade(user, list4, list); } else { DoModerateTrade(user, null, list); } } else if (list2.Count > 0) { if (list2.Count > 1) { DoModerateTrade(user, null, list2); } else if (list5.Count > 0) { DoModerateTrade(user, list5, list2); } else if (list4.Count > 0) { DoModerateTrade(user, list4, list2); } else { DoModerateTrade(user, null, list2); } } else if (list3.Count > 0) { DoModerateTrade(user, null, list3); } else { ETGModConsole.Log((object)"player has way too much stuff o.o", false); } } private void DoTrade(PlayerController user, List offerList, List receiveList, bool big) { //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0330: 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_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_0558: Unknown result type (might be due to invalid IL or missing references) //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_0563: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_04db: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_05d8: Unknown result type (might be due to invalid IL or missing references) //IL_05f4: Unknown result type (might be due to invalid IL or missing references) //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_0603: Unknown result type (might be due to invalid IL or missing references) //IL_0608: Unknown result type (might be due to invalid IL or missing references) //IL_060d: Unknown result type (might be due to invalid IL or missing references) //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_06e4: Unknown result type (might be due to invalid IL or missing references) //IL_06ec: Unknown result type (might be due to invalid IL or missing references) //IL_06f1: Unknown result type (might be due to invalid IL or missing references) //IL_06f6: Unknown result type (might be due to invalid IL or missing references) //IL_06fb: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_0657: 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_058a: Unknown result type (might be due to invalid IL or missing references) //IL_058b: 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_0681: Unknown result type (might be due to invalid IL or missing references) //IL_0682: Unknown result type (might be due to invalid IL or missing references) //IL_0687: Unknown result type (might be due to invalid IL or missing references) //IL_068c: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Invalid comparison between Unknown and I4 //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Invalid comparison between Unknown and I4 //IL_01da: 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) if (receiveList == null || receiveList.Count == 0) { return; } Need? need = null; if (offerList != null && offerList.Count > 0 && !user.HasSynergy(Synergy.KALIBERS_FAVOR)) { need = offerList.ChooseRandom(); switch (need.Value.type) { case NeedType.Health: ((BraveBehaviour)user).healthHaver.ApplyDamage(big ? 3.5f : 2f, Vector2.zero, "Balance", (CoreDamageTypes)0, (DamageCategory)5, true, (PixelCollider)null, false); break; case NeedType.Armor: { HealthHaver healthHaver = ((BraveBehaviour)user).healthHaver; healthHaver.Armor -= (float)(big ? 4 : 2); break; } case NeedType.Money: { PlayerConsumables carriedConsumables2 = GameManager.Instance.PrimaryPlayer.carriedConsumables; carriedConsumables2.Currency -= (big ? 125 : 50); break; } case NeedType.Keys: { PlayerConsumables carriedConsumables = GameManager.Instance.PrimaryPlayer.carriedConsumables; carriedConsumables.KeyBullets -= ((!big) ? 1 : 3); break; } case NeedType.Blanks: user.Blanks -= ((!big) ? 1 : 3); break; case NeedType.Ammo: foreach (Gun allGun in user.inventory.AllGuns) { if (!allGun.InfiniteAmmo) { allGun.CurrentAmmo = (int)((float)allGun.CurrentAmmo * (big ? 0.5f : 0.75f)); } } break; case NeedType.Guns: { for (int k = 0; k < ((!big) ? 1 : 2); k++) { Gun val2 = null; for (int l = 0; l < 100; l++) { val2 = user.inventory.AllGuns.ChooseRandom(); if (((PickupObject)val2).CanActuallyBeDropped(user) && l < 50 && !big && (int)((PickupObject)val2).quality != 5) { _ = ((PickupObject)val2).quality; _ = 4; } } if (Object.op_Implicit((Object)(object)val2) && ((PickupObject)val2).CanActuallyBeDropped(user)) { Object.Destroy((Object)(object)((Component)user.ForceDropGun(val2)).gameObject); } else { ETGModConsole.Log((object)"dropping a gun went horrifically wrong o.o", false); } } break; } case NeedType.Passives: { for (int i = 0; i < ((!big) ? 1 : 2); i++) { PassiveItem val = null; for (int j = 0; j < 100; j++) { val = user.passiveItems.ChooseRandom(); if (((PickupObject)val).CanActuallyBeDropped(user) && j < 50 && !big && (int)((PickupObject)val).quality != 5) { _ = ((PickupObject)val).quality; _ = 4; } } if (Object.op_Implicit((Object)(object)val) && ((PickupObject)val).CanActuallyBeDropped(user)) { Object.Destroy((Object)(object)((Component)user.DropPassiveItem(val)).gameObject); } else { ETGModConsole.Log((object)"dropping a passive went horrifically wrong o.o", false); } } break; } } } Need need2 = receiveList.ChooseRandom(); Vector2 centerPosition = ((GameActor)user).CenterPosition; switch (need2.type) { case NeedType.Health: { LootEngine.SpawnItem(((Component)ItemHelper.Get(big ? Items.HeartSynthesizer : Items.HeartHolster)).gameObject, Vector2.op_Implicit(SpotNear(centerPosition)), Vector2.zero, 0f, true, true, false); for (int num = 0; num < 3; num++) { LootEngine.SpawnItem(((Component)ItemHelper.Get(Items.Heart)).gameObject, Vector2.op_Implicit(SpotNear(centerPosition)), Vector2.zero, 0f, true, true, false); } break; } case NeedType.Armor: { LootEngine.SpawnItem(((Component)ItemHelper.Get(big ? Items.ArmorSynthesizer : Items.Nanomachines)).gameObject, Vector2.op_Implicit(SpotNear(centerPosition)), Vector2.zero, 0f, true, true, false); for (int m = 0; m < 2; m++) { LootEngine.SpawnItem(((Component)ItemHelper.Get(Items.Armor)).gameObject, Vector2.op_Implicit(SpotNear(centerPosition)), Vector2.zero, 0f, true, true, false); } break; } case NeedType.Money: if (big) { LootEngine.SpawnItem(((Component)ItemHelper.Get(Items.BriefcaseOfCash)).gameObject, Vector2.op_Implicit(SpotNear(centerPosition)), Vector2.zero, 0f, true, true, false); } else { LootEngine.SpawnCurrency(SpotNear(centerPosition), 70, false, (Vector2?)null, (float?)null, 4f, 0.05f); } break; case NeedType.Keys: LootEngine.SpawnItem(((Component)ItemHelper.Get(big ? Items.Akey47 : Items.ShelletonKey)).gameObject, Vector2.op_Implicit(SpotNear(centerPosition)), Vector2.zero, 0f, true, true, false); break; case NeedType.Blanks: { Items items = ((big && !user.HasPassive(579)) ? Items.BlankBullets : Items.ElderBlank); if (!user.HasPassive((int)items)) { LootEngine.SpawnItem(((Component)ItemHelper.Get(items)).gameObject, Vector2.op_Implicit(SpotNear(centerPosition)), Vector2.zero, 0f, true, true, false); } for (int num2 = 0; num2 < (big ? 4 : 2); num2++) { LootEngine.SpawnItem(((Component)ItemHelper.Get(Items.Blank)).gameObject, Vector2.op_Implicit(SpotNear(centerPosition)), Vector2.zero, 0f, true, true, false); } break; } case NeedType.Ammo: { LootEngine.SpawnItem(((Component)ItemHelper.Get(big ? Items.AmmoSynthesizer : Items.MagazineRack)).gameObject, Vector2.op_Implicit(SpotNear(centerPosition)), Vector2.zero, 0f, true, true, false); for (int n = 0; n < ((!big) ? 1 : 2); n++) { LootEngine.SpawnItem(((Component)ItemHelper.Get(Items.PartialAmmo)).gameObject, Vector2.op_Implicit(SpotNear(centerPosition)), Vector2.zero, 0f, true, true, false); } break; } case NeedType.Guns: { ItemQuality val4 = (ItemQuality)((!Lazy.CoinFlip()) ? (big ? 4 : 2) : (big ? 5 : 3)); LootEngine.SpawnItem(GameManager.Instance.RewardManager.GetItemForPlayer(user, GameManager.Instance.RewardManager.GunsLootTable, val4, (List)null, false, (Random)null, false, (List)null, false, (RewardSource)0), Vector2.op_Implicit(SpotNear(centerPosition)), Vector2.zero, 0f, true, true, false); break; } case NeedType.Passives: { ItemQuality val3 = (ItemQuality)((!Lazy.CoinFlip()) ? (big ? 4 : 2) : (big ? 5 : 3)); while (true) { GameObject itemForPlayer = GameManager.Instance.RewardManager.GetItemForPlayer(user, GameManager.Instance.RewardManager.ItemsLootTable, val3, (List)null, false, (Random)null, false, (List)null, false, (RewardSource)0); if ((Object)(object)itemForPlayer == (Object)null) { break; } if (!Object.op_Implicit((Object)(object)itemForPlayer.GetComponent())) { LootEngine.SpawnItem(itemForPlayer, Vector2.op_Implicit(SpotNear(centerPosition)), Vector2.zero, 0f, true, true, false); break; } } break; } } GameObject effect = Items.MagicLamp.AsGun().DefaultModule.projectiles[0].hitEffects.tileMapVertical.effects[0].effects[0].effect; for (int num3 = 0; num3 < 8; num3++) { float self = 45f * (float)num3; SpawnManager.SpawnVFX(effect, Vector2.op_Implicit(centerPosition + self.ToVector(1.5f)), Quaternion.identity); } ((Component)user).gameObject.Play("Play_OBJ_dice_bless_01"); Lazy.CustomNotification("Kaliber's Justice", $"Offered {(need.HasValue ? need.Value.type : NeedType.Nothing)}, Received {need2.type}", ((BraveBehaviour)this).sprite); } private static Vector2 SpotNear(Vector2 where) { //IL_0000: 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) return where + Lazy.RandomVector(0.75f); } private void DoBigTrade(PlayerController user, List offerList, List receiveList) { DoTrade(user, offerList, receiveList, big: true); } private void DoModerateTrade(PlayerController user, List offerList, List receiveList) { DoTrade(user, offerList, receiveList, big: false); } private List GetItemNeeds(PlayerController user) { //IL_034a: 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_0356: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Invalid comparison between Unknown and I4 //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Invalid comparison between Unknown and I4 //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Invalid comparison between Unknown and I4 //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Invalid comparison between Unknown and I4 //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Invalid comparison between Unknown and I4 //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Invalid comparison between Unknown and I4 //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Invalid comparison between Unknown and I4 //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Invalid comparison between Unknown and I4 List list = new List(); Need item = new Need(NeedType.Health); NeedStatus status; if (user.ForceZeroHealthState) { status = NeedStatus.Enough; } else { float currentHealth = ((BraveBehaviour)user).healthHaver.currentHealth; NeedStatus needStatus = ((currentHealth <= 1f) ? NeedStatus.Minimal : ((currentHealth <= 2f) ? NeedStatus.Lacking : ((!(currentHealth <= 4f)) ? ((currentHealth <= 6f) ? NeedStatus.Plenty : NeedStatus.Excessive) : NeedStatus.Enough))); status = needStatus; } item.status = status; list.Add(item); Need item2 = new Need(NeedType.Armor); int num = (int)((BraveBehaviour)user).healthHaver.currentArmor + ((!user.ForceZeroHealthState) ? 1 : (-1)); status = ((num <= 5) ? ((num <= 2) ? NeedStatus.Minimal : ((num <= 3) ? NeedStatus.Lacking : NeedStatus.Enough)) : ((num <= 8) ? NeedStatus.Plenty : NeedStatus.Excessive)); item2.status = status; list.Add(item2); Need item3 = new Need(NeedType.Money); int currency = GameManager.Instance.PrimaryPlayer.carriedConsumables.Currency; status = ((currency < 100) ? ((currency < 10) ? NeedStatus.Minimal : ((currency < 25) ? NeedStatus.Lacking : NeedStatus.Enough)) : ((currency < 200) ? NeedStatus.Plenty : NeedStatus.Excessive)); item3.status = status; list.Add(item3); Need item4 = new Need(NeedType.Keys); int num2 = GameManager.Instance.PrimaryPlayer.carriedConsumables.KeyBullets; if ((GameManager.Instance.PrimaryPlayer.carriedConsumables.InfiniteKeys || Lazy.AnyoneHasGun(95) || Lazy.AnyoneHas(166)) && num2 < 4) { num2 = 4; } status = ((num2 > 2) ? ((num2 > 6) ? NeedStatus.Excessive : ((num2 > 4) ? NeedStatus.Plenty : NeedStatus.Enough)) : ((num2 <= 0) ? NeedStatus.Minimal : NeedStatus.Lacking)); item4.status = status; list.Add(item4); Need item5 = new Need(NeedType.Blanks); int blanks = user.Blanks; status = ((blanks > 1) ? ((blanks > 5) ? NeedStatus.Excessive : ((blanks > 3) ? NeedStatus.Plenty : NeedStatus.Enough)) : ((blanks <= 0) ? NeedStatus.Minimal : NeedStatus.Lacking)); item4.status = status; list.Add(item5); Need item6 = new Need(NeedType.Ammo); int num3 = user.inventory.AllGuns.Count; float num4 = 0f; foreach (Gun allGun in user.inventory.AllGuns) { if (allGun.InfiniteAmmo) { num3--; } else { num4 += (float)allGun.CurrentAmmo / (float)allGun.AdjustedMaxAmmo; } } if (num3 == 0) { item6.status = NeedStatus.Enough; } else { num4 /= (float)num3; if (num4 < 0.34f) { item6.status = NeedStatus.Minimal; } else if (num4 < 0.5f) { item6.status = NeedStatus.Lacking; } else if (num4 < 0.67f) { item6.status = NeedStatus.Enough; } else if (num4 < 0.75f) { item6.status = NeedStatus.Plenty; } else { item6.status = NeedStatus.Excessive; } } list.Add(item6); Need item7 = new Need(NeedType.Guns); int count = user.inventory.AllGuns.Count; PickupObject val = user.inventory.AllGuns.HighestQualityItem(); ItemQuality val2 = (ItemQuality)((val == null) ? 1 : ((int)val.quality)); if (count <= 2 || (int)val2 == 1) { item7.status = NeedStatus.Minimal; } else if (count <= 4 || (int)val2 == 2) { item7.status = NeedStatus.Lacking; } else if (count <= 6 || (int)val2 == 3) { item7.status = NeedStatus.Enough; } else if (count <= 8 || (int)val2 == 4) { item7.status = NeedStatus.Plenty; } else { item7.status = NeedStatus.Excessive; } list.Add(item7); Need item8 = new Need(NeedType.Passives); int count2 = user.passiveItems.Count; PickupObject val3 = user.passiveItems.HighestQualityItem(); ItemQuality val4 = (ItemQuality)((val3 == null) ? 1 : ((int)val3.quality)); if (count2 < 2 || (int)val4 == 1) { item8.status = NeedStatus.Minimal; } else if (count2 < 4 || (int)val4 == 2) { item8.status = NeedStatus.Lacking; } else if (count2 < 6 || (int)val4 == 3) { item8.status = NeedStatus.Enough; } else if (count2 < 8 || (int)val4 == 4) { item8.status = NeedStatus.Plenty; } else { item8.status = NeedStatus.Excessive; } list.Add(item8); return list; } } internal enum NeedType { Health, Armor, Money, Keys, Blanks, Ammo, Guns, Passives, Nothing } internal enum NeedStatus { Minimal = -2, Lacking, Enough, Plenty, Excessive } internal struct Need { public NeedType type; public NeedStatus status; public Need(NeedType type) { this.type = type; status = NeedStatus.Enough; } } public class Detergent : CwaffActive { public static string ItemName = "Detergent"; public static string ShortDescription = "Next to Godliness"; public static string LongDescription = "Sets curse to 0 upon use."; public static string Lore = "An ordinary bottle of liquid laundry detergent, often used to repel the Jammed by disguising the scent of contraband inventory. The fresh non-specifically clean scent reminds you of home and provides with you an additional false sense of security."; public static void Init() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) PlayerItem obj = Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore); ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)0, 1f); ((PickupObject)obj).quality = (ItemQuality)3; } public override bool CanBeUsed(PlayerController user) { return user.Curse() > 0f; } public override void DoEffect(PlayerController user) { //IL_0045: 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) user.ownerlessStatModifiers.Add(((StatType)14).Add(0f - user.Curse())); user.stats.RecalculateStats(user, false, false); ((Component)user).gameObject.Play("detergent_cleanse_sound"); CwaffVFX.SpawnBurst(AllayCompanion._AllaySparkles, 20, ((GameActor)user).CenterPosition, 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, copyShaders: false); } } public class StopSign : CwaffActive { private class StoppedInTheirTracks : MonoBehaviour { } public static string ItemName = "Stop Sign"; public static string ShortDescription = "Believing"; public static string LongDescription = "Briefly stuns any enemies that are currently moving, indefinitely immobilizing them after the stun wears off."; public static string Lore = "There is nothing more effective at stopping the Gundead in their tracks than plastering giant metal street signs in front of their faces as they're darting about. Except for possibly bullets. Or goop. Or pits. Or...okay, maybe a lot of things are more effective. But nothing is quite as octagonally satisfying."; internal static GameActorSpeedEffect _SpeedEffect; internal static GameObject _StopSignVFX; public static void Init() { //IL_0021: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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) //IL_00c2: 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_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_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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Expected O, but got Unknown PlayerItem obj = Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)2; obj.consumable = false; ItemBuilder.SetCooldownType(obj, (CooldownType)1, 160f); _StopSignVFX = VFX.Create("stop_sign_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 1f); _SpeedEffect = new GameActorSpeedEffect { SpeedMultiplier = 0f, CooldownMultiplier = 1f, AffectsPlayers = false, AffectsEnemies = true, effectIdentifier = "stopped", resistanceType = (EffectResistanceType)0, stackMode = (EffectStackingMode)0, duration = 3600f, maxStackedDuration = -1f, AppliesTint = false, AppliesDeathTint = false, AppliesOutlineTint = false, OverheadVFX = ((GameActorEffect)Items.TripleCrossbow.AsGun().DefaultModule.projectiles[0].speedEffect).OverheadVFX, PlaysVFXOnActor = false }; } public override void DoEffect(PlayerController user) { //IL_0003: 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_0050: 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_0085: 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_00a6: 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) bool flag = false; foreach (AIActor allNearbyEnemy in ((GameActor)user).CenterPosition.GetAllNearbyEnemies()) { if (Object.op_Implicit((Object)(object)((BraveBehaviour)allNearbyEnemy).behaviorSpeculator) && !((BraveBehaviour)allNearbyEnemy).behaviorSpeculator.ImmuneToStun) { Vector2 voluntaryMovementVelocity = allNearbyEnemy.VoluntaryMovementVelocity; if (!(((Vector2)(ref voluntaryMovementVelocity)).magnitude < 0.1f) && !Object.op_Implicit((Object)(object)((Component)allNearbyEnemy).GetComponent())) { GameObject stopSignVFX = _StopSignVFX; Vector3 position = Vector2.op_Implicit((Object.op_Implicit((Object)(object)((BraveBehaviour)allNearbyEnemy).sprite) ? ((BraveBehaviour)allNearbyEnemy).sprite.WorldTopCenter : ((GameActor)allNearbyEnemy).CenterPosition) + new Vector2(0f, 1f)); float? fadeOutTime = 0.5f; float? endScale = 2f; float? height = 1f; CwaffVFX.Spawn(stopSignVFX, position, null, null, 0.25f, fadeOutTime, 0f, null, fadeIn: false, null, endScale, height); ((BraveBehaviour)allNearbyEnemy).behaviorSpeculator.Stun(2f, true); ((GameActor)allNearbyEnemy).ApplyEffect((GameActorEffect)(object)_SpeedEffect, 1f, (Projectile)null); ((Component)allNearbyEnemy).gameObject.AddComponent(); flag = true; } } } if (flag) { ((Component)this).gameObject.Play("stop_sign_sound"); } } } public class GunSynthesizer : CwaffActive { private class SyntheticGun : MonoBehaviour { private Gun _gun; private PlayerController _owner; private void Start() { Gun val = (_gun = ((Component)this).GetComponent()); _owner = GunTools.GunPlayerOwner(_gun); ((PickupObject)val).CanBeDropped = false; ((PickupObject)val).CanBeSold = false; val.Attach(); _owner.inventory.GunLocked.SetOverride("Synthetic Gun", true, (float?)null); if (!val.InfiniteAmmo) { val.CurrentAmmo = Math.Max(1, Mathf.CeilToInt(0.25f * (float)val.GetBaseMaxAmmo())); } ((BraveBehaviour)val).sprite.MakeHolographic(green: true); } private void Update() { if (Object.op_Implicit((Object)(object)_gun)) { ((BraveBehaviour)((BraveBehaviour)_gun).sprite).renderer.material.shader = ShaderCache.Acquire("Brave/Internal/HologramShader"); } } } public static string ItemName = "Gun Synthesizer"; public static string ShortDescription = "Transient Guns, Lasting Damage"; public static string LongDescription = "Synthesizes a random gun for 20 seconds. Synthesized guns have 25% of their max ammo and cannot be switched, thrown, or dropped. Recharges every 3 rooms."; public static string Lore = "A strange device made entirely of unrecognizable alien parts, save for a one quettabyte USB thumb drive sticking out of the side. Previous examinations have revealed the USB drive to contain detailed blueprints and specifications for almost every gun ever encountered in the Gungeon. The remaining 99.99999999995% of space on the drive is filled with assorted memes, cat pictures, and Touhou remixes."; private const float _SYNTH_LIFETIME = 20f; private const float _AMMO_PERCENT = 0.25f; private const int _COOLDOWN = 3; private const string _OVERRIDE = "Synthetic Gun"; private static GameObject _SPAWN_VFX = null; private PlayerController _owner; private SyntheticGun _currentSyntheticGun; private const int _SPAWN_PARTICLES = 64; private const int _FRAGMENT_EDGE = 4; private const int _FRAGMENTS = 16; private const float _DECONSTRUCT_DELAY = 0.0625f; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PlayerItem obj = Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)2; ItemBuilder.AddToSubShop((PickupObject)(object)obj, (ShopType)3, 1f); ItemBuilder.SetCooldownType(obj, (CooldownType)2, 3f); obj.consumable = false; _SPAWN_VFX = VFX.Create("basic_green_square", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); ((tk2dBaseSprite)(object)_SPAWN_VFX.GetComponent()).MakeHolographic(green: true); } public override bool CanBeUsed(PlayerController user) { return !Object.op_Implicit((Object)(object)_currentSyntheticGun); } public override void DoEffect(PlayerController user) { Gun val = PickupObjectDatabase.GetRandomGun(); if (!Object.op_Implicit((Object)(object)val)) { val = Items.Ak47.AsGun(); } MakeSyntheticGun(val, user); ((PlayerItem)this).m_activeDuration = 20f; ((PlayerItem)this).m_activeElapsed = 0f; ((PlayerItem)this).IsCurrentlyActive = true; ((Component)user).gameObject.Play("gun_synthesizer_activate_sound"); } public override void Pickup(PlayerController player) { base.Pickup(player); _owner = player; } public override void OnPreDrop(PlayerController player) { DestroySyntheticGun(player); _owner = null; ((PlayerItem)this).OnPreDrop(player); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)_owner)) { DestroySyntheticGun(_owner); } ((PlayerItem)this).OnDestroy(); } private void MakeSyntheticGun(Gun gun, PlayerController pc) { //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) pc.inventory.GunChangeForgiveness = true; Gun val = pc.inventory.AddGunToInventory(gun, true); _currentSyntheticGun = ((Component)val).gameObject.AddComponent(); CwaffVFX.SpawnBurst(_SPAWN_VFX, 64, Vector2.op_Implicit(val.barrelOffset.position), 0.25f, null, 15f, 0f, CwaffVFX.Vel.Random, CwaffVFX.Rot.None, 0.85f, null, 0f, null, fadeIn: false, uniform: false, 1f, 0.1f); } public override void Update() { ((PlayerItem)this).Update(); if (Object.op_Implicit((Object)(object)_currentSyntheticGun)) { if (((PlayerItem)this).CurrentRoomCooldown != 3) { ((PlayerItem)this).CurrentRoomCooldown = 3; } if (((PlayerItem)this).m_activeElapsed >= ((PlayerItem)this).m_activeDuration || ((Component)_currentSyntheticGun).GetComponent().CurrentAmmo == 0) { DestroySyntheticGun(((PlayerItem)this).LastOwner); } } } private void DestroySyntheticGun(PlayerController pc) { //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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) ((PlayerItem)this).IsCurrentlyActive = false; if (!Object.op_Implicit((Object)(object)_currentSyntheticGun)) { return; } Gun component = ((Component)_currentSyntheticGun).GetComponent(); tk2dSpriteCollectionData collection = ((BraveBehaviour)component).sprite.collection; tk2dSpriteDefinition currentSpriteDef = ((BraveBehaviour)component).sprite.GetCurrentSpriteDef(); List list = new List(16); for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { list.Add(Lazy.GetSpriteFragment(currentSpriteDef, i, j, 4)); } } if (collection.spriteNameLookupDict == null) { collection.InitDictionary(); } if (!collection.spriteNameLookupDict.TryGetValue(list[0].name, out var value)) { int num = (value = collection.spriteDefinitions.Length); Array.Resize(ref collection.spriteDefinitions, collection.spriteDefinitions.Length + 16); foreach (tk2dSpriteDefinition item in list) { collection.spriteDefinitions[num] = item; collection.spriteNameLookupDict[item.name] = num; num++; } } Vector3 val = Vector2.op_Implicit(((BraveBehaviour)component).sprite.WorldCenter); Vector3 val2 = Vector3Extensions.WithY(val, val.y + 16f); List list2 = Extensions.AsRange(new IntVector2(value, 16)); float num2 = 0f; foreach (int item2 in list2) { tk2dSprite obj = Lazy.SpriteObject(collection, item2); ((tk2dBaseSprite)obj).FlipX = ((BraveBehaviour)component).sprite.FlipX; ((tk2dBaseSprite)obj).FlipY = ((BraveBehaviour)component).sprite.FlipY; ((BraveBehaviour)obj).transform.rotation = ((BraveBehaviour)((BraveBehaviour)component).sprite).transform.rotation; ((tk2dBaseSprite)(object)obj).PlaceAtRotatedPositionByAnchor(val, (Anchor)4); ((Component)(object)obj).AddComponent().Setup(Vector2.op_Implicit(val), Vector2.op_Implicit(val2), 0.5f, num2, autoDestroy: true); ((tk2dBaseSprite)(object)obj).MakeHolographic(green: true); num2 += 0.0625f; } ((Component)pc).gameObject.Play("gun_synthesizer_activate_sound"); pc.inventory.GunLocked.RemoveOverride("Synthetic Gun"); pc.inventory.DestroyGun(component); _currentSyntheticGun = null; pc.inventory.GunChangeForgiveness = false; } } public class GasterBlaster : CwaffActive { public static string ItemName = "Gaster Blaster"; public static string ShortDescription = "Use Your Best Attack First"; public static string LongDescription = "Deploys a blaster behind the player that fires an extremely powerful beam after a short delay."; public static string Lore = "Given to Mr. Gundertale by \"a dear old friend\" and passed along to you, this blaster operates using a uniquely powerful combination of science, magic, and friendship. It shows surprisingly little wear, and the initials \"WDG\" can still clearly be seen engraved between the eyes. Holding it in your hands fills with you with a positive feeling you find difficult to determine at the moment."; internal static Projectile _GasterBlast; internal static GameObject _GasterBlaster; private PlayerController _owner; public static void Init() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) PlayerItem obj = Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)(-50); obj.consumable = false; ItemBuilder.SetCooldownType(obj, (CooldownType)1, 100f); float? damage = 700f; float? speed = 150f; float? force = 70f; float? range = 200f; bool? pierceBreakables = true; bool? pierceInternalWalls = true; bool? doBeamSetup = true; bool? beamIsRigid = false; bool? beamContinueToWall = false; bool? beamPiercesCover = true; _GasterBlast = Items.MarineSidearm.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, 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, null, pierceInternalWalls, doBeamSetup, "gaster_beam", 60, -1, -1, -1, -1, 16, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, 1000, beamPiercesCover, beamContinueToWall, beamIsRigid)).Attach((Action)delegate(PierceProjModifier pierce) { pierce.penetration = 100; pierce.penetratesBreakables = true; }, allowDuplicates: false); _GasterBlaster = VFX.Create("gaster_blaster_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } public override void Pickup(PlayerController player) { base.Pickup(player); _owner = player; } public override void OnPreDrop(PlayerController player) { _owner = null; ((PlayerItem)this).OnPreDrop(player); } public override bool CanBeUsed(PlayerController user) { if (user.IsInCombat) { return ((PlayerItem)this).CanBeUsed(user); } return false; } public override void DoEffect(PlayerController user) { if (!((Object)(object)user != (Object)(object)_owner)) { ((MonoBehaviour)user).StartCoroutine(BlasterWithGaster()); } } private IEnumerator BlasterWithGaster() { float currentGunAngle = _owner.m_currentGunAngle; Vector2 val = ((GameActor)_owner).CenterPosition.ToNearestWallOrObject((180f + currentGunAngle).Clamp180(), 0f); Vector2 val2 = val - ((GameActor)_owner).CenterPosition; val = ((GameActor)_owner).CenterPosition + (((Vector2)(ref val2)).magnitude - 1f).Clamp(0f, 2f) * ((Vector2)(ref val2)).normalized; GameObject blaster = SpawnManager.SpawnVFX(_GasterBlaster, Vector2Extensions.ToVector3ZUp(((GameActor)_owner).CenterPosition, 10f), Quaternion.identity); RotateIntoPositionBehavior rotcomp = blaster.AddComponent(); rotcomp.m_radius = 16f; rotcomp.m_fulcrum = val + BraveMathCollege.DegreesToVector(currentGunAngle, 16f); rotcomp.m_start_angle = currentGunAngle; rotcomp.m_end_angle = (180f + currentGunAngle).Clamp180(); rotcomp.m_rotate_time = 0.5f; rotcomp.Setup(); blaster.PlayUnique("gaster_blaster_sound_effect"); yield return (object)new WaitForSeconds(0.75f); ((Component)((BraveBehaviour)BeamAPI.FreeFireBeamFromAnywhere(_GasterBlast, _owner, (GameObject)null, ((tk2dBaseSprite)blaster.GetComponent()).WorldCenter + rotcomp.m_start_angle.ToVector(0.33f), rotcomp.m_start_angle, 0.75f, true, true, 0f)).sprite).gameObject.SetGlowiness(300f); blaster.ExpireIn(1.25f, 0.25f); } } public class InsurancePolicy : CwaffActive { public static string ItemName = "Insurance Policy"; public static string ShortDescription = "Kill Your Past, not Your Future"; public static string LongDescription = "Can be used when near a dropped item to insure it. Insured items will spawn in a special chest at the start of the next new run. Pseudo-restarts (such as those triggered by Clone) do not count as a new run for insurance purposes."; public static string Lore = "You can never quite know what the Gungeon has in store for you. One moment you might be minding your own business fighting off a wave of Blobulons, the next moment you might find a bottomless pit has formed underneath your feet to consume you and all of your hard-earned loot. Regardless of the outcome of your journey into the Gungeon, a personalized insurance policy offers the peace of mind that you'll get a second chance to put your favorite item to poor use."; private const float _MAX_DIST = 5f; internal static Chest _InsuranceChestPrefab = null; internal static GameObject _InsuranceSparklePrefab = null; internal static int _InsuranceSpriteRobot; internal static int _InsuranceSpriteConvict; internal static int _InsuranceSpritePilot; internal static int _InsuranceSpriteParadox; internal static int _InsuranceSpriteGunslinger; internal static int _InsuranceSpriteHunter; internal static int _InsuranceSpriteMarine; internal static int _InsuranceSpriteBullet; internal static GameObject _InsuranceVFXRobot; internal static GameObject _InsuranceVFXConvict; internal static GameObject _InsuranceVFXPilot; internal static GameObject _InsuranceVFXParadox; internal static GameObject _InsuranceVFXGunslinger; internal static GameObject _InsuranceVFXHunter; internal static GameObject _InsuranceVFXMarine; internal static GameObject _InsuranceVFXBullet; internal static GameObject _InsuranceParticleVFX; internal static int _InsurancePickupId; private static List _InsuredItems = new List(); private static string _InsuranceFile; public static void Init() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) PlayerItem obj = Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)(-50); ((PickupObject)obj).CanBeSold = false; ((PickupObject)obj).UsesCustomCost = true; ((PickupObject)obj).CustomCost = 30; ItemBuilder.SetCooldownType(obj, (CooldownType)0, 0.5f); _InsuranceVFXRobot = VFX.Create("insurance_policy_robot_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _InsuranceVFXConvict = VFX.Create("insurance_policy_convict_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _InsuranceVFXPilot = VFX.Create("insurance_policy_pilot_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _InsuranceVFXParadox = VFX.Create("insurance_policy_paradox_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _InsuranceVFXGunslinger = VFX.Create("insurance_policy_gunslinger_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _InsuranceVFXHunter = VFX.Create("insurance_policy_hunter_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _InsuranceVFXMarine = VFX.Create("insurance_policy_marine_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _InsuranceVFXBullet = VFX.Create("insurance_policy_bullet_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _InsuranceSpriteRobot = ((BraveBehaviour)obj).sprite.collection.GetSpriteIdByName("insurance_policy_robot_icon"); _InsuranceSpriteConvict = ((BraveBehaviour)obj).sprite.collection.GetSpriteIdByName("insurance_policy_convict_icon"); _InsuranceSpritePilot = ((BraveBehaviour)obj).sprite.collection.GetSpriteIdByName("insurance_policy_pilot_icon"); _InsuranceSpriteParadox = ((BraveBehaviour)obj).sprite.collection.GetSpriteIdByName("insurance_policy_paradox_icon"); _InsuranceSpriteGunslinger = ((BraveBehaviour)obj).sprite.collection.GetSpriteIdByName("insurance_policy_gunslinger_icon"); _InsuranceSpriteHunter = ((BraveBehaviour)obj).sprite.collection.GetSpriteIdByName("insurance_policy_hunter_icon"); _InsuranceSpriteMarine = ((BraveBehaviour)obj).sprite.collection.GetSpriteIdByName("insurance_policy_marine_icon"); _InsuranceSpriteBullet = ((BraveBehaviour)obj).sprite.collection.GetSpriteIdByName("insurance_policy_bullet_icon"); _InsuranceChestPrefab = ((Component)GameManager.Instance.RewardManager.GetTargetChestPrefab((ItemQuality)3)).gameObject.ClonePrefab().GetComponent(); _InsuranceChestPrefab.groundHitDelay = 0.4f; _InsuranceChestPrefab.spawnAnimName = ((BraveBehaviour)_InsuranceChestPrefab).sprite.SetUpAnimation("insurance_chest_appear", 11f, (WrapMode)2).name; ((BraveBehaviour)_InsuranceChestPrefab).spriteAnimator.GetClipByName("insurance_chest_appear").frames[0].triggerEvent = true; ((BraveBehaviour)_InsuranceChestPrefab).spriteAnimator.GetClipByName("insurance_chest_appear").frames[0].eventAudio = "Play_OBJ_smallchest_spawn_01"; _InsuranceChestPrefab.openAnimName = ((BraveBehaviour)_InsuranceChestPrefab).sprite.SetUpAnimation("insurance_chest_open", 12f, (WrapMode)2).name; _InsuranceChestPrefab.breakAnimName = ((BraveBehaviour)_InsuranceChestPrefab).sprite.SetUpAnimation("insurance_chest_break", 11f, (WrapMode)2).name; ((BraveBehaviour)_InsuranceChestPrefab).sprite.SetUpAnimation("insurance_chest_idle", 11f, (WrapMode)2); _InsuranceChestPrefab.IsLocked = false; ((Component)_InsuranceChestPrefab).GetComponent().HitPoints = float.MaxValue; _InsuranceFile = Path.Combine(SaveManager.SavePath, "insurance.csv"); _InsurancePickupId = ((PickupObject)obj).PickupObjectId; _InsuranceParticleVFX = VFX.Create("insurance_sparkle", 8f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 5f); CwaffEvents.OnFirstFloorOfRunFullyLoaded = (Action)Delegate.Combine(CwaffEvents.OnFirstFloorOfRunFullyLoaded, new Action(InsuranceCheck)); } internal static int GetSpriteIdForCharacter() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected I4, but got Unknown PlayableCharacters characterIdentity = GameManager.Instance.PrimaryPlayer.characterIdentity; return (int)characterIdentity switch { 2 => _InsuranceSpriteRobot, 1 => _InsuranceSpriteConvict, 0 => _InsuranceSpritePilot, 9 => _InsuranceSpriteParadox, 10 => _InsuranceSpriteGunslinger, 6 => _InsuranceSpriteHunter, 5 => _InsuranceSpriteMarine, 8 => _InsuranceSpriteBullet, _ => _InsuranceSpritePilot, }; } internal static GameObject GetVFXForCharacter() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected I4, but got Unknown PlayableCharacters characterIdentity = GameManager.Instance.PrimaryPlayer.characterIdentity; return (GameObject)((int)characterIdentity switch { 2 => _InsuranceVFXRobot, 1 => _InsuranceVFXConvict, 0 => _InsuranceVFXPilot, 9 => _InsuranceVFXParadox, 10 => _InsuranceVFXGunslinger, 6 => _InsuranceVFXHunter, 5 => _InsuranceVFXMarine, 8 => _InsuranceVFXBullet, _ => _InsuranceVFXPilot, }); } public override void Start() { ((PlayerItem)this).Start(); ((BraveBehaviour)this).sprite.SetSprite(GetSpriteIdForCharacter()); } public static void InsuranceCheck() { ((MonoBehaviour)GameManager.Instance).StartCoroutine(InsuranceCheck_CR()); static IEnumerator InsuranceCheck_CR() { PlayerController p1 = GameManager.Instance.PrimaryPlayer; while (!p1.AcceptingAnyInput) { yield return null; } LoadInsuredItems(); ClearInsuredItemsFile(); if (_InsuredItems.Count != 0) { bool flag = default(bool); Chest obj = Chest.Spawn(_InsuranceChestPrefab, GameManager.Instance.PrimaryPlayer.CurrentRoom.GetCenteredVisibleClearSpot(2, 2, ref flag, false)); obj.m_isMimic = false; obj.forceContentIds = new List(_InsuredItems); _InsuredItems.Clear(); } } } public override void DoEffect(PlayerController user) { //IL_0080: 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_0090: Unknown result type (might be due to invalid IL or missing references) ((PlayerItem)this).numberOfUses = ((PlayerItem)this).numberOfUses + 1; PickupObject val = null; float num = 5f; foreach (DebrisObject allDebri in StaticReferenceManager.AllDebris) { if (!allDebri.IsPickupObject) { continue; } PickupObject componentInChildren = ((Component)allDebri).GetComponentInChildren(); if (componentInChildren != null && !componentInChildren.IsBeingSold && !Object.op_Implicit((Object)(object)((Component)componentInChildren).GetComponent()) && !_InsuredItems.Contains(componentInChildren.PickupObjectId) && componentInChildren.PickupObjectId != _InsurancePickupId) { Vector2 val2 = ((BraveBehaviour)allDebri).sprite.WorldCenter - ((GameActor)user).CenterPosition; float magnitude = ((Vector2)(ref val2)).magnitude; if (!(magnitude >= num)) { val = componentInChildren; num = magnitude; } } } if (Object.op_Implicit((Object)(object)val)) { ((PlayerItem)this).numberOfUses = ((PlayerItem)this).numberOfUses - 1; ((Component)val).gameObject.AddComponent().DoSparkles(); _InsuredItems.Add(val.PickupObjectId); SaveInsuredItems(); ((Component)this).gameObject.Play("the_sound_of_buying_insurance"); } } internal static void SaveInsuredItems() { using StreamWriter streamWriter = File.CreateText(_InsuranceFile); bool flag = true; foreach (int insuredItem in _InsuredItems) { streamWriter.Write(string.Format("{0}{1}", flag ? "" : ",", insuredItem)); flag = false; } } internal static void LoadInsuredItems() { _InsuredItems.Clear(); if (!File.Exists(_InsuranceFile)) { return; } try { string[] array = File.ReadAllLines(_InsuranceFile)[0].Split(new char[1] { ',' }); foreach (string s in array) { _InsuredItems.Add(int.Parse(s)); } } catch (Exception) { _InsuredItems.Clear(); } } internal static void ClearInsuredItemsFile() { if (File.Exists(_InsuranceFile)) { File.Delete(_InsuranceFile); } } } public class Insured : MonoBehaviour { private PickupObject _pickup; private int _pickupId; private bool _doSparkles; public bool dropped; public GameObject vfx; private const float SPIN_TIME = 3f; private const float SPIN_AMOUNT = 4.25f; private const float SPIN_RADIANS = 26.703539f; private void Start() { _pickup = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)_pickup)) { _pickupId = _pickup.PickupObjectId; dropped = true; OnDrop(); if (_doSparkles && Object.op_Implicit((Object)(object)((BraveBehaviour)_pickup).sprite)) { ((MonoBehaviour)_pickup).StartCoroutine(DoSparkles_CR()); } } } private void LateUpdate() { if (dropped) { UpdateVFX(); } List unassignedInteractableObjects = RoomHandler.unassignedInteractableObjects; PickupObject pickup = _pickup; bool flag = unassignedInteractableObjects.Contains((IPlayerInteractable)(object)((pickup is IPlayerInteractable) ? pickup : null)); if (dropped != flag) { if (flag) { OnDrop(); } else { OnPickup(); } dropped = flag; } } private void UpdateVFX() { //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) if (Object.op_Implicit((Object)(object)vfx) && Object.op_Implicit((Object)(object)_pickup) && Object.op_Implicit((Object)(object)((BraveBehaviour)_pickup).sprite)) { vfx.transform.position = Vector2.op_Implicit(((BraveBehaviour)_pickup).sprite.WorldTopCenter.HoverAt(0.25f, 4f, 0.75f)); } } private void OnDrop() { //IL_003c: 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_0050: 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) vfx.SafeDestroy(); if (Object.op_Implicit((Object)(object)_pickup) && Object.op_Implicit((Object)(object)((BraveBehaviour)_pickup).sprite)) { vfx = SpawnManager.SpawnVFX(InsurancePolicy.GetVFXForCharacter(), Vector2.op_Implicit(((BraveBehaviour)_pickup).sprite.WorldTopCenter + new Vector2(0f, 0.5f)), Quaternion.identity); vfx.transform.parent = ((Component)_pickup).gameObject.transform; ((MonoBehaviour)_pickup).StartCoroutine(SpinIntoExistence(vfx)); } } public static IEnumerator SpinIntoExistence(GameObject vfx) { if (!Object.op_Implicit((Object)(object)vfx)) { yield break; } vfx.SetAlphaImmediate(0.5f); vfx.transform.localScale = Vector3Extensions.WithX(vfx.transform.localScale, 0f); for (float elapsed = 0f; elapsed < 3f; elapsed += BraveTime.DeltaTime) { if (!Object.op_Implicit((Object)(object)vfx)) { break; } float num = 1f - elapsed / 3f; float num2 = 1f - num * num * num; vfx.transform.localScale = Vector3Extensions.WithX(vfx.transform.localScale, Mathf.Sin(num2 * 26.703539f)); yield return null; } } private void OnPickup() { if (!((Object)(object)vfx == (Object)null)) { Object.Destroy((Object)(object)vfx); vfx = null; } } public void DoSparkles() { _doSparkles = true; } public IEnumerator DoSparkles_CR() { Vector3 basePos = Vector2Extensions.ToVector3ZisY(((BraveBehaviour)_pickup).sprite.WorldCenter, -10f); int i = 0; while (i < 20) { SpawnManager.SpawnVFX(InsurancePolicy._InsuranceParticleVFX, basePos + Vector2Extensions.ToVector3ZUp(Lazy.RandomVector(0.5f), 0f), Quaternion.identity); yield return null; int num = i + 1; i = num; } } } public class Itemfinder : CwaffActive { public static string ItemName = "Itemfinder"; public static string ShortDescription = "Scavenger Hunt"; public static string LongDescription = "Beeps when near hidden treasure. Using near hidden treasure uncovers an item or gun with varying rarity."; public static string Lore = "Ox and Cadence commissioned the development of this handy little gadget for helping them find wares to sell at their shop. Their inventory has expanded considerably since they switched over from using a traditional metal detector, which had the unfortunate habit of going off around just about everything in the Gungeon. As this included the Gundead themselves, Ox and Cadence's medical expenses have also gone down considerably since foregoing the metal detector."; internal readonly float[] _TREASURE_CHANCES = new float[4] { 1f, 0.5f, 0.2f, 0.05f }; internal readonly float[] _QUALITY_CHANCES = new float[5] { 1f, 0.6f, 0.27f, 0.09f, 0.03f }; internal const float _CLOSE_DISTANCE = 5f; internal const float _CLOSE_DISTANCE_SQR = 25f; internal const int _MAX_CELL_DIST = 5; internal static List _RoomsOnFloor = null; internal static List _Treasure = null; internal static float _LastSoundPlayTime = 0f; internal static int _NormalId; internal static int _BlinkId; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) PlayerItem obj = Lazy.SetupActive(ItemName, ShortDescription, LongDescription, Lore); ((PickupObject)obj).quality = (ItemQuality)4; obj.consumable = false; ItemBuilder.SetCooldownType(obj, (CooldownType)0, 1f); _NormalId = ((BraveBehaviour)obj).sprite.spriteId; _BlinkId = ((BraveBehaviour)obj).sprite.collection.GetSpriteIdByName("itemfinder_blink_icon"); } public override void OnFirstPickup(PlayerController player) { base.OnFirstPickup(player); InitializeTreasureForFloor(); } public override void Pickup(PlayerController player) { GameManager.Instance.OnNewLevelFullyLoaded -= InitializeTreasureForFloor; GameManager.Instance.OnNewLevelFullyLoaded += InitializeTreasureForFloor; base.Pickup(player); } public override void OnPreDrop(PlayerController player) { GameManager.Instance.OnNewLevelFullyLoaded -= InitializeTreasureForFloor; ((PlayerItem)this).OnPreDrop(player); } public override void OnDestroy() { GameManager.Instance.OnNewLevelFullyLoaded -= InitializeTreasureForFloor; ((PlayerItem)this).OnDestroy(); } public override bool CanBeUsed(PlayerController user) { //IL_0016: 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_0021: 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) bool flag = false; foreach (TreasureLocation item in _Treasure) { Vector2 val = item.location - ((GameActor)user).CenterPosition; if (((Vector2)(ref val)).sqrMagnitude < 25f) { flag = true; break; } } if (flag && BraveTime.ScaledTimeSinceStartup - _LastSoundPlayTime > 1f) { ((BraveBehaviour)this).sprite.SetSprite(_BlinkId); ((Component)user).gameObject.Play("itemfinder_sound"); _LastSoundPlayTime = BraveTime.ScaledTimeSinceStartup; } if (BraveTime.ScaledTimeSinceStartup - _LastSoundPlayTime > 0.5f) { ((BraveBehaviour)this).sprite.SetSprite(_NormalId); } if (flag) { return ((PlayerItem)this).CanBeUsed(user); } return false; } public override void DoEffect(PlayerController user) { //IL_001e: 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_002e: 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_007b: 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) TreasureLocation treasureLocation = null; float num = 25f; foreach (TreasureLocation item in _Treasure) { Vector2 val = item.location - ((GameActor)user).CenterPosition; float sqrMagnitude = ((Vector2)(ref val)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; treasureLocation = item; } } if (Object.op_Implicit((Object)(object)treasureLocation)) { LootEngine.SpawnItem(((Component)treasureLocation.pickup).gameObject, Vector2.op_Implicit(treasureLocation.location), Vector2.zero, 0f, true, true, false); if (user.HasSynergy(Synergy.TREASURE_HUNTER)) { LootEngine.SpawnCurrency(treasureLocation.location, Random.Range(3, 10), false, (Vector2?)null, (float?)null, 4f, 0.05f); } ((Component)user).gameObject.Play("itemfinder_get_item"); _Treasure.Remove(treasureLocation); Object.Destroy((Object)(object)((Component)treasureLocation).gameObject); } } private void InitializeTreasureForFloor() { //IL_0060: 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_0093: 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_0091: 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) if (_Treasure != null) { _Treasure.Clear(); } _Treasure = new List(); _RoomsOnFloor = GameManager.Instance.Dungeon.data.rooms.CopyAndShuffle(); float value = Random.value; for (int i = 0; i < _TREASURE_CHANCES.Length && !(value > _TREASURE_CHANCES[i]); i++) { float value2 = Random.value; ItemQuality quality = ((!(value2 < _QUALITY_CHANCES[4])) ? ((!(value2 < _QUALITY_CHANCES[3])) ? ((!(value2 < _QUALITY_CHANCES[2])) ? ((!(value2 < _QUALITY_CHANCES[1])) ? ((ItemQuality)1) : ((ItemQuality)2)) : ((ItemQuality)3)) : ((ItemQuality)4)) : ((ItemQuality)5)); InitializeSingleTreasureOfQuality(quality); } } private bool IsViableTreasureRoom(RoomHandler room) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 //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) if (room == null || room.area == null) { return false; } if ((int)room.area.PrototypeRoomCategory != 2 && (int)room.area.PrototypeRoomCategory != 1) { return false; } if (room.area.IsProceduralRoom || room.area.proceduralCells != null) { return false; } if (room.GetRandomVisibleClearSpot(5, 5) == IntVector2.Zero) { return false; } return true; } private RoomHandler GetNextTreasureRoom() { for (int num = _RoomsOnFloor.Count - 1; num >= 0; num--) { RoomHandler val = _RoomsOnFloor[num]; _RoomsOnFloor.RemoveAt(num); if (IsViableTreasureRoom(val)) { return val; } } return null; } private void InitializeSingleTreasureOfQuality(ItemQuality quality) { //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_003f: 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) RoomHandler nextTreasureRoom = GetNextTreasureRoom(); if (nextTreasureRoom == null) { ETGModConsole.Log((object)"failed to initalize treasure D:", false); return; } IntVector2 randomVisibleClearSpot = nextTreasureRoom.GetRandomVisibleClearSpot(5, 5); if (randomVisibleClearSpot == IntVector2.Zero) { ETGModConsole.Log((object)"failed to get a good spot for treasure D:", false); } else { _Treasure.Add(TreasureLocation.Create(quality, ((IntVector2)(ref randomVisibleClearSpot)).ToVector2())); } } } public class TreasureLocation : MonoBehaviour { public PickupObject pickup; public Vector2 location = Vector2.zero; public static TreasureLocation Create(ItemQuality quality, Vector2 location) { //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_000b: 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_001c: 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) GameObject val = new GameObject(); val.transform.position = Vector2.op_Implicit(location); TreasureLocation treasureLocation = val.AddComponent(); treasureLocation.pickup = LootEngine.GetItemOfTypeAndQuality(quality, (GenericLootTable)null, false); treasureLocation.location = location; return treasureLocation; } } public class PlayerProjectilePoolInfo : MonoBehaviour { public Action OnDestruction; public OnPreRigidbodyCollisionDelegate OnPreRigidbodyCollision; public Action OnCollision; public OnPreTileCollisionDelegate OnPreTileCollision; public OnTileCollisionDelegate OnTileCollision; public OnRigidbodyCollisionDelegate OnRigidbodyCollision; internal Projectile projectile; internal PlayerProjectilePooler pooler; internal LinkedListNode node; internal List startingTransforms = new List(); internal bool spawned; private static FieldInfo _OnDestructionBackingField = typeof(Projectile).GetField("OnDestruction", BindingFlags.Instance | BindingFlags.NonPublic); internal LinkedListNode Register(PlayerProjectilePooler pooler) { this.pooler = pooler; node = new LinkedListNode(((Component)this).gameObject); RegisterStartingTransforms(((Component)this).gameObject.transform); spawned = true; return node; } internal void RestoreDelegates() { _OnDestructionBackingField.SetValue(projectile, OnDestruction); SpeculativeRigidbody specRigidbody = ((BraveBehaviour)projectile).specRigidbody; specRigidbody.OnPreRigidbodyCollision = OnPreRigidbodyCollision; specRigidbody.OnCollision = OnCollision; specRigidbody.OnPreTileCollision = OnPreTileCollision; specRigidbody.OnTileCollision = OnTileCollision; specRigidbody.OnRigidbodyCollision = OnRigidbodyCollision; } private void RegisterStartingTransforms(Transform root) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown startingTransforms.Add(root); foreach (Transform item in root) { Transform root2 = item; RegisterStartingTransforms(root2); } } } [HarmonyPatch] internal class PlayerProjectilePooler { internal static readonly List _NoPurgeWhitelist = new List(7) { typeof(Transform), typeof(PlayerProjectilePoolInfo), typeof(Projectile), typeof(SpeculativeRigidbody), typeof(tk2dSprite), typeof(MeshFilter), typeof(MeshRenderer) }; private static readonly List _AwaitingNewOwner = new List(); private static List _Components = new List(); internal static readonly Dictionary _Poolers = new Dictionary(); private GameObject _prefab; private string _name; private List _prefabTransforms = new List(); private LinkedList _despawned = new LinkedList(); private LinkedList _spawned = new LinkedList(); internal static void RegisterAsPoolable(Projectile p) { GameObject gameObject = ((Component)p).gameObject; PlayerProjectilePooler playerProjectilePooler = new PlayerProjectilePooler(); playerProjectilePooler._prefab = gameObject; playerProjectilePooler._name = ((Object)gameObject).name; if (playerProjectilePooler.RegisterPrefabTransforms(gameObject.transform)) { _Poolers[gameObject] = playerProjectilePooler; } } private bool RegisterPrefabTransforms(Transform root) { _prefabTransforms.Add(root); ((Component)root).gameObject.GetComponents(_Components); foreach (Component component in _Components) { if (!(component is IPPPComponent) && !_NoPurgeWhitelist.Contains(((object)component).GetType())) { return false; } } int childCount = root.childCount; for (int i = 0; i < childCount; i++) { if (!RegisterPrefabTransforms(root.GetChild(i))) { return false; } } return true; } private static void ClearPoolsForNextFloor() { foreach (PlayerProjectilePooler value in _Poolers.Values) { while (value._spawned.Count > 0) { value.Despawn(value._spawned.Last.Value, destroy: true); } while (value._despawned.Count > 0) { Object.Destroy((Object)(object)value._despawned.Last.Value); value._despawned.RemoveLast(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPatch(typeof(Projectile), "SetOwnerSafe")] [HarmonyPostfix] private static void OnProjectileOwnerAssignedPatch(Projectile __instance) { if (!_AwaitingNewOwner.Remove(__instance)) { return; } __instance.OnSpawned(); ((Component)__instance).gameObject.GetComponents(_Components); foreach (Component component in _Components) { if (component is IPPPComponent iPPPComponent) { iPPPComponent.PPPRespawn(); } } } private GameObject Spawn(Vector3 position, Quaternion rotation) { //IL_015d: 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_0016: 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_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 //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown if (_despawned.Count == 0) { GameObject val = Object.Instantiate(_prefab, position, rotation); PlayerProjectilePoolInfo playerProjectilePoolInfo = val.AddComponent(); Projectile val2 = (playerProjectilePoolInfo.projectile = val.GetComponent()); playerProjectilePoolInfo.OnPreTileCollision = (OnPreTileCollisionDelegate)Delegate.Combine((Delegate?)(object)playerProjectilePoolInfo.OnPreTileCollision, (Delegate?)new OnPreTileCollisionDelegate(val2.OnPreTileCollision)); playerProjectilePoolInfo.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)playerProjectilePoolInfo.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(val2.OnPreCollision)); playerProjectilePoolInfo.OnTileCollision = (OnTileCollisionDelegate)Delegate.Combine((Delegate?)(object)playerProjectilePoolInfo.OnTileCollision, (Delegate?)new OnTileCollisionDelegate(val2.OnTileCollision)); playerProjectilePoolInfo.OnRigidbodyCollision = (OnRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)playerProjectilePoolInfo.OnRigidbodyCollision, (Delegate?)new OnRigidbodyCollisionDelegate(val2.OnRigidbodyCollision)); val.GetComponents(_Components); foreach (Component component3 in _Components) { if (component3 is IPPPComponent iPPPComponent) { iPPPComponent.PPPInit(playerProjectilePoolInfo); } } _spawned.AddLast(playerProjectilePoolInfo.Register(this)); playerProjectilePoolInfo.RestoreDelegates(); return val; } LinkedListNode last = _despawned.Last; _despawned.RemoveLast(); _spawned.AddLast(last); GameObject value = last.Value; value.transform.position = position; value.transform.rotation = rotation; value.SetActive(true); Projectile component = value.GetComponent(); component.Reawaken(); _AwaitingNewOwner.Add(component); PlayerProjectilePoolInfo component2 = value.GetComponent(); component2.spawned = true; component2.RestoreDelegates(); return value; } private void Sanitize(Transform root, PlayerProjectilePoolInfo pppi, ref int savedTransforms) { int num = pppi.startingTransforms.IndexOf(root); if (num == -1) { Object.Destroy((Object)(object)((Component)root).gameObject); return; } Transform val = _prefabTransforms[num]; ((Component)root).gameObject.GetComponents(_Components); foreach (Component component in _Components) { if (!_NoPurgeWhitelist.Contains(((object)component).GetType())) { if (component is IPPPComponent iPPPComponent) { iPPPComponent.PPPReset(((Component)val).gameObject); } else { Object.Destroy((Object)(object)component); } } } savedTransforms++; int childCount = root.childCount; for (int i = 0; i < childCount; i++) { Sanitize(root.GetChild(i), pppi, ref savedTransforms); } } private void Despawn(GameObject projInstance, bool destroy = false) { PlayerProjectilePoolInfo component = projInstance.GetComponent(); component.spawned = false; int savedTransforms = 0; Sanitize(projInstance.transform, component, ref savedTransforms); if (savedTransforms != component.startingTransforms.Count) { Object.Destroy((Object)(object)projInstance); return; } SpeculativeRigidbody component2 = projInstance.GetComponent(); SpeculativeRigidbody component3 = _prefab.GetComponent(); ResetSpeculativeRigidbody(component2, component3); Projectile component4 = projInstance.GetComponent(); Projectile component5 = _prefab.GetComponent(); ResetProjectile(component4, component5); StaticReferenceManager.RemoveProjectile(component4); tk2dBaseSprite sprite = ((BraveBehaviour)component4).sprite; tk2dBaseSprite componentInChildren = _prefab.GetComponentInChildren(); ResetSprite(sprite, componentInChildren); projInstance.transform.parent = null; projInstance.SetActive(false); _spawned.Remove(component.node); if (!destroy) { _despawned.AddLast(component.node); } else { Object.Destroy((Object)(object)projInstance); } } private static void ResetSprite(tk2dBaseSprite sprite, tk2dBaseSprite baseSprite) { //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) sprite.OverrideMaterialMode = baseSprite.OverrideMaterialMode; ((BraveBehaviour)sprite).renderer.material.shader = ((BraveBehaviour)baseSprite).renderer.material.shader; ((BraveBehaviour)sprite).renderer.material.CopyPropertiesFromMaterial(((BraveBehaviour)baseSprite).renderer.material); sprite.SetSprite(baseSprite.collection, baseSprite.spriteId); } private static void ResetProjectile(Projectile proj, Projectile baseProj) { //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_0359: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Unknown result type (might be due to invalid IL or missing references) proj.PossibleSourceGun = null; proj.SpawnedFromOtherPlayerProjectile = false; proj.PlayerProjectileSourceGameTimeslice = -1f; proj.m_owner = null; proj.BulletScriptSettings.SetAll(baseProj.BulletScriptSettings); proj.damageTypes = baseProj.damageTypes; proj.allowSelfShooting = baseProj.allowSelfShooting; proj.collidesWithPlayer = baseProj.collidesWithPlayer; proj.collidesWithProjectiles = baseProj.collidesWithProjectiles; proj.collidesOnlyWithPlayerProjectiles = baseProj.collidesOnlyWithPlayerProjectiles; proj.projectileHitHealth = baseProj.projectileHitHealth; proj.collidesWithEnemies = baseProj.collidesWithEnemies; proj.shouldRotate = baseProj.shouldRotate; proj.shouldFlipVertically = baseProj.shouldFlipVertically; proj.shouldFlipHorizontally = baseProj.shouldFlipHorizontally; proj.ignoreDamageCaps = baseProj.ignoreDamageCaps; proj.baseData.damage = baseProj.baseData.damage; proj.baseData.speed = baseProj.baseData.speed; proj.baseData.range = baseProj.baseData.range; proj.baseData.force = baseProj.baseData.force; proj.baseData.damping = baseProj.baseData.damping; proj.baseData.UsesCustomAccelerationCurve = baseProj.baseData.UsesCustomAccelerationCurve; proj.baseData.AccelerationCurve = baseProj.baseData.AccelerationCurve; proj.baseData.CustomAccelerationCurveDuration = baseProj.baseData.CustomAccelerationCurveDuration; proj.AppliesPoison = baseProj.AppliesPoison; proj.PoisonApplyChance = baseProj.PoisonApplyChance; proj.AppliesSpeedModifier = baseProj.AppliesSpeedModifier; proj.SpeedApplyChance = baseProj.SpeedApplyChance; proj.AppliesCharm = baseProj.AppliesCharm; proj.CharmApplyChance = baseProj.CharmApplyChance; proj.AppliesFreeze = baseProj.AppliesFreeze; proj.FreezeApplyChance = baseProj.FreezeApplyChance; proj.AppliesFire = baseProj.AppliesFire; proj.FireApplyChance = baseProj.FireApplyChance; proj.AppliesStun = baseProj.AppliesStun; proj.StunApplyChance = baseProj.StunApplyChance; proj.AppliedStunDuration = baseProj.AppliedStunDuration; proj.AppliesBleed = baseProj.AppliesBleed; proj.AppliesCheese = baseProj.AppliesCheese; proj.CheeseApplyChance = baseProj.CheeseApplyChance; proj.BleedApplyChance = baseProj.BleedApplyChance; proj.CanTransmogrify = baseProj.CanTransmogrify; proj.ChanceToTransmogrify = baseProj.ChanceToTransmogrify; if (proj.TransmogrifyTargetGuids != null && proj.TransmogrifyTargetGuids.Length != 0) { Array.Resize(ref proj.TransmogrifyTargetGuids, 0); } proj.BossDamageMultiplier = 1f; proj.SpawnedFromNonChallengeItem = false; proj.TreatedAsNonProjectileForChallenge = false; proj.CenterTilemapHitEffectsByProjectileVelocity = baseProj.CenterTilemapHitEffectsByProjectileVelocity; proj.damagesWalls = baseProj.damagesWalls; proj.persistTime = baseProj.persistTime; proj.angularVelocity = baseProj.angularVelocity; proj.angularVelocityVariance = baseProj.angularVelocityVariance; proj.spawnEnemyGuidOnDeath = baseProj.spawnEnemyGuidOnDeath; proj.HasFixedKnockbackDirection = baseProj.HasFixedKnockbackDirection; proj.FixedKnockbackDirection = baseProj.FixedKnockbackDirection; proj.pierceMinorBreakables = baseProj.pierceMinorBreakables; proj.objectImpactEventName = baseProj.objectImpactEventName; proj.enemyImpactEventName = baseProj.enemyImpactEventName; proj.onDestroyEventName = baseProj.onDestroyEventName; proj.additionalStartEventName = baseProj.additionalStartEventName; proj.IsRadialBurstLimited = baseProj.IsRadialBurstLimited; proj.MaxRadialBurstLimit = baseProj.MaxRadialBurstLimit; proj.AppliesKnockbackToPlayer = baseProj.AppliesKnockbackToPlayer; proj.PlayerKnockbackForce = baseProj.PlayerKnockbackForce; proj.HasDefaultTint = baseProj.HasDefaultTint; proj.DefaultTintColor = baseProj.DefaultTintColor; proj.IsCritical = false; proj.BlackPhantomDamageMultiplier = 1f; proj.PenetratesInternalWalls = baseProj.PenetratesInternalWalls; proj.neverMaskThis = baseProj.neverMaskThis; proj.isFakeBullet = baseProj.isFakeBullet; proj.CanBecomeBlackBullet = baseProj.CanBecomeBlackBullet; proj.DelayedDamageToExploders = baseProj.DelayedDamageToExploders; proj.IsBlackBullet = false; proj.m_forceBlackBullet = false; (proj.statusEffectsToApply ?? (proj.statusEffectsToApply = new List())).Clear(); proj.m_initialized = false; proj.m_cachedHasBeamController = null; proj.AdditionalScaleMultiplier = baseProj.AdditionalScaleMultiplier; proj.m_cachedLayer = 0; proj.m_currentTintPriority = -1; proj.CurseSparks = false; proj.m_lastSparksPoint = null; proj.OverrideMotionModule = null; proj.m_usesNormalMoveRegardless = false; proj.m_isInWall = false; proj.m_shooter = null; proj.m_currentSpeed = 0f; proj.m_currentDirection = default(Vector2); proj.m_timeElapsed = 0f; proj.m_distanceElapsed = 0f; proj.m_lastPosition = default(Vector3); proj.m_hasImpactedObject = false; proj.m_hasImpactedEnemy = false; proj.m_hasDiedInAir = false; proj.m_hasPierced = false; proj.m_healthHaverHitCount = 0; proj.m_spawnPool = null; proj.m_isRamping = false; proj.m_rampTimer = 0f; proj.m_rampDuration = 0f; proj.m_currentRampHeight = 0f; proj.m_startRampHeight = 0f; proj.m_ignoreTileCollisionsTimer = 0f; proj.m_outOfBoundsCounter = 0f; proj.m_isExitClippingTiles = false; proj.m_exitClippingDistance = 0f; proj.OnHitEnemy = null; proj.OnWillKillEnemy = null; proj.OnBecameDebris = null; proj.OnBecameDebrisGrounded = null; proj.ModifyVelocity = null; proj.PreMoveModifiers = null; } private static void ResetSpeculativeRigidbody(SpeculativeRigidbody body, SpeculativeRigidbody baseBody) { //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_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_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_0112: 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_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0168: 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) body.CollideWithTileMap = baseBody.CollideWithTileMap; body.CollideWithOthers = baseBody.CollideWithOthers; body.Velocity = baseBody.Velocity; body.CapVelocity = baseBody.CapVelocity; body.MaxVelocity = baseBody.MaxVelocity; body.ForceAlwaysUpdate = baseBody.ForceAlwaysUpdate; body.CanPush = baseBody.CanPush; body.CanBePushed = baseBody.CanBePushed; body.PushSpeedModifier = baseBody.PushSpeedModifier; body.CanCarry = baseBody.CanCarry; body.CanBeCarried = baseBody.CanBeCarried; body.ForceCarriesRigidbodies = false; body.PreventPiercing = baseBody.PreventPiercing; body.SkipEmptyColliders = baseBody.SkipEmptyColliders; body.TK2DSprite = baseBody.TK2DSprite; body.RegenerateColliders = false; body.RecheckTriggers = baseBody.RecheckTriggers; body.UpdateCollidersOnRotation = baseBody.UpdateCollidersOnRotation; body.UpdateCollidersOnScale = baseBody.UpdateCollidersOnScale; body.AxialScale = baseBody.AxialScale; body.IgnorePixelGrid = baseBody.IgnorePixelGrid; body.SortHash = -1; body.m_cachedIsSimpleProjectile = null; body.PathMode = false; body.PathTarget = default(IntVector2); body.PathSpeed = 0f; SpeculativeRigidbody val = body; (val.PreviousPositions ?? (val.PreviousPositions = new LinkedList())).Clear(); body.LastVelocity = default(Vector3); body.LastRotation = 0f; body.LastScale = default(Vector2); body.m_position = new Position(0, 0); val = body; (val.m_specificCollisionExceptions ?? (val.m_specificCollisionExceptions = new List())).Clear(); val = body; (val.m_temporaryCollisionExceptions ?? (val.m_temporaryCollisionExceptions = new List())).Clear(); val = body; (val.m_ghostCollisionExceptions ?? (val.m_ghostCollisionExceptions = new List())).Clear(); val = body; (val.m_pushedRigidbodies ?? (val.m_pushedRigidbodies = new List())).Clear(); val = body; (val.m_carriedRigidbodies ?? (val.m_carriedRigidbodies = new List())).Clear(); body.m_initialized = false; PhysicsEngine.Instance.DeregisterWhenAvailable(body); body.OnPreMovement = null; body.OnPreRigidbodyCollision = null; body.OnPreTileCollision = null; body.OnCollision = null; body.OnRigidbodyCollision = null; body.OnBeamCollision = null; body.OnTileCollision = null; body.OnEnterTrigger = null; body.OnTriggerCollision = null; body.OnExitTrigger = null; body.OnPathTargetReached = null; body.OnPostRigidbodyMovement = null; body.MovementRestrictor = null; body.OnHitByBeam = null; body.ReflectProjectilesNormalGenerator = null; body.ReflectBeamsNormalGenerator = null; } [HarmonyPatch(typeof(SpawnManager), "SpawnProjectile", new Type[] { typeof(GameObject), typeof(Vector3), typeof(Quaternion), typeof(bool) })] [HarmonyPrefix] private static bool SpawnManagerSpawnProjectilePatch(GameObject prefab, Vector3 position, Quaternion rotation, bool ignoresPools, ref GameObject __result) { //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) if (!_Poolers.TryGetValue(prefab, out var value)) { return true; } __result = value.Spawn(position, rotation); return (Object)(object)__result == (Object)null; } [HarmonyPatch(typeof(SpawnManager), "Despawn", new Type[] { typeof(GameObject) })] [HarmonyPatch(typeof(SpawnManager), "Despawn", new Type[] { typeof(GameObject), typeof(PrefabPool) })] [HarmonyPrefix] private static bool SpawnManagerDespawnPatch(GameObject instance, ref bool __result) { PlayerProjectilePoolInfo component = instance.GetComponent(); if (component == null) { return true; } if (component.pooler == null) { Debug.LogError((object)"Detected invalid duplication of a pooled player projectile, tell Captain Pretzel"); Object.Destroy((Object)(object)component); return true; } component.pooler.Despawn(instance); __result = true; return false; } [HarmonyPatch(typeof(GameManager), "LoadNextLevelAsync_CR")] [HarmonyPrefix] private static void LoadNextLevelAsync_CRPatch(GameManager __instance) { ClearPoolsForNextFloor(); } [HarmonyPatch(typeof(ParticleKiller), "Update")] [HarmonyILManipulator] private static void ParticleKillerUpdatePatchIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func[2] { (Instruction instr) => ILPatternMatchingExt.MatchLdfld(instr, "m_parentTransform"), (Instruction instr) => ILPatternMatchingExt.MatchCall(instr, "op_Implicit") })) { val.Emit(OpCodes.Ldarg_0); val.CallPrivate(typeof(PlayerProjectilePooler), "IsPKParentActive"); } } private static bool IsPKParentActive(bool wasActive, ParticleKiller pk) { if (wasActive) { return ((Component)pk.m_parentTransform).gameObject.activeSelf; } return false; } } internal static class PlayerProjectilePoolerHelpers { public static Projectile RegisterAsPoolable(this Projectile p) { PlayerProjectilePooler.RegisterAsPoolable(p); return p; } } internal interface IPPPComponent { void PPPInit(PlayerProjectilePoolInfo pppi); void PPPReset(GameObject prefab); void PPPRespawn(); } [HarmonyPatch] internal static class CwaffDebug { [Conditional("DEBUG")] public static void DebugNametag(this AIActor actor, string text) { Nametag nametag = ((Component)actor).gameObject.GetComponent(); if (nametag == null) { nametag = ((Component)actor).gameObject.AddComponent(); nametag.Setup((TextAnchor)1); } nametag.SetName(text); nametag.UpdateWhileParentAlive(); } } public static class CwaffProfile { private class ProfileData { public Stopwatch watch = new Stopwatch(); public long startBytes; public string shortName; } private static readonly Dictionary _ProfileData = new Dictionary(); private static readonly string _RX = ".*<.*::(.*)>"; public static void ProfileType(this Harmony harmony) { //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_007c: Expected O, but got Unknown //IL_007c: Expected O, but got Unknown Type typeFromHandle = typeof(T); MethodInfo method = typeof(CwaffProfile).GetMethod("ProfileMethodPrefix", AccessTools.all); MethodInfo method2 = typeof(CwaffProfile).GetMethod("ProfileMethodPostfix", AccessTools.all); MethodInfo[] methods = typeof(T).GetMethods(); foreach (MethodInfo methodInfo in methods) { if ((object)methodInfo.DeclaringType == typeFromHandle) { try { harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(method), new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ETGModConsole.Log((object)(" Patched " + GeneralExtensions.FullDescription((MethodBase)methodInfo)), false); } catch (Exception) { ETGModConsole.Log((object)(" Exception patching " + GeneralExtensions.FullDescription((MethodBase)methodInfo)), false); } } } } private static void ProfileMethodPrefix() { string name = new StackTrace().GetFrame(1).GetMethod().Name; if (!_ProfileData.TryGetValue(name, out var value)) { ProfileData profileData = (_ProfileData[name] = new ProfileData()); value = profileData; value.shortName = Regex.Replace(name, _RX, "$1"); } value.watch.Reset(); value.watch.Start(); value.startBytes = GC.GetTotalMemory(forceFullCollection: false); } private static void ProfileMethodPostfix() { string name = new StackTrace().GetFrame(1).GetMethod().Name; if (_ProfileData.TryGetValue(name, out var value)) { value.watch.Stop(); long num = GC.GetTotalMemory(forceFullCollection: false) - value.startBytes; if (num > 8192) { Console.WriteLine($" used {num:8} bytes in {value.watch.ElapsedTicks,8} ticks during {value.shortName}"); } } } } public static class ConstructorProfiler { public class StackData { public StackTrace stackTrace; public int count; public StackData(StackTrace stackTrace) { this.stackTrace = stackTrace; count = 0; } } private static string[] AssFilter = new string[2] { "Assembly-CSharp", "UnityEngine" }; private static Dictionary CallCounter = new Dictionary(); private static bool _Adding = false; private static MethodInfo AddCallMethodInfo = typeof(ConstructorProfiler).GetMethod("AddCall", AccessTools.all); private static bool run; [Conditional("DEBUG")] public static void Enable() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown Harmony val = new Harmony("ConstructorProfiler"); string[] bannedAssemblies = new string[2] { "ConstructorProfiler", "mscorlib" }; foreach (ConstructorInfo item in (from x in (from x in AppDomain.CurrentDomain.GetAssemblies() where !bannedAssemblies.Any((string y) => x.FullName.Contains(y)) select x).ToList().SelectMany(delegate(Assembly ass) { try { return ass.GetTypes(); } catch (ReflectionTypeLoadException ex2) { return ex2.Types.Where((Type x) => (object)x != null); } }) where x.IsClass && !x.IsGenericType && !x.FullName.Contains("ConstructorProfiler") && !x.FullName.Contains("ReflectionUtil") select x).ToList().SelectMany((Type type) => type.GetConstructors()).ToList()) { try { Console.WriteLine("Patching " + GeneralExtensions.FullDescription((MethodBase)item)); val.Patch((MethodBase)item, new HarmonyMethod(AddCallMethodInfo), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } catch (Exception) { Console.WriteLine(" Exception patching " + GeneralExtensions.FullDescription((MethodBase)item)); } } } [Conditional("DEBUG")] private static void AddCall() { if (run && !_Adding) { _Adding = true; StackTrace stackTrace = new StackTrace(); string key = stackTrace.ToString(); if (CallCounter.TryGetValue(key, out var value)) { CallCounter[key].count = value.count + 1; } else { CallCounter.Add(key, new StackData(stackTrace)); } _Adding = false; } } [Conditional("DEBUG")] public static void Toggle() { if (!run) { ETGModConsole.Log((object)"Started collecting data", false); run = true; return; } ETGModConsole.Log((object)$"Outputting data ({CallCounter.Count})", false); Dictionary callCounter = CallCounter; CallCounter = new Dictionary(); var list = callCounter.Values.OrderByDescending((StackData x) => x.count).Select(delegate(StackData item) { StackFrame frame = item.stackTrace.GetFrame(1); string createdTypeStr = frame.GetMethod().DeclaringType?.FullName ?? frame.ToString(); return new { stack = string.Join("\n", item.stackTrace.ToString().Split(new char[2] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).Skip(2) .ToArray()), createdTypeStr = createdTypeStr, count = item.count.ToString() }; }).ToList(); list.Insert(0, new { stack = "Stack", createdTypeStr = "Created object", count = "Count" }); File.WriteAllLines(Path.Combine(Paths.GameRootPath, $"ConstructorProfiler{DateTime.Now:yyyy-MM-dd-HH-mm-ss}.csv"), list.Select(x => "\"" + x.stack + "\",\"" + x.createdTypeStr + "\",\"" + x.count + "\"").ToArray()); run = false; } } internal static class DebugDraw { public class DebugCircle : MonoBehaviour { public Color color; public Vector2 pos; public float radius = 1f; private const int _CIRCLE_SEGMENTS = 12; private bool _didSetup; private GameObject _meshObject; private Mesh _mesh; private MeshRenderer _meshRenderer; private Vector3[] _vertices; private void CreateMesh() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) _meshObject = new GameObject("debug_circle"); GameObjectExtensions.SetLayerRecursively(_meshObject, LayerMask.NameToLayer("FG_Critical")); _mesh = new Mesh(); _vertices = (Vector3[])(object)new Vector3[14]; int[] array = new int[36]; for (int i = 0; i < 12; i++) { array[i * 3] = 0; array[i * 3 + 1] = i + 1; array[i * 3 + 2] = i + 2; } _mesh.vertices = _vertices; _mesh.triangles = array; _mesh.uv = (Vector2[])(object)new Vector2[14]; _meshObject.AddComponent().mesh = _mesh; _meshRenderer = _meshObject.AddComponent(); Material val = (((Renderer)_meshRenderer).material = (Material)/*isinst with value type is only supported in some contexts*/); val.shader = ShaderCache.Acquire("tk2d/BlendVertexColorAlphaTintableTilted"); val.SetColor(CwaffVFX._OverrideColorId, color); } private void RebuildMeshes() { //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_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_0019: 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_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_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) Vector3 val = (_vertices[0] = Vector2.op_Implicit(pos)); for (int i = 0; i <= 12; i++) { _vertices[i + 1] = val + ((float)i * 30f).ToVector3(radius); } _mesh.vertices = _vertices; _mesh.RecalculateBounds(); _mesh.RecalculateNormals(); } public void Setup(Vector2? pos = null, float? radius = null, Color? color = null) { //IL_0024: 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_0029: 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_003b: 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_0088: Unknown result type (might be due to invalid IL or missing references) if (!_didSetup) { CreateMesh(); } this.color = (Color)(((??)color) ?? this.color); this.pos = (Vector2)(((??)pos) ?? this.pos); this.radius = radius ?? this.radius; if (color.HasValue) { ((Renderer)_meshRenderer).material.SetColor(CwaffVFX._OverrideColorId, this.color); } if (!_didSetup || pos.HasValue || radius.HasValue) { RebuildMeshes(); } _didSetup = true; } private void Update() { } private void OnDestroy() { if (Object.op_Implicit((Object)(object)_meshObject)) { Object.Destroy((Object)(object)_meshObject); } } } [Conditional("DEBUG")] internal static void DrawDebugCircle(this GameObject go, Vector2? pos = null, float? radius = null, Color? color = null) { GameObjectExtensions.GetOrAddComponent(go).Setup(pos, radius, color); } } public class Distortyboi : MonoBehaviour { private Material _mat; public void Setup(Material mat) { _mat = mat; } private void Update() { if (Object.op_Implicit((Object)(object)_mat)) { _mat.SetFloat(CwaffVFX._FadeId, Mathf.Max(0f, Mathf.Sin(0.9f * BraveTime.ScaledTimeSinceStartup))); } } } public static class EmissionTester { private static tk2dSprite _TestSprite = null; private static readonly string _DataFile = "shadertest.txt"; private static readonly string _DataFilePath = Path.Combine(Paths.BepInExRootPath, _DataFile); private static FileSystemWatcher _Watcher = null; private static Dictionary _DebugSpriteIds = new Dictionary(); public static void FileChangedCallback(object sender, FileSystemEventArgs e) { UpdateFromFile(); } public static void UpdateFromFile() { //IL_013f: 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_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) if (!File.Exists(_DataFilePath)) { using StreamWriter streamWriter = File.CreateText(_DataFilePath); streamWriter.WriteLine("sprite: "); streamWriter.WriteLine("emissivePower: "); streamWriter.WriteLine("emissiveColorPower: "); streamWriter.WriteLine("sensitivity: "); streamWriter.WriteLine("red: "); streamWriter.WriteLine("green: "); streamWriter.WriteLine("blue: "); streamWriter.WriteLine("ored: "); streamWriter.WriteLine("ogreen: "); streamWriter.WriteLine("oblue: "); streamWriter.WriteLine("oalpha: "); } if (_Watcher == null) { _Watcher = new FileSystemWatcher(Paths.BepInExRootPath); _Watcher.Filter = _DataFile; _Watcher.NotifyFilter = NotifyFilters.LastWrite; _Watcher.Changed += FileChangedCallback; _Watcher.EnableRaisingEvents = true; } if ((Object)(object)_TestSprite == (Object)null) { _TestSprite = Lazy.SpriteObject(VFX.Collection, 0); ((tk2dBaseSprite)_TestSprite).PlaceAtPositionByAnchor(Vector2.op_Implicit(((BraveBehaviour)GameManager.Instance.PrimaryPlayer).sprite.WorldTopCenter), (Anchor)1); } tk2dSpriteDefinition value = null; string text = null; float result = 0f; float result2 = 0f; float result3 = 1f; float result4 = 1f; float result5 = 1f; float result6 = 1f; float result7 = 1f; float result8 = 1f; float result9 = 0f; float result10 = 0.5f; using (StreamReader streamReader = File.OpenText(_DataFilePath)) { string text2 = ""; while ((text2 = streamReader.ReadLine()) != null) { string[] array = text2.Split(new char[1] { ':' }); if (array.Length != 2) { continue; } string text3 = array[0].Trim(); string text4 = array[1].Trim(); switch (text3) { case "sprite": if (AtlasHelper._PackedTextures.TryGetValue(text4, out value)) { text = text4; } break; case "emissivePower": if (float.TryParse(text4, out result)) { } break; case "emissiveColorPower": if (float.TryParse(text4, out result2)) { } break; case "sensitivity": if (float.TryParse(text4, out result10)) { } break; case "red": if (float.TryParse(text4, out result3)) { } break; case "green": if (float.TryParse(text4, out result4)) { } break; case "blue": if (float.TryParse(text4, out result5)) { } break; case "ored": if (float.TryParse(text4, out result6)) { } break; case "ogreen": if (float.TryParse(text4, out result7)) { } break; case "oblue": if (float.TryParse(text4, out result8)) { } break; case "oalpha": float.TryParse(text4, out result9); break; } } } if (value != null) { if (!_DebugSpriteIds.TryGetValue(text, out var value2)) { int num = (_DebugSpriteIds[text] = AtlasHelper.AddSpritesToCollection(new List(1) { text }, VFX.Collection, copyMaterialSettings: true).x); value2 = num; } ((tk2dBaseSprite)_TestSprite).SetSprite(VFX.Collection, value2); ((tk2dBaseSprite)(object)_TestSprite).MakeGlowyBetter((float?)result, glowColorPower: (float?)result2, glowColor: (Color?)new Color(result3, result4, result5), sensitivity: result10, overrideColor: (Color?)new Color(result6, result7, result8, result9), skipSetup: false); } } } public class PhotonCannon : CwaffGun { public static string ItemName = "Photon Cannon"; public static string ShortDescription = "20 Minute Battery Life"; public static string LongDescription = "Fires a beam that continuously inflicts sunburn. Sunburn deals increasing damage over time the longer an enemy is afflicted. Enemies not afflicted with sunburn within the last second recover from the status completely."; public static string Lore = "Via the controlled tunneling of massless particles through a cylindrical polymer at light speed, and the redirecting of those particles to a single point of contact through an amorphous silica-based substrate, this weapon is capable of transferring millions of femtojoules of raw energy to a designated target in seconds."; private const float _SOUND_TIMER = 0.25f; internal const float _BRIGHTNESS = 10f; internal const float _BRIGHTNESS_MASTERED = 50f; internal static GameObject _SweatVFX = null; private EasyLight _glassLight; public static void Init() { Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore).SetAttributes((ItemQuality)1, (GunClass)20, 0f, 1200, Items.Banana, defaultAudio: false, infiniteAmmo: false, 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: true, dynamicBarrelOffsets: false, banFromBlessedRuns: false, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0).InitProjectile(GunData.New(null, Items.Moonscraper.Projectile(), -1, 0.18f, damage: 3f, force: 0f, speed: -1f, angleVariance: 0f, shootStyle: (ShootStyle)2, sequenceStyle: (ProjectileSequenceStyle)0, chargeTime: 0f, ammoCost: 1, ammoType: null, customClip: false, range: null, recoil: null, poison: 0f, fire: 0f, freeze: 0f, slow: 0f, collidesWithEnemies: null, ignoreDamageCaps: null, collidesWithProjectiles: null, surviveRigidbodyCollisions: null, collidesWithTilemap: null, sprite: null, fps: 2, anchor: (Anchor)4, scale: 1f, anchorsChangeColliders: true, fixesScales: true, overrideColliderPixelSizes: null, overrideColliderOffsets: null, bossDamageMult: 1f, destroySound: null, shouldRotate: null, barrageSize: 1, shouldFlipHorizontally: null, shouldFlipVertically: null, useDummyChargeModule: false, invisibleProjectile: false, spawnSound: null, stopSoundOnDeath: null, uniqueSounds: null, shrapnelVFX: null, shrapnelCount: null, shrapnelMinVelocity: null, shrapnelMaxVelocity: null, shrapnelLifetime: null, preventOrbiting: null, hitSound: null, hitEnemySound: null, hitWallSound: null, becomeDebris: null, angleFromAim: 0f, ignoredForReloadPurposes: false, mirror: false, electric: null, burstCooldown: null, preventSparks: null, pierceBreakables: null, collidesOnlyWithPlayerProjectiles: null, pierceInternalWalls: null, doBeamSetup: null, beamSprite: "photon_beam", beamFps: 60, beamStartFps: -1, beamEndFps: -1, beamChargeFps: 8, beamMuzzleFps: -1, beamImpactFps: 30, beamLoopCharge: false, beamEmission: 50f, beamReflections: 0, beamChargeDelay: 0f)) .Attach(); _SweatVFX = VFX.Create("sweat_particle", 16f, loops: true, -1, 1f, (Anchor)1, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 1f); } public override void Update() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) base.Update(); if (((GunBehaviour)this).gun.IsFiring && ((BraveBehaviour)((GunBehaviour)this).gun).renderer.enabled) { if (!Object.op_Implicit((Object)(object)_glassLight)) { Transform barrelOffset = ((GunBehaviour)this).gun.barrelOffset; Color? val = ExtendedColours.honeyYellow; float num = (base.Mastered ? 50f : 10f); _glassLight = EasyLight.Create((Vector2?)null, barrelOffset, val, -1f, 1f, false, num, 0f, 0f, true, false, 30f, 0f, true, true); } } else if (Object.op_Implicit((Object)(object)_glassLight)) { Object.Destroy((Object)(object)((Component)_glassLight).gameObject); _glassLight = null; } if (!((GunBehaviour)this).gun.IsFiring) { ((Component)this).gameObject.Play("photon_beam_sound_stop"); } else { ((Component)this).gameObject.Play("photon_beam_sound", 0.25f); } } } public class MagnifyingRay : MonoBehaviour { private BasicBeamController _beam; private EasyLight _light; private bool _mastered; public float magStrength; private void Start() { Projectile component = ((Component)this).GetComponent(); _beam = ((Component)component).gameObject.GetComponent(); magStrength = component.baseData.damage; component.baseData.damage = 0f; ref bool mastered = ref _mastered; GameActor owner = component.Owner; mastered = ((PlayerController)(object)((owner is PlayerController) ? owner : null))?.HasSynergy(Synergy.MASTERY_PHOTON_CANNON) ?? false; component.statusEffectsToApply.Add((GameActorEffect)(object)(_mastered ? AntBurningEffect.DefaultPermanent : AntBurningEffect.Default)); } private void Update() { //IL_009a: 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_002e: 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)_beam)) { if (!Object.op_Implicit((Object)(object)_light)) { Transform transform = ((BraveBehaviour)_beam).transform; _light = EasyLight.Create((Vector2?)_beam.Endpoint(), transform, (Color?)ExtendedColours.honeyYellow, -1f, 4f, false, _mastered ? 50f : 10f, 0f, 0f, true, false, 30f, 0f, true, true); } ((Component)_light).gameObject.transform.position = Vector2.op_Implicit(_beam.Endpoint()); } } } public class AntBurningEffect : GameActorEffect { private const float _PERSIST_TIME = 1f; public static readonly AntBurningEffect Default = new AntBurningEffect { duration = 1f, effectIdentifier = "AntBurningEffect", PlaysVFXOnActor = true, OverheadVFX = PhotonCannon._SweatVFX, stackMode = (EffectStackingMode)3 }; public static readonly AntBurningEffect DefaultPermanent = new AntBurningEffect { duration = 10000000f, effectIdentifier = "AntBurningEffect", PlaysVFXOnActor = true, OverheadVFX = PhotonCannon._SweatVFX, stackMode = (EffectStackingMode)3 }; public override void OnDarkSoulsAccumulate(GameActor actor, RuntimeGameActorEffectData effectData, float partialAmount = 1f, Projectile sourceProjectile = null) { float num = 1f; if (Object.op_Implicit((Object)(object)sourceProjectile)) { MagnifyingRay component = ((Component)sourceProjectile).gameObject.GetComponent(); if (component != null) { num = component.magStrength; } } effectData.accumulator += partialAmount * num * BraveTime.DeltaTime; effectData.elapsed = 0f; } public override void EffectTick(GameActor actor, RuntimeGameActorEffectData effectData) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) AIActor val = (AIActor)(object)((actor is AIActor) ? actor : null); if (val != null) { ((BraveBehaviour)val).healthHaver.ApplyDamage(Mathf.Ceil(effectData.accumulator) * BraveTime.DeltaTime, Vector2.zero, base.effectIdentifier, (CoreDamageTypes)4, (DamageCategory)1, false, (PixelCollider)null, true); } } } public class Toothpaste : CwaffGun { private class GoopPropData { public IntVector2 pos; public int source; public int frame; public uint prop; } [HarmonyPatch] private static class ToothpasteGoopSudsDoer { [HarmonyPatch(typeof(DeadlyDeadlyGoopManager), "LateUpdate")] [HarmonyPostfix] private static void DeadlyDeadlyGoopManagerLateUpdatePatch(DeadlyDeadlyGoopManager __instance) { if ((Object)(object)__instance.goopDefinition == (Object)(object)EasyGoopDefinitions.ToothpasteGoop) { HandleToothpasteGoopSpread(__instance); } } } public static string ItemName = "Toothpaste"; public static string ShortDescription = "2 in 10 Dentists Recommend"; public static string LongDescription = "Fires globs of toothpaste that spread to consume all other adjacent goops. Reloading with a full clip swings a toothbrush that releases a damaging foam wave across nearby toothpaste goop."; public static string Lore = "The de facto gold standard of tooth cleansing technology, packaged in a convenient easy-squeeze tube. You're truthfully not sure how basic dental hygiene equipment even remotely qualifies as weaponry, but your wishful thinking convinces you that with a bit of time and imagination, its utility will become apparent."; private const float _SWING_RATE = 0.65f; private const float _MASTERED_SWING_RATE = 0.4f; private static string _BrushAnim = null; internal static GameObject _ToothpasteSudsVFX = null; private float _nextSwing; internal const float _PROP_RATE = 1f / 60f; internal const float _PROP_CHANCE = 0.1f; private const int _PROP_BITS = 30; private const uint _PROP_MAX = 3u; private const uint _PROP_MASK = 3221225472u; private const float _MIN_SUDS_LIFE = 1f; private const float _HIT_CLEAR_RATE = 0.5f; private const float _SPREAD_SOUND_RATE = 0.2f; private static float _NextHitClearTime = 0f; private static float _NextUpdateTime = 0f; private static HashSet _ConvertedGoops = new HashSet(); private static HashSet _NewGoops = new HashSet(); private static List _HitEnemies = new List(); public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 16; int? reloadFps = 16; Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)1, (GunClass)50, 0.8f, 300, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "toothpaste_squirt_sound", "toothpaste_squeeze_sound", 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, autoPlay: true, attacksThroughWalls: false, suppressReloadLabel: false, 1f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: false, preventRollingWhenCharging: false, 1f, 0.1f).AssignGun(out gunRef); int? clipSize = 5; float? cooldown = 0.23f; float? angleVariance = 30f; float? damage = 5f; float? speed = 30f; float? range = 1000f; float? force = 4f; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "toothpaste_bullet", 8, (Anchor)4)).Attach((Action)delegate(GoopModifier g) { g.goopDefinition = EasyGoopDefinitions.ToothpasteGoop; g.SpawnGoopInFlight = true; g.InFlightSpawnRadius = 0.25f; g.InFlightSpawnFrequency = 0.01f; }, allowDuplicates: false).Attach() .AttachTrail("toothpaste_trail", 24, null, -1f, 1f / 60f, 1f); _BrushAnim = gunRef.QuickUpdateGunAnimation("brush", null, returnToIdle: true, 30, "toothbrush_swing_sound"); _ToothpasteSudsVFX = VFX.Create("toothpaste_suds", 20f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } public override void OnFullClipReload(PlayerController player, Gun gun) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; if (!(scaledTimeSinceStartup < _nextSwing) && !player.IsDodgeRolling) { ((BraveBehaviour)gun).spriteAnimator.PlayIfNotPlaying(_BrushAnim); new GameObject().AddComponent().DoTheWave(player, gun); _nextSwing = scaledTimeSinceStartup + (base.Mastered ? 0.4f : 0.65f); } } public static void HandleToothpasteGoopSpread(DeadlyDeadlyGoopManager ddgm) { //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00eb: 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_01bf: 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_00f8: Unknown result type (might be due to invalid IL or missing references) float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; if (scaledTimeSinceStartup < _NextUpdateTime) { return; } _NextUpdateTime = scaledTimeSinceStartup + 1f / 60f; bool flag = false; foreach (GoopPositionData value3 in ddgm.m_goopedCells.Values) { if (value3.NeighborsAsInt == 255) { value3.elecTriggerSemaphore |= 0xC0000000u; } else if (!(value3.remainingLifespan < 1f) && !(Random.value > 0.1f)) { flag |= HandleSingleToothpasteGoopSpread(ddgm, value3); } } if (flag) { ((Component)ddgm).gameObject.Play("toothpaste_suds_spread_sound", 0.2f); } if (_ConvertedGoops.Count > 0) { foreach (IntVector2 convertedGoop in _ConvertedGoops) { ddgm.AddGoopedPosition(convertedGoop, 0f, false, -1, -1); if (ddgm.m_goopedCells.TryGetValue(convertedGoop, out var _)) { DoToothpasteSudsAt(convertedGoop.GoopToWorldPosition()); } } if (_NextHitClearTime > scaledTimeSinceStartup) { _HitEnemies.Clear(); _NextHitClearTime = scaledTimeSinceStartup + 0.5f; } if (HandleNewlyGoopedEnemies(ref _ConvertedGoops, ref _HitEnemies)) { ((Component)ddgm).gameObject.Play("the_sound_of_getting_sudsed"); } _ConvertedGoops.Clear(); } foreach (GoopPropData newGoop in _NewGoops) { ddgm.AddGoopedPosition(newGoop.pos, 0f, false, newGoop.source, newGoop.frame); if (ddgm.m_goopedCells.TryGetValue(newGoop.pos, out var value2)) { DoToothpasteSudsAt(newGoop.pos.GoopToWorldPosition()); GoopPositionData obj = value2; obj.elecTriggerSemaphore |= newGoop.prop + 1 << 30; } } _NewGoops.Clear(); } internal static bool HandleNewlyGoopedEnemies(ref HashSet processedThisFrame, ref List hitEnemies) { //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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00cb: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)SudsWave._ToothpasteGooper)) { SudsWave._ToothpasteGooper = DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(EasyGoopDefinitions.ToothpasteGoop); } List allEnemies = StaticReferenceManager.AllEnemies; bool result = false; for (int i = 0; i < allEnemies.Count; i++) { AIActor val = allEnemies[i]; if (!val.IsNormalEnemy || !((BraveBehaviour)val).renderer.isVisible || ((GameActor)val).IsGone) { continue; } HealthHaver healthHaver = ((BraveBehaviour)val).healthHaver; if (healthHaver == null || !healthHaver.IsAlive || !healthHaver.IsVulnerable || hitEnemies.Contains(healthHaver)) { continue; } tk2dBaseSprite sprite = ((BraveBehaviour)val).sprite; if (sprite != null) { IntVector2 item = sprite.WorldCenter.WorldToGoopPosition(); if (processedThisFrame.Contains(item) && SudsWave._ToothpasteGooper.m_goopedPositions.Contains(item)) { result = true; hitEnemies.Add(healthHaver); healthHaver.ApplyDamage(20f, Vector2.zero, "Minty Fresh Toothpaste Suds", (CoreDamageTypes)32, (DamageCategory)3, false, (PixelCollider)null, false); } } } return result; } internal static void DoToothpasteSudsAt(Vector2 position) { //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) GameObject toothpasteSudsVFX = _ToothpasteSudsVFX; Vector3 position2 = Vector2.op_Implicit(position); Quaternion? rotation = Lazy.RandomEulerZ(); float? fadeOutTime = 0.24f; CwaffVFX.Spawn(toothpasteSudsVFX, position2, rotation, null, 0.24f, fadeOutTime); } private static bool HandleSingleToothpasteGoopSpread(DeadlyDeadlyGoopManager ddgm, GoopPositionData goop) { //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_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) //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_003f: 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_0068: 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) bool result = false; IntVector2 goopPosition = goop.goopPosition; uint num = (goop.elecTriggerSemaphore & 0xC0000000u) >> 30; for (int i = 0; i < IntVector2.CardinalsAndOrdinals.Length; i++) { if (goop.neighborGoopData[i] != null) { continue; } IntVector2 val = IntVector2.CardinalsAndOrdinals[i] + goopPosition; if (DeadlyDeadlyGoopManager.allGoopPositionMap.TryGetValue(val, out var _)) { _ConvertedGoops.Add(val); } else { if (num == 3) { continue; } _NewGoops.Add(new GoopPropData { pos = val, source = goop.lastSourceID, frame = goop.frameGooped, prop = num }); } result = true; } return result; } } public class SudsWave : MonoBehaviour { internal static DeadlyDeadlyGoopManager _ToothpasteGooper; public void DoTheWave(PlayerController player, Gun gun) { if (!Object.op_Implicit((Object)(object)_ToothpasteGooper)) { _ToothpasteGooper = DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(EasyGoopDefinitions.ToothpasteGoop); } ((MonoBehaviour)this).StartCoroutine(DoTheWave_CR(player, gun)); } private IEnumerator DoTheWave_CR(PlayerController player, Gun gun) { IntVector2 item = Vector2.op_Implicit(gun.barrelOffset.position).WorldToGoopPosition(); Queue frontier = new Queue(); HashSet processed = new HashSet(); HashSet processedThisFrame = new HashSet(); List hitEnemies = new List(); frontier.Enqueue(item); processed.Add(item); while (frontier.Count > 0) { for (int i = 0; i < 4; i++) { bool flag = i == 3; int count = frontier.Count; for (int j = 0; j < count; j++) { IntVector2 val = frontier.Dequeue(); if (!_ToothpasteGooper.m_goopedCells.TryGetValue(val, out var value)) { continue; } if (Random.value > 0.1f) { frontier.Enqueue(val); continue; } if (flag) { Toothpaste.DoToothpasteSudsAt(val.GoopToWorldPosition()); } for (int k = 0; k < 8; k++) { GoopPositionData val2 = value.neighborGoopData[k]; if (val2 != null && !processed.Contains(val2.goopPosition)) { val2.remainingLifespan = EasyGoopDefinitions.ToothpasteGoop.lifespan; frontier.Enqueue(val2.goopPosition); processed.Add(val2.goopPosition); processedThisFrame.Add(val2.goopPosition); } } } } if (Toothpaste.HandleNewlyGoopedEnemies(ref processedThisFrame, ref hitEnemies)) { ((Component)this).gameObject.Play("the_sound_of_getting_sudsed"); } processedThisFrame.Clear(); yield return (object)new WaitForSeconds(1f / 60f); } Object.Destroy((Object)(object)((Component)this).gameObject); } } public class ToothpasteProjectile : MonoBehaviour { private enum State { START, DECEL, HALT } private const float _DECEL_START = 0.05f; private const float _HALT_START = 0.25f; private const float _RELAUNCH_START = 0.5f; private const float _LERP_RATE = 13f; private const float _SUDS_RATE = 0.04f; private const float _GOOP_SCALE = 1.25f; private const float _MAX_GROWTH = 3f; private Projectile _projectile; private float _lifetime; private float _sudsTime; private State _state; private float _startSpeed; private float _nextSuds; private float _nextGoop = 0.5f; private bool _mastered; private void Start() { _projectile = ((Component)this).GetComponent(); GameActor owner = _projectile.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null) { _mastered = val.HasSynergy(Synergy.MASTERY_TOOTHPASTE); } Projectile projectile = _projectile; projectile.OnHitEnemy = (Action)Delegate.Combine(projectile.OnHitEnemy, new Action(OnHitEnemy)); _startSpeed = _projectile.baseData.speed; _projectile.m_usesNormalMoveRegardless = true; } private void MintyFreshExplosion() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) float num = 1.25f * _sudsTime * (_mastered ? 2f : 1f); if (!(num < _nextGoop)) { DeadlyDeadlyGoopManager goopManagerForGoopType = DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(EasyGoopDefinitions.ToothpasteGoop); if (goopManagerForGoopType != null) { goopManagerForGoopType.AddGoopCircle(_projectile.SafeCenter, num, -1, false, -1); } _nextGoop += 0.5f; } } private void OnHitEnemy(Projectile arg1, SpeculativeRigidbody arg2, bool arg3) { MintyFreshExplosion(); } private void Update() { _ = BraveTime.ScaledTimeSinceStartup; float deltaTime = BraveTime.DeltaTime; _lifetime += deltaTime; switch (_state) { case State.START: if (_lifetime >= 0.05f) { _state = State.DECEL; } break; case State.DECEL: if (_lifetime >= 0.25f) { _projectile.baseData.speed = 0.01f; _nextSuds = BraveTime.ScaledTimeSinceStartup + 0.04f; _state = State.HALT; } else { _projectile.baseData.speed = Lazy.SmoothestLerp(_projectile.baseData.speed, 0f, 13f); } _projectile.UpdateSpeed(); break; case State.HALT: _sudsTime += deltaTime; MintyFreshExplosion(); if (_sudsTime >= 3f) { _projectile.DieInAir(false, true, true, false); } break; } } } public class Lightwing : CwaffGun { public static string ItemName = "Lightwing"; public static string ShortDescription = "Falcon Captain"; public static string LongDescription = "Fires birds that return to the user after hitting an enemy. Shooting a projectile will destroy it and cause the bird to home in on its owner with increased speed and damage. When returning, birds will attempt to retrieve an additional projectile belonging to the enemy they hit, restoring additional ammo if successful."; public static string Lore = "Falconry is an art that is on the verge of being lost to time, with this weapon being one gunsmith's attempt to revive the art with a modern coat of paint. Boasting state-of-the-art military artificial intelligence in every projectile, the Lightwing allows its user to experience everything traditional falconry has to offer, except perhaps the bond between falcon and falconer. An improved model with projectiles that exhibit more realistic perching and pooping behaviors is currently under development."; internal static tk2dSpriteAnimationClip _NeutralSprite = null; internal static tk2dSpriteAnimationClip _HuntingSprite = null; internal static tk2dSpriteAnimationClip _RetrievingSprite = null; internal static tk2dSpriteAnimationClip _ReturningSprite = null; public static void Init() { //IL_014a: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 32; int? reloadFps = 30; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)15, 1f, 120, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "lightwing_fire_sound", "lightwing_reload_sound", null, -1, -1, -1, null, modulesAreTiers: false, "muzzle_lightwing", 30, 0.5f, (Anchor)4, -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); int? clipSize = 20; float? cooldown = 0.28f; float? damage = 4f; float? speed = 20f; bool? collidesWithProjectiles = true; float? lightStrength = 5f; float? lightRange = 2f; Color? lightColor = Color.white; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, null, null, 0f, 0f, 0f, 0f, null, null, collidesWithProjectiles, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 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, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: false, 0f, null, 30f, null, null, -1, null, lightStrength, lightRange, lightColor)).AddAnimations(AnimatedBullet.Create(ref _NeutralSprite, "lightwing_projectile", 12, (Anchor)3), AnimatedBullet.Create(ref _HuntingSprite, "lightwing_projectile_hunt", 12, (Anchor)3), AnimatedBullet.Create(ref _RetrievingSprite, "lightwing_projectile_retrieve", 12, (Anchor)3), AnimatedBullet.Create(ref _ReturningSprite, "lightwing_projectile_return", 12, (Anchor)3)).Attach(); } } public class LightwingProjectile : MonoBehaviour { private enum State { NEUTRAL, HUNTING, RETRIEVING, RETURNING } internal const float _START_SPEED = 10f; internal const float _MAX_TURN_RATE = 16f; internal const float _TURN_FRICTION = 0.98f; internal const float _BASE_ACCEL = 1f; internal const float _HUNT_ACCEL = 2f; internal const float _HUNT_SPEED_SCALE = 2f; internal const float _HUNT_DAMAGE_SCALE = 2f; private Projectile _projectile; private PlayerController _owner; private Gun _gun; private GameActor _target; private Projectile _targetProjectile; private EasyTrailBullet _trail; private float _topSpeed; private int _retrievedAmmo; private float _speedMult = 1f; private bool _mastered; private State _state_internal; private State _state { get { return _state_internal; } set { //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_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_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_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_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_00b9: 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_00c5: 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_00d1: 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_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) _state_internal = value; if (Object.op_Implicit((Object)(object)_projectile)) { Color val = Color.white; switch (value) { case State.NEUTRAL: ((BraveBehaviour)_projectile).spriteAnimator.Play(Lightwing._NeutralSprite); val = Color.white; break; case State.HUNTING: ((BraveBehaviour)_projectile).spriteAnimator.Play(Lightwing._HuntingSprite); val = Color.red; break; case State.RETRIEVING: ((BraveBehaviour)_projectile).spriteAnimator.Play(Lightwing._RetrievingSprite); val = ExtendedColours.purple; break; case State.RETURNING: ((BraveBehaviour)_projectile).spriteAnimator.Play(Lightwing._ReturningSprite); val = Color.blue; break; } if (Object.op_Implicit((Object)(object)_trail)) { _trail.BaseColor = val; _trail.StartColor = val; _trail.EndColor = Color.Lerp(val, Color.white, 0.75f); _trail.UpdateTrail(); } } } } private void Start() { //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: 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_01d0: 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_0155: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015f: 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)) { if (!_projectile.FiredForFree() && ((Component)((GameActor)_owner).CurrentGun).GetComponent() != null) { _gun = ((GameActor)_owner).CurrentGun; } _mastered = _owner.HasSynergy(Synergy.MASTERY_LIGHTWING); _topSpeed = _projectile.baseData.speed; _speedMult = _owner.ProjSpeedMult(); _projectile.baseData.speed = 10f * _speedMult; _projectile.BulletScriptSettings.surviveRigidbodyCollisions = true; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody.OnCollision = (Action)Delegate.Combine(specRigidbody.OnCollision, new Action(OnCollision)); SpeculativeRigidbody specRigidbody2 = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody2.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody2.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreCollision)); _projectile.m_usesNormalMoveRegardless = true; if (_mastered) { SpeculativeRigidbody specRigidbody3 = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody3.OnPreTileCollision = (OnPreTileCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody3.OnPreTileCollision, (Delegate?)new OnPreTileCollisionDelegate(OnPreTileCollision)); } _trail = ((Component)_projectile).gameObject.AddComponent(); _trail.StartWidth = 0.35f; _trail.EndWidth = 0.05f; _trail.LifeTime = 0.1f; _trail.StartColor = Color.white; _trail.BaseColor = Color.white; _trail.EndColor = Color.white; } } private void OnPreTileCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, Tile tile, PixelCollider tilePixelCollider) { if (_state == State.RETURNING) { PhysicsEngine.SkipCollision = true; } } private void DetermineTargetProjectile() { //IL_0081: 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) tk2dBaseSprite val = (Object.op_Implicit((Object)(object)_targetProjectile) ? ((BraveBehaviour)_targetProjectile).sprite : null); if (Object.op_Implicit((Object)(object)val) && ((BraveBehaviour)val).renderer.enabled && ((Behaviour)_targetProjectile).isActiveAndEnabled) { return; } _targetProjectile = null; float num = 9999f; foreach (Projectile allProjectile in StaticReferenceManager.AllProjectiles) { if (((Behaviour)allProjectile).isActiveAndEnabled && !((Object)(object)allProjectile.Owner != (Object)(object)_target)) { Vector3 val2 = ((BraveBehaviour)allProjectile).transform.position - ((BraveBehaviour)_projectile).transform.position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (!(sqrMagnitude > num)) { num = sqrMagnitude; _targetProjectile = allProjectile; } } } if ((Object)(object)_targetProjectile == (Object)null) { _target = (GameActor)(object)_owner; _state = State.RETURNING; } } private void Update() { //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_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_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_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_00cb: 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_00dc: 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_0070: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) Vector2 val = Vector2.zero; bool flag = true; switch (_state) { case State.NEUTRAL: flag = false; break; case State.HUNTING: if (Object.op_Implicit((Object)(object)_target)) { val = _target.CenterPosition; } else if (Object.op_Implicit((Object)(object)_owner)) { _target = (GameActor)(object)_owner; val = _target.CenterPosition; _state = State.RETURNING; } else { flag = false; } break; case State.RETURNING: if (Object.op_Implicit((Object)(object)_target)) { val = _target.CenterPosition; } else { flag = false; } break; case State.RETRIEVING: DetermineTargetProjectile(); if (_state != State.RETRIEVING) { return; } val = _targetProjectile.SafeCenter; break; } float num = 60f * BraveTime.DeltaTime; if (flag) { Vector2 val2 = val - _projectile.SafeCenter; if (_state == State.RETURNING && ((Vector2)(ref val2)).sqrMagnitude < 1f) { DissipateNearPlayer(); return; } Vector2 currentDirection = _projectile.m_currentDirection; float num2 = 16f * num * _speedMult; float num3 = Vector2Extensions.ToAngle(currentDirection); float num4 = num3.RelAngleTo(Vector2Extensions.ToAngle(val2)); if (Mathf.Abs(num4) < num2) { _projectile.SendInDirection(val2, true, true); } else { _projectile.ApplyFriction(0.98f); _projectile.SendInDirection((num3 + num2 * Mathf.Sign(num4)).ToVector(), true, true); } } _projectile.Accelerate(60f * ((_state == State.NEUTRAL) ? 1f : 2f)); } private void OnCollision(CollisionData collision) { if (!Object.op_Implicit((Object)(object)collision.OtherRigidbody)) { return; } GameObject gameObject = ((Component)collision.OtherRigidbody).gameObject; if (gameObject == null) { return; } Projectile component = gameObject.GetComponent(); if (component != null) { OnProjectileCollision(component); return; } AIActor component2 = gameObject.GetComponent(); if (component2 != null) { OnEnemyCollision(component2); } } private void OnPreCollision(SpeculativeRigidbody me, PixelCollider myPixelCollider, SpeculativeRigidbody other, PixelCollider otherPixelCollider) { Projectile component = ((Component)other).GetComponent(); if (component == null) { return; } switch (_state) { case State.NEUTRAL: if (!(component.Owner is AIActor)) { PhysicsEngine.SkipCollision = true; } break; case State.RETRIEVING: PhysicsEngine.SkipCollision = (Object)(object)component.Owner != (Object)(object)_target; break; case State.HUNTING: case State.RETURNING: PhysicsEngine.SkipCollision = true; break; } } private void OnProjectileCollision(Projectile projectile) { if (_state != State.NEUTRAL && _state != State.RETRIEVING) { return; } GameActor owner = projectile.Owner; AIActor val = (AIActor)(object)((owner is AIActor) ? owner : null); if (val == null || (_state == State.RETRIEVING && (Object)(object)_target != (Object)(object)val)) { return; } projectile.DieInAir(false, false, false, true); _topSpeed *= 2f; ProjectileData baseData = _projectile.baseData; baseData.damage *= 2f; if (_state == State.NEUTRAL) { ((Component)this).gameObject.Play("lightwing_hunt_sound"); _target = (GameActor)(object)val; _state = State.HUNTING; _projectile.collidesWithProjectiles = false; return; } _retrievedAmmo++; if (!_mastered || _retrievedAmmo >= 3) { _target = (GameActor)(object)_owner; _projectile.collidesWithProjectiles = false; _state = State.RETURNING; } else { _targetProjectile = null; DetermineTargetProjectile(); } } private void OnEnemyCollision(AIActor enemy) { State state = _state; if ((uint)state > 1u) { _ = state - 2; _ = 1; return; } ((Component)this).gameObject.Play("lightwing_impact_sound"); _target = (GameActor)(object)enemy; _projectile.collidesWithEnemies = false; _state = State.RETRIEVING; } private void DissipateNearPlayer() { if (Object.op_Implicit((Object)(object)_gun)) { _gun.GainAmmo(_retrievedAmmo + 1); } _projectile.DieInAir(false, true, true, false); Object.Destroy((Object)(object)this); } } public class FluxFist : CwaffGun { public static string ItemName = "Flux Fist"; public static string ShortDescription = "Pole to Pole"; public static string LongDescription = "Alternates between firing north and south polarity beams that magnetize enemies. Reload to toss or dismiss a north-polarized ball that damages and repels / attracts nearby magnetized enemies."; public static string Lore = "A repurposed greave retrofitted with a proprietary piezomagnetic mechanism, capable of generating strong magnetic fields with a clench of the fist. It was originally conceived as a consumer product for retrieving one's dropped keys from underneath the fridge. Sadly, it was recalled hours after hitting store shelves due to a common issue with entire fridges crashing into users."; private const float _BALL_LAUNCH_SPEED = 20f; private const float _SOUND_TIMER = 0.25f; private static readonly string[] _ExtraAnims = new string[4] { "north_fire", "south_fire", "north_idle", "south_idle" }; internal static GameObject _MagnetBallPrefab = null; internal static GameObject _RepelParticle = null; internal static GameObject _AttractParticle = null; private MagnetBall _magnetBall; private bool _attract; private bool _toggleWhenDoneFiring; private PlayerController _lastOwner; private static Projectile NorthBeam = null; private static Projectile SouthBeam = null; public static void Init() { //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0175: 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_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Expected O, but got Unknown Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 14; int? num = 4; int? reloadFps = num; Color? val = null; gun.SetAttributes((ItemQuality)1, (GunClass)20, 0f, 600, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, null, null, null, -1, -1, -1, null, modulesAreTiers: true, null, 60, 1f, (Anchor)3, -1f, null, -1f, muzzleLit: false, 0f, 0f, val, null, preventRotation: false, 0f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: false, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)3).AssignGun(out Gun gunRef); for (int i = 0; i < 2; i++) { string text = ((i == 0) ? "flux_fist_beam_north" : "flux_fist_beam_south"); Gun gun2 = gunRef; Projectile baseProjectile = Items.Moonscraper.Projectile(); int? clipSize = -1; float? cooldown = 0.25f; float? damage = 4f; float? force = 0f; float? speed = -1f; float? angleVariance = 0f; string beamSprite = text; val = Color.Lerp(Color.black, (i == 0) ? Color.red : Color.blue, 0.5f); GunData b = GunData.New(gun2, baseProjectile, clipSize, cooldown, angleVariance, (ShootStyle)2, (ProjectileSequenceStyle)0, 0f, 4, null, customClip: false, damage, speed, force, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 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, null, null, null, null, beamSprite, 36, -1, -1, 8, -1, 30, beamLoopCharge: false, 250f, 0, 0f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: false, 0f, null, 0f, null, null, -1, null, null, null, null, null, null, val, 1.5f, 50f); if (i == 0) { NorthBeam = gunRef.InitProjectile(b); ((Component)NorthBeam).gameObject.AddComponent().attract = false; gunRef.DefaultModule.SetupCustomAmmoClip("flux_fist_north"); } else { ProjectileModule val2 = GunBuilder.InitSingleProjectileModule(new ProjectileModule(), b); gunRef.Volley.projectiles.Add(val2); SouthBeam = val2.projectiles[0]; ((Component)SouthBeam).gameObject.AddComponent().attract = true; val2.SetupCustomAmmoClip("flux_fist_south"); } } string[] extraAnims = _ExtraAnims; foreach (string name in extraAnims) { gunRef.QuickUpdateGunAnimation(name); } _MagnetBallPrefab = VFX.Create("magnet_ball", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _MagnetBallPrefab.AutoRigidBody((CollisionLayer)6, canBePushed: true); _MagnetBallPrefab.AddComponent().weight = 10f; _RepelParticle = VFX.Create("flux_fist_repel_vfx", 10f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _AttractParticle = VFX.Create("flux_fist_attract_vfx", 10f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } private void CheckFlight(bool newEnabled) { if (Object.op_Implicit((Object)(object)_lastOwner) && newEnabled != ((GameActor)_lastOwner).m_isFlying.HasOverride(ItemName)) { ((GameActor)_lastOwner).SetIsFlying(newEnabled, ItemName, true, false); if (newEnabled) { _lastOwner.AdditionalCanDodgeRollWhileFlying.AddOverride(ItemName, (float?)null); } else { _lastOwner.AdditionalCanDodgeRollWhileFlying.RemoveOverride(ItemName); } } } public override void OnMasteryStatusChanged() { base.OnMasteryStatusChanged(); CheckFlight(newEnabled: true); } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); _lastOwner = ((GunBehaviour)this).PlayerOwner; CheckFlight(base.Mastered); } public override void OnDroppedByPlayer(PlayerController player) { CheckFlight(newEnabled: false); base.OnDroppedByPlayer(player); } public override void OnDestroy() { if ((Object)(object)_lastOwner == (Object)(object)((GunBehaviour)this).PlayerOwner) { CheckFlight(newEnabled: false); } base.OnDestroy(); } public override void OverrideShootAnimation(ref string overrideAnimation) { overrideAnimation = (_attract ? "flux_fist_south_fire" : "flux_fist_north_fire"); } public override void PostProcessBeam(BeamController beam) { ((GunBehaviour)this).PostProcessBeam(beam); _toggleWhenDoneFiring = true; Projectile projectile = ((BraveBehaviour)beam).projectile; projectile.OnHitEnemy = (Action)Delegate.Combine(projectile.OnHitEnemy, new Action(PolarizeEnemy)); } private void PolarizeEnemy(Projectile projectile, SpeculativeRigidbody rigidbody, bool arg3) { MagnetBeamBehavior component = ((Component)projectile).gameObject.GetComponent(); if (component != null) { float num = (base.Mastered ? 3f : 1f); GameObjectExtensions.GetOrAddComponent(((Component)rigidbody).gameObject).Polarize(BraveTime.DeltaTime * 0.5f * (component.attract ? (0f - num) : num)); } } private void TogglePolarity() { _attract = !_attract; ((GunBehaviour)this).gun.CurrentStrengthTier = (_attract ? 1 : 0); ((GunBehaviour)this).gun.idleAnimation = (_attract ? "flux_fist_south_idle" : "flux_fist_north_idle"); ((GunBehaviour)this).gun.PlayIfExists(((GunBehaviour)this).gun.idleAnimation, true); } private void LateUpdate() { if (((GunBehaviour)this).gun.IsFiring) { ((Component)this).gameObject.Play(_attract ? "flux_fist_attract_sound" : "flux_fist_repel_sound", 0.25f); } else if (_toggleWhenDoneFiring) { _toggleWhenDoneFiring = false; TogglePolarity(); } } public override void OnReloadPressed(PlayerController player, Gun gun, bool manualReload) { //IL_0040: 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) base.OnReloadPressed(player, gun, manualReload); if (Object.op_Implicit((Object)(object)_magnetBall)) { _magnetBall.Selfdestruct(); _magnetBall = null; return; } RoomHandler currentRoom = player.CurrentRoom; if (currentRoom != null) { _magnetBall = _MagnetBallPrefab.Instantiate(gun.barrelOffset.position).AddComponent(); _magnetBall.Setup(currentRoom, player, gun.CurrentAngle.ToVector(20f)); ((Component)_magnetBall).gameObject.GetComponent().CorrectForWalls(andRigidBodies: true); } } } public class MagnetBeamBehavior : MonoBehaviour { public bool attract; } public class MagnetizedEnemyBehavior : MonoBehaviour { private const float _PARTICLE_TIME = 0.5f; private static readonly Color _RepelColor = new Color(0.9490196f, 27f / 85f, 27f / 85f); private static readonly Color _AttractColor = new Color(27f / 85f, 0.69803923f, 0.9490196f); public float polarity; private bool _setup; private AIActor _enemy; private KnockbackDoer _kbd; private HealthHaver _hh; private float _lastParticles; private const float _MIN_INFLUENCE_TIME = 0.1f; private const float _INFLUENCE_TIME_FACTOR = 0.01f; private const float _MAX_INFLUENCE_TIME = 1f; private float _lastInfluenceTime; private void Start() { _setup = true; _enemy = ((Component)this).gameObject.GetComponent(); _kbd = ((Component)this).gameObject.GetComponent(); _hh = ((Component)this).gameObject.GetComponent(); } public void Polarize(float amt) { polarity = Mathf.Clamp(polarity + amt, -1f, 1f); } private void Update() { //IL_00a5: 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_00e7: Unknown result type (might be due to invalid IL or missing references) if (!_setup || !Object.op_Implicit((Object)(object)_enemy) || ((GameActor)_enemy).IsGone || !Object.op_Implicit((Object)(object)_hh) || _hh.IsDead || !_hh.IsVulnerable) { return; } int num = Mathf.CeilToInt(Mathf.Abs(polarity) * 10f); if (num != 0) { float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; if (!(_lastParticles + 0.5f / (float)num > scaledTimeSinceStartup)) { _lastParticles = scaledTimeSinceStartup; GameObject prefab = ((polarity > 0f) ? FluxFist._RepelParticle : FluxFist._AttractParticle); Vector2 centerPosition = ((GameActor)_enemy).CenterPosition; float velocityVariance = 0.5f + 0.5f * (float)num; float emissivePower = ((polarity > 0f) ? 50f : 100f); Color? emissiveColor = ((polarity > 0f) ? _RepelColor : _AttractColor); CwaffVFX.SpawnBurst(height: 8f, anchorTransform: ((BraveBehaviour)((BraveBehaviour)_enemy).sprite).transform, prefab: prefab, numToSpawn: 2, basePosition: centerPosition, positionVariance: 0.5f, baseVelocity: null, minVelocity: 0f, velocityVariance: velocityVariance, velType: CwaffVFX.Vel.AwayRadial, rotType: CwaffVFX.Rot.Random, lifetime: 0.5f, fadeOutTime: null, emissivePower: emissivePower, emissiveColor: emissiveColor); } } } public void HandleInfluenceParticles(Vector2 sourcePos, float influence) { //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_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_007b: 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_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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) if (influence <= 0f || polarity == 0f || !Object.op_Implicit((Object)(object)_enemy)) { return; } float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; float num = _lastInfluenceTime + Mathf.Clamp(0.01f / influence, 0.1f, 1f); if (!(scaledTimeSinceStartup < num)) { _lastInfluenceTime = scaledTimeSinceStartup; bool flag = polarity > 0f; Vector2 centerPosition = ((GameActor)_enemy).CenterPosition; Vector2 val = (flag ? (centerPosition - sourcePos) : (sourcePos - centerPosition)); if (!(((Vector2)(ref val)).sqrMagnitude < 1f)) { GameObject prefab = (flag ? FluxFist._RepelParticle : FluxFist._AttractParticle); Vector3 position = Vector2.op_Implicit(flag ? sourcePos : centerPosition); Quaternion? rotation = Quaternion.identity; Vector2? velocity = 2f * val; float? startScale = 3f; float? endScale = 0.5f; CwaffVFX.Spawn(prefab, position, rotation, velocity, 0.5f, null, 50f, null, fadeIn: false, startScale, endScale); } } } } public class MagnetBall : MonoBehaviour { private const float _FRICTION = 0.9f; private const float _SOUND_RATE = 0.3f; private bool _setup; private RoomHandler _room; private PlayerController _owner; private tk2dBaseSprite _sprite; private SpeculativeRigidbody _body; private KnockbackDoer _kbd; private Dictionary _KnockbackDict = new Dictionary(); public void Setup(RoomHandler room, PlayerController owner, Vector2 velocity) { //IL_003d: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown _setup = true; _owner = owner; _room = room; ((Component)this).gameObject.GetComponent().usesOverrideMaterial = true; _body = ((Component)this).gameObject.GetComponent(); _body.Velocity = velocity; _body.RegisterTemporaryCollisionException(((BraveBehaviour)owner).specRigidbody, 0.01f, (float?)null); PlayerController otherPlayer = GameManager.Instance.GetOtherPlayer(owner); if (otherPlayer != null) { _body.RegisterTemporaryCollisionException(((BraveBehaviour)otherPlayer).specRigidbody, 0.01f, (float?)null); } _kbd = ((Component)this).gameObject.GetComponent(); SpeculativeRigidbody body = _body; body.OnBeamCollision = (OnBeamCollisionDelegate)Delegate.Combine((Delegate?)(object)body.OnBeamCollision, (Delegate?)new OnBeamCollisionDelegate(OnBeamCollision)); _sprite = (tk2dBaseSprite)(object)_body.DecoupleSpriteFromCollider(); ((Component)this).gameObject.Play("magnet_ball_attract_sound"); } private void OnBeamCollision(BeamController beam) { //IL_0030: 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_0053: 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_0060: 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_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) if (!_kbd.m_isImmobile.Value && Object.op_Implicit((Object)(object)beam)) { MagnetBeamBehavior component = ((Component)beam).gameObject.GetComponent(); if (component != null) { Vector2 val = BraveTime.DeltaTime * Vector2Extensions.ToAngle(beam.Direction).ToVector(component.attract ? (-75f) : 75f); SpeculativeRigidbody body = _body; body.Velocity += val; } } } public void Selfdestruct() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) Lazy.DoSmokeAt(((Component)this).transform.position); Object.Destroy((Object)(object)((Component)this).gameObject); } private void Update() { //IL_004f: 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_0104: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0194: 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_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0218: 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) if (!_setup) { return; } if (!Object.op_Implicit((Object)(object)_owner) || _owner.IsGhost || _owner.CurrentRoom != _room) { Selfdestruct(); return; } float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; _sprite.PlaceAtPositionByAnchor(((Component)this).transform.position.HoverAt(0.25f, 10f), (Anchor)4); _sprite.UpdateZDepth(); _sprite.SetGlowiness(30f + 50f * Mathf.Abs(Mathf.Sin(8f * scaledTimeSinceStartup))); float deltaTime = BraveTime.DeltaTime; if (((Vector2)(ref _body.Velocity)).sqrMagnitude < 1E-05f) { _body.Velocity = Vector2.zero; } else { SpeculativeRigidbody body = _body; body.Velocity *= Mathf.Pow(0.9f, 60f * deltaTime); } bool flag = false; Vector2 unitCenter = _body.UnitCenter; foreach (AIActor allNearbyEnemy in unitCenter.GetAllNearbyEnemies(30f)) { MagnetizedEnemyBehavior component = ((Component)allNearbyEnemy).gameObject.GetComponent(); if (component != null && component.polarity != 0f) { float num = Mathf.Abs(component.polarity) * 30f; float num2 = num * num; Vector2 val = unitCenter - ((GameActor)allNearbyEnemy).CenterPosition; float sqrMagnitude = ((Vector2)(ref val)).sqrMagnitude; if (!(sqrMagnitude >= num2)) { float num3 = 1f - sqrMagnitude / num2; float num4 = ((component.polarity > 0f) ? (-50f) : 50f) * num3; float num5 = 10f * num3 * deltaTime; allNearbyEnemy.ApplyContinuousSourcedKnockback(((Component)this).gameObject, _KnockbackDict, num4 * ((Vector2)(ref val)).normalized); ((BraveBehaviour)allNearbyEnemy).healthHaver.ApplyDamage(num5, Vector2.zero, "Flux Field", (CoreDamageTypes)0, (DamageCategory)3, false, (PixelCollider)null, false); component.HandleInfluenceParticles(unitCenter, 1f - Mathf.Sqrt(1f - num3)); flag = true; } } } if (flag) { ((Component)this).gameObject.Play("magnet_ball_attract_sound", 0.3f); } } } public class Forkbomb : CwaffGun { public static string ItemName = "Forkbomb"; public static string ShortDescription = "Recursion Excursion"; public static string LongDescription = "Throws a large dinner fork that bursts into two more copies of itself shortly after impact. Can be charged up to 6 times, with each charge level doubling the maximum number of forks spawned."; public static string Lore = "For more information on Forkbomb, please see the Ammonomicon entries for Forkbomb and Forkbomb."; private const float _EXPLODE_DAMAGE = 50f; internal static Projectile _ForkbombProj = null; internal static ExplosionData _Explosion = null; public static void Init() { //IL_0149: 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_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_0463: 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_046b: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Expected O, but got Unknown Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 60; int? reloadFps = 4; int? chargeFps = 30; Items? muzzleFrom = Items.Mailbox; Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)4, (GunClass)50, 1f, 300, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, chargeFps, null, "knife_gun_launch", null, null, 4, -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).AssignGun(out gunRef); int? clipSize = 1; float? cooldown = 0.18f; float? damage = 15f; float? speed = 75f; float? range = 100f; float? force = 12f; IntVector2? overrideColliderPixelSizes = new IntVector2(1, 1); IntVector2? overrideColliderOffsets = new IntVector2(16, 3); bool? pierceBreakables = true; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)3, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "forkbomb_projectile", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, overrideColliderPixelSizes, overrideColliderOffsets, 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(delegate(ForkbombProjectile f) { f.forks = 1; }).Assign(out _ForkbombProj) .SetupChargeProjectiles(gunRef.DefaultModule, 6, delegate(int i, Projectile p) { //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_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Expected O, but got Unknown ChargeProjectile val = new ChargeProjectile(); string chargeSound = $"forkbomb_charge_sound_{i + 1}"; val.Projectile = p.Clone(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 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, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: false, 0f, null, 0f, null, null, -1, null, null, null, null, chargeSound)).Attach(delegate(ForkbombProjectile f) { f.forks = i + 2; }); val.ChargeTime = 0.8f * (float)(i + 1); val.AmmoCost = i + 1; val.UsedProperties = (ChargeProjectileProperties)1; return val; }); _Explosion = Explosions.ExplosiveRounds.With(100f, 10f, 50f, 1.5f); _Explosion.ss = new ScreenShakeSettings { magnitude = 0.05f, speed = 12f, time = 0.05f, falloff = 0f, direction = Vector2.zero, vibrationType = (VibrationType)10, simpleVibrationTime = (Time)10, simpleVibrationStrength = (Strength)5 }; } public override void Update() { base.Update(); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { if (((GunBehaviour)this).gun.IsReloading || ((GunBehaviour)this).gun.ClipShotsRemaining == 0) { ((GunBehaviour)this).PlayerOwner.ToggleGunRenderers(false, ItemName); } else { ((GunBehaviour)this).PlayerOwner.ToggleGunRenderers(true, ItemName); } } } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); player.ToggleGunRenderers(true, ItemName); } public override void OnSwitchedAwayFromThisGun() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((GunBehaviour)this).PlayerOwner.ToggleGunRenderers(true, ItemName); } base.OnSwitchedAwayFromThisGun(); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((GunBehaviour)this).PlayerOwner.ToggleGunRenderers(true, ItemName); } base.OnDestroy(); } public override void PostProcessProjectile(Projectile projectile) { ((GunBehaviour)this).PostProcessProjectile(projectile); ((Component)projectile).gameObject.GetComponent().mastered = base.Mastered; } } public class ForkbombProjectile : MonoBehaviour { private const float _DET_TIMER = 0.42f; private const float _BASE_GLOW = 10f; private const float _DET_GLOW = 100f; private const float _FORK_SPREAD = 45f; private static int _VfxId; private static tk2dSpriteCollectionData _VfxCol; private PlayerController _owner; private Projectile _projectile; private bool _stuck; private Vector2 _stickPoint; private Vector2 _stickNormal; private AIActor _stuckEnemy; private HealthHaver _stuckHealthhaver; private float _detTimer; private int _detPhase; private Material _mat; private float _originalSpeed; private SpeculativeRigidbody _body; private Vector2 _contact; public int forks = -1; public bool mastered; private void Start() { if ((Object)(object)_VfxCol == (Object)null) { tk2dSprite component = AllayCompanion._AllaySparkles.GetComponent(); _VfxCol = ((tk2dBaseSprite)component).collection; _VfxId = ((tk2dBaseSprite)component).spriteId; } _projectile = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); _mat = ((BraveBehaviour)((BraveBehaviour)_projectile).sprite).renderer.material; _body = ((BraveBehaviour)_projectile).specRigidbody; Reinitialize(); } private void Reinitialize() { //IL_0037: 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_00c4: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown _stuck = false; _stuckHealthhaver = null; _stuckEnemy = null; _detTimer = 0f; _detPhase = 0; ((BraveBehaviour)_projectile).sprite.SetGlowiness(10f, Color.white); _projectile.BulletScriptSettings.surviveRigidbodyCollisions = true; _projectile.BulletScriptSettings.surviveTileCollisions = true; _projectile.collidesWithEnemies = true; _body.CollideWithOthers = true; _body.CollideWithTileMap = true; SpeculativeRigidbody body = _body; body.OnRigidbodyCollision = (OnRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)body.OnRigidbodyCollision, (Delegate?)new OnRigidbodyCollisionDelegate(StickToSurface)); SpeculativeRigidbody body2 = _body; body2.OnTileCollision = (OnTileCollisionDelegate)Delegate.Combine((Delegate?)(object)body2.OnTileCollision, (Delegate?)new OnTileCollisionDelegate(StickToSurface)); } private void StickToSurface(CollisionData coll) { //IL_0020: 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_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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0194: 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_01e7: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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) if (Object.op_Implicit((Object)(object)coll.OtherRigidbody) && Object.op_Implicit((Object)(object)((BraveBehaviour)coll.OtherRigidbody).minorBreakable)) { return; } PhysicsEngine.PostSliceVelocity = Vector2.zero; _contact = ((CastResult)coll).Contact; _stickNormal = ((CastResult)coll).Normal; SpeculativeRigidbody body = _body; body.OnRigidbodyCollision = (OnRigidbodyCollisionDelegate)Delegate.Remove((Delegate?)(object)body.OnRigidbodyCollision, (Delegate?)new OnRigidbodyCollisionDelegate(StickToSurface)); SpeculativeRigidbody body2 = _body; body2.OnTileCollision = (OnTileCollisionDelegate)Delegate.Remove((Delegate?)(object)body2.OnTileCollision, (Delegate?)new OnTileCollisionDelegate(StickToSurface)); _body.CollideWithOthers = false; _body.CollideWithTileMap = false; _projectile.collidesWithEnemies = false; _originalSpeed = _projectile.baseData.speed; _projectile.SetSpeed(0f); ((BraveBehaviour)_projectile).sprite.HeightOffGround = 10f; ((BraveBehaviour)_projectile).sprite.UpdateZDepth(); if (Object.op_Implicit((Object)(object)coll.OtherRigidbody)) { AIActor component = ((Component)coll.OtherRigidbody).GetComponent(); if (component != null) { _stuckEnemy = component; _stuckHealthhaver = ((BraveBehaviour)_stuckEnemy).healthHaver; _stickPoint -= Vector3Extensions.XY(((BraveBehaviour)((BraveBehaviour)component).specRigidbody).transform.position); ((BraveBehaviour)_body).transform.parent = ((BraveBehaviour)((BraveBehaviour)component).specRigidbody).transform; } } _projectile.m_usesNormalMoveRegardless = true; Projectile projectile = _projectile; projectile.damageTypes = (CoreDamageTypes)(projectile.damageTypes & -65); _detTimer = 0f; _detPhase = 0; _stuck = true; ((Component)this).gameObject.Play("fork_impact_sound"); tk2dSpriteCollectionData vfxCol = _VfxCol; int vfxId = _VfxId; Vector2 contact = ((CastResult)coll).Contact; Vector2? baseVelocity = 8f * _stickNormal; float? fadeOutTime = 0.1f; float? startScale = 0.5f; float? endScale = 0.1f; CwaffVFX.SpawnBurst(null, 5, contact, 0f, baseVelocity, 0f, 4f, CwaffVFX.Vel.Random, CwaffVFX.Rot.None, 0.5f, fadeOutTime, 0f, null, fadeIn: false, uniform: false, startScale, endScale, null, randomFrame: false, -1, flipX: false, flipY: false, null, null, 1.55f, 45f, vfxCol, vfxId); } private void Update() { //IL_0050: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) if (!_stuck) { return; } if (Object.op_Implicit((Object)(object)_stuckHealthhaver) && _stuckHealthhaver.IsDead) { Detonate(); return; } if (Object.op_Implicit((Object)(object)_stuckEnemy) && Object.op_Implicit((Object)(object)((BraveBehaviour)_stuckEnemy).specRigidbody)) { _body.Position = new Position(_stickPoint + Vector3Extensions.XY(((BraveBehaviour)((BraveBehaviour)_stuckEnemy).specRigidbody).transform.position)); _body.UpdateColliderPositions(); } if ((_detTimer += BraveTime.DeltaTime) >= 0.42f) { Detonate(); return; } int num = (int)(6f * _detTimer / 0.42f); if (num != _detPhase) { if (Object.op_Implicit((Object)(object)_mat)) { _mat.SetFloat(CwaffVFX._EmissivePowerId, (num % 2 == 0) ? 100f : 10f); } _detPhase = num; } } private void Detonate() { //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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_00ba: 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_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_0193: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) if (forks <= 0) { _projectile.DieInAir(true, true, true, false); return; } forks--; if (Object.op_Implicit((Object)(object)_stuckEnemy) || _stickNormal == default(Vector2)) { _stickNormal = Vector2.op_Implicit(-((BraveBehaviour)_projectile).transform.right); } Vector2 val = ((!Object.op_Implicit((Object)(object)_stuckEnemy)) ? _contact : (Object.op_Implicit((Object)(object)((BraveBehaviour)_projectile).sprite) ? ((BraveBehaviour)_projectile).sprite.WorldCenterRight() : Vector2.op_Implicit(((BraveBehaviour)_projectile).transform.position))); float angle = Vector2Extensions.ToAngle(_stickNormal); for (int i = 0; i < 2; i++) { float num = angle.AddRandomSpread(45f).Clamp360(); Projectile val2; if (i == 0) { val2 = SpawnManager.SpawnProjectile(((Component)Forkbomb._ForkbombProj).gameObject, ((BraveBehaviour)_projectile).transform.position, Quaternion.Euler(0f, 0f, num), true).GetComponent(); val2.SpawnedFromOtherPlayerProjectile = true; val2.Owner = _projectile.Owner; val2.Shooter = _projectile.Shooter; ForkbombProjectile component = ((Component)val2).gameObject.GetComponent(); component.forks = forks; component.mastered = mastered; } else { val2 = _projectile; val2.ResetPiercing(); val2.SetSpeed(_originalSpeed); val2.SendInDirection(num.ToVector(), true, true); Reinitialize(); } if (Object.op_Implicit((Object)(object)_stuckEnemy)) { SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_stuckEnemy).specRigidbody; if (specRigidbody != null) { ((BraveBehaviour)val2).specRigidbody.RegisterTemporaryCollisionException(specRigidbody, 0.25f, (float?)0.5f); specRigidbody.RegisterTemporaryCollisionException(((BraveBehaviour)val2).specRigidbody, 0.25f, (float?)0.5f); } } PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(((BraveBehaviour)val2).specRigidbody, (int?)null, false); if (i == 0 && Object.op_Implicit((Object)(object)_owner)) { _owner.DoPostProcessProjectile(val2); } } if (mastered) { Exploder.Explode(Vector2.op_Implicit(val), Forkbomb._Explosion, Vector2.op_Implicit(((BraveBehaviour)_projectile).transform.right), (Action)null, true, (CoreDamageTypes)0, false); } } } public class DeathNote : CwaffGun { public static string ItemName = "Death Note"; public static string ShortDescription = "You Will Know Their Names"; public static string LongDescription = "Use to see enemies' names. Writing a name ensures the namebearer's untimely death. Boss names cannot have typos. Increases Curse by 3."; public static string Lore = "\"A seemingly empty notebook with an impossibly dark cover. Holding it open in your hands fills you with a sense of control over everyone's fate except your own.\" ~ An edgy quote scribbled on the back of what is obviously a 5th-grader's school notebook."; internal static GameObject _ReaperVFX = null; internal static GameObject _ScytheVFX = null; private DeathNoteHUD _hud; private static GameObject _Scribbles; internal string _ownerName = string.Empty; internal int nextLetter; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 14; int? reloadFps = 4; gun.SetAttributes((ItemQuality)4, (GunClass)50, 0f, 444, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, 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, 3f, continuousFire: false, dynamicBarrelOffsets: true, banFromBlessedRuns: false, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0, autoPlay: true, attacksThroughWalls: true, suppressReloadLabel: false, 1f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: false, preventRollingWhenCharging: false, 1f, -1f, canAttackWhileRolling: false, isStarterGun: false, 1f, preventDuctTape: true).AddToShop((ShopType)2).AssignGun(out Gun gunRef) .InitProjectile(GunData.New(null, null, -1, null, null, (ShootStyle)3, (ProjectileSequenceStyle)0, float.MaxValue, 1, null, customClip: true, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4)); ((BraveBehaviour)gunRef).spriteAnimator.SetLoopPoint(gunRef.QuickUpdateGunAnimation("open", null, returnToIdle: false, 10), 3); gunRef.QuickUpdateGunAnimation("close", null, returnToIdle: true, 30); _ReaperVFX = VFX.Create("reaper_vfx", 2f, loops: true, -1, 1f, (Anchor)1, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _ScytheVFX = VFX.Create("death_scythe_swing", 30f, loops: false, -1, 1f, (Anchor)1, null, usesZHeight: false, 10f, persist: false, (VFXAlignment)1); _Scribbles = VFX.Create("scribbles", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("CwaffingTheGungy.Resources.listofnames.txt"); using StreamReader streamReader = new StreamReader(stream); for (string text = streamReader.ReadLine(); text != null; text = streamReader.ReadLine()) { string text2 = text.Trim(); if (text2.Length > 0) { DeathNoteNameHandler.AddPossibleName(text2); } } } public override void Update() { base.Update(); ((GunBehaviour)this).gun.OverrideAngleSnap = 180f; } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); nextLetter = 0; _ownerName = Lazy.GetPlayerCharacterName(player).ToUpper(); } public override void OnTriedToInitiateAttack(PlayerController player) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) base.OnTriedToInitiateAttack(player); if (((GunBehaviour)this).gun.CurrentAmmo == 0 && !((GunBehaviour)this).gun.InfiniteAmmo) { DismissHUD(); return; } player.SuppressThisClick = true; if (player.IsDodgeRolling || (int)player.CurrentInputState != 0 || ((GunBehaviour)this).gun.IsReloading) { return; } if (!Object.op_Implicit((Object)(object)_hud) || !_hud.Active) { CreateHUDIfNecessary(); if (Object.op_Implicit((Object)(object)_hud) && !((GunBehaviour)this).gun.m_moduleData[((GunBehaviour)this).gun.DefaultModule].onCooldown) { ((GunBehaviour)this).gun.PlayIfExists("death_note_open", true); _hud.Toggle(); if (base.Mastered) { SetFocus(focus: true); } } } else { WriteInNotebook(player); } } public void WriteInNotebook(PlayerController player) { //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_0062: 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_0161: Unknown result type (might be due to invalid IL or missing references) ((Component)this).gameObject.Play("death_note_write_sound"); char c = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[DeathNoteHUD.LetterIndexForAngle(player.AimAngleFromCenterOfScreen())]; DeathNoteNameHandler.WriteLetter(c, player); CwaffVFX.SpawnBurst(_Scribbles, 4, Vector2.op_Implicit(((Component)((GunBehaviour)this).gun.barrelOffset).transform.position), 0.5f, (Vector2?)new Vector2(0f, 12f), 0f, 6f, CwaffVFX.Vel.Random, CwaffVFX.Rot.None, 1.5f, (float?)0.5f, 10f, startScale: (float?)0.5f, emissiveColor: (Color?)Color.white, fadeIn: false, uniform: false, endScale: (float?)null, height: (float?)null, randomFrame: true, 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, copyShaders: false); ((GunBehaviour)this).gun.LoseAmmo(1); if (((GunBehaviour)this).gun.CurrentAmmo == 0 && !((GunBehaviour)this).gun.InfiniteAmmo) { DismissHUD(); } if (!string.IsNullOrEmpty(_ownerName)) { if (_ownerName[nextLetter] != c) { nextLetter = 0; } else if (++nextLetter == _ownerName.Length) { nextLetter = 0; new GameObject().AddComponent().Setup(((BraveBehaviour)player).healthHaver); } } } private void RegisterEvents(PlayerController player) { if (Object.op_Implicit((Object)(object)player)) { player.OnReceivedDamage -= OnReceivedDamage; player.OnReceivedDamage += OnReceivedDamage; player.OnEnteredCombat = (Action)Delegate.Remove(player.OnEnteredCombat, new Action(OnEnteredCombat)); player.OnEnteredCombat = (Action)Delegate.Combine(player.OnEnteredCombat, new Action(OnEnteredCombat)); } } private void DeregisterEvents(PlayerController player) { if (Object.op_Implicit((Object)(object)player)) { player.OnReceivedDamage -= OnReceivedDamage; player.OnEnteredCombat = (Action)Delegate.Remove(player.OnEnteredCombat, new Action(OnEnteredCombat)); } } private void OnEnteredCombat() { if (((GunBehaviour)this).PlayerOwner.InBossRoom()) { BraveTime.SetTimeScaleMultiplier(1f, ((Component)this).gameObject); } PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null && (Object)(object)((GameActor)playerOwner).CurrentGun == (Object)(object)((GunBehaviour)this).gun && playerOwner.HasSynergy(Synergy.ILL_TAKE_A_POTATO_CHIP)) { BecomeInvisible(playerOwner); } } private void BecomeInvisible(PlayerController player) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) player.OnDidUnstealthyAction += BreakStealth; ((GameActor)player).SetIsStealthed(true, "PotatoChips"); Material[] array = player.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); } } private void BreakStealth(PlayerController player) { player.ClearOverrideShader(); ((GameActor)player).SetIsStealthed(false, "PotatoChips"); player.OnDidUnstealthyAction -= BreakStealth; } private void OnReceivedDamage(PlayerController player) { DismissHUD(); } public override bool OnManualReloadAttempted(PlayerController player) { if (!Object.op_Implicit((Object)(object)_hud) || !_hud.Active) { return true; } ((Component)this).gameObject.Play("death_note_close_sound"); DismissHUD(); return false; } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); DeathNoteNameHandler.Instance(); CreateHUDIfNecessary(); RegisterEvents(((GunBehaviour)this).PlayerOwner); } public override void OnSwitchedAwayFromThisGun() { DismissHUD(); base.OnSwitchedAwayFromThisGun(); } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); DismissHUD(); DeregisterEvents(player); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { DeregisterEvents(((GunBehaviour)this).PlayerOwner); } DismissHUD(); base.OnDestroy(); } private void CreateHUDIfNecessary() { if (!Object.op_Implicit((Object)(object)_hud)) { _hud = ((Component)this).gameObject.AddComponent(); _hud.Setup(); } } private void DismissHUD() { if (Object.op_Implicit((Object)(object)_hud) && _hud.Active) { ((GunBehaviour)this).gun.PlayIfExists("death_note_close", true); _hud.Dismiss(); } } internal void SetFocus(bool focus) { BraveTime.SetTimeScaleMultiplier((focus && !((GunBehaviour)this).PlayerOwner.InBossRoom()) ? 0.5f : 1f, ((Component)this).gameObject); } } public class ShinigamiVisit : MonoBehaviour { private const float FADE_DELAY = 1f; private const float LERP_RATE = 5f; private static readonly Vector2 _HoverOffset = new Vector2(0f, 1f); private static readonly Vector2 _OffscreenOffset = new Vector2(0f, 15f); private GameActor _actor; private HealthHaver _hh; private SpeculativeRigidbody _body; private tk2dSprite _shinigami; private float _timer; private bool _activated; private bool _setup; private bool _destroying; private Vector2 _lastPosition; public void Setup(HealthHaver hh) { //IL_00f5: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0168: 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) _hh = hh; if (!Object.op_Implicit((Object)(object)_hh)) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } _actor = ((BraveBehaviour)_hh).gameActor; if (!Object.op_Implicit((Object)(object)_actor) || !Object.op_Implicit((Object)(object)((BraveBehaviour)_actor).sprite) || !Object.op_Implicit((Object)(object)((BraveBehaviour)_actor).specRigidbody)) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } _body = ((BraveBehaviour)_actor).specRigidbody; if (!Object.op_Implicit((Object)(object)_body) || !Object.op_Implicit((Object)(object)_hh) || _hh.IsDead) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } _timer = 1f; _shinigami = ((Component)this).gameObject.AddComponent(); ((tk2dBaseSprite)_shinigami).SetSprite(VFX.Collection, ((tk2dBaseSprite)DeathNote._ReaperVFX.GetComponent()).spriteId); ((tk2dBaseSprite)(object)_shinigami).MakeGlowyBetter(glowColor: Color.red, glowAmount: 2f, glowColorPower: 10f); _lastPosition = ((BraveBehaviour)_actor).sprite.WorldTopCenter + _OffscreenOffset; ((tk2dBaseSprite)_shinigami).PlaceAtPositionByAnchor(Vector2.op_Implicit(_lastPosition.HoverAt(0.25f)), (Anchor)1); _setup = true; } private void Update() { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_00a0: 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_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_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_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) if (!_setup || _destroying) { return; } if (!Object.op_Implicit((Object)(object)_actor) || !Object.op_Implicit((Object)(object)((BraveBehaviour)_actor).sprite) || !Object.op_Implicit((Object)(object)_body) || !Object.op_Implicit((Object)(object)_hh)) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } _timer = Mathf.Max(_timer - BraveTime.DeltaTime, 0f); if (!_activated) { _lastPosition = Lazy.SmoothestLerp(_lastPosition, ((BraveBehaviour)_actor).sprite.WorldTopCenter + _HoverOffset, 5f); } ((tk2dBaseSprite)_shinigami).PlaceAtPositionByAnchor(Vector2.op_Implicit(_lastPosition.HoverAt(0.25f)), (Anchor)1); if (_activated || _timer > 0f || _actor.IsGone || !_hh.IsVulnerable || GameManager.IsBossIntro) { return; } _activated = true; _destroying = true; ((MonoBehaviour)this).StartCoroutine(GlowTime()); ((Component)this).gameObject.Play("death_note_scythe_swing_sound"); GameObject scytheVFX = DeathNote._ScytheVFX; Vector3 position = Vector2.op_Implicit(((BraveBehaviour)_actor).sprite.WorldBottomCenter); float? height = 10f; CwaffVFX.Spawn(scytheVFX, position, null, null, 0f, null, 0f, null, fadeIn: false, null, null, height); GameObject scytheVFX2 = DeathNote._ScytheVFX; Vector3 position2 = Vector2.op_Implicit(((BraveBehaviour)_actor).sprite.WorldBottomCenter); height = 10f; CwaffVFX.Spawn(scytheVFX2, position2, null, null, 0f, null, 0f, null, fadeIn: false, null, null, height, randomFrame: false, -1, flipX: true); CwaffVFX.Spawn(DeathNote._ScytheVFX, Vector2.op_Implicit(((BraveBehaviour)_actor).sprite.WorldBottomCenter), height: 10f, rotation: 45f.EulerZ()); CwaffVFX.Spawn(DeathNote._ScytheVFX, Vector2.op_Implicit(((BraveBehaviour)_actor).sprite.WorldBottomCenter), height: 10f, rotation: (-45f).EulerZ(), velocity: null, lifetime: 0f, fadeOutTime: null, emissivePower: 0f, emissiveColor: null, fadeIn: false, startScale: null, endScale: null, randomFrame: false, specificFrame: -1, flipX: true); if (_actor is PlayerController) { _hh.NextShotKills = true; } _hh.minimumHealth = 0f; _hh.ApplyDamage(9999999f, Vector2.zero, "Shinigami", (CoreDamageTypes)0, (DamageCategory)5, true, (PixelCollider)null, true); ((Component)_hh).gameObject.PlayUnique("death_note_scythe_hit_sound"); if (!_hh.IsDead && !_hh.IsBoss && !_hh.IsSubboss) { GameActor actor = _actor; AIActor val = (AIActor)(object)((actor is AIActor) ? actor : null); if (val != null) { val.EraseFromExistenceWithRewards(false); } } } private IEnumerator GlowTime() { ((tk2dBaseSprite)(object)_shinigami).MakeGlowyBetter(glowColor: Color.red, glowAmount: 2f, glowColorPower: 10f, sensitivity: 0.5f, overrideColor: null, skipSetup: true); for (float elapsed = 0f; elapsed < 0.2f; elapsed += BraveTime.DeltaTime) { float t = elapsed / 0.2f; ((tk2dBaseSprite)(object)_shinigami).MakeGlowyBetter(Mathf.Lerp(2f, 20f, Ease.OutQuad(t)), null, null, 0.5f, null, skipSetup: true); yield return null; } for (float elapsed = 0f; elapsed < 0.2f; elapsed += BraveTime.DeltaTime) { float t2 = elapsed / 0.2f; ((tk2dBaseSprite)(object)_shinigami).MakeGlowyBetter(Mathf.Lerp(20f, 2f, Ease.OutQuad(t2)), null, null, 0.5f, null, skipSetup: true); yield return null; } for (float elapsed = 0f; elapsed < 1f; elapsed += BraveTime.DeltaTime) { _lastPosition = Lazy.SmoothestLerp(_lastPosition, Vector2Extensions.WithY(_lastPosition, GameManager.Instance.MainCameraController.MaxVisiblePoint.y + 1.5f), 3f); ((tk2dBaseSprite)_shinigami).PlaceAtPositionByAnchor(Vector2.op_Implicit(_lastPosition.HoverAt(0.25f)), (Anchor)1); yield return null; } Object.Destroy((Object)(object)((Component)this).gameObject); } } public class DeathNoteNameHandler { private static DeathNoteNameHandler _Instance; private const int _MAX_NAME_LENGTH = 16; private static readonly float[] _NameLengthHealthThresholds; private Dictionary _nametags; private char _queuedLetter; private List _bestLetters; private bool _needsReset; private PlayerController _owner; internal static readonly List> _PossibleNames; internal static readonly List _ActiveNames; static DeathNoteNameHandler() { _Instance = null; _NameLengthHealthThresholds = new float[17] { 0f, 10f, 20f, 40f, 60f, 90f, 120f, 150f, 200f, 300f, 400f, 500f, 750f, 100f, 1500f, 2000f, float.MaxValue }; _PossibleNames = new List>(); _ActiveNames = new List(); for (int i = 0; i <= 16; i++) { _PossibleNames.Add(new List()); } } public static DeathNoteNameHandler Instance() { if (_Instance == null) { _Instance = new DeathNoteNameHandler(); } return _Instance; } private DeathNoteNameHandler() { _nametags = new Dictionary(); _bestLetters = new List(); CwaffEvents.OnFloorEnded = (Action)Delegate.Combine(CwaffEvents.OnFloorEnded, new Action(OnFloorEnded)); } public static void AddPossibleName(string name) { Instance(); if (name.Length <= 16) { _PossibleNames[name.Length].Add(name); } } private static void OnFloorEnded() { _Instance._nametags.Clear(); } public static string GenerateName(AIActor enemy, HealthHaver hh) { float adjustedMaxHealth = hh.AdjustedMaxHealth; int num = _NameLengthHealthThresholds.FirstLT(adjustedMaxHealth); if (!hh.IsBoss && !hh.IsSubboss && num < 16 && Random.value < 0.2f) { num++; } return _PossibleNames[num].ChooseRandom(); } public static void WriteLetter(char c, PlayerController owner) { _Instance._queuedLetter = c; _Instance._owner = owner; } public static bool OneGoodLetter() { return _Instance._bestLetters.Count == 1; } public static bool IsGoodLetter(char c) { return _Instance._bestLetters.Contains(c); } public static bool ResetNameProgress() { return _Instance._needsReset = true; } public IEnumerable GetNameTags() { _nametags.RemoveDeadKeys(); _ActiveNames.Clear(); foreach (DeathNoteNametag value2 in _nametags.Values) { _ActiveNames.Add(value2.name); } bool resetNames = _needsReset; _needsReset = false; bool newLetter = _queuedLetter != '\0'; _bestLetters.Clear(); int longestName = 0; for (int i = 0; i < StaticReferenceManager.AllEnemies.Count; i++) { AIActor val = StaticReferenceManager.AllEnemies[i]; if (!Object.op_Implicit((Object)(object)val)) { continue; } HealthHaver healthHaver = ((BraveBehaviour)val).healthHaver; if (healthHaver == null || healthHaver.IsDead || !((Behaviour)val).isActiveAndEnabled || !val.IsWorthShootingAt || val.m_spriteDimensions == default(Vector3)) { continue; } if (!_nametags.TryGetValue(val, out var value)) { string text = null; int num = 100; while (num-- > 0 && (string.IsNullOrEmpty(text) || _ActiveNames.Contains(text))) { text = GenerateName(val, healthHaver); } value = (_nametags[val] = DeathNoteNametag.Generate(val, healthHaver, text)); } if (resetNames) { value.ResetName(); } if (newLetter) { value.HandleLetter(_queuedLetter, _owner); } if (value.nextLetter < value.nameLength) { if (value.nextLetter > longestName) { longestName = value.nextLetter; _bestLetters.Clear(); } if (value.nextLetter == longestName) { _bestLetters.Add(value.uppername[value.nextLetter]); } } yield return value; } if (newLetter) { _queuedLetter = '\0'; } } } public class DeathNoteNametag { public string name; public string uppername; public string markupName; public AIActor actor; public HealthHaver hh; public int nameLength = -1; public int nextLetter; private bool _dirty; private bool _dying; public static DeathNoteNametag Generate(AIActor enemy, HealthHaver hh, string name) { DeathNoteNametag obj = new DeathNoteNametag { actor = enemy, hh = hh, nextLetter = 0, name = name }; obj.uppername = obj.name.ToUpper(); obj.nameLength = obj.name.Length; obj._dirty = true; return obj; } public void HandleLetter(char c, PlayerController owner) { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) if (_dying || !Object.op_Implicit((Object)(object)hh) || !Object.op_Implicit((Object)(object)actor)) { return; } if (c != uppername[nextLetter]) { if (hh.IsBoss || hh.IsSubboss) { nextLetter = 0; } return; } _dirty = true; nextLetter++; if (nextLetter == nameLength) { if (hh.IsBoss || hh.IsSubboss) { DeathNoteNameHandler.ResetNameProgress(); } _dying = true; if (Object.op_Implicit((Object)(object)owner)) { owner.DidUnstealthyAction(); } new GameObject().AddComponent().Setup(hh); } } public void ResetName() { if (!_dying) { nextLetter = 0; _dirty = true; } } public void PlaceNametag(dfLabel label) { //IL_0070: 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_00a4: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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 (_dirty) { markupName = "[color #dd6666]" + name.Substring(0, nextLetter) + "[/color]" + name.Substring(nextLetter); _dirty = false; } ((dfControl)label).IsVisible = true; ((dfControl)label).Opacity = 1f; label.Text = markupName; Vector2 val = ((BraveBehaviour)actor).sprite.WorldTopCenter + new Vector2(0f, 1f); if (_dying) { val += Lazy.RandomVector(0.0625f); } label.Place(val); } } public class DeathNoteHUD : MonoBehaviour { internal const string _NAME_LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; private const int _NUM_LETTERS = 26; private const float _WEDGE_ARC = 13.846154f; private const float _SHWOOP_TIME = 0.3f; private const float _BASE_GEOM_ALPHA = 0.3f; private static readonly Color _GeomColor1 = new Color(0.25f, 0.25f, 0.25f); private static readonly Color _GeomColor2 = new Color(0.35f, 0.35f, 0.35f); private bool _setup; private float _shwoop; private bool _active; private DeathNote _gun; private List _geometry = new List(); private Geometry _selector = new Geometry(); private List _labels = new List(); private List _nametags = new List(); private CameraController _camera; private Vector2 _worldBottomLeft; private Vector2 _worldTopRight; public bool Active => _active; public void Setup() { //IL_0018: 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_0091: 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_009b: Unknown result type (might be due to invalid IL or missing references) _gun = ((Component)this).gameObject.GetComponent(); _selector = Geometry.Create(Geometry.Shape.RING).Place(Vector3Extensions.WithAlpha(Color.red, 0.3f)).UseGUILayer(); for (int i = 0; i < 26; i++) { _geometry.Add(Geometry.Create(Geometry.Shape.RING).Place(Vector3Extensions.WithAlpha((i % 2 == 0) ? _GeomColor1 : _GeomColor2, 0.3f)).UseGUILayer()); _labels.Add(EasyLabel.Create(unicode: false, outline: true, (TextAlignment)1)); _labels[i].Text = new string("ABCDEFGHIJKLMNOPQRSTUVWXYZ"[i], 1); ((dfControl)_labels[i]).Pivot = (dfPivotPoint)4; } Dismiss(force: true); _setup = true; _camera = GameManager.Instance.MainCameraController; if (Object.op_Implicit((Object)(object)_camera)) { CameraController camera = _camera; camera.OnFinishedFrame = (Action)Delegate.Remove(camera.OnFinishedFrame, new Action(OnFinishedFrame)); CameraController camera2 = _camera; camera2.OnFinishedFrame = (Action)Delegate.Combine(camera2.OnFinishedFrame, new Action(OnFinishedFrame)); } } public void Toggle() { if (_active) { Dismiss(); } else { Engage(); } } public void Engage() { //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_0054: Unknown result type (might be due to invalid IL or missing references) if (!_active) { _active = true; _shwoop = 0f; if (((Component)this).gameObject.RequestCameraControl(lerp: true, OnCameraRelinquish)) { GameManager.Instance.MainCameraController.OverridePosition = Vector2.op_Implicit(((GameActor)((GunBehaviour)_gun).PlayerOwner).CenterPosition); } ((Component)this).gameObject.Play("death_note_open_sound"); } } private void OnCameraRelinquish() { } public void Dismiss(bool force = false, bool deactivate = true) { if (!_active && !force) { return; } foreach (Geometry item in _geometry) { if (Object.op_Implicit((Object)(object)item)) { item.Disable(); } } if (Object.op_Implicit((Object)(object)_selector)) { _selector.Disable(); } foreach (dfLabel label in _labels) { if (!((Object)(object)label == (Object)null)) { ((dfControl)label).Opacity = 0f; ((dfControl)label).IsVisible = false; } } foreach (dfLabel nametag in _nametags) { if (!((Object)(object)nametag == (Object)null)) { ((dfControl)nametag).Opacity = 0f; ((dfControl)nametag).IsVisible = false; } } if (deactivate) { _active = false; ((Component)this).gameObject.RelinquishCameraControl(); if (Object.op_Implicit((Object)(object)_gun)) { _gun.SetFocus(focus: false); } } } private void LateUpdate() { //IL_0066: 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_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) if (!_setup) { return; } if (Object.op_Implicit((Object)(object)_camera) && Object.op_Implicit((Object)(object)_gun)) { Gun gun = ((GunBehaviour)_gun).gun; if (gun != null) { PlayerController playerOwner = ((GunBehaviour)_gun).PlayerOwner; if (playerOwner != null) { if (GameManager.Instance.IsPaused) { Dismiss(force: false, deactivate: false); } else if ((int)playerOwner.CurrentInputState != 0 || gun.IsReloading || GameManager.IsBossIntro) { Dismiss(); } else if (_active) { ((Component)this).gameObject.RequestCameraControl(lerp: true, OnCameraRelinquish); if (((Component)this).gameObject.HasControlOverCamera()) { GameManager.Instance.MainCameraController.OverridePosition = Vector2.op_Implicit(((GameActor)((GunBehaviour)_gun).PlayerOwner).CenterPosition); } } return; } } } Dismiss(); Object.Destroy((Object)(object)this); } private void OnFinishedFrame() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (_setup && _active && Object.op_Implicit((Object)(object)_camera) && !GameManager.Instance.IsPaused && Object.op_Implicit((Object)(object)_gun) && Object.op_Implicit((Object)(object)((GunBehaviour)_gun).PlayerOwner) && (int)((GunBehaviour)_gun).PlayerOwner.CurrentInputState == 0) { Engage(); if (_active) { PlaceHUDElements(); } } } internal static int LetterIndexForAngle(float angle) { return Mathf.FloorToInt((angle.Clamp360() + 6.923077f) / 13.846154f) % 26; } private void PlaceHUDElements() { //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_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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00c3: 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_019d: 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_01c9: 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_01df: 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_018f: 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_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: 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_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: 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_02f6: 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_0356: Unknown result type (might be due to invalid IL or missing references) PlayerController playerOwner = ((GunBehaviour)_gun).PlayerOwner; if (!Object.op_Implicit((Object)(object)playerOwner) || (Object)(object)((GameActor)playerOwner).CurrentGun != (Object)(object)((GunBehaviour)_gun).gun) { Dismiss(); return; } int num = LetterIndexForAngle(playerOwner.AimAngleFromCenterOfScreen().Clamp360()); _shwoop = Mathf.Clamp01(_shwoop + BraveTime.DeltaTime / 0.3f); float num2 = Ease.OutQuad(_shwoop); _worldBottomLeft = _camera.MinVisiblePoint; _worldTopRight = _camera.MaxVisiblePoint; Vector2 val = 0.5f * (_worldBottomLeft + _worldTopRight); float num3 = _camera.MaxVisiblePoint.y - _camera.MinVisiblePoint.y; float num4 = num2 * num3; float num5 = 0.3f * num2; float num6 = 0.225f * num3; float num7 = num6 + 0.04f * num4; float magnitude = 0.5f * (num6 + num7); _selector.Disable(); for (int i = 0; i < 26; i++) { bool flag = i == num; bool flag2 = DeathNoteNameHandler.IsGoodLetter("ABCDEFGHIJKLMNOPQRSTUVWXYZ"[i]); Geometry geometry = _geometry[i]; Vector2? pos = val; float? angle = 13.846154f * (float)i; float? arc = 13.846154f; float? radiusInner = num6; float? num8 = num7 * (flag ? 1.125f : 1f); geometry.Place(Vector3Extensions.WithAlpha(flag ? Color.white : ((i % 2 == 0) ? _GeomColor1 : _GeomColor2), num5), pos, null, num8, angle, arc, radiusInner); Vector2 val2 = val + (13.846154f * (float)i).ToVector(magnitude); if (flag) { val2 += Lazy.RandomVector(1f / 32f); } if (flag2 && DeathNoteNameHandler.OneGoodLetter()) { Geometry selector = _selector; pos = val; num8 = 13.846154f * (float)i; selector.Place(arc: 13.846154f, radiusInner: num6 * 0.3f, radius: num6 * 0.9f, color: Vector3Extensions.WithAlpha(Color.Lerp(Color.red, ExtendedColours.pink, Mathf.Abs(Mathf.Sin(12f * BraveTime.ScaledTimeSinceStartup))), num5), pos: pos, pos2: null, angle: num8); } ((dfControl)_labels[i]).Color = Color32.op_Implicit(Vector3Extensions.WithAlpha(flag ? Color.black : (flag2 ? Color.red : Color.white), Mathf.Clamp01(2f * num2 - 1f))); _labels[i].OutlineColor = Color32.op_Implicit(Vector3Extensions.WithAlpha(flag ? Color.white : Color.black, Mathf.Clamp01(2f * num2 - 1f))); ((dfControl)_labels[i]).Opacity = num2; ((dfControl)_labels[i]).IsVisible = true; _labels[i].Place(val2); } int j = 0; foreach (DeathNoteNametag nameTag in DeathNoteNameHandler.Instance().GetNameTags()) { if (j >= _nametags.Count) { dfLabel val3 = EasyLabel.Create(unicode: false, outline: true, (TextAlignment)1); val3.ProcessMarkup = true; _nametags.Add(val3); } nameTag.PlaceNametag(_nametags[j]); j++; } for (; j < _nametags.Count; j++) { ((dfControl)_nametags[j]).IsVisible = false; ((dfControl)_nametags[j]).Opacity = 0f; } } } public class Leafblower : CwaffGun { public class BlownByLeafblowerBehavior : MonoBehaviour { private Projectile _projectile; private PlayerController _owner; private bool _setup; private bool _active; private Vector2 _windVector; public void Blow(Vector2 windVector) { //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) if (!_setup) { Setup(); } if (!Object.op_Implicit((Object)(object)_projectile)) { Object.Destroy((Object)(object)this); return; } _windVector = windVector; _active = true; } private void Setup() { _projectile = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); Projectile projectile = _projectile; projectile.ModifyVelocity = (Func)Delegate.Combine(projectile.ModifyVelocity, new Func(ModifyVelocity)); _setup = true; } private Vector2 ModifyVelocity(Vector2 inVector) { //IL_0011: 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) //IL_0022: 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) if (!_active) { return inVector; } _active = false; return inVector + BraveTime.DeltaTime * _windVector; } } private class LeafblowerParticle : MonoBehaviour { private const float _MAX_LIFE = 1f; private const float _DRAG = 0.25f; private const float _MIN_SPEED = 15f; private const float _MAX_SPEED = 25f; private const float _MAX_ANG_VEL = 100f; private float _lifetime; private float _angle; private float _mag; private float _angularVel; private tk2dBaseSprite _sprite; private Vector2 _spriteCenter = Vector2.zero; public void Setup(float startAngle) { //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) _sprite = (tk2dBaseSprite)(object)((Component)this).gameObject.GetComponent(); _spriteCenter = _sprite.WorldCenter; _mag = Random.Range(15f, 25f); _angle = startAngle; _angularVel = Random.Range(-100f, 100f); } private void LateUpdate() { //IL_0080: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) float deltaTime = BraveTime.DeltaTime; if (deltaTime != 0f) { if ((_lifetime += deltaTime) > 1f) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } float num = 1f - _lifetime / 1f; _mag *= Mathf.Pow(0.25f, deltaTime); _angle += _angularVel * deltaTime; _sprite.scale = new Vector3(num, num, 1f); _spriteCenter += _angle.ToVector(_mag) * BraveTime.DeltaTime; _sprite.PlaceAtRotatedPositionByAnchor(Vector2.op_Implicit(_spriteCenter), (Anchor)4); ((BraveBehaviour)_sprite).renderer.SetAlpha(num); } } } public static string ItemName = "Leafblower"; public static string ShortDescription = "Winds of Change"; public static string LongDescription = "Pushes around debris on the floor. Deals no direct damage, but can push enemies into pits."; public static string Lore = "Any sensible project manager in charge of designing an industrial strength leafblower would ensure the final product was as effective as possible. Instead, the entire design budget of this leafblower was allocated towards making it look intimidating to the Gundead, with the hopes of scaring them away as the Gungeon's janitors performed their duties. Not only was this approach ineffective -- as the Gundead couldn't care less about the aesthetics of invaders' equipment -- but the horsepower of this leafblower is mediocre at best."; private const float _MAX_REACH = 10f; private const float _MIN_REACH = 3f; private const float _SPREAD = 30f; private const float _DEBRIS_FORCE = 2f; private const float _ACTOR_FORCE = 40f; private const float _PROJ_FORCE = 120f; private const float _SQR_MAX_REACH = 100f; private const float _SQR_MIN_REACH = 9f; private readonly Dictionary _Knockbacks = new Dictionary(); private readonly List _RemovableKeys = new List(); public static void Init() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); GunClass uTILITY = CwaffGunClass.UTILITY; int? chargeFps = 60; gun.SetAttributes((ItemQuality)1, uTILITY, 1.2f, 999, Items.Banana, defaultAudio: false, infiniteAmmo: true, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, null, null, chargeFps, 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: true, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0).AddDualWieldSynergy(Synergy.FULL_CIRCULATION).AddToShop((ShopType)0) .AddToShop(ModdedShopType.Rusty) .InitProjectile(GunData.New(null, null, -1, null, null, (ShootStyle)3, (ProjectileSequenceStyle)0, float.MaxValue, 1, null, customClip: false, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 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, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: true)); } public override void Update() { //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_0041: 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_0093: 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_00ca: 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_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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0174: 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_021f: 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_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: 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_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) base.Update(); if (((GunBehaviour)this).PlayerOwner == null) { return; } float deltaTime = BraveTime.DeltaTime; if (deltaTime == 0f || !((GunBehaviour)this).gun.IsCharging) { return; } Vector2 val = Vector2.op_Implicit(((GunBehaviour)this).gun.barrelOffset.position); Lazy.PlaySoundUntilDeathOrTimeout("leafblower_loop", ((Component)((GunBehaviour)this).gun).gameObject, 0.05f); if (Random.value < 0.66f * (deltaTime * 60f)) { float startAngle = ((GunBehaviour)this).gun.CurrentAngle + Random.Range(-30f, 30f); SpawnManager.SpawnVFX(VacuumCleaner._VacuumVFX, Vector2.op_Implicit(val), Lazy.RandomEulerZ(), true).AddComponent().Setup(startAngle); } float num = 2f * (base.Mastered ? 2f : 1f); foreach (DebrisObject item in val.DebrisWithinCone(100f, ((GunBehaviour)this).gun.CurrentAngle, 30f, 100)) { Vector2 val2 = (Object.op_Implicit((Object)(object)((BraveBehaviour)item).sprite) ? ((BraveBehaviour)item).sprite.WorldCenter : Vector3Extensions.XY(((Component)item).gameObject.transform.position)) - val; float sqrMagnitude = ((Vector2)(ref val2)).sqrMagnitude; Vector2 val3 = num * (1f - Mathf.Clamp01((sqrMagnitude - 9f) / 91f)) * ((Vector2)(ref val2)).normalized; if (item.HasBeenTriggered) { item.ApplyVelocity(val3); } else { item.Trigger(Vector2.op_Implicit(val3), 0.5f, 1f); } } float num2 = 40f * (base.Mastered ? 2f : 1f); foreach (AIActor item2 in val.AllEnemiesWithinConeOfVision(((GunBehaviour)this).gun.CurrentAngle, 30f, 10f)) { KnockbackDoer knockbackDoer = ((BraveBehaviour)item2).knockbackDoer; if (knockbackDoer != null && !knockbackDoer.m_isImmobile.Value) { Vector2 val4 = ((GameActor)item2).CenterPosition - val; float sqrMagnitude2 = ((Vector2)(ref val4)).sqrMagnitude; Vector2 val5 = num2 * (1f - Mathf.Clamp01((sqrMagnitude2 - 9f) / 91f)) * ((Vector2)(ref val4)).normalized; float magnitude = ((Vector2)(ref val5)).magnitude; ActiveKnockbackData val6 = knockbackDoer.ApplySourcedKnockback(val5, magnitude, ((Component)this).gameObject, false); ActiveKnockbackData value; if (val6 != null) { _Knockbacks[item2] = val6; } else if (_Knockbacks.TryGetValue(item2, out value)) { value.knockback = Lazy.MaxMagnitude(value.knockback, ((Vector2)(ref val5)).normalized * (magnitude / (knockbackDoer.weight / 10f))); value.initialKnockback = value.knockback; value.elapsedTime = 0f; } } } if (base.Mastered) { ReadOnlyCollection allProjectiles = StaticReferenceManager.AllProjectiles; for (int num3 = allProjectiles.Count - 1; num3 >= 0; num3--) { Projectile val7 = allProjectiles[num3]; if (Object.op_Implicit((Object)(object)val7) && !(val7.Owner is PlayerController)) { Vector2 val8 = val7.SafeCenter - val; float sqrMagnitude3 = ((Vector2)(ref val8)).sqrMagnitude; if (!(sqrMagnitude3 > 100f)) { float num4 = Vector2Extensions.ToAngle(val8).Clamp360(); if (!(Mathf.Abs((((GunBehaviour)this).gun.CurrentAngle - num4).Clamp180()) > 30f)) { val7.RemoveBulletScriptControl(); Vector2 windVector = 120f * (1f - Mathf.Clamp01((sqrMagnitude3 - 9f) / 91f)) * ((Vector2)(ref val8)).normalized; GameObjectExtensions.GetOrAddComponent(((Component)val7).gameObject).Blow(windVector); } } } } } foreach (AIActor key in _Knockbacks.Keys) { ActiveKnockbackData val9 = _Knockbacks[key]; if (val9.elapsedTime >= val9.curveTime) { _RemovableKeys.Add(key); } } foreach (AIActor removableKey in _RemovableKeys) { _Knockbacks.Remove(removableKey); } _RemovableKeys.Clear(); } } public class VacuumCleaner : CwaffGun { private class VacuumAmmoDisplay : CustomAmmoDisplay { private VacuumCleaner _vac; private PlayerController _owner; private void Start() { Gun component = ((Component)this).GetComponent(); _vac = ((Component)component).GetComponent(); ref PlayerController owner = ref _owner; GameActor currentOwner = component.CurrentOwner; owner = (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null); } public override bool DoCustomAmmoDisplay(GameUIAmmoController uic) { if (!Object.op_Implicit((Object)(object)_owner)) { return false; } if (_vac.Mastered) { uic.GunAmmoCountLabel.Text = $"[sprite \"corpse_ui\"]x{_vac.corpsesSucked}\n[sprite \"vacuum_debris_ui\"]x{_vac.debrisSucked}"; } else { uic.GunAmmoCountLabel.Text = $"[sprite \"vacuum_debris_ui\"]x{_vac.debrisSucked}"; } return true; } } public static string ItemName = "Vacuum Cleaner"; public static string ShortDescription = "Lean Mean Cleaning Machine"; public static string LongDescription = "Cleans up debris lying around the Gungeon. Each piece of debris vacuumed has a 5% chance to restore 1% of a random gun's ammo."; public static string Lore = "Over time, the Gungeon naturally accrues a substantial amount of shrapnel, corpses, and other garbage as Gungeoneers fight their way through hordes of Gundead. The Gungeon's relatively pristine state as each new adventurer begins their descent is thanks largely to the Gungeon Janitorial Crew, whose work largely goes unnoticed and unthanked. Observing how adventurers had a penchant for using guns with flashy particle effects, one cunning janitor modified a few vacuum cleaners to electrify the latent argon in the Gungeon, creating some fancy green eddies in the air as the vacuums are running. The janitor stuffed a few of these modified vacuums in chests, hoping adventurers would be distracted enough by the particles to not notice the complete lack of damage as they unwittingly cleaned the dungeon and made the GJC's lives a little easier."; internal static GameObject _VacuumVFX = null; internal const float _REACH = 8f; internal const float _SPREAD = 10f; internal const float _ACCEL_SEC = 1.8f; internal const float _UPDATE_RATE = 0.1f; internal const float _AMMO_CHANCE = 0.05f; internal const float _HIGH_AMMO_CHANCE = 0.2f; internal const float _AMMO_AMT = 0.01f; internal const float _CASING_CHANCE = 0.01f; internal const int _FLOOR_CASINGS = 20; internal const int _CORPSE_PER_ARMOR = 16; internal const float _SQR_REACH = 64f; private int _casingsThisFloor; public int debrisSucked; public int corpsesSucked; public static void Init() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); GunClass uTILITY = CwaffGunClass.UTILITY; int? chargeFps = 16; gun.SetAttributes((ItemQuality)1, uTILITY, 1.2f, 999, Items.Banana, defaultAudio: false, infiniteAmmo: true, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, null, null, chargeFps, 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: true, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0).AddDualWieldSynergy(Synergy.FULL_CIRCULATION).Attach((Action)null, allowDuplicates: false) .AddToShop((ShopType)0) .AddToShop(ModdedShopType.Rusty) .InitProjectile(GunData.New(null, null, -1, null, null, (ShootStyle)3, (ProjectileSequenceStyle)0, float.MaxValue, 1, null, customClip: false, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 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, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: true)); _VacuumVFX = VFX.Create("vacuum_wind_sprite_a", 30f, loops: true, 6, 0.5f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); CwaffEvents.OnNewFloorFullyLoaded = (Action)Delegate.Combine(CwaffEvents.OnNewFloorFullyLoaded, new Action(OnNewFloorReached)); } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); CwaffEvents.OnNewFloorFullyLoaded = (Action)Delegate.Remove(CwaffEvents.OnNewFloorFullyLoaded, new Action(OnNewFloorReached)); } public override void OnDestroy() { CwaffEvents.OnNewFloorFullyLoaded = (Action)Delegate.Remove(CwaffEvents.OnNewFloorFullyLoaded, new Action(OnNewFloorReached)); base.OnDestroy(); } private void OnNewFloorReached() { _casingsThisFloor = 0; } private void MaybeRestoreAmmo() { if (Random.value > (((GunBehaviour)this).PlayerOwner.HasSynergy(Synergy.SCAVENGEST) ? 0.2f : 0.05f)) { return; } List list = new List(); foreach (Gun allGun in ((GunBehaviour)this).PlayerOwner.inventory.AllGuns) { if (!allGun.InfiniteAmmo && allGun.CanGainAmmo && allGun.CurrentAmmo < allGun.AdjustedMaxAmmo) { list.Add(allGun); } } if (list.Count != 0) { Gun val = list.ChooseRandom(); int num = (0.01f * (float)val.AdjustedMaxAmmo).RoundWeighted(); if (num != 0) { val.GainAmmo(num); ((Component)((GunBehaviour)this).gun).gameObject.Play("vacuum_process_ammo_sound"); } } } public override void Update() { //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) //IL_00cd: 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_009a: 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_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) //IL_0177: 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_016a: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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_0192: 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) base.Update(); if (((GunBehaviour)this).PlayerOwner == null || BraveTime.DeltaTime == 0f || !((GunBehaviour)this).gun.IsCharging) { return; } Lazy.PlaySoundUntilDeathOrTimeout("suction_loop", ((Component)((GunBehaviour)this).gun).gameObject, 0.05f); Vector2 val = Vector2.op_Implicit(((GunBehaviour)this).gun.barrelOffset.position); if (Random.value < 0.66f * (BraveTime.DeltaTime * 60f)) { float self = ((GunBehaviour)this).gun.CurrentAngle + Random.Range(-10f, 10f); SpawnManager.SpawnVFX(_VacuumVFX, Vector2Extensions.ToVector3ZUp(val + self.ToVector(8f), 0f), Lazy.RandomEulerZ()).AddComponent().Setup(((GunBehaviour)this).gun, 8f); } foreach (DebrisObject item in val.DebrisWithinCone(64f, ((GunBehaviour)this).gun.CurrentAngle, 10f, 100, base.Mastered)) { if (!Object.op_Implicit((Object)(object)((Component)item).gameObject.GetComponent())) { item.ClearVelocity(); item.PreventFallingInPits = true; item.IsAccurateDebris = false; SpeculativeRigidbody component = ((Component)item).GetComponent(); if (component != null) { ((Behaviour)component).enabled = false; } item.isStatic = true; ((Behaviour)item).enabled = false; Vector2 val2 = (Object.op_Implicit((Object)(object)((BraveBehaviour)item).sprite) ? ((BraveBehaviour)item).sprite.WorldCenter : Vector3Extensions.XY(((Component)item).gameObject.transform.position)); VacuumParticle vacuumParticle = ((Component)item).gameObject.AddComponent(); Gun gun = ((GunBehaviour)this).gun; Vector2 val3 = val2 - val; vacuumParticle.Setup(gun, ((Vector2)(ref val3)).magnitude); } } } public void ProcessDebris(DebrisObject debris) { //IL_004e: 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_00c1: 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) PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null) { return; } debrisSucked++; MaybeRestoreAmmo(); if (Random.value <= 0.01f && playerOwner.HasSynergy(Synergy.CLEANUP_CREW) && _casingsThisFloor < 20) { _casingsThisFloor++; LootEngine.SpawnCurrency(((GameActor)playerOwner).CenterPosition, 1, false); } if (!base.Mastered) { return; } if (debris.IsCorpse && ++corpsesSucked >= 16) { ((Component)((GunBehaviour)this).gun).gameObject.Play("vacuum_process_armor_sound"); corpsesSucked -= 16; LootEngine.SpawnItem(((Component)ItemHelper.Get(Items.Armor)).gameObject, Vector2.op_Implicit(((GameActor)playerOwner).CenterPosition), Vector2.zero, 0f, true, true, false); } if (debris.IsPickupObject) { PickupObject component = ((Component)debris).GetComponent(); if (component != null && component.PickupObjectId == 127) { ((Component)((GunBehaviour)this).gun).gameObject.Play("vacuum_process_armor_sound"); LootEngine.SpawnItem(((Component)ItemHelper.Get(Items.Ammo)).gameObject, Vector2.op_Implicit(((GameActor)playerOwner).CenterPosition), Vector2.zero, 0f, true, true, false); } } } public override void MidGameSerialize(List data, int i) { ((GunBehaviour)this).MidGameSerialize(data, i); data.Add(debrisSucked); } public override void MidGameDeserialize(List data, ref int i) { ((GunBehaviour)this).MidGameDeserialize(data, ref i); debrisSucked = (int)data[i++]; } } public class VacuumParticle : MonoBehaviour { private const float _MAX_LIFE = 1f; private const float _MIN_DIST_TO_VACUUM = 0.5f; private const float _MIN_VAC_DIST_SQR = 0.25f; private const float _MAX_ALPHA = 0.5f; private const float _DLT_ALPHA = 0.01f; private VacuumCleaner _vac; private Gun _gun; private tk2dBaseSprite _sprite; private Vector2 _velocity = Vector2.zero; private float _lifetime; private bool _isDebris = true; private DebrisObject _debris; private float _startDistance; private float _startScaleX = 1f; private float _startScaleY = 1f; private Vector2 _spriteCenter = Vector2.zero; public void Setup(Gun gun, float startDistance = 0f) { //IL_007e: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) _gun = gun; _vac = ((Component)gun).gameObject.GetComponent(); _startDistance = startDistance; _debris = ((Component)this).gameObject.GetComponent(); _isDebris = (Object)(object)_debris != (Object)null; _sprite = (tk2dBaseSprite)(_isDebris ? ((object)((BraveBehaviour)_debris).sprite) : ((object)((Component)this).gameObject.GetComponent())); _startScaleX = (_isDebris ? _sprite.scale.x : 1f); _startScaleY = (_isDebris ? _sprite.scale.y : 1f); _spriteCenter = _sprite.WorldCenter; } private void LateUpdate() { //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_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_009a: 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_0116: 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_012b: 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_0146: 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_0158: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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) if (BraveTime.DeltaTime == 0f) { return; } if (!_isDebris) { _lifetime += BraveTime.DeltaTime; if (!Object.op_Implicit((Object)(object)_gun) || _lifetime > 1f) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } ((BraveBehaviour)_sprite).renderer.SetAlpha(0.5f * (1f - _lifetime / 1f)); } Vector2 val = Vector3Extensions.XY(_gun.barrelOffset.position) - _sprite.WorldCenter; if (((Vector2)(ref val)).sqrMagnitude < 0.25f) { if (Object.op_Implicit((Object)(object)_vac) && _isDebris) { _vac.ProcessDebris(_debris); } Object.Destroy((Object)(object)((Component)this).gameObject); } else { float num = ((Vector2)(ref val)).magnitude / _startDistance; _sprite.scale = new Vector3(_startScaleX * num, _startScaleY * num, 1f); _velocity = _sprite.WorldCenter.LerpDirectAndNaturalVelocity(Vector2.op_Implicit(_gun.barrelOffset.position), _velocity, 1.8f * BraveTime.DeltaTime, 1f); _spriteCenter += _velocity * 60f * BraveTime.DeltaTime; _sprite.PlaceAtRotatedPositionByAnchor(Vector2.op_Implicit(_spriteCenter), (Anchor)4); } } } public class Magunet : CwaffGun { public static string ItemName = "Magunet"; public static string ShortDescription = "An Attractive Option"; public static string LongDescription = "Attracts debris in a cone in front of the player and holds it in stasis while fire is held. Upon releasing fire, launches all attracted debris forwards, damaging any enemies in the way. Corpses deal extra damage when launched. Increases curse by 1."; public static string Lore = "Standing in sharp defiance of all that the Gungeon, electrical engineering, and common sense stand for, the Magunet manages to weaponize the messiness of battle-torn Gungeon rooms through questionable physics that only vaguely approximate how actual magnets operate."; internal static GameObject _MagunetBeamVFX = null; internal static GameObject _MagunetChargeVFX = null; internal static GameObject _DebrisImpactVFX = null; internal static GameObject _DebrisBigImpactVFX = null; internal const float _REACH = 8f; internal const float _SPREAD = 35f; internal const float _ACCEL_SEC = 3.5f; internal const float _UPDATE_RATE = 0.1f; internal const float _FX_RATE = 0.15f; internal const float _SQR_REACH = 64f; private const float _NUM_PARTICLES = 3f; private float _timeOfLastFX; private bool _wasCharging; private GameObject _extantChargeVFX; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? chargeFps = 16; gun.SetAttributes((ItemQuality)3, (GunClass)60, 1.2f, 999, Items.Banana, defaultAudio: false, infiniteAmmo: true, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, null, null, chargeFps, 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, 1f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: true, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0).AddToShop((ShopType)2).InitProjectile(GunData.New(null, null, -1, null, null, (ShootStyle)3, (ProjectileSequenceStyle)0, float.MaxValue, 1, null, customClip: false, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 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, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: true)); _MagunetBeamVFX = VFX.Create("magbeam_alt", 30f, loops: true, -1, 0.65f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 1f); _MagunetChargeVFX = VFX.Create("magunet_charge_vfx", 30f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _MagunetChargeVFX.SetAlpha(0.5f); _DebrisImpactVFX = Items.Ak47.EnemyImpactVFX(); _DebrisBigImpactVFX = Items.HegemonyRifle.EnemyImpactVFX(); } public override void OnSwitchedAwayFromThisGun() { CeaseCharging(); base.OnSwitchedAwayFromThisGun(); } public override void OnDroppedByPlayer(PlayerController player) { CeaseCharging(); base.OnDroppedByPlayer(player); } public override void OnDestroy() { CeaseCharging(); base.OnDestroy(); } private void CeaseCharging() { //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_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) _extantChargeVFX.SafeDestroy(); _extantChargeVFX = null; if (_wasCharging) { ((Component)this).gameObject.Play("magunet_launch_sound"); Exploder.DoDistortionWave(Vector3Extensions.XY(((GunBehaviour)this).gun.barrelOffset.position) + ((GunBehaviour)this).gun.gunAngle.ToVector(0.5f), 1.5f, 0.05f, 2.75f, 0.25f); } _wasCharging = false; } public override void Update() { //IL_0071: 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_00a6: 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_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_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0180: 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_0280: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: 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_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) base.Update(); if (BraveTime.DeltaTime == 0f) { return; } if (!((GunBehaviour)this).gun.IsCharging) { CeaseCharging(); return; } _wasCharging = true; if (_extantChargeVFX == null) { _extantChargeVFX = SpawnManager.SpawnVFX(_MagunetChargeVFX, ((GunBehaviour)this).gun.barrelOffset.position, Quaternion.identity); } _extantChargeVFX.transform.position = ((GunBehaviour)this).gun.barrelOffset.position; _extantChargeVFX.transform.rotation = ((GunBehaviour)this).gun.CurrentAngle.EulerZ(); Vector2 val = Vector2.op_Implicit(((GunBehaviour)this).gun.barrelOffset.position); if (BraveTime.ScaledTimeSinceStartup - _timeOfLastFX >= 0.15f) { ((Component)((GunBehaviour)this).gun).gameObject.Play("magunet_attract_sound"); _timeOfLastFX = BraveTime.ScaledTimeSinceStartup; for (int i = 0; (float)i < 3f; i++) { float num = 35f * ((float)i / 3f); float self = ((GunBehaviour)this).gun.CurrentAngle + num; SpawnManager.SpawnVFX(_MagunetBeamVFX, Vector2Extensions.ToVector3ZUp(val + self.ToVector(8f), 0f), self.EulerZ()).AddComponent().Setup(((GunBehaviour)this).gun, 8f, num); if (i != 0) { float self2 = ((GunBehaviour)this).gun.CurrentAngle - num; SpawnManager.SpawnVFX(_MagunetBeamVFX, Vector2Extensions.ToVector3ZUp(val + self2.ToVector(8f), 0f), self2.EulerZ()).AddComponent().Setup(((GunBehaviour)this).gun, 8f, 0f - num); } } } foreach (DebrisObject item in val.DebrisWithinCone(64f, ((GunBehaviour)this).gun.CurrentAngle, 35f, 100)) { if (!Object.op_Implicit((Object)(object)((Component)item).gameObject.GetComponent()) && !Object.op_Implicit((Object)(object)((Component)item).gameObject.GetComponent())) { item.ClearVelocity(); item.PreventFallingInPits = true; item.IsAccurateDebris = false; SpeculativeRigidbody component = ((Component)item).GetComponent(); if (component != null) { ((Behaviour)component).enabled = false; } item.isStatic = true; ((Behaviour)item).enabled = false; Vector2 val2 = (Object.op_Implicit((Object)(object)((BraveBehaviour)item).sprite) ? ((BraveBehaviour)item).sprite.WorldCenter : Vector3Extensions.XY(((Component)item).gameObject.transform.position)); MagnetParticle magnetParticle = ((Component)item).gameObject.AddComponent(); Gun gun = ((GunBehaviour)this).gun; Vector2 val3 = val2 - val; magnetParticle.Setup(gun, ((Vector2)(ref val3)).magnitude); } } } } public class DebrisProjectile : Projectile { private const float _MIN_PROJ_SPEED = 4f; private const float _MIN_PROJ_SPEED_SQR = 16f; private DebrisObject _debris; public override void Start() { ((Projectile)this).Start(); _debris = ((Component)this).GetComponent(); } public override void Update() { //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_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) //IL_0037: Unknown result type (might be due to invalid IL or missing references) ((Projectile)this).Update(); ((BraveBehaviour)this).specRigidbody.Position = new Position(_debris.m_currentPosition); ((BraveBehaviour)this).specRigidbody.Velocity = Vector3Extensions.XY(_debris.m_velocity); if (((Vector2)(ref ((BraveBehaviour)this).specRigidbody.Velocity)).sqrMagnitude < 16f) { ((Projectile)this).DieInAir(true, false, false, true); } } } public class MagnetParticle : MonoBehaviour { private const float _MAX_LIFE = 0.5f; private const float _MIN_DIST_TO_VACUUM = 1.25f; private const float _MIN_VAC_DIST_SQR = 1.5625f; private const float _MIN_LAUNCH_SPEED = 24f; private const float _MAX_LAUNCH_SPEED = 40f; private Gun _gun; private tk2dBaseSprite _sprite; private Vector2 _velocity = Vector2.zero; private float _lifetime; private bool _isDebris = true; private DebrisObject _debris; private float _startDistance; private float _startScaleX = 1f; private float _startScaleY = 1f; private float _startAngle = 1f; private bool _inStasis; private float _statisAngle; private float _statisMag; private float _trueAngle; private float _timeInStasis; private Vector2 _spriteCenter = Vector2.zero; public void Setup(Gun g, float startDistance = 0f, float offsetAngle = 0f) { //IL_005e: 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_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) _gun = g; _startDistance = startDistance; _debris = ((Component)this).gameObject.GetComponent(); _isDebris = (Object)(object)_debris != (Object)null; _sprite = (tk2dBaseSprite)(_isDebris ? ((object)((BraveBehaviour)_debris).sprite) : ((object)((Component)this).gameObject.GetComponent())); _startScaleX = _sprite.scale.x; _startScaleY = _sprite.scale.y; _startAngle = offsetAngle; _spriteCenter = _sprite.WorldCenter; if (Object.op_Implicit((Object)(object)_debris) && Object.op_Implicit((Object)(object)((BraveBehaviour)_debris).specRigidbody)) { Object.Destroy((Object)(object)((BraveBehaviour)_debris).specRigidbody); ((BraveBehaviour)_debris).specRigidbody = null; ((BraveBehaviour)_debris).RegenerateCache(); } } private void LaunchDebrisInStasis(Vector2 velocity) { //IL_0035: 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_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_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_0050: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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_01c9: Unknown result type (might be due to invalid IL or missing references) SpeculativeRigidbody val = (((BraveBehaviour)_debris).specRigidbody = GameObjectExtensions.GetOrAddComponent(((Component)this).gameObject)); SpeculativeRigidbody val2 = val; val2.ClearSpecificCollisionExceptions(); val2.CollideWithTileMap = true; val2.CollideWithOthers = true; val2.PixelColliders = new List { new PixelCollider { CollisionLayer = (CollisionLayer)4, ColliderGenerationMode = (PixelColliderGeneration)0, ManualOffsetX = -4, ManualOffsetY = -4, ManualWidth = 8, ManualHeight = 8 } }; DebrisProjectile debrisProjectile = ((Component)this).gameObject.AddComponent(); ((BraveBehaviour)debrisProjectile).specRigidbody = val2; ((Projectile)debrisProjectile).baseData.damage = (_debris.IsCorpse ? 30f : 2f); ((Projectile)debrisProjectile).baseData.range = 1000000f; ((Projectile)debrisProjectile).baseData.speed = ((Vector2)(ref velocity)).magnitude; ((Projectile)debrisProjectile).baseData.force = 50f; ((Projectile)(object)debrisProjectile).SetOwnerAndStats(_gun.CurrentOwner); ((Projectile)debrisProjectile).DestroyMode = (ProjectileDestroyMode)2; ((Projectile)debrisProjectile).ManualControl = true; ((Projectile)debrisProjectile).OnHitEnemy = (Action)Delegate.Combine(((Projectile)debrisProjectile).OnHitEnemy, new Action(OnHitEnemy)); ((Projectile)debrisProjectile).shouldRotate = true; ((BraveBehaviour)val2).RegenerateCache(); val2.Reinitialize(); ((Projectile)debrisProjectile).Start(); GameActor owner = ((Projectile)debrisProjectile).Owner; PlayerController val3 = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val3 != null) { velocity *= val3.ProjSpeedMult(); } _debris.m_currentPosition = Vector3Extensions.WithZ(((Component)this).gameObject.transform.position, 0f); _debris.m_transform.rotation = ((Component)this).gameObject.transform.rotation; ((Behaviour)_debris).enabled = true; if (!Object.op_Implicit((Object)(object)((BraveBehaviour)_debris).sprite)) { ((BraveBehaviour)_debris).sprite = _sprite; } _debris.ApplyVelocity(velocity); Object.Destroy((Object)(object)this); } private void OnHitEnemy(Projectile bullet, SpeculativeRigidbody body, bool what) { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) SpawnManager.SpawnVFX(_debris.IsCorpse ? Magunet._DebrisBigImpactVFX : Magunet._DebrisImpactVFX, Vector2.op_Implicit(body.UnitCenter + Lazy.RandomVector(0.5f)), Quaternion.identity); GameActor owner = bullet.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null && val.HasSynergy(Synergy.MASTERY_MAGUNET)) { ((BraveBehaviour)bullet).specRigidbody.RegisterSpecificCollisionException(body); } else { Object.Destroy((Object)(object)((Component)bullet).gameObject); } } private void LateUpdate() { //IL_01c7: 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_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_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: 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_008e: 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_00a6: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0283: 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_028d: 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_02b9: 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_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_034d: 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: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) if (BraveTime.DeltaTime == 0f) { return; } if (!_isDebris) { _lifetime += BraveTime.DeltaTime; if (!Object.op_Implicit((Object)(object)_gun) || _lifetime > 0.5f) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } float num = 1f - _lifetime / 0.5f; float num2 = num * num; float self = _gun.CurrentAngle + _startAngle; ((Component)this).gameObject.transform.position = Vector2.op_Implicit(Vector3Extensions.XY(_gun.barrelOffset.position) + self.Clamp360().ToVector(num2 * _startDistance)); ((BraveBehaviour)_sprite).transform.rotation = self.EulerZ(); _sprite.scale = new Vector3(_startScaleX * num2, _startScaleY * num2, 1f); return; } if (!Object.op_Implicit((Object)(object)_gun) || !_gun.IsCharging) { if (_inStasis) { PlayerController val = (PlayerController)(Object.op_Implicit((Object)(object)_gun) ? /*isinst with value type is only supported in some contexts*/: null); float num3 = _statisAngle * (7f / 36f) * (Object.op_Implicit((Object)(object)val) ? val.AccuracyMult() : 1f); float num4 = (Object.op_Implicit((Object)(object)_gun) ? _gun.CurrentAngle : Lazy.RandomAngle()); LaunchDebrisInStasis((num4 + num3).ToVector((Object.op_Implicit((Object)(object)val) ? val.ProjSpeedMult() : 1f) * Random.Range(24f, 40f))); } else { Object.Destroy((Object)(object)this); } return; } Vector2 val2 = _sprite.WorldCenter - Vector3Extensions.XY(_gun.barrelOffset.position); ((Component)this).gameObject.transform.rotation = Vector2Extensions.ToAngle(val2).EulerZ(); if (_inStasis) { _timeInStasis += BraveTime.DeltaTime; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0f, 0.2f * Mathf.Sin(24f * _timeInStasis)); _trueAngle = _gun.CurrentAngle + _statisAngle; _spriteCenter = Vector3Extensions.XY(_gun.barrelOffset.position) + val3 + _trueAngle.ToVector(_statisMag); ((Component)this).gameObject.transform.rotation = _gun.CurrentAngle.EulerZ(); _sprite.PlaceAtRotatedPositionByAnchor(Vector2.op_Implicit(_spriteCenter), (Anchor)4); } else if (((Vector2)(ref val2)).sqrMagnitude < 1.5625f) { _inStasis = true; _statisAngle = (Vector2Extensions.ToAngle(val2) - _gun.CurrentAngle).Clamp180(); _statisMag = ((Vector2)(ref val2)).magnitude; } else { _velocity = _sprite.WorldCenter.LerpDirectAndNaturalVelocity(Vector2.op_Implicit(_gun.barrelOffset.position), _velocity, 1.8f * BraveTime.DeltaTime, 1f); _spriteCenter += _velocity * 60f * BraveTime.DeltaTime; _sprite.PlaceAtRotatedPositionByAnchor(Vector2.op_Implicit(_spriteCenter), (Anchor)4); } } } public class Yggdrashell : CwaffGun { [HarmonyPatch(typeof(GameUIHeartController), "ProcessHeartSpriteModifications")] private class YggdrashellShieldPatch { private static void Postfix(GameUIHeartController __instance, PlayerController associatedPlayer) { if (Object.op_Implicit((Object)(object)associatedPlayer) && associatedPlayer.inventory != null && associatedPlayer.inventory.AllGuns != null) { Yggdrashell gun = associatedPlayer.GetGun(); if (gun != null && gun._protectionActive) { __instance.m_currentFullHeartName = "yggdrashell_heart_full_ui"; __instance.m_currentHalfHeartName = "yggdrashell_heart_half_ui"; __instance.m_currentArmorName = "yggdrashell_armor_ui"; } } } } public static string ItemName = "Yggdrashell"; public static string ShortDescription = "The Gun of Life"; public static string LongDescription = "Fires constricting vines that absorb enemies' life force. Vines grow stronger as more life is absorbed. Max absorption scales with the player's current number of hearts (or armor, for 0-health characters). At max absorption, grants Earth Armor that negates damage once. Absorbed life force is reset to zero upon getting hit."; public static string Lore = "Crafted from the wood of the World Tree by Reloadin himself, this gun thrives off the life forces of those at both ends of its barrel. Its true strength manifests only when wielded by one possessing both great might and great fortitude."; private const float _PARTICLE_RATE = 0.03f; private const float _LIFEFORCE_VALUE = 100f; private const float _LEAF_GLOW = 100f; private const float _ACCUM_RATE = 2f; private static readonly float[] _Thresholds = new float[5] { 0f, 100f, 300f, 600f, 1000f }; internal static Color _EarthBlankColor = new Color(0.75f, 1f, 0.75f, 1f); internal static Color _LeafColor = new Color(0.41960785f, 0.6431373f, 1f / 15f); internal static tk2dBaseSprite _HeartVFXSprite = null; internal static tk2dBaseSprite _ArmorVFXSprite = null; internal static GameObject _LeafVFX = null; private bool _protectionActive; private float _lastParticleTime; public float lifeForce; public static void Init() { //IL_022d: Unknown result type (might be due to invalid IL or missing references) Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore).SetAttributes(reloadTime: 0f, ammo: 600, audioFrom: Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, shootFps: 14, reloadFps: 4, quality: (ItemQuality)5, gunClass: (GunClass)20, doesScreenShake: false, idleFps: null, chargeFps: null, introFps: null, fireAudio: null, reloadAudio: null, introAudio: null, loopChargeAt: -1, loopReloadAt: -1, loopFireAt: -1, muzzleFrom: null, modulesAreTiers: true, muzzleVFX: null, muzzleFps: 60, muzzleScale: 1f, muzzleAnchor: (Anchor)3, muzzleEmission: -1f, muzzleEmissionColor: null, muzzleEmissionColorPower: -1f, muzzleLit: false, muzzleLightStrength: 0f, muzzleLightRange: 0f, muzzleLightColor: null, carryOffset: null, preventRotation: false, curse: 0f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: false, rampUpFireRate: false, rampUpFactor: 0f, suppressReloadAnim: false, handedness: (GunHandedness)0, autoPlay: true, attacksThroughWalls: true).AssignGun(out Gun gunRef) .Volley.projectiles = new List { SetupMod(1, gunRef), SetupMod(2, gunRef), SetupMod(3, gunRef), SetupMod(4, gunRef), SetupMod(5, gunRef) }; _HeartVFXSprite = VFX.Create("yggdrashell_heart_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1).GetComponent(); _ArmorVFXSprite = VFX.Create("yggdrashell_armor_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1).GetComponent(); Color? emissiveColour = Color.green; _LeafVFX = VFX.Create("leaf_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 100f, emissiveColour); } private static ProjectileModule SetupMod(int level, Gun gun) { //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_04ed: Expected O, but got Unknown int? clipSize = -1; float? cooldown = 0.1f; bool? doBeamSetup = false; float? damage = 15f * (float)level; Projectile val = Items._38Special.CloneProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)2, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, damage, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 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, null, null, null, doBeamSetup)); val.AddRaidenBeamPrefab($"yggdrashell_beam_{level}", 20, 1, targetOffscreen: true); ProjectileModule obj = GunBuilder.SetAttributes(new ProjectileModule(), GunData.New(gun, null, -1, 0.1f, null, (ShootStyle)2, (ProjectileSequenceStyle)0, 0f, 5, null, customClip: true, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4)); obj.projectiles = new List { val }; return obj; } public void UpdateDamageDealt(float damageThisTick) { //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) PlayerController val = GunTools.GunPlayerOwner(((GunBehaviour)this).gun); if (val != null) { float num = (float)Mathf.Max(1, Mathf.FloorToInt(val.ForceZeroHealthState ? ((BraveBehaviour)val).healthHaver.currentArmor : ((BraveBehaviour)val).healthHaver.currentHealth)) * 100f; lifeForce = Mathf.Min(lifeForce + damageThisTick * 2f, num); if (!_protectionActive && lifeForce >= num) { _protectionActive = true; val.DoGenericItemActivation(((GunBehaviour)this).PlayerOwner.ForceZeroHealthState ? _ArmorVFXSprite : _HeartVFXSprite, "yggdrashell_protection_ready_sound"); ((Component)val).gameObject.Play("yggdrashell_protection_ready_sound"); GameObject leafVFX = _LeafVFX; Transform transform = ((BraveBehaviour)((BraveBehaviour)val).sprite).transform; Vector2 centerPosition = ((GameActor)val).CenterPosition; float? startScale = 1f; float? endScale = 0.1f; Color? emissiveColor = _LeafColor; CwaffVFX.SpawnBurst(leafVFX, 50, centerPosition, 8f, null, 0f, 0f, CwaffVFX.Vel.InwardToCenter, CwaffVFX.Rot.Random, 0.5f, null, 100f, emissiveColor, fadeIn: false, uniform: false, startScale, endScale, null, randomFrame: true, -1, flipX: false, flipY: false, transform); } int currentStrengthTier = ((GunBehaviour)this).gun.CurrentStrengthTier; ((GunBehaviour)this).gun.CurrentStrengthTier = _Thresholds.FirstLT(lifeForce) - 1; if (currentStrengthTier < ((GunBehaviour)this).gun.CurrentStrengthTier) { ClearCachedShootData(); ((Component)((GunBehaviour)this).gun).gameObject.Play("yggdrashell_power_up_sound"); ((GunBehaviour)this).gun.CeaseAttack(true, (ProjectileData)null); ((GunBehaviour)this).gun.Attack((ProjectileData)null, (GameObject)null); } } } public override void Update() { //IL_009c: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_0101: Unknown result type (might be due to invalid IL or missing references) base.Update(); bool play = Object.op_Implicit((Object)(object)((GunBehaviour)this).gun) && ((GunBehaviour)this).gun.IsFiring; ((MonoBehaviour)(object)((GunBehaviour)this).gun).LoopSoundIf(play, "entangle_loop", 1500, 500); if (((GunBehaviour)this).gun.IsFiring && !(BraveTime.ScaledTimeSinceStartup - _lastParticleTime <= 0.03f)) { _lastParticleTime = BraveTime.ScaledTimeSinceStartup; if (GetExtantBeam() is CwaffRaidenBeamController cwaffRaidenBeamController) { cwaffRaidenBeamController.maxTargets = ((!base.Mastered) ? 1 : 3); Vector2 val = ((GunBehaviour)this).gun.CurrentAngle.ToVector(); GameObject leafVFX = _LeafVFX; int numToSpawn = 2 + 2 * ((GunBehaviour)this).gun.CurrentStrengthTier; Vector2 pointOnMainBezier = cwaffRaidenBeamController.GetPointOnMainBezier(Random.value); Vector2? baseVelocity = 4f * val; float? startScale = 1f; float? endScale = 0.1f; Color? emissiveColor = _LeafColor; CwaffVFX.SpawnBurst(leafVFX, numToSpawn, pointOnMainBezier, 1f, baseVelocity, 0f, 4f, CwaffVFX.Vel.Random, CwaffVFX.Rot.Random, 0.5f, null, 100f, emissiveColor, fadeIn: false, uniform: false, startScale, endScale, null, randomFrame: true); } } } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); ((GunBehaviour)this).gun.CurrentStrengthTier = 0; player.OnReceivedDamage += OnReceivedDamage; HealthHaver healthHaver = ((BraveBehaviour)player).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Combine(healthHaver.ModifyDamage, new Action(OnMightTakeDamage)); } private void OnReceivedDamage(PlayerController player) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) lifeForce = 0f; int currentStrengthTier = ((GunBehaviour)this).gun.CurrentStrengthTier; ((GunBehaviour)this).gun.CurrentStrengthTier = 0; if (currentStrengthTier != ((GunBehaviour)this).gun.CurrentStrengthTier) { ClearCachedShootData(); if (((GunBehaviour)this).gun.IsFiring) { ((GunBehaviour)this).gun.CeaseAttack(true, (ProjectileData)null); ((GunBehaviour)this).gun.Attack((ProjectileData)null, (GameObject)null); } } } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); player.OnReceivedDamage -= OnReceivedDamage; HealthHaver healthHaver = ((BraveBehaviour)player).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Remove(healthHaver.ModifyDamage, new Action(OnMightTakeDamage)); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((GunBehaviour)this).PlayerOwner.OnReceivedDamage -= OnReceivedDamage; HealthHaver healthHaver = ((BraveBehaviour)((GunBehaviour)this).PlayerOwner).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Remove(healthHaver.ModifyDamage, new Action(OnMightTakeDamage)); } base.OnDestroy(); } private void OnMightTakeDamage(HealthHaver hh, ModifyDamageEventArgs data) { //IL_005d: 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_00bc: Unknown result type (might be due to invalid IL or missing references) if (_protectionActive && Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) && (object)data != EventArgs.Empty && !(data.ModifiedDamage <= 0f) && hh.IsVulnerable) { data.ModifiedDamage = 0f; hh.TriggerInvulnerabilityPeriod(-1f); Lazy.DoDamagedFlash(hh); _protectionActive = false; ((GunBehaviour)this).PlayerOwner.DoColorfulBlank(_EarthBlankColor); ((Component)((GunBehaviour)this).PlayerOwner).gameObject.Play("yggdrashell_protection_activate_sound"); GameObject leafVFX = _LeafVFX; Vector2 centerPosition = ((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition; float? startScale = 1f; float? endScale = 0.1f; Color? emissiveColor = _LeafColor; CwaffVFX.SpawnBurst(leafVFX, 50, centerPosition, 1f, null, 6f, 2f, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.Random, 0.8f, null, 100f, emissiveColor, fadeIn: false, uniform: false, startScale, endScale, null, randomFrame: true); OnReceivedDamage(((GunBehaviour)this).PlayerOwner); } } public override void MidGameSerialize(List data, int i) { ((GunBehaviour)this).MidGameSerialize(data, i); data.Add(lifeForce); } public override void MidGameDeserialize(List data, ref int i) { ((GunBehaviour)this).MidGameDeserialize(data, ref i); lifeForce = (float)data[i++]; ((GunBehaviour)this).gun.CurrentStrengthTier = _Thresholds.FirstLT(lifeForce) - 1; PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; float num = (float)Mathf.Max(1, Mathf.FloorToInt(playerOwner.ForceZeroHealthState ? ((BraveBehaviour)playerOwner).healthHaver.currentArmor : ((BraveBehaviour)playerOwner).healthHaver.currentHealth)) * 100f; _protectionActive = lifeForce >= num; } } public class IronMaid : CwaffGun { public static string ItemName = "Iron Maid"; public static string ShortDescription = "Night of Knives"; public static string LongDescription = "Fires bullets that quickly decelerate and enter stasis after firing. Reloading or switching to a different gun releases all bullets towards the nearest wall or enemy in the player's line of sight."; public static string Lore = "An urban legend tells the story of a Gungeoneer who happened upon a cosmic rift deep in the Gungeon. Upon entering the rift, they found themselves in a great mansion guarded by a maid who wielded no guns, yet produced more bullets than the mind could comprehend. After holding their own for all of 1.3 seconds, the Gungeoneer was overwhelmed by knife-like projectiles that appeared out of nowhere in seeming defiance of time and space. The Gungeoneer awoke to find themself back in the Breach, with this gun lying by their side as the only evidence of their journey."; private const float _MAX_AIM_DEV = 15f; private int _nextIndex; private Vector2 _whereIsThePlayerLooking; private AIActor _targetEnemy; private LinkedList _bulletsInStasis = new LinkedList(); public static void Init() { //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_067e: Expected O, but got Unknown Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 24; int? reloadFps = 24; Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)2, (GunClass)1, 0.75f, 400, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "knife_gun_launch", "knife_gun_reload", null, -1, -1, -1, null, modulesAreTiers: false, "muzzle_iron_maid", 30, 0.5f, (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).AddReticle(VFX.BasicReticle, 0.4f, 0f, 0f, smoothLerp: true, -1f, 1f, 0f, CwaffReticle.Visibility.ALWAYS).AddToShop((ShopType)3) .AssignGun(out gunRef); int? clipSize = 20; float? cooldown = 0.1f; float? damage = 5f; float? speed = 40f; Color? glowColor = Color.cyan; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "kunai", 12, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, null, null, "knife_hit_enemy_sound", "knife_hit_wall_sound", null, 0f, ignoredForReloadPurposes: false, mirror: false, null, null, null, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: false, 0f, null, 3f, glowColor)).CopyAllImpactVFX(Items.Thunderclap).Attach() .Assign(out Projectile projectileRef); gunRef.AddSynergyModules(Synergy.MASTERY_IRON_MAID, GunBuilder.InitSingleProjectileModule(new ProjectileModule(), GunData.New(gunRef, clipSize: 20, cooldown: 0.1f, angleVariance: 8f, baseProjectile: projectileRef, shootStyle: (ShootStyle)0, sequenceStyle: (ProjectileSequenceStyle)0, chargeTime: 0f, ammoCost: 0, ammoType: null, customClip: false, damage: null, speed: null, force: null, range: null, recoil: null, poison: 0f, fire: 0f, freeze: 0f, slow: 0f, collidesWithEnemies: null, ignoreDamageCaps: null, collidesWithProjectiles: null, surviveRigidbodyCollisions: null, collidesWithTilemap: null, sprite: null, fps: 2, anchor: (Anchor)4, scale: 1f, anchorsChangeColliders: true, fixesScales: true, overrideColliderPixelSizes: null, overrideColliderOffsets: null, bossDamageMult: 1f, destroySound: null, shouldRotate: null, barrageSize: 1, shouldFlipHorizontally: null, shouldFlipVertically: null, useDummyChargeModule: false, invisibleProjectile: false, spawnSound: null, stopSoundOnDeath: null, uniqueSounds: null, shrapnelVFX: null, shrapnelCount: null, shrapnelMinVelocity: null, shrapnelMaxVelocity: null, shrapnelLifetime: null, preventOrbiting: null, hitSound: null, hitEnemySound: null, hitWallSound: null, becomeDebris: null, angleFromAim: 20f, ignoredForReloadPurposes: true, mirror: true))); } private GameObject GetTargetEnemy(CwaffReticle reticle) { if (!Object.op_Implicit((Object)(object)_targetEnemy)) { return null; } return ((Component)_targetEnemy).gameObject; } private Vector2 GetTargetPos(CwaffReticle reticle) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return PointWherePlayerIsLooking(); } public AIActor CurrentTargetEnemy() { if (!Object.op_Implicit((Object)(object)_targetEnemy)) { return null; } return _targetEnemy; } public Vector2 PointWherePlayerIsLooking() { //IL_001a: 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 (!Object.op_Implicit((Object)(object)_targetEnemy)) { return _whereIsThePlayerLooking; } return ((GameActor)_targetEnemy).CenterPosition; } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); ((Component)((GunBehaviour)this).gun).GetComponent().targetPosFunc = GetTargetPos; } public override void OnReloadPressed(PlayerController player, Gun gun, bool manualReload) { base.OnReloadPressed(player, gun, manualReload); LaunchAllBullets(player); } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); LaunchAllBullets(((GunBehaviour)this).PlayerOwner); if (!base.Mastered || ((GunBehaviour)this).gun.ClipShotsRemaining != ((GunBehaviour)this).gun.DefaultModule.numberOfShotsInClip) { return; } foreach (ProjectileModule projectile in ((GunBehaviour)this).gun.Volley.projectiles) { if (((GunBehaviour)this).gun.m_moduleData.TryGetValue(projectile, out var value)) { value.numberShotsFired = 0; } } } public override void OnDroppedByPlayer(PlayerController player) { LaunchAllBullets(player); player.OnReceivedDamage -= LaunchAllBullets; base.OnDroppedByPlayer(player); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { LaunchAllBullets(((GunBehaviour)this).PlayerOwner); } base.OnDestroy(); } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); LaunchAllBullets(((GunBehaviour)this).PlayerOwner); } public int GetNextIndex() { return ++_nextIndex; } private void LaunchAllBullets(GameActor player) { PlayerController val = (PlayerController)(object)((player is PlayerController) ? player : null); if (val != null) { LaunchAllBullets(val); } } private void LaunchAllBullets(PlayerController pc) { int num = 0; foreach (IronMaidBullets bulletsInStasi in _bulletsInStasis) { if (Object.op_Implicit((Object)(object)bulletsInStasi)) { bulletsInStasi.StartLaunchSequence(num++); } } _bulletsInStasis.Clear(); _nextIndex = 0; } private AIActor SwitchTargetEnemy() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null) { return null; } return TransformExtensions.PositionVector2(((GunBehaviour)this).gun.barrelOffset).NearestEnemyWithinConeOfVision(playerOwner.m_currentGunAngle, 15f, 100f, useNearestAngleInsteadOfDistance: true, ignoreWalls: true); } public override void Update() { //IL_0039: 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_0053: Unknown result type (might be due to invalid IL or missing references) base.Update(); if (GameManager.Instance.IsLoadingLevel) { return; } PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null) { _targetEnemy = SwitchTargetEnemy(); if (!Object.op_Implicit((Object)(object)_targetEnemy)) { _whereIsThePlayerLooking = ((GameActor)playerOwner).CenterPosition.ToNearestWallOrEnemyOrObject(((GameActor)playerOwner).CurrentGun.CurrentAngle); } } } public override void PostProcessProjectile(Projectile projectile) { ((GunBehaviour)this).PostProcessProjectile(projectile); IronMaidBullets component = ((Component)projectile).GetComponent(); if (component != null) { component.Setup(this); _bulletsInStasis.AddLast(component); } } } public class IronMaidBullets : MonoBehaviour { private const float _TIME_BEFORE_STASIS = 0.2f; private const float _GLOW_TIME = 0.1f; private const float _GLOW_MAX = 10f; private const float _LAUNCH_DELAY = 0.04f; private const float _LAUNCH_SPEED = 50f; internal const float _BASE_GLOW = 3f; private PlayerController _owner; private Projectile _projectile; private IronMaid _ironMaid; private float _moveTimer; private bool _launchSequenceStarted; private int _index; public void Setup(IronMaid ironMaid) { _ironMaid = ironMaid; } private IEnumerator Start() { _projectile = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); _launchSequenceStarted = false; _index = 0; _moveTimer = 0.2f; float decel = _projectile.baseData.speed / 12f; while (_moveTimer > 0f && !_launchSequenceStarted) { _moveTimer -= BraveTime.DeltaTime; yield return null; _projectile.Accelerate(0f - decel); } _projectile.SetSpeed(0.01f); Vector2 pos = _projectile.SafeCenter; Vector2 targetDir = _projectile.Direction; AIActor targetEnemy = null; while (Object.op_Implicit((Object)(object)_ironMaid)) { targetEnemy = _ironMaid.CurrentTargetEnemy(); targetDir = (Object.op_Implicit((Object)(object)targetEnemy) ? ((GameActor)targetEnemy).CenterPosition : _ironMaid.PointWherePlayerIsLooking()) - pos; _projectile.SendInDirection(targetDir, true, true); if (_launchSequenceStarted) { break; } yield return null; } Material m = ((BraveBehaviour)((BraveBehaviour)_projectile).sprite).renderer.material; ((Component)_projectile).gameObject.PlayUnique("knife_gun_glow"); _moveTimer = 0.1f; while (_moveTimer > 0f) { if (Object.op_Implicit((Object)(object)targetEnemy)) { targetDir = ((GameActor)targetEnemy).CenterPosition - pos; _projectile.SendInDirection(targetDir, true, true); } float num = (0.1f - _moveTimer) / 0.1f; m.SetFloat(CwaffVFX._EmissivePowerId, 3f + num * 10f); _moveTimer -= BraveTime.DeltaTime; yield return null; } _moveTimer = 0.04f * (float)_index; while (_moveTimer > 0f) { if (Object.op_Implicit((Object)(object)targetEnemy)) { targetDir = ((GameActor)targetEnemy).CenterPosition - pos; _projectile.SendInDirection(targetDir, true, true); } _moveTimer -= BraveTime.DeltaTime; yield return null; } _projectile.SetSpeed(50f * (Object.op_Implicit((Object)(object)_owner) ? _owner.ProjSpeedMult() : 1f)); _projectile.SendInDirection(targetDir, true, true); ((Component)_projectile).gameObject.Play("knife_gun_launch"); } public void StartLaunchSequence(int index) { _index = index; _launchSequenceStarted = true; } } public class BlasTechF4 : CwaffGun { public class BlasTechProjectile : MonoBehaviour { private void Start() { //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_0051: 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) Projectile component = ((Component)this).GetComponent(); GameActor owner = component.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (Object.op_Implicit((Object)(object)val) && val.HasSynergy(Synergy.BLASTECH_A1)) { ((Component)component).gameObject.PlayUnique("blastech_fire_sound"); return; } component.Start(); Quaternion rotation = ((BraveBehaviour)component).transform.rotation; float z = ((Quaternion)(ref rotation)).eulerAngles.z; bool flag = Lazy.CoinFlip(); for (float num = 0f; num < 30f; num += Random.Range(1f, 10f)) { float num2 = z + (flag ? num : (0f - num)); if ((!Object.op_Implicit((Object)(object)val) || !component.WouldCollideWithEnemy(num2, accountForWalls: false, pixelPerfect: false, 2)) && (Object.op_Implicit((Object)(object)val) || !component.WouldCollideWithPlayer(num2, accountForWalls: false, pixelPerfect: false, 2))) { if (num2 != z) { component.SendInDirection(num2.ToVector(), true, true); } ((Component)component).gameObject.PlayUnique("blastech_fire_sound"); return; } } if (Object.op_Implicit((Object)(object)val)) { Gun possibleSourceGun = component.PossibleSourceGun; if (possibleSourceGun != null && (Object)(object)possibleSourceGun == (Object)(object)((GameActor)val).CurrentGun && !component.FiredForFree()) { possibleSourceGun.GainAmmo(1); possibleSourceGun.MoveBulletsIntoClip(1); } } ((Component)component).gameObject.PlayUnique("blastech_jam_sound"); component.DieInAir(true, true, true, false); } } public static string ItemName = "BlasTech F-4"; public static string ShortDescription = "Imperial Quality"; public static string LongDescription = "Rapidly fires strong, fast projectiles with absolutely zero side effects."; public static string Lore = "Based on the beloved E-11 model, the BlasTech Alternating F-4 Rifle improves upon the previous generation of blasters in power, speed, range, and precision. The difference in performance is so noticeable that regardless of a Gungeoneer's training or experience, each and every firefight will be more consistent than ever."; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 30; int? reloadFps = 12; Gun gun2 = gun.SetAttributes((ItemQuality)1, (GunClass)55, 0.75f, 1000, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, null, null, null, -1, -1, -1, null, modulesAreTiers: false, "muzzle_blastech", 60, 0.5f, (Anchor)3, -1f, null, -1f, muzzleLit: false, 0f, 0f, null, null, preventRotation: false, 0f, continuousFire: false, dynamicBarrelOffsets: true, banFromBlessedRuns: true, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0).SetReloadAudio("blastech_jam_sound", 0, 2, 4, 5, 6); int? clipSize = 20; float? cooldown = 0.11f; float? damage = 20f; float? speed = 100f; float? range = 9999f; float? force = 12f; bool? ignoreDamageCaps = true; Projectile p = gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, ignoreDamageCaps, null, null, null, "blastech_projectile", 2, (Anchor)4, 0.5f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, null, "generic_bullet_impact")).Attach().Attach((Action)delegate(EasyTrailBullet trail) { //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_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_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_0052: 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_005d: Unknown result type (might be due to invalid IL or missing references) trail.TrailPos = ((BraveBehaviour)trail).transform.position; trail.StartWidth = 0.3f; trail.EndWidth = 0.05f; trail.LifeTime = 0.07f; trail.BaseColor = ExtendedColours.purple; trail.StartColor = Color.Lerp(ExtendedColours.purple, Color.white, 0.25f); trail.EndColor = ExtendedColours.purple; }, allowDuplicates: false); PickupObject obj = ItemHelper.Get(Items.WitchPistol); p.SetAllImpactVFX(((Gun)((obj is Gun) ? obj : null)).DefaultModule.projectiles[0].hitEffects.enemy); } } public class ChekhovsGun : CwaffGun { public static string ItemName = "Chekhov's Gun"; public static string ShortDescription = "Keeps its Promise"; public static string LongDescription = "Places a rifle that automatically fires a single round at any enemy that crosses its line of sight. Rifles cannot fire within 3 seconds of placement. Half of all unfired shots are returned as ammo on room clear."; public static string Lore = "There is no record of this gun having ever been brought into the Gungeon, nor of it having belonged to anyone named Chekhov. Rather, the arcane magics enveloping the Gungeon have seemingly managed to produce a physical manifestation of a purely metaphorical weapon. Whether its unique properties will render it a deus ex machina or a brick joke remains to be seen."; internal static CwaffTrailController _ChekhovTrailPrefab = null; internal static GameObject _ChekhovGunVFX = null; internal static GameObject _ChekhovGunFireVFX = null; private List _extantBullets = new List(); public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 16; int? reloadFps = 16; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)15, 0.75f, 200, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "chekhovs_gun_place_sound", "chekhovs_gun_reload_sound", null, -1, -1, -1, null, modulesAreTiers: false, "muzzle_chekhovs_gun", 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); int? clipSize = 8; float? cooldown = 0.1f; float? damage = 15f; float? range = 1000f; float? speed = 200f; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "chekhov_projectile", 12, (Anchor)4, 0.5f)).Attach(); _ChekhovTrailPrefab = VFX.CreateSpriteTrailObject("chekhov_trail_mid", 60, "chekhov_trail_start", -1f, 1f / 60f, -1f, destroyOnEmpty: true); _ChekhovGunVFX = VFX.Create("chekhovs_gun_idle_vfx", 12f, loops: true, -1, 1f, (Anchor)8, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _ChekhovGunFireVFX = VFX.Create("chekhovs_gun_fire_vfx", 12f, loops: false, -1, 1f, (Anchor)8, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); player.OnRoomClearEvent += OnRoomClear; } public override void OnDroppedByPlayer(PlayerController player) { player.OnRoomClearEvent -= OnRoomClear; base.OnDroppedByPlayer(player); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((GunBehaviour)this).PlayerOwner.OnRoomClearEvent -= OnRoomClear; } base.OnDestroy(); } public override void PostProcessProjectile(Projectile projectile) { ChekhovBullet component = ((Component)projectile).GetComponent(); if (component != null) { _extantBullets.Add(component); } } private void OnRoomClear(PlayerController player) { int num = 0; foreach (ChekhovBullet extantBullet in _extantBullets) { if (!Object.op_Implicit((Object)(object)extantBullet)) { continue; } Projectile component = ((Component)extantBullet).GetComponent(); if (component != null && ((Behaviour)component).isActiveAndEnabled) { component.DieInAir(false, false, false, true); if (!component.FiredForFree()) { num++; } } } _extantBullets.Clear(); if (!base.Mastered) { num /= 2; } ((GunBehaviour)this).gun.GainAmmo(num); } } public class ChekhovBullet : MonoBehaviour { private const float _MIN_FREEZE_TIME = 3f; private const float _SCAN_RATE = 0.1f; private const float _TRAIL_GLOW = 10f; private Projectile _projectile; private GameObject _sightline; private GameObject _gunVfx; public bool mastered; private void Start() { //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) _projectile = ((Component)this).GetComponent(); GameActor owner = _projectile.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null) { mastered = val.HasSynergy(Synergy.MASTERY_CHEKHOVS_GUN); } ((MonoBehaviour)this).StartCoroutine(PlotDevice(Vector3Extensions.XY(((BraveBehaviour)_projectile).transform.right))); } private void OnDestroy() { _sightline.SafeDestroy(); _gunVfx.SafeDestroy(); } private IEnumerator PlotDevice(Vector2 angleVec) { //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) float num = Vector2Extensions.ToAngle(angleVec); Vector2 start = Vector3Extensions.XY(((BraveBehaviour)_projectile).transform.position); GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(Vector2Extensions.ToIntVector2(start, (VectorConversions)2)); float oldSpeed = _projectile.baseData.speed; bool wasElectric = (_projectile.damageTypes & 0x40) > 0; Projectile projectile = _projectile; projectile.damageTypes = (CoreDamageTypes)(projectile.damageTypes & -65); _projectile.SetSpeed(0.0001f); ((BraveBehaviour)_projectile).specRigidbody.CollideWithOthers = false; ((BraveBehaviour)_projectile).specRigidbody.CollideWithTileMap = false; ((BraveBehaviour)((BraveBehaviour)_projectile).sprite).renderer.enabled = false; float num2 = 999f; Vector2 target = Vector2.zero; RaycastResult val = default(RaycastResult); if (PhysicsEngine.Instance.Raycast(start, angleVec, num2, ref val, true, false, int.MaxValue, (CollisionLayer?)null, false, (Func)null, (SpeculativeRigidbody)null)) { num2 = 16f * val.Distance; target = ((CastResult)val).Contact; } RaycastResult.Pool.Free(ref val); _sightline = VFX.CreateLaserSight(start, num2, 1f, num, Color.white); _sightline.SetAlpha(0.05f); _gunVfx = SpawnManager.SpawnVFX(ChekhovsGun._ChekhovGunVFX, Vector2.op_Implicit(start), num.EulerZ(), true); ((tk2dBaseSprite)(object)_gunVfx.GetComponent()).PlaceAtRotatedPositionByAnchor(Vector2.op_Implicit(start), (Anchor)4); float lifeTime = 0f; if (!mastered) { while (lifeTime < 3f) { lifeTime += BraveTime.DeltaTime; _gunVfx.SetAlpha(Mathf.Max(0.1f, 1f - lifeTime)); yield return null; } } float lastScan = 0f; while (true) { yield return null; lifeTime += BraveTime.DeltaTime; if (!(BraveTime.ScaledTimeSinceStartup - lastScan < 0.1f)) { lastScan = BraveTime.ScaledTimeSinceStartup; if (Lazy.AnyEnemyInLineOfSight(start, target)) { break; } } } ((Component)this).gameObject.PlayUnique("chekhovs_gun_launch_sound_alt"); ((Component)((BraveBehaviour)(object)_projectile).AddTrail(ChekhovsGun._ChekhovTrailPrefab)).gameObject.SetGlowiness(10f); Object.Destroy((Object)(object)_sightline); _sightline = null; GameObject chekhovGunFireVFX = ChekhovsGun._ChekhovGunFireVFX; Vector3 position = _gunVfx.transform.position; Quaternion? rotation = _gunVfx.transform.rotation; float? fadeOutTime = 0.25f; CwaffVFX.Spawn(chekhovGunFireVFX, position, rotation, null, 0.25f, fadeOutTime); Object.Destroy((Object)(object)_gunVfx); _gunVfx = null; ((BraveBehaviour)_projectile).specRigidbody.CollideWithOthers = true; ((BraveBehaviour)_projectile).specRigidbody.CollideWithTileMap = true; _projectile.SetSpeed(oldSpeed); if (wasElectric) { Projectile projectile2 = _projectile; projectile2.damageTypes = (CoreDamageTypes)(projectile2.damageTypes | 0x40); } EasyTrailBullet easyTrailBullet = ((Component)_projectile).gameObject.AddComponent(); easyTrailBullet.StartWidth = 0.1f; easyTrailBullet.EndWidth = 0f; easyTrailBullet.LifeTime = 0.25f; easyTrailBullet.BaseColor = Color.yellow; easyTrailBullet.StartColor = Color.yellow; easyTrailBullet.EndColor = Color.yellow; } } public class AimuHakurei : CwaffGun { public static string ItemName = "Aimu Hakurei"; public static string ShortDescription = "Highly Responsive"; public static string LongDescription = "Passively grants the ability to graze enemy projectiles. Fires additional projectiles based on graze level, which increases at 10, 30, 60, and 100 graze. Reloading toggles focus mode, which slows time to enable precision grazing. Reloading, firing, dodge rolling, or switching guns cancels focus mode. Graze naturally decays over time and cannot be gained while invulnerable."; public static string Lore = "One of the finest weapons ever crafted in Gunsokyo, a land whose denizens are renowned for their otherworldly bullet-dodging abilities that would put most Gungeoneers to shame. The potential dakka output of this gun is enough to keep up even with these impressive abilities. However, the Gunsokyo warriors being the showboats that they are, reaching this gun's full potential requires placing oneself in some rather precarious situations, making it a weapon of truly ludicrous risk and reward."; internal const float _GRAZE_THRES = 1.5f; internal const float _GRAZE_THRES_SQUARED = 2.25f; internal const float _GRAZE_DECAY_RATE = 0.75f; internal const float _GRAZE_COOLDOWN = 1f; internal const int _GRAZE_PER_PROJECTILE = 5; internal const int _GRAZE_MAX = 120; internal static readonly int[] _GRAZE_TIER_THRESHOLDS = new int[4] { 10, 30, 60, 100 }; internal static Projectile _ProjBase; internal static GameObject _GrazeVFX; public int graze; private float _lastDecayTime; private bool _focused; private static LinkedList _GrazeCandidates = new LinkedList(); public static void Init() { //IL_0627: Unknown result type (might be due to invalid IL or missing references) //IL_0696: Unknown result type (might be due to invalid IL or missing references) //IL_06c9: Unknown result type (might be due to invalid IL or missing references) //IL_0862: Unknown result type (might be due to invalid IL or missing references) //IL_0887: Unknown result type (might be due to invalid IL or missing references) //IL_0911: Unknown result type (might be due to invalid IL or missing references) //IL_0936: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 60; gun.SetAttributes((ItemQuality)3, (GunClass)10, 0f, 200, Items.Banana, defaultAudio: false, infiniteAmmo: true, canGainAmmo: false, canReloadNoMatterAmmo: true, null, null, shootFps, null, null, null, null, null, null, -1, -1, -1, null, modulesAreTiers: true, "muzzle_aimu", 30, 0.3f, (Anchor)4, -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).Attach((Action)null, allowDuplicates: false).AddToShop(ModdedShopType.TimeTrader) .AssignGun(out Gun gunRef); Gun gun2 = gunRef; float? damage = 8f; float? speed = 44f; float? range = 100f; float? force = 3f; _ProjBase = gun2.InitFirstProjectile(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, "aimu_projectile", 2, (Anchor)4, 0.625f)); speed = 16f; damage = 300f; Projectile p = Items._38Special.CloneProjectile(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, speed, damage, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, "aimu_beam_sound_2")); Color? emissiveColour = new Color(1f, 0.5f, 0.75f); Projectile target = p.SetAllImpactVFX(VFX.CreatePool("aimu_beam_impact", 20f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 2f, emissiveColour, orphaned: false, attached: true, unlit: false, 0f, 0f, null, 8f)); GameObject dispersalPrefab = Lazy.DispersalParticles(ExtendedColours.pink); force = 2f; range = 8f; Color? emissiveColor = new Color(1f, 0.5f, 0.75f); Projectile item = target.AttachTrail("aimu_beam_mid", 60, "aimu_beam_start", -1f, 1f / 60f, 1f, destroyOnEmpty: true, dispersalPrefab, null, force, range, emissiveColor); gunRef.Volley.projectiles = new List { AimuMod(gun: gunRef, projectiles: new List { AimuProj(invert: false, 0f, "aimu_shoot_sound", 0.2f) }, fireRate: 16f, level: 1), AimuMod(gun: gunRef, projectiles: new List { AimuProj(invert: false, 0.75f, "aimu_shoot_sound", 0.3f), AimuProj(invert: true, 0.75f, "aimu_shoot_sound", 0.3f) }, fireRate: 12f, level: 2), AimuMod(gun: gunRef, projectiles: new List { AimuProj(invert: false, 0.75f, "aimu_shoot_sound", 0.4f), AimuProj(invert: true, 0.75f, "aimu_shoot_sound", 0.4f) }, fireRate: 8f, level: 3), AimuMod(gun: gunRef, projectiles: new List { AimuProj(invert: false, 0.75f, "aimu_shoot_sound", 0.5f), AimuProj(invert: true, 0.75f, "aimu_shoot_sound", 0.5f), AimuProj(invert: false, 2.25f, "aimu_shoot_sound_alt", 0.5f, Color.white), AimuProj(invert: true, 2.25f, "aimu_shoot_sound_alt", 0.5f, Color.white) }, fireRate: 4f, level: 4), AimuMod(gun: gunRef, projectiles: new List { AimuProj(invert: false, 0.75f, "aimu_shoot_sound", 0.5f), AimuProj(invert: true, 0.75f, "aimu_shoot_sound", 0.5f), AimuProj(invert: false, 2.25f, "aimu_shoot_sound_alt", 0.5f, Color.white), AimuProj(invert: true, 2.25f, "aimu_shoot_sound_alt", 0.5f, Color.white), item }, fireRate: 2f, level: 5) }; _GrazeVFX = VFX.Create("graze_vfx", 5f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 5f); } public override void OnPostFired(PlayerController player, Gun gun) { ((GunBehaviour)this).OnPostFired(player, gun); SetFocus(focus: false); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); graze = 0; ((GunBehaviour)this).gun.CurrentStrengthTier = 0; SetFocus(focus: false); player.OnRollStarted += OnDodgeRoll; player.OnReceivedDamage += OnReceivedDamage; } private void OnReceivedDamage(PlayerController player) { if (player.HasSynergy(Synergy.LOTUS_LAND_STORY)) { graze = 120; PowerUp(); } } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); player.OnRollStarted -= OnDodgeRoll; player.OnReceivedDamage -= OnReceivedDamage; } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((GunBehaviour)this).PlayerOwner.OnRollStarted -= OnDodgeRoll; ((GunBehaviour)this).PlayerOwner.OnReceivedDamage -= OnReceivedDamage; } base.OnDestroy(); } private void OnDodgeRoll(PlayerController player, Vector2 dirVec) { SetFocus(focus: false); } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); SetFocus(focus: false); } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); SetFocus(focus: false); } public override void OnReloadPressed(PlayerController player, Gun gun, bool manualReload) { base.OnReloadPressed(player, gun, manualReload); if (!player.IsDodgeRolling && player.AcceptingNonMotionInput) { SetFocus(!_focused); } } private void SetFocus(bool focus) { if (focus != _focused) { _focused = focus; ((PickupObject)((GunBehaviour)this).gun).CanBeDropped = !focus; BraveTime.SetTimeScaleMultiplier((!focus) ? 1f : (base.Mastered ? 0.4f : 0.65f), ((Component)this).gameObject); if (_focused) { ((Component)((GunBehaviour)this).PlayerOwner).gameObject.Play("aimu_focus_sound"); } GunTools.RemoveStatFromGun(((GunBehaviour)this).gun, (StatType)0); ((GunBehaviour)this).gun.AddStatToGun(((StatType)0).Mult((focus && !base.Mastered) ? 0.65f : 1f)); ((GunBehaviour)this).PlayerOwner.stats.RecalculateStats(((GunBehaviour)this).PlayerOwner, false, false); } } private static ProjectileModule AimuMod(List projectiles, float fireRate, int level, Gun gun) { //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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Expected O, but got Unknown return GunBuilder.SetAttributes(new ProjectileModule { projectiles = projectiles, burstShotCount = projectiles.Count, burstCooldownTime = 1f / 60f * fireRate }, GunData.New(gun, null, -1, 1f / 60f * fireRate, 15f - (float)(2 * level), (ShootStyle)4, (ProjectileSequenceStyle)1, 0f, 0, null, customClip: true, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4)); } private static Projectile AimuProj(bool invert, float amplitude, string sound, float trailWidth, Color? trailColor = null) { Projectile obj = _ProjBase.ClonePrefab(deactivate: true, markFake: true, dontUnload: true); ((Component)obj).gameObject.AddComponent().Setup(invert, amplitude, sound); AddTrail(obj, trailWidth, trailColor); return obj; } private static void AddTrail(Projectile p, float trailWidth, Color? trailColor = 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_0026: 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_0035: 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_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_0072: 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_00a8: 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_009f: 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) EasyTrailBullet easyTrailBullet = ((Component)p).gameObject.AddComponent(); easyTrailBullet.TrailPos = Vector2.op_Implicit(Vector3Extensions.XY(((BraveBehaviour)p).transform.position) + new Vector2(0.3125f, 0.3125f)); easyTrailBullet.StartWidth = trailWidth; easyTrailBullet.EndWidth = 0.05f; easyTrailBullet.LifeTime = 0.1f; easyTrailBullet.BaseColor = (Color)(((??)trailColor) ?? Color.Lerp(Color.magenta, Color.red, 0.5f)); easyTrailBullet.EndColor = (Color)(((??)trailColor) ?? Color.Lerp(Color.magenta, Color.red, 0.5f)); } public override void Update() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) base.Update(); PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null && (int)playerOwner.CurrentInputState != 0) { SetFocus(focus: false); } } public override void OwnedUpdatePlayer(PlayerController player, GunInventory inventory) { ((GunBehaviour)this).OwnedUpdatePlayer(player, inventory); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).gun)) { UpdateGraze(); } } private void PowerUp() { while (((GunBehaviour)this).gun.CurrentStrengthTier < _GRAZE_TIER_THRESHOLDS.Length && graze >= _GRAZE_TIER_THRESHOLDS[((GunBehaviour)this).gun.CurrentStrengthTier]) { Gun gun = ((GunBehaviour)this).gun; int currentStrengthTier = gun.CurrentStrengthTier + 1; gun.CurrentStrengthTier = currentStrengthTier; ((Component)((GunBehaviour)this).PlayerOwner).gameObject.PlayOnce("aimu_power_up_sound"); ((Component)((GunBehaviour)this).gun).gameObject.SetGlowiness(((GunBehaviour)this).gun.CurrentStrengthTier * ((GunBehaviour)this).gun.CurrentStrengthTier); } } private void PowerDown() { while (((GunBehaviour)this).gun.CurrentStrengthTier > 0 && graze < _GRAZE_TIER_THRESHOLDS[((GunBehaviour)this).gun.CurrentStrengthTier - 1]) { Gun gun = ((GunBehaviour)this).gun; int currentStrengthTier = gun.CurrentStrengthTier - 1; gun.CurrentStrengthTier = currentStrengthTier; ((Component)((GunBehaviour)this).gun).gameObject.SetGlowiness(((GunBehaviour)this).gun.CurrentStrengthTier * ((GunBehaviour)this).gun.CurrentStrengthTier); } } private void UpdateGraze() { //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_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_0097: 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_0222: 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_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_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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)this)) { return; } PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null) { return; } if (graze > 0 && _lastDecayTime + 0.75f <= BraveTime.ScaledTimeSinceStartup) { graze--; PowerDown(); _lastDecayTime = BraveTime.ScaledTimeSinceStartup; } float num = 2.25f * (base.Mastered ? 2f : 1f); bool flag = Object.op_Implicit((Object)(object)((BraveBehaviour)playerOwner).healthHaver) && ((BraveBehaviour)playerOwner).healthHaver.IsVulnerable; Vector2 centerPosition = ((GameActor)playerOwner).CenterPosition; Vector2 val = Vector2.op_Implicit(playerOwner.SpriteBottomCenter); int count = _GrazeCandidates.Count; LinkedListNode linkedListNode = _GrazeCandidates.First; Vector2 val2; for (int i = 0; i < count; i++) { LinkedListNode next = linkedListNode.Next; Projectile value = linkedListNode.Value; if (Object.op_Implicit((Object)(object)value) && ((Behaviour)value).isActiveAndEnabled && Object.op_Implicit((Object)(object)((BraveBehaviour)value).sprite) && Object.op_Implicit((Object)(object)((BraveBehaviour)((BraveBehaviour)value).sprite).renderer) && ((BraveBehaviour)((BraveBehaviour)value).sprite).renderer.enabled && value.collidesWithPlayer && !(value.Owner is PlayerController) && (value.HeadingTowardPlayer(playerOwner) || value.Direction == Vector2.zero)) { val2 = value.SafeCenter - centerPosition; if (((Vector2)(ref val2)).sqrMagnitude <= num) { linkedListNode = next; continue; } } if (!flag) { _GrazeCandidates.Remove(linkedListNode); linkedListNode = next; continue; } if (base.Mastered && !_focused && Object.op_Implicit((Object)(object)value) && !(value.Owner is PlayerController)) { PassiveReflectItem.ReflectBullet(value, true, (GameActor)(object)((GunBehaviour)this).PlayerOwner, 30f, 1f, 1f, 0f); ((Component)((GunBehaviour)this).PlayerOwner).gameObject.Play("aimu_reflect_sound"); } else { ((Component)((GunBehaviour)this).PlayerOwner).gameObject.Play("aimu_graze_sound"); } graze = Mathf.Min(graze + 5, 120); GameObject grazeVFX = _GrazeVFX; Vector3 position = Vector2.op_Implicit(val); Vector2? velocity = new Vector2(0f, 5f); float? fadeOutTime = 0.4f; CwaffVFX.Spawn(grazeVFX, position, null, velocity, 0.2f, fadeOutTime); PowerUp(); _GrazeCandidates.Remove(linkedListNode); linkedListNode = next; } if (!flag) { return; } foreach (Projectile allProjectile in StaticReferenceManager.AllProjectiles) { if (Object.op_Implicit((Object)(object)allProjectile) && ((Behaviour)allProjectile).isActiveAndEnabled && Object.op_Implicit((Object)(object)((BraveBehaviour)allProjectile).sprite) && Object.op_Implicit((Object)(object)((BraveBehaviour)((BraveBehaviour)allProjectile).sprite).renderer) && ((BraveBehaviour)((BraveBehaviour)allProjectile).sprite).renderer.enabled && allProjectile.collidesWithPlayer && !(allProjectile.Owner is PlayerController) && !_GrazeCandidates.Contains(allProjectile)) { val2 = allProjectile.SafeCenter - centerPosition; if (((Vector2)(ref val2)).sqrMagnitude <= num && (allProjectile.Direction == Vector2.zero || allProjectile.HeadingTowardPlayer(playerOwner))) { _GrazeCandidates.AddLast(allProjectile); } } } } } public class AimuHakureiAmmoDisplay : CustomAmmoDisplay { private Gun _gun; private AimuHakurei _aimu; private PlayerController _owner; private void Start() { _gun = ((Component)this).GetComponent(); _aimu = ((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) { //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_0083: 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) if (!Object.op_Implicit((Object)(object)_owner)) { return false; } if (_gun.CurrentStrengthTier < 4) { uic.SetAmmoCountLabelColor(Color.magenta); uic.GunAmmoCountLabel.Text = $"{_aimu.graze} - L{1 + _gun.CurrentStrengthTier}"; } else { float num = Mathf.Sin(4f * BraveTime.ScaledTimeSinceStartup); uic.SetAmmoCountLabelColor(Color.Lerp(Color.magenta, Color.cyan, Mathf.Abs(num))); uic.GunAmmoCountLabel.Text = $"{_aimu.graze} - MAX"; } return true; } } public class AimuHakureiProjectileBehavior : MonoBehaviour { public bool invert; public float amplitude; public string sound; public void Setup(bool invert, float amplitude, string sound) { this.invert = invert; this.amplitude = amplitude; this.sound = sound; } private void Start() { ((Component)this).GetComponent().OverrideMotionModule = (ProjectileMotionModule)(object)new AimuHakureiProjectileMotionModule { ForceInvert = invert, amplitude = amplitude }; ((Component)this).gameObject.Play(sound); } } public class AimuHakureiProjectileMotionModule : ProjectileMotionModule { public float wavelength = 8f; public float amplitude; public bool ForceInvert; private bool _initialized; private Vector2 _initialRightVector; private Vector2 _initialUpVector; private Vector2 _privateLastPosition; private float _xDisplacement; private float _yDisplacement; private void ResetAngle(float angleDiff) { //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_001b: 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_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_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_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_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) if (!float.IsNaN(angleDiff)) { Quaternion val = Quaternion.Euler(0f, 0f, angleDiff); _initialUpVector = Vector2.op_Implicit(val * Vector2.op_Implicit(_initialUpVector)); _initialRightVector = Vector2.op_Implicit(val * Vector2.op_Implicit(_initialRightVector)); } } public override void UpdateDataOnBounce(float angleDiff) { ResetAngle(angleDiff); } public override void AdjustRightVector(float angleDiff) { ResetAngle(angleDiff); } private void Initialize(Vector2 lastPosition, Transform projectileTransform, float m_timeElapsed, Vector2 m_currentDirection, bool shouldRotate) { //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_0019: 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_0012: 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_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_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_0026: 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) _privateLastPosition = lastPosition; _initialRightVector = ((!shouldRotate) ? m_currentDirection : Vector3Extensions.XY(projectileTransform.right)); _initialUpVector = Vector2.op_Implicit((!shouldRotate) ? (Quaternion.Euler(0f, 0f, 90f) * Vector2.op_Implicit(m_currentDirection)) : projectileTransform.up); _initialized = true; _xDisplacement = 0f; _yDisplacement = 0f; } public override void Move(Projectile source, Transform projectileTransform, tk2dBaseSprite projectileSprite, SpeculativeRigidbody specRigidbody, ref float m_timeElapsed, ref Vector2 m_currentDirection, bool Inverted, bool shouldRotate) { //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) //IL_0010: 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_002c: 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_00a9: 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_00b6: 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) //IL_00c1: 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_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_00d3: 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) //IL_0129: 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_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_013b: 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_011f: 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_016b: 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) ProjectileData baseData = source.baseData; Vector2 val = ((!Object.op_Implicit((Object)(object)projectileSprite)) ? Vector3Extensions.XY(projectileTransform.position) : projectileSprite.WorldCenter); if (!_initialized) { Initialize(val, projectileTransform, m_timeElapsed, m_currentDirection, shouldRotate); } m_timeElapsed += BraveTime.DeltaTime; int num = ((!(Inverted ^ ForceInvert)) ? 1 : (-1)); float num2 = (float)Math.PI * baseData.speed / wavelength; float num3 = m_timeElapsed * baseData.speed; float num4 = (float)num * amplitude * Mathf.Sin(m_timeElapsed * num2); float num5 = num3 - _xDisplacement; float num6 = num4 - _yDisplacement; Vector2 val2 = (_privateLastPosition = _privateLastPosition + _initialRightVector * num5 + _initialUpVector * num6); if (shouldRotate) { float num7 = BraveMathCollege.Atan2Degrees((float)num * amplitude * Mathf.Sin((m_timeElapsed + 0.01f) * num2) - num4, 0.01f * baseData.speed); projectileTransform.localRotation = (num7 + Vector2Extensions.ToAngle(_initialRightVector)).EulerZ(); } Vector2 val3 = (val2 - val) / BraveTime.DeltaTime; if (!float.IsNaN(BraveMathCollege.Atan2Degrees(val3))) { m_currentDirection = ((Vector2)(ref val3)).normalized; } _xDisplacement = num3; _yDisplacement = num4; specRigidbody.Velocity = val3; } public override void SentInDirection(ProjectileData baseData, Transform projectileTransform, tk2dBaseSprite projectileSprite, SpeculativeRigidbody specRigidbody, ref float m_timeElapsed, ref Vector2 m_currentDirection, bool shouldRotate, Vector2 dirVec, bool resetDistance, bool updateRotation) { //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_000a: 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) Initialize((!Object.op_Implicit((Object)(object)projectileSprite)) ? Vector3Extensions.XY(projectileTransform.position) : projectileSprite.WorldCenter, projectileTransform, m_timeElapsed, m_currentDirection, shouldRotate); } } 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.25f, 1.0625f, 0f); private static readonly Vector3 _PogoRightHandOffset = new Vector3(0.1875f, 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, 1f, preventDuctTape: false, 0.5f, preventVolleyModifications: false, undroppableStarter: 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, 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 PlatinumStar : CwaffGun { public static string ItemName = "Platinum Star"; public static string ShortDescription = "Unbreakable"; public static string LongDescription = "Fires projectiles that deal no damage upon initial impact. When reloaded, summons manifestations of the user's soul to attack all previously-shot enemies with a flurry of rapid punches."; public static string Lore = "This gun had a large golden arrow pierced through its barrel and grip when it was originally discovered by Ox and Cadence lying in a patch of flowers behind the Gungeon. The arrow had mysteriously vanished by the time they had gotten back to the Breach to test out the gun's capabilities, which by all accounts seemed to be nothing more than rapid-firing some harmless phantom projectiles. Having deemed the gun worthless in combat, Cadence tossed it back outside where she found it, only for it to vanish before hitting the ground. Somehow, it has found its way into the Gungeon on its own."; internal static Projectile _OraBullet; internal static GameObject _MenacingVFX = null; public static void Init() { //IL_0057: 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) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 20; int? reloadFps = 40; Color? muzzleEmissionColor = new Color(0.75f, 0.55f, 0.5f); Color? muzzleLightColor = Color.magenta; Gun gun2 = gun.SetAttributes((ItemQuality)4, (GunClass)1, 1f, 480, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "platinum_fire_sound", null, null, -1, -1, -1, null, modulesAreTiers: false, "muzzle_platinum_star", 60, 1f, (Anchor)4, 2f, muzzleEmissionColor, 12f, muzzleLit: false, 7.5f, 1.375f, muzzleLightColor, 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: false, 1f, preventDuctTape: false, 0.85f).SetReloadAudio("platinum_reload_sound", 5).AddToShop(ModdedShopType.TimeTrader); int? clipSize = 28; float? cooldown = 0.125f; float? angleVariance = 15f; float? damage = 3f; float? speed = 50f; float? force = 1f; float? range = 50f; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "platinum_star_projectile", 12, (Anchor)3, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, "tomislav_shoot")).Attach(); range = 1f; force = 75f; speed = 0.1f; damage = 3f; bool? shouldRotate = true; _OraBullet = Items.Polaris.CloneProjectile(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, range, force, speed, damage, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, shouldRotate)).AddAnimations(AnimatedBullet.Create("ora_fist_fast", 12, (Anchor)5, 0.33f)).Attach((Action)delegate(PierceProjModifier pierce) { pierce.penetration = 999; }, allowDuplicates: false) .Attach(); _MenacingVFX = VFX.Create("menacing_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 3f); } public override void OnTriedToInitiateAttack(PlayerController player) { base.OnTriedToInitiateAttack(player); if (JojoReferenceHandler.TimeIsFrozen()) { player.SuppressThisClick = true; } } public override void OnReloadPressed(PlayerController player, Gun gun, bool manual) { base.OnReloadPressed(player, gun, manual); LaunchAllBullets(((GunBehaviour)this).PlayerOwner); if (gun.IsReloading) { gun.muzzleFlashEffects.DestroyAll(); } } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); LaunchAllBullets(((GunBehaviour)this).PlayerOwner); } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); LaunchAllBullets(((GunBehaviour)this).PlayerOwner); } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); LaunchAllBullets(((GunBehaviour)this).PlayerOwner); } private void LaunchAllBullets(PlayerController pc) { foreach (AIActor allEnemy in StaticReferenceManager.AllEnemies) { if (Object.op_Implicit((Object)(object)allEnemy)) { ((Component)allEnemy).GetComponent()?.OraOraOra(pc); } } } public override void Update() { base.Update(); tk2dSpriteAnimationClip currentClip = ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.currentClip; if (currentClip != null) { ((GunBehaviour)this).gun.preventRotation = currentClip.name == ((GunBehaviour)this).gun.reloadAnimation; } } } public class ImmuneToTimestop : MonoBehaviour { } public class PlatinumProjectile : MonoBehaviour { private Projectile _projectile; private PlayerController _owner; private float _bankedDamage; private float _angle; private void Start() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) _projectile = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); _angle = Vector2Extensions.ToAngle(_projectile.Direction); _bankedDamage = _projectile.baseData.damage; _projectile.baseData.damage = 0f; Projectile projectile = _projectile; projectile.OnHitEnemy = (Action)Delegate.Combine(projectile.OnHitEnemy, new Action(OnHitEnemy)); } private void OnHitEnemy(Projectile p, SpeculativeRigidbody enemy, bool killed) { ((Component)p).gameObject.Play("soul_kaliber_impact"); GameObjectExtensions.GetOrAddComponent(((Component)enemy).gameObject).BankDamage(_bankedDamage, _angle); } } public class JojoReferenceHandler : MonoBehaviour { [HarmonyPatch(/*Could not decode attribute arguments.*/)] private class ProjectileLocalTimeScalePatch { private static bool Prefix(Projectile __instance, ref float __result) { if (!Instance._timeIsStopped) { return true; } if (Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { return true; } __result = 0f; return false; } } private static JojoReferenceHandler _instance; private float _timestopTime; private bool _timeIsStopped; private static JojoReferenceHandler Instance { get { if (!Object.op_Implicit((Object)(object)_instance)) { _instance = ((Component)(object)GameManager.Instance).AddComponent(); } return _instance; } } public static bool TimeIsFrozen() { return Instance._timeIsStopped; } public static void RefreshTimeStop(float duration = 0.5f) { if (!(duration <= 0f)) { if (Instance._timestopTime < duration) { Instance._timestopTime = duration; } if (!Instance._timeIsStopped) { StopTime(); } Instance._timeIsStopped = true; } } private void Update() { if (_timeIsStopped && !((_timestopTime -= BraveTime.DeltaTime) > 0f)) { _timestopTime = 0f; ResumeTime(); _timeIsStopped = false; } } private static void StopTime() { PlayerController bestActivePlayer = GameManager.Instance.BestActivePlayer; if (bestActivePlayer == null) { return; } RoomHandler currentRoom = bestActivePlayer.CurrentRoom; if (currentRoom == null) { return; } List activeEnemies = currentRoom.activeEnemies; if (activeEnemies == null) { return; } foreach (AIActor item in activeEnemies) { if (Object.op_Implicit((Object)(object)item)) { item.LocalTimeScale = 0f; } } Pixelator.Instance.DoFinalNonFadedLayer = true; PlayerController[] allPlayers = GameManager.Instance.AllPlayers; foreach (PlayerController val in allPlayers) { if (Object.op_Implicit((Object)(object)val)) { GameObjectExtensions.SetLayerRecursively(((Component)val).gameObject, LayerMask.NameToLayer("Unfaded")); } } Pixelator.Instance.saturation = 0f; AkSoundEngine.PostEvent("Stop_SND_All", ((Component)bestActivePlayer).gameObject); AkSoundEngine.StopAll(); } private static void ResumeTime() { PlayerController bestActivePlayer = GameManager.Instance.BestActivePlayer; if (bestActivePlayer == null) { return; } RoomHandler currentRoom = bestActivePlayer.CurrentRoom; if (currentRoom == null) { return; } List activeEnemies = currentRoom.activeEnemies; if (activeEnemies == null) { return; } foreach (AIActor item in activeEnemies) { if (Object.op_Implicit((Object)(object)item)) { item.LocalTimeScale = 1f; } } Pixelator.Instance.DoFinalNonFadedLayer = false; PlayerController[] allPlayers = GameManager.Instance.AllPlayers; foreach (PlayerController val in allPlayers) { if (Object.op_Implicit((Object)(object)val)) { GameObjectExtensions.SetLayerRecursively(((Component)val).gameObject, LayerMask.NameToLayer("FG_Reflection")); } } Pixelator.Instance.saturation = 1f; GameManager.Instance.DungeonMusicController.ResetForNewFloor(GameManager.Instance.Dungeon); GameManager.Instance.DungeonMusicController.NotifyEnteredNewRoom(currentRoom); } } public class OraOra : MonoBehaviour { private const float _HIT_DELAY = 0.1f; private const float _DELAY_DECAY = 0.01f; private const float _ANGLE_VARIANCE = 45f; private const float _MOVE_TIME = 0.1f; private const int _BURST_SIZE = 4; private AIActor _enemy; private GameObject _stand; private List _bankedDamage = new List(); private List _bankedAngles = new List(); private bool _activated; private void Start() { _enemy = ((Component)this).GetComponent(); } private void OnDestroy() { _stand.SafeDestroy(); _stand = null; } public void BankDamage(float damage, float angle) { if (!_activated) { _bankedDamage.Add(damage); _bankedAngles.Add(angle); } } public void OraOraOra(PlayerController pc) { if (!_activated && _bankedDamage.Count != 0) { _activated = true; ((MonoBehaviour)this).StartCoroutine(OraOraOraOra(pc)); } } private void DoMenacingVFX(Projectile p) { //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_0010: 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_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_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) GameObject menacingVFX = PlatinumStar._MenacingVFX; Vector3 position = Vector2.op_Implicit(p.SafeCenter); Quaternion? rotation = Quaternion.identity; Vector2 val = ((BraveBehaviour)p).specRigidbody.Velocity.Rotate(Random.Range(-30f, 30f)); Vector2? velocity = 15f * ((Vector2)(ref val)).normalized; float? fadeOutTime = 0.05f; float? startScale = 0.5f; float? endScale = 1f; CwaffVFX.Spawn(menacingVFX, position, rotation, velocity, 0.35f, fadeOutTime, 3f, null, fadeIn: false, startScale, endScale); } private void DoHit(Projectile p) { ((Component)p).gameObject.PlayUnique("ora_hit_sound"); DoMenacingVFX(p); } private void DoFinalHit(Projectile p) { ((Component)p).gameObject.Play("ora_final_hit_sound"); DoMenacingVFX(p); } private IEnumerator OraOraOraOra(PlayerController pc) { bool doTimeFreeze = pc.HasSynergy(Synergy.MASTERY_PLATINUM_STAR); float lumpDamage = (doTimeFreeze ? (4f * _bankedDamage.Sum()) : 0f); if (Object.op_Implicit((Object)(object)_enemy)) { HealthHaver hh = ((BraveBehaviour)_enemy).healthHaver; if (hh != null) { while (!Object.op_Implicit((Object)(object)_enemy) || !Object.op_Implicit((Object)(object)((BraveBehaviour)_enemy).sprite) || !((BraveBehaviour)((BraveBehaviour)_enemy).sprite).renderer.enabled || !hh.IsVulnerable) { if (!Object.op_Implicit((Object)(object)hh) || !hh.IsAlive) { yield break; } yield return null; } Bounds bounds = ((BraveBehaviour)_enemy).sprite.GetBounds(); Vector2 val = Vector3Extensions.XY(((Bounds)(ref bounds)).size); float num = 0.5f * Mathf.Max(val.x, val.y); float offset = num + 2f; List bankedDamage = new List(_bankedDamage); List bankedAngles = new List(_bankedAngles); _bankedDamage.Clear(); _bankedAngles.Clear(); tk2dSprite standSprite = Lazy.SpriteObject(((BraveBehaviour)pc).spriteAnimator.CurrentClip.frames[0].spriteCollection, ((BraveBehaviour)pc).spriteAnimator.GetClipByName(Lazy.GetBaseIdleAnimationName(pc, bankedAngles[0])).frames[0].spriteId); ((tk2dBaseSprite)standSprite).usesOverrideMaterial = true; ((BraveBehaviour)standSprite).renderer.material.shader = ShaderCache.Acquire("Brave/Internal/HologramShader"); _stand = ((Component)standSprite).gameObject; if (doTimeFreeze) { GameObjectExtensions.SetLayerRecursively(_stand, LayerMask.NameToLayer("Unfaded")); JojoReferenceHandler.RefreshTimeStop(); } for (float elapsed = BraveTime.DeltaTime; elapsed < 0.1f; elapsed += BraveTime.DeltaTime) { float num2 = elapsed / 0.1f; ((tk2dBaseSprite)standSprite).PlaceAtPositionByAnchor(Vector2.op_Implicit(Vector2.Lerp(((GameActor)pc).CenterPosition, ((GameActor)_enemy).CenterPosition - bankedAngles[0].ToVector(offset + 0.5f), num2)), (Anchor)4); yield return null; } float baseDelay = 0.1f; int numBursts = bankedDamage.Count; BehaviorSpeculator spec = ((BraveBehaviour)_enemy).behaviorSpeculator; int i = 0; while (i < numBursts && Object.op_Implicit((Object)(object)_enemy) && Object.op_Implicit((Object)(object)((BraveBehaviour)_enemy).healthHaver) && ((BraveBehaviour)_enemy).healthHaver.IsAlive) { float elapsed = bankedDamage[i]; bool lastBurst = i == numBursts - 1; ((tk2dBaseSprite)standSprite).SetSprite(((BraveBehaviour)pc).spriteAnimator.GetClipByName(Lazy.GetBaseIdleAnimationName(pc, bankedAngles[i])).frames[0].spriteId); ((tk2dBaseSprite)standSprite).PlaceAtPositionByAnchor(Vector2.op_Implicit(((GameActor)_enemy).CenterPosition - bankedAngles[i].ToVector(offset + 0.5f)), (Anchor)4); ((tk2dBaseSprite)standSprite).FlipX = Mathf.Abs(bankedAngles[i].Clamp180()) > 90f; int num4; for (int j = 0; j < 4; j = num4) { bool num3 = lastBurst && j == 3; float self = (bankedAngles[i] + Random.Range(-45f, 45f)).Clamp360(); Vector2 val2 = self.ToVector(offset); Vector2 val3 = ((GameActor)_enemy).CenterPosition - val2; Projectile component = SpawnManager.SpawnProjectile(((Component)PlatinumStar._OraBullet).gameObject, Vector2.op_Implicit(val3), self.EulerZ(), true).GetComponent(); component.Owner = (GameActor)(object)pc; component.Shooter = ((BraveBehaviour)pc).specRigidbody; ((Component)component).gameObject.SetAlphaImmediate(0.3f); component.baseData.damage = (doTimeFreeze ? 0f : elapsed); ((BraveBehaviour)component).specRigidbody.CollideWithTileMap = false; if (num3) { component.baseData.force = numBursts * 4; component.OnDestruction += DoFinalHit; } else { component.OnDestruction += DoHit; } component.SendInDirection(val2, false, true); ((Component)component).gameObject.PlayUnique("ora_fist_fire"); if (doTimeFreeze) { JojoReferenceHandler.RefreshTimeStop(); } else if (Object.op_Implicit((Object)(object)spec) && !spec.ImmuneToStun) { spec.Stun(1f, true); } yield return (object)new WaitForSeconds(baseDelay); num4 = j + 1; } baseDelay = Mathf.Max(baseDelay - 0.01f, 0.02f); num4 = i + 1; i = num4; } Vector2 finalPos = ((tk2dBaseSprite)standSprite).WorldCenter; for (float elapsed = BraveTime.DeltaTime; elapsed < 0.1f; elapsed += BraveTime.DeltaTime) { float num5 = elapsed / 0.1f; ((tk2dBaseSprite)standSprite).PlaceAtPositionByAnchor(Vector2.op_Implicit(Vector2.Lerp(finalPos, ((GameActor)pc).CenterPosition, num5)), (Anchor)4); yield return null; } Object.Destroy((Object)(object)_stand); _stand = null; if (doTimeFreeze) { while (JojoReferenceHandler.TimeIsFrozen()) { yield return null; } if (Object.op_Implicit((Object)(object)_enemy) && Object.op_Implicit((Object)(object)hh) && hh.IsAlive) { _enemy.LocalTimeScale = 1f; hh.ApplyDamage(lumpDamage, Vector2.zero, PlatinumStar.ItemName, (CoreDamageTypes)1, (DamageCategory)0, true, (PixelCollider)null, true); if (Object.op_Implicit((Object)(object)spec) && !spec.ImmuneToStun) { spec.Stun(1f, true); } } } _activated = false; yield break; } } Object.Destroy((Object)(object)this); } } public class Crapshooter : CwaffGun { public static string ItemName = "Crapshooter"; public static string ShortDescription = "Reloaded Dice"; public static string LongDescription = "Shoots a die whose face value corresponds to the one currently shown on the gun. Dice have different effects corresponding to their face value: 1) weak + slow, 2) normal, 3) explosive, 4) homing, 5) flak, 6) strong + piercing. The face shown on the gun cycles from 1 to 6, and shooting immediately resets the value to 1, so shots may be timed to repeatedly roll the desired value."; public static string Lore = "Dice are the core component of several games, ranging from family-friendly ones (like Monopoly) to those that inevitably end in homicide (like Monopoly). The dice themselves are rarely the vessels used to carry out these acts of violence, but when stuffed inside a firearm, they prove to be at least somewhat effective projectiles, if not unpredictable ones."; internal static Projectile _BaseCrapshooterProjectile; internal static readonly List _DiceSounds = new List { "dice_sound_1", "dice_sound_2", "dice_sound_3", "dice_sound_4", "dice_sound_5" }; private int _nextRoll; private float _freezeTimer; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? idleFps = 6; int? shootFps = 24; int? reloadFps = 24; Items? muzzleFrom = Items.Mailbox; Gun gun2 = gun.SetAttributes((ItemQuality)1, (GunClass)1, 1.5f, 300, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, idleFps, shootFps, reloadFps, null, null, "crapshooter_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).SetReloadAudio(_DiceSounds[0], 0, 6, 11, 14, 17, 19, 28).SetReloadAudio(_DiceSounds[1], 3, 7, 12, 15, 21, 27) .SetReloadAudio(_DiceSounds[2], 2, 18, 23, 25, 31); int? clipSize = 12; float? cooldown = 0.16f; float? damage = 3f; float? speed = 24f; float? force = 10f; float? range = 30f; bool? shouldRotate = false; bool? becomeDebris = true; ((Projectile)(object)gun2.InitSpecialProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "crapshooter_projectile", 12, (Anchor)4, 2f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, shouldRotate, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, null, null, null, null, becomeDebris))).Attach((Action)delegate(GrenadeProjectile g) { g.startingHeight = 0.5f; }, allowDuplicates: false).Attach((Action)delegate(BounceProjModifier bounce) { bounce.percentVelocityToLoseOnBounce = 0.5f; bounce.numberOfBounces = Mathf.Max(bounce.numberOfBounces, 0) + 3; bounce.OnBounce += delegate { ((Component)bounce).gameObject.Play(_DiceSounds.ChooseRandom()); }; }, allowDuplicates: false).Attach() .Assign(out _BaseCrapshooterProjectile); } private void Explode(Projectile p) { //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_0011: Unknown result type (might be due to invalid IL or missing references) Exploder.Explode(Vector2.op_Implicit(p.SafeCenter), Bouncer._MiniExplosion, p.Direction, (Action)null, false, (CoreDamageTypes)0, false); } public override void PostProcessProjectile(Projectile projectile) { ((GunBehaviour)this).PostProcessProjectile(projectile); if (base.Mastered) { _freezeTimer = 0.25f; } ((Component)this).gameObject.Play(_DiceSounds.ChooseRandom()); projectile.SetFrame(_nextRoll); switch (_nextRoll) { case 0: { ProjectileData baseData6 = projectile.baseData; baseData6.speed *= 0.5f; break; } case 1: { ProjectileData baseData4 = projectile.baseData; baseData4.damage *= 2f; break; } case 2: { ProjectileData baseData5 = projectile.baseData; baseData5.damage *= 3f; projectile.OnDestruction += Explode; break; } case 3: { ProjectileData baseData7 = projectile.baseData; baseData7.damage *= 4f; projectile.Attach((Action)delegate(HomingModifier homing) { homing.HomingRadius = 8f; homing.AngularVelocity = 540f; }, allowDuplicates: false); break; } case 4: { ProjectileData baseData8 = projectile.baseData; baseData8.damage *= 5f; projectile.Attach((Action)delegate(SpawnProjModifier s) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) s.spawnProjectilesOnCollision = true; s.numberToSpawnOnCollison = 5; s.startAngle = 180; s.projectileToSpawnOnCollision = _BaseCrapshooterProjectile; s.collisionSpawnStyle = (CollisionSpawnStyle)0; }, allowDuplicates: false); break; } case 5: { ProjectileData baseData = projectile.baseData; baseData.range *= 1.5f; ProjectileData baseData2 = projectile.baseData; baseData2.speed *= 1.5f; ProjectileData baseData3 = projectile.baseData; baseData3.damage *= 10f; projectile.Attach((Action)delegate(PierceProjModifier pierce) { pierce.penetration = 6; pierce.penetratesBreakables = true; }, allowDuplicates: false); projectile.Attach((Action)delegate(EasyTrailBullet trail) { //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_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) //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) trail.StartWidth = 0.1f; trail.EndWidth = 0f; trail.LifeTime = 0.25f; trail.BaseColor = Color.white; trail.StartColor = Color.white; trail.EndColor = Color.white; }, allowDuplicates: false); break; } } } private void LateUpdate() { ((GunBehaviour)this).gun.RenderInFrontOfPlayer(); if (!((_freezeTimer -= BraveTime.DeltaTime) > 0f)) { if (((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.currentClip.name == ((GunBehaviour)this).gun.idleAnimation) { _nextRoll = ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.CurrentFrame; } else { _nextRoll = 0; } } } } public class DiceProjectile : MonoBehaviour { private const float _AIR_FRICTION = 0.985f; private const float _MIN_SPEED = 1f; private const float _ROTATION_COEFF = 20f; private const float _ROT_RATE = 7200f; private GrenadeProjectile _projectile; private PlayerController _owner; private float _rotation; private void Start() { _projectile = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = ((Projectile)_projectile).Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); ((BraveBehaviour)_projectile).spriteAnimator.Stop(); ProjectileData baseData = ((Projectile)_projectile).baseData; baseData.speed *= 0.95f + 1.05f * Random.value; _rotation = 360f * Random.value; } private void Update() { //IL_0108: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_projectile)) { if (_projectile.m_currentHeight + (_projectile.m_current3DVelocity.z + ((Projectile)_projectile).LocalDeltaTime * -10f) * ((Projectile)_projectile).LocalDeltaTime < 0f) { ((Component)this).gameObject.Play(Crapshooter._DiceSounds.ChooseRandom()); } ((Projectile)(object)_projectile).ApplyFriction(0.985f); if (((Projectile)_projectile).baseData.speed < 1f) { ((Projectile)_projectile).DieInAir(true, true, true, false); } if (Object.op_Implicit((Object)(object)((BraveBehaviour)_projectile).specRigidbody)) { _rotation += Mathf.Sign(((BraveBehaviour)_projectile).specRigidbody.Velocity.x) * 7200f * ((Projectile)_projectile).baseData.speed * BraveTime.DeltaTime; ((BraveBehaviour)_projectile).transform.localRotation = _rotation.EulerZ(); } } } } public class Plasmarble : CwaffGun { public static string ItemName = "Plasmarble"; public static string ShortDescription = "Stunning in the 80's"; public static string LongDescription = "Launches an orb of plasma that periodically discharges electric bolts towards nearby enemies, shattering after a few seconds. Orbs discharge twice as quickly when soaked in water."; public static string Lore = "An artifact emblematic of funkier times when peace and love were rad and war was totally uncool. Much like other household decor of its era, it is eccentric, flashy, and unreasonably dangerous when considering its intended purpose."; internal static GameObject _LinkVFXPrefab = null; internal static Projectile _FlakProjectile = null; private int _chargeLevel = -1; private Material _mat; public static void Init() { //IL_016d: 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) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? reloadFps = 10; Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)2, (GunClass)60, 1f, 80, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, null, reloadFps, null, null, "plasmarble_explode_sound", "plasmarble_charge_sound", 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).AssignGun(out gunRef).UpdateAnimationFPS(gunRef.emptyAnimation, 0); int? clipSize = 1; float? cooldown = 0.15f; float? angleVariance = 10f; float? range = 9999f; float? speed = 50f; float? damage = 3.5f; bool? shouldRotate = true; bool? shouldFlipHorizontally = true; bool? surviveRigidbodyCollisions = true; Color? glowColor = Color.magenta; float? lightStrength = 5f; float? lightRange = 3f; Color? lightColor = Color.magenta; ((Projectile)(object)gun2.InitSpecialProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)3, (ProjectileSequenceStyle)1, 0.5f, 1, null, customClip: true, damage, speed, null, range, null, 0f, 0f, 0f, 0f, null, null, null, surviveRigidbodyCollisions, null, "plasmarble_projectile", 20, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, shouldRotate, 1, shouldFlipHorizontally, 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, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: false, 0f, null, 100f, glowColor, null, -1, null, lightStrength, lightRange, lightColor))).Attach((Action)delegate(BounceProjModifier bounce) { bounce.numberOfBounces = 2; bounce.onlyBounceOffTiles = false; bounce.ExplodeOnEnemyBounce = false; }, allowDuplicates: false).Attach((Action)delegate(FancyGrenadeProjectile g) { g.startingHeight = 0.5f; g.minBounceAngle = 10f; g.maxBounceAngle = 30f; g.startingVelocity = 0.5f; }, allowDuplicates: false).Attach(); lightRange = 3.5f; surviveRigidbodyCollisions = true; lightStrength = 50f; _FlakProjectile = Items._38Special.CloneProjectile(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, lightRange, lightStrength, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "plasmarble_flak", 1, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, surviveRigidbodyCollisions)).Attach(); _LinkVFXPrefab = VFX.Create("plasmarble_lightning", 30f, loops: true, -1, 1f, (Anchor)3, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1).MakeChainLightingVFX(); } public override void Update() { //IL_0085: 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) base.Update(); if (BraveTime.DeltaTime == 0f || ((GunBehaviour)this).PlayerOwner == null) { return; } if (((GunBehaviour)this).gun.ClipShotsRemaining <= 0 && !((GunBehaviour)this).gun.IsReloading) { ((GunBehaviour)this).gun.PlayIfExistsAndNotPlaying(((GunBehaviour)this).gun.emptyAnimation); } if (!Object.op_Implicit((Object)(object)_mat)) { _mat = ((BraveBehaviour)((BraveBehaviour)((GunBehaviour)this).gun).sprite).renderer.material; ((BraveBehaviour)((GunBehaviour)this).gun).sprite.SetGlowiness(0f, Color.magenta); ((BraveBehaviour)((GunBehaviour)this).gun).sprite.usesOverrideMaterial = false; } ((MonoBehaviour)(object)((GunBehaviour)this).gun).LoopSoundIf(((GunBehaviour)this).gun.IsCharging, "plasmarble_charge_sound"); if (!((GunBehaviour)this).gun.IsCharging) { _chargeLevel = -1; ((BraveBehaviour)((GunBehaviour)this).gun).sprite.usesOverrideMaterial = false; _mat.SetFloat(CwaffVFX._EmissivePowerId, 0f); ((BraveBehaviour)((GunBehaviour)this).gun).sprite.UpdateMaterial(); return; } int num = 1 + ((GunBehaviour)this).gun.GetChargeLevel(); if (num != _chargeLevel) { _chargeLevel = num; if (num > 0) { ((BraveBehaviour)((GunBehaviour)this).gun).sprite.SetGlowiness((float)num * 100f, Color.magenta); } else { ((BraveBehaviour)((GunBehaviour)this).gun).sprite.usesOverrideMaterial = false; } } } } public class PlasmarbleFlak : MonoBehaviour { private Vector2 _startPos; private void Start() { //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) Projectile component = ((Component)this).GetComponent(); _startPos = component.SafeCenter; component.OnDestruction += OnDestruction; ((BraveBehaviour)component).spriteAnimator.PickFrame(); } private void OnDestruction(Projectile p) { //IL_001a: 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) ((Component)p).gameObject.PlayUnique("plasma_zap_sound"); PlasmarbleProjectile.ZapRandomEnemies(p, 1, attachToProjectile: false, Vector2Extensions.ToAngle(_startPos - p.SafeCenter)); } } public class PlasmarbleProjectile : MonoBehaviour { private const int _MAX_BOUNCES = 6; private const int _MAX_MASTER_BOUNCES = 8; private const float _AIR_FRICTION = 0.9f; private const float _BOUNCE_FRICTION = 0.75f; private const float _ZAP_FREQUENCY = 0.25f; private Projectile _projectile; private PlayerController _owner; private FancyGrenadeProjectile _grenade; private int _bounces; private float _lastZap; private RoomHandler _room; private bool _inWater; private bool _mastered; private void Start() { //IL_00e2: Unknown result type (might be due to invalid IL or missing references) _projectile = ((Component)this).GetComponent(); _mastered = _projectile.Mastered(); _bounces = (_mastered ? 8 : 6); ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); _grenade = ((Component)this).GetComponent(); FancyGrenadeProjectile grenade = _grenade; grenade.OnBounce = (Action)Delegate.Combine(grenade.OnBounce, new Action(OnGroundBounce)); ((Component)this).GetComponent().OnBounce += OnGroundBounce; _projectile.m_usesNormalMoveRegardless = true; _projectile.OnDestruction += OnDestruction; ((BraveBehaviour)_projectile).specRigidbody.CollideWithOthers = false; _projectile.collidesWithEnemies = false; _projectile.UpdateCollisionMask(); _room = Vector3Extensions.GetAbsoluteRoom(_projectile.SafeCenter); } private void OnDestruction(Projectile p) { //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) Exploder.Explode(((BraveBehaviour)p).transform.position, CarpetBomber._CarpetExplosion, p.Direction, (Action)null, true, (CoreDamageTypes)0, false); ExplodeIntoFlak(4); } internal static void ZapRandomEnemies(Projectile proj, int numZaps = 1, bool attachToProjectile = true, float? overrideAngle = null) { //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_000c: 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_004b: 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_0086: 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_00c3: 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_00ca: 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_00fa: 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) Vector2 unitCenter = ((BraveBehaviour)proj).specRigidbody.UnitCenter; ReadOnlyCollection allNearbyEnemies = unitCenter.GetAllNearbyEnemies(100f, ignoreWalls: false); _ = allNearbyEnemies.Count; IEnumerator enumerator = allNearbyEnemies.InRandomOrder().GetEnumerator(); for (int i = 0; i < numZaps; i++) { AIActor val = enumerator.Advance(); Vector2 targetPos = (Object.op_Implicit((Object)(object)val) ? ((GameActor)val).CenterPosition : ((BraveBehaviour)proj).specRigidbody.UnitCenter.ToNearestWall(overrideAngle ?? Lazy.RandomAngle())); OwnerConnectLightningModifier ownerConnectLightningModifier = ((GameObject)(attachToProjectile ? ((object)((Component)proj).gameObject) : ((object)new GameObject("lightningboi")))).AddComponent(); ownerConnectLightningModifier.disowned = true; ownerConnectLightningModifier.owner = proj.Owner; ownerConnectLightningModifier.targetBody = (Object.op_Implicit((Object)(object)val) ? ((BraveBehaviour)val).specRigidbody : null); ownerConnectLightningModifier.originPos = unitCenter; ownerConnectLightningModifier.targetPos = targetPos; ownerConnectLightningModifier.linkPrefab = Plasmarble._LinkVFXPrefab; ownerConnectLightningModifier.disownTimer = 0.1f; ownerConnectLightningModifier.fadeTimer = 0.15f; ownerConnectLightningModifier.shrinkFade = true; ownerConnectLightningModifier.color = Color.magenta; ownerConnectLightningModifier.emissivePower = 50f; ownerConnectLightningModifier.baseDamage = proj.baseData.damage; ownerConnectLightningModifier.MakeGlowy(); } } private void Update() { //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_00db: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_projectile)) { return; } _projectile.ApplyFriction(0.9f); float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; if (scaledTimeSinceStartup - _lastZap < 0.25f * (_inWater ? 0.5f : 1f)) { return; } _lastZap = scaledTimeSinceStartup; ZapRandomEnemies(_projectile, (!_mastered) ? 1 : 4); ((Component)_projectile).gameObject.PlayUnique("plasma_zap_sound"); _inWater = false; Vector2 safeCenter = _projectile.SafeCenter; if (_room == null || _room.RoomGoops == null) { return; } foreach (DeadlyDeadlyGoopManager roomGoop in _room.RoomGoops) { if (Object.op_Implicit((Object)(object)roomGoop) && roomGoop.IsPositionElectrified(safeCenter)) { _inWater = true; break; } } } public void OnGroundBounce() { _projectile.m_usesNormalMoveRegardless = true; ProjectileData baseData = _projectile.baseData; baseData.speed *= 0.75f; if (--_bounces <= 0) { _projectile.DieInAir(true, true, true, false); } } private void ExplodeIntoFlak(int numFlak) { //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_0037: 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_003f: Unknown result type (might be due to invalid IL or missing references) Vector2 safeCenter = _projectile.SafeCenter; float num = Lazy.RandomAngle(); float num2 = 360f / (float)numFlak; for (int i = 0; i < numFlak; i++) { float self = num + ((float)i + Random.value) * num2; Projectile component = SpawnManager.SpawnProjectile(((Component)Plasmarble._FlakProjectile).gameObject, Vector2.op_Implicit(safeCenter), self.EulerZ(), true).GetComponent(); component.SpawnedFromOtherPlayerProjectile = true; component.Owner = _projectile.Owner; component.Shooter = _projectile.Shooter; if (Object.op_Implicit((Object)(object)_owner)) { _owner.DoPostProcessProjectile(component); } } ((Component)_projectile).gameObject.PlayUnique("plasmarble_explode_sound"); } } public class Blamethrower : CwaffGun { private class BlameDamage : DamageAdjuster { private const float _BLAME_MULT = 4f; protected override float AdjustDamage(float currentDamage, Projectile proj, AIActor enemy) { return currentDamage * (Object.op_Implicit((Object)(object)((Component)enemy).GetComponent()) ? 4f : 1f); } } public static string ItemName = "Blamethrower"; public static string ShortDescription = "Take It Up with HR"; public static string LongDescription = "Fires harsh words that deal emotional damage and may inflict blame, making enemies run away and take 4x emotional damage. Taking damage from an enemy or enemy projectile gives that enemy the scapegoat status, making it 100% susceptible to blame and dropping an appropriate health / armor pickup when killed with Blamethrower."; public static string Lore = "Whoever claimed that actions speak louder than words has clearly never stared down the barrel of a military-grade bullhorn. As the saying goes, sticks and stones may break your bones, but words can get you grounded, expelled, fired, ostracized, defenestrated, imprisoned, executed, or flipped off depending on your specific life circumstances."; internal static GameObject _BlameImpact = null; internal static GameObject _BlameTrail = null; internal static GameObject _ScapeGoatVFX = null; private AIActor _candidateScapegoat; private float _candidateValidUntil; public static void Init() { //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_063d: Expected O, but got Unknown Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); bool? doesScreenShake = false; int? shootFps = 40; Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)4, (GunClass)40, 0f, 800, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: true, doesScreenShake, null, shootFps, null, null, null, null, null, null, -1, -1, -1, null, modulesAreTiers: false, "muzzle_blamethrower", 30, 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).AssignGun(out gunRef); int? clipSize = -1; float? cooldown = 0.08f; float? damage = 4f; float? angleVariance = 30f; float? speed = 17f; float? range = 17f; bool? shouldRotate = false; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "blamethrower_projectile", 10, (Anchor)4, 2f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, shouldRotate)).Attach().Attach() .Assign(out Projectile projectileRef); ProjectileModule[] array = (ProjectileModule[])(object)new ProjectileModule[3]; for (int i = 0; i < 3; i++) { int num = i; ProjectileModule val = new ProjectileModule(); Gun gun3 = gunRef; Projectile baseProjectile = projectileRef; int? clipSize2 = -1; float? cooldown2 = 0.08f; float angleFromAim = 90f * (float)(i + 1); array[num] = GunBuilder.InitSingleProjectileModule(val, GunData.New(gun3, baseProjectile, clipSize2, cooldown2, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 0, null, customClip: false, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, null, null, null, null, null, angleFromAim, ignoredForReloadPurposes: true)); } gunRef.AddSynergyModules(Synergy.MASTERY_BLAMETHROWER, array); _BlameImpact = VFX.Create("blamethrower_projectile_vfx", 2f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _BlameTrail = VFX.Create("blamethrower_trail", 16f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _ScapeGoatVFX = VFX.Create("goat_vfx", 16f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } public override void OnPlayerPickup(PlayerController player) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown base.OnPlayerPickup(player); player.OnReceivedDamage += OnReceivedDamage; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)player).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(DeterminePotentialScapegoat)); } public override void OnDroppedByPlayer(PlayerController player) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown player.OnReceivedDamage -= OnReceivedDamage; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)player).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Remove((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(DeterminePotentialScapegoat)); base.OnDroppedByPlayer(player); } public override void OnDestroy() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((GunBehaviour)this).PlayerOwner.OnReceivedDamage -= OnReceivedDamage; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)((GunBehaviour)this).PlayerOwner).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Remove((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(DeterminePotentialScapegoat)); } base.OnDestroy(); } private void DeterminePotentialScapegoat(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { AIActor val = null; AIActor component = ((Component)otherRigidbody).gameObject.GetComponent(); if (component != null) { val = component; } else { Projectile component2 = ((Component)otherRigidbody).gameObject.GetComponent(); if (component2 != null) { GameActor owner = component2.Owner; AIActor val2 = (AIActor)(object)((owner is AIActor) ? owner : null); if (val2 != null) { val = val2; } } } if (Object.op_Implicit((Object)(object)val)) { _candidateScapegoat = val; _candidateValidUntil = BraveTime.ScaledTimeSinceStartup + 0.1f; } } private void OnReceivedDamage(PlayerController player) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_candidateScapegoat) && _candidateValidUntil >= BraveTime.ScaledTimeSinceStartup) { if (!Object.op_Implicit((Object)(object)((Component)_candidateScapegoat).gameObject.GetComponent())) { GameObjectExtensions.GetOrAddComponent(((Component)_candidateScapegoat).gameObject).Setup(base.Mastered); } return; } ReadOnlyCollection allNearbyEnemies = ((GameActor)player).CenterPosition.GetAllNearbyEnemies(); if (allNearbyEnemies == null || allNearbyEnemies.Count == 0) { return; } for (int i = 0; i < 10; i++) { AIActor val = allNearbyEnemies.ChooseRandom(); if (!val.IsABoss() && !Object.op_Implicit((Object)(object)((Component)val).GetComponent())) { GameObjectExtensions.GetOrAddComponent(((Component)val).gameObject).Setup(base.Mastered); break; } } } } internal class ScapeGoat : MonoBehaviour { private bool _active = true; private bool _mastered; public void Setup(bool mastered) { _mastered = mastered; } private IEnumerator Start() { AIActor enemy = ((Component)this).GetComponent(); if (enemy == null) { yield break; } HealthHaver hh = ((Component)this).GetComponent(); if (hh == null || Object.op_Implicit((Object)(object)((Component)this).GetComponent())) { yield break; } if (_mastered) { BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)enemy).behaviorSpeculator; if (behaviorSpeculator != null && !behaviorSpeculator.ImmuneToStun) { behaviorSpeculator.Stun(36000f, true); } } GameObject vfx = SpawnManager.SpawnVFX(Blamethrower._ScapeGoatVFX, Vector2.op_Implicit(((BraveBehaviour)enemy).sprite.WorldTopCenter), Quaternion.identity); tk2dSprite sprite = vfx.GetComponent(); while (_active && Object.op_Implicit((Object)(object)enemy) && Object.op_Implicit((Object)(object)hh) && hh.IsAlive) { ((tk2dBaseSprite)sprite).PlaceAtPositionByAnchor(Vector2.op_Implicit(((BraveBehaviour)enemy).sprite.WorldTopCenter.HoverAt(0.1f, 10f, 0.75f)), (Anchor)4); yield return null; } vfx.SafeDestroy(); this.SafeDestroy(); } public void TakeTheBlame(PlayerController player) { //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_0036: Unknown result type (might be due to invalid IL or missing references) AIActor component = ((Component)this).GetComponent(); LootEngine.SpawnItem(((Component)ItemHelper.Get(player.ForceZeroHealthState ? Items.Armor : (component.IsBlackPhantom ? Items.Heart : Items.HalfHeart))).gameObject, Vector2.op_Implicit(((GameActor)component).CenterPosition), Vector2.zero, 0f, true, true, false); _active = false; } } public class BlamethrowerProjectile : MonoBehaviour { private const float _FEAR_CHANCE = 0.125f; private const float _VFX_RATE = 0.1f; private float _vfxTimer; private Projectile _projectile; private void Start() { _projectile = ((Component)this).GetComponent(); _projectile.PickFrame(); ((Component)this).gameObject.Play($"blame_sound_{Random.Range(1, 6)}"); Projectile projectile = _projectile; projectile.OnHitEnemy = (Action)Delegate.Combine(projectile.OnHitEnemy, new Action(OnHitEnemy)); } private void OnHitEnemy(Projectile p, SpeculativeRigidbody enemy, bool killed) { //IL_001d: 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) ((Component)this).gameObject.Play("blamethrower_impact_sound"); CwaffVFX.SpawnBurst(Blamethrower._BlameImpact, 2, enemy.UnitCenter, 1f, 10f * Vector2.up, 0f, 5f, CwaffVFX.Vel.Radial, CwaffVFX.Rot.None, 0.5f, 0.5f, 0f, null, fadeIn: false, uniform: false, null, null, null, randomFrame: true); GameActor owner = p.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null) { ScapeGoat component = ((Component)enemy).GetComponent(); if (killed && Object.op_Implicit((Object)(object)component)) { component.TakeTheBlame(val); } if ((!(Random.value > 0.125f) || Object.op_Implicit((Object)(object)component)) && Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).aiActor) && ((BraveBehaviour)enemy).aiActor.IsHostileAndNotABoss() && !Object.op_Implicit((Object)(object)((Component)enemy).GetComponent())) { ((Component)enemy).gameObject.AddComponent().Setup(p); } } } private void Update() { //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_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_006b: 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) if (!((_vfxTimer += BraveTime.DeltaTime) < 0.1f)) { _vfxTimer -= 0.1f; CwaffVFX.Spawn(Blamethrower._BlameTrail, Vector2Extensions.ToVector3ZisY(_projectile.SafeCenter, -1f), velocity: 0.2f * _projectile.LastVelocity, rotation: _projectile.LastVelocity.EulerZ(), lifetime: 0.18f, fadeOutTime: 0.15f); } } } internal class EnemyBlamedBehavior : MonoBehaviour { internal static readonly List _BlameQuotes = new List { "It's my fault!", "I messed up!", "It was me, I did it!", "Won't happen again!", "I'm sorry!", "I'm so sorry!", "My apologies!", "Please excuse me!", "Don't tell my boss!", "I confess!", "I have no excuse!", "That's my bad!", "I'm in so much trouble!", "My mistake!", "What have I done?!", "I slipped up!" }; public void Setup(Projectile p) { //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_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_00b0: 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) //IL_00cb: Expected O, but got Unknown AIActor component = ((Component)this).GetComponent(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)((BraveBehaviour)component).healthHaver) || ((BraveBehaviour)component).healthHaver.currentHealth <= 0f) { return; } GameActor owner = p.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null) { if (TextBoxManager.HasTextBox(((BraveBehaviour)((BraveBehaviour)component).sprite).transform)) { TextBoxManager.ClearTextBox(((BraveBehaviour)((BraveBehaviour)component).sprite).transform); } TextBoxManager.ShowTextBox(Vector2.op_Implicit(((BraveBehaviour)component).sprite.WorldTopCenter), ((BraveBehaviour)((BraveBehaviour)component).sprite).transform, 2f, _BlameQuotes.ChooseRandom(), "", false, (BoxSlideOrientation)0, true, false); BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)component).behaviorSpeculator; if (behaviorSpeculator != null) { behaviorSpeculator.FleePlayerData = new FleePlayerData { Player = val, StartDistance = 100f, StopDistance = 100f }; } } } } public class Stereoscope : CwaffGun { private class ResonantProjectile : Projectile { private const int NO_FREQ = 99; public int frequency = 99; public int power = 8; public Gun gun; public override void Start() { ((Projectile)this).Start(); base.m_usesNormalMoveRegardless = true; } public override void Move() { //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_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_004d: 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) if (frequency == 99) { GameActor owner = base.m_owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null) { frequency = FrequencyFromGunAngle(val); } else { frequency = Random.Range(-6, 6); } } Vector3 position = ((BraveBehaviour)this).transform.position; Reverberate(Vector2.op_Implicit(position)); Vector3Extensions.GetAbsoluteRoom(position).ApplyActionToNearbyEnemies(Vector3Extensions.XY(position), 100f, (Action)ProcessEnemy); ((Projectile)this).DieInAir(true, false, false, false); } private void Reverberate(Vector2 pos) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) GameObject resonancePrefab = _ResonancePrefab; int numToSpawn = power; float? fadeOutTime = 0.25f; float? startScale = 1f; float? endScale = 0.1f; int specificFrame = frequency + 6; float? height = 8f; CwaffVFX.SpawnBurst(resonancePrefab, numToSpawn, pos, 1.75f, null, 0f, 1f, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.Position, 0.25f, fadeOutTime, 0f, null, fadeIn: false, uniform: true, startScale, endScale, height, randomFrame: false, specificFrame); Exploder.DoDistortionWave(pos, 1.5f, 0.05f, 1.75f, 0.25f); } private void ProcessEnemy(AIActor enemy, float b) { //IL_0066: 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_00aa: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)enemy) || !enemy.IsNormalEnemy || !Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).healthHaver) || ((GameActor)enemy).IsGone) { return; } string enemyGuid = enemy.EnemyGuid; if (Utility.IsNullOrWhiteSpace(enemyGuid)) { return; } if (!_FrequencyMap.TryGetValue(enemyGuid, out var value)) { value = (_FrequencyMap[enemyGuid] = Random.Range(-6, 6)); } if (value == frequency) { Reverberate(((GameActor)enemy).CenterPosition); ((BraveBehaviour)enemy).healthHaver.ApplyDamage(0.125f * (float)power * ((Projectile)this).ModifiedDamage, Vector2.zero, Object.op_Implicit((Object)(object)((Projectile)this).Owner) ? ((Projectile)this).OwnerName : "projectile", base.damageTypes, (DamageCategory)0, false, (PixelCollider)null, false); if (((BraveBehaviour)enemy).healthHaver.IsDead && !((BraveBehaviour)enemy).healthHaver.IsBoss && !((BraveBehaviour)enemy).healthHaver.IsSubboss) { SunderbussProjectile.ShatterViolentlyIntoAMillionPieces(enemy); enemy.EraseFromExistenceWithRewards(true); } } } } public class StereoscopeStereo : MonoBehaviour { public Vector2 pos; public int freq; public bool linked; private Stereoscope _gun; public void Setup(Stereoscope gun) { //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_0011: Unknown result type (might be due to invalid IL or missing references) pos = Vector2.op_Implicit(((Component)this).transform.position); _gun = gun; freq = gun._frequency; linked = true; } private void Update() { if (!linked && Object.op_Implicit((Object)(object)_gun)) { _gun.HandleAudioChecks(); } } } public static string ItemName = "Stereoscope"; public static string ShortDescription = "Surround Sound"; public static string LongDescription = "Continuously emits sound at a pitch corresponding to aim direction, and fires sonic waves which only damage enemies that resonate with the current pitch. Each enemy type resonates with a specific pitch. Enemies are stunned while resonating, and sonic waves deal extra damage when fired in time with Stereoscope's beat."; public static string Lore = "A sonic weapon that was once very popular among 90's kids and Kins, doomed to fall into obscurity after the advent of the iBomb and later the iPwn. While the Stereoscope's ability to incapacitate the Gundead is indisputable, it's anyone's guess as to whether the prevailing theory regarding the Gundead's sensitivity to certain frequencies holds any weight, or if they just really despise the average Gungeoneer's taste in music."; private const int _IDLE_FPS = 19; private const int _SOUND_MS = 469; private const float _VFX_RATE = 0.1f; private const float _STUN_LINGER_TIME = 0.25f; private const int _MAX_SOUNDS = 16; internal static GameObject _ResonancePrefab = null; internal static GameObject _StereoPrefab = null; private static ResonantProjectile _StereoscopeProjectile = null; private static Dictionary _FrequencyMap = new Dictionary(); private static uint[] _PlayingIds = new uint[16]; private static Color[] _FreqColors = (Color[])(object)new Color[12]; private static readonly LinkedList[] _PooledIcons = new LinkedList[2] { new LinkedList(), new LinkedList() }; private static readonly LinkedList[] _ActiveIcons = new LinkedList[2] { new LinkedList(), new LinkedList() }; private int _frequency; private int _lastSoundPos; private uint _soundId; private float _lastVfx; private StereoscopeStereo _extantStereo; public static void Init() { //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? idleFps = 19; int? shootFps = 19; Gun gun2 = gun.SetAttributes((ItemQuality)4, (GunClass)15, 0f, 261, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, idleFps, shootFps, null, null, null, "stereoscope_fire_sound", 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: true, (GunHandedness)0, autoPlay: false, attacksThroughWalls: true); int? clipSize = -1; float? cooldown = 0.3f; float? damage = 17f; float? speed = 25f; float? range = 18f; float? force = 12f; gun2.InitSpecialProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, 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, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: true)).Assign(out _StereoscopeProjectile); _ResonancePrefab = VFX.Create("resonance_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _StereoPrefab = VFX.Create("stereoscope_stereo", 19f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1).Attach(); for (int i = 0; i < 12; i++) { _FreqColors[i] = Color.HSVToRGB((float)((8 + i) % 12) / 12f, 1f, 1f); } } private void Resonate(Vector2 pos, int freq, Transform anchor = null) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) GameObject resonancePrefab = _ResonancePrefab; float? fadeOutTime = 0.25f; float? startScale = 1f; float? endScale = 0.1f; int specificFrame = freq + 6; float? height = 8f; CwaffVFX.SpawnBurst(resonancePrefab, 6, pos, 0.4f, null, 0f, 10f, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.Position, 0.25f, fadeOutTime, 0f, null, fadeIn: false, uniform: true, startScale, endScale, height, randomFrame: false, specificFrame, flipX: false, flipY: false, anchor); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); GunExt.SetAnimationFPS(((GunBehaviour)this).gun, ((GunBehaviour)this).gun.idleAnimation, 19); ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.Play(); CwaffEvents.OnChangedRooms = (Action)Delegate.Remove(CwaffEvents.OnChangedRooms, new Action(OnChangedRooms)); CwaffEvents.OnChangedRooms = (Action)Delegate.Combine(CwaffEvents.OnChangedRooms, new Action(OnChangedRooms)); } private void OnChangedRooms(PlayerController player, RoomHandler oldRoom, RoomHandler newRoom) { if ((Object)(object)player == (Object)(object)((GunBehaviour)this).PlayerOwner) { CleanUpStereos(); } } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); ClearIcons(); CleanUpStereos(); GunExt.SetAnimationFPS(((GunBehaviour)this).gun, ((GunBehaviour)this).gun.idleAnimation, 0); ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.StopAndResetFrameToDefault(); CwaffEvents.OnChangedRooms = (Action)Delegate.Remove(CwaffEvents.OnChangedRooms, new Action(OnChangedRooms)); } public override void OnReloadPressed(PlayerController player, Gun gun, bool manualReload) { //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) //IL_0083: 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) base.OnReloadPressed(player, gun, manualReload); if (!player.IsDodgeRolling && player.AcceptingNonMotionInput && base.Mastered) { CleanUpStereos(); _extantStereo = _StereoPrefab.Instantiate(Vector2.op_Implicit(((GameActor)player).CenterPosition)).AddComponent(); _extantStereo.Setup(this); ((Component)this).gameObject.Play("place_stereo_sound"); Lazy.DoSmokeAt(Vector2.op_Implicit(((GameActor)player).CenterPosition)); } } private void ClearIcons() { for (int i = 0; i < 2; i++) { while (true) { LinkedListNode last = _ActiveIcons[i].Last; if (last == null) { break; } _ActiveIcons[i].RemoveLast(); Geometry value = last.Value; if (value != null) { value.Disable(); _PooledIcons[i].AddLast(last); } } } } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); ClearIcons(); if (Object.op_Implicit((Object)(object)_extantStereo)) { _extantStereo.linked = false; } } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); if (Object.op_Implicit((Object)(object)_extantStereo)) { _extantStereo.linked = true; } } public override void OnDestroy() { CleanUpStereos(); ClearIcons(); CwaffEvents.OnChangedRooms = (Action)Delegate.Remove(CwaffEvents.OnChangedRooms, new Action(OnChangedRooms)); base.OnDestroy(); } private void CleanUpStereos() { //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) if (Object.op_Implicit((Object)(object)_extantStereo)) { Lazy.DoPickupAt(Vector2.op_Implicit(_extantStereo.pos)); Object.Destroy((Object)(object)((Component)_extantStereo).gameObject); _extantStereo = null; } } private bool IsGunResonating() { //IL_0015: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 uint num = 16u; AkSoundEngine.GetPlayingIDsFromGameObject(((Component)((GunBehaviour)this).PlayerOwner).gameObject, ref num, _PlayingIds); int num2 = default(int); for (int i = 0; i < num; i++) { if (_PlayingIds[i] == _soundId) { AKRESULT sourcePlayPosition = AkSoundEngine.GetSourcePlayPosition(_soundId, ref num2); _lastSoundPos = (((int)sourcePlayPosition == 1) ? num2 : 0); return true; } } return false; } private static string GetSoundForFrequency(int freq) { if (freq > 0) { return $"stereoscope_charge_sound_{freq}_up"; } if (freq < 0) { return $"stereoscope_charge_sound_{-freq}_down"; } return "stereoscope_charge_sound_0"; } internal static int FrequencyFromGunAngle(PlayerController player) { return Mathf.FloorToInt(player.m_currentGunAngle.Clamp360() / 30f) - 6; } internal static float MiddleAngleFromFrequency(int freq) { return 30f * (float)(freq + 6) + 15f; } private static Geometry RentIcon(Geometry.Shape shape) { int num = ((shape != Geometry.Shape.FILLEDCIRCLE) ? 1 : 0); if (_PooledIcons[num].Count == 0) { _PooledIcons[num].AddLast(Geometry.Create(shape)); } LinkedListNode last = _PooledIcons[num].Last; _PooledIcons[num].RemoveLast(); _ActiveIcons[num].AddLast(last); Geometry geometry = last.Value; if (geometry == null) { Geometry geometry2 = (last.Value = Geometry.Create(shape)); geometry = geometry2; } return geometry; } public void HandleAudioChecks() { //IL_0199: 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_00f5: 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_0234: 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_0247: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: 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_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_032c: 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_0333: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { return; } bool flag = (Object)(object)((GunBehaviour)this).gun == (Object)(object)((GameActor)((GunBehaviour)this).PlayerOwner).CurrentGun; if (flag) { _frequency = FrequencyFromGunAngle(((GunBehaviour)this).PlayerOwner); } else if (Object.op_Implicit((Object)(object)_extantStereo)) { _frequency = _extantStereo.freq; } float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; bool flag2 = scaledTimeSinceStartup > _lastVfx + 0.1f && !IsGunResonating(); if (flag2) { flag2 = true; _lastSoundPos = 0; _lastVfx = scaledTimeSinceStartup; _soundId = AkSoundEngine.PostEvent(GetSoundForFrequency(_frequency), ((Component)((GunBehaviour)this).PlayerOwner).gameObject, 1048576u); if (flag) { Resonate(((BraveBehaviour)((GunBehaviour)this).gun).sprite.WorldCenter, _frequency, ((BraveBehaviour)((GunBehaviour)this).gun).transform); } if (Object.op_Implicit((Object)(object)_extantStereo)) { Resonate(_extantStereo.pos, _extantStereo.freq, ((Component)_extantStereo).transform); if (flag && _frequency != _extantStereo.freq) { ((Component)_extantStereo).gameObject.Play(GetSoundForFrequency(_extantStereo.freq)); } } } _ = ((GunBehaviour)this).PlayerOwner.CurrentRoom; float num = 0.35f + Mathf.Max(0.5f * GetAccuracy(twoWay: false), 0f); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0f, -0.375f); float value = 0.375f; foreach (AIActor allNearbyEnemy in ((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition.GetAllNearbyEnemies()) { BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)allNearbyEnemy).behaviorSpeculator; if (behaviorSpeculator == null) { continue; } string enemyGuid = allNearbyEnemy.EnemyGuid; if (Utility.IsNullOrWhiteSpace(enemyGuid)) { continue; } if (!_FrequencyMap.TryGetValue(enemyGuid, out var value2)) { value2 = (_FrequencyMap[enemyGuid] = Random.Range(-6, 6)); } SpeculativeRigidbody specRigidbody = ((BraveBehaviour)allNearbyEnemy).specRigidbody; if (specRigidbody != null) { Geometry geometry = RentIcon(Geometry.Shape.FILLEDCIRCLE); Color? color = Vector3Extensions.WithAlpha(_FreqColors[value2 + 6], num); Vector2? pos = specRigidbody.UnitBottomCenter + val; float? radius = value; float? angle = MiddleAngleFromFrequency(value2); float? arc = 30f; geometry.Place(color, pos, null, radius, angle, arc); Geometry geometry2 = RentIcon(Geometry.Shape.FILLEDCIRCLE); Color? color2 = Vector3Extensions.WithAlpha(Color.white, num); Vector2? pos2 = specRigidbody.UnitBottomCenter + val; arc = value; angle = ((GunBehaviour)this).PlayerOwner.m_currentGunAngle.Clamp360(); radius = 12f; geometry2.Place(color2, pos2, null, arc, angle, radius); Geometry geometry3 = RentIcon(Geometry.Shape.CIRCLE); Color? color3 = Vector3Extensions.WithAlpha(_FreqColors[value2 + 6], num); Vector2? pos3 = specRigidbody.UnitBottomCenter + val; radius = value; angle = MiddleAngleFromFrequency(value2); arc = 360f; geometry3.Place(color3, pos3, null, radius, angle, arc); } if (value2 == _frequency || (Object.op_Implicit((Object)(object)_extantStereo) && value2 == _extantStereo.freq)) { if (!behaviorSpeculator.ImmuneToStun) { behaviorSpeculator.Stun(0.25f, true); } if (flag2) { Resonate(((GameActor)allNearbyEnemy).CenterPosition, value2, ((BraveBehaviour)allNearbyEnemy).transform); } } } } public override void Update() { base.Update(); if (!GameManager.Instance.IsLoadingLevel && !GameManager.Instance.IsPaused && BraveTime.DeltaTime != 0f) { ClearIcons(); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) && ((GunBehaviour)this).PlayerOwner.AcceptingNonMotionInput) { HandleAudioChecks(); } } } private float GetAccuracy(bool twoWay = true) { float num = (twoWay ? Mathf.Min(_lastSoundPos, 469 - _lastSoundPos) : _lastSoundPos); return Mathf.Clamp01(1f - 2f * (num / 469f)); } public override void PostProcessProjectile(Projectile projectile) { //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_0070: Unknown result type (might be due to invalid IL or missing references) ((GunBehaviour)this).PostProcessProjectile(projectile); if (projectile is ResonantProjectile resonantProjectile) { float accuracy = GetAccuracy(); int power = Mathf.RoundToInt(8f * accuracy * accuracy); resonantProjectile.frequency = _frequency; resonantProjectile.power = power; resonantProjectile.gun = ((GunBehaviour)this).gun; if (Object.op_Implicit((Object)(object)_extantStereo)) { Projectile component = SpawnManager.SpawnProjectile(((Component)_StereoscopeProjectile).gameObject, Vector2.op_Implicit(_extantStereo.pos), Quaternion.identity, true).GetComponent(); component.SetOwnerAndStats((GameActor)(object)((GunBehaviour)this).PlayerOwner); ResonantProjectile component2 = ((Component)component).gameObject.GetComponent(); component2.frequency = _extantStereo.freq; component2.power = power; component2.gun = ((GunBehaviour)this).gun; } } } } public class HandCannon : CwaffGun { public static string ItemName = "Hand Cannon"; public static string ShortDescription = "Fire Arms"; public static string LongDescription = "Fires a high-powered glove that slaps enemies with extreme force perpendicular to the glove's trajectory."; public static string Lore = "Second only to guns, hands are widely considered to be one of the most effective weapons ever brought to the battlefield. In ancient times, combatants would often throw the severed hands of their fallen comrades at their enemies to simultaneously inflict physical and emotional damage, ergo the modern expression \"tossing hands\". The venerable Gun Tzu is thought to be the first to marry guns and hands with his legendary Finger Gun, known for inflicting panic and fear in all who opposed his army. The Hand Cannon is a direct descendant and natural evolution of Gun Tzu's original Finger Gun, packing enough force to make Vasilii Kamotskii blush."; private const float _CHARGE_TIME = 0.5f; private const float _CHARGE_LOOP_FRAME = 11f; internal static GameObject _SlapppAnimation; internal static GameObject _ClapppShockwave; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 30; int? reloadFps = 1; int? chargeFps = 22; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)60, 0.75f, 100, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, chargeFps, null, "hand_cannon_shoot_sound", "hand_cannon_reload_sound", null, 11, -1, -1, null, modulesAreTiers: false, "muzzle_hand_cannon", 30, 0.5f, (Anchor)4, -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).SetChargeAudio("hand_cannon_charge_sound", 0, 10); int? clipSize = 2; float? cooldown = 0.1f; float? angleVariance = 15f; float? damage = 40f; float? speed = 40f; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)3, (ProjectileSequenceStyle)0, 0.5f, 1, null, customClip: true, damage, speed, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "slappp", 30, (Anchor)4)).Attach(); _SlapppAnimation = VFX.Create("slappp_vfx", 30f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _ClapppShockwave = Items.ChargeShot.AsGun().muzzleFlashEffects.effects[0].effects[0].effect; } } public class SlappProjectile : MonoBehaviour { private const int _SLAPPP_FRAME = 8; private const float _SLAPPP_FORCE = 300f; private const float _SLAPPP_STUN = 2f; private const float _CLAPPP_STUN = 10f; private const float _SLAPP_RADIUS = 3f; private Projectile _projectile; private AIActor _slapVictim; private Vector2 _slapAngle = Vector2.zero; private bool _flipped; private float _slapDamage; private GameObject _vfx; private bool _isMastered; private void Start() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown _projectile = ((Component)this).GetComponent(); GameActor owner = _projectile.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null) { _flipped = ((BraveBehaviour)val).sprite.FlipX; _isMastered = val.HasSynergy(Synergy.MASTERY_HAND_CANNON); _slapDamage = _projectile.baseData.damage * (_isMastered ? 2f : 1f); SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreCollision)); } } private void OnPreCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { //IL_0064: 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_0069: 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_008c: 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_0122: 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) if (!Object.op_Implicit((Object)(object)otherRigidbody)) { return; } GameActor gameActor = ((BraveBehaviour)otherRigidbody).gameActor; AIActor val = (AIActor)(object)((gameActor is AIActor) ? gameActor : null); if (val != null && val.IsHostile(canBeDead: false, canBeNeutral: true)) { PhysicsEngine.SkipCollision = true; _slapVictim = val; _slapAngle = (_isMastered ? _projectile.Direction : _projectile.Direction.Rotate(_flipped ? (-90f) : 90f)); Transform transform = ((BraveBehaviour)((BraveBehaviour)_projectile).sprite).transform; _vfx = SpawnManager.SpawnVFX(HandCannon._SlapppAnimation, transform.position, transform.rotation, true); _vfx.transform.parent = ((BraveBehaviour)((BraveBehaviour)val).sprite).transform; _vfx.ExpireIn(0.5f, 0.2f); _vfx.AddAnimationEvent(SlapppEvent, 8, _isMastered ? "clappp_sound" : "slappp_sound"); ((tk2dBaseSprite)_vfx.GetComponent()).FlipY = _flipped; if (_isMastered) { GameObject obj = SpawnManager.SpawnVFX(HandCannon._SlapppAnimation, transform.position, transform.rotation, true); obj.transform.parent = ((BraveBehaviour)((BraveBehaviour)val).sprite).transform; obj.ExpireIn(0.5f, 0.2f); obj.AddAnimationEvent(SlapppEvent, 8, _isMastered ? "clappp_sound" : "slappp_sound"); ((tk2dBaseSprite)obj.GetComponent()).FlipY = !_flipped; } _projectile.DieInAir(true, false, false, false); } } private void SlapppEvent(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frame) { //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_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_0069: 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_0125: 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_012b: 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_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0156: 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) _vfx.transform.parent = null; if (!Object.op_Implicit((Object)(object)_slapVictim)) { return; } GameActor owner = _projectile.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); float num = 300f * (Object.op_Implicit((Object)(object)val) ? val.KnockbackMult() : 1f); Vector2 centerPosition = ((GameActor)_slapVictim).CenterPosition; Vector2 worldCenter = ((tk2dBaseSprite)_vfx.GetComponent()).WorldCenter; foreach (AIActor allNearbyEnemy in centerPosition.GetAllNearbyEnemies(3f, ignoreWalls: true, includeDead: false, includeGone: false, includeInvulnerable: true)) { HealthHaver healthHaver = ((BraveBehaviour)allNearbyEnemy).healthHaver; healthHaver.ApplyDamage(_slapDamage, Vector2.zero, "SLAPPP", (CoreDamageTypes)0, (DamageCategory)2, true, (PixelCollider)null, false); if (!healthHaver.IsBoss && !healthHaver.IsSubboss) { KnockbackDoer knockbackDoer = ((BraveBehaviour)allNearbyEnemy).knockbackDoer; if (knockbackDoer != null) { knockbackDoer.ApplyKnockback(_slapAngle, num, false); } } if (Object.op_Implicit((Object)(object)((BraveBehaviour)allNearbyEnemy).behaviorSpeculator) && !((BraveBehaviour)allNearbyEnemy).behaviorSpeculator.ImmuneToStun) { ((BraveBehaviour)allNearbyEnemy).behaviorSpeculator.Stun(_isMastered ? 10f : 2f, true); } tk2dSprite component = SpawnManager.SpawnVFX(HandCannon._ClapppShockwave, Vector2.op_Implicit(centerPosition), Quaternion.identity, true).GetComponent(); if (_isMastered) { ((tk2dBaseSprite)component).scale = new Vector3(3f, 3f, 1f); } ((tk2dBaseSprite)(object)component).PlaceAtScaledPositionByAnchor(Vector2.op_Implicit(worldCenter), (Anchor)4); } Object.Destroy((Object)(object)this); } } public class Glockarina : CwaffGun { internal enum Mode { DEFAULT, STORM, TIME, SARIA, EMPTY, BOLERO, REQUIEM, DOUBLE, SUN, PRELUDE, HEALING, WHAT } private enum Note { UP, LEFT, RIGHT, DOWN, A } [HarmonyPatch(/*Could not decode attribute arguments.*/)] private class ChestOpenPatch { [HarmonyILManipulator] private static void OnSpewContentsOntoGroundIL(ILContext il, MethodBase original) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown ILCursor val = new ILCursor(il); Type ot = original.DeclaringType; if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchStfld(instr, ot, ot.GetEnumeratorFieldName("displayTime")) })) { val.CallPrivate(typeof(Glockarina), "OnChestOpen"); } } } public static string ItemName = "Glockarina"; public static string ShortDescription = "ShOOT 'em Up"; public static string LongDescription = "Fires musical notes as projectiles. Reloading with a full clip while aiming in a cardinal direction will play a note corresponding to that direction. Playing certain songs can change the properties of the projectiles or have other side effects."; public static string Lore = "An unorthodox toy gun brought into the Gungeon by a teary-eyed child, who received it as a seasonal gift from 'one of Santa's elves'. Legend holds that the spirits of various phantoms have been masked inside this gun since ages long past, and that breathing wind through the gun while raising it skyward at twilight can awaken their diminished powers."; internal const string _StormSpriteUI = "cg:_GlockStormSpriteUI"; internal const string _TimeSpriteUI = "cg:_GlockTimeSpriteUI"; internal const string _SariaSpriteUI = "cg:_GlockSariaSpriteUI"; internal const string _EmptySpriteUI = "cg:_GlockEmptySpriteUI"; private const float _MOUSE_DEAD_ZONE_SQR = 4f; private const float _CONTROLLER_DEAD_ZONE_SQR = 0.16f; private const float _DECOY_LIFE = 2f; internal static GameObject _DecoyPrefab = null; internal static GameObject _NoteVFXPrefab = null; private static Projectile _Projectile = null; private static int _GlockarinaPickupID = -1; private static List> _Songs = new List> { null, new List { Note.A, Note.DOWN, Note.UP, Note.A, Note.DOWN, Note.UP }, new List { Note.RIGHT, Note.A, Note.DOWN, Note.RIGHT, Note.A, Note.DOWN }, new List { Note.DOWN, Note.RIGHT, Note.LEFT, Note.DOWN, Note.RIGHT, Note.LEFT }, new List { Note.RIGHT, Note.LEFT, Note.RIGHT, Note.DOWN, Note.RIGHT, Note.UP, Note.LEFT }, new List { Note.DOWN, Note.A, Note.DOWN, Note.A, Note.RIGHT, Note.DOWN, Note.RIGHT, Note.DOWN }, new List { Note.A, Note.DOWN, Note.A, Note.RIGHT, Note.DOWN, Note.A }, new List { Note.RIGHT, Note.RIGHT, Note.A, Note.A, Note.DOWN, Note.DOWN }, new List { Note.RIGHT, Note.DOWN, Note.UP, Note.RIGHT, Note.DOWN, Note.UP }, new List { Note.UP, Note.RIGHT, Note.UP, Note.RIGHT, Note.LEFT, Note.UP }, new List { Note.LEFT, Note.RIGHT, Note.DOWN, Note.LEFT, Note.RIGHT, Note.DOWN }, new List { Note.A, Note.A, Note.UP, Note.RIGHT } }; internal Mode _mode; private List _lastNotes = new List(); private DamageTypeModifier _electricImmunity; [SerializeField] private bool _didHealThisFloor; private static float _LastReloadNoteSpriteTime = 0f; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 24; int? reloadFps = 20; Items? muzzleFrom = Items.Mailbox; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)50, 1.2f, 400, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: true, null, null, shootFps, reloadFps, null, null, "glockarina_shoot_sound", "glockarina_reload_sound", 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).Attach((Action)null, allowDuplicates: false); int? clipSize = 12; float? cooldown = 0.2f; float? speed = 35f; float? damage = 7.5f; bool? shouldRotate = false; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "glockarina_projectile", 12, (Anchor)3, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, shouldRotate)).Assign(out _Projectile); _DecoyPrefab = ((Component)ItemHelper.Get(Items.Decoy)).GetComponent().objectToSpawn.ClonePrefab(); _DecoyPrefab.GetComponent().DeathExplosionTimer = 2f; _NoteVFXPrefab = VFX.Create("note_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } private static void OnChestOpen() { if (_GlockarinaPickupID < 0) { _GlockarinaPickupID = Lazy.PickupId(); } if (Lazy.AnyoneHasGun(_GlockarinaPickupID) || CwaffConfig._Gunfig.Enabled("Enable Fun Chest Sounds")) { ((Component)GameManager.Instance).gameObject.Play("zelda_chest_sound"); } } private void UpdateMode() { PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null) { if (_mode == Mode.STORM) { ((BraveBehaviour)playerOwner).healthHaver.damageTypeModifiers.AddUnique(_electricImmunity); } else { ((BraveBehaviour)playerOwner).healthHaver.damageTypeModifiers.Remove(_electricImmunity); } } } public override void OnPlayerPickup(PlayerController player) { //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_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_0026: Expected O, but got Unknown if (_electricImmunity == null) { _electricImmunity = new DamageTypeModifier { damageType = (CoreDamageTypes)64, damageMultiplier = 0f }; } base.OnPlayerPickup(player); UpdateMode(); UpdateAmmo(); GameManager.Instance.OnNewLevelFullyLoaded += OnNewLevelFullyLoaded; } public override void OnDroppedByPlayer(PlayerController player) { GameManager.Instance.OnNewLevelFullyLoaded -= OnNewLevelFullyLoaded; base.OnDroppedByPlayer(player); ((BraveBehaviour)player).healthHaver.damageTypeModifiers.Remove(_electricImmunity); } public override void OnDestroy() { GameManager.Instance.OnNewLevelFullyLoaded -= OnNewLevelFullyLoaded; if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((BraveBehaviour)((GunBehaviour)this).PlayerOwner).healthHaver.damageTypeModifiers.Remove(_electricImmunity); } base.OnDestroy(); } private void OnNewLevelFullyLoaded() { _didHealThisFloor = false; } private void UpdateAmmo() { ((GunBehaviour)this).gun.LocalInfiniteAmmo = base.Mastered; ((GunBehaviour)this).gun.DefaultModule.ammoCost = ((!base.Mastered) ? 1 : 0); } public override void OnMasteryStatusChanged() { UpdateAmmo(); } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); UpdateAmmo(); } private bool HandleSpecialSong(Mode song) { //IL_01c3: 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: Invalid comparison between Unknown and I4 //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Invalid comparison between Unknown and I4 //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Invalid comparison between Unknown and I4 //IL_00b0: Unknown result type (might be due to invalid IL or missing references) PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null) { return false; } switch (song) { case Mode.DOUBLE: if ((float)((GunBehaviour)this).gun.CurrentAmmo < 0.35f * (float)((GunBehaviour)this).gun.AdjustedMaxAmmo) { return false; } if (playerOwner.CurrentRoom == null || (int)playerOwner.CurrentRoom.area.PrototypeRoomCategory == 3) { return false; } playerOwner.CurrentRoom.ClearReinforcementLayers(); foreach (AIActor allNearbyEnemy in ((GameActor)playerOwner).CenterPosition.GetAllNearbyEnemies()) { if (!allNearbyEnemy.IsABoss()) { ((BraveBehaviour)allNearbyEnemy).healthHaver.ApplyDamage(10000000f, Vector2.zero, "Double Time", (CoreDamageTypes)1, (DamageCategory)5, true, (PixelCollider)null, false); } } ((GunBehaviour)this).gun.LoseAmmo(Mathf.CeilToInt(0.35f * (float)((GunBehaviour)this).gun.AdjustedMaxAmmo)); return true; case Mode.SUN: if (playerOwner.CurrentRoom != null && playerOwner.CurrentRoom.IsDarkAndTerrifying) { playerOwner.CurrentRoom.EndTerrifyingDarkRoom(1f, 0.1f, 1f, "Play_ENM_lighten_world_01"); return true; } return false; case Mode.PRELUDE: if (playerOwner.CurrentRoom == null || !playerOwner.CurrentRoom.CanTeleportFromRoom()) { return false; } foreach (RoomHandler room in GameManager.Instance.Dungeon.data.rooms) { if ((int)room.area.PrototypeRoomCategory == 5 && (int)room.area.PrototypeRoomSpecialSubcategory == 1) { playerOwner.AttemptTeleportToRoom(room, true, false); return true; } } return false; case Mode.HEALING: if (_didHealThisFloor) { return false; } LootEngine.SpawnHealth(((GameActor)playerOwner).CenterPosition, 1, (Vector2?)null, 4f, 0.05f); _didHealThisFloor = true; return true; case Mode.WHAT: ((Component)this).gameObject.Play("sans_laugh"); return false; default: return false; } } public override void OnActualReload(PlayerController player, Gun gun, bool manual) { base.OnActualReload(player, gun, manual); if (gun.ClipShotsRemaining <= 0 && base.Mastered) { ((MonoBehaviour)((GunBehaviour)this).gun).StartCoroutine(DoRadialMusic()); } } private IEnumerator DoRadialMusic() { int i = 0; while (i < 3 && Object.op_Implicit((Object)(object)this) && Object.op_Implicit((Object)(object)((GunBehaviour)this).gun) && Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { float num = Random.value * 45f; for (int j = 0; j < 8; j++) { Projectile component = SpawnManager.SpawnProjectile(((Component)_Projectile).gameObject, ((GunBehaviour)this).gun.barrelOffset.position, ((float)j * 45f + num).EulerZ(), true).GetComponent(); component.SetOwnerAndStats((GameActor)(object)((GunBehaviour)this).PlayerOwner); ((GunBehaviour)this).PostProcessProjectile(component); component.SetSpeed(component.baseData.speed / 2f); } yield return (object)new WaitForSeconds(0.3f); int num2 = i + 1; i = num2; } } public override void OnFullClipReload(PlayerController player, Gun gun) { //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_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_0015: 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_004d: 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_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: 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_038a: Unknown result type (might be due to invalid IL or missing references) bool flag = player.IsKeyboardAndMouse(); Vector2 val = (flag ? (Vector3Extensions.XY(player.unadjustedAimPoint) - ((GameActor)player).CenterPosition) : ((TwoAxisInputControl)player.m_activeActions.Aim).Vector); Note note = Note.A; if (((Vector2)(ref val)).sqrMagnitude > (flag ? 4f : 0.16f)) { float num = Vector2Extensions.ToAngle(val).Clamp180(); note = ((Mathf.Abs(num) < 45f) ? Note.RIGHT : ((Mathf.Abs(num) > 135f) ? Note.LEFT : ((!(num > 0f)) ? Note.DOWN : Note.UP))); } ((Component)this).gameObject.Play("ocarina_note_up_stop_all"); ((Component)this).gameObject.Play("ocarina_note_left_stop_all"); ((Component)this).gameObject.Play("ocarina_note_right_stop_all"); ((Component)this).gameObject.Play("ocarina_note_down_stop_all"); ((Component)this).gameObject.Play("ocarina_note_neutral_stop_all"); switch (note) { case Note.UP: ((Component)this).gameObject.Play("ocarina_note_up"); break; case Note.LEFT: ((Component)this).gameObject.Play("ocarina_note_left"); break; case Note.RIGHT: ((Component)this).gameObject.Play("ocarina_note_right"); break; case Note.DOWN: ((Component)this).gameObject.Play("ocarina_note_down"); break; case Note.A: ((Component)this).gameObject.Play("ocarina_note_neutral"); break; } GameObject noteVFXPrefab = _NoteVFXPrefab; Vector3 position = Vector2.op_Implicit(((BraveBehaviour)player).sprite.WorldTopCenter); Vector2? velocity = Random.Range(40f, 50f).ToVector(4f); float? fadeOutTime = 0.4f; int specificFrame = (int)note; CwaffVFX.Spawn(noteVFXPrefab, position, null, velocity, 0.65f, fadeOutTime, 0f, null, fadeIn: false, null, null, null, randomFrame: false, specificFrame); if (_lastNotes.Count >= 8) { _lastNotes.RemoveAt(0); } _lastNotes.Add(note); Mode? mode = null; for (int i = 1; i < _Songs.Count; i++) { List list = _Songs[i]; int num2 = list.Count - 1; int num3 = _lastNotes.Count - 1; while (num3 >= 0 && _lastNotes[num3] == list[num2]) { if (--num2 < 0) { mode = (Mode)i; break; } num3--; } } if (!mode.HasValue || mode.Value == _mode) { return; } if (mode.Value >= Mode.DOUBLE) { if (HandleSpecialSong(mode.Value)) { ((Component)this).gameObject.Play("ocarina_song_success"); _lastNotes.Clear(); } return; } _mode = mode.Value; UpdateMode(); for (int j = 0; j < 6; j++) { GameObject noteVFXPrefab2 = _NoteVFXPrefab; Vector3 position2 = Vector2.op_Implicit(((BraveBehaviour)player).sprite.WorldTopCenter); velocity = Random.Range(45f + 15f * (float)j, 45f + 15f * (float)(j + 1)).ToVector(4f); fadeOutTime = 0.4f; CwaffVFX.Spawn(noteVFXPrefab2, position2, null, velocity, 0.65f, fadeOutTime, 0f, null, fadeIn: false, null, null, null, randomFrame: true); } ((Component)this).gameObject.Play("ocarina_song_success"); _lastNotes.Clear(); } public override void PostProcessProjectile(Projectile projectile) { //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_0039: 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_00dd: 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) ((GunBehaviour)this).PostProcessProjectile(projectile); switch (_mode) { case Mode.STORM: { projectile.damageTypes = (CoreDamageTypes)(projectile.damageTypes | 0x40); GoopModifier obj4 = ((Component)projectile).gameObject.AddComponent(); obj4.SpawnGoopOnCollision = true; obj4.CollisionSpawnRadius = 1f; obj4.SpawnGoopInFlight = true; obj4.InFlightSpawnRadius = 0.4f; obj4.InFlightSpawnFrequency = 1f / 60f; obj4.goopDefinition = EasyGoopDefinitions.WaterGoop; break; } case Mode.TIME: ((Component)projectile).gameObject.AddComponent(); break; case Mode.SARIA: { HomingModifier obj3 = ((Component)projectile).gameObject.AddComponent(); obj3.HomingRadius = 10f; obj3.AngularVelocity = 720f; ProjectileData baseData = projectile.baseData; baseData.damage *= 1.25f; break; } case Mode.EMPTY: ((Component)projectile).gameObject.AddComponent(); break; case Mode.BOLERO: { projectile.damageTypes = (CoreDamageTypes)(projectile.damageTypes | 4); GoopModifier obj2 = ((Component)projectile).gameObject.AddComponent(); obj2.SpawnGoopOnCollision = true; obj2.CollisionSpawnRadius = 1f; obj2.SpawnGoopInFlight = true; obj2.InFlightSpawnRadius = 0.4f; obj2.InFlightSpawnFrequency = 1f / 60f; obj2.goopDefinition = EasyGoopDefinitions.FireDef; break; } case Mode.REQUIEM: { PierceProjModifier obj = ((Component)projectile).gameObject.AddComponent(); obj.penetration = 999; obj.penetratesBreakables = true; break; } } } public override void Update() { //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_0097: Unknown result type (might be due to invalid IL or missing references) base.Update(); if (BraveTime.DeltaTime != 0f && ((GunBehaviour)this).gun.IsReloading && !(BraveTime.ScaledTimeSinceStartup - _LastReloadNoteSpriteTime < 0.1f) && Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { int currentFrame = ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.CurrentFrame; if (currentFrame >= 4 && currentFrame <= 12) { _LastReloadNoteSpriteTime = BraveTime.ScaledTimeSinceStartup; GameObject noteVFXPrefab = _NoteVFXPrefab; Vector3 position = Vector2.op_Implicit(((BraveBehaviour)((GunBehaviour)this).PlayerOwner).sprite.WorldTopCenter); Vector2? velocity = Random.Range(45f, 135f).ToVector(4f); float? fadeOutTime = 0.4f; CwaffVFX.Spawn(noteVFXPrefab, position, null, velocity, 0.65f, fadeOutTime, 0f, null, fadeIn: false, null, null, null, randomFrame: true); } } } private void LateUpdate() { if (((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.currentClip.name == ((GunBehaviour)this).gun.reloadAnimation) { ((GunBehaviour)this).gun.RenderInFrontOfPlayer(); } } } public class GlockarinaAmmoDisplay : CustomAmmoDisplay { private Gun _gun; private Glockarina _glock; private PlayerController _owner; private void Start() { _gun = ((Component)this).GetComponent(); _glock = ((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; } string text = null; switch (_glock._mode) { case Glockarina.Mode.STORM: text = "glockarina_storm_ui_icon"; break; case Glockarina.Mode.TIME: text = "glockarina_time_ui_icon"; break; case Glockarina.Mode.SARIA: text = "glockarina_saria_ui_icon"; break; case Glockarina.Mode.EMPTY: text = "glockarina_empty_ui_icon"; break; case Glockarina.Mode.BOLERO: text = "glockarina_fire_ui_icon"; break; case Glockarina.Mode.REQUIEM: text = "glockarina_spirit_ui_icon"; break; default: uic.GunAmmoCountLabel.Text = CustomAmmoDisplayExtensions.VanillaAmmoDisplay(_owner); return true; } uic.GunAmmoCountLabel.Text = "[sprite \"" + text + "\"]\n" + CustomAmmoDisplayExtensions.VanillaAmmoDisplay(_owner); return true; } } public class SlowNearbyBullets : MonoBehaviour { private class SlowedByGlockarina : MonoBehaviour { } private const float _REACH_SQR = 4f; private const float _BULLET_TIME_SCALE = 0.5f; private Projectile _projectile; private PlayerController _owner; private void Start() { _projectile = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); } private void Update() { //IL_0048: 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_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) foreach (Projectile allProjectile in StaticReferenceManager.AllProjectiles) { if (!((Behaviour)allProjectile).isActiveAndEnabled || allProjectile.Owner is PlayerController || Object.op_Implicit((Object)(object)((Component)allProjectile).GetComponent())) { continue; } Vector3 val = ((BraveBehaviour)allProjectile).transform.position - ((BraveBehaviour)_projectile).transform.position; if (((Vector3)(ref val)).sqrMagnitude > 4f) { continue; } BulletScriptBehavior component = ((Component)allProjectile).GetComponent(); if (component != null) { Bullet bullet = component.bullet; if (bullet != null) { bullet.Speed *= 0.5f; goto IL_00a5; } } allProjectile.MultiplySpeed(0.5f); goto IL_00a5; IL_00a5: ((Component)(object)allProjectile).AddComponent(); ((BraveBehaviour)allProjectile).transform.DoMovingDistortionWave(1.5f, 0.25f, 0.25f, 0.15f); } } } public class CreateDecoyOnKill : MonoBehaviour { private Projectile _projectile; private PlayerController _owner; private void Start() { _projectile = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); Projectile projectile = _projectile; projectile.OnWillKillEnemy = (Action)Delegate.Combine(projectile.OnWillKillEnemy, new Action(OnWillKillEnemy)); } private void OnWillKillEnemy(Projectile bullet, SpeculativeRigidbody enemy) { //IL_0001: 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_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_004e: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector2Extensions.ToVector3ZUp(enemy.UnitCenter, 0f); GameObject decoyPrefab = Glockarina._DecoyPrefab; Vector3? position = val; Anchor? anchor = (Anchor)1; SpeculativeRigidbody component = decoyPrefab.Instantiate(position, null, anchor).GetComponent(); if (component != null) { component.RegisterGhostCollisionException(((BraveBehaviour)_owner).specRigidbody); } Lazy.DoSmokeAt(val); } } public class MacchiAuto : CwaffGun { public static string ItemName = "Macchi Auto"; public static string ShortDescription = "Espresso Shots"; public static string LongDescription = "Fires a stream of coffee that inflicts a stacking caffeinated status on enemies, increasing their speed but inflicting damage over time. Standing inside a pool of coffee slows down time for all objects other than the player."; public static string Lore = "This gun was designed to answer one simple question: 'what would happen if you filled a water gun with espresso?' While the gun's designer may have been the first and only person to ever ask this question, it turns out many of the Gundead are actually very sensitive to caffeine and enter a berserker-like state when exposed to it. Assuming you can stay out of their warpath, the caffeine quickly takes its toll on even the most resilient among the Gundead."; internal static OverdoseEffect _OverdoseEffect = null; internal static Color _OverdoseTint = new Color(0.25f, 0.125f, 0f, 1f); public static void Init() { //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore).SetAttributes((ItemQuality)2, (GunClass)20, 1f, 100, Items.MegaDouser, defaultAudio: true, infiniteAmmo: false, 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).AddToShop((ShopType)2) .AddToShop((ShopType)0); Projectile baseProjectile = Items.MegaDouser.Projectile(); int? clipSize = -1; float? damage = 1f; float? speed = 50f; float? force = 0f; bool? beamInterpolate = false; GoopDefinition coffeeGoop = EasyGoopDefinitions.CoffeeGoop; gun.InitProjectile(GunData.New(null, baseProjectile, clipSize, null, null, (ShootStyle)2, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 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, null, null, null, null, "overdose", 20, -1, -1, -1, -1, -1, beamLoopCharge: true, 3f, -1, -1f, 0f, coffeeGoop, beamInterpolate, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: true)).Attach(); _OverdoseEffect = new OverdoseEffect { TintColor = _OverdoseTint, DeathTintColor = _OverdoseTint, AppliesTint = true, AppliesDeathTint = true, AffectsEnemies = true, duration = 10000000f, effectIdentifier = ItemName, stackMode = (EffectStackingMode)3 }; } public override void PostProcessBeam(BeamController beam) { ((GunBehaviour)this).PostProcessBeam(beam); if (base.Mastered) { ((Component)beam).gameObject.GetComponent().goopDefinition = EasyGoopDefinitions.SuperCoffeeGoop; } } } public class OverdoseJuice : MonoBehaviour { private void Start() { ((Component)this).GetComponent().statusEffectsToApply.Add((GameActorEffect)(object)MacchiAuto._OverdoseEffect); } } public class OverdoseEffect : GameActorEffect { private const float _ACCUM_RATE = 0.5f; private const float _DAMAGE_RATE = 10f; public override void OnDarkSoulsAccumulate(GameActor actor, RuntimeGameActorEffectData effectData, float partialAmount = 1f, Projectile sourceProjectile = null) { AIActor val = (AIActor)(object)((actor is AIActor) ? actor : null); if (val != null) { effectData.accumulator += partialAmount * 0.5f * BraveTime.DeltaTime; val.LocalTimeScale = 1f + effectData.accumulator; } } public override void EffectTick(GameActor actor, RuntimeGameActorEffectData effectData) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) AIActor val = (AIActor)(object)((actor is AIActor) ? actor : null); if (val != null) { float num = 10f * effectData.accumulator; ((BraveBehaviour)val).healthHaver.ApplyDamage(num * num * BraveTime.DeltaTime, Vector2.zero, base.effectIdentifier, (CoreDamageTypes)0, (DamageCategory)1, false, (PixelCollider)null, false); } } } public class GameActorCaffeineGoopEffect : GameActorSpeedEffect { public class CaffeineAnimationSpeedCorrector : MonoBehaviour { private PlayerController _player; private tk2dSpriteAnimator _animator; private float _speed = -1f; public void Setup(float speed) { _player = ((Component)this).gameObject.GetComponent(); _player.OnPreDodgeRoll += ClearTimeScale; _animator = ((BraveBehaviour)_player).spriteAnimator; _speed = speed; } private void OnDestroy() { _player.OnPreDodgeRoll -= ClearTimeScale; } private void ClearTimeScale(PlayerController controller) { _animator.OverrideTimeScale = 0f; } private void Update() { if (_player.IsDodgeRolling) { _animator.OverrideTimeScale = 0f; } else { _animator.OverrideTimeScale = _speed; } } } private static GameObject _DummyCaffeineTimeScaleObject; private StatModifier[] _caffeineGoopBuffs; public override void OnEffectApplied(GameActor actor, RuntimeGameActorEffectData effectData, float partialAmount = 1f) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown ((GameActorSpeedEffect)this).OnEffectApplied(actor, effectData, partialAmount); PlayerController val = (PlayerController)(object)((actor is PlayerController) ? actor : null); if (val != null) { if (!Object.op_Implicit((Object)(object)_DummyCaffeineTimeScaleObject)) { _DummyCaffeineTimeScaleObject = new GameObject(); } float num = 1f / base.SpeedMultiplier; BraveTime.SetTimeScaleMultiplier(num, _DummyCaffeineTimeScaleObject); if (_caffeineGoopBuffs == null) { _caffeineGoopBuffs = (StatModifier[])(object)new StatModifier[3] { ((StatType)1).Mult(base.SpeedMultiplier), ((StatType)28).Mult(base.SpeedMultiplier), ((StatType)10).Mult(num) }; } StatModifier[] caffeineGoopBuffs = _caffeineGoopBuffs; foreach (StatModifier item in caffeineGoopBuffs) { val.ownerlessStatModifiers.AddUnique(item); } val.stats.RecalculateStats(val, false, false); ((BraveBehaviour)val).spriteAnimator.OverrideTimeScale = base.SpeedMultiplier; GameObjectExtensions.GetOrAddComponent(((Component)val).gameObject).Setup(base.SpeedMultiplier); } } public override void OnEffectRemoved(GameActor actor, RuntimeGameActorEffectData effectData) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown ((GameActorSpeedEffect)this).OnEffectRemoved(actor, effectData); PlayerController val = (PlayerController)(object)((actor is PlayerController) ? actor : null); if (val != null) { StatModifier[] caffeineGoopBuffs = _caffeineGoopBuffs; foreach (StatModifier item in caffeineGoopBuffs) { val.ownerlessStatModifiers.Remove(item); } val.stats.RecalculateStats(val, false, false); if (!Object.op_Implicit((Object)(object)_DummyCaffeineTimeScaleObject)) { _DummyCaffeineTimeScaleObject = new GameObject(); } BraveTime.SetTimeScaleMultiplier(1f, _DummyCaffeineTimeScaleObject); CaffeineAnimationSpeedCorrector component = ((Component)val).gameObject.GetComponent(); if (component != null) { Object.Destroy((Object)(object)component); } ((BraveBehaviour)val).spriteAnimator.OverrideTimeScale = 0f; } } } public class SubtractorBeam : CwaffGun { public static string ItemName = "Subtractor Beam"; public static string ShortDescription = "What's the Difference?"; public static string LongDescription = "Fires a piercing beam that uses the health of the first enemy it hits as its damage. The beam's damage is reduced by the health of each subsequent enemy it hits, and dissipates once its damage reaches zero. Cannot damage the first enemy it hits. Reveals enemies' health while active."; public static string Lore = "In a time and place where weaponry seems to have an ever-increasing disregard for the biology, chemistry, and physics that govern our universe, the Subtractor Beam spits in the face of something even more fundamental: math. Invented by someone who wasn't a mad scientist so much as a moderately irritable elementary school professor, the destructive potential of this gun has been calibrated to vary with the resilience of the first object it passes through. As to why a weapon with near limitless potential would be designed with such arbitrary limitations, the creator has claimed it is 'to show the kids that subtraction tables ARE useful in real life! Now if only I could do something for multiplication tables....'"; internal static CwaffTrailController _GreenTrailPrefab; internal static CwaffTrailController _RedTrailPrefab; internal static GameObject _HitEffects; private static readonly LinkedList _PooledNametags = new LinkedList(); private static readonly LinkedList _ActiveNametags = new LinkedList(); private static bool _EverPickedUp = false; internal HealthHaver _lastHitEnemy; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? idleFps = 10; int? shootFps = 24; int? reloadFps = 30; Gun gun2 = gun.SetAttributes((ItemQuality)1, (GunClass)15, 1.25f, 300, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, idleFps, shootFps, reloadFps, null, null, null, "subtractor_beam_reload_sound", null, -1, -1, -1, null, modulesAreTiers: false, "muzzle_subtractor_beam", 30, 0.3f, (Anchor)4, -1f, null, -1f, muzzleLit: false, 0f, 0f, null, null, preventRotation: false, 0f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: true, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0, autoPlay: true, attacksThroughWalls: false, suppressReloadLabel: false, 1f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: false, preventRollingWhenCharging: false, 1f, 0.1f).Attach((Action)null, allowDuplicates: false); int? clipSize = 4; float? cooldown = 0.25f; float? angleVariance = 5f; float? damage = 0f; float? speed = 300f; float? force = 0f; float? range = 300f; bool? uniqueSounds = true; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, 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, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, "subtractor_beam_fire_sound", null, uniqueSounds)).Attach((Action)delegate(PierceProjModifier pierce) { pierce.penetration = 999; pierce.penetratesBreakables = true; }, allowDuplicates: false).Attach(); _GreenTrailPrefab = VFX.CreateSpriteTrailObject("subtractor_beam_mid", 60, "subtractor_beam_start", -1f, 1f / 60f, 1f, destroyOnEmpty: true); _RedTrailPrefab = VFX.CreateSpriteTrailObject("subtractor_beam_red_mid", 60, "subtractor_beam_red_start", -1f, 1f / 60f, 1f, destroyOnEmpty: true); _HitEffects = VFX.Create("subtractor_beam_hit_effect", 12f, loops: true, -1, 0.5f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 10f); } public override void OnDroppedByPlayer(PlayerController player) { ClearNametags(); base.OnDroppedByPlayer(player); } public override void OnDestroy() { ClearNametags(); base.OnDestroy(); } public override void OnSwitchedAwayFromThisGun() { ClearNametags(); base.OnSwitchedAwayFromThisGun(); } public override void Update() { base.Update(); ClearNametags(); if (!GameManager.Instance.IsLoadingLevel && !GameManager.Instance.IsPaused && BraveTime.DeltaTime != 0f) { PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null && Object.op_Implicit((Object)(object)((BraveBehaviour)playerOwner).healthHaver) && ((BraveBehaviour)playerOwner).healthHaver.IsAlive) { YouShallKnowTheirNames(playerOwner); } } } private void ClearNametags() { while (true) { LinkedListNode last = _ActiveNametags.Last; if (last != null) { _ActiveNametags.RemoveLast(); dfLabel value = last.Value; if (value != null) { ((dfControl)value).IsVisible = false; _PooledNametags.AddLast(last); } continue; } break; } } private static void OnNewFloorReached() { _PooledNametags.Clear(); } private void YouShallKnowTheirNames(PlayerController player) { //IL_003d: 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_010c: 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) if (!_EverPickedUp) { _EverPickedUp = true; CwaffEvents.OnNewFloorFullyLoaded = (Action)Delegate.Combine(CwaffEvents.OnNewFloorFullyLoaded, new Action(OnNewFloorReached)); } foreach (AIActor allNearbyEnemy in ((GameActor)player).CenterPosition.GetAllNearbyEnemies(100f, ignoreWalls: true, includeDead: false, includeGone: false, includeInvulnerable: true)) { if (Object.op_Implicit((Object)(object)((BraveBehaviour)allNearbyEnemy).sprite)) { if (_PooledNametags.Count == 0) { _PooledNametags.AddLast(EasyLabel.Create(unicode: false, outline: true, (TextAlignment)1)); } LinkedListNode last = _PooledNametags.Last; _PooledNametags.RemoveLast(); _ActiveNametags.AddLast(last); dfLabel val = last.Value; if (val == null) { dfLabel val2 = (last.Value = EasyLabel.Create(unicode: false, outline: true, (TextAlignment)1)); val = val2; } val.Text = $"{Mathf.CeilToInt(((BraveBehaviour)allNearbyEnemy).healthHaver.currentHealth)}[sprite \"mini_heart_ui\"]"; val.Place(((BraveBehaviour)allNearbyEnemy).sprite.WorldBottomCenter + new Vector2(0f, -0.75f)); } } } internal void SetLastEnemy(HealthHaver enemy) { if (base.Mastered) { _lastHitEnemy = enemy; } } internal HealthHaver GetLastEnemy() { HealthHaver lastHitEnemy = _lastHitEnemy; _lastHitEnemy = null; return lastHitEnemy; } } public class SubtractorBeamAmmoDisplay : CustomAmmoDisplay { private Gun _gun; private SubtractorBeam _sub; private PlayerController _owner; private void Start() { _gun = ((Component)this).GetComponent(); _sub = ((Component)_gun).gameObject.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)_sub) || !_sub.Mastered) { return false; } float num = (Object.op_Implicit((Object)(object)_sub._lastHitEnemy) ? _sub._lastHitEnemy.currentHealth : 0f); uic.GunAmmoCountLabel.Text = $"[color #66dd66]{num}[/color]\n{CustomAmmoDisplayExtensions.VanillaAmmoDisplay(_owner)}"; return true; } } public class SubtractorProjectile : MonoBehaviour { private const int _NUM_HIT_PARTICLES = 5; private Projectile _projectile; private PlayerController _owner; private HealthHaver _hitFirstEnemy; private bool _hitTwoEnemies; private float _damage; private float _postHitDamage; private CwaffTrailController _trail; private SubtractorBeam _gun; private void Start() { //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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 _projectile = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); Gun currentGun = ((GameActor)_owner).CurrentGun; if (currentGun != null) { SubtractorBeam component = ((Component)currentGun).gameObject.GetComponent(); if (component != null) { _gun = component; _hitFirstEnemy = component.GetLastEnemy(); _damage = Mathf.Max(0f, Object.op_Implicit((Object)(object)_hitFirstEnemy) ? _hitFirstEnemy.currentHealth : 0f); _projectile.baseData.damage = _damage; } } _trail = ((BraveBehaviour)(object)_projectile).AddTrail(Object.op_Implicit((Object)(object)_hitFirstEnemy) ? SubtractorBeam._RedTrailPrefab : SubtractorBeam._GreenTrailPrefab); ((Component)_trail).gameObject.SetGlowiness(100f); ((BraveBehaviour)((BraveBehaviour)_projectile).sprite).renderer.enabled = false; 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(OnHitEnemy)); _projectile.OnDestruction += OnDestruction; } private void OnDestruction(Projectile proj) { if (Object.op_Implicit((Object)(object)_gun) && !_hitTwoEnemies) { _gun.SetLastEnemy(_hitFirstEnemy); } } private void OnPreRigidbodyCollision(SpeculativeRigidbody me, PixelCollider myPixelCollider, SpeculativeRigidbody other, PixelCollider otherPixelCollider) { AIActor component = ((Component)((BraveBehaviour)other).specRigidbody).GetComponent(); if (component == null || !component.IsHostile(canBeDead: false, canBeNeutral: true) || (Object)(object)_hitFirstEnemy == (Object)(object)((BraveBehaviour)component).healthHaver) { PhysicsEngine.SkipCollision = true; } else if (Object.op_Implicit((Object)(object)_hitFirstEnemy)) { _projectile.ResetPiercing(); _postHitDamage = _damage - ((BraveBehaviour)component).healthHaver.GetCurrentHealth(); } } private void OnHitEnemy(Projectile p, SpeculativeRigidbody body, bool wasKiled) { //IL_00a8: 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) AIActor aiActor = ((BraveBehaviour)body).aiActor; if (aiActor == null || (!aiActor.IsHostile(canBeDead: false, canBeNeutral: true) && !wasKiled)) { return; } if (!Object.op_Implicit((Object)(object)_hitFirstEnemy)) { _hitFirstEnemy = ((BraveBehaviour)aiActor).healthHaver; _damage = Mathf.Ceil(_hitFirstEnemy.GetCurrentHealth()); _projectile.baseData.damage = _damage; if (Object.op_Implicit((Object)(object)_trail)) { _trail.DisconnectFromSpecRigidbody(); } _trail = ((BraveBehaviour)(object)_projectile).AddTrail(SubtractorBeam._RedTrailPrefab); ((Component)_trail).gameObject.SetGlowiness(100f); } else { CwaffVFX.SpawnBurst(SubtractorBeam._HitEffects, 5, ((GameActor)aiActor).CenterPosition, 1f, Vector2.zero, 0f, 1f, CwaffVFX.Vel.Radial, CwaffVFX.Rot.None, 0.5f, 0.5f); ((Component)aiActor).gameObject.PlayUnique("subtractor_beam_impact_sound"); _hitTwoEnemies = true; _damage = _postHitDamage; _projectile.baseData.damage = _damage; if (_damage <= 0f) { _projectile.DieInAir(false, true, true, false); } } } } public class KiBlast : CwaffGun { public static string ItemName = "Ki Blast"; public static string ShortDescription = "Dragunball Z"; public static string LongDescription = "Fires alternating ki blasts that may be reflected by sufficiently strong enemies. Reloading reflects the nearest ki blast back at the enemy, amplifying the damage after every successive reflect. Reflected projectiles are not affected by DPS caps."; public static string Lore = "Harnessing one's ki is an art form that has been taught for millennia, yet mastered by exceptionally few. Among the already small number of those able to effectively harness ki, even fewer have successfully weaponized it, and among them, only one has brought that power to the Gungeon. That Gungeoneer unfortunately got absolutely incinerated by a flamethrower they didn't see jutting out of the wall, but to this very day, the ki they released upon their untimely demise occasionally manifests itself as a weapon for others passing through the Gungeon."; internal static string _FireLeftAnim; internal static string _FireRightAnim; internal static string _KameAnim; internal static string _HameAnim; internal const float _DAMAGE_MULT_CAP = 8f; private const float _KI_REFLECT_RANGE = 3f; private const float _KI_REFLECT_RANGE_SQR = 9f; private const float _MAX_RECHARGE_TIME = 0.5f; private const float _MIN_RECHARGE_TIME = 0.05f; private const float _RECHARGE_DECAY = 0.9f; private const float _CHARGE_START_TIME = 0.5f; private const float _CHARGE_FINISH_TIME = 4.5f; private const float _CHARGE_TOTAL_TIME = 4f; private const float _CHARGE_SOUND_DELAY = 0.25f; private Vector2 _currentTarget = Vector2.zero; public float nextKiBlastSign = 1f; private float _rechargeTimer; private float _nextRecharge; private int _nextChargeSound = 1; private float _timeCharging; public static void Init() { //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_06fc: Expected O, but got Unknown Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? idleFps = 10; int? shootFps = 24; Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)20, 0f, 20, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: false, canReloadNoMatterAmmo: false, null, idleFps, shootFps, null, null, null, null, null, null, -1, -1, -1, null, modulesAreTiers: false, "muzzle_ki_blast", 30, 0.5f, (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).Attach((Action)null, allowDuplicates: false).Attach() .AddToShop(ModdedShopType.Boomhildr) .AssignGun(out gunRef); int? clipSize = -1; float? cooldown = 0.1f; float? damage = 4f; float? range = 1000f; float? speed = 50f; bool? ignoreDamageCaps = true; float? lightStrength = 2.1f; float? lightRange = 2.4f; Color? lightColor = Color.cyan; Projectile p = gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)3, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, range, null, 0f, 0f, 0f, 0f, null, ignoreDamageCaps, null, null, null, "ki_blast", 12, (Anchor)4, 0.25f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, "ki_blast_sound", null, null, null, null, null, null, null, null, "ki_blast_explode_sound", null, null, null, 0f, ignoredForReloadPurposes: false, mirror: false, null, null, null, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: false, 0f, null, 50f, null, null, -1, null, lightStrength, lightRange, lightColor)); lightColor = new Color(0.8f, 0.8f, 1f); p.SetAllImpactVFX(VFX.CreatePool("ki_explosion", 20f, loops: false, -1, 0.5f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 0.75f, lightColor, orphaned: false, attached: true, unlit: false, 0f, 0f, null, 20f)).Attach((Action)delegate(EasyTrailBullet trail) { //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_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_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) trail.TrailPos = ((BraveBehaviour)trail).transform.position; trail.StartWidth = 0.2f; trail.EndWidth = 0f; trail.LifeTime = 0.1f; trail.BaseColor = Color.cyan; trail.EndColor = Color.cyan; }, allowDuplicates: false).Attach() .Attach(); Gun gun3 = gunRef; ProjectileModule[] array = new ProjectileModule[1]; ProjectileModule val = new ProjectileModule(); Gun gun4 = gunRef; Projectile baseProjectile = Items.Moonscraper.Projectile(); int? clipSize2 = -1; float? cooldown2 = 0.18f; lightRange = 100f; lightStrength = -1f; float? angleVariance = 0f; ignoreDamageCaps = true; array[0] = GunBuilder.InitSingleProjectileModule(val, GunData.New(gun4, baseProjectile, clipSize2, cooldown2, angleVariance, (ShootStyle)2, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, lightRange, lightStrength, null, null, null, 0f, 0f, 0f, 0f, null, ignoreDamageCaps, null, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 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, null, null, null, null, "kamehameha", 30, -1, -1, 20, -1, 30, beamLoopCharge: true, 160f, 0, 4.5f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: false, 0f, null, 0f, null, null, 30)); gun3.AddSynergyModules(Synergy.MASTERY_KI_BLAST, (ProjectileModule[])(object)array); _FireLeftAnim = gunRef.shootAnimation; _FireRightAnim = gunRef.QuickUpdateGunAnimation("fire_alt", null, returnToIdle: true, 24); _KameAnim = gunRef.QuickUpdateGunAnimation("kame"); _HameAnim = gunRef.QuickUpdateGunAnimation("hameha"); } public override void OnPostFired(PlayerController player, Gun gun) { ((GunBehaviour)this).OnPostFired(player, gun); gun.shootAnimation = ((nextKiBlastSign > 0f) ? _FireRightAnim : _FireLeftAnim); _rechargeTimer = 0f; _nextRecharge = 0.5f; } public override void OnReloadPressed(PlayerController player, Gun gun, bool manualReload) { //IL_0055: 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_0065: Unknown result type (might be due to invalid IL or missing references) base.OnReloadPressed(player, gun, manualReload); float num = 9f; KiBlastBehavior kiBlastBehavior = null; foreach (Projectile allProjectile in StaticReferenceManager.AllProjectiles) { if (!Object.op_Implicit((Object)(object)allProjectile) || !((Behaviour)allProjectile).isActiveAndEnabled) { continue; } KiBlastBehavior component = ((Component)allProjectile).gameObject.GetComponent(); if (Object.op_Implicit((Object)(object)component) && component.reflected) { Vector2 val = ((GameActor)player).CenterPosition - allProjectile.SafeCenter; float sqrMagnitude = ((Vector2)(ref val)).sqrMagnitude; if (!(sqrMagnitude > num)) { num = sqrMagnitude; kiBlastBehavior = component; } } } if (Object.op_Implicit((Object)(object)kiBlastBehavior)) { kiBlastBehavior.ReturnFromPlayer(player); } } public override void PostProcessBeam(BeamController beam) { ((GunBehaviour)this).PostProcessBeam(beam); if (!base.Mastered || ((GunBehaviour)this).PlayerOwner == null) { return; } Projectile projectile = ((BraveBehaviour)beam).projectile; if (projectile != null) { GameLevelDefinition lastLoadedLevelDefinition = GameManager.Instance.GetLastLoadedLevelDefinition(); if (lastLoadedLevelDefinition != null) { ProjectileData baseData = projectile.baseData; baseData.damage *= lastLoadedLevelDefinition.enemyHealthMultiplier; } } } private void UpdateIdleAnimation(string idleAnimation = null, int frame = -1) { string name = ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.CurrentClip.name; if (!(name != ((GunBehaviour)this).gun.idleAnimation) || !(name != _KameAnim) || !(name != _HameAnim)) { ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.PlayIfNotPlaying(idleAnimation ?? ((GunBehaviour)this).gun.idleAnimation); if (frame >= 0) { ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.PlayFromFrame(frame); } } } private bool HandleKamehameha() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Invalid comparison between Unknown and I4 percentSpeedWhileFiring = 1f; if (!((GunBehaviour)this).gun.IsFiring) { return false; } if (((GunBehaviour)this).gun.Volley.projectiles.Count < 2 || ((GunBehaviour)this).gun.m_moduleData == null || !((GunBehaviour)this).gun.m_moduleData.TryGetValue(((GunBehaviour)this).gun.Volley.projectiles[1], out var value)) { return false; } if (value != null) { BeamController beam = value.beam; BasicBeamController val = (BasicBeamController)(object)((beam is BasicBeamController) ? beam : null); if (val != null) { bool flag = false; if ((int)val.State == 0) { _timeCharging += BraveTime.DeltaTime; ((MonoBehaviour)(object)((GunBehaviour)this).gun).LoopSoundIf(_timeCharging >= 0.25f, "kamehameha_charge_sound"); bool flag2 = val.m_chargeTimer < 0.5f; if (Object.op_Implicit((Object)(object)val.m_beamMuzzleAnimator) && Object.op_Implicit((Object)(object)((BraveBehaviour)val.m_beamMuzzleAnimator).sprite)) { ((BraveBehaviour)((BraveBehaviour)val.m_beamMuzzleAnimator).sprite).renderer.enabled = !flag2; } if (flag2) { _nextChargeSound = 1; } else { flag = true; if (Mathf.FloorToInt(5f * (val.m_chargeTimer - 0.5f) / 4f) >= _nextChargeSound && _nextChargeSound <= 5) { ((Component)this).gameObject.Play($"kamehameha_charge_{_nextChargeSound++}_sound"); } UpdateIdleAnimation(_KameAnim, _nextChargeSound - 1); } percentSpeedWhileFiring = 1f - val.m_chargeTimer / ((BeamController)val).chargeDelay; if (Object.op_Implicit((Object)(object)val.m_beamMuzzleAnimator) && Object.op_Implicit((Object)(object)((BraveBehaviour)val.m_beamMuzzleAnimator).sprite)) { ((BraveBehaviour)val.m_beamMuzzleAnimator).sprite.SetGlowiness(500f * val.m_chargeTimer / ((BeamController)val).chargeDelay); val.m_beamMuzzleAnimator.ClipFps = 20f + 8f * val.m_chargeTimer; } } else { bool flag3 = (flag = (int)val.State == 2); if (flag3 && _nextChargeSound == 5) { ((Component)this).gameObject.Play($"kamehameha_charge_{_nextChargeSound++}_sound"); } ((MonoBehaviour)(object)((GunBehaviour)this).gun).LoopSoundIf(flag3, "kamehameha_fire_sound", 1050, 300, finishNaturally: true); percentSpeedWhileFiring = 0f; _nextChargeSound = 1; UpdateIdleAnimation(flag3 ? _HameAnim : ((GunBehaviour)this).gun.idleAnimation); } if (flag && ((GunBehaviour)this).gun.m_moduleData.TryGetValue(((GunBehaviour)this).gun.Volley.projectiles[0], out var value2)) { value2.chargeFired = true; } return true; } } return false; } public override void OwnedUpdatePlayer(PlayerController owner, GunInventory inventory) { ((GunBehaviour)this).OwnedUpdatePlayer(owner, inventory); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).gun) && ((GunBehaviour)this).gun.CurrentAmmo < ((GunBehaviour)this).gun.AdjustedMaxAmmo) { _rechargeTimer += BraveTime.DeltaTime; if (!(_rechargeTimer < _nextRecharge)) { _rechargeTimer -= _nextRecharge; _nextRecharge = Mathf.Max(_nextRecharge * 0.9f, 0.05f); ((GunBehaviour)this).gun.ammo = Math.Min(((GunBehaviour)this).gun.ammo + 1, ((GunBehaviour)this).gun.AdjustedMaxAmmo); } } } public override void Update() { base.Update(); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) && Object.op_Implicit((Object)(object)((GunBehaviour)this).gun) && !HandleKamehameha()) { _timeCharging = 0f; _nextChargeSound = 1; UpdateIdleAnimation(); } } private void LateUpdate() { bool enabled = !Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner); ((BraveBehaviour)((BraveBehaviour)((GunBehaviour)this).gun).sprite).renderer.enabled = enabled; if (!((BraveBehaviour)((BraveBehaviour)((GunBehaviour)this).gun).sprite).renderer.enabled) { SpriteOutlineManager.RemoveOutlineFromSprite(((BraveBehaviour)((GunBehaviour)this).gun).sprite, false); } } } public class KiBlastAmmoDisplay : CustomAmmoDisplay { private Gun _gun; private KiBlast _kiblast; private PlayerController _owner; private void Start() { _gun = ((Component)this).GetComponent(); _kiblast = ((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) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_owner)) { return false; } uic.SetAmmoCountLabelColor(Color.cyan); uic.GunAmmoCountLabel.Text = $"{_gun.CurrentAmmo} Ki"; return true; } } public class KiBlastBehavior : MonoBehaviour { private const float _SCALING = 1.5f; private static float _MinAngleVariance = 10f; private static float _MaxAngleVariance = 60f; private static float _MinReflectableLifetime = 0.15f; private static SlashData _BasicSlashData = null; private Projectile _projectile; private PlayerController _owner; private float _timeSinceLastReflect; private int _numReflections; private float _startingDamage; private ArcTowardsTargetBehavior _arc; public bool reflected; private void Start() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown _projectile = ((Component)this).GetComponent(); GameActor owner = _projectile.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null) { _owner = val; if (_BasicSlashData == null) { _BasicSlashData = new SlashData(); } _startingDamage = _projectile.baseData.damage; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreCollision)); float arcAngle = 0f; KiBlast component = ((Component)((GameActor)_owner).CurrentGun).GetComponent(); if (component != null) { arcAngle = Mathf.Max(Random.value * val.AccuracyMult() * _MaxAngleVariance, _MinAngleVariance) * component.nextKiBlastSign; component.nextKiBlastSign *= -1f; } _arc = ((Component)this).GetComponent(); _arc.Setup(arcAngle, 0.5f / val.ProjSpeedMult(), 15f); ((Component)_projectile).gameObject.Play("ki_blast_return_sound_stop_all"); ((Component)_projectile).gameObject.PlayUnique("ki_blast_sound"); } } private void OnPreCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_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_0096: Unknown result type (might be due to invalid IL or missing references) if (reflected || _timeSinceLastReflect < _MinReflectableLifetime) { return; } AIActor component = ((Component)otherRigidbody).GetComponent(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)((BraveBehaviour)component).healthHaver) && !(_projectile.baseData.damage >= ((BraveBehaviour)component).healthHaver.GetCurrentHealth())) { ((BraveBehaviour)component).healthHaver.ApplyDamage(_projectile.baseData.damage, _projectile.Direction, "Ki Blast", (CoreDamageTypes)0, (DamageCategory)2, false, (PixelCollider)null, true); KnockbackDoer knockbackDoer = ((BraveBehaviour)((BraveBehaviour)component).healthHaver).knockbackDoer; if (knockbackDoer != null) { knockbackDoer.ApplyKnockback(_projectile.Direction, _projectile.baseData.force, false); } PhysicsEngine.SkipCollision = true; reflected = true; Projectile projectile = _projectile; projectile.Owner = (GameActor)(object)component; projectile.collidesWithPlayer = true; projectile.collidesWithEnemies = false; _arc.SetNewTarget(((GameActor)_owner).CenterPosition); EasyTrailBullet component2 = ((Component)projectile).gameObject.GetComponent(); component2.BaseColor = Color.yellow; component2.EndColor = Color.yellow; component2.UpdateTrail(); ((Component)_projectile).gameObject.Play("ki_blast_sound_stop_all"); ((Component)_projectile).gameObject.PlayUnique("ki_blast_return_sound"); } } public void ReturnFromPlayer(PlayerController player) { //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_00d0: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_01ad: 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_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: 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) if (!reflected || !Object.op_Implicit((Object)(object)_projectile)) { return; } GameActor owner = _projectile.Owner; AIActor val = (AIActor)(object)((owner is AIActor) ? owner : null); if (val == null || !Object.op_Implicit((Object)(object)player)) { return; } RoomHandler currentRoom = player.CurrentRoom; if (currentRoom == null) { return; } _numReflections++; reflected = false; _timeSinceLastReflect = 0f; _projectile.baseData.damage = _startingDamage * Mathf.Min(8f, Mathf.Pow(1.5f, (float)_numReflections)); _projectile.Owner = (GameActor)(object)player; _projectile.collidesWithPlayer = false; _projectile.collidesWithEnemies = true; EasyTrailBullet component = ((Component)_projectile).gameObject.GetComponent(); component.BaseColor = Color.cyan; component.EndColor = Color.cyan; component.UpdateTrail(); ((Component)_projectile).gameObject.Play("ki_blast_sound_stop_all"); ((Component)_projectile).gameObject.PlayUnique("ki_blast_return_sound"); int num = 10; bool flag = true; while (!Object.op_Implicit((Object)(object)val) || !((Behaviour)val).isActiveAndEnabled || !Object.op_Implicit((Object)(object)((BraveBehaviour)val).healthHaver) || ((BraveBehaviour)val).healthHaver.IsDead) { if (--num < 0) { flag = false; break; } val = currentRoom.GetRandomActiveEnemy(true); } float angle = (flag ? Vector2Extensions.ToAngle(((GameActor)val).CenterPosition - ((GameActor)player).CenterPosition) : Lazy.RandomAngle()); _arc.SetNewTarget(flag ? ((GameActor)val).CenterPosition : (((GameActor)player).CenterPosition + player.m_currentGunAngle.ToVector(Random.Range(1f, 5f)))); SlashDoer.DoSwordSlash(((GameActor)player).CenterPosition, angle, _projectile.Owner, _BasicSlashData); } private void Update() { _timeSinceLastReflect += BraveTime.DeltaTime; } } public class Blackjack : CwaffGun { public static string ItemName = "Blackjack"; public static string ShortDescription = "Gambit's Queens"; public static string LongDescription = "Fires cards whose speed, range, and damage increase with accuracy. Ammo can only be regained by picking up cards from the floor."; public static string Lore = "Many would argue that cards do not make the best projectiles for a gun...and many would largely be correct, as their lack of raw power and aerodynamics make them rather weak and unreliable in the hands of a novice. The most proficient and well-prepared duelists, however, have demonstrated that a single deck of cards is more than capable of dealing with the Gungeon's greatest threats."; private const int _DECK_SIZE = 52; private const int _CLIP_SIZE = 13; private const int _NUM_DECKS = 3; private const int _AMMO = 156; internal static tk2dSpriteAnimationClip _BulletSprite; internal static tk2dSpriteAnimationClip _BackSprite; internal static tk2dSpriteAnimationClip _RedSprite; internal static tk2dSpriteAnimationClip _RedBackSprite; public static void Init() { //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_0779: Expected O, but got Unknown Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 30; int? reloadFps = 30; Items? muzzleFrom = Items.Mailbox; Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)2, (GunClass)50, 0.8f, 156, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: false, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "card_throw_sound", "card_shuffle_sound", 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).AddDualWieldSynergy(Synergy.BOARD_AND_CARD_GAME_NIGHT).AssignGun(out gunRef); int? clipSize = 13; float? cooldown = 0.16f; float? angleVariance = 24f; float? damage = 6f; float? speed = 22f; float? range = 999f; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, null, "blackjack_card_impact_sound")).AddAnimations(AnimatedBullet.Create(ref _BulletSprite, "playing_card", 0, (Anchor)3, 0.25f), AnimatedBullet.Create(ref _BackSprite, "playing_card_back", 0, (Anchor)3, 0.25f), AnimatedBullet.Create(ref _RedSprite, "playing_card_red", 0, (Anchor)3, 0.25f), AnimatedBullet.Create(ref _RedBackSprite, "playing_card_back_red", 0, (Anchor)3, 0.25f)).SetAllImpactVFX(VFX.CreatePool("blackjack_card_impact_vfx", 16f, loops: false, -1, 0.75f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1)) .Attach() .Assign(out Projectile projectileRef); Gun gun3 = gunRef; ProjectileModule[] array = new ProjectileModule[1]; ProjectileModule val = new ProjectileModule(); Gun gun4 = gunRef; reloadFps = 13; range = 0.16f; speed = 5f; Projectile baseProjectile = Items._38Special.Projectile(); int? clipSize2 = reloadFps; float? cooldown2 = range; float? angleVariance2 = speed; bool? becomeDebris = true; array[0] = GunBuilder.InitSingleProjectileModule(val, GunData.New(gun4, baseProjectile, clipSize2, cooldown2, angleVariance2, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 0, null, customClip: true, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "chip_projectile", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, null, "chess_move", null, null, becomeDebris, 20f, ignoredForReloadPurposes: true, mirror: true)); gun3.AddSynergyModules(Synergy.PIT_BOSS, (ProjectileModule[])(object)array); gunRef.AddSynergyFinalProjectile(Synergy.MASTERY_BLACKJACK, projectileRef.Clone().Attach(delegate(ThrownCard t) { t.explosive = true; }), "blackjack_red", 13); } } public class ThrownCard : MonoBehaviour { private class PlayingCard : MonoBehaviour { private const float PICKUP_RADIUS = 3f; private const float PICKUP_RADIUS_SQR = 9f; private tk2dBaseSprite _sprite; internal static PlayingCard Create(Projectile p) { tk2dBaseSprite val = ((BraveBehaviour)p).sprite.DuplicateInWorld(); PlayingCard playingCard = ((Component)val).gameObject.AddComponent(); playingCard._sprite = val; ((Component)playingCard).gameObject.AllowFallingIntoPits(); return playingCard; } private void Update() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00a0: 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_00a6: Unknown result type (might be due to invalid IL or missing references) Vector2 worldCenter = _sprite.WorldCenter; for (int i = 0; i < GameManager.Instance.AllPlayers.Length; i++) { PlayerController val = GameManager.Instance.AllPlayers[i]; if (!Object.op_Implicit((Object)(object)val) || val.IsGhost || ((BraveBehaviour)val).healthHaver.IsDead) { continue; } Vector2 val2 = ((GameActor)val).CenterPosition - worldCenter; if (!(((Vector2)(ref val2)).sqrMagnitude > 9f)) { Gun val3 = val.FindBaseGun(); if (val3 != null && val3.CurrentAmmo < val3.AdjustedMaxAmmo) { val3.CurrentAmmo += 1; ((Component)val).gameObject.PlayUnique("card_pickup_sound"); SpawnManager.SpawnVFX(VFX.MiniPickup, Vector2.op_Implicit(worldCenter), Lazy.RandomEulerZ()); Object.Destroy((Object)(object)((Component)this).gameObject); break; } } } } } private const float _SPIN_SPEED = 2f; private const float _BASE_LIFE = 0.33f; private const float _AIR_DRAG = 0.94f; public bool explosive; private Projectile _projectile; private PlayerController _owner; private float _lifetime; private float _distanceTraveled; private int _cardFront; private int _cardBack; private float _timeAtMaxPower; private bool _faltering; private float _curveAmount; private float _startScale = 1f; private float _startAngle; private bool _bounced; private void Start() { _projectile = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); _projectile.OnDestruction += CreatePlayingCardPickup; ((BraveBehaviour)((BraveBehaviour)_projectile).sprite).renderer.material.shader = ShaderCache.Acquire("Brave/LitBlendUber"); if (!explosive) { _cardFront = Blackjack._BulletSprite.GetFrame(0).spriteId; _cardBack = Blackjack._BackSprite.GetFrame(0).spriteId; BounceProjModifier orAddComponent = GameObjectExtensions.GetOrAddComponent(((Component)_projectile).gameObject); orAddComponent.numberOfBounces = 1; orAddComponent.chanceToDieOnBounce = 0f; orAddComponent.onlyBounceOffTiles = false; orAddComponent.OnBounce += OnBounce; } else { _cardFront = Blackjack._RedSprite.GetFrame(0).spriteId; _cardBack = Blackjack._RedBackSprite.GetFrame(0).spriteId; ((Component)_projectile).gameObject.AddComponent().explosionData = Bouncer._MiniExplosion; } CalculateStatsFromPlayerStats(); _startScale = (Lazy.CoinFlip() ? (-1f) : 1f); _startAngle = _projectile.OriginalDirection(); } private void OnBounce() { _lifetime = _timeAtMaxPower; _bounced = true; _projectile.m_usesNormalMoveRegardless = true; ProjectileData baseData = _projectile.baseData; baseData.speed *= 0.4f; } private void CalculateStatsFromPlayerStats() { float num = _owner.AccuracyMult(); float num2 = Mathf.Sqrt(1f / Mathf.Max(0.1f, num)); _timeAtMaxPower = 0.33f * Random.Range(0.8f, 1.2f); ProjectileData baseData = _projectile.baseData; baseData.damage *= Mathf.Clamp(num2, 1f, 3f); ProjectileData baseData2 = _projectile.baseData; baseData2.speed *= num2; _projectile.UpdateSpeed(); } private void Update() { //IL_0065: 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_0173: 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) if (_projectile.baseData.speed < 1f) { _projectile.DieInAir(true, true, true, false); return; } if (BraveTime.DeltaTime == 0f) { return; } _lifetime += BraveTime.DeltaTime; if (_faltering || _lifetime >= _timeAtMaxPower) { float num = Vector2Extensions.ToAngle(_projectile.Direction); bool faltering = _faltering; if (!faltering) { _faltering = true; _curveAmount = (Lazy.CoinFlip() ? (-1f) : 1f) * 5f * Random.value; if (!_bounced) { num = _startAngle; } } float num2 = BraveTime.DeltaTime * 60f; _projectile.ApplyFriction(0.94f); float num3 = num + _curveAmount * num2; if (faltering) { ProjectileMotionModule overrideMotionModule = _projectile.OverrideMotionModule; HelixProjectileMotionModule val = (HelixProjectileMotionModule)(object)((overrideMotionModule is HelixProjectileMotionModule) ? overrideMotionModule : null); if (val != null) { ((ProjectileMotionModule)val).AdjustRightVector(Mathf.DeltaAngle(num, num3)); goto IL_011b; } } _projectile.SendInDirection(BraveMathCollege.DegreesToVector(num3, 1f), true, true); } goto IL_011b; IL_011b: _distanceTraveled += BraveTime.DeltaTime * _projectile.baseData.speed; float num4 = _startScale * Mathf.Cos(2f * _distanceTraveled); ((BraveBehaviour)_projectile).sprite.scale = Vector3Extensions.WithY(((BraveBehaviour)_projectile).sprite.scale, num4); ((BraveBehaviour)_projectile).spriteAnimator.SetSprite(((BraveBehaviour)_projectile).sprite.collection, (num4 > 0f) ? _cardFront : _cardBack); } private void CreatePlayingCardPickup(Projectile p) { if (!p.FiredForFree() && Object.op_Implicit((Object)(object)((BraveBehaviour)p).sprite)) { PlayingCard.Create(p); } } } public class Macheening : CwaffGun { public static string ItemName = "Macheening"; public static string ShortDescription = "Let the Daggers Fall"; public static string LongDescription = "Fires magic blade projectiles conjured through sheer willpower. Requires unbroken concentration while firing, preventing movement or rolling. User receives double damage from all sources while this weapon is equipped."; public static string Lore = "An ancient artifact created by the first great gunsmith, Lord Kagreflak. The range of its blade is bounded only by the focus of its user, which was fantastic for warriors of yore and is awful for most scatterbrained Gungeoneers today. Despite not drawing the attention of the Jammed, you still feel uneasy holding this weapon."; private const float _BASE_SPINUP_TIME = 1.2f; private static string _PrefireAnim; private bool _hasLichguard; public static void Init() { //IL_015a: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 45; Items? muzzleFrom = Items.Origuni; Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)10, 0.1f, 100, Items.Banana, defaultAudio: false, infiniteAmmo: true, canGainAmmo: true, canReloadNoMatterAmmo: true, null, null, shootFps, null, null, null, "macheening_fire_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: true, dynamicBarrelOffsets: true, banFromBlessedRuns: false, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0, autoPlay: true, attacksThroughWalls: false, suppressReloadLabel: false, 0f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: true).IncreaseLootChance(typeof(Lichguard), 20f).AssignGun(out gunRef) .LoopAnimation(gunRef.shootAnimation, 4); int? clipSize = -1; float? cooldown = 0.11f; float? damage = 7f; float? speed = 50f; float? range = 1000f; Color? glowColor = Color.yellow; float? lightStrength = 5f; float? lightRange = 2f; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 0, null, customClip: false, damage, speed, null, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "macheening_projectile", 2, (Anchor)4, 0.75f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, null, null, "knife_hit_enemy_sound", "knife_hit_wall_sound", null, 0f, ignoredForReloadPurposes: false, mirror: false, null, null, null, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: true, 1.2f, null, 20f, glowColor, null, -1, null, lightStrength, lightRange)).SetAllImpactVFX(Items.Excaliber.AsGun().DefaultModule.projectiles[0].hitEffects.enemy).Attach((Action)delegate(CombineEvaporateEffect c) { CombineEvaporateEffect component = ((Component)Items.CombinedRifle.AsGun().alternateVolley.projectiles[0].projectiles[0]).GetComponent(); c.FallbackShader = component.FallbackShader; c.ParticleSystemToSpawn = component.ParticleSystemToSpawn; }, allowDuplicates: false); _PrefireAnim = gunRef.QuickUpdateGunAnimation("prefire", null, returnToIdle: true, 20); gunRef.LoopAnimation(_PrefireAnim, 11); gunRef.SetGunAudio(_PrefireAnim, "macheening_brandish", 6); CwaffGun.SetUpDynamicBarrelOffsetsForExtraAnimation(gunRef, _PrefireAnim); } public override void Update() { base.Update(); PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null) { if (playerOwner.IsDodgeRolling) { _spinupRemaining = spinupTime; BraveInput.GetInstanceForPlayer(playerOwner.PlayerIDX).ConsumeAll((GungeonActionType)8); } if (IsSpinningUp()) { ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.PlayIfNotPlaying(_PrefireAnim); } else if (!IsSpunUp()) { ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.PlayIfNotPlaying(((GunBehaviour)this).gun.idleAnimation); } } } public override void OnPlayerPickup(PlayerController player) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown base.OnPlayerPickup(player); HealthHaver healthHaver = ((BraveBehaviour)player).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Combine(healthHaver.ModifyDamage, new Action(ModifyDamage)); ((BraveBehaviour)player).healthHaver.OnDamaged += new OnDamagedEvent(OnDamaged); CwaffEvents.OnStatsRecalculated = (Action)Delegate.Combine(CwaffEvents.OnStatsRecalculated, new Action(CheckForLichguard)); CheckForLichguard(player); } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); tk2dSpriteAnimator spriteAnimator = ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator; spriteAnimator.AnimationEventTriggered = (Action)Delegate.Remove(spriteAnimator.AnimationEventTriggered, new Action(ProduceLight)); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { tk2dSpriteAnimator spriteAnimator2 = ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator; spriteAnimator2.AnimationEventTriggered = (Action)Delegate.Combine(spriteAnimator2.AnimationEventTriggered, new Action(ProduceLight)); } } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); tk2dSpriteAnimator spriteAnimator = ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator; spriteAnimator.AnimationEventTriggered = (Action)Delegate.Remove(spriteAnimator.AnimationEventTriggered, new Action(ProduceLight)); } private void ProduceLight(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frame) { //IL_0021: 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_0030: Unknown result type (might be due to invalid IL or missing references) if (!(clip.name != _PrefireAnim)) { Transform barrelOffset = ((GunBehaviour)this).gun.barrelOffset; Color? val = Color.Lerp(Color.yellow, Color.white, 0.65f); EasyLight.Create((Vector2?)null, barrelOffset, val, 0.5f, 5f, true, 5f, 0.1f, 0.4f, true, false, 30f, 0f, true, true); } } private void ModifyDamage(HealthHaver hh, ModifyDamageEventArgs data) { if (!_hasLichguard) { GameActor currentOwner = ((GunBehaviour)this).gun.CurrentOwner; PlayerController val = (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null); if (val != null && (Object)(object)((GameActor)val).CurrentGun == (Object)(object)((GunBehaviour)this).gun) { data.ModifiedDamage *= 2f; } } } private void OnDamaged(float resultValue, float maxValue, CoreDamageTypes damageTypes, DamageCategory damageCategory, Vector2 damageDirection) { if (!_hasLichguard) { GameActor currentOwner = ((GunBehaviour)this).gun.CurrentOwner; PlayerController val = (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null); if (val != null && (Object)(object)((GameActor)val).CurrentGun == (Object)(object)((GunBehaviour)this).gun) { ((Component)this).gameObject.Play("lichguard_curse_sound"); } } } public override void OnDroppedByPlayer(PlayerController player) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown base.OnDroppedByPlayer(player); HealthHaver healthHaver = ((BraveBehaviour)player).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Remove(healthHaver.ModifyDamage, new Action(ModifyDamage)); ((BraveBehaviour)player).healthHaver.OnDamaged -= new OnDamagedEvent(OnDamaged); CwaffEvents.OnStatsRecalculated = (Action)Delegate.Remove(CwaffEvents.OnStatsRecalculated, new Action(CheckForLichguard)); CheckForLichguard(player); } public override void OnDestroy() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { HealthHaver healthHaver = ((BraveBehaviour)((GunBehaviour)this).PlayerOwner).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Remove(healthHaver.ModifyDamage, new Action(ModifyDamage)); ((BraveBehaviour)((GunBehaviour)this).PlayerOwner).healthHaver.OnDamaged -= new OnDamagedEvent(OnDamaged); CwaffEvents.OnStatsRecalculated = (Action)Delegate.Remove(CwaffEvents.OnStatsRecalculated, new Action(CheckForLichguard)); } base.OnDestroy(); } public override void OnMasteryStatusChanged() { base.OnMasteryStatusChanged(); spinupTime = 1.2f * (base.Mastered ? 0.5f : 1f); } private void CheckForLichguard(PlayerController player) { _hasLichguard = player.HasPassive(); percentSpeedWhileCharging = (_hasLichguard ? 1f : 0f); } public override void PostProcessProjectile(Projectile projectile) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown ((GunBehaviour)this).PostProcessProjectile(projectile); if (base.Mastered) { projectile.collidesWithProjectiles = true; projectile.collidesOnlyWithPlayerProjectiles = false; projectile.UpdateCollisionMask(); SpeculativeRigidbody specRigidbody = ((BraveBehaviour)projectile).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreRigidbodyCollision)); SpeculativeRigidbody specRigidbody2 = ((BraveBehaviour)projectile).specRigidbody; specRigidbody2.OnCollision = (Action)Delegate.Combine(specRigidbody2.OnCollision, new Action(OnProjectileCollision)); } } private void OnPreRigidbodyCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { if (Object.op_Implicit((Object)(object)otherRigidbody)) { Projectile component = ((Component)otherRigidbody).gameObject.GetComponent(); if (component != null && component.Owner is PlayerController) { PhysicsEngine.SkipCollision = true; } } } private void OnProjectileCollision(CollisionData data) { if (!Object.op_Implicit((Object)(object)data.OtherRigidbody)) { return; } Projectile component = ((Component)data.OtherRigidbody).gameObject.GetComponent(); if (component != null && !(component.Owner is PlayerController) && Object.op_Implicit((Object)(object)data.MyRigidbody)) { Projectile component2 = ((Component)data.MyRigidbody).gameObject.GetComponent(); if (component2 != null) { component2.DieInAir(false, true, true, false); component.DieInAir(false, true, true, false); ((Component)((GunBehaviour)this).gun).gameObject.Play("aimu_reflect_sound"); } } } } public class Femtobyte : CwaffGun { public enum HoldType { EMPTY, TABLE, BARREL, SPECIAL, CHEST, ENEMY, PICKUP } [Serializable] public class PrefabData { public string prefabName; public string displayName; public GameObject prefab; public PrefabData(string prefabName, string displayName, GameObject prefab) { this.prefabName = prefabName; this.displayName = displayName; this.prefab = prefab; } } [Serializable] public class DigitizedObject { public HoldType type; public PrefabData data; public List contents; public bool locked; public bool glitched; public bool rainbow; public int pickupID = -1; public string enemyGuid; public bool jammed; public static DigitizedObject FromPickup(PickupObject pickup) { return new DigitizedObject { type = HoldType.PICKUP, pickupID = pickup.PickupObjectId, data = new PrefabData(pickup.EncounterNameOrDisplayName, pickup.EncounterNameOrDisplayName, ((Component)PickupObjectDatabase.GetById(pickup.PickupObjectId)).gameObject) }; } public static DigitizedObject FromEnemyGuid(string guid) { AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); if (!Object.op_Implicit((Object)(object)orLoadByGuid)) { return null; } return new DigitizedObject { type = HoldType.ENEMY, enemyGuid = guid, data = new PrefabData(((GameActor)orLoadByGuid).ActorName, guid.AmmonomiconName(), ((Component)orLoadByGuid).gameObject) }; } } public class DigitizedProjectile : MonoBehaviour { private Shader _oldShader; private void Start() { Projectile component = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { tk2dBaseSprite sprite = ((BraveBehaviour)component).sprite; if (sprite != null) { _oldShader = ((BraveBehaviour)sprite).renderer.material.shader; sprite.usesOverrideMaterial = true; ((BraveBehaviour)sprite).renderer.material.shader = CwaffShaders.DigitizeShader; ((BraveBehaviour)sprite).renderer.material.SetTexture(CwaffVFX._BinaryTexId, (Texture)(object)CwaffShaders.DigitizeTexture); ((BraveBehaviour)sprite).renderer.material.SetFloat(CwaffVFX._BinarizeProgressId, 1f); ((BraveBehaviour)sprite).renderer.material.SetFloat(CwaffVFX._ColorizeProgressId, 1f); ((BraveBehaviour)sprite).renderer.material.SetFloat(CwaffVFX._FadeProgressId, 0f); ((BraveBehaviour)sprite).renderer.material.SetFloat(CwaffVFX._ScrollSpeedId, -4.5f); component.OnDestruction += DestroyReplicantProjectile; } } } private void DestroyReplicantProjectile(Projectile p) { ((BraveBehaviour)p).sprite.usesOverrideMaterial = false; ((BraveBehaviour)((BraveBehaviour)p).sprite).renderer.material.shader = _oldShader; this.SafeDestroy(); } } private class FemtobyteAmmoDisplay : CustomAmmoDisplay { private static StringBuilder _SB = new StringBuilder("", 1000); private Femtobyte _femto; private PlayerController _owner; private string _cachedDisplayName; private void Start() { Gun component = ((Component)this).GetComponent(); _femto = ((Component)component).GetComponent(); ref PlayerController owner = ref _owner; GameActor currentOwner = component.CurrentOwner; owner = (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null); } public override bool DoCustomAmmoDisplay(GameUIAmmoController uic) { if (!Object.op_Implicit((Object)(object)_owner)) { return false; } if (_femto._displayNameDirty || Utility.IsNullOrWhiteSpace(_cachedDisplayName)) { _SB.Length = 0; if (_owner.HasSynergy(Synergy.LOOKUP_TABLE) && _femto._lastEnemyName != null) { _SB.Append("[color #dd6666]"); _SB.Append(_femto._lastEnemyName); _SB.Append("[/color]"); _SB.Append("\n"); } _SB.Append(_femto.GetTitleForCurrentSlot()); _SB.Append("\n"); for (int i = 0; i < 6; i++) { DigitizedObject digitizedObject = _femto.digitizedObjects[i]; if (digitizedObject != null && digitizedObject.type != HoldType.EMPTY) { _SB.AppendFormat("[sprite \"{0}\"]", (i == _femto._currentSlot) ? "slot_full_active_ui" : "slot_full_ui"); } else { _SB.AppendFormat("[sprite \"{0}\"]", (i == _femto._currentSlot) ? "slot_empty_active_ui" : "slot_empty_ui"); } } _cachedDisplayName = _SB.ToString(); } uic.GunAmmoCountLabel.Text = _cachedDisplayName; return true; } } public static string ItemName = "Femtobyte"; public static string ShortDescription = "Digital Storage"; public static string LongDescription = "Fires projectiles that can digitize chests, tables, barrels, consumables, and certain other objects. Reloading cycles through digital slots. If the current slot is full, firing the gun will place the selected digitized object at the reticle."; public static string Lore = "Gungeoneers can carry a seemingly unlimited number of firearms and trinkets on their persons without fear of encumbrance. This magical hammerspace can be expanded to include larger objects than ever thanks to recent advancements in techno-ballistics, which have enabled projectiles to download data from their environment to a computer embedded inside their host gun. While such projectiles have limited direct damage output, it's hard to beat the fun and effectiveness of materializing sawblades on top of unsuspecting Gundead."; private const int _MAX_SLOTS = 6; internal const string _EmptyUI = "cg:_SlotEmptyUI"; internal const string _EmptyActiveUI = "cg:_SlotEmptyActiveUI"; internal const string _FullUI = "cg:_SlotFullUI"; internal const string _FullActiveUI = "cg:_SlotFullActiveUI"; internal static GameObject _ImpactBits = null; internal static HashSet _Replicants = new HashSet(); internal static readonly Dictionary _NameToPrefabMap = new Dictionary { { "npc_gunbermuncher", new PrefabData("npc_gunbermuncher", "Muncher", ((Component)LoadHelper.LoadAssetFromAnywhere("Base Shared Injection Data").AttachedInjectionData[2].InjectionData[0].exactRoom.placedObjects[11].nonenemyBehaviour).gameObject) }, { "npc_gunbermuncher_evil", new PrefabData("npc_gunbermuncher_evil", "Evil Muncher", ((Component)GameManager.Instance.GlobalInjectionData.entries[3].injectionData.InjectionData[5].exactRoom.placedObjects[0].nonenemyBehaviour).gameObject) }, { "heartdispenser", new PrefabData("heartdispenser", "Heart Dispenser", ((Component)DungeonDatabase.GetOrLoadByName("base_castle").PatternSettings.flows[0].m_nodes[3].overrideExactRoom.placedObjects[2].nonenemyBehaviour).gameObject) }, { "trap_sawblade_omni_gungeon_2x2", new PrefabData("trap_sawblade_omni_gungeon_2x2", "Sawblade", SetupExoticObjects.SawBlade) }, { "skullfirespinner", new PrefabData("skullfirespinner", "Skull Fire Trap", SetupExoticObjects.FireBarTrap) }, { "flamepipe_spraysdown", new PrefabData("flamepipe_spraysdown", "Flame Pipe N", SetupExoticObjects.FlamePipeNorth) }, { "flamepipe_spraysleft", new PrefabData("flamepipe_spraysleft", "Flame Pipe E", SetupExoticObjects.FlamePipeEast) }, { "flamepipe_spraysright", new PrefabData("flamepipe_spraysright", "Flame Pipe W", SetupExoticObjects.FlamePipeWest) }, { "forge_hammer", new PrefabData("forge_hammer", "Forge Hammer", LoadHelper.LoadAssetFromAnywhere("Forge_Hammer")) }, { "brazier", new PrefabData("brazier", "Brazier", LoadHelper.LoadAssetFromAnywhere("Base Shared Injection Data").InjectionData[1].roomTable.includedRooms.elements[6].room.placedObjects[4].placeableContents.variantTiers[0].nonDatabasePlaceable) }, { "red barrel", new PrefabData("red barrel", "Exposive Barrel", LoadHelper.LoadAssetFromAnywhere("Red Barrel")) }, { "red drum", new PrefabData("red drum", "Exposive Drum", LoadHelper.LoadAssetFromAnywhere("Red Drum")) }, { "blue drum", new PrefabData("blue drum", "Water Drum", LoadHelper.LoadAssetFromAnywhere("Blue Drum")) }, { "purple drum", new PrefabData("purple drum", "Oil Drum", LoadHelper.LoadAssetFromAnywhere("Purple Drum")) }, { "yellow drum", new PrefabData("yellow drum", "Poison Drum", LoadHelper.LoadAssetFromAnywhere("Yellow Drum")) }, { "chest_wood_two_items", new PrefabData("chest_wood_two_items", "Brown Chest", ((Component)GameManager.Instance.RewardManager.D_Chest).gameObject) }, { "chest_silver", new PrefabData("chest_silver", "Blue Chest", ((Component)GameManager.Instance.RewardManager.C_Chest).gameObject) }, { "chest_green", new PrefabData("chest_green", "Green Chest", ((Component)GameManager.Instance.RewardManager.B_Chest).gameObject) }, { "chest_red", new PrefabData("chest_red", "Red Chest", ((Component)GameManager.Instance.RewardManager.A_Chest).gameObject) }, { "chest_black", new PrefabData("chest_black", "Black Chest", ((Component)GameManager.Instance.RewardManager.S_Chest).gameObject) }, { "chest_rainbow", new PrefabData("chest_rainbow", "Rainbow Chest", ((Component)GameManager.Instance.RewardManager.Rainbow_Chest).gameObject) }, { "chest_synergy", new PrefabData("chest_synergy", "Synergy Chest", ((Component)GameManager.Instance.RewardManager.Synergy_Chest).gameObject) }, { "truthchest", new PrefabData("truthchest", "Albern's Chest", LoadHelper.LoadAssetFromAnywhere("TruthChest")) }, { "chest_rat", new PrefabData("chest_rat", "Rat Chest", LoadHelper.LoadAssetFromAnywhere("Chest_Rat")) }, { "folding_table_vertical", new PrefabData("folding_table_vertical", "Folding Table", ((Component)((Component)ItemHelper.Get(Items.PortableTableDevice)).GetComponent().TableToSpawn).gameObject) }, { "kingofthehillbox", new PrefabData("kingofthehillbox", "KotH Table", ((Component)LoadHelper.LoadAssetFromAnywhere("_ChallengeManager").GetComponent().PossibleChallenges[21].challenge).gameObject.GetComponent().BoxPlaceable.variantTiers[0].nonDatabasePlaceable) }, { "table_horizontal_steel", new PrefabData("table_horizontal_steel", "Steel Table H", SetupExoticObjects.SteelTableHorizontal) }, { "table_vertical_steel", new PrefabData("table_vertical_steel", "Steel Table V", SetupExoticObjects.SteelTableVertical) }, { "coffin_horizontal", new PrefabData("coffin_horizontal", "Coffin H", LoadHelper.LoadAssetFromAnywhere("coffin_horizontal")) }, { "coffin_vertical", new PrefabData("coffin_vertical", "Coffin V", LoadHelper.LoadAssetFromAnywhere("coffin_vertical")) }, { "table_horizontal", new PrefabData("table_horizontal", "Wood Table H", LoadHelper.LoadAssetFromAnywhere("table_horizontal")) }, { "table_vertical", new PrefabData("table_vertical", "Wood Table V", LoadHelper.LoadAssetFromAnywhere("table_vertical")) }, { "table_horizontal_stone", new PrefabData("table_horizontal_stone", "Stone Table H", LoadHelper.LoadAssetFromAnywhere("table_horizontal_stone")) }, { "table_vertical_stone", new PrefabData("table_vertical_stone", "Stone Table V", LoadHelper.LoadAssetFromAnywhere("table_vertical_stone")) } }; public List digitizedObjects = Enumerable.Repeat(null, 6).ToList(); private tk2dBaseSprite _placementPhantom; private Material _placementMaterial; internal int _currentSlot; internal bool _displayNameDirty; internal string _lastEnemyKilled; internal string _lastEnemyName; private static readonly Color _Valid = Color.Lerp(Color.green, Color.black, 0.35f); private static readonly Color _Invalid = Color.Lerp(Color.red, Color.black, 0.35f); public static void Init() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); GunClass uTILITY = CwaffGunClass.UTILITY; int? shootFps = 24; int? reloadFps = 16; gun.SetAttributes((ItemQuality)2, uTILITY, 0f, 9999, Items.Banana, defaultAudio: false, infiniteAmmo: true, canGainAmmo: false, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "femtobyte_shoot_sound", null, null, -1, -1, -1, null, modulesAreTiers: true, null, 60, 1f, (Anchor)3, -1f, null, -1f, muzzleLit: false, 0f, 0f, null, null, preventRotation: false, 0f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: true, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0).Attach((Action)null, allowDuplicates: false).InitProjectile(GunData.New(null, null, -1, angleVariance: 2f, damage: 7.5f, speed: 90f, cooldown: 0.4f, shootStyle: (ShootStyle)0, sequenceStyle: (ProjectileSequenceStyle)0, chargeTime: 0f, ammoCost: 1, ammoType: null, customClip: false, force: null, range: null, recoil: null, poison: 0f, fire: 0f, freeze: 0f, slow: 0f, collidesWithEnemies: null, ignoreDamageCaps: null, collidesWithProjectiles: null, surviveRigidbodyCollisions: null, collidesWithTilemap: null, sprite: "femtobyte_projectile", fps: 2, anchor: (Anchor)4, scale: 1f, anchorsChangeColliders: true, fixesScales: true, overrideColliderPixelSizes: null, overrideColliderOffsets: null, bossDamageMult: 1f, destroySound: null, shouldRotate: null, barrageSize: 1, shouldFlipHorizontally: null, shouldFlipVertically: null, useDummyChargeModule: false, invisibleProjectile: false, spawnSound: null, stopSoundOnDeath: null, uniqueSounds: null, shrapnelVFX: null, shrapnelCount: null, shrapnelMinVelocity: null, shrapnelMaxVelocity: null, shrapnelLifetime: null, preventOrbiting: null, hitSound: null, hitEnemySound: "femtobyte_hit_enemy_sound", hitWallSound: null, becomeDebris: null, angleFromAim: 0f, ignoredForReloadPurposes: false, mirror: false, electric: null, burstCooldown: null, preventSparks: null, pierceBreakables: null, collidesOnlyWithPlayerProjectiles: null, pierceInternalWalls: null, doBeamSetup: null, beamSprite: null, beamFps: -1, beamStartFps: -1, beamEndFps: -1, beamChargeFps: -1, beamMuzzleFps: -1, beamImpactFps: -1, beamLoopCharge: true, beamEmission: -1f, beamReflections: -1, beamChargeDelay: -1f, beamStatusDelay: -1f, beamGoop: null, beamInterpolate: null, beamPiercing: -1, beamPiercesCover: null, beamContinueToWall: null, beamIsRigid: null, beamKnockback: -1f, beamTiling: null, beamEndType: null, beamSeparation: null, beamStartIsMuzzle: false, hideAmmo: true)) .Attach() .AttachTrail("femtobyte_beam", 10, null, -1f, 1f / 60f, 1f, destroyOnEmpty: false, Lazy.DispersalParticles(Color.white)); _ImpactBits = VFX.Create("femtobyte_projectile_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } internal static bool IsWhiteListedPrefab(GameObject bodyObject, out PrefabData trapPrefab) { Transform parent = bodyObject.transform.parent; if (parent != null && Object.op_Implicit((Object)(object)((Component)parent).gameObject.GetComponent())) { bodyObject = ((Component)parent).gameObject; } string key = ((Object)bodyObject).name.Replace("(Clone)", "").TrimEnd(new char[0]).ToLowerInvariant(); return _NameToPrefabMap.TryGetValue(key, out trapPrefab); } private bool DigitizeEnemy(AIActor enemy, PrefabData data) { HealthHaver healthHaver = ((BraveBehaviour)enemy).healthHaver; if (healthHaver == null || healthHaver.IsDead || healthHaver.IsBoss || healthHaver.IsSubboss) { return false; } _lastEnemyKilled = enemy.EnemyGuid; _lastEnemyName = _lastEnemyKilled.AmmonomiconName(); _displayNameDirty = true; if (base.Mastered) { DigitizedObject digitizedObject = DigitizedObject.FromEnemyGuid(enemy.EnemyGuid); if (digitizedObject != null) { SetCurrentSlot(digitizedObject); } } CwaffShaders.Digitize(((BraveBehaviour)enemy).sprite, 0f); if (_Replicants.Contains(enemy)) { _Replicants.Remove(enemy); } if (Object.op_Implicit((Object)(object)((Component)enemy).gameObject.GetComponent())) { enemy.EraseFromExistence(false); } else { enemy.EraseFromExistenceWithRewards(false); } return true; } private bool DigitizePickup(PickupObject pickup, PrefabData data) { if (pickup.PickupObjectId < 0) { return false; } HealthPickup val = (HealthPickup)(object)((pickup is HealthPickup) ? pickup : null); if (val != null) { val.GetRidOfMinimapIcon(); } else { AmmoPickup val2 = (AmmoPickup)(object)((pickup is AmmoPickup) ? pickup : null); if (val2 != null) { val2.GetRidOfMinimapIcon(); } else { KeyBulletPickup val3 = (KeyBulletPickup)(object)((pickup is KeyBulletPickup) ? pickup : null); if (val3 != null) { val3.GetRidOfMinimapIcon(); } else { SilencerItem val4 = (SilencerItem)(object)((pickup is SilencerItem) ? pickup : null); if (val4 == null) { return false; } ((PlayerItem)val4).GetRidOfMinimapIcon(); } } } SetCurrentSlot(DigitizedObject.FromPickup(pickup)); CwaffShaders.Digitize(((BraveBehaviour)pickup).sprite, 0f); Object.Destroy((Object)(object)((Component)pickup).gameObject); return true; } private bool DigitizeChest(Chest chest, PrefabData data) { if (data == null || (Object)(object)data.prefab == (Object)null) { return false; } if (chest.IsOpen || chest.IsBroken || chest.IsMimic) { return false; } SetCurrentSlot(new DigitizedObject { type = HoldType.CHEST, data = data, locked = (chest.IsLocked && !((GunBehaviour)this).PlayerOwner.HasSynergy(Synergy.KEYGEN)), glitched = chest.IsGlitched, rainbow = chest.IsRainbowChest, contents = ((chest.contents != null) ? chest.contents.Select((PickupObject p) => (!Object.op_Implicit((Object)(object)p)) ? (-1) : p.PickupObjectId).ToList() : null) }); CwaffShaders.Digitize(((BraveBehaviour)chest).sprite, 0f); RoomHandler absoluteParentRoom = ((DungeonPlaceableBehaviour)chest).GetAbsoluteParentRoom(); if (absoluteParentRoom != null) { absoluteParentRoom.DeregisterInteractable((IPlayerInteractable)(object)chest); } chest.DeregisterChestOnMinimap(); Object.Destroy((Object)(object)((Component)chest).gameObject); return true; } private bool DigitizeBarrel(KickableObject barrel, PrefabData data) { if ((Object)(object)data.prefab != (Object)null) { SetCurrentSlot(new DigitizedObject { type = HoldType.BARREL, data = data }); } CwaffShaders.Digitize(((BraveBehaviour)barrel).sprite, 0f); Object.Destroy((Object)(object)((Component)barrel).gameObject); return true; } private bool DigitizeTable(FlippableCover table, PrefabData data) { if ((Object)(object)data.prefab != (Object)null) { SetCurrentSlot(new DigitizedObject { type = HoldType.TABLE, data = data }); } CwaffShaders.Digitize(((BraveBehaviour)table).sprite, 0f); Object.Destroy((Object)(object)((Component)table).gameObject); return true; } private static void RemoveMuncherRoomIcons(SpeculativeRigidbody body) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (((Component)body).gameObject.GetComponent() == null) { return; } RoomHandler absoluteRoom = Vector3Extensions.GetAbsoluteRoom(body.UnitCenter); if (absoluteRoom == null || !Minimap.Instance.roomToIconsMap.TryGetValue(absoluteRoom, out var value)) { return; } for (int i = 0; i < value.Count; i++) { if (((Object)value[i]).name.Contains("Muncher")) { Minimap.Instance.DeregisterRoomIcon(absoluteRoom, value[i]); break; } } } private bool IsUsedMuncher(SpeculativeRigidbody body) { if (Object.op_Implicit((Object)(object)body)) { GunberMuncherController component = ((Component)body).gameObject.GetComponent(); if (component != null) { if ((Object)(object)component.m_first != (Object)null) { return true; } if ((Object)(object)component.m_second != (Object)null) { return true; } PlayMakerFSM component2 = ((Component)component).GetComponent(); if (component2 != null && !component2.FsmVariables.FindFsmBool("canBeUsed").Value) { return true; } return false; } } return false; } private bool DigitizeSpecial(SpeculativeRigidbody body, PrefabData data) { if (IsUsedMuncher(body)) { return false; } if ((Object)(object)data.prefab != (Object)null) { SetCurrentSlot(new DigitizedObject { type = HoldType.SPECIAL, data = data }); } tk2dBaseSprite sprite = ((BraveBehaviour)body).sprite; tk2dSlicedSprite val = (tk2dSlicedSprite)(object)((sprite is tk2dSlicedSprite) ? sprite : null); if (val != null) { CwaffShaders.Digitize(val, 0f); } else { CwaffShaders.Digitize(((BraveBehaviour)body).sprite, 0f); } RemoveMuncherRoomIcons(body); Object.Destroy((Object)(object)((Component)body).gameObject); return true; } private void SetCurrentSlot(DigitizedObject d) { digitizedObjects[_currentSlot] = d; UpdateCurrentSlot(); } public bool TryToDigitize(GameObject target) { DigitizedObject digitizedObject = digitizedObjects[_currentSlot]; if (digitizedObject != null && digitizedObject.type != HoldType.EMPTY) { return false; } SpeculativeRigidbody component = target.GetComponent(); if (!IsWhiteListedPrefab(target, out var trapPrefab)) { trapPrefab = null; } AIActor component2 = target.GetComponent(); if (component2 != null) { return DigitizeEnemy(component2, trapPrefab); } PickupObject component3 = target.GetComponent(); if (component3 != null) { return DigitizePickup(component3, trapPrefab); } Chest component4 = target.GetComponent(); if (component4 != null) { return DigitizeChest(component4, trapPrefab); } KickableObject component5 = target.GetComponent(); if (component5 != null) { return DigitizeBarrel(component5, trapPrefab); } Transform parent = target.transform.parent; if (parent != null) { FlippableCover component6 = ((Component)parent).gameObject.GetComponent(); if (component6 != null) { return DigitizeTable(component6, trapPrefab); } } if (trapPrefab != null && (Object)(object)trapPrefab.prefab != (Object)null) { return DigitizeSpecial(component, trapPrefab); } return false; } public override void OnTriedToInitiateAttack(PlayerController player) { //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_0020: 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_002d: Unknown result type (might be due to invalid IL or missing references) base.OnTriedToInitiateAttack(player); if (((GunBehaviour)this).gun.CurrentStrengthTier != 0) { Vector2 val = Vector2.op_Implicit(player.unadjustedAimPoint); if (CanPlacePhantom(val)) { MaterializeObject(val); player.SuppressThisClick = true; } } } private bool CanPlacePhantom(Vector2 pos, DigitizedObject d = null) { //IL_0050: 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_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_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_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_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_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) if (d == null) { d = digitizedObjects[_currentSlot]; } if (d != null && d.data != null && !((Object)(object)d.data.prefab == (Object)null)) { tk2dSprite componentInChildren = d.data.prefab.GetComponentInChildren(); if (componentInChildren != null) { Bounds bounds = ((tk2dBaseSprite)componentInChildren).GetBounds(); Vector2 val = Vector2.op_Implicit(0.5f * ((Bounds)(ref bounds)).extents); foreach (ICollidableObject overlappingCollidableObject in PhysicsEngine.Instance.GetOverlappingCollidableObjects(pos - val, pos + val, true, true, (int?)null, false)) { SpeculativeRigidbody val2 = (SpeculativeRigidbody)(object)((overlappingCollidableObject is SpeculativeRigidbody) ? overlappingCollidableObject : null); if (val2 == null) { return false; } if (!Object.op_Implicit((Object)(object)val2)) { continue; } GameObject gameObject = ((Component)val2).gameObject; if (gameObject != null) { if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { return false; } if (Object.op_Implicit((Object)(object)gameObject.GetComponent())) { return false; } if (!Object.op_Implicit((Object)(object)gameObject.GetComponent()) && !Object.op_Implicit((Object)(object)gameObject.GetComponent())) { return false; } } } return true; } } return false; } public string GetTitleForCurrentSlot() { DigitizedObject digitizedObject = digitizedObjects[_currentSlot]; if (digitizedObject == null) { return "Empty"; } if (digitizedObject.data != null && !Utility.IsNullOrWhiteSpace(digitizedObject.data.displayName)) { return digitizedObject.data.displayName; } return digitizedObject.type switch { HoldType.EMPTY => "Empty", HoldType.CHEST => "Chest", HoldType.ENEMY => "Enemy", HoldType.PICKUP => "Pickup", HoldType.SPECIAL => "Trap", HoldType.BARREL => "Barrel", HoldType.TABLE => "Table", _ => "Unknown", }; } private static void CheckFromDigitizedOwner(Projectile p) { if (Object.op_Implicit((Object)(object)p)) { GameActor owner = p.Owner; AIActor val = (AIActor)(object)((owner is AIActor) ? owner : null); if (val != null && _Replicants.Contains(val)) { p.StopCollidingWithPlayers(); p.collidesWithEnemies = true; ((Component)(object)p).AddComponent(); } } } public override void OnPlayerPickup(PlayerController player) { StaticReferenceManager.ProjectileAdded -= CheckFromDigitizedOwner; StaticReferenceManager.ProjectileAdded += CheckFromDigitizedOwner; CwaffEvents.OnBankBulletOwnerAssigned = (Action)Delegate.Remove(CwaffEvents.OnBankBulletOwnerAssigned, new Action(CheckFromDigitizedOwner)); CwaffEvents.OnBankBulletOwnerAssigned = (Action)Delegate.Combine(CwaffEvents.OnBankBulletOwnerAssigned, new Action(CheckFromDigitizedOwner)); base.OnPlayerPickup(player); AdjustGunShader(on: true); UpdateCurrentSlot(); } public override void OnDroppedByPlayer(PlayerController player) { AdjustGunShader(on: false); if (Object.op_Implicit((Object)(object)_placementPhantom)) { Object.Destroy((Object)(object)_placementPhantom); } base.OnDroppedByPlayer(player); } public void AdjustGunShader(bool on) { Material material = ((BraveBehaviour)((BraveBehaviour)((GunBehaviour)this).gun).sprite).renderer.material; if (!on) { ((BraveBehaviour)((GunBehaviour)this).gun).sprite.usesOverrideMaterial = false; material.shader = ShaderCache.Acquire("Brave/PlayerShader"); return; } ((BraveBehaviour)((GunBehaviour)this).gun).sprite.usesOverrideMaterial = true; material.shader = CwaffShaders.UnlitDigitizeShader; material.SetTexture(CwaffVFX._BinaryTexId, (Texture)(object)CwaffShaders.DigitizeTexture); material.SetFloat(CwaffVFX._BinarizeProgressId, 1f); material.SetFloat(CwaffVFX._ColorizeProgressId, 0f); material.SetFloat(CwaffVFX._FadeProgressId, 0f); material.SetFloat(CwaffVFX._ScrollSpeedId, 1.5f); material.SetFloat(CwaffVFX._HScrollSpeedId, 0.35f); } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); if (Object.op_Implicit((Object)(object)_placementPhantom)) { ((Component)_placementPhantom).gameObject.SetActive(false); } } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)_placementPhantom)) { Object.Destroy((Object)(object)_placementPhantom); } base.OnDestroy(); } public override void Update() { //IL_00dc: 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_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: 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_01d9: Unknown result type (might be due to invalid IL or missing references) base.Update(); PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null) { return; } if (!Object.op_Implicit((Object)(object)_placementPhantom)) { _placementPhantom = (tk2dBaseSprite)(object)Lazy.SpriteObject(((BraveBehaviour)playerOwner).sprite.collection, ((BraveBehaviour)playerOwner).sprite.spriteId); _placementPhantom.usesOverrideMaterial = true; Material obj = (_placementMaterial = ((Component)_placementPhantom).gameObject.GetComponent().material); obj.shader = CwaffShaders.UnlitDigitizeShader; obj.SetTexture(CwaffVFX._BinaryTexId, (Texture)(object)CwaffShaders.DigitizeTexture); obj.SetFloat(CwaffVFX._BinarizeProgressId, 1f); obj.SetFloat(CwaffVFX._ColorizeProgressId, 1f); obj.SetFloat(CwaffVFX._FadeProgressId, 0f); obj.SetFloat(CwaffVFX._ScrollSpeedId, -4f); obj.SetFloat(CwaffVFX._HScrollSpeedId, 0.35f); obj.SetColor(CwaffVFX._ColorId, _Invalid); } if (((GunBehaviour)this).gun.CurrentStrengthTier == 0) { ((Component)_placementPhantom).gameObject.SetActive(false); return; } DigitizedObject digitizedObject = digitizedObjects[_currentSlot]; if (digitizedObject == null || digitizedObject.data == null || (Object)(object)digitizedObject.data.prefab == (Object)null) { ((Component)_placementPhantom).gameObject.SetActive(false); return; } tk2dSprite componentInChildren = digitizedObject.data.prefab.GetComponentInChildren(); ((Component)_placementPhantom).gameObject.SetActive(true); _placementPhantom.SetSprite(((tk2dBaseSprite)componentInChildren).collection, ((tk2dBaseSprite)componentInChildren).spriteId); _placementPhantom.PlaceAtPositionByAnchor(playerOwner.unadjustedAimPoint, (Anchor)4); if (!Object.op_Implicit((Object)(object)_placementMaterial)) { _placementMaterial = ((Component)_placementPhantom).gameObject.GetComponent().material; } _placementMaterial.SetColor(CwaffVFX._ColorId, CanPlacePhantom(Vector2.op_Implicit(playerOwner.unadjustedAimPoint), digitizedObject) ? _Valid : _Invalid); } private void UpdateCurrentSlot() { DigitizedObject digitizedObject = digitizedObjects[_currentSlot]; int num = ((digitizedObject != null && digitizedObject.type != HoldType.EMPTY) ? 1 : 0); if (num != ((GunBehaviour)this).gun.CurrentStrengthTier) { ((GunBehaviour)this).gun.CurrentStrengthTier = num; } _displayNameDirty = true; } public override void OnReloadPressed(PlayerController player, Gun gun, bool manualReload) { if (manualReload) { _currentSlot = (_currentSlot + 1) % 6; UpdateCurrentSlot(); ((Component)player).gameObject.Play("replicant_select_sound"); } } private void MaterializeObject(Vector2 placePoint) { //IL_0000: 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_00da: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_0180: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_0258: 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_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0287: 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_01e2: 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_009b: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) RoomHandler absoluteRoom = Vector3Extensions.GetAbsoluteRoom(placePoint); if (absoluteRoom == null) { return; } if (digitizedObjects.Count != 6) { Lazy.RuntimeWarn($"Digitized Object list is length {digitizedObjects.Count}, not what it should be; this should never happen"); return; } DigitizedObject digitizedObject = digitizedObjects[_currentSlot]; if (digitizedObject == null || digitizedObject.type == HoldType.EMPTY) { return; } switch (digitizedObject.type) { case HoldType.PICKUP: { tk2dSprite componentInChildren10 = ((Component)LootEngine.SpawnItem(((Component)PickupObjectDatabase.GetById(digitizedObject.pickupID)).gameObject, Vector2.op_Implicit(placePoint), Vector2.zero, 0f, false, false, true)).gameObject.GetComponentInChildren(); ((tk2dBaseSprite)componentInChildren10).PlaceAtPositionByAnchor(Vector2.op_Implicit(placePoint), (Anchor)4); CwaffShaders.Materialize((tk2dBaseSprite)(object)componentInChildren10); break; } case HoldType.TABLE: { GameObject obj4 = Object.Instantiate(digitizedObject.data.prefab, Vector2.op_Implicit(placePoint), Quaternion.identity); tk2dSprite componentInChildren11 = obj4.GetComponentInChildren(); ((tk2dBaseSprite)componentInChildren11).PlaceAtPositionByAnchor(Vector2.op_Implicit(placePoint), (Anchor)4); SpeculativeRigidbody componentInChildren12 = obj4.GetComponentInChildren(); FlippableCover component3 = obj4.GetComponent(); absoluteRoom.RegisterInteractable((IPlayerInteractable)(object)component3); component3.ConfigureOnPlacement(absoluteRoom); componentInChildren12.CorrectForWalls(); ((Component)component3).gameObject.AddComponent().flipper = ((GunBehaviour)this).PlayerOwner; PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(componentInChildren12, (int?)null, false); CwaffShaders.Materialize((tk2dBaseSprite)(object)componentInChildren11); break; } case HoldType.BARREL: { GameObject obj2 = Object.Instantiate(digitizedObject.data.prefab, Vector2.op_Implicit(placePoint), Quaternion.identity); tk2dSprite componentInChildren7 = obj2.GetComponentInChildren(); ((tk2dBaseSprite)componentInChildren7).PlaceAtPositionByAnchor(Vector2.op_Implicit(placePoint), (Anchor)4); SpeculativeRigidbody componentInChildren8 = obj2.GetComponentInChildren(); KickableObject componentInChildren9 = obj2.GetComponentInChildren(); absoluteRoom.RegisterInteractable((IPlayerInteractable)(object)componentInChildren9); componentInChildren9.ConfigureOnPlacement(absoluteRoom); componentInChildren8.Initialize(); componentInChildren8.CorrectForWalls(); PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(componentInChildren8, (int?)null, false); CwaffShaders.Materialize((tk2dBaseSprite)(object)componentInChildren7); break; } case HoldType.ENEMY: { AIActor val = Replicant.Create(digitizedObject.enemyGuid, placePoint, CwaffShaders.MaterializePartial, hasCollision: true); if (Object.op_Implicit((Object)(object)val)) { _Replicants.Add(val); ((Component)val).gameObject.AddComponent(); PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(((BraveBehaviour)val).specRigidbody, (int?)null, false); } break; } case HoldType.CHEST: { GameObject obj3 = Object.Instantiate(digitizedObject.data.prefab, Vector2.op_Implicit(placePoint), Quaternion.identity); Chest component2 = obj3.GetComponent(); tk2dBaseSprite sprite = ((BraveBehaviour)component2).sprite; Transform transform = obj3.transform; transform.position -= Vector2Extensions.ToVector3ZUp(sprite.GetRelativePositionFromAnchor((Anchor)4), 0f); sprite.UpdateZDepth(); component2.MimicGuid = null; component2.Initialize(); component2.m_room = absoluteRoom; component2.IsLocked = digitizedObject.locked; if ((Object)(object)component2.LockAnimator != (Object)null) { ((Component)component2.LockAnimator).GetComponent().enabled = component2.IsLocked; } component2.contents = null; if (digitizedObject.contents != null && digitizedObject.contents.Count > 0) { component2.contents = new List(digitizedObject.contents.Count); foreach (int content in digitizedObject.contents) { if (content >= 0) { component2.contents.Add(PickupObjectDatabase.GetById(content)); } } } absoluteRoom.RegisterInteractable((IPlayerInteractable)(object)component2); component2.RegisterChestOnMinimap(absoluteRoom); if (digitizedObject.glitched) { component2.BecomeGlitchChest(); } if (digitizedObject.rainbow) { component2.BecomeRainbowChest(); } ((BraveBehaviour)component2).specRigidbody.CorrectForWalls(); PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(((BraveBehaviour)component2).specRigidbody, (int?)null, false); CwaffShaders.Materialize(sprite); break; } case HoldType.SPECIAL: { GameObject obj = Object.Instantiate(digitizedObject.data.prefab, Vector2.op_Implicit(placePoint), Quaternion.identity); tk2dSprite componentInChildren = obj.GetComponentInChildren(); ((tk2dBaseSprite)componentInChildren).PlaceAtPositionByAnchor(Vector2.op_Implicit(placePoint), (Anchor)4); ForgeHammerController componentInChildren2 = obj.GetComponentInChildren(); if (componentInChildren2 != null) { componentInChildren2.DeactivateOnEnemiesCleared = false; } IPlaceConfigurable componentInChildren3 = obj.GetComponentInChildren(); if (componentInChildren3 != null) { componentInChildren3.ConfigureOnPlacement(absoluteRoom); } IPlayerInteractable componentInChildren4 = obj.GetComponentInChildren(); if (componentInChildren4 != null) { absoluteRoom.RegisterInteractable(componentInChildren4); } obj.GetComponentInChildren()?.CreateDummyPath(); PathingTrapController componentInChildren5 = obj.GetComponentInChildren(); if (componentInChildren5 != null) { componentInChildren5.hitsEnemies = true; componentInChildren5.enemyDamage = Mathf.Max(20f, componentInChildren5.enemyDamage); componentInChildren5.enemyKnockbackStrength = 3f * componentInChildren5.knockbackStrength; } SpeculativeRigidbody componentInChildren6 = obj.GetComponentInChildren(); if (componentInChildren6 != null) { componentInChildren6.Reinitialize(); } BraveBehaviour component = obj.GetComponent(); if (component != null) { component.RegenerateCache(); } CwaffShaders.Materialize((tk2dBaseSprite)(object)componentInChildren); break; } } SpawnBitBurst(placePoint, 20); digitizedObjects[_currentSlot] = null; UpdateCurrentSlot(); } public override void PostProcessProjectile(Projectile projectile) { ((GunBehaviour)this).PostProcessProjectile(projectile); ((Component)projectile).gameObject.GetComponent()?.Setup(this); } public static void SpawnBitBurst(Vector2 pos, int howMany) { //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) CwaffVFX.SpawnBurst(_ImpactBits, howMany, pos, 1f, 10f * Vector2.up, 0f, 5f, CwaffVFX.Vel.Radial, CwaffVFX.Rot.None, 0.5f, 0.5f, 0f, null, fadeIn: false, uniform: false, null, null, null, randomFrame: true); } public override void InheritData(Gun sourceGun) { ((GunBehaviour)this).InheritData(sourceGun); Femtobyte component = ((Component)sourceGun).gameObject.GetComponent(); if (component != null) { digitizedObjects = component.digitizedObjects; } } public override void MidGameSerialize(List data, int i) { ((GunBehaviour)this).MidGameSerialize(data, i); int num = 0; foreach (DigitizedObject digitizedObject2 in digitizedObjects) { if (digitizedObject2 != null && digitizedObject2.type != HoldType.EMPTY) { num++; } } data.Add(num); for (int j = 0; j < digitizedObjects.Count; j++) { DigitizedObject digitizedObject = digitizedObjects[j]; if (digitizedObject == null || digitizedObject.type == HoldType.EMPTY) { continue; } data.Add(j); data.Add((int)digitizedObject.type); switch (digitizedObject.type) { case HoldType.CHEST: { data.Add(digitizedObject.data.prefabName); data.Add(digitizedObject.locked); data.Add(digitizedObject.glitched); data.Add(digitizedObject.rainbow); int num2 = ((digitizedObject.contents != null) ? digitizedObject.contents.Count : 0); data.Add(num2); for (int k = 0; k < num2; k++) { data.Add(digitizedObject.contents[k]); } break; } case HoldType.ENEMY: data.Add(digitizedObject.enemyGuid); break; case HoldType.PICKUP: data.Add(digitizedObject.pickupID); break; default: data.Add(digitizedObject.data.prefabName); break; } } data.Add((_lastEnemyKilled != null) ? _lastEnemyKilled : string.Empty); } public override void MidGameDeserialize(List saveData, ref int i) { ((GunBehaviour)this).MidGameDeserialize(saveData, ref i); int num = (int)saveData[i++]; for (int j = 0; j < num; j++) { int index = (int)saveData[i++]; HoldType holdType = (HoldType)saveData[i++]; _ = digitizedObjects[j]; switch (holdType) { case HoldType.CHEST: { string key2 = (string)saveData[i++]; bool locked = (bool)saveData[i++]; bool glitched = (bool)saveData[i++]; bool rainbow = (bool)saveData[i++]; int num3 = (int)saveData[i++]; List list = new List(num3); saveData.Add(num3); for (int k = 0; k < num3; k++) { list.Add((int)saveData[i++]); } digitizedObjects[index] = new DigitizedObject { type = HoldType.CHEST, data = _NameToPrefabMap[key2], locked = locked, glitched = glitched, rainbow = rainbow, contents = ((list.Count > 0) ? list : null) }; break; } case HoldType.ENEMY: { string guid = (string)saveData[i++]; digitizedObjects[index] = DigitizedObject.FromEnemyGuid(guid); break; } case HoldType.PICKUP: { int num2 = (int)saveData[i++]; digitizedObjects[index] = DigitizedObject.FromPickup(PickupObjectDatabase.GetById(num2)); break; } default: { string key = (string)saveData[i++]; digitizedObjects[index] = new DigitizedObject { type = holdType, data = _NameToPrefabMap[key] }; break; } } } _lastEnemyKilled = (string)saveData[i++]; if (string.IsNullOrEmpty(_lastEnemyKilled)) { _lastEnemyKilled = null; } else { _lastEnemyName = _lastEnemyKilled.AmmonomiconName(); } UpdateCurrentSlot(); } } public class FemtobyteProjectile : MonoBehaviour { private Projectile _projectile; private PlayerController _owner; private Femtobyte _femtobyte; private bool _setup; private void Start() { Setup(null); } public void Setup(Femtobyte femtobyte) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown if (!_setup) { _setup = true; _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)femtobyte)) { _femtobyte = femtobyte; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreRigidbodyCollision)); ((BraveBehaviour)_projectile).specRigidbody.AddCollisionLayerOverride(CollisionMask.LayerToMask((CollisionLayer)0)); ((BraveBehaviour)_projectile).specRigidbody.AddCollisionLayerOverride(CollisionMask.LayerToMask((CollisionLayer)16)); ((BraveBehaviour)_projectile).specRigidbody.AddCollisionLayerOverride(CollisionMask.LayerToMask((CollisionLayer)7)); ((BraveBehaviour)_projectile).specRigidbody.AddCollisionLayerOverride(CollisionMask.LayerToMask((CollisionLayer)5)); } Projectile projectile = _projectile; projectile.OnHitEnemy = (Action)Delegate.Combine(projectile.OnHitEnemy, new Action(OnHitEnemy)); Projectile projectile2 = _projectile; projectile2.OnWillKillEnemy = (Action)Delegate.Combine(projectile2.OnWillKillEnemy, new Action(OnWillKillEnemy)); tk2dBaseSprite component = ((Component)((Component)this).gameObject.GetComponentInChildren()).gameObject.GetComponent(); component.usesOverrideMaterial = true; Material material = ((BraveBehaviour)component).renderer.material; material.shader = CwaffShaders.DigitizeShader; material.SetTexture(CwaffVFX._BinaryTexId, (Texture)(object)CwaffShaders.DigitizeTexture); material.SetFloat(CwaffVFX._BinarizeProgressId, 1f); material.SetFloat(CwaffVFX._ColorizeProgressId, 1f); material.SetFloat(CwaffVFX._FadeProgressId, 0f); material.SetFloat(CwaffVFX._ScrollSpeedId, 3.5f); material.SetFloat(CwaffVFX._HScrollSpeedId, 0.25f); material.SetFloat(CwaffVFX._EmissionId, 10f); } } private void OnHitEnemy(Projectile p, SpeculativeRigidbody body, bool killed) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Femtobyte.SpawnBitBurst(body.UnitCenter, Mathf.Min((int)p.baseData.damage, 30)); AIActor component = ((Component)body).gameObject.GetComponent(); if (component != null && Object.op_Implicit((Object)(object)_femtobyte) && component.EnemyGuid != null && !(component.EnemyGuid != _femtobyte._lastEnemyKilled)) { PlayerController playerOwner = ((GunBehaviour)_femtobyte).PlayerOwner; if (playerOwner != null && playerOwner.HasSynergy(Synergy.LOOKUP_TABLE)) { OnWillKillEnemy(p, body); } } } private void OnWillKillEnemy(Projectile proj, SpeculativeRigidbody enemy) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) HealthHaver component = ((Component)enemy).GetComponent(); if (component != null && !component.IsBoss && !component.IsSubboss) { Femtobyte.SpawnBitBurst(enemy.UnitCenter, 10); if (Object.op_Implicit((Object)(object)_femtobyte)) { _femtobyte.TryToDigitize(((Component)enemy).gameObject); } } } private void OnPreRigidbodyCollision(SpeculativeRigidbody body, PixelCollider myCollider, SpeculativeRigidbody otherBody, PixelCollider otherCollider) { //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_0095: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_owner) || !Object.op_Implicit((Object)(object)_projectile) || !Object.op_Implicit((Object)(object)_femtobyte) || !Object.op_Implicit((Object)(object)otherBody)) { return; } if (!Object.op_Implicit((Object)(object)((Component)otherBody).GetComponent())) { if (Object.op_Implicit((Object)(object)((Component)otherBody).GetComponent())) { return; } HealthHaver component = ((Component)otherBody).GetComponent(); if (component != null && (component.IsBoss || component.IsSubboss)) { return; } } if (Object.op_Implicit((Object)(object)((Component)otherBody).GetComponent())) { PhysicsEngine.SkipCollision = true; return; } Vector2 unitCenter = otherBody.UnitCenter; if (_femtobyte.TryToDigitize(((Component)otherBody).gameObject)) { Femtobyte.SpawnBitBurst(unitCenter, 10); _projectile.DieInAir(false, false, false, false); PhysicsEngine.SkipCollision = true; } } private void Update() { if (Object.op_Implicit((Object)(object)_owner) && Object.op_Implicit((Object)(object)_projectile) && Object.op_Implicit((Object)(object)_femtobyte)) { TryToCollideWithPickups(); } } private void TryToCollideWithPickups() { //IL_0011: 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_0060: Unknown result type (might be due to invalid IL or missing references) IPlayerInteractable nearestInteractable = _owner.CurrentRoom.GetNearestInteractable(_projectile.SafeCenter, 1f, _owner); PickupObject val = (PickupObject)(object)((nearestInteractable is PickupObject) ? nearestInteractable : null); if (val != null && !val.IsBeingEyedByRat && ((Behaviour)val).isActiveAndEnabled) { Vector2 worldCenter = ((Component)val).GetComponent().WorldCenter; if (_femtobyte.TryToDigitize(((Component)val).gameObject)) { Femtobyte.SpawnBitBurst(worldCenter, 5); _projectile.DieInAir(false, false, false, false); } } } } public class DigitizedEnemy : MonoBehaviour { } public class FlipOnStart : MonoBehaviour { public PlayerController flipper; } [HarmonyPatch(typeof(FlippableCover), "Start")] internal static class FlippableCoverStartPatch { private static void Postfix(FlippableCover __instance) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) FlipOnStart component = ((Component)__instance).gameObject.GetComponent(); if (component != null) { ((BraveBehaviour)__instance).specRigidbody.PixelColliders[1].Enabled = true; __instance.RemoveFromRoomHierarchy(); if (Object.op_Implicit((Object)(object)__instance.m_breakable)) { ((PersistentVFXManagerBehaviour)__instance.m_breakable).TriggerTemporaryDestructibleVFXClear(); } __instance.Flip(__instance.GetFlipDirection(((BraveBehaviour)component.flipper).specRigidbody)); Object.Destroy((Object)(object)component); } } } public class Vladimir : CwaffGun { internal class ImpaledOnGunBehaviour : SkipNonProjectileCollisionsBehavior { } [HarmonyPatch(typeof(Dungeon), "SpawnCurseReaper")] private class PreventLotJSpawnWhenMasteredPatch { private static bool Prefix(Dungeon __instance) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 if (GameManager.Instance.PrimaryPlayer.HasSynergy(Synergy.MASTERY_VLADIMIR)) { return false; } if ((int)GameManager.Instance.CurrentGameType == 1 && GameManager.Instance.SecondaryPlayer.HasSynergy(Synergy.MASTERY_VLADIMIR)) { return false; } return true; } } public static string ItemName = "Vladimir"; public static string ShortDescription = "Poke 'em On"; public static string LongDescription = "Impales nearby enemies. Impaled enemies are vulnerable to other enemies' projectiles and take damage from subsequent stabs. Each stab can destroy a single enemy projectile. Cannot be dropped or switched while an enemy is impaled. Increases curse by 1."; public static string Lore = "Wielded by and named after a mad warrior who was addicted to impaling his enemies -- enough so that he would frequently count the number of times he was able to bounce them on his trident before they gave out on him. They say some of his madness still lingers within the weapon, but what that means is up to interpretation. On an unrelated note, you find yourself wondering how many stabs a Gun Nut can withstand."; internal const float _LAUNCH_FORCE = 150f; internal const float _SKEWER_DAMAGE = 14f; internal const float _CURSE_DAMAGE_SCALING = 4f; internal const int _ENEMIES_PER_CURSE = 10; internal static GameObject _AbsorbVFX = null; internal int _enemiesKilled; private List _skeweredEnemies = new List(); public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore).SetAttributes((ItemQuality)3, (GunClass)50, 0.1f, 100, Items.Banana, defaultAudio: false, infiniteAmmo: true, canGainAmmo: true, canReloadNoMatterAmmo: true, null, null, null, null, null, null, "vladimir_fire_sound", null, null, -1, -1, -1, null, modulesAreTiers: false, "muzzle_vladimir", 30, 1f, (Anchor)4, -1f, null, -1f, muzzleLit: false, 0f, 0f, null, null, preventRotation: false, 1f, continuousFire: false, dynamicBarrelOffsets: true, banFromBlessedRuns: false, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0).AddToShop((ShopType)2); int? clipSize = -1; float? cooldown = 0.3f; float? damage = 7f; float? speed = 1f; float? range = 0.01f; gun.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 0, null, customClip: false, damage, speed, null, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "vladimir_hitbox", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 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, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: true)).SetAllImpactVFX(VFX.CreatePool("vladimir_particles", 20f, loops: false, -1, 0.5f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1)).Attach((Action)delegate(PierceProjModifier pierce) { pierce.penetration = 100; pierce.penetratesBreakables = true; }, allowDuplicates: false) .Attach(); _AbsorbVFX = VFX.Create("vladimir_impale_projectile_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 1f); } public override void Update() { //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_0026: 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_009d: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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) base.Update(); PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null) { return; } Vector2 val = Vector3Extensions.XY(((GunBehaviour)this).gun.barrelOffset.position); Vector2 val2 = ((GunBehaviour)this).gun.CurrentAngle.ToVector(0.5f); int num = 0; for (int num2 = _skeweredEnemies.Count - 1; num2 >= 0; num2--) { AIActor val3 = _skeweredEnemies[num2]; if (!Object.op_Implicit((Object)(object)val3) || !Object.op_Implicit((Object)(object)((BraveBehaviour)val3).healthHaver) || !((BraveBehaviour)val3).healthHaver.IsAlive) { _skeweredEnemies.RemoveAt(num2); } else { ((BraveBehaviour)val3).sprite.PlaceAtPositionByAnchor(Vector2Extensions.ToVector3ZisY(val - (float)num * val2, 0f), (Anchor)4); num++; if (Object.op_Implicit((Object)(object)((BraveBehaviour)val3).specRigidbody)) { ((BraveBehaviour)val3).specRigidbody.Reinitialize(); } } } bool flag = _skeweredEnemies.Count > 0; playerOwner.inventory.GunLocked.SetOverride(ItemName, flag, (float?)null); } public override void OnPostFired(PlayerController player, Gun gun) { //IL_0013: 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_005a: 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) ((GunBehaviour)this).OnPostFired(player, gun); Vector2 val = gun.CurrentAngle.ToVector(); float num = 14f * player.DamageMult(); for (int num2 = _skeweredEnemies.Count - 1; num2 >= 0; num2--) { AIActor val2 = _skeweredEnemies[num2]; if (Object.op_Implicit((Object)(object)val2)) { HealthHaver healthHaver = ((BraveBehaviour)val2).healthHaver; if (healthHaver != null) { healthHaver.ApplyDamage(num, val, ItemName, (CoreDamageTypes)0, (DamageCategory)0, false, (PixelCollider)null, false); if (!healthHaver.IsAlive) { ((BraveBehaviour)val2).specRigidbody.RegisterSpecificCollisionException(((BraveBehaviour)player).specRigidbody); ((BraveBehaviour)val2).specRigidbody.AddCollisionLayerIgnoreOverride(CollisionMask.LayerToMask((CollisionLayer)4)); TossOff(val2, val); } } } } } public void Impale(AIActor enemy) { PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null && Object.op_Implicit((Object)(object)enemy) && enemy.IsHostileAndNotABoss() && Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).behaviorSpeculator) && !((BraveBehaviour)enemy).behaviorSpeculator.ImmuneToStun && Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).specRigidbody) && !Object.op_Implicit((Object)(object)((Component)enemy).GetComponent())) { _skeweredEnemies.Add(enemy); ((Component)enemy).gameObject.AddComponent(); ((BraveBehaviour)enemy).behaviorSpeculator.Stun(36000f, true); enemy.HitByEnemyBullets = true; ((BraveBehaviour)enemy).specRigidbody.AddCollisionLayerOverride(CollisionMask.LayerToMask((CollisionLayer)4)); playerOwner.inventory.GunLocked.SetOverride(ItemName, true, (float?)null); } } public void TossOff(AIActor enemy, Vector2 launchDir) { //IL_0059: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) _skeweredEnemies.Remove(enemy); enemy.HitByEnemyBullets = false; ((Component)enemy).GetComponent().SafeDestroy(); if (Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).behaviorSpeculator)) { ((BraveBehaviour)enemy).behaviorSpeculator.ResetStun(1f); } if (Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).specRigidbody)) { ((BraveBehaviour)enemy).specRigidbody.MoveTowardsTargetOrWall(((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition, Vector3Extensions.XY(((GunBehaviour)this).gun.barrelOffset.position)); ((BraveBehaviour)enemy).specRigidbody.AddCollisionLayerOverride(CollisionMask.LayerToMask((CollisionLayer)2)); ((BraveBehaviour)enemy).specRigidbody.RemoveCollisionLayerOverride(CollisionMask.LayerToMask((CollisionLayer)4)); ((BraveBehaviour)enemy).specRigidbody.AddCollisionLayerIgnoreOverride(CollisionMask.LayerToMask((CollisionLayer)4)); SpeculativeRigidbody specRigidbody = ((BraveBehaviour)enemy).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(DealDamageWhenTossedAtEnemies)); } if (Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).knockbackDoer)) { ((BraveBehaviour)enemy).knockbackDoer.m_activeKnockbacks.Clear(); ((BraveBehaviour)enemy).knockbackDoer.ClearContinuousKnockbacks(); ((BraveBehaviour)enemy).knockbackDoer.ApplyKnockback(launchDir, 150f, false); } if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) && base.Mastered && ++_enemiesKilled >= 10) { _enemiesKilled -= 10; ((GunBehaviour)this).PlayerOwner.IncreaseCurse(); } } private void DealDamageWhenTossedAtEnemies(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_007b: 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)myRigidbody) && Object.op_Implicit((Object)(object)((BraveBehaviour)myRigidbody).healthHaver)) { myRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Remove((Delegate?)(object)myRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(DealDamageWhenTossedAtEnemies)); AIActor aiActor = ((BraveBehaviour)otherRigidbody).aiActor; if (aiActor.IsNormalEnemy && Object.op_Implicit((Object)(object)((BraveBehaviour)aiActor).healthHaver)) { ((BraveBehaviour)aiActor).healthHaver.ApplyDamage(((BraveBehaviour)myRigidbody).healthHaver.GetMaxHealth(), myRigidbody.Velocity, ItemName, (CoreDamageTypes)0, (DamageCategory)0, false, (PixelCollider)null, false); } } } public void AbsorbProjectile(Projectile p) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) ((Component)((GunBehaviour)this).gun).gameObject.Play("subtractor_beam_fire_sound"); GameObject absorbVFX = _AbsorbVFX; Vector2 safeCenter = p.SafeCenter; float? fadeOutTime = 0.5f; CwaffVFX.SpawnBurst(absorbVFX, 8, safeCenter, 0.2f, null, 0f, 2f, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.None, 0.5f, fadeOutTime, 0f, null, fadeIn: false, uniform: true); p.DieInAir(true, false, false, true); } public override void PostProcessProjectile(Projectile projectile) { ((GunBehaviour)this).PostProcessProjectile(projectile); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) && base.Mastered) { ProjectileData baseData = projectile.baseData; baseData.damage += 4f * Mathf.Max(0f, ((GunBehaviour)this).PlayerOwner.Curse()); } } } public class VladimirProjectile : MonoBehaviour { private const float _PROJ_GRAB_RANGE_SQR = 9f; private Projectile _projectile; private PlayerController _owner; private Vladimir _gun; private bool _absorbedProjectile; private void Start() { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown _projectile = ((Component)this).GetComponent(); ((BraveBehaviour)((BraveBehaviour)_projectile).sprite).renderer.enabled = false; ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); if (Object.op_Implicit((Object)(object)_owner) && Object.op_Implicit((Object)(object)((GameActor)_owner).CurrentGun)) { Vladimir component = ((Component)((GameActor)_owner).CurrentGun).GetComponent(); if (component != null) { _gun = component; 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(OnHitEnemy)); } } } 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 Update() { //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_0052: 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_005e: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_gun) || _absorbedProjectile) { return; } Vector2 safeCenter = _projectile.SafeCenter; for (int num = StaticReferenceManager.AllProjectiles.Count - 1; num >= 0; num--) { Projectile val = StaticReferenceManager.AllProjectiles[num]; if (((Behaviour)val).isActiveAndEnabled && val.Owner is AIActor) { Vector2 val2 = safeCenter - val.SafeCenter; if (!(((Vector2)(ref val2)).sqrMagnitude > 9f)) { _gun.AbsorbProjectile(val); _absorbedProjectile = true; break; } } } } private void OnHitEnemy(Projectile p, SpeculativeRigidbody enemy, bool killed) { if (!Object.op_Implicit((Object)(object)enemy)) { return; } if (!killed) { _gun.Impale(((BraveBehaviour)enemy).aiActor); } else if (Object.op_Implicit((Object)(object)_gun)) { PlayerController playerOwner = ((GunBehaviour)_gun).PlayerOwner; if (playerOwner != null && _gun.Mastered && ++_gun._enemiesKilled >= 10) { _gun._enemiesKilled -= 10; playerOwner.IncreaseCurse(); } } } } public class Exceptional : CwaffGun { private class ExplodeWhenOpened : MonoBehaviour { private Chest chest; private float ExplodeTime = float.MaxValue; private bool didOpen; private static readonly ExplosionData _Explosion = new ExplosionData { forceUseThisRadius = true, pushRadius = 3f, damageRadius = 3f, damageToPlayer = 0f, doDamage = true, damage = 9001f, doDestroyProjectiles = false, doForce = false, force = 0f, debrisForce = 0f, preventPlayerForce = true, explosionDelay = 0.01f, usesComprehensiveDelay = false, doScreenShake = false, playDefaultSFX = true, ignoreList = new List(), effect = Explosions.DefaultLarge.effect, ss = Explosions.DefaultLarge.ss }; private void Start() { chest = ((Component)this).gameObject.GetComponent(); } private void Update() { //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_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 (!Object.op_Implicit((Object)(object)chest) || !Object.op_Implicit((Object)(object)((BraveBehaviour)chest).sprite)) { Object.Destroy((Object)(object)this); } else if (BraveTime.ScaledTimeSinceStartup >= ExplodeTime) { ((BraveBehaviour)chest).sprite.usesOverrideMaterial = false; Exploder.Explode(Vector2.op_Implicit(((BraveBehaviour)chest).sprite.WorldCenter), _Explosion, default(Vector2), (Action)null, true, (CoreDamageTypes)0, false); Object.Destroy((Object)(object)((Component)chest).gameObject); } else if (!didOpen && chest.IsOpen) { didOpen = true; ExplodeTime = BraveTime.ScaledTimeSinceStartup + 1f; } } } public class ExceptionalAmmoDisplay : CustomAmmoDisplay { private PlayerController _owner; private void Start() { ref PlayerController owner = ref _owner; GameActor currentOwner = ((Component)this).GetComponent().CurrentOwner; owner = (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null); } public override bool DoCustomAmmoDisplay(GameUIAmmoController uic) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_owner)) { return false; } uic.SetAmmoCountLabelColor(Color.red); uic.GunAmmoCountLabel.Text = $"{_ExceptionalPower}"; return true; } } [CompilerGenerated] private static class <>O { public static LogCallback <0>__Exceptionalizationizer; public static Action <1>__SpawnErrorChestOnceCombatEnds; } public static string ItemName = "Exceptional"; public static int _PickupId; public static int _ExceptionalPower; public static bool _Spawned = false; private const int _ERRORS_BEFORE_SPAWNING = 1337; private const int _BURST_SIZE = 7; private int _cachedPower = -1; private static bool _DidRuntimePatches = false; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Expected O, but got Unknown Gun gun = Lazy.SetupGun(ItemName, "", "", "", hideFromAmmonomicon: true); GunClass uTILITY = CwaffGunClass.UTILITY; int? shootFps = 30; int? reloadFps = 40; Items? muzzleFrom = Items.Mailbox; Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)(-50), uTILITY, 0f, 80, Items.Banana, defaultAudio: false, infiniteAmmo: true, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "corruption_sound", null, null, -1, -1, -1, muzzleFrom, modulesAreTiers: true, null, 60, 1f, (Anchor)3, -1f, null, -1f, muzzleLit: false, 0f, 0f, null, null, preventRotation: false, 0f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: true, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0).Attach((Action)null, allowDuplicates: false).AssignGun(out gunRef); int? clipSize = 32; float? cooldown = 0.33f; float? angleVariance = 10f; float? damage = 4f; float? speed = 75f; float? range = 1000f; float? force = 12f; float? burstCooldown = 0.04f; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)4, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "exceptional_projectile", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 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, burstCooldown, null, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: true)).Attach().Assign(out Projectile projectileRef); ProjectileModule defaultModule = gunRef.DefaultModule; gunRef.Volley.projectiles = new List(10); for (int i = 1; i <= 10; i++) { ProjectileModule val = ProjectileModule.CreateClone(defaultModule, false, -1); val.numberOfShotsInClip = -1; val.burstShotCount = i; val.projectiles = Enumerable.Repeat(projectileRef, i).ToList(); gunRef.Volley.projectiles.Add(val); } _PickupId = ((PickupObject)gunRef).PickupObjectId; object obj = <>O.<0>__Exceptionalizationizer; if (obj == null) { LogCallback val2 = Exceptionalizationizer; <>O.<0>__Exceptionalizationizer = val2; obj = (object)val2; } Application.logMessageReceived += (LogCallback)obj; } public static void InitRuntimePatches() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown Harmony harmony = Initialisation._Harmony; BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; harmony.Patch((MethodBase)typeof(AmmonomiconPageRenderer).GetMethod("SetRightDataPageTexts", bindingAttr), (HarmonyMethod)null, new HarmonyMethod(typeof(CorruptAmmonomiconPatch).GetMethod("Postfix", bindingAttr)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)typeof(EncounterTrackable).GetMethod("GetModifiedDisplayName", bindingAttr), (HarmonyMethod)null, new HarmonyMethod(typeof(CorruptDisplayNamePatch).GetMethod("Postfix", bindingAttr)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.EnumeratorMoveNext((MethodBase)typeof(UINotificationController).GetMethod("HandleNotification", bindingAttr)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(CorruptNotificationPatch).GetMethod("CorruptNotificationIL", bindingAttr))); } private void Start() { if (!_DidRuntimePatches) { InitRuntimePatches(); _DidRuntimePatches = true; } AdjustGunShader(isOn: true); } private static void CauseErrors() { DumpUsefulDataToLog(); throw new Exception("hi C:"); } private static void DumpUsefulDataToLog() { //IL_06e4: Unknown result type (might be due to invalid IL or missing references) Debug.LogWarning((object)"Dumping run data for debugging purposes"); Debug.LogWarning((object)"---------------------------------------"); if (!GameManager.HasInstance || GameManager.Instance.AllPlayers == null) { Debug.LogWarning((object)"No Active Players / Game Manager!"); return; } Debug.LogWarning((object)("Floor: " + GameManager.Instance.GetLastLoadedLevelDefinition()?.dungeonSceneName.IfNullOrEmpty("[UNKNOWN]"))); PlayerController bestActivePlayer = GameManager.Instance.BestActivePlayer; RoomHandler val = (Object.op_Implicit((Object)(object)bestActivePlayer) ? bestActivePlayer.CurrentRoom : null); if (val == null) { Debug.LogWarning((object)"Room: [NONE]"); } else { Debug.LogWarning((object)("Room: " + val.GetRoomName().IfNullOrEmpty("[NAMELESS ROOM]"))); Debug.LogWarning((object)" Active Enemies:"); List activeEnemies = val.GetActiveEnemies((ActiveEnemyType)0); if (activeEnemies != null) { foreach (AIActor item in activeEnemies) { if (!Object.op_Implicit((Object)(object)item)) { Debug.LogWarning((object)" [INVALID ENEMY]"); continue; } string s = ((!string.IsNullOrEmpty(item.EnemyGuid)) ? item.EnemyGuid.AmmonomiconName() : string.Empty); Debug.LogWarning((object)(" " + s.IfNullOrEmpty(((GameActor)item).ActorName).IfNullOrEmpty("[UNKNOWN ENEMY]"))); } } else { Debug.LogWarning((object)" [NO ACTIVE ENEMIES IN ROOM]"); } Debug.LogWarning((object)" Active Pickups In Room:"); ReadOnlyCollection roomInteractables = val.GetRoomInteractables(); bool flag = false; if (roomInteractables != null) { foreach (IPlayerInteractable item2 in roomInteractables) { PickupObject val2 = (PickupObject)(object)((item2 is PickupObject) ? item2 : null); if (val2 != null) { Debug.LogWarning((object)(" " + val2.SafeEncounterNameOrDisplayName().IfNullOrEmpty("[UNKNOWN PICKUP]"))); flag = true; } } } if (!flag) { Debug.LogWarning((object)" [NO PICKUPS IN ROOM]"); } } Debug.LogWarning((object)"Active Pickups On Floor:"); List unassignedInteractableObjects = RoomHandler.unassignedInteractableObjects; bool flag2 = false; if (unassignedInteractableObjects != null) { foreach (IPlayerInteractable item3 in unassignedInteractableObjects) { PickupObject val3 = (PickupObject)(object)((item3 is PickupObject) ? item3 : null); if (val3 != null) { string s2 = val3.SafeEncounterNameOrDisplayName(); Debug.LogWarning((object)(" " + s2.IfNullOrEmpty("[UNKNOWN PICKUP]"))); flag2 = true; } } } if (!flag2) { Debug.LogWarning((object)" [NO PICKUPS ON FLOOR]"); } string[] names = Enum.GetNames(typeof(StatType)); AdvancedSynergyEntry[] synergies = GameManager.Instance.SynergyManager.synergies; PlayerController[] allPlayers = GameManager.Instance.AllPlayers; foreach (PlayerController val4 in allPlayers) { if (!Object.op_Implicit((Object)(object)val4)) { Debug.LogWarning((object)"[INVALID PLAYER]"); continue; } Debug.LogWarning((object)$"Player {val4.PlayerIDX + 1}:"); Debug.LogWarning((object)(" Character: " + ((Object)val4).name.IfNullOrEmpty("[UNKNOWN CHARACTER]") + ":")); Debug.LogWarning((object)" Guns:"); if (val4.inventory == null || val4.inventory.m_guns == null || val4.inventory.m_guns.Count == 0) { Debug.LogWarning((object)" [NO GUNS]"); } else { foreach (Gun gun in val4.inventory.m_guns) { if (!Object.op_Implicit((Object)(object)gun)) { Debug.LogWarning((object)" [CORRUPTED GUN])"); } else { Debug.LogWarning((object)(" " + ((PickupObject)(object)gun).SafeEncounterNameOrDisplayName().IfNullOrEmpty("[NAMELESS GUN]"))); } } } Debug.LogWarning((object)" Passives:"); if (val4.passiveItems == null || val4.passiveItems.Count == 0) { Debug.LogWarning((object)" [NO PASSIVES]"); } else { foreach (PassiveItem passiveItem in val4.passiveItems) { if (!Object.op_Implicit((Object)(object)passiveItem)) { Debug.LogWarning((object)" [CORRUPTED PASSIVE]"); } else { Debug.LogWarning((object)(" " + ((PickupObject)(object)passiveItem).SafeEncounterNameOrDisplayName().IfNullOrEmpty("[NAMELESS PASSIVE]"))); } } } Debug.LogWarning((object)" Actives:"); if (val4.activeItems == null || val4.activeItems.Count == 0) { Debug.LogWarning((object)" [NO ACTIVES]"); } else { foreach (PlayerItem activeItem in val4.activeItems) { if (!Object.op_Implicit((Object)(object)activeItem)) { Debug.LogWarning((object)" [CORRUPTED ACTIVE]"); } else { Debug.LogWarning((object)(" " + ((PickupObject)(object)activeItem).SafeEncounterNameOrDisplayName().IfNullOrEmpty("[NAMELESS ACTIVE]"))); } } } Debug.LogWarning((object)" Synergies:"); if (val4.ActiveExtraSynergies == null || val4.ActiveExtraSynergies.Count == 0) { Debug.LogWarning((object)" [NO SYNERGIES]"); } else { foreach (int activeExtraSynergy in val4.ActiveExtraSynergies) { if (activeExtraSynergy >= synergies.Length) { Debug.LogWarning((object)" [UNKNOWN SYNERGY]"); continue; } AdvancedSynergyEntry val5 = synergies[activeExtraSynergy]; if (val5 == null) { Debug.LogWarning((object)" [MISSING SYNERGY]"); } else { Debug.LogWarning((object)(" " + val5.NameKey.IfNullOrEmpty("[NAMELESS SYNERGY]"))); } } } Debug.LogWarning((object)" Stats:"); if ((Object)(object)val4.stats == (Object)null || val4.stats.StatValues == null || val4.stats.StatValues.Count == 0) { Debug.LogWarning((object)" [NO STATS]"); continue; } for (int j = 0; j < val4.stats.StatValues.Count; j++) { Debug.LogWarning((object)$" {((j < names.Length && !string.IsNullOrEmpty(names[j])) ? names[j] : $"[UNKNOWN STAT #{j}]")}: {val4.stats.StatValues[j]}"); } } Debug.LogWarning((object)$"Active Projectiles: {StaticReferenceManager.AllProjectiles?.Count ?? 0}"); Debug.LogWarning((object)$"Active Debris Objects: {StaticReferenceManager.AllDebris?.Count ?? 0}"); Debug.LogWarning((object)$"Active Goops: {StaticReferenceManager.AllGoops?.Count ?? 0}"); Debug.LogWarning((object)("Current Run Time: " + (GameStatsManager.HasInstance ? GameStatsManager.Instance.GetSessionStatValue((TrackedStats)23).ToString() : "[UNKNOWN]") + " seconds")); Debug.LogWarning((object)$"Current Game Language: {StringTableManager.CurrentLanguage}"); Debug.LogWarning((object)"---------------------------------------"); } public override void Update() { base.Update(); if (_cachedPower != _ExceptionalPower) { _cachedPower = _ExceptionalPower; int num = 0; if (_cachedPower >= 2) { num = Mathf.Min(9, Mathf.FloorToInt(Mathf.Log((float)_cachedPower, 2f))); } if (((GunBehaviour)this).gun.CurrentStrengthTier != num) { ((GunBehaviour)this).gun.CurrentStrengthTier = num; } } } public void AdjustGunShader(bool isOn) { ((BraveBehaviour)((GunBehaviour)this).gun).sprite.usesOverrideMaterial = isOn; ((BraveBehaviour)((BraveBehaviour)((GunBehaviour)this).gun).sprite).renderer.material.shader = (isOn ? CwaffShaders.CorruptShader : ShaderCache.Acquire("Brave/PlayerShader")); } public static void Exceptionalizationizer(string text, string stackTrace, LogType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)type == 4 && ++_ExceptionalPower >= 1337 && !_Spawned) { _Spawned = true; try { DumpUsefulDataToLog(); } catch { Debug.LogError((object)"Got an error while logging errors...RIP"); } if (GameManager.Instance.BestActivePlayer.IsInCombat) { GameManager.Instance.BestActivePlayer.OnRoomClearEvent += SpawnErrorChestOnceCombatEnds; } else { SpawnErrorChestImmediately(); } } } private static void SpawnErrorChestOnceCombatEnds(PlayerController player) { player.OnRoomClearEvent -= SpawnErrorChestOnceCombatEnds; SpawnErrorChestImmediately(); } private static void SpawnErrorChestImmediately() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) bool flag = default(bool); Chest obj = Lazy.SpawnChestWithSpecificItem(Lazy.Pickup(), GameManager.Instance.BestActivePlayer.CurrentRoom.GetCenteredVisibleClearSpot(2, 2, ref flag, false), (ItemQuality)5, overrideJunk: true); obj.MimicGuid = null; ((BraveBehaviour)obj).sprite.usesOverrideMaterial = true; ((BraveBehaviour)((BraveBehaviour)obj).sprite).renderer.material.shader = CwaffShaders.CorruptShader; ((Component)obj).gameObject.AddComponent(); } } public class ExceptionalProjectile : MonoBehaviour { private enum State { START, DECEL, HALT, RELAUNCH } private const float _DECEL_START = 0.05f; private const float _HALT_START = 0.25f; private const float _RELAUNCH_START = 0.5f; private Projectile _projectile; private PlayerController _owner; private float _lifetime; private State _state; private void Start() { _projectile = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); Projectile projectile = _projectile; projectile.OnHitEnemy = (Action)Delegate.Combine(projectile.OnHitEnemy, new Action(OnHitEnemy)); _projectile.m_usesNormalMoveRegardless = true; ((BraveBehaviour)_projectile).sprite.usesOverrideMaterial = true; ((BraveBehaviour)((BraveBehaviour)_projectile).sprite).renderer.material.shader = CwaffShaders.CorruptShader; } private static void ApplyCorruptionShader(tk2dBaseSprite sprite) { sprite.usesOverrideMaterial = true; ((BraveBehaviour)sprite).renderer.material.shader = CwaffShaders.CorruptShader; } private void OnHitEnemy(Projectile bullet, SpeculativeRigidbody enemy, bool killed) { ((Component)enemy).gameObject.PlayUnique("corruption_sound"); if (Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).aiActor)) { ((BraveBehaviour)enemy).aiActor.ApplyShader(ApplyCorruptionShader, includeHands: true, includeGun: true); } } private void Update() { //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_00fb: Unknown result type (might be due to invalid IL or missing references) _lifetime += BraveTime.DeltaTime; switch (_state) { case State.START: if (_lifetime >= 0.05f) { _state = State.DECEL; } break; case State.DECEL: _projectile.baseData.speed = Lazy.SmoothestLerp(_projectile.baseData.speed, 0f, 10f); _projectile.UpdateSpeed(); if (_lifetime >= 0.25f) { _projectile.baseData.speed = 0.01f; _projectile.UpdateSpeed(); _state = State.HALT; } break; case State.HALT: if (_lifetime >= 0.5f) { AIActor val = Lazy.NearestEnemy(_projectile.SafeCenter); if (val != null) { _projectile.SendInDirection(((GameActor)val).CenterPosition - _projectile.SafeCenter, true, true); } _projectile.baseData.speed = 100f * (Object.op_Implicit((Object)(object)_owner) ? _owner.ProjSpeedMult() : 1f); _projectile.UpdateSpeed(); ((Component)this).gameObject.PlayUnique("corruption_sound"); _state = State.RELAUNCH; } break; case State.RELAUNCH: break; } } } internal static class CorruptNotificationPatch { private static StringBuilder _SB = new StringBuilder("", 1000); private static void CorruptNotificationIL(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_0041: 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_0064: 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) ILCursor val = new ILCursor(il); Type declaringType = original.DeclaringType; 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, declaringType.GetEnumeratorField("notifyParams")); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldfld, declaringType.GetEnumeratorField("$this")); val.CallPrivate(typeof(CorruptNotificationPatch), "Corrupt"); } } private static void Corrupt(NotificationParams notifyParams, UINotificationController uinc) { if (notifyParams.pickupId == Exceptional._PickupId) { _SB.Length = 0; _SB.Append("[color #dd6666]"); _SB.Append(Lazy.GenRandomCorruptedString()); _SB.Append("[/color]"); uinc.NameLabel.ProcessMarkup = true; uinc.NameLabel.Text = _SB.ToString(); _SB.Length = 0; _SB.Append("[color #dd6666]"); _SB.Append(Lazy.GenRandomCorruptedString()); _SB.Append(Lazy.GenRandomCorruptedString()); _SB.Append("[/color]"); uinc.DescriptionLabel.ProcessMarkup = true; uinc.DescriptionLabel.Text = _SB.ToString(); } } } internal static class CorruptAmmonomiconPatch { private static void Postfix(AmmonomiconPageRenderer __instance, tk2dBaseSprite sourceSprite, EncounterDatabaseEntry linkedTrackable) { if (linkedTrackable.pickupObjectId == Exceptional._PickupId) { dfScrollPanel component = ((Component)((Component)((!((Object)(object)AmmonomiconController.Instance.ImpendingRightPageRenderer != (Object)null)) ? AmmonomiconController.Instance.CurrentRightPageRenderer : AmmonomiconController.Instance.ImpendingRightPageRenderer).guiManager).transform.Find("Scroll Panel")).GetComponent(); Transform val = ((Component)component).transform.Find("Header"); if (Object.op_Implicit((Object)(object)val)) { dfLabel component2 = ((Component)val.Find("Label")).GetComponent(); component2.ProcessMarkup = true; component2.Text = Lazy.GenRandomCorruptedString(); ((dfControl)component2).PerformLayout(); dfLabel component3 = ((Component)((Component)component).transform.Find("Tape Line One").Find("Label")).GetComponent(); component3.ProcessMarkup = true; component3.Text = Lazy.GenRandomCorruptedString(); ((dfControl)component3).PerformLayout(); ((dfControl)((Component)((Component)component).transform.Find("Tape Line One")).GetComponentInChildren()).Width = component3.GetAutosizeWidth() / 4f + 12f; dfLabel component4 = ((Component)((Component)component).transform.Find("Tape Line Two").Find("Label")).GetComponent(); component4.ProcessMarkup = true; component4.Text = Lazy.GenRandomCorruptedString(); ((dfControl)component4).PerformLayout(); ((dfControl)((Component)((Component)component).transform.Find("Tape Line Two")).GetComponentInChildren()).Width = component4.GetAutosizeWidth() / 4f + 12f; dfLabel component5 = ((Component)((Component)component).transform.Find("Scroll Panel").Find("Panel").Find("Label")).GetComponent(); __instance.CheckLanguageFonts(component5); component5.ProcessMarkup = true; component5.Text = Lazy.GenRandomCorruptedString() + "\n" + Lazy.GenRandomCorruptedString() + "\n" + Lazy.GenRandomCorruptedString() + "\n" + Lazy.GenRandomCorruptedString(); ((dfControl)((Component)((Component)component5).transform.parent).GetComponent()).Height = ((dfControl)component5).Height; ((dfControl)component5).PerformLayout(); ((dfControl)component5).Update(); } } } } internal static class CorruptDisplayNamePatch { private static void Postfix(EncounterTrackable __instance, ref string __result) { PickupObject pickup = __instance.m_pickup; if (pickup != null && pickup.PickupObjectId == Exceptional._PickupId) { __result = Lazy.GenRandomCorruptedString(); } } } public class Zag : CwaffGun { public static string ItemName = "Zag"; public static string ShortDescription = "Ziggin'"; public static string LongDescription = "Fires bullets that will attempt to navigate around walls to seek out enemies and home in when perpendicular to them."; public static string Lore = "An unusual combination of cutting-edge projectile technology housed in a cheap, barebones firearm. Given that the projectiles are self-propelled, self-stabilized, and self-guided before even leaving the barrel, the housing is largely incidental. Even so, one would think that any manufacturer willing to spend a fortune on state-of-the-art projectiles could spare a few extra casings for a more shock absorbant grip."; internal static CwaffTrailController _ZagTrailPrefab = null; internal static GameObject _ZagZigVFX = null; internal static Projectile _ZagProjectile = null; public static void Init() { //IL_013d: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 30; int? reloadFps = 40; Items? muzzleFrom = Items.Heroine; Gun gun2 = gun.SetAttributes((ItemQuality)4, (GunClass)1, 0.8f, 600, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "zag_zig_sound", "zag_zig_sound", null, -1, 0, -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); int? clipSize = 9; float? cooldown = 0.125f; bool? electric = true; bool? preventOrbiting = true; float? damage = 5f; float? speed = 40f; IntVector2? overrideColliderPixelSizes = new IntVector2(2, 2); gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "zag_bullet", 8, (Anchor)4, 1f, anchorsChangeColliders: false, fixesScales: true, overrideColliderPixelSizes, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, preventOrbiting, null, "zag_hit_enemy_sound", null, null, 0f, ignoredForReloadPurposes: false, mirror: false, electric)).Attach().CopyAllImpactVFX(Items.ShockRifle) .Assign(out _ZagProjectile); _ZagTrailPrefab = VFX.CreateSpriteTrailObject("zag_trail_mid", 30, null, -1f, 1f / 60f, -1f, destroyOnEmpty: true); _ZagZigVFX = VFX.Create("zag_zig_vfx", 15f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } } public class ZagProjectile : MonoBehaviour { private const int _MAX_TILE_COLLISIONS = 10; private Projectile _projectile; private PlayerController _owner; private bool _blockedByWall; private Vector2 _wallAngle; private int _tileCollisionsLeft; private SpeculativeRigidbody _body; private bool _hasTarget; private bool _straightened; private CwaffTrailController _trail; private bool _mastered; private bool _doNormalSetup = true; private static readonly Color _ZAG_GRAY = new Color(0.5f, 0.625f, 0.5f, 1f); private const float _MAX_DIST = 1f; private const float _MAX_DIST_SQR = 1f; private void Start() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //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) _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)) { _mastered = _owner.HasSynergy(Synergy.MASTERY_ZAG); _body = ((Component)this).GetComponent(); if (_doNormalSetup) { _wallAngle = _projectile.Direction; _tileCollisionsLeft = 10; } SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreRigidbodyCollision)); SpeculativeRigidbody specRigidbody2 = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody2.OnTileCollision = (OnTileCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody2.OnTileCollision, (Delegate?)new OnTileCollisionDelegate(OnTileCollision)); _projectile.BulletScriptSettings.surviveTileCollisions = true; _projectile.m_usesNormalMoveRegardless = true; _trail = ((BraveBehaviour)(object)_projectile).AddTrail(Zag._ZagTrailPrefab); ((Component)_trail).gameObject.SetGlowiness(10f); } } private void OnPreRigidbodyCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { if (otherRigidbody.IsActuallyOubiletteEntranceRoom()) { _projectile.DieInAir(false, true, true, false); } } private void OnTileCollision(CollisionData tileCollision) { //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_0067: 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_008f: 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_00a9: 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_00d3: Unknown result type (might be due to invalid IL or missing references) if (_blockedByWall || _hasTarget || _tileCollisionsLeft <= 0) { _projectile.DieInAir(false, true, true, false); return; } if (--_tileCollisionsLeft <= 0) { _projectile.BulletScriptSettings.surviveTileCollisions = false; } _ = tileCollision.MyRigidbody; _wallAngle = -((CastResult)tileCollision).Normal; bool flag = Vector2Extensions.ToAngle(_wallAngle).RelAngleTo(Vector2Extensions.ToAngle(_projectile.Direction)) > 0f; Vector2 val = ((CastResult)tileCollision).Normal.Rotate(flag ? (-90f) : 90f); PhysicsEngine.PostSliceVelocity = val; _blockedByWall = true; _straightened = true; DoZigZag(val); if (_mastered) { SplitProjectile(-val); } } private void SplitProjectile(Vector2 dir) { //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_001a: 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_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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) Projectile component = SpawnManager.SpawnProjectile(((Component)Zag._ZagProjectile).gameObject, Vector2.op_Implicit(_projectile.SafeCenter), dir.EulerZ(), true).GetComponent(); component.SpawnedFromOtherPlayerProjectile = true; component.Owner = _projectile.Owner; component.Shooter = _projectile.Shooter; if (Object.op_Implicit((Object)(object)_owner)) { _owner.DoPostProcessProjectile(component); } ZagProjectile component2 = ((Component)component).gameObject.GetComponent(); component2._doNormalSetup = false; component2._mastered = true; component2._straightened = true; component2._blockedByWall = true; component2._wallAngle = _wallAngle; component2._tileCollisionsLeft = _tileCollisionsLeft; ((Component)component2).gameObject.GetComponent().PushAgainstWalls(Vector2Extensions.ToIntVector2(_wallAngle, (VectorConversions)2)); } private void DoZigZag(Vector2 newDir) { //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_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_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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) Vector2 self = -newDir; CwaffVFX.Spawn(Zag._ZagZigVFX, ((Component)this).transform.position, self.EulerZ(), 2f * ((Vector2)(ref self)).normalized, 0.2f, 0.4f); if (Object.op_Implicit((Object)(object)_trail) && Object.op_Implicit((Object)(object)((BraveBehaviour)_trail).specRigidbody)) { _trail.DisconnectFromSpecRigidbody(); } _projectile.SendInDirection(newDir, true, true); ((Component)this).gameObject.PlayUnique("zag_zig_sound"); _trail = ((BraveBehaviour)(object)_projectile).AddTrail(Zag._ZagTrailPrefab); ((Component)_trail).gameObject.SetGlowiness(10f); } private void Reorient() { //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_002e: Unknown result type (might be due to invalid IL or missing references) if (_blockedByWall && !_body.IsAgainstWall(Vector2Extensions.ToIntVector2(_wallAngle, (VectorConversions)2), 16)) { _blockedByWall = false; DoZigZag(_wallAngle); } } private static AIActor FindClosestPerpendicularEnemy(Vector2 ppos, float trajectory, out Vector2 trueIpoint) { //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_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_001f: 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_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_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_0095: 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_009d: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00b5: 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_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) trueIpoint = Vector2.zero; Vector2 dir = trajectory.ToVector(); float num = 1f; AIActor result = null; foreach (AIActor allNearbyEnemy in ppos.GetAllNearbyEnemies(100f, ignoreWalls: false)) { if (!Object.op_Implicit((Object)(object)allNearbyEnemy) || !allNearbyEnemy.IsHostile(canBeDead: false, canBeNeutral: true)) { continue; } Vector2? val = Lazy.PointOrthognalTo(ppos, ((GameActor)allNearbyEnemy).CenterPosition, dir); if (!val.HasValue) { continue; } Vector2 val2 = ppos - val.Value; float sqrMagnitude = ((Vector2)(ref val2)).sqrMagnitude; if (!(sqrMagnitude > num)) { val2 = ((GameActor)allNearbyEnemy).CenterPosition - ppos; Vector2 target = ppos + ((Vector2)(ref val2)).normalized; if (((GameActor)allNearbyEnemy).CenterPosition.HasLineOfSight(target)) { num = sqrMagnitude; result = allNearbyEnemy; trueIpoint = val.Value; } } } return result; } private void StraightenOut() { //IL_0006: 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_004d: Unknown result type (might be due to invalid IL or missing references) float num = Vector2Extensions.ToAngle(_projectile.Direction).Clamp360(); float num2 = dfNumberExtensions.Quantize(num, 90f, (VectorConversions)2); float num3 = (num2 - num).Clamp180(); float num4 = 360f * BraveTime.DeltaTime; if (Mathf.Abs(num3) < num4) { _projectile.SendInDirection(num2.ToVector(), true, true); _straightened = true; } else { _projectile.SendInDirection((num + Mathf.Sign(num3) * num4).ToVector(), true, true); } } private void Update() { //IL_0038: 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_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_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) if (BraveTime.DeltaTime == 0f) { return; } if (!_straightened) { StraightenOut(); } Reorient(); if (!_hasTarget && _straightened) { Vector2 trueIpoint; AIActor val = FindClosestPerpendicularEnemy(_projectile.SafeCenter, Vector2Extensions.ToAngle(_projectile.Direction), out trueIpoint); if (val != null) { _hasTarget = true; _blockedByWall = false; ((BraveBehaviour)_projectile).specRigidbody.Position = new Position(trueIpoint); ((BraveBehaviour)_projectile).specRigidbody.UpdateColliderPositions(); DoZigZag(((GameActor)val).CenterPosition - trueIpoint); } } } } public class Vacpack : CwaffGun { private class SlimeProjectile : WeirdProjectile { private static readonly AnimationCurve _KnockbackCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[4] { new Keyframe(0f, 1f), new Keyframe(0.25f, 0.3f), new Keyframe(0.5f, 0.1f), new Keyframe(1f, 0f) }); private void BecomeSlime() { //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_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_009d: 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_00a7: 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_00bb: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) int num = 2; Gun possibleSourceGun = ((Projectile)this).PossibleSourceGun; if (possibleSourceGun != null) { Vacpack component = ((Component)possibleSourceGun).gameObject.GetComponent(); if (component != null) { num = component._lastSlime; if (component.slimeCounts[num] > 0) { List slimeCounts = component.slimeCounts; int index = num; int value = slimeCounts[index] - 1; slimeCounts[index] = value; } } } if (num < 0 && num >= Slimybois.NumSlimes) { num = 2; } SlimeData obj = Slimybois.SlimeData[num]; Vector2 safeCenter = ((Projectile)this).SafeCenter; AIActor val = AIActor.Spawn(obj.prefab, safeCenter, Vector3Extensions.GetAbsoluteRoom(safeCenter), true, (AwakenAnimationType)2, true); val.SpawnInInstantly(); ((Component)val).gameObject.AddComponent(); Vector2 val2 = Vector2.op_Implicit(((BraveBehaviour)this).transform.right); KnockbackDoer knockbackDoer = ((BraveBehaviour)val).knockbackDoer; Vector2 val3 = Vector2.op_Implicit(((BraveBehaviour)this).transform.right); GameObject gameObject = ((Component)val).gameObject; knockbackDoer.ApplySourcedKnockback(val3, ((Projectile)this).baseData.speed * Random.Range(0.8f, 1f), _KnockbackCurve, 0.75f, gameObject, false); SlimyboiController component2 = ((Component)val).gameObject.GetComponent(); Vector2 dir = val2; GameActor obj2 = base.sourceOwner; component2.HandleFiredFromVacpack(dir, (PlayerController)(object)((obj2 is PlayerController) ? obj2 : null)); GameObject gameObject2 = obj.debris.gameObject; Vector2? baseVelocity = 3f * ((Vector2)(ref val2)).normalized; float? fadeOutTime = 0.1f; float? startScale = 1f; float? endScale = 0f; CwaffVFX.SpawnBurst(gameObject2, 10, safeCenter, 0f, baseVelocity, 0f, 2f, CwaffVFX.Vel.Random, CwaffVFX.Rot.Random, 0.5f, fadeOutTime, 0f, null, fadeIn: false, uniform: false, startScale, endScale, null, randomFrame: false, -1, flipX: false, flipY: false, null, null, 1.55f, 0f, null, -1, 0f, 0f, unoccluded: false, copyShaders: true); ((Component)this).gameObject.Play("slime_spawn_sound"); } protected override void OnFiredByAnything() { BecomeSlime(); ((Projectile)this).DieInAir(true, false, false, false); } } private class VacpackAmmoDisplay : CustomAmmoDisplay { private Gun _gun; private Vacpack _vac; private PlayerController _owner; private int _cachedIndex = -1; private int _cachedCount = -1; private string _cachedAmmoString = string.Empty; private void Start() { _gun = ((Component)this).GetComponent(); _vac = ((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 curSlime = _vac._curSlime; if (curSlime < 0) { uic.GunAmmoCountLabel.Text = "Vac Mode"; } else { int num = _vac.slimeCounts[curSlime]; if (curSlime != _cachedIndex || num != _cachedCount) { _cachedIndex = curSlime; _cachedCount = num; _cachedAmmoString = $"[sprite \"slime_{Slimybois.SlimeData[curSlime].slimeName}_ui\"]\nx{num}"; } uic.GunAmmoCountLabel.Text = _cachedAmmoString; } return true; } } public static string ItemName = "Vacpack"; public static string ShortDescription = "Plortable Storage"; public static string LongDescription = "Shoots and vacuums slimes. Tap reload to toggle between shooting and vacuuming. Hold reload to select a slime to shoot. Each slime type has unique stats and behavior in combat. Slimes cannot be vacuumed in combat."; public static string Lore = "A multipurpose device catering to all sorts of slime ranching needs. Compared to other models, this Vacpack omits many of the usual upgrades in the interest of carrying as many slimes as possible. Cutting-edge slime compression technology allows the user to collect hundreds -- perhaps thousands -- of slimes in a compact, portable form factor."; internal static GameObject _VacpackVFX = null; internal const float _REACH = 9f; internal const float _ABSORB_RANGE = 1.5f; internal const float _SPREAD = 15f; internal const float _ACCEL_SEC = 3.5f; internal const float _SUCK_FORCE = 100f; internal const float _SQR_REACH = 81f; internal const float _SQR_ABSORB_RANGE = 2.25f; private const float _HUD_HOLD_TIME = 0.25f; public List slimeCounts; private Dictionary _KnockbackDict = new Dictionary(); private List _vacSlimes = new List(); private VacpackHUD _hud; private int _curSlime = -1; private int _lastSlime = 2; private float _hudHoldTimer; public static void Init() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_061c: Expected O, but got Unknown Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); GunClass uTILITY = CwaffGunClass.UTILITY; int? chargeFps = 16; bool? doesScreenShake = false; Items? muzzleFrom = Items.Mailbox; gun.SetAttributes((ItemQuality)(-100), uTILITY, 0f, 999, Items.Banana, defaultAudio: false, infiniteAmmo: true, canGainAmmo: true, canReloadNoMatterAmmo: false, doesScreenShake, null, null, null, chargeFps, null, null, null, null, -1, -1, -1, muzzleFrom, modulesAreTiers: true, null, 60, 1f, (Anchor)3, -1f, null, -1f, muzzleLit: false, 0f, 0f, null, null, preventRotation: false, 0f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: true, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0, autoPlay: true, attacksThroughWalls: false, suppressReloadLabel: false, 1f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: false, preventRollingWhenCharging: false, 1f, -1f, canAttackWhileRolling: false, isStarterGun: false, 1f, preventDuctTape: false, 0.5f, preventVolleyModifications: true, undroppableStarter: true).Attach((Action)null, allowDuplicates: false).AssignGun(out Gun gunRef) .InitProjectile(GunData.New(null, null, -1, null, null, (ShootStyle)3, (ProjectileSequenceStyle)0, float.MaxValue, 1, null, customClip: false, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 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, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: true)); ProjectileModule item = GunBuilder.InitSpecialSingleProjectileModule(new ProjectileModule(), GunData.New(gunRef, Items._38Special.Projectile(), -1, 0.225f, damage: 3f, speed: 300f, range: 9999f, force: 12f, angleVariance: 5f, shootStyle: (ShootStyle)0, sequenceStyle: (ProjectileSequenceStyle)0, chargeTime: 0f, ammoCost: 1, ammoType: null, customClip: false, recoil: null, poison: 0f, fire: 0f, freeze: 0f, slow: 0f, collidesWithEnemies: null, ignoreDamageCaps: null, collidesWithProjectiles: null, surviveRigidbodyCollisions: null, collidesWithTilemap: null, sprite: null, fps: 2, anchor: (Anchor)4, scale: 1f, anchorsChangeColliders: true, fixesScales: true, overrideColliderPixelSizes: null, overrideColliderOffsets: null, bossDamageMult: 1f, destroySound: null, shouldRotate: null, barrageSize: 1, shouldFlipHorizontally: null, shouldFlipVertically: null, useDummyChargeModule: false, invisibleProjectile: false, spawnSound: null, stopSoundOnDeath: null, uniqueSounds: null, shrapnelVFX: null, shrapnelCount: null, shrapnelMinVelocity: null, shrapnelMaxVelocity: null, shrapnelLifetime: null, preventOrbiting: null, hitSound: "generic_bullet_impact")); gunRef.Volley.projectiles.Add(item); _VacpackVFX = VFX.Create("vacpack_wind_sprite_a", 30f, loops: true, 6, 0.5f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } private void Start() { EnsureSlimeCounts(); } private void EnsureSlimeCounts() { if (slimeCounts == null || slimeCounts.Count <= 0) { int numSlimes = Slimybois.NumSlimes; slimeCounts = new List(numSlimes); for (int i = 0; i < numSlimes; i++) { slimeCounts.Add(0); } slimeCounts[2] = 8; } } public override void MidGameSerialize(List data, int i) { ((GunBehaviour)this).MidGameSerialize(data, i); for (int j = 0; j < Slimybois.NumSlimes; j++) { data.Add(slimeCounts[j]); } } public override void MidGameDeserialize(List data, ref int i) { ((GunBehaviour)this).MidGameDeserialize(data, ref i); EnsureSlimeCounts(); for (int j = 0; j < Slimybois.NumSlimes; j++) { slimeCounts[j] = (int)data[i++]; } } public override void OnTriedToInitiateAttack(PlayerController player) { base.OnTriedToInitiateAttack(player); if (Object.op_Implicit((Object)(object)_hud) && _hud.Active) { DoSlimeSelection(); DismissHUD(); player.SuppressThisClick = true; } else if (_curSlime >= 0 && slimeCounts[_curSlime] == 0) { ((Component)this).gameObject.Play("vacpack_empty_sound"); player.SuppressThisClick = true; } } public override bool OnManualReloadAttempted(PlayerController player) { if (!player.AcceptingNonMotionInput || ((GunBehaviour)this).gun.IsFiring) { return false; } CreateHUDIfNecessary(); if (_hud.Active) { return false; } _hudHoldTimer = 0.25f; return false; } public void DoSlimeSelection(int slimeIndex = -2) { if (slimeIndex == -2) { _lastSlime = (slimeIndex = VacpackHUD.SlimeIndexForAngle(((GunBehaviour)this).PlayerOwner.AimAngleFromCenterOfScreen())); } _curSlime = slimeIndex; int num = ((slimeIndex >= 0) ? 1 : 0); if (num != ((GunBehaviour)this).gun.m_currentStrengthTier) { ((GunBehaviour)this).gun.CurrentStrengthTier = num; ClearCachedShootData(); } ((Component)this).gameObject.Play("vacpack_select_sound"); } public override void Update() { //IL_017e: 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) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: 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_01d6: 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) //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_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: 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) base.Update(); float deltaTime = BraveTime.DeltaTime; PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null || deltaTime == 0f) { ((MonoBehaviour)(object)((GunBehaviour)this).gun).LoopSoundIf(play: false, "vacpack_fire_sound"); return; } if (_hudHoldTimer > 0f) { if (!((OneAxisInputControl)playerOwner.m_activeActions.ReloadAction).IsPressed) { _hudHoldTimer = 0f; DoSlimeSelection((_curSlime == -1) ? _lastSlime : (-1)); } else if ((_hudHoldTimer -= deltaTime) <= 0f) { _hudHoldTimer = 0f; _hud.Engage(); SetFocus(focus: true); } } if (Object.op_Implicit((Object)(object)_hud) && _hud.Active && !((OneAxisInputControl)playerOwner.m_activeActions.ReloadAction).IsPressed) { DoSlimeSelection(); DismissHUD(); } bool flag = ((GunBehaviour)this).gun.IsCharging && ((GunBehaviour)this).gun.m_currentStrengthTier == 0; ((MonoBehaviour)(object)((GunBehaviour)this).gun).LoopSoundIf(flag, "vacpack_fire_sound", 3898, 2043); if (!flag) { foreach (SlimyboiController vacSlime in _vacSlimes) { if (Object.op_Implicit((Object)(object)vacSlime)) { vacSlime.HandleNoLongerVacuumedByVacpack(); } } _vacSlimes.Clear(); return; } Vector2 val = Vector2.op_Implicit(((GunBehaviour)this).gun.barrelOffset.position); bool flag2 = Random.value < 0.66f * (BraveTime.DeltaTime * 60f); if (flag2) { float self = ((GunBehaviour)this).gun.CurrentAngle + Random.Range(-15f, 15f); SpawnManager.SpawnVFX(_VacpackVFX, Vector2Extensions.ToVector3ZUp(val + self.ToVector(9f), 0f), Lazy.RandomEulerZ()).AddComponent().Setup(((GunBehaviour)this).gun, 9f); } float angle = (180f + ((GunBehaviour)this).gun.CurrentAngle).Clamp180(); foreach (AIActor allNearbyEnemy in val.GetAllNearbyEnemies(9f, ignoreWalls: false, includeDead: false, includeGone: false, includeInvulnerable: true, limitToCurrentRoom: false, includeHarmless: true)) { if (!Object.op_Implicit((Object)(object)allNearbyEnemy)) { continue; } SlimyboiController component = ((Component)allNearbyEnemy).gameObject.GetComponent(); if (component == null || (playerOwner.IsInCombat && !component.Attribute(SlimyboiFlags.CanAlwaysVac))) { continue; } Vector2 val2 = val - ((GameActor)allNearbyEnemy).CenterPosition; float sqrMagnitude = ((Vector2)(ref val2)).sqrMagnitude; if (!_vacSlimes.Contains(component)) { if (sqrMagnitude >= 81f || angle.AbsAngleTo(Vector2Extensions.ToAngle(val2)) > 15f) { continue; } component.HandleVacuumedByVacpack(); _vacSlimes.Add(component); } if (sqrMagnitude < 2.25f) { ProcessSlime(component); continue; } ((BraveBehaviour)allNearbyEnemy).behaviorSpeculator.Stun(0.1f, false); float num = Mathf.Max(0.1f, 1f - sqrMagnitude / 81f); allNearbyEnemy.ApplyContinuousSourcedKnockback(((Component)this).gameObject, _KnockbackDict, 100f * num * ((Vector2)(ref val2)).normalized, overwrite: true); if (flag2) { GameObject vacpackVFX = _VacpackVFX; Vector2 centerPosition = ((GameActor)allNearbyEnemy).CenterPosition; float? fadeOutTime = 0.5f; float? startScale = 1f; float? endScale = 0.1f; CwaffVFX.SpawnBurst(vacpackVFX, 1, centerPosition, 0.5f, null, 2f, 2f, CwaffVFX.Vel.Away, CwaffVFX.Rot.Random, 0.5f, fadeOutTime, 0f, null, fadeIn: false, uniform: false, startScale, endScale); } } } public bool IsVacuumingSlime(SlimyboiController sloim) { return _vacSlimes.Contains(sloim); } public void ProcessSlime(SlimyboiController sloim) { //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_0049: 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_0085: Unknown result type (might be due to invalid IL or missing references) ((Component)this).gameObject.PlayUnique("slime_vacuum_sound"); List list = slimeCounts; int slimeType = (int)sloim.slimeType; int value = list[slimeType] + 1; list[slimeType] = value; Gun currentGun = ((GameActor)((GunBehaviour)this).PlayerOwner).CurrentGun; Vector2 basePosition = ((currentGun != null) ? Vector2.op_Implicit(currentGun.barrelOffset.position) : ((GameActor)((BraveBehaviour)sloim).aiActor).CenterPosition); ((BraveBehaviour)sloim).aiActor.EraseFromExistence(true); GameObject gameObject = Slimybois.SlimeData[(int)sloim.slimeType].debris.gameObject; float? fadeOutTime = 0.1f; float? startScale = 1f; float? endScale = 0f; CwaffVFX.SpawnBurst(gameObject, 10, basePosition, 0f, null, 3f, 2f, CwaffVFX.Vel.Random, CwaffVFX.Rot.Random, 0.5f, fadeOutTime, 0f, null, fadeIn: false, uniform: false, startScale, endScale, null, randomFrame: false, -1, flipX: false, flipY: false, null, null, 1.55f, 0f, null, -1, 0f, 0f, unoccluded: false, copyShaders: true); } private void OnReceivedDamage(PlayerController player) { DismissHUD(); } private void DeregisterEvents(PlayerController player) { player.OnRoomClearEvent -= SlimyboiManager.OnCombatRoomClear; CustomActions.OnAnyPlayerCollectedKey = (Action)Delegate.Remove(CustomActions.OnAnyPlayerCollectedKey, new Action(SlimyboiManager.OnKeyCollected)); CustomActions.OnAnyPlayerCollectedBlank = (Action)Delegate.Remove(CustomActions.OnAnyPlayerCollectedBlank, new Action(SlimyboiManager.OnBlankCollected)); CustomActions.OnAnyHealthHaverDie = (Action)Delegate.Remove(CustomActions.OnAnyHealthHaverDie, new Action(SlimyboiManager.OnAnyHealthHaverDie)); CustomActions.OnAnyPlayerCollectedHealth = (Action)Delegate.Remove(CustomActions.OnAnyPlayerCollectedHealth, new Action(SlimyboiManager.OnAnyPlayerCollectedHealth)); CustomActions.OnMinorBreakableShattered = (Action)Delegate.Remove(CustomActions.OnMinorBreakableShattered, new Action(SlimyboiManager.OnMinorBreakableShattered)); CwaffEvents.OnWillPickUpCurrency = (Action)Delegate.Remove(CwaffEvents.OnWillPickUpCurrency, new Action(SlimyboiManager.OnWillPickUpCurrency)); CwaffEvents.OnWillPickUpAnyPassive = (Action)Delegate.Remove(CwaffEvents.OnWillPickUpAnyPassive, new Action(SlimyboiManager.OnWillPickUpAnyPassive)); } private void RegisterEvents(PlayerController player) { DeregisterEvents(player); player.OnRoomClearEvent += SlimyboiManager.OnCombatRoomClear; CustomActions.OnAnyPlayerCollectedKey = (Action)Delegate.Combine(CustomActions.OnAnyPlayerCollectedKey, new Action(SlimyboiManager.OnKeyCollected)); CustomActions.OnAnyPlayerCollectedBlank = (Action)Delegate.Combine(CustomActions.OnAnyPlayerCollectedBlank, new Action(SlimyboiManager.OnBlankCollected)); CustomActions.OnAnyHealthHaverDie = (Action)Delegate.Combine(CustomActions.OnAnyHealthHaverDie, new Action(SlimyboiManager.OnAnyHealthHaverDie)); CustomActions.OnAnyPlayerCollectedHealth = (Action)Delegate.Combine(CustomActions.OnAnyPlayerCollectedHealth, new Action(SlimyboiManager.OnAnyPlayerCollectedHealth)); CustomActions.OnMinorBreakableShattered = (Action)Delegate.Combine(CustomActions.OnMinorBreakableShattered, new Action(SlimyboiManager.OnMinorBreakableShattered)); CwaffEvents.OnWillPickUpCurrency = (Action)Delegate.Combine(CwaffEvents.OnWillPickUpCurrency, new Action(SlimyboiManager.OnWillPickUpCurrency)); CwaffEvents.OnWillPickUpAnyPassive = (Action)Delegate.Combine(CwaffEvents.OnWillPickUpAnyPassive, new Action(SlimyboiManager.OnWillPickUpAnyPassive)); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); SlimyboiManager.EnsureInstance(); RegisterEvents(player); } private void InfiniteSlimes() { int numSlimes = Slimybois.NumSlimes; for (int i = 0; i < numSlimes; i++) { slimeCounts[i] = 10000; } } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); SlimyboiManager.EnsureInstance(); CreateHUDIfNecessary(); } public override void OnSwitchedAwayFromThisGun() { DismissHUD(); base.OnSwitchedAwayFromThisGun(); } public override void OnDroppedByPlayer(PlayerController player) { DeregisterEvents(player); base.OnDroppedByPlayer(player); DismissHUD(); } public override void OnDestroy() { PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null) { DeregisterEvents(playerOwner); } DismissHUD(); SlimyboiManager.ForceDestroy(); base.OnDestroy(); } private void CreateHUDIfNecessary() { if (!Object.op_Implicit((Object)(object)_hud)) { _hud = ((Component)this).gameObject.AddComponent(); _hud.Setup(); } } private void DismissHUD() { if (Object.op_Implicit((Object)(object)_hud) && _hud.Active) { _hud.Dismiss(); } } internal void SetFocus(bool focus) { BraveTime.SetTimeScaleMultiplier(focus ? 0.1f : 1f, ((Component)this).gameObject); percentSpeedWhileHolding = (focus ? 0f : 1f); } } public class VacpackParticle : MonoBehaviour { private const float _MAX_LIFE = 1f; private const float _MIN_DIST_TO_VACUUM = 0.5f; private const float _MIN_VAC_DIST_SQR = 0.25f; private const float _MAX_ALPHA = 0.5f; private const float _DLT_ALPHA = 0.01f; private Vacpack _vac; private Gun _gun; private tk2dBaseSprite _sprite; private Vector2 _velocity = Vector2.zero; private float _lifetime; private float _startDistance; private float _startScaleX = 1f; private float _startScaleY = 1f; private Vector2 _spriteCenter = Vector2.zero; public void Setup(Gun gun, float startDistance = 0f) { //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) _gun = gun; _vac = ((Component)gun).gameObject.GetComponent(); _startDistance = startDistance; _sprite = (tk2dBaseSprite)(object)((Component)this).gameObject.GetComponent(); _startScaleX = 1f; _startScaleY = 1f; _spriteCenter = _sprite.WorldCenter; } private void LateUpdate() { //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_0088: 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_00d7: 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_00f8: 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_0103: 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_0124: 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_0134: 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_0143: 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_0154: 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) if (BraveTime.DeltaTime == 0f) { return; } _lifetime += BraveTime.DeltaTime; if (!Object.op_Implicit((Object)(object)_gun) || _lifetime > 1f) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } ((BraveBehaviour)_sprite).renderer.SetAlpha(0.5f * (1f - _lifetime / 1f)); Vector2 val = Vector3Extensions.XY(_gun.barrelOffset.position) - _sprite.WorldCenter; if (((Vector2)(ref val)).sqrMagnitude < 0.25f) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } float num = ((Vector2)(ref val)).magnitude / _startDistance; _sprite.scale = new Vector3(_startScaleX * num, _startScaleY * num, 1f); _velocity = _sprite.WorldCenter.LerpDirectAndNaturalVelocity(Vector2.op_Implicit(_gun.barrelOffset.position), _velocity, 1.8f * BraveTime.DeltaTime, 1f); _spriteCenter += _velocity * 60f * BraveTime.DeltaTime; _sprite.PlaceAtRotatedPositionByAnchor(Vector2.op_Implicit(_spriteCenter), (Anchor)4); } } public class VacpackHUD : MonoBehaviour { internal const string _NAME_LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; private static float _WedgeArc = 360f / (float)Slimybois.NumSlimes; private static float _SHWOOP_TIME = 0.3f; private static float _BASE_GEOM_ALPHA = 0.3f; private static readonly Color _GeomColor1 = new Color(0.25f, 0.25f, 0.25f); private static readonly Color _GeomColor2 = new Color(0.35f, 0.35f, 0.35f); private static bool _HideDescriptions = false; private bool _setup; private float _shwoop; private bool _active; private Vacpack _gun; private List _geometry = new List(); private Geometry _selector = new Geometry(); private List _labels = new List(); private dfLabel _nameLabel; private dfLabel _countLabel; private dfLabel _blurbLabel; private dfLabel _helpLabel; private string _longHelpText; private string _shortHelpText; private bool _cachedHideHelpText; private CameraController _camera; private Vector2 _worldBottomLeft; private Vector2 _worldTopRight; public bool Active => _active; public void Setup() { //IL_0018: 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_0091: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) _gun = ((Component)this).gameObject.GetComponent(); _selector = Geometry.Create(Geometry.Shape.RING).Place(Vector3Extensions.WithAlpha(Color.red, _BASE_GEOM_ALPHA)).UseGUILayer(); for (int i = 0; i < Slimybois.NumSlimes; i++) { _geometry.Add(Geometry.Create(Geometry.Shape.RING).Place(Vector3Extensions.WithAlpha((i % 2 == 0) ? _GeomColor1 : _GeomColor2, _BASE_GEOM_ALPHA)).UseGUILayer()); _labels.Add(EasyLabel.Create(unicode: false, outline: true, (TextAlignment)1)); _labels[i].Text = "[sprite \"slime_" + Slimybois.SlimeData[i].slimeName + "_ui\"]"; ((dfControl)_labels[i]).Pivot = (dfPivotPoint)4; } _nameLabel = EasyLabel.Create(unicode: false, outline: true, (TextAlignment)1); _countLabel = EasyLabel.Create(unicode: false, outline: true, (TextAlignment)1); _helpLabel = EasyLabel.Create(unicode: false, outline: true, (TextAlignment)2); _helpLabel.VerticalAlignment = (dfVerticalAlignment)0; ((dfControl)_helpLabel).Pivot = (dfPivotPoint)2; _longHelpText = "Press [color #dd6666]" + StringTableManager.EvaluateReplacementToken("%CONTROL_INTERACT") + "[/color] to Hide Descriptions"; _shortHelpText = "Press [color #dd6666]" + StringTableManager.EvaluateReplacementToken("%CONTROL_INTERACT") + "[/color]"; _helpLabel.Text = (_HideDescriptions ? _shortHelpText : _longHelpText); _cachedHideHelpText = _HideDescriptions; ((dfControl)_helpLabel).IsVisible = false; _blurbLabel = EasyLabel.Create(unicode: false, outline: true, (TextAlignment)2); _blurbLabel.AutoHeight = true; _blurbLabel.WordWrap = true; _blurbLabel.VerticalAlignment = (dfVerticalAlignment)0; ((dfControl)_blurbLabel).Pivot = (dfPivotPoint)2; ((dfControl)_blurbLabel).Size = new Vector2(320f, 48f); Dismiss(force: true); _setup = true; _camera = GameManager.Instance.MainCameraController; if (Object.op_Implicit((Object)(object)_camera)) { CameraController camera = _camera; camera.OnFinishedFrame = (Action)Delegate.Remove(camera.OnFinishedFrame, new Action(OnFinishedFrame)); CameraController camera2 = _camera; camera2.OnFinishedFrame = (Action)Delegate.Combine(camera2.OnFinishedFrame, new Action(OnFinishedFrame)); } } public void Toggle() { if (_active) { Dismiss(); } else { Engage(); } } public void Engage() { //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) if (!_active) { _active = true; _shwoop = 0f; if (((Component)this).gameObject.RequestCameraControl()) { GameManager.Instance.MainCameraController.OverridePosition = Vector2.op_Implicit(((GameActor)((GunBehaviour)_gun).PlayerOwner).CenterPosition); } if (!_HideDescriptions) { Minimap.Instance.TemporarilyPreventMinimap = true; } ((Component)this).gameObject.Play("vacpack_menu_sound"); } } public void Dismiss(bool force = false, bool deactivate = true) { if (!_active && !force) { return; } foreach (Geometry item in _geometry) { if (Object.op_Implicit((Object)(object)item)) { item.Disable(); } } if (Object.op_Implicit((Object)(object)_selector)) { _selector.Disable(); } foreach (dfLabel label in _labels) { if (!((Object)(object)label == (Object)null)) { ((dfControl)label).Opacity = 0f; ((dfControl)label).IsVisible = false; } } if (Object.op_Implicit((Object)(object)_nameLabel)) { ((dfControl)_nameLabel).Opacity = 0f; ((dfControl)_nameLabel).IsVisible = false; } if (Object.op_Implicit((Object)(object)_countLabel)) { ((dfControl)_countLabel).Opacity = 0f; ((dfControl)_countLabel).IsVisible = false; } if (Object.op_Implicit((Object)(object)_blurbLabel)) { ((dfControl)_blurbLabel).Opacity = 0f; ((dfControl)_blurbLabel).IsVisible = false; } if (Object.op_Implicit((Object)(object)_helpLabel)) { ((dfControl)_helpLabel).Opacity = 0f; ((dfControl)_helpLabel).IsVisible = false; } if (deactivate) { _active = false; Minimap.Instance.TemporarilyPreventMinimap = false; ((Component)this).gameObject.RelinquishCameraControl(); if (Object.op_Implicit((Object)(object)_gun)) { _gun.SetFocus(focus: false); } } } private void LateUpdate() { //IL_0066: 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_00e6: Unknown result type (might be due to invalid IL or missing references) if (!_setup) { return; } if (Object.op_Implicit((Object)(object)_camera) && Object.op_Implicit((Object)(object)_gun)) { Gun gun = ((GunBehaviour)_gun).gun; if (gun != null) { PlayerController playerOwner = ((GunBehaviour)_gun).PlayerOwner; if (playerOwner != null) { if (GameManager.Instance.IsPaused) { Dismiss(force: false, deactivate: false); } else if ((int)playerOwner.CurrentInputState != 0 || gun.IsReloading || GameManager.IsBossIntro) { Dismiss(); } else if (_active) { if (((OneAxisInputControl)playerOwner.m_activeActions.InteractAction).WasPressed) { _HideDescriptions = !_HideDescriptions; } ((Component)this).gameObject.RequestCameraControl(); if (((Component)this).gameObject.HasControlOverCamera()) { GameManager.Instance.MainCameraController.OverridePosition = Vector2.op_Implicit(((GameActor)((GunBehaviour)_gun).PlayerOwner).CenterPosition); } } return; } } } Dismiss(); Object.Destroy((Object)(object)this); } private void OnFinishedFrame() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (_setup && _active && Object.op_Implicit((Object)(object)_camera) && !GameManager.Instance.IsPaused && Object.op_Implicit((Object)(object)_gun) && Object.op_Implicit((Object)(object)((GunBehaviour)_gun).PlayerOwner) && (int)((GunBehaviour)_gun).PlayerOwner.CurrentInputState == 0) { Engage(); if (_active) { PlaceHUDElements(); } } } internal static int SlimeIndexForAngle(float angle) { return Mathf.FloorToInt((angle.Clamp360() + 0.5f * _WedgeArc) / _WedgeArc) % Slimybois.NumSlimes; } private void PlaceHUDElements() { //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_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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: 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_01de: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_018e: 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_0255: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Invalid comparison between Unknown and I4 //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_0340: 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_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) PlayerController playerOwner = ((GunBehaviour)_gun).PlayerOwner; if (!Object.op_Implicit((Object)(object)playerOwner) || (Object)(object)((GameActor)playerOwner).CurrentGun != (Object)(object)((GunBehaviour)_gun).gun) { Dismiss(); return; } int num = SlimeIndexForAngle(playerOwner.AimAngleFromCenterOfScreen().Clamp360()); _shwoop = Mathf.Clamp01(_shwoop + Time.unscaledDeltaTime / _SHWOOP_TIME); float num2 = Ease.OutQuad(_shwoop); _worldBottomLeft = _camera.MinVisiblePoint; _worldTopRight = _camera.MaxVisiblePoint; Vector2 val = 0.5f * (_worldBottomLeft + _worldTopRight); float num3 = _camera.MaxVisiblePoint.y - _camera.MinVisiblePoint.y; float num4 = num2 * num3; float num5 = _BASE_GEOM_ALPHA * num2; float num6 = 0.3f * num3; float num7 = num6 + 0.1f * num4; float magnitude = 0.5f * (num6 + num7); _selector.Disable(); for (int i = 0; i < Slimybois.NumSlimes; i++) { bool flag = i == num; DeathNoteNameHandler.IsGoodLetter("ABCDEFGHIJKLMNOPQRSTUVWXYZ"[i]); Geometry geometry = _geometry[i]; Vector2? pos = val; float? angle = _WedgeArc * (float)i; float? arc = _WedgeArc; float? radiusInner = num6; float? radius = num7 * (flag ? 1.125f : 1f); geometry.Place(Vector3Extensions.WithAlpha(flag ? Color.white : ((i % 2 == 0) ? _GeomColor1 : _GeomColor2), num5), pos, null, radius, angle, arc, radiusInner); Vector2 pos2 = val + (_WedgeArc * (float)i).ToVector(magnitude); if (flag) { _nameLabel.Text = Slimybois.SlimeData[i].fullName; ((dfControl)_nameLabel).Opacity = num2; _nameLabel.Place(val); _countLabel.Text = _gun.slimeCounts[i].ToString(); ((dfControl)_countLabel).Opacity = num2; _countLabel.Place(val + new Vector2(0f, (0f - ((dfControl)_countLabel).Height) / 32f)); if ((int)GameManager.Instance.CurrentGameType != 1) { if (_cachedHideHelpText != _HideDescriptions) { _helpLabel.Text = (_HideDescriptions ? _shortHelpText : _longHelpText); Minimap.Instance.TemporarilyPreventMinimap = !_HideDescriptions; _cachedHideHelpText = _HideDescriptions; } ((dfControl)_helpLabel).Opacity = num2; _helpLabel.Place(_worldTopRight + new Vector2(-1f, -1f)); if (!_HideDescriptions) { _blurbLabel.Text = Slimybois.SlimeBlurbs[i]; ((dfControl)_blurbLabel).Opacity = num2; _blurbLabel.Place(_worldTopRight + new Vector2(-1f, -2f)); } else { ((dfControl)_blurbLabel).Opacity = 0f; } } else { ((dfControl)_helpLabel).IsVisible = false; } } ((dfControl)_labels[i]).Color = Color32.op_Implicit((_gun.slimeCounts[i] == 0) ? Color.black : Color.white); _labels[i].OutlineColor = Color32.op_Implicit(Vector3Extensions.WithAlpha(flag ? Color.white : Color.black, Mathf.Clamp01(2f * num2 - 1f))); ((dfControl)_labels[i]).Opacity = num2; _labels[i].Place(pos2); } } } public class Outbreak : CwaffGun { public static string ItemName = "Outbreak"; public static string ShortDescription = "Going Viral"; public static string LongDescription = "Fires a parasitic projectile that infects enemies on contact. All infected enemies fire additional parasitic projectiles towards the player's target whenever this gun is fired."; public static string Lore = "For years, Gungineers have tried to develop synthetic self-replicating projectiles in the lab, with the closest they've gotten being the discovery that glass beakers shatter when you throw them against the wall. As a last ditch effort after research funding inevitably ran dry, one Gungineer decided to stuff live parasites of unknown origin into a casing and fire it at a target dummy. To everyone's surprise, a new projectile emerged right back from the puncture area. After a few generations of design tweaks and genetic mutations, the Outbreak emerged in its current form."; internal static GameObject _OutbreakSmokeVFX = null; internal static GameObject _OutbreakSmokeLargeVFX = null; internal static Projectile _InfectionProjectile = null; internal readonly bool _INFECT_TOWARDS_CURSOR = true; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 24; int? reloadFps = 20; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)1, 1.2f, 300, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "outbreak_shoot_sound", "outbreak_reload_sound", null, -1, -1, -1, null, modulesAreTiers: false, "muzzle_outbreak", 40, 0.3f, (Anchor)4, -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).AddToShop((ShopType)2); int? clipSize = 10; float? cooldown = 0.2f; float? damage = 8f; float? speed = 17f; float? range = 100f; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "outbreak_projectile", 12, (Anchor)3)).Attach().Assign(out _InfectionProjectile); _OutbreakSmokeVFX = VFX.Create("outbreak_smoke_small", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _OutbreakSmokeLargeVFX = VFX.Create("outbreak_smoke_large", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } public override void OnPostFired(PlayerController player, Gun gun) { //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_0042: 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_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_00b1: 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_0088: 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_00a2: Unknown result type (might be due to invalid IL or missing references) ((GunBehaviour)this).OnPostFired(player, gun); if (player.CurrentRoom == null || ((Component)gun).GetComponent() == null) { return; } bool flag = false; Vector2 val = Vector2.zero; if (_INFECT_TOWARDS_CURSOR) { val = ((GameActor)player).CenterPosition.ToNearestWallOrEnemyOrObject(player.m_currentGunAngle); } foreach (AIActor allNearbyEnemy in ((GameActor)player).CenterPosition.GetAllNearbyEnemies(100f, ignoreWalls: true, includeDead: false, includeGone: false, includeInvulnerable: true)) { if (((Component)allNearbyEnemy).GetComponent() == null) { continue; } flag = true; float num = player.m_currentGunAngle; if (_INFECT_TOWARDS_CURSOR) { Vector2 val2 = val - ((GameActor)allNearbyEnemy).CenterPosition; if (((Vector2)(ref val2)).sqrMagnitude > 1f) { num = Vector2Extensions.ToAngle(val2); } } Projectile val3 = VolleyUtility.ShootSingleProjectile(_InfectionProjectile, ((GameActor)allNearbyEnemy).CenterPosition, num, false, (GameActor)(object)player); if (base.Mastered) { GameObjectExtensions.GetOrAddComponent(((Component)val3).gameObject); } val3.SetOwnerAndStats((GameActor)(object)player); player.DoPostProcessProjectile(val3); ((BraveBehaviour)val3).specRigidbody.RegisterSpecificCollisionException(((BraveBehaviour)allNearbyEnemy).specRigidbody); } if (flag) { ((Component)player).gameObject.Play("outbreak_spread_sound"); } } } public class InfectionBehavior : MonoBehaviour { private Projectile _projectile; private void Start() { _projectile = ((Component)this).GetComponent(); Projectile projectile = _projectile; projectile.OnHitEnemy = (Action)Delegate.Combine(projectile.OnHitEnemy, new Action(OnHitEnemy)); GameActor owner = _projectile.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null && val.HasSynergy(Synergy.MASTERY_OUTBREAK)) { GameObjectExtensions.GetOrAddComponent(((Component)_projectile).gameObject); } } private void OnHitEnemy(Projectile proj, SpeculativeRigidbody enemy, bool killed) { if (Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).aiActor) && ((BraveBehaviour)enemy).aiActor.IsHostileAndNotABoss()) { GameObjectExtensions.GetOrAddComponent(((Component)((BraveBehaviour)enemy).aiActor).gameObject); } } private void Update() { //IL_0018: 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_0036: Unknown result type (might be due to invalid IL or missing references) if (!(Random.value > 0.3f)) { CwaffVFX.Spawn(Outbreak._OutbreakSmokeVFX, Vector2Extensions.ToVector3ZisY(_projectile.SafeCenter, -1f), Lazy.RandomEulerZ(), Lazy.RandomVector(0.1f), 0.3f, 0.6f); } } } public class InfectedBehavior : MonoBehaviour { private AIActor _enemy; private void Start() { _enemy = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)_enemy) && Object.op_Implicit((Object)(object)((BraveBehaviour)_enemy).healthHaver) && !(((BraveBehaviour)_enemy).healthHaver.currentHealth <= 0f)) { ((Component)_enemy).gameObject.Play("outbreak_infect_sound"); } } private void Update() { //IL_001d: 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_002c: 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 (!(Random.value > 0.02f)) { CwaffVFX.Spawn(Outbreak._OutbreakSmokeVFX, Vector2Extensions.ToVector3ZisY(((BraveBehaviour)_enemy).sprite.WorldTopCenter, -1f), Lazy.RandomEulerZ(), Lazy.RandomVector(0.5f), 0.3f, 0.6f); } } } public class OutbreakHomingModifier : BraveBehaviour { public float HomingRadius = 10f; public float AngularVelocity = 1080f; public AIActor originEnemy; protected Projectile m_projectile; private void Start() { if (!Object.op_Implicit((Object)(object)m_projectile)) { m_projectile = ((Component)this).GetComponent(); } Projectile projectile = m_projectile; projectile.ModifyVelocity = (Func)Delegate.Combine(projectile.ModifyVelocity, new Func(ModifyVelocity)); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)m_projectile)) { Projectile projectile = m_projectile; projectile.ModifyVelocity = (Func)Delegate.Remove(projectile.ModifyVelocity, new Func(ModifyVelocity)); } ((BraveBehaviour)this).OnDestroy(); } private Vector2 ModifyVelocity(Vector2 inVel) { //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_0017: 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_0039: 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_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_0065: 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_0110: 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_00f9: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_01b3: 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_01b9: 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_01a0: 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_00d7: 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_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) Vector2 val = inVel; List activeEnemies = GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(Vector3Extensions.IntXY(m_projectile.LastPosition, (VectorConversions)0)).GetActiveEnemies((ActiveEnemyType)0); if (activeEnemies == null || activeEnemies.Count == 0) { return inVel; } float num = HomingRadius * HomingRadius; Vector2 val2 = Vector2.zero; AIActor val3 = null; Vector2 val4 = ((!Object.op_Implicit((Object)(object)((BraveBehaviour)this).sprite)) ? Vector3Extensions.XY(((BraveBehaviour)this).transform.position) : ((BraveBehaviour)this).sprite.WorldCenter); for (int i = 0; i < activeEnemies.Count; i++) { AIActor val5 = activeEnemies[i]; if (Object.op_Implicit((Object)(object)val5) && val5.IsWorthShootingAt && !((GameActor)val5).IsGone && !((Object)(object)val5 == (Object)(object)originEnemy)) { Vector2 val6 = ((GameActor)val5).CenterPosition - val4; float sqrMagnitude = ((Vector2)(ref val6)).sqrMagnitude; if (!(sqrMagnitude > num)) { val2 = val6; num = sqrMagnitude; val3 = val5; } } } if ((Object)(object)val3 == (Object)null) { return inVel; } float num2 = 1f - Mathf.Sqrt(num) / HomingRadius; float num3 = Vector2Extensions.ToAngle(inVel); float num4 = AngularVelocity * num2 * m_projectile.LocalDeltaTime; float num5 = Mathf.MoveTowardsAngle(num3, Vector2Extensions.ToAngle(val2), num4); if (m_projectile.OverrideMotionModule != null) { m_projectile.OverrideMotionModule.AdjustRightVector(num5 - num3); } Projectile projectile = m_projectile; HelixProjectile val7 = (HelixProjectile)(object)((projectile is HelixProjectile) ? projectile : null); if (val7 != null) { val7.AdjustRightVector(num5 - num3); return inVel; } if (m_projectile.shouldRotate) { ((BraveBehaviour)this).transform.rotation = Quaternion.Euler(0f, 0f, num5); } val = BraveMathCollege.DegreesToVector(num5, ((Vector2)(ref inVel)).magnitude); if (val == Vector2.zero || float.IsNaN(val.x) || float.IsNaN(val.y)) { return inVel; } return val; } } public class Empath : CwaffGun { public static string ItemName = "Empath"; public static string ShortDescription = "More than a Feeling"; public static string LongDescription = "Fires eyeballs that pass through enemies but collide with their projectiles, destroying them and damaging their owners in the process."; public static string Lore = "Within the confines of the Gungeon, a small part of one's spirit is attached to each and every shot fired -- a link enabling the Gungeon's various treasures to impart their properties upon one's projectiles. By amplifying that attachment by several orders of magnitude, it's possible to inflict damage upon a projectile's owner simply by destroying the projectile. Whether treating a projectile to a day at the spa has positive effects on the owner has not yet been tested."; internal static GameObject _PsychicVFX = null; private bool _setupAnimator; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 14; int? reloadFps = 1; Gun gun2 = gun.SetAttributes((ItemQuality)2, (GunClass)1, 2.1f, 480, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "empath_fire_sound", null, null, -1, -1, -1, null, modulesAreTiers: false, "muzzle_empath", 30, 1f, (Anchor)4, -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, 0f).SetReloadAudio("empath_reload_sound_2", 7); int? clipSize = 15; float? cooldown = 0.13f; float? damage = 3.75f; float? speed = 18f; float? range = 999f; float? force = 12f; bool? collidesWithProjectiles = true; ((Projectile)(object)gun2.InitSpecialProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, collidesWithProjectiles, null, null, "empath_projectile", 11, (Anchor)4, 2f, anchorsChangeColliders: true, fixesScales: true, null, null, 0.6f))).SetAllImpactVFX(VFX.CreatePool("empath_impact_vfx", 30f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1)); _PsychicVFX = VFX.Create("empath_psychic_damage_vfx", 30f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } public override void Update() { base.Update(); if (!_setupAnimator) { tk2dSpriteAnimator component = ((Component)this).gameObject.GetComponent(); component.AnimationEventTriggered = (Action)Delegate.Combine(component.AnimationEventTriggered, new Action(AnimationEventTriggered)); _setupAnimator = true; } } private void AnimationEventTriggered(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frame) { //IL_002c: 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_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_0050: 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_005f: Unknown result type (might be due to invalid IL or missing references) if (frame == 7 && clip.name == "empath_reload") { GameObject psychicVFX = _PsychicVFX; Vector3 position = Vector2.op_Implicit(((BraveBehaviour)((GunBehaviour)this).gun).sprite.WorldCenter + Vector3Extensions.XY(((BraveBehaviour)this).transform.rotation * Vector2.op_Implicit(new Vector2(-0.375f, -0.125f)))); float? startScale = 0.5f; float? endScale = 3f; float? fadeOutTime = 0.4f; Transform transform = ((BraveBehaviour)this).transform; CwaffVFX.Spawn(psychicVFX, position, null, null, 0.5f, fadeOutTime, 0f, null, fadeIn: false, startScale, endScale, null, randomFrame: false, -1, flipX: false, flipY: false, transform); } } } public class EmpathProjectile : Projectile { private const float _EMPATHY_DAMAGE_MULT = 4f; private const int _MAX_BULLETS_DESTROYED = 5; private bool _mastered; private static readonly List _ProjectilesToDestroy = new List(); public override void Start() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //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_0061: Expected O, but got Unknown ((Projectile)this).Start(); _mastered = ((Projectile)(object)this).Mastered(); SpeculativeRigidbody specRigidbody = ((BraveBehaviour)this).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(EmpathProjPreCollision)); SpeculativeRigidbody specRigidbody2 = ((BraveBehaviour)this).specRigidbody; specRigidbody2.OnRigidbodyCollision = (OnRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody2.OnRigidbodyCollision, (Delegate?)new OnRigidbodyCollisionDelegate(EmpathProjCollision)); } private void EmpathProjPreCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { if (!Object.op_Implicit((Object)(object)otherRigidbody)) { PhysicsEngine.SkipCollision = true; } else { Projectile component = ((Component)otherRigidbody).gameObject.GetComponent(); if (component != null && ((Behaviour)component).isActiveAndEnabled) { if (component.m_owner is PlayerController) { PhysicsEngine.SkipCollision = true; } return; } if (_mastered && Object.op_Implicit((Object)(object)((Component)otherRigidbody).gameObject.GetComponent())) { return; } } PhysicsEngine.SkipCollision = true; } private void EmpathProjCollision(CollisionData collision) { //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_00ce: 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_0164: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)collision.OtherRigidbody)) { return; } GameObject gameObject = ((Component)collision.OtherRigidbody).gameObject; if (gameObject == null) { return; } if (_mastered) { AIActor component = gameObject.GetComponent(); if (component != null) { HandleEnemyCollision(component); return; } } Projectile component2 = gameObject.GetComponent(); if (component2 != null) { Projectile component3 = ((Component)collision.MyRigidbody).gameObject.GetComponent(); GameActor owner = component2.Owner; AIActor val = (AIActor)(object)((owner is AIActor) ? owner : null); if (val == null || !Object.op_Implicit((Object)(object)((BraveBehaviour)val).specRigidbody) || !Object.op_Implicit((Object)(object)((BraveBehaviour)val).healthHaver) || !((BraveBehaviour)val).healthHaver.IsAlive) { component3.DieInAir(false, true, true, false); component2.DieInAir(false, true, true, false); return; } Vector2 unitCenter = ((BraveBehaviour)val).specRigidbody.UnitCenter; ((Component)val).gameObject.Play("empath_collide_sound"); CwaffVFX.SpawnBurst(Empath._PsychicVFX, 4, unitCenter, 1f, null, 2f, 0f, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.None, 0.4f, null, 0f, null, fadeIn: false, uniform: true); component3.HandleHitEffectsMidair(false); ((BraveBehaviour)component3).specRigidbody.Position = new Position(unitCenter); ((BraveBehaviour)component3).specRigidbody.UpdateColliderPositions(); LinearCastResult val2 = LinearCastResult.Pool.Allocate(); ProjectileData baseData = component3.baseData; baseData.damage *= 4f; component3.ForceCollision(((BraveBehaviour)val).specRigidbody, val2); LinearCastResult.Pool.Free(ref val2); component2.DieInAir(false, true, true, false); } } private void HandleEnemyCollision(AIActor enemy) { //IL_00d4: 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).healthHaver) || !((BraveBehaviour)enemy).healthHaver.IsAlive) { return; } for (int num = StaticReferenceManager.AllProjectiles.Count - 1; num >= 0; num--) { Projectile val = StaticReferenceManager.AllProjectiles[num]; if (Object.op_Implicit((Object)(object)val) && ((Behaviour)val).isActiveAndEnabled && !val.HasDiedInAir && (Object)(object)val.Owner == (Object)(object)enemy && Object.op_Implicit((Object)(object)((BraveBehaviour)val).sprite)) { _ProjectilesToDestroy.Add(val); } } int num2 = 5; if (num2 > _ProjectilesToDestroy.Count) { num2 = _ProjectilesToDestroy.Count; } else if (num2 < _ProjectilesToDestroy.Count) { _ProjectilesToDestroy.Shuffle(); } for (int i = 0; i < num2; i++) { Projectile obj = _ProjectilesToDestroy[i]; tk2dBaseSprite obj2 = ((BraveBehaviour)obj).sprite.DuplicateInWorld(); ((MonoBehaviour)obj2).StartCoroutine(SchrodingersStat.PhaseOut(obj2, Vector2.right, 25f, 90f, 1f)); obj.DieInAir(false, true, true, false); } if (num2 > 0) { ((Component)enemy).gameObject.Play("schrodinger_dead_sound"); } _ProjectilesToDestroy.Clear(); } } public class SeltzerPelter : CwaffGun { public static string ItemName = "Seltzer Pelter"; public static string ShortDescription = "Shaken, not Stirred"; public static string LongDescription = "Launches soda cans that fly around wildly after initial impact, pushing enemies away with highly pressurized streams of seltzer water."; public static string Lore = "The best designs are inspired by nature, but those inspired by fraternities come in at a close second. This weapon was first conceptualized when a frat bro stuffed a beer can in a spud launcher and fired it at the ceiling. Although the can burst immediately and ruined the launcher, another frat bro desperate for a cool term project to bring his engineering class grade up to a D- ran with the idea. After investing in sturdier titanium-alloy cans and substituting the beer for soda, the remodeled launcher created as big a mess as ever, but by virtue of externalizing that mess, was considered a resounding success. The frat bro got a D+ in his class, and an actually competent engineer bought the rights to the design and tweaked it to be a bit more marketable and combat-viable, resulting in win-wins all around."; internal static Projectile _BubbleBeam; internal static List _ReloadAnimations; private int _loadedCanIndex; public static void Init() { //IL_0152: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 36; Items? muzzleFrom = Items.Mailbox; Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)15, 1f, 150, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, null, 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).AddToShop((ShopType)0).AssignGun(out gunRef); int? clipSize = 1; float? cooldown = 0.5f; bool? preventOrbiting = true; float? damage = 16f; float? speed = 30f; float? force = 45f; float? range = 999f; IntVector2? overrideColliderPixelSizes = new IntVector2(2, 2); bool? becomeDebris = true; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "can_projectile", 1, (Anchor)4, 1f, anchorsChangeColliders: false, fixesScales: true, overrideColliderPixelSizes, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, preventOrbiting, null, null, null, becomeDebris)).Attach((Action)delegate(BounceProjModifier bounce) { bounce.numberOfBounces = 9999; bounce.chanceToDieOnBounce = 0f; bounce.onlyBounceOffTiles = false; bounce.ExplodeOnEnemyBounce = false; bounce.bouncesTrackEnemies = true; bounce.bounceTrackRadius = 3f; }, allowDuplicates: false).Attach(); _ReloadAnimations = new List { gunRef.QuickUpdateGunAnimation("reload", null, returnToIdle: true, 52), gunRef.QuickUpdateGunAnimation("reload_b", null, returnToIdle: true, 52), gunRef.QuickUpdateGunAnimation("reload_c", null, returnToIdle: true, 52) }; foreach (string reloadAnimation in _ReloadAnimations) { gunRef.SetGunAudio(reloadAnimation, "seltzer_shake_sound", 0, 10, 22, 29, 35); gunRef.SetGunAudio(reloadAnimation, "seltzer_insert_sound", 42); } range = 40f; force = 20f; speed = 25f; damage = 4f; becomeDebris = true; preventOrbiting = true; bool? beamSeparation = true; bool? beamIsRigid = false; bool? beamInterpolate = false; BeamTileType? beamTiling = (BeamTileType)2; BeamEndType? beamEndType = (BeamEndType)1; _BubbleBeam = Items.MarineSidearm.CloneProjectile(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, range, force, speed, damage, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, becomeDebris, null, null, null, null, 0f, ignoredForReloadPurposes: false, mirror: false, null, null, null, null, null, null, preventOrbiting, "bubble_stream", 8, -1, -1, -1, -1, -1, beamLoopCharge: true, 5f, -1, 0f, -1f, null, beamInterpolate, -1, null, null, beamIsRigid, 100f, beamTiling, beamEndType, beamSeparation)).Attach((Action)delegate(GoopModifier gmod) { gmod.SpawnAtBeamEnd = true; gmod.BeamEndRadius = 0.5f; gmod.SpawnGoopInFlight = true; gmod.InFlightSpawnRadius = 0.5f; gmod.InFlightSpawnFrequency = 0.01f; gmod.goopDefinition = EasyGoopDefinitions.SeltzerGoop; }, allowDuplicates: false); } public override void PostProcessProjectile(Projectile projectile) { ((GunBehaviour)this).PostProcessProjectile(projectile); ((BraveBehaviour)projectile).spriteAnimator.PlayFromFrame(_loadedCanIndex); _loadedCanIndex = Random.Range(0, _ReloadAnimations.Count); ((GunBehaviour)this).gun.reloadAnimation = _ReloadAnimations[_loadedCanIndex]; } } public class SeltzerProjectile : MonoBehaviour { private Projectile _canProjectile; private PlayerController _owner; private BounceProjModifier _bounce; private BasicBeamController _beam; private float _rotationRate; private bool _startedSpraying; private bool _mastered; private const float SPRAY_TIME = 2f; private const float SPIN_TIME = 4f; private const float ACCEL = 40f; private const float _AIR_DRAG = 0.25f; private const float _SOUND_RATE = 0.2f; private void Start() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown _canProjectile = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = _canProjectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); _mastered = _canProjectile.Mastered(); _canProjectile.BulletScriptSettings.surviveRigidbodyCollisions = true; _canProjectile.shouldRotate = false; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_canProjectile).specRigidbody; specRigidbody.OnRigidbodyCollision = (OnRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnRigidbodyCollision, (Delegate?)new OnRigidbodyCollisionDelegate(OnRigidbodyCollision)); _bounce = ((Component)_canProjectile).gameObject.GetComponent(); _bounce.OnBounce += StartSprayingSoda; ((BraveBehaviour)_canProjectile).spriteAnimator.Stop(); ((Component)this).gameObject.Play("seltzer_shoot_sound_alt_2"); } private void OnRigidbodyCollision(CollisionData rigidbodyCollision) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)this) || !Object.op_Implicit((Object)(object)_canProjectile)) { return; } _canProjectile.SendInDirection(((CastResult)rigidbodyCollision).Normal, false, true); if (_mastered) { AIActor component = ((Component)rigidbodyCollision.OtherRigidbody).gameObject.GetComponent(); if (component != null) { ((GameActor)component).ApplyEffect((GameActorEffect)(object)EasyGoopDefinitions.SuperSeltzerGoop.SpeedModifierEffect, 1f, (Projectile)null); } } if (!_startedSpraying) { StartSprayingSoda(); return; } ((Component)this).gameObject.Play("seltzer_pelter_collide_sound"); _canProjectile.MultiplySpeed(0.5f); } private void StartSprayingSoda() { _startedSpraying = true; _bounce.OnBounce -= StartSprayingSoda; _bounce.OnBounce += RestartBeamOnBounce; _canProjectile.m_usesNormalMoveRegardless = true; _canProjectile.MultiplySpeed(0.5f); _canProjectile.OnDestruction += DestroyBeam; ((MonoBehaviour)_canProjectile).StartCoroutine(SpraySoda_CR(this, _canProjectile)); ((Component)this).gameObject.Play("seltzer_shoot_sound"); ((Component)this).gameObject.Play("seltzer_pelter_collide_sound"); } private void CreateBeam() { //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_001a: 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_0099: 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) GameObject val = SpawnManager.SpawnProjectile(((Component)SeltzerPelter._BubbleBeam).gameObject, Vector2.op_Implicit(_canProjectile.SafeCenter), Quaternion.identity, true); val.GetComponent().SetOwnerAndStats((GameActor)(object)_owner); _beam = val.GetComponent(); ((BeamController)_beam).Owner = (GameActor)(object)_owner; ((BeamController)_beam).HitsPlayers = false; ((BeamController)_beam).HitsEnemies = true; ((BeamController)_beam).Origin = _canProjectile.SafeCenter; ((BeamController)_beam).Direction = -((BraveBehaviour)((BraveBehaviour)_canProjectile).sprite).transform.rotation.z.ToVector(); _owner.DoPostProcessBeamSafe((BeamController)(object)_beam); if (_mastered) { val.GetComponent().goopDefinition = EasyGoopDefinitions.SuperSeltzerGoop; } } private void RestartBeamOnBounce() { if (Object.op_Implicit((Object)(object)_canProjectile)) { ProjectileData baseData = _canProjectile.baseData; baseData.speed *= 0.5f; } if (Object.op_Implicit((Object)(object)_beam)) { ((BeamController)_beam).CeaseAttack(); } _beam = null; ((Component)this).gameObject.Play("seltzer_pelter_collide_sound"); } private void UpdateRotationRate() { _rotationRate = Random.Range(-5f, 5f); } private void DestroyBeam(Projectile p) { if (Object.op_Implicit((Object)(object)_beam)) { ((BeamController)_beam).CeaseAttack(); } } private static IEnumerator SpraySoda_CR(SeltzerProjectile seltzer, Projectile p) { yield return null; if (!Object.op_Implicit((Object)(object)p) || !Object.op_Implicit((Object)(object)seltzer)) { yield break; } float num = Vector2Extensions.ToAngle(p.LastVelocity); float curAngle = num; seltzer.UpdateRotationRate(); ((Component)p).gameObject.Play("seltzer_spray_sound"); int maxSounds = 20; for (float elapsed = 0f; elapsed < 2f; elapsed += BraveTime.DeltaTime) { while (BraveTime.DeltaTime == 0f) { yield return null; } if (!Object.op_Implicit((Object)(object)p) || !((Behaviour)p).isActiveAndEnabled || p.HasDiedInAir || !Object.op_Implicit((Object)(object)seltzer)) { yield break; } if (!Object.op_Implicit((Object)(object)seltzer._beam)) { seltzer.CreateBeam(); } if (maxSounds > 0 && ((Component)p).gameObject.Play("seltzer_spray_sound", 0.2f)) { int num2 = maxSounds - 1; maxSounds = num2; } Vector2 lastVelocity = p.LastVelocity; curAngle += seltzer._rotationRate; Vector2 val = lastVelocity + curAngle.ToVector(40f * BraveTime.DeltaTime); p.SetSpeed(((Vector2)(ref val)).magnitude); p.SendInDirection(val, false, false); p.SetRotation(Vector2Extensions.ToAngle(val)); ((BeamController)seltzer._beam).Origin = p.SafeCenter; ((BeamController)seltzer._beam).Direction = -p.LastVelocity; ((BeamController)seltzer._beam).LateUpdatePosition(Vector2.op_Implicit(((BeamController)seltzer._beam).Origin)); yield return null; } if (!Object.op_Implicit((Object)(object)p)) { yield break; } curAngle = Vector2Extensions.ToAngle(p.LastVelocity); float rotIncrease = 5f * Mathf.Sign(seltzer._rotationRate); for (float elapsed = 0f; elapsed < 4f; elapsed += BraveTime.DeltaTime) { while (BraveTime.DeltaTime == 0f) { yield return null; } if (!Object.op_Implicit((Object)(object)p) || !((Behaviour)p).isActiveAndEnabled || p.HasDiedInAir || !Object.op_Implicit((Object)(object)seltzer)) { yield break; } if (!Object.op_Implicit((Object)(object)seltzer._beam)) { seltzer.CreateBeam(); } if (maxSounds > 0 && ((Component)p).gameObject.Play("seltzer_spray_sound", 0.2f)) { int num2 = maxSounds - 1; maxSounds = num2; } if (p.baseData.speed > 0.1f) { p.ApplyFriction(0.25f); } seltzer._rotationRate += rotIncrease * BraveTime.DeltaTime; curAngle += seltzer._rotationRate * 60f * BraveTime.DeltaTime; p.SetRotation(curAngle); ((BeamController)seltzer._beam).Origin = p.SafeCenter; ((BeamController)seltzer._beam).Direction = -curAngle.ToVector(); ((BeamController)seltzer._beam).LateUpdatePosition(Vector2.op_Implicit(((BeamController)seltzer._beam).Origin)); yield return null; } if (Object.op_Implicit((Object)(object)seltzer) && Object.op_Implicit((Object)(object)seltzer._beam)) { ((BeamController)seltzer._beam).CeaseAttack(); } if (Object.op_Implicit((Object)(object)p)) { p.DieInAir(false, true, true, false); } } } public class HiccupVFXDoer : MonoBehaviour { private const float _VFX_RATE = 0.4f; private AIActor _enemy; private float _nextVfxTime; private void Start() { _enemy = ((Component)this).gameObject.GetComponent(); } private void Update() { //IL_004e: 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) float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; if (!(scaledTimeSinceStartup < _nextVfxTime)) { _nextVfxTime = scaledTimeSinceStartup + 0.4f; if (Object.op_Implicit((Object)(object)_enemy) && Object.op_Implicit((Object)(object)((BraveBehaviour)_enemy).sprite)) { CwaffVFX.SpawnBurst(Bubblebeam._BurstBubbleVFX, 4, ((BraveBehaviour)_enemy).sprite.WorldTopCenter, 1f, (Vector2?)new Vector2(0f, 2.5f), 0f, 2.5f, CwaffVFX.Vel.Random, CwaffVFX.Rot.Random, 0.5f, (float?)0.1f, 0f, (Color?)null, fadeIn: false, uniform: false, (float?)null, (float?)null, (float?)null, randomFrame: false, -1, flipX: false, flipY: false, (Transform)null, (Color?)null, 1.55f, 0f, (tk2dSpriteCollectionData)null, -1, 0f, 0f, unoccluded: false, copyShaders: false); } } } } public class GameActorHiccupEffect : GameActorSpeedEffect { internal const float _HICCUP_PERSIST_TIME = 3f; private const float _HICCUP_STUN_TIME = 0.5f; private const float _HICCUP_CHANCE_PER_SEC = 0.4f; private const int _HICCUP_NUM_PROJECTILES = 12; private const float _HICCUP_PROJ_GAP = 30f; internal static GameObject _HiccupProjectile; public override void OnEffectApplied(GameActor actor, RuntimeGameActorEffectData effectData, float partialAmount = 1f) { GameObjectExtensions.GetOrAddComponent(((Component)actor).gameObject); } public override void OnEffectRemoved(GameActor actor, RuntimeGameActorEffectData effectData) { HiccupVFXDoer component = ((Component)actor).gameObject.GetComponent(); if (component != null) { Object.Destroy((Object)(object)component); } } public override void EffectTick(GameActor actor, RuntimeGameActorEffectData effectData) { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_HiccupProjectile)) { _HiccupProjectile = ((Component)((BraveBehaviour)Items.Ak47.AsGun().DefaultModule.projectiles[0]).projectile).gameObject; } AIActor val = (AIActor)(object)((actor is AIActor) ? actor : null); if (val == null || ((GameActor)val).IsGone) { return; } HealthHaver healthHaver = ((BraveBehaviour)val).healthHaver; if (healthHaver == null || healthHaver.IsDead || !healthHaver.IsVulnerable || Random.value > BraveMathCollege.SliceProbability(0.4f, BraveTime.DeltaTime)) { return; } BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)val).behaviorSpeculator; if (behaviorSpeculator != null && !behaviorSpeculator.ImmuneToStun && !behaviorSpeculator.IsStunned) { behaviorSpeculator.Stun(0.5f, true); ((Component)val).gameObject.Play("hiccup_sound"); float num = 30f * Random.value; for (int i = 0; i < 12; i++) { Projectile component = SpawnManager.SpawnProjectile(_HiccupProjectile, Vector2.op_Implicit(((GameActor)val).CenterPosition), (num + 30f * (float)i).EulerZ(), true).GetComponent(); component.SetOwnerAndStats((GameActor)(object)val, updateCollisions: false); component.collidesWithEnemies = true; component.collidesWithPlayer = false; component.SetSpeed(15f); ((BraveBehaviour)component).specRigidbody.RegisterSpecificCollisionException(((BraveBehaviour)val).specRigidbody); } } } } public class Wayfarer : CwaffGun { public static string ItemName = "Wayfarer"; public static string ShortDescription = "Search and Destroy"; public static string LongDescription = "Launches a high velocity drone that pierces enemies and sticks to walls. Subsequent shots relaunch stationary drones towards the cursor. Drones are destroyed upon reloading, colliding with certain objects, or exiting the current room. Guns cannot be changed while a drone is active."; public static string Lore = "Developed as a secret research project coincidentally timed around the invention of sticky notes, this weapons grants its wielder unprecedented control over the trajectory of its projectiles. Once released to the general public, it quickly became apparent this level of control was often both unnecessary and disorienting. While it never reached mainstream popularity, it did find a niche use among the wealthy as an excellent car key locator."; private const string _WAYFARER_OVERRIDE = "Wayfarer Gunlock"; private List _extantProjectiles = new List(); private PlayerController _prevOwner; private OverrideLerper _lerpyboi; public static void Init() { //IL_014a: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 14; int? reloadFps = 4; Items? muzzleFrom = Items.Mailbox; Gun gun2 = gun.SetAttributes((ItemQuality)4, (GunClass)1, 0f, 50, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "wayfarer_launch_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).AddToShop((ShopType)0); int? clipSize = 1; float? cooldown = 1f; float? damage = 30f; float? speed = 70f; float? range = 1000f; float? force = 12f; bool? pierceBreakables = true; IntVector2? overrideColliderPixelSizes = new IntVector2(2, 2); gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "wayfarer_projectile", 2, (Anchor)4, 0.9f, anchorsChangeColliders: false, fixesScales: true, overrideColliderPixelSizes, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, null, "wayfarer_impact_sound", null, null, null, 0f, ignoredForReloadPurposes: false, mirror: false, null, null, null, pierceBreakables)).SetAllImpactVFX(Items.Blooper.AsGun().DefaultModule.projectiles[0].hitEffects.enemy).Attach((Action)delegate(PierceProjModifier pierce) { pierce.penetration = 10000; pierce.penetratesBreakables = true; }, allowDuplicates: false) .Attach() .AttachTrail("wayfarer_trail", 30, null, -1f, 1f / 60f, 1f); } public override void OnTriedToInitiateAttack(PlayerController player) { //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_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) base.OnTriedToInitiateAttack(player); RemoveDeadProjectiles(); for (int num = _extantProjectiles.Count - 1; num >= 0; num--) { float angle = (player.IsKeyboardAndMouse() ? Vector2Extensions.ToAngle(Vector3Extensions.XY(player.unadjustedAimPoint) - _extantProjectiles[num].SafeCenter) : ((GunBehaviour)this).gun.gunAngle); ((Component)_extantProjectiles[num]).gameObject.GetComponent().Redirect(angle); player.SuppressThisClick = true; } } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); _lerpyboi = GameObjectExtensions.GetOrAddComponent(((Component)player).gameObject); } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); CleanupWayfarer(); } public override void OnReloadPressed(PlayerController player, Gun gun, bool manualReload) { base.OnReloadPressed(player, gun, manualReload); if (manualReload) { CleanupWayfarer(); } } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); CleanupWayfarer(); } private void CleanupWayfarer() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((GunBehaviour)this).PlayerOwner.OverrideCursorCenter(null); } if (Object.op_Implicit((Object)(object)_lerpyboi)) { _lerpyboi.Deactivate(); } if (base.Mastered) { foreach (Projectile extantProjectile in _extantProjectiles) { if (Object.op_Implicit((Object)(object)extantProjectile)) { ((Component)extantProjectile).gameObject.GetComponent().MakeAutonomous(); } } } else { foreach (Projectile extantProjectile2 in _extantProjectiles) { if (Object.op_Implicit((Object)(object)extantProjectile2)) { extantProjectile2.DieInAir(false, true, true, false); } } } _extantProjectiles.Clear(); } public override void OnDestroy() { CleanupWayfarer(); base.OnDestroy(); } public override void PostProcessProjectile(Projectile projectile) { ((GunBehaviour)this).PostProcessProjectile(projectile); if (((GunBehaviour)this).PlayerOwner != null) { _extantProjectiles.Add(projectile); } } private void RemoveDeadProjectiles() { for (int num = _extantProjectiles.Count - 1; num >= 0; num--) { if (!Object.op_Implicit((Object)(object)_extantProjectiles[num])) { _extantProjectiles.RemoveAt(num); } } } public bool Owns(Projectile proj) { return _extantProjectiles.Contains(proj); } public override void Update() { //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_010f: 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_0124: Unknown result type (might be due to invalid IL or missing references) base.Update(); CameraController mainCameraController = GameManager.Instance.MainCameraController; PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null) { if (!Object.op_Implicit((Object)(object)_prevOwner)) { return; } foreach (Projectile extantProjectile in _extantProjectiles) { if (Object.op_Implicit((Object)(object)extantProjectile)) { extantProjectile.DieInAir(false, true, true, false); } } _extantProjectiles.Clear(); if (_prevOwner.IsPrimaryPlayer) { mainCameraController.UseOverridePlayerOnePosition = false; } else { mainCameraController.UseOverridePlayerTwoPosition = false; } return; } _prevOwner = playerOwner; RemoveDeadProjectiles(); if (_extantProjectiles.Count > 0) { playerOwner.inventory.GunLocked.SetOverride("Wayfarer Gunlock", true, (float?)null); ((PickupObject)((GunBehaviour)this).gun).CanBeDropped = false; Vector2 safeCenter = _extantProjectiles[0].SafeCenter; if (safeCenter != Vector2.zero) { _lerpyboi.Recenter(0.5f * (((GameActor)playerOwner).CenterPosition + safeCenter), 2f); playerOwner.OverrideCursorCenter(safeCenter); } } else { playerOwner.inventory.GunLocked.SetOverride("Wayfarer Gunlock", false, (float?)null); ((PickupObject)((GunBehaviour)this).gun).CanBeDropped = true; _lerpyboi.Deactivate(); playerOwner.OverrideCursorCenter(null); } } } public class OverrideLerper : MonoBehaviour { private bool _active; private PlayerController _player; private CameraController _cc; private void Setup() { if (!Object.op_Implicit((Object)(object)_player)) { _player = ((Component)this).gameObject.GetComponent(); } if (!Object.op_Implicit((Object)(object)_cc)) { _cc = GameManager.Instance.MainCameraController; } } public void Recenter(Vector2 pos, float lerpFactor = 0f) { //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_0028: 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_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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00bc: 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_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_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_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_0050: 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) Setup(); _active = true; if (_player.IsPrimaryPlayer) { if (lerpFactor == 0f) { _cc.OverridePlayerOnePosition = pos; } else if (_cc.UseOverridePlayerOnePosition) { _cc.OverridePlayerOnePosition = Lazy.SmoothestLerp(_cc.OverridePlayerOnePosition, pos, lerpFactor); } else { _cc.OverridePlayerOnePosition = Lazy.SmoothestLerp(((GameActor)_player).CenterPosition, pos, lerpFactor); } _cc.UseOverridePlayerOnePosition = true; } else { if (lerpFactor == 0f) { _cc.OverridePlayerTwoPosition = pos; } else if (_cc.UseOverridePlayerTwoPosition) { _cc.OverridePlayerTwoPosition = Lazy.SmoothestLerp(_cc.OverridePlayerTwoPosition, pos, lerpFactor); } else { _cc.OverridePlayerTwoPosition = Lazy.SmoothestLerp(((GameActor)_player).CenterPosition, pos, lerpFactor); } _cc.UseOverridePlayerTwoPosition = true; } } public void Deactivate() { Setup(); _active = false; } private void Update() { //IL_0036: 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_0050: 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_0058: 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_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_00ad: 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_00c2: 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_00ce: 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_00da: 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_00e5: Unknown result type (might be due to invalid IL or missing references) if (_active || !Object.op_Implicit((Object)(object)_player)) { return; } Vector2 val2; if (_player.IsPrimaryPlayer && _cc.UseOverridePlayerOnePosition) { Vector2 val = Lazy.SmoothestLerp(_cc.OverridePlayerOnePosition, ((GameActor)_player).CenterPosition, 5f); _cc.OverridePlayerOnePosition = val; val2 = ((GameActor)_player).CenterPosition - val; if (((Vector2)(ref val2)).sqrMagnitude < 0.00390625f) { _cc.UseOverridePlayerOnePosition = false; } } else if (!_player.IsPrimaryPlayer && _cc.UseOverridePlayerTwoPosition) { Vector2 val3 = Lazy.SmoothestLerp(_cc.OverridePlayerTwoPosition, ((GameActor)_player).CenterPosition, 5f); _cc.OverridePlayerTwoPosition = val3; val2 = ((GameActor)_player).CenterPosition - val3; if (((Vector2)(ref val2)).sqrMagnitude < 0.00390625f) { _cc.UseOverridePlayerTwoPosition = false; } } } } public class WayfarerProjectile : MonoBehaviour { private const float _MAX_DUPE_COLLISIONS = 5f; private const float _AUTO_FIRE_RATE = 0.75f; private const float _MAX_ANGLE_DEV = 88f; private Projectile _projectile; private PlayerController _owner; private bool stationary; private Vector2 normal; private float normalAngle; private float prevSpeed; private SpeculativeRigidbody _lastCollisionBody; private int _duplicateCollisions; private bool _autonomous; private Geometry _pingRing; private Geometry _ownerRing; private float _pingTimer; private float _shootTimer; private bool _disowned = true; public bool Autonomous { get { return _autonomous; } private set { _autonomous = value; } } private void Start() { //IL_004c: 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_00d1: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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 //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown _projectile = ((Component)this).GetComponent(); ((BraveBehaviour)_projectile).sprite.usesOverrideMaterial = true; ((BraveBehaviour)((BraveBehaviour)_projectile).sprite).renderer.material.shader = ShaderCache.Acquire("Brave/PlayerShader"); SpriteOutlineManager.AddOutlineToSprite(((BraveBehaviour)_projectile).sprite, Color.black); ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); if (!Object.op_Implicit((Object)(object)_owner)) { return; } Wayfarer gun = _owner.GetGun(); if (gun == null || !gun.Owns(_projectile)) { return; } _disowned = false; _projectile.BulletScriptSettings.surviveTileCollisions = true; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody.OnTileCollision = (OnTileCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnTileCollision, (Delegate?)new OnTileCollisionDelegate(OnTileCollision)); SpeculativeRigidbody specRigidbody2 = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody2.OnRigidbodyCollision = (OnRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody2.OnRigidbodyCollision, (Delegate?)new OnRigidbodyCollisionDelegate(OnRigidBodyCollision)); _pingRing = Geometry.Create(Geometry.Shape.RING); _ownerRing = Geometry.Create(Geometry.Shape.RING); bool flag = _owner.HasSynergy(Synergy.STRAGGLER); bool flag2 = _owner.HasSynergy(Synergy.TRAILBLAZER); if (flag || flag2) { GoopModifier orAddComponent = GameObjectExtensions.GetOrAddComponent(((Component)_projectile).gameObject); orAddComponent.SpawnGoopOnCollision = false; orAddComponent.SpawnGoopInFlight = true; orAddComponent.InFlightSpawnRadius = 0.625f; orAddComponent.InFlightSpawnFrequency = 0.01f; if (flag && flag2) { orAddComponent.goopDefinition = EasyGoopDefinitions.GreenFireDef; } else if (flag) { orAddComponent.goopDefinition = EasyGoopDefinitions.PoisonDef; } else if (flag2) { orAddComponent.goopDefinition = EasyGoopDefinitions.FireDef; } } } public void MakeAutonomous() { _autonomous = true; ((Component)this).gameObject.Play("wayfarer_autonomize_sound"); } private void OnRigidBodyCollision(CollisionData rigidbodyCollision) { if ((Object)(object)rigidbodyCollision.OtherRigidbody == (Object)(object)_lastCollisionBody) { if ((float)(++_duplicateCollisions) >= 5f) { _projectile.DieInAir(false, true, true, false); return; } } else { _duplicateCollisions = 0; } _lastCollisionBody = rigidbodyCollision.OtherRigidbody; } private void OnTileCollision(CollisionData tileCollision) { //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_0021: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) stationary = true; _projectile.shouldRotate = false; normal = ((CastResult)tileCollision).Normal; normalAngle = Vector2Extensions.ToAngle(normal); prevSpeed = _projectile.baseData.speed; _projectile.m_usesNormalMoveRegardless = true; ((BraveBehaviour)_projectile).specRigidbody.PullOutOfWall(Vector2Extensions.ToIntVector2(normal, (VectorConversions)2), forceAtLeastOne: true); _projectile.SetSpeed(0f); ((BraveBehaviour)_projectile).specRigidbody.CollideWithTileMap = false; ((BraveBehaviour)_projectile).specRigidbody.CollideWithOthers = false; ((BraveBehaviour)_projectile).specRigidbody.Reinitialize(); _projectile.ResetPiercing(); PhysicsEngine.PostSliceVelocity = Vector2.zero; } public void Redirect(float angle) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) if (stationary && !(angle.AbsAngleTo(normalAngle) > 88f)) { stationary = false; _projectile.shouldRotate = true; _projectile.m_usesNormalMoveRegardless = false; _projectile.SetSpeed(prevSpeed); _projectile.SendInDirection(angle.ToVector(), true, true); ((BraveBehaviour)_projectile).specRigidbody.CollideWithTileMap = true; ((BraveBehaviour)_projectile).specRigidbody.CollideWithOthers = true; ((BraveBehaviour)_projectile).specRigidbody.Reinitialize(); ((Component)this).gameObject.PlayUnique("wayfarer_relaunch_sound"); } } private void Update() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_008a: 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_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_0124: 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) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) if (_disowned) { return; } if (!Object.op_Implicit((Object)(object)_owner) || _owner.CurrentRoom == null || _owner.CurrentRoom != Vector3Extensions.GetAbsoluteRoom(((Component)this).transform.position)) { _projectile.DieInAir(false, true, true, false); return; } HandlePing(); if (!stationary) { return; } if (!_autonomous) { ((BraveBehaviour)_projectile).transform.rotation = (_owner.IsKeyboardAndMouse() ? (Vector3Extensions.XY(_owner.unadjustedAimPoint) - _projectile.SafeCenter).EulerZ() : _owner.m_currentGunAngle.EulerZ()); } else { if ((_shootTimer += BraveTime.DeltaTime) < 0.75f) { return; } _ = ((BraveBehaviour)_projectile).sprite.WorldCenter; Vector2 val = default(Vector2); Vector2 val2 = default(Vector2); bool flag = false; for (int i = 0; i < 4; i++) { Vector2 val3 = normal.Rotate(90f * (float)i); val = ((BraveBehaviour)_projectile).sprite.WorldCenter + val3; AIActor val4 = Lazy.NearestEnemy(val); if (val4 != null) { val2 = ((GameActor)val4).CenterPosition; normal = val3; normalAngle = Vector2Extensions.ToAngle(normal); flag = true; break; } } if (flag) { float num = Vector2Extensions.ToAngle(val2 - val); Quaternion rotation = num.EulerZ(); ((BraveBehaviour)_projectile).transform.rotation = rotation; Redirect(num); _shootTimer = 0f; } } } private void HandlePing() { //IL_0068: 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_006e: 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_0081: Unknown result type (might be due to invalid IL or missing references) _pingTimer += BraveTime.DeltaTime; float num = 6f * _pingTimer % ((float)Math.PI * 2f) / ((float)Math.PI * 2f); float num2 = num * 2f; float num3 = Mathf.Min(num, 1f - num); for (int i = 0; i < 2; i++) { Geometry obj = ((i == 0) ? _pingRing : _ownerRing); Color? color = Vector3Extensions.WithAlpha(_autonomous ? Color.red : Color.green, num3); Vector2? pos = ((i == 0) ? _projectile.SafeCenter : ((GameActor)_owner).CenterPosition); float? radius = num2; float? radiusInner = Mathf.Max(0f, num2 - 0.1f); obj.Place(color, pos, null, radius, null, null, radiusInner); if (_autonomous) { _ownerRing.Disable(); break; } } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)_pingRing)) { Object.Destroy((Object)(object)((Component)_pingRing).gameObject); } if (Object.op_Implicit((Object)(object)_ownerRing)) { Object.Destroy((Object)(object)((Component)_ownerRing).gameObject); } ((Component)this).gameObject.Play("wayfarer_destroy_sound"); } } [HarmonyPatch] internal static class AimCursorOverride { private static Vector2? _P1; private static Vector2? _P2; [HarmonyPatch(typeof(GameCursorController), "DrawCursor")] [HarmonyILManipulator] private static void GameCursorControllerDrawCursorIL(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) //IL_008e: 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.MatchCallvirt(instr, "get_CenterPosition") })) { val.Emit(OpCodes.Ldloc_S, (byte)6); val.CallPrivate(typeof(AimCursorOverride), "AdjustPlayerCursorCenter"); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchCallvirt(instr, "get_CenterPosition") })) { val.Emit(OpCodes.Ldloc_S, (byte)14); val.CallPrivate(typeof(AimCursorOverride), "AdjustPlayerCursorCenter"); } } } private static Vector2 AdjustPlayerCursorCenter(Vector2 orig, PlayerController player) { //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) return (player.IsPrimaryPlayer ? _P1 : _P2) ?? orig; } internal static void OverrideCursorCenter(this PlayerController player, Vector2? overridePos) { if (player.IsPrimaryPlayer) { _P1 = overridePos; } else { _P2 = overridePos; } } } public class SoulKaliber : CwaffGun { public static string ItemName = "Soul Kaliber"; public static string ShortDescription = "Gundead or Alive"; public static string LongDescription = "Fires projectiles that give enemies the soul link status effect. All soul linked enemies receive damage when any one of them is hit."; public static string Lore = "A traveling missionary of Kaliber was once rudely interrupted mid-sermon by a bandit army of sword-wielding heathens. With no weapons on hand to defend their congregation, the missionary prayed to the goddess for a firearm to deliver them from impending doom. Kaliber asked an acolyte to prepare and deliver one of her strongest guns; the acolyte, however, accidentally dropped the gun and its ammunition while loading it. The ammo rained down rather harmlessly on the bandits' heads, but by some miracle, the gun itself managed to bludgeon one of the bandits, knocking all of them out in the process."; internal static Color _SoulBlankColor = new Color(1f, 0.3f, 0.8f, 1f); private static readonly List _Targets = new List(); public static void Init() { //IL_012c: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 24; int? reloadFps = 12; Items? muzzleFrom = Items.BundleOfWands; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)15, 1.1f, 444, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "soul_kaliber_fire", "soul_kaliber_reload", 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); int? clipSize = 10; float? cooldown = 0.1f; float? damage = 1f; float? speed = 30f; Color? glowColor = Color.magenta; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "soul_kaliber_projectile", 2, (Anchor)4, 0.33f, anchorsChangeColliders: true, fixesScales: true, null, null, 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, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: false, 0f, null, 100f, glowColor)).Attach(); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); HealthHaver healthHaver = ((BraveBehaviour)player).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Combine(healthHaver.ModifyDamage, new Action(OnMightTakeDamage)); } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); HealthHaver healthHaver = ((BraveBehaviour)player).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Remove(healthHaver.ModifyDamage, new Action(OnMightTakeDamage)); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { HealthHaver healthHaver = ((BraveBehaviour)((GunBehaviour)this).PlayerOwner).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Remove(healthHaver.ModifyDamage, new Action(OnMightTakeDamage)); } base.OnDestroy(); } private void OnMightTakeDamage(HealthHaver hh, ModifyDamageEventArgs data) { //IL_0072: 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) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) if ((object)data == EventArgs.Empty || data.ModifiedDamage <= 0f || !hh.IsVulnerable) { return; } AIActor aiActor = ((BraveBehaviour)hh).aiActor; if (aiActor == null || !Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) || ((GunBehaviour)this).PlayerOwner.CurrentRoom == null || !base.Mastered) { return; } float num = 0.25f + 0.05f * (float)Mathf.Clamp(PlayerStats.GetTotalCurse(), 0, 10); _Targets.Clear(); foreach (AIActor allNearbyEnemy in ((GameActor)aiActor).CenterPosition.GetAllNearbyEnemies()) { if (Object.op_Implicit((Object)(object)allNearbyEnemy) && Random.value <= num && Object.op_Implicit((Object)(object)((Component)allNearbyEnemy).gameObject.GetComponent())) { _Targets.Add(allNearbyEnemy); } } if (_Targets.Count != 0) { AIActor val = _Targets.ChooseRandom(); ((BraveBehaviour)val).healthHaver.ApplyDamage(100f, ((GameActor)val).CenterPosition - ((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition, "Kaliber's Protection", (CoreDamageTypes)0, (DamageCategory)0, false, (PixelCollider)null, false); data.ModifiedDamage = 0f; hh.TriggerInvulnerabilityPeriod(-1f); Lazy.DoDamagedFlash(hh); ((Component)((GunBehaviour)this).PlayerOwner).gameObject.Play("kaliber_protection_activate_sound"); ((GunBehaviour)this).PlayerOwner.DoColorfulMiniBlank(_SoulBlankColor); ((GunBehaviour)this).PlayerOwner.DoColorfulMiniBlank(_SoulBlankColor, ((GameActor)val).CenterPosition); for (int i = 0; i < 2; i++) { GameObject soulLinkOverheadVFX = SoulLinkStatus._SoulLinkOverheadVFX; Vector2 basePosition = ((i == 0) ? ((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition : ((GameActor)val).CenterPosition); float? startScale = 0.5f; float? endScale = 0.01f; Color? emissiveColor = Color.red; CwaffVFX.SpawnBurst(soulLinkOverheadVFX, 10, basePosition, 1f, null, 4f, 1f, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.None, 0.3f, null, 1f, emissiveColor, fadeIn: false, uniform: false, startScale, endScale); } } } } public class SoulLinkProjectile : MonoBehaviour { private void Start() { Projectile component = ((Component)this).GetComponent(); component.OnHitEnemy = (Action)Delegate.Combine(component.OnHitEnemy, new Action(OnHitEnemy)); } private void OnHitEnemy(Projectile p, SpeculativeRigidbody enemy, bool _) { ((Component)p).gameObject.Play("soul_kaliber_impact"); GameObjectExtensions.GetOrAddComponent(((Component)enemy).gameObject); } } public class SoulLinkStatus : MonoBehaviour { public static GameActorHealthEffect StandardSoulLinkEffect; private const int _NUM_HIT_PARTICLES = 12; private const float _SOUL_PART_SPEED = 3f; private const float _MAX_VFX_RATE = 0.1f; internal static VFXPool _SoulLinkHitVFXPool; internal static GameObject _SoulLinkHitVFX; internal static GameObject _SoulLinkOverheadVFX; internal static GameObject _SoulLinkSoulVFX; private static bool _SoulLinkEffectHappening; private AIActor _enemy; private OrbitalEffect _orbitalEffect; private float _lastVfxTime; public static void Init() { //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_011e: 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) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_0150: 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_015e: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Expected O, but got Unknown _SoulLinkHitVFXPool = Items.MagicLamp.AsGun().DefaultModule.projectiles[0].hitEffects.overrideMidairDeathVFX.CreatePoolFromVFXGameObject(); _SoulLinkHitVFX = _SoulLinkHitVFXPool.effects[0].effects[0].effect.gameObject; _SoulLinkOverheadVFX = VFX.Create("soul_link_particle", 16f, loops: true, -1, 0.3f, (Anchor)1, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 100f); _SoulLinkSoulVFX = VFX.Create("soul_link_soul", 5f, loops: true, -1, 0.3f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 200f); StandardSoulLinkEffect = new GameActorHealthEffect { duration = 60f, effectIdentifier = "SoulLink", resistanceType = (EffectResistanceType)0, DamagePerSecondToEnemies = 0f, ignitesGoops = false, OverheadVFX = null, AffectsEnemies = true, AffectsPlayers = false, AppliesOutlineTint = true, PlaysVFXOnActor = false, AppliesTint = false, AppliesDeathTint = false }; } private void Start() { _enemy = ((Component)this).GetComponent(); _orbitalEffect = ((Component)_enemy).gameObject.AddComponent(); _orbitalEffect.SetupOrbitals(_SoulLinkOverheadVFX, 3, 0.5f, isEmissive: true); ((GameActor)_enemy).ApplyEffect((GameActorEffect)(object)StandardSoulLinkEffect, 1f, (Projectile)null); HealthHaver healthHaver = ((BraveBehaviour)_enemy).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Combine(healthHaver.ModifyDamage, new Action(OnTakeDamage)); ((BraveBehaviour)_enemy).healthHaver.OnPreDeath += delegate { _orbitalEffect.HandleEnemyDied(); }; } private void OnTakeDamage(HealthHaver hh, ModifyDamageEventArgs data) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (_SoulLinkEffectHappening) { return; } try { _SoulLinkEffectHappening = true; AIActor aiActor = ((BraveBehaviour)hh).aiActor; if (!Object.op_Implicit((Object)(object)aiActor)) { return; } bool flag = false; foreach (AIActor allNearbyEnemy in ((GameActor)aiActor).CenterPosition.GetAllNearbyEnemies()) { if (!((Object)(object)aiActor == (Object)(object)allNearbyEnemy)) { SoulLinkStatus component = ((Component)allNearbyEnemy).gameObject.GetComponent(); if (component != null) { flag = component.ShareThePain(data.ModifiedDamage); } } } if (flag) { ((Component)hh).gameObject.Play("soul_kaliber_drain"); } } finally { _SoulLinkEffectHappening = false; } } public bool ShareThePain(float damage) { //IL_0028: 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_008f: 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_00cd: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_enemy)) { HealthHaver healthHaver = ((BraveBehaviour)_enemy).healthHaver; if (healthHaver != null && !healthHaver.IsDead) { healthHaver.ApplyDamage(damage, Vector2.zero, "Soul Link", (CoreDamageTypes)2, (DamageCategory)5, true, (PixelCollider)null, false); KnockbackDoer knockbackDoer = ((BraveBehaviour)healthHaver).knockbackDoer; if (knockbackDoer != null) { knockbackDoer.ApplyKnockback(new Vector2(0f, 0f), 2f, false); } if (_lastVfxTime + 0.1f > BraveTime.ScaledTimeSinceStartup) { return false; } _lastVfxTime = BraveTime.ScaledTimeSinceStartup; CwaffVFX.SpawnBurst(_SoulLinkSoulVFX, 12, ((GameActor)_enemy).CenterPosition, 1f, 3f * Vector2.up, 0f, 0f, CwaffVFX.Vel.Random, CwaffVFX.Rot.None, 0.5f, 0.5f, 50f, Color.white); return true; } } return false; } } public class Heartbreaker : CwaffGun { private class HeartbreakerAmmoDisplay : CustomAmmoDisplay { private Gun _gun; private PlayerController _owner; private void Start() { _gun = ((Component)this).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; } uic.GunAmmoCountLabel.Text = $"[sprite \"heartbreaker_heart_ui\"]x{_gun.m_currentStrengthTier}\n{CustomAmmoDisplayExtensions.VanillaAmmoDisplay(_owner)}"; return true; } } public static string ItemName = "Heartbreaker"; public static string ShortDescription = " _extantOrbitals = new List(); internal static GameObject _AbsorbVFX = null; internal static GameObject _EmptyHeartGuon = null; public int storedHalfHearts; public static void Init() { //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0548: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 30; int? reloadFps = 16; Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)4, (GunClass)50, 1.4f, 800, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "heartbreaker_fire_sound", null, null, -1, -1, -1, null, modulesAreTiers: true, 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("heartbeat_sound", 0, 2, 4).Attach((Action)null, allowDuplicates: false) .AssignGun(out gunRef); int? clipSize = 5; float? cooldown = 0.25f; float? burstCooldown = 0.04f; float? angleVariance = 30f; float? damage = 5.5f; float? speed = 25f; float? range = 1000f; float? force = 9f; float? lightStrength = 8f; float? lightRange = 0.75f; Color? lightColor = ExtendedColours.vibrantOrange; HeartbreakerProjectile p = gun2.InitSpecialProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)4, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "heartbreaker_projectile", 15, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, "heartbreaker_fire_sound", null, null, null, null, null, null, null, null, null, "heartbreaker_impact_sound", null, null, 0f, ignoredForReloadPurposes: false, mirror: false, null, burstCooldown, null, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: false, 0f, null, 30f, null, null, -1, null, lightStrength, lightRange, lightColor)); lightColor = new Color(1f, 0.85f, 0f, 5f); Color? lightColor2 = ExtendedColours.vibrantOrange; ((Projectile)(object)p).SetAllImpactVFX(VFX.CreatePool("heartbreak_projectile_impact_vfx", 60f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 6.5f, lightColor, orphaned: false, attached: true, unlit: false, 7f, 1.5f, lightColor2, 10f)).AttachTrail("heartbreaker_trail", 60, null, -1f, 1f / 120f, 0.25f); ProjectileModule defaultModule = gunRef.DefaultModule; gunRef.Volley.projectiles = new List(27); for (int i = 0; i <= 26; i++) { ProjectileModule val = ProjectileModule.CreateClone(defaultModule, false, -1); val.burstShotCount = 4 + i; val.numberOfShotsInClip = val.burstShotCount * 3; float burstCooldownTime = ((i >= 12) ? ((i >= 18) ? 0.01f : 0.02f) : ((i >= 6) ? 0.03f : 0.04f)); val.burstCooldownTime = burstCooldownTime; gunRef.Volley.projectiles.Add(val); } lightColor2 = Color.Lerp(Color.red, Color.white, 0.5f); _AbsorbVFX = VFX.Create("hearbreaker_absorb_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 10f, lightColor2); PassiveItem obj = Items.GlassGuonStone.AsPassive(); _EmptyHeartGuon = ((Component)((PlayerOrbitalItem)((obj is IounStoneOrbitalItem) ? obj : null)).OrbitalPrefab).gameObject.ClonePrefab(); ((tk2dBaseSprite)_EmptyHeartGuon.GetComponentInChildren()).SetSprite(VFX.Collection, VFX.Collection.GetSpriteIdByName("heartbreaker_shield")); PixelCollider obj2 = _EmptyHeartGuon.GetComponent().PixelColliders[0]; obj2.ManualWidth = 13; obj2.ManualHeight = 11; obj2.ManualOffsetX = 6; obj2.ManualOffsetY = 5; _EmptyHeartGuon.GetComponent().orbitRadius = 4f; } private void Start() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) tk2dBaseSprite sprite = ((BraveBehaviour)((GunBehaviour)this).gun).sprite; Color? glowColor = Color.red; float? glowColorPower = 2f; bool? clampBrightness = false; sprite.SetGlowiness(1f, glowColor, null, clampBrightness, glowColorPower); } private void UpdateOrbitals() { //IL_0059: 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_007d: Unknown result type (might be due to invalid IL or missing references) HealthHaver healthHaver = ((BraveBehaviour)((GunBehaviour)this).PlayerOwner).healthHaver; _ = _extantOrbitals.Count; int num = Mathf.Max(0, Mathf.FloorToInt(healthHaver.GetMaxHealth() - healthHaver.GetCurrentHealth())); while (_extantOrbitals.Count < num) { PlayerOrbital component = PlayerOrbitalItem.CreateOrbital(((GunBehaviour)this).PlayerOwner, _EmptyHeartGuon, false, (PlayerOrbitalItem)null).GetComponent(); EasyLight.Create((Vector2?)((tk2dBaseSprite)((Component)component).gameObject.GetComponentInChildren()).WorldCenter, ((Component)component).gameObject.transform, (Color?)Color.Lerp(ExtendedColours.vibrantOrange, Color.white, 0.35f), -1f, 2f, false, 3f, 0.05f, 0.05f, true, false, 30f, 0f, true, true); _extantOrbitals.Add(component); } while (_extantOrbitals.Count > num) { int index = _extantOrbitals.Count - 1; if (Object.op_Implicit((Object)(object)_extantOrbitals[index])) { Object.Destroy((Object)(object)((Component)_extantOrbitals[index]).gameObject); } _extantOrbitals.RemoveAt(index); } } private void DestroyOrbitals() { for (int num = _extantOrbitals.Count - 1; num >= 0; num--) { if (Object.op_Implicit((Object)(object)_extantOrbitals[num])) { Object.Destroy((Object)(object)((Component)_extantOrbitals[num]).gameObject); } } _extantOrbitals.Clear(); } public override void Update() { base.Update(); if (!((GunBehaviour)this).gun.IsReloading) { if (base.Mastered && Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { UpdateOrbitals(); } float num = Mathf.Abs(Mathf.Sin(9f * BraveTime.ScaledTimeSinceStartup)); Material material = ((BraveBehaviour)((BraveBehaviour)((GunBehaviour)this).gun).sprite).renderer.material; material.SetFloat(CwaffVFX._EmissivePowerId, 1f + 2f * num); material.SetFloat(CwaffVFX._EmissiveColorPowerId, 2f + 8f * num); } } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); tk2dSpriteAnimator spriteAnimator = ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator; spriteAnimator.AnimationEventTriggered = (Action)Delegate.Remove(spriteAnimator.AnimationEventTriggered, new Action(ProduceLight)); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { tk2dSpriteAnimator spriteAnimator2 = ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator; spriteAnimator2.AnimationEventTriggered = (Action)Delegate.Combine(spriteAnimator2.AnimationEventTriggered, new Action(ProduceLight)); } UpdateGunStrength(); } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); tk2dSpriteAnimator spriteAnimator = ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator; spriteAnimator.AnimationEventTriggered = (Action)Delegate.Remove(spriteAnimator.AnimationEventTriggered, new Action(ProduceLight)); DestroyOrbitals(); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); GameManager.Instance.OnNewLevelFullyLoaded += OnNewFloor; } public override void OnDroppedByPlayer(PlayerController player) { GameManager.Instance.OnNewLevelFullyLoaded -= OnNewFloor; DestroyOrbitals(); base.OnDroppedByPlayer(player); } public override void OnDestroy() { GameManager.Instance.OnNewLevelFullyLoaded -= OnNewFloor; base.OnDestroy(); } private void OnNewFloor() { if (Object.op_Implicit((Object)(object)this)) { DestroyOrbitals(); } } public override void OnFullClipReload(PlayerController player, Gun gun) { //IL_000e: 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_008b: Unknown result type (might be due to invalid IL or missing references) if (gun.CurrentStrengthTier < 26) { int num = ConsumeNearbyHeart(player, ((GameActor)player).CenterPosition); if (num != 0) { num = Mathf.Min(num, 26 - storedHalfHearts); storedHalfHearts += num; UpdateGunStrength(); gun.GainAmmo(num * 200); GameObject absorbVFX = _AbsorbVFX; Transform transform = ((BraveBehaviour)((BraveBehaviour)gun).sprite).transform; Vector2 worldCenter = ((BraveBehaviour)gun).sprite.WorldCenter; float? startScale = 1f; float? endScale = 0.1f; Color? emissiveColor = Color.red; CwaffVFX.SpawnBurst(absorbVFX, 30, worldCenter, 5f, null, 0f, 0f, CwaffVFX.Vel.InwardToCenter, CwaffVFX.Rot.Random, 0.35f, null, 10f, emissiveColor, fadeIn: false, uniform: false, startScale, endScale, null, randomFrame: false, -1, flipX: false, flipY: false, transform); } } } private static void CheckIfNearestHeart(IPlayerInteractable ix, Vector2 pos, ref IPlayerInteractable targetIx, ref HealthPickup targetHeart, ref float nearest) { //IL_0038: 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_0049: Unknown result type (might be due to invalid IL or missing references) if (ix == null) { return; } HealthPickup val = (HealthPickup)(object)((ix is HealthPickup) ? ix : null); if (val != null && Object.op_Implicit((Object)(object)val) && ((Behaviour)val).isActiveAndEnabled && Object.op_Implicit((Object)(object)((BraveBehaviour)val).sprite) && !(val.healAmount <= 0f)) { Vector2 val2 = pos - ((BraveBehaviour)val).sprite.WorldCenter; float sqrMagnitude = ((Vector2)(ref val2)).sqrMagnitude; if (!(sqrMagnitude > nearest)) { targetIx = ix; targetHeart = val; nearest = sqrMagnitude; } } } private int ConsumeNearbyHeart(PlayerController player, Vector2 pos) { //IL_001f: 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) IPlayerInteractable targetIx = null; HealthPickup targetHeart = null; float nearest = 25f; foreach (IPlayerInteractable unassignedInteractableObject in RoomHandler.unassignedInteractableObjects) { CheckIfNearestHeart(unassignedInteractableObject, pos, ref targetIx, ref targetHeart, ref nearest); } RoomHandler currentRoom = player.CurrentRoom; if (currentRoom != null) { foreach (IPlayerInteractable interactableObject in currentRoom.interactableObjects) { CheckIfNearestHeart(interactableObject, pos, ref targetIx, ref targetHeart, ref nearest); } } if (!Object.op_Implicit((Object)(object)targetHeart)) { return 0; } RoomHandler.unassignedInteractableObjects.Remove(targetIx); if (player.CurrentRoom != null && player.CurrentRoom.IsRegistered(targetIx)) { player.CurrentRoom.DeregisterInteractable(targetIx); } int result = Mathf.RoundToInt(2f * targetHeart.healAmount); ((BraveBehaviour)targetHeart).sprite.DuplicateInWorldAsMesh().Dissipate(0.4f, 0f, 5f, progressive: true); Object.Destroy((Object)(object)((Component)targetHeart).gameObject); ((Component)this).gameObject.Play("heartbreaker_absorb_sound"); return result; } private void ProduceLight(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frame) { //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_0036: Unknown result type (might be due to invalid IL or missing references) if (!(clip.name != "heartbreaker_reload") && frame % 2 != 1) { Transform primaryHandAttachPoint = ((GunBehaviour)this).gun.PrimaryHandAttachPoint; Color? val = Color.Lerp(ExtendedColours.vibrantOrange, Color.white, 0.35f); EasyLight.Create((Vector2?)null, primaryHandAttachPoint, val, 0.1f, 2f, false, 3f, 0.05f, 0.05f, true, false, 30f, 0f, true, true); } } private void UpdateGunStrength() { if (((GunBehaviour)this).gun.CurrentStrengthTier != storedHalfHearts) { ((GunBehaviour)this).gun.CurrentStrengthTier = storedHalfHearts; ((GunBehaviour)this).gun.SetBaseMaxAmmo(800 + 200 * storedHalfHearts); } } public override void MidGameSerialize(List data, int i) { ((GunBehaviour)this).MidGameSerialize(data, i); data.Add(storedHalfHearts); } public override void MidGameDeserialize(List data, ref int i) { ((GunBehaviour)this).MidGameDeserialize(data, ref i); storedHalfHearts = (int)data[i++]; UpdateGunStrength(); } } public class HeartbreakerProjectile : Projectile { private enum State { START, DECEL, LOCKON, HOME } private const float _DECEL_START = 0.15f; private const float _LERP_RATE = 13f; private const float _LOCKON_SPEED = 5f; private const float _LOCKON_SPEED_SCALE = 2f; private const float _HOME_SPEED_SCALE = 4f; private const float _MIN_START_SPEED = 5f; private const float _HOME_THRES = 10f; private const float _HOME_THRES_SQR = 100f; private float _stateTime; private State _state; private Vector2 _targetDir; private float _startSpeed; private Vector2 DetermineTargetDir(Projectile source, SpeculativeRigidbody specRigidbody) { //IL_0001: 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_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_0039: 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) AIActor val = Lazy.NearestEnemy(source.SafeCenter); if (!Object.op_Implicit((Object)(object)val)) { return Lazy.RandomVector(); } Vector2 val2 = ((GameActor)val).CenterPosition - source.SafeCenter; return ((Vector2)(ref val2)).normalized; } public override void Start() { ((Projectile)this).Start(); base.m_usesNormalMoveRegardless = true; } public override void Move() { //IL_012f: 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_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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: 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_0080: 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_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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0195: 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_019f: 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_0119: 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) _ = BraveTime.ScaledTimeSinceStartup; float deltaTime = BraveTime.DeltaTime; _stateTime += deltaTime; switch (_state) { case State.START: if (_stateTime >= 0.15f) { _startSpeed = base.baseData.speed; if (_startSpeed < 5f) { _startSpeed = 5f; } _state = State.DECEL; } ((BraveBehaviour)this).specRigidbody.Velocity = base.m_currentDirection * base.m_currentSpeed; break; case State.DECEL: { float num = Lazy.SmoothestLerp(base.baseData.speed, 0f, 13f); if (num < 1f || base.m_currentDirection == Vector2.zero) { num = 1f; _targetDir = DetermineTargetDir((Projectile)(object)this, ((BraveBehaviour)this).specRigidbody); _state = State.LOCKON; _stateTime = 0f; } base.baseData.speed = num; ((Projectile)this).UpdateSpeed(); ((BraveBehaviour)this).specRigidbody.Velocity = base.m_currentDirection * num; break; } case State.LOCKON: { SpeculativeRigidbody specRigidbody = ((BraveBehaviour)this).specRigidbody; specRigidbody.Velocity += _startSpeed * 2f * deltaTime * _targetDir; if (((Vector2)(ref ((BraveBehaviour)this).specRigidbody.Velocity)).sqrMagnitude > 100f) { float num = 4f * _startSpeed; base.baseData.speed = num; ((Projectile)this).UpdateSpeed(); ((BraveBehaviour)this).specRigidbody.Velocity = num * _targetDir; _state = State.HOME; ((Component)this).gameObject.Play("heartbreaker_home_sound"); } break; } case State.HOME: ((BraveBehaviour)this).specRigidbody.Velocity = 4f * _startSpeed * _targetDir; base.m_usesNormalMoveRegardless = false; break; } ((BraveBehaviour)this).transform.localRotation = ((BraveBehaviour)this).specRigidbody.Velocity.EulerZ(); } } public class Missiletoe : CwaffGun { public static string ItemName = "Missiletoe"; public static string ShortDescription = "O Tannenbomb"; public static string LongDescription = "Fires wrapped gifts with special attributes depending on the quality of item they contain. Reloading with a full clip while a dropped item or gun is nearby wraps it and adds it to the gun's clip. Reloading with a full clip while no items are nearby unwraps the most recently wrapped item and removes it from the gun's clip. Items and guns do not count as part of the player's normal inventory while they are wrapped."; public static string Lore = "Leaving all of the gift-giving to Santa Claus during the Christmas season seems silly when modern firearm technology allows for the expedient delivery of high-velocity presents all year round. The sheer inertia with which the {ItemName} can launch presents is sure to leave a lasting impression on its lucky recipients, and while concussive force may render those recipients unable to actually enjoy those gifts, it's the thought that counts, right?"; internal static GameObject _SparklePrefab; internal static GameObject _WrapVFXS; internal static GameObject _WrapVFXA; internal static GameObject _WrapVFXB; internal static GameObject _WrapVFXC; internal static GameObject _WrapVFXD; internal static GameObject _UnwrapVFXS; internal static GameObject _UnwrapVFXA; internal static GameObject _UnwrapVFXB; internal static GameObject _UnwrapVFXC; internal static GameObject _UnwrapVFXD; internal static float _WrapAnimLength; internal static Projectile _OrnamentProjectile; internal static Projectile _ExplodingOrnamentProjectile; internal static Projectile _GiftProjectileS; internal static Projectile _GiftProjectileA; internal static Projectile _GiftProjectileB; internal static Projectile _GiftProjectileC; internal static Projectile _GiftProjectileD; private const int _WRAP_FPS = 16; private const float _MAX_DIST = 5f; private const int _MIN_EXCHANGE_KILLS = 5; private const int _MAX_EXCHANGE_KILLS = 15; private static readonly List _AllowedQualities = new List { (ItemQuality)5, (ItemQuality)4, (ItemQuality)3, (ItemQuality)2, (ItemQuality)1 }; private static GameObject _SecretSantaVFX = null; private ItemQuality _lastQualityFired; internal List _shuffledQualities = new List(); internal bool _currentlyWrapping; public List wrappedGifts = new List(); public List wrappedQualities = new List(); public int exchangeKillsRemaining = -1; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 45; int? reloadFps = 20; Items? muzzleFrom = Items.Mailbox; gun.SetAttributes((ItemQuality)4, (GunClass)40, 1f, 300, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: true, null, null, shootFps, reloadFps, null, null, "missiletoe_shoot_sound_1", "missiletoe_reload_sound", 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).AddToShop(ModdedShopType.Boomhildr).AssignGun(out Gun gunRef); gunRef.DefaultModule.SetAttributes(GunData.New(gunRef, null, 1, 0.2f, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4)); ExplosionData splode = Explosions.DefaultSmall.With(100f, 10f, 10f, 0.5f, preventPlayerForce: true, shake: false); tk2dSpriteAnimationClip val = AnimatedBullet.Create("missiletoe_projectile_ball", 2, (Anchor)3); tk2dSpriteAnimationClip val2 = AnimatedBullet.Create("missiletoe_projectile_gingerbread", 2, (Anchor)3); tk2dSpriteAnimationClip val3 = AnimatedBullet.Create("missiletoe_projectile_mistletoe", 2, (Anchor)3); tk2dSpriteAnimationClip val4 = AnimatedBullet.Create("missiletoe_projectile_sock", 2, (Anchor)3); tk2dSpriteAnimationClip val5 = AnimatedBullet.Create("missiletoe_projectile_star", 2, (Anchor)3); tk2dSpriteAnimationClip val6 = AnimatedBullet.Create("missiletoe_projectile_wreath", 2, (Anchor)3); _OrnamentProjectile = Items._38Special.CloneProjectile().AddAnimations(val, val2, val3, val4, val5, val6).Attach(); _ExplodingOrnamentProjectile = Items._38Special.CloneProjectile().AddAnimations(val, val2, val3, val4, val5, val6).Attach(delegate(GlowyChristmasProjectileBehavior glow) { glow.glow = 40f; }) .Attach((Action)delegate(ExplosiveModifier e) { e.explosionData = splode; }, allowDuplicates: false); _GiftProjectileS = SetupProjectile(gunRef, "gift_projectile_black", 30f, 30f, 30f).Attach((Action)delegate(ExplosiveModifier e) { e.explosionData = splode; }, allowDuplicates: false).Attach((Action)delegate(SpawnProjModifier s) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) s.spawnProjectilesOnCollision = true; s.numberToSpawnOnCollison = 9; s.startAngle = 180; s.projectileToSpawnOnCollision = _ExplodingOrnamentProjectile; s.collisionSpawnStyle = (CollisionSpawnStyle)0; }, allowDuplicates: false); _GiftProjectileA = SetupProjectile(gunRef, "gift_projectile_red", 25f, 30f, 25f).Attach((Action)delegate(ExplosiveModifier e) { e.explosionData = Bouncer._MiniExplosion; }, allowDuplicates: false).Attach((Action)delegate(SpawnProjModifier s) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) s.spawnProjectilesOnCollision = true; s.numberToSpawnOnCollison = 7; s.startAngle = 180; s.projectileToSpawnOnCollision = _OrnamentProjectile; s.collisionSpawnStyle = (CollisionSpawnStyle)0; }, allowDuplicates: false); _GiftProjectileB = SetupProjectile(gunRef, "gift_projectile_green", 20f, 25f, 20f).Attach((Action)delegate(SpawnProjModifier s) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) s.spawnProjectilesOnCollision = true; s.numberToSpawnOnCollison = 5; s.startAngle = 180; s.projectileToSpawnOnCollision = _OrnamentProjectile; s.collisionSpawnStyle = (CollisionSpawnStyle)0; }, allowDuplicates: false); _GiftProjectileC = SetupProjectile(gunRef, "gift_projectile_blue", 15f, 25f, 15f).Attach((Action)delegate(SpawnProjModifier s) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) s.spawnProjectilesOnCollision = true; s.numberToSpawnOnCollison = 2; s.startAngle = 180; s.projectileToSpawnOnCollision = _OrnamentProjectile; s.collisionSpawnStyle = (CollisionSpawnStyle)1; }, allowDuplicates: false); _GiftProjectileD = SetupProjectile(gunRef, "gift_projectile_brown", 10f, 25f, 10f); _WrapVFXS = SetupVFX("black_gift_wrap"); _WrapVFXA = SetupVFX("red_gift_wrap"); _WrapVFXB = SetupVFX("green_gift_wrap"); _WrapVFXC = SetupVFX("blue_gift_wrap"); _WrapVFXD = SetupVFX("brown_gift_wrap"); _UnwrapVFXS = SetupVFX("black_gift_unwrap"); _UnwrapVFXA = SetupVFX("red_gift_unwrap"); _UnwrapVFXB = SetupVFX("green_gift_unwrap"); _UnwrapVFXC = SetupVFX("blue_gift_unwrap"); _UnwrapVFXD = SetupVFX("brown_gift_unwrap"); _WrapAnimLength = _WrapVFXB.GetComponent().DefaultClip.BaseClipLength; _SparklePrefab = VFX.Create("missiletoe_sparkles", 8f, loops: false, -1, 0.75f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _SecretSantaVFX = VFX.Create("present_vfx", 2f, loops: true, -1, 1f, (Anchor)1, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 10f); } private static GameObject SetupVFX(string name) { return VFX.Create(name, 16f, loops: false, -1, 0.75f, (Anchor)1, null, usesZHeight: false, 0f, persist: true, (VFXAlignment)1); } private static Projectile SetupProjectile(Gun gun, string name, float damage, float speed, float force) { float? damage2 = damage; float? speed2 = speed; float? range = 50f; float? force2 = force; Projectile obj = gun.CloneProjectile(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, damage2, speed2, force2, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4)); obj.AddDefaultAnimation(AnimatedBullet.Create(name, 1, (Anchor)3, 0.5f)); ((BraveBehaviour)obj).transform.parent = gun.barrelOffset; obj.shouldFlipHorizontally = true; obj.shouldFlipVertically = false; obj.shouldRotate = false; obj.onDestroyEventName = "gift_impact_sound"; ((Component)obj).gameObject.AddComponent(); return obj; } public override Projectile OnPreFireProjectileModifier(Gun gun, Projectile projectile, ProjectileModule mod) { //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_002b: 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_0032: 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_000e: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected I4, but got Unknown ItemQuality val = ((mod.ammoCost != 0) ? (_lastQualityFired = _shuffledQualities[mod.numberOfShotsInClip - gun.ClipShotsRemaining]) : _lastQualityFired); return (Projectile)((val - 1) switch { 4 => _GiftProjectileS, 3 => _GiftProjectileA, 2 => _GiftProjectileB, 1 => _GiftProjectileC, 0 => _GiftProjectileD, _ => _GiftProjectileD, }); } public static GameObject GetGiftVFX(ItemQuality quality, bool wrap) { //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_001c: Expected I4, but got Unknown switch (quality - 1) { case 4: if (!wrap) { return _UnwrapVFXS; } return _WrapVFXS; case 3: if (!wrap) { return _UnwrapVFXA; } return _WrapVFXA; case 2: if (!wrap) { return _UnwrapVFXB; } return _WrapVFXB; case 1: if (!wrap) { return _UnwrapVFXC; } return _WrapVFXC; case 0: if (!wrap) { return _UnwrapVFXD; } return _WrapVFXD; default: if (!wrap) { return _UnwrapVFXD; } return _WrapVFXD; } } public override void PostProcessProjectile(Projectile projectile) { ((GunBehaviour)this).PostProcessProjectile(projectile); if (base.Mastered) { projectile.OnWillKillEnemy = (Action)Delegate.Combine(projectile.OnWillKillEnemy, new Action(GiftExchange)); } } private void GiftExchange(Projectile projectile, SpeculativeRigidbody rigidbody) { HealthHaver healthHaver = ((BraveBehaviour)rigidbody).healthHaver; if (healthHaver != null && !healthHaver.IsDead && --exchangeKillsRemaining <= 0) { SecretSanta(); ResetSecretSanta(); } } private void ResetSecretSanta() { exchangeKillsRemaining = Random.Range(5, 16); } public override void OnPlayerPickup(PlayerController player) { RecalculateClip(); base.OnPlayerPickup(player); } public override void OnReloadPressed(PlayerController player, Gun gun, bool manualReload) { if (manualReload && !_currentlyWrapping && gun.DefaultModule.numberOfShotsInClip == Mathf.Min(gun.ClipShotsRemaining, gun.AdjustedMaxAmmo)) { WrapPresent(); } else { RecalculateClip(); } base.OnReloadPressed(player, gun, manualReload); } public override void OnAmmoChanged(PlayerController player, Gun gun) { ((GunBehaviour)this).OnAmmoChanged(player, gun); RecalculateClip(); } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); RecalculateClip(); if (exchangeKillsRemaining < 0) { ResetSecretSanta(); } } private void WrapPresent() { //IL_00ba: 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_005b: 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_0070: Unknown result type (might be due to invalid IL or missing references) PickupObject val = null; float num = 5f; foreach (DebrisObject allDebri in StaticReferenceManager.AllDebris) { if (!allDebri.IsPickupObject || !allDebri.onGround) { continue; } PickupObject componentInChildren = ((Component)allDebri).GetComponentInChildren(); if (componentInChildren != null && !componentInChildren.IsBeingSold && _AllowedQualities.Contains(componentInChildren.quality)) { Vector2 val2 = ((BraveBehaviour)allDebri).sprite.WorldCenter - ((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition; float magnitude = ((Vector2)(ref val2)).magnitude; if (!(magnitude >= num)) { val = componentInChildren; num = magnitude; } } } if (!Object.op_Implicit((Object)(object)val)) { UnwrapPresent(); } else { WrappableGift.Spawn(this, ((GunBehaviour)this).gun.barrelOffset.position, val, unwrapping: false); } } internal void RecalculateClip() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) wrappedQualities.Add((ItemQuality)1); _shuffledQualities = wrappedQualities.CopyAndShuffle(); wrappedQualities.Pop(); ((GunBehaviour)this).gun.DefaultModule.numberOfShotsInClip = _shuffledQualities.Count; } private void SecretSanta(int index = -1) { //IL_0044: 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_0103: Unknown result type (might be due to invalid IL or missing references) if (wrappedGifts.Count == 0 || !Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { return; } if (index < 0) { index = Random.Range(0, wrappedGifts.Count); } GameObject randomChestRewardOfQuality = ((GunBehaviour)this).PlayerOwner.GetRandomChestRewardOfQuality(wrappedGifts[index].quality); Object.Destroy((Object)(object)((Component)wrappedGifts[index]).gameObject); PickupObject component = Object.Instantiate(randomChestRewardOfQuality).GetComponent(); PlayerItem component2 = ((Component)component).gameObject.GetComponent(); if (component2 != null) { component2.m_pickedUp = true; } else { PassiveItem component3 = ((Component)component).gameObject.GetComponent(); if (component3 != null) { component3.m_pickedUp = true; } } SpriteOutlineManager.RemoveOutlineFromSprite(((BraveBehaviour)component).sprite, true); ((BraveBehaviour)component).renderer.enabled = false; Object.DontDestroyOnLoad((Object)(object)((Component)component).gameObject); wrappedGifts[index] = component; for (int i = 0; i <= 8; i++) { GameObject secretSantaVFX = _SecretSantaVFX; Vector3 position = Vector2.op_Implicit(((BraveBehaviour)((GunBehaviour)this).PlayerOwner).sprite.WorldCenter); Vector2? velocity = (22.5f + 45f * (float)i).ToVector(4f); float? fadeOutTime = 0.125f; float? startScale = 0.75f; float? endScale = 0.4f; Transform transform = ((BraveBehaviour)((GunBehaviour)this).PlayerOwner).transform; CwaffVFX.Spawn(secretSantaVFX, position, null, velocity, 0.6f, fadeOutTime, 0f, null, fadeIn: false, startScale, endScale, null, randomFrame: false, -1, flipX: false, flipY: false, transform); } ((Component)((GunBehaviour)this).PlayerOwner).gameObject.Play("secret_santa_sound"); } private void UnwrapPresent() { //IL_0020: 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) if (wrappedGifts.Count != 0) { PickupObject pickup = wrappedGifts.Pop(); wrappedQualities.Pop(); RecalculateClip(); WrappableGift.Spawn(this, ((GunBehaviour)this).gun.barrelOffset.position, pickup, unwrapping: true); } } public override void MidGameSerialize(List data, int i) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown ((GunBehaviour)this).MidGameSerialize(data, i); data.Add(exchangeKillsRemaining); data.Add(wrappedGifts.Count); foreach (PickupObject wrappedGift in wrappedGifts) { data.Add(wrappedGift.PickupObjectId); PlayerItem component = ((Component)wrappedGift).GetComponent(); if (component != null) { data.Add((object)new MidGameActiveItemData(component)); continue; } PassiveItem component2 = ((Component)wrappedGift).GetComponent(); if (component2 != null) { data.Add((object)new MidGamePassiveItemData(component2)); continue; } Gun component3 = ((Component)wrappedGift).GetComponent(); if (component3 != null) { data.Add((object)new MidGameGunData(component3)); } else { ETGModConsole.Log((object)" SERIALIZING SOMETHING THAT ISN'T A GUN, ACTIVE, OR PASSIVE, TELL PRETZEL", false); } } } public override void MidGameDeserialize(List data, ref int i) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown //IL_01d8: 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_0154: Expected O, but got Unknown ((GunBehaviour)this).MidGameDeserialize(data, ref i); wrappedGifts.Clear(); exchangeKillsRemaining = (int)data[i++]; int num = (int)data[i++]; for (int j = 0; j < num; j++) { PickupObject component = Object.Instantiate(((Component)PickupObjectDatabase.GetById((int)data[i++])).gameObject).GetComponent(); PlayerItem component2 = ((Component)component).GetComponent(); if (component2 != null) { MidGameActiveItemData val = (MidGameActiveItemData)data[i++]; component2.CurrentDamageCooldown = val.DamageCooldown; component2.CurrentRoomCooldown = val.RoomCooldown; component2.CurrentTimeCooldown = val.TimeCooldown; component2.numberOfUses = val.NumberOfUses; ((PickupObject)component2).MidGameDeserialize(val.SerializedData); component2.GetRidOfMinimapIcon(); component2.m_pickedUp = true; } else { PassiveItem component3 = ((Component)component).GetComponent(); if (component3 != null) { MidGamePassiveItemData val2 = (MidGamePassiveItemData)data[i++]; ((PickupObject)component3).MidGameDeserialize(val2.SerializedData); component3.GetRidOfMinimapIcon(); component3.m_pickedUp = true; } else { Gun component4 = ((Component)component).GetComponent(); if (component4 != null) { MidGameGunData val3 = (MidGameGunData)data[i++]; ((PickupObject)component4).MidGameDeserialize(val3.SerializedData); for (int k = 0; k < val3.DuctTapedGunIDs.Count; k++) { PickupObject byId = PickupObjectDatabase.GetById(val3.DuctTapedGunIDs[k]); Gun val4 = (Gun)(object)((byId is Gun) ? byId : null); if (val4 != null) { DuctTapeItem.DuctTapeGuns(val4, component4); } } component4.CurrentAmmo = val3.CurrentAmmo; } } } ((BraveBehaviour)component).renderer.enabled = false; component.m_isBeingEyedByRat = false; wrappedGifts.Add(component); wrappedQualities.Add(component.quality); } RecalculateClip(); } } public class GlowyChristmasProjectileBehavior : MonoBehaviour { public float glow; private void Start() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) Projectile component = ((Component)this).GetComponent(); ((BraveBehaviour)((BraveBehaviour)component).sprite).spriteAnimator.Play(((BraveBehaviour)((BraveBehaviour)component).sprite).spriteAnimator.Library.clips.ChooseRandom()); if (glow > 0f) { ((BraveBehaviour)component).sprite.SetGlowiness(glow, Color.white); } } } public class ChristmasSparkleDoer : MonoBehaviour { private const float _SPARKLE_TIME = 0.03f; private const float _SPARKLE_LIFE = 0.45f; private const float _SPARKLE_FADE = 0.25f; private const float _PART_EMIT = 5f; private Projectile _projectile; private PlayerController _owner; private float _lifetime; private void Start() { _projectile = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); } private void Update() { //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_0047: Unknown result type (might be due to invalid IL or missing references) _lifetime += BraveTime.DeltaTime; if (!(_lifetime < 0.03f)) { _lifetime -= 0.03f; SpawnManager.SpawnVFX(Missiletoe._SparklePrefab, Vector2.op_Implicit(_projectile.SafeCenter), Lazy.RandomEulerZ()).ExpireIn(0.45f, 0.25f); } } } public class WrappableGift : MonoBehaviour { private const float _GROW_TIME = 0.5f; private const float _MIN_SCALE = 0.4f; private const float _VANISH_PERCENT = 0.5f; private static readonly Vector2 _EXTRA_OFFSET = new Vector2(0f, 0.75f); private GameObject _vfx; private tk2dBaseSprite _sprite; private tk2dSpriteAnimator _animator; private Vector3 _position; private PickupObject _pickup; private Missiletoe _gun; private bool _wasEyedByRat; public static WrappableGift Spawn(Missiletoe gun, Vector3 position, PickupObject pickup, bool unwrapping) { //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_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) WrappableGift wrappableGift = Object.Instantiate(new GameObject(), position, Quaternion.identity).AddComponent(); wrappableGift.Setup(gun, position, pickup, unwrapping); return wrappableGift; } public void Setup(Missiletoe gun, Vector3 position, PickupObject pickup, bool unwrapping) { //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_0017: 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_002c: Unknown result type (might be due to invalid IL or missing references) _gun = gun; _position = position; _pickup = pickup; _vfx = SpawnManager.SpawnVFX(Missiletoe.GetGiftVFX(pickup.quality, !unwrapping), _position, Quaternion.identity, true); _vfx.ExpireIn(Missiletoe._WrapAnimLength + 0.5f, 0.25f); _sprite = _vfx.GetComponent(); _animator = _vfx.GetComponent(); _gun._currentlyWrapping = true; ((MonoBehaviour)this).StartCoroutine(WrapItUp(unwrapping)); } private IEnumerator WrapItUp(bool unwrapping) { bool wrapping = !unwrapping; Gun component = ((Component)_pickup).GetComponent(); bool isGun = component != null; Vector2 targetPosition = Vector3Extensions.XY(_position) + _EXTRA_OFFSET; float animLength = Missiletoe._WrapAnimLength; tk2dBaseSprite pickupvfx = null; if (wrapping) { pickupvfx = ((BraveBehaviour)_pickup).sprite.DuplicateInWorld(); } if (wrapping) { _gun.wrappedQualities.Add(_pickup.quality); if (isGun) { PickupObject pickup = _pickup; _pickup = Object.Instantiate(pickup); ((Component)_pickup).GetComponent().DuctTapeMergedGunIDs = ((Component)pickup).GetComponent().DuctTapeMergedGunIDs; Transform parent = ((BraveBehaviour)pickup).transform.parent; if (parent != null) { Object.Destroy((Object)(object)((Component)parent).gameObject); } else { Object.Destroy((Object)(object)pickup); } } else { PlayerItem component2 = ((Component)_pickup).GetComponent(); if (component2 != null) { component2.GetRidOfMinimapIcon(); component2.m_pickedUp = true; } else { PassiveItem component3 = ((Component)_pickup).GetComponent(); if (component3 != null) { component3.GetRidOfMinimapIcon(); component3.m_pickedUp = true; } } SpriteOutlineManager.RemoveOutlineFromSprite(((BraveBehaviour)_pickup).sprite, true); ((BraveBehaviour)_pickup).renderer.enabled = false; _wasEyedByRat = _pickup.m_isBeingEyedByRat; _pickup.m_isBeingEyedByRat = false; DebrisObject component4 = ((Component)_pickup).gameObject.GetComponent(); if (component4 != null) { Object.Destroy((Object)(object)component4); } SquishyBounceWiggler component5 = ((Component)_pickup).gameObject.GetComponent(); if (component5 != null) { Object.Destroy((Object)(object)component5); } } Object.DontDestroyOnLoad((Object)(object)((Component)_pickup).gameObject); _gun.wrappedGifts.Add(_pickup); _gun.RecalculateClip(); } _vfx.SetAlphaImmediate(0f); yield return null; _vfx.SetAlpha(1f); _animator.StopAndResetFrame(); ((Component)this).gameObject.Play("present_create_sound"); for (float elapsed = 0f; elapsed < 0.5f; elapsed += BraveTime.DeltaTime) { float num = elapsed / 0.5f; ((BraveBehaviour)_sprite).transform.localScale = new Vector3(num, num, 1f); yield return null; } _animator.Play(); ((Component)this).gameObject.Play(wrapping ? "present_wrap_sound" : "present_unwrap_sound"); if (wrapping) { pickupvfx.ArcTowards(animLength, _sprite, useBottom: true); yield return (object)new WaitForSeconds(animLength); _gun._currentlyWrapping = false; yield break; } yield return (object)new WaitForSeconds(animLength * 0.5f); Vector2 val = targetPosition - ((BraveBehaviour)_pickup).sprite.GetRelativePositionFromAnchor((Anchor)1); if (isGun) { val += _EXTRA_OFFSET; } LootEngine.DropItemWithoutInstantiating(((Component)_pickup).gameObject, Vector2.op_Implicit(val), Vector2.zero, 0f, true, false, true, false); PlayerItem component6 = ((Component)_pickup).GetComponent(); if (component6 != null) { component6.RegisterMinimapIcon(); component6.m_pickedUp = false; RoomHandler.unassignedInteractableObjects.AddUnique((IPlayerInteractable)(object)component6); } else { PassiveItem component7 = ((Component)_pickup).GetComponent(); if (component7 != null) { component7.RegisterMinimapIcon(); component7.m_pickedUp = false; RoomHandler.unassignedInteractableObjects.AddUnique((IPlayerInteractable)(object)component7); } } _pickup.m_isBeingEyedByRat = _wasEyedByRat; _gun._currentlyWrapping = false; } } public class QuarterPounder : CwaffGun { public static string ItemName = "Quarter Pounder"; public static string ShortDescription = "Pay Per Pew"; public static string LongDescription = "Uses casings as ammo. Fires high-powered projectiles that transmute enemies to gold upon death, spawning an extra casing."; public static string Lore = "Legend says that Dionysus granted King Midas' wish that everything he touched would turn to gold. Midas was overjoyed at first, but upon turning his food and daughter to gold, realized his wish was ill thought out, and eventually died of starvation.\n\nThe average person might interpret King Midas as a cautionary tale to be mindful of what you wish for. One gunsmith, however, heard the tale and thought, \"wow, turning my enemies to gold sure would be useful!\". Despite completely missing the moral of King Midas, the gunsmith did succeed in forging a rather powerful weapon, proving that the meaning of art is indeed up to the beholder."; internal static GameObject _MidasParticleVFX; internal static Projectile _GoldProjectile; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 24; int? reloadFps = 16; Gun gun2 = gun.SetAttributes((ItemQuality)2, (GunClass)15, 1.1f, 9999, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: false, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "fire_coin_sound", "coin_gun_reload", null, -1, -1, -1, null, modulesAreTiers: false, "muzzle_quarter_pounder", 30, 0.4f, (Anchor)4, -1f, null, -1f, muzzleLit: false, 0f, 0f, null, null, preventRotation: false, 0f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: true, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0); int? clipSize = 10; float? angleVariance = 15f; float? damage = 20f; float? speed = 44f; gun2.InitProjectile(GunData.New(null, null, clipSize, null, angleVariance, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "coin_gun_projectile", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, null, "coin_hit_wall_sound")).Attach(); speed = 30f; damage = 80f; angleVariance = 10f; float? range = 80f; bool? shouldRotate = true; _GoldProjectile = Items.Ak47.CloneProjectile(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, speed, damage, angleVariance, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "midas_gold_projectile", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, shouldRotate)).Attach(); _MidasParticleVFX = VFX.Create("midas_sparkle", 8f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 5f); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); AdjustAmmoToMoney(); } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); AdjustAmmoToMoney(); } public override void Update() { base.Update(); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { AdjustAmmoToMoney(); } } public override void OnPostFired(PlayerController player, Gun gun) { ((GunBehaviour)this).OnPostFired(player, gun); PlayerConsumables carriedConsumables = GameManager.Instance.PrimaryPlayer.carriedConsumables; int currency = carriedConsumables.Currency - 1; carriedConsumables.Currency = currency; AdjustAmmoToMoney(); } private void AdjustAmmoToMoney() { int currency = GameManager.Instance.PrimaryPlayer.carriedConsumables.Currency; ((GunBehaviour)this).gun.CurrentAmmo = currency; if (((GunBehaviour)this).gun.ClipShotsRemaining > currency) { ((GunBehaviour)this).gun.ClipShotsRemaining = currency; } } } public class MidasProjectile : MonoBehaviour { internal static Color _Gold = new Color(1f, 1f, 0f, 1f); internal static Color _White = new Color(1f, 1f, 1f, 1f); private void Start() { Projectile component = ((Component)this).GetComponent(); component.OnWillKillEnemy = (Action)Delegate.Combine(component.OnWillKillEnemy, new Action(OnWillKillEnemy)); } private void OnWillKillEnemy(Projectile bullet, SpeculativeRigidbody enemy) { //IL_004f: 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_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_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_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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00ba: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_00e8: 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_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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).aiActor) && Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).healthHaver) && !((BraveBehaviour)enemy).healthHaver.IsBoss && !((BraveBehaviour)enemy).healthHaver.IsSubboss) { tk2dBaseSprite val = ((BraveBehaviour)enemy).aiActor.DuplicateInWorld(); GameObject gameObject = ((Component)val).gameObject; IntVector2 val2 = Vector2Extensions.ToIntVector2(16f * (val.WorldBottomLeft - Vector3Extensions.XY(gameObject.transform.position)), (VectorConversions)2); SpeculativeRigidbody obj = gameObject.AddComponent(); obj.CanBePushed = true; obj.CanBeCarried = true; obj.CollideWithOthers = true; obj.CollideWithTileMap = false; List list = new List(1); PixelCollider val3 = new PixelCollider { CollisionLayer = (CollisionLayer)10, Enabled = true, IsTrigger = false, ColliderGenerationMode = (PixelColliderGeneration)0, ManualOffsetX = val2.x, ManualOffsetY = val2.y }; Bounds bounds = val.GetBounds(); val3.ManualWidth = Mathf.CeilToInt(16f * ((Bounds)(ref bounds)).size.x); bounds = val.GetBounds(); val3.ManualHeight = Mathf.CeilToInt(16f * ((Bounds)(ref bounds)).size.y); list.Add(val3); obj.PixelColliders = list; obj.Initialize(); gameObject.AddComponent()._paletteTexture = ((BraveBehaviour)enemy).aiActor.optionalPalette; LootEngine.SpawnCurrency(((GameActor)((BraveBehaviour)enemy).aiActor).CenterPosition, 1, false); ((BraveBehaviour)enemy).aiActor.EraseFromExistenceWithRewards(true); } } } public class GoldenDeath : MonoBehaviour { private const float _START_EMIT = 30f; private const float _MAX_EMIT = 50f; private const float _MIN_EMIT = 0f; private const float _GROW_TIME = 0.25f; private const float _DECAY_TIME = 0.5f; private const float _EXPLODE_TIME = 0.75f; private const int _NUM_PARTICLES = 10; private const float _PART_SPEED = 2f; private const float _PART_SPREAD = 0.5f; private const float _PART_LIFE = 0.5f; private const float _PART_EMIT = 20f; internal Texture2D _paletteTexture; private float _lifetime; private bool _decaying; private tk2dSprite _sprite; private bool _exploding; private PlayerController _midasOwner; private void Start() { //IL_0060: 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_0094: Unknown result type (might be due to invalid IL or missing references) SpeculativeRigidbody component = ((Component)this).gameObject.GetComponent(); component.OnCollision = (Action)Delegate.Combine(component.OnCollision, new Action(OnCollision)); _sprite = ((Component)this).gameObject.GetComponent(); ((tk2dBaseSprite)(object)_sprite).OverrideShader(CwaffShaders.GoldShader, _paletteTexture); CwaffVFX.SpawnBurst(QuarterPounder._MidasParticleVFX, 10, ((tk2dBaseSprite)_sprite).WorldCenter, 0.5f, Vector2.zero, 0f, 2f, CwaffVFX.Vel.Radial, CwaffVFX.Rot.Random, 0.5f, 0.5f, 20f, Color.white); ((Component)this).gameObject.Play("turn_to_gold"); } private void OnCollision(CollisionData data) { if (!_exploding && Object.op_Implicit((Object)(object)data.OtherRigidbody)) { GameActor gameActor = ((BraveBehaviour)data.OtherRigidbody).gameActor; PlayerController val = (PlayerController)(object)((gameActor is PlayerController) ? gameActor : null); if (val != null && val.HasSynergy(Synergy.MASTERY_QUARTER_POUNDER)) { _exploding = true; _lifetime = 0f; _midasOwner = val; ((Component)this).gameObject.Play("midas_touch_sound"); } } } private void Update() { //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_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_0071: Unknown result type (might be due to invalid IL or missing references) ((tk2dBaseSprite)_sprite).UpdateZDepth(); if (_exploding) { _lifetime += BraveTime.DeltaTime; if (_lifetime >= 0.75f) { for (int i = 0; i < 20; i++) { Quaternion val = ((float)i * 18f).AddRandomSpread(9f).EulerZ(); Projectile component = SpawnManager.SpawnProjectile(((Component)QuarterPounder._GoldProjectile).gameObject, Vector2.op_Implicit(((tk2dBaseSprite)_sprite).WorldCenter), val, true).GetComponent(); ProjectileData baseData = component.baseData; baseData.speed *= Random.Range(0.9f, 1.1f); component.collidesWithPlayer = false; component.Owner = (GameActor)(object)_midasOwner; if (Object.op_Implicit((Object)(object)_midasOwner)) { _midasOwner.DoPostProcessProjectile(component); } component.DestroyMode = (ProjectileDestroyMode)2; ((BraveBehaviour)component).sprite.usesOverrideMaterial = true; ((BraveBehaviour)((BraveBehaviour)component).sprite).renderer.material.shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTiltedCutoutEmissive"); ((BraveBehaviour)((BraveBehaviour)component).sprite).renderer.material.SetFloat(CwaffVFX._EmissivePowerId, 50f); } ((Component)this).gameObject.Play("midas_explode_sound"); Object.Destroy((Object)(object)((Component)this).gameObject); } else { float num = 0f + 50f * (_lifetime / 0.75f); ((BraveBehaviour)_sprite).renderer.material.SetFloat(CwaffVFX._EmissivePowerId, num); } } else if (_decaying) { if (!(_lifetime >= 0.5f)) { _lifetime = Mathf.Min(_lifetime + BraveTime.DeltaTime, 0.5f); float num = 50f - 50f * (_lifetime / 0.5f); ((BraveBehaviour)_sprite).renderer.material.SetFloat(CwaffVFX._EmissivePowerId, num); } } else { _lifetime = Mathf.Min(_lifetime + BraveTime.DeltaTime, 0.25f); float num = 30f + 20f * (_lifetime / 0.25f); ((BraveBehaviour)_sprite).renderer.material.SetFloat(CwaffVFX._EmissivePowerId, num); if (_lifetime >= 0.25f) { _decaying = true; _lifetime = 0f; } } } } public class PistolWhip : CwaffGun { private class PistolWhipAmmoDisplay : CustomAmmoDisplay { private PistolWhip whip; private PlayerController _owner; private void Start() { Gun component = ((Component)this).GetComponent(); whip = ((Component)component).GetComponent(); ref PlayerController owner = ref _owner; GameActor currentOwner = component.CurrentOwner; owner = (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null); } public override bool DoCustomAmmoDisplay(GameUIAmmoController uic) { if (!whip.Mastered) { return false; } uic.GunAmmoCountLabel.Text = $"[sprite \"mini_blank_ui\"]x{whip.miniBlanks}\n[sprite \"infinite-big\"]"; return true; } } public static string ItemName = "Pistol Whip"; public static string ShortDescription = "What a Horrible Night"; public static string LongDescription = "Deals high melee damage and fires a fast projectile at its tip when fully extended. Can only melee hit enemies when fully extended. Increases curse by 2 while in inventory."; public static string Lore = "Once wielded by elite foot soldiers in the army of the great Pharaoh Tutancannon, this weapon is contraband in modern gunfare. On top of flouting the Guneva Conventions with its absurd muzzle range and ability to reach around rather tall walls, it is also reported to have been cursed by Tutancannon himself on his deathbed, bound to unleash the foulest creatures upon those who would dare wield it within the Gungeon's chambers."; internal const int _MINI_BLANKS_ON_KILL = 3; internal static Projectile _PistolWhipProjectile; internal static Projectile _PistolButtProjectile; public int miniBlanks; private float _unlockAngleTime; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 30; int? reloadFps = 40; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)1, 0.01f, 100, Items.Banana, defaultAudio: false, infiniteAmmo: true, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, 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, 2f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: false, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0, autoPlay: true, attacksThroughWalls: true).Attach((Action)null, allowDuplicates: false).AddToShop((ShopType)2); int? clipSize = -1; float? cooldown = WhipChainStart.TOTAL_TIME + 1f / 60f; float? damage = 0f; float? speed = 0.01f; float? range = 999f; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 0, null, customClip: false, damage, speed, null, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 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, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: true)).Attach(); range = 15f; speed = 80f; damage = 10f; float? range2 = 80f; _PistolWhipProjectile = Items.Ak47.CloneProjectile(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, range, speed, damage, range2, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4)).Attach((Action)delegate(EasyTrailBullet trail) { //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_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_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) trail.TrailPos = ((BraveBehaviour)trail).transform.position; trail.StartWidth = 0.3f; trail.EndWidth = 0f; trail.LifeTime = 0.05f; trail.BaseColor = Color.yellow; trail.EndColor = Color.yellow; }, allowDuplicates: false); range2 = 30f; damage = 1f; speed = 40f; range = 0.01f; _PistolButtProjectile = Items.Ak47.CloneProjectile(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, range2, damage, speed, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4)).AddAnimations(AnimatedBullet.Create("pistol_whip_dummy_bullet", 12, (Anchor)4)).SetAllImpactVFX(VFX.CreatePool("whip_particles", 20f, loops: false, -1, 0.5f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1)) .Attach(); } public void ReplenishMiniBlanks(Projectile p, SpeculativeRigidbody body) { if (Object.op_Implicit((Object)(object)((BraveBehaviour)body).healthHaver) && ((BraveBehaviour)body).healthHaver.IsAlive) { miniBlanks = 3; } } public void MaybeDoMiniBlank(Vector2 pos) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (miniBlanks > 0) { miniBlanks--; Lazy.DoMicroBlankAt(pos, ((GunBehaviour)this).PlayerOwner); } } public override void OnPostFired(PlayerController player, Gun gun) { ((GunBehaviour)this).OnPostFired(player, gun); _unlockAngleTime = BraveTime.ScaledTimeSinceStartup + WhipChainStart.TIMES.Last(); } public override void Update() { base.Update(); PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null) { bool hasValue = playerOwner.m_overrideGunAngle.HasValue; bool flag = BraveTime.ScaledTimeSinceStartup < _unlockAngleTime; if (!hasValue && flag) { playerOwner.m_overrideGunAngle = playerOwner.m_currentGunAngle; } else if (hasValue && !flag) { playerOwner.m_overrideGunAngle = null; } } } public override void MidGameSerialize(List data, int i) { ((GunBehaviour)this).MidGameSerialize(data, i); data.Add(miniBlanks); } public override void MidGameDeserialize(List data, ref int i) { ((GunBehaviour)this).MidGameDeserialize(data, ref i); miniBlanks = (int)data[i++]; } } public class PistolButtProjectile : MonoBehaviour { private void Start() { Projectile component = ((Component)this).gameObject.GetComponent(); ((BraveBehaviour)((BraveBehaviour)component).sprite).renderer.enabled = false; GameActor owner = component.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null && val.HasSynergy(Synergy.WICKED_CHILD)) { component.BlackPhantomDamageMultiplier = 2f; component.OnHitEnemy = (Action)Delegate.Combine(component.OnHitEnemy, new Action(OnHitEnemy)); } ((MonoBehaviour)this).StartCoroutine(ExpireInTwoFrames()); } private void OnHitEnemy(Projectile p, SpeculativeRigidbody other, bool killed) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) AIActor component = ((Component)other).GetComponent(); if (component != null && component.IsBlackPhantom) { HealthHaver healthHaver = ((BraveBehaviour)component).healthHaver; if (healthHaver != null && !healthHaver.IsBoss && !healthHaver.IsSubboss) { healthHaver.ApplyDamage(9999f, p.Direction, "Doesn't Belong in this World", (CoreDamageTypes)2, (DamageCategory)0, false, (PixelCollider)null, false); } } } private IEnumerator ExpireInTwoFrames() { yield return null; yield return null; ((Component)this).gameObject.GetComponent().DieInAir(false, true, true, false); } } public class WhipChainStartProjectile : MonoBehaviour { private void Start() { //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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) Projectile component = ((Component)this).gameObject.GetComponent(); WhipChainStart whipChainStart = Object.Instantiate(new GameObject(), Vector3.zero, Quaternion.identity).AddComponent(); GameActor owner = component.Owner; whipChainStart.Setup((PlayerController)(object)((owner is PlayerController) ? owner : null), Vector2Extensions.ToAngle(component.Direction)); Object.Destroy((Object)(object)((Component)this).gameObject); } } public class WhipChainStart : MonoBehaviour { internal const int _CHAIN_LENGTH = 60; internal const float _INVLINKS = 1f / 60f; internal const int _HANDLE_LENGTH = 6; internal const float _WHIP_WIDTH = 0.1875f; internal const float _SPEED_SCALE = 1f; internal const float _WHIP_RANGE = 6f; internal const float _RETRACT_MAX = 0.65f; internal const float _MAX_AMP = 0.5f; internal static readonly float[] TIMES = new float[5] { 0f, 0.05f, 0.2f, 0.25f, 0.4f }; internal static readonly float TOTAL_TIME = TIMES[TIMES.Length - 1]; internal static tk2dBaseSprite gunSprite = null; private PlayerController _owner; private float _angle; private List _links; private PistolWhip _whip; public void Setup(PlayerController owner, float angle) { if (Object.op_Implicit((Object)(object)owner)) { Gun currentGun = ((GameActor)owner).CurrentGun; if (currentGun != null) { _whip = ((Component)currentGun).GetComponent(); } if (gunSprite == null) { gunSprite = ((BraveBehaviour)Items.Magnum.AsGun()).sprite; } _owner = owner; _angle = angle; _links = new List(); for (int i = 0; i < 60; i++) { _links.Add(null); } ((MonoBehaviour)this).StartCoroutine(WhipItGood()); } } private void OnDestroy() { _links.SafeDestroyAll(); } private IEnumerator WhipItGood() { float freq = (float)Math.PI / 10f; bool flipped = Mathf.Abs(_angle) > 90f; Quaternion baseEuler = _angle.EulerZ(); ((GameActor)_owner).CurrentGun.ToggleRenderers(false); ((Component)_owner).gameObject.PlayOnce("whip_sound"); tk2dSprite pistolSprite = Lazy.SpriteObject(gunSprite.collection, gunSprite.spriteId); ((BraveBehaviour)pistolSprite).transform.rotation = baseEuler; ((BraveBehaviour)pistolSprite).transform.localScale = new Vector3(1f, flipped ? (-1f) : 1f, 1f); int phase = 1; bool spawnProjectile = false; float whipRange = 6f; bool mastered = _owner.HasSynergy(Synergy.MASTERY_PISTOL_WHIP); Vector2 val = Vector2.op_Implicit(((BraveBehaviour)_owner.primaryHand).transform.position); Vector2 end = val + whipRange * _owner.m_currentGunAngle.ToVector(); AIActor val2 = Lazy.NearestEnemyInLineOfSight(val, end); if (Object.op_Implicit((Object)(object)val2)) { Vector2 val3 = ((GameActor)val2).CenterPosition - val; whipRange = Mathf.Max(1f, ((Vector2)(ref val3)).magnitude - 1f); } Vector2 val7 = default(Vector2); for (float elapsed = 0f; elapsed < TOTAL_TIME; elapsed += BraveTime.DeltaTime) { if (elapsed > TIMES[phase]) { int num = phase + 1; phase = num; if (phase == 3) { spawnProjectile = true; } } float num2 = (elapsed - TIMES[phase - 1]) / (TIMES[phase] - TIMES[phase - 1]); float num3 = 0f; switch (phase) { case 1: { float num5 = 1f - num2; num3 = (0f - (1f - num5 * num5)) * whipRange * 0.65f; break; } case 2: { float num4 = num2 * num2 * num2; num3 = whipRange * Mathf.Lerp(-0.65f, 1f, num4); break; } case 3: num3 = whipRange; break; case 4: num3 = (1f - num2) * whipRange; break; } float num6 = Mathf.Abs(num3) / whipRange; float num7 = (flipped ? (-0.5f) : 0.5f) * (1f - num6 * num6); float num8 = num3 * (1f / 60f); Vector3 val4 = (Object.op_Implicit((Object)(object)_owner) ? ((BraveBehaviour)_owner.primaryHand).transform.position : Vector3.zero); Vector2 val5 = Vector2.zero; Vector2 val6 = Vector2.zero; if (spawnProjectile) { ((Vector2)(ref val7))..ctor(1.25f, flipped ? (-0.18f) : 0.18f); Vector3 val8 = val4 + baseEuler * Vector2.op_Implicit(whipRange * Vector2.right + val7); Projectile component = SpawnManager.SpawnProjectile(((Component)PistolWhip._PistolWhipProjectile).gameObject, val8, baseEuler, true).GetComponent(); component.SetOwnerAndStats((GameActor)(object)_owner); _owner.DoPostProcessProjectile(component); Projectile component2 = SpawnManager.SpawnProjectile(((Component)PistolWhip._PistolButtProjectile).gameObject, val8, baseEuler, true).GetComponent(); component2.SetOwnerAndStats((GameActor)(object)_owner); _owner.DoPostProcessProjectile(component2); if (mastered && Object.op_Implicit((Object)(object)_whip)) { component.BlackPhantomDamageMultiplier *= 2f; component2.BlackPhantomDamageMultiplier *= 2f; component.OnWillKillEnemy = (Action)Delegate.Combine(component.OnWillKillEnemy, new Action(_whip.ReplenishMiniBlanks)); component2.OnWillKillEnemy = (Action)Delegate.Combine(component2.OnWillKillEnemy, new Action(_whip.ReplenishMiniBlanks)); _whip.MaybeDoMiniBlank(Vector2.op_Implicit(val8)); } ((Component)_owner).gameObject.PlayOnce("whip_crack_sound"); spawnProjectile = false; } _ = Quaternion.identity; for (int i = 0; i < 60; i++) { val6 = Vector2.op_Implicit(val4 + baseEuler * Vector2.op_Implicit(new Vector2((float)(i + 1) * num8, num7 * Mathf.Sin((float)(i + 1) * freq)))); if ((Object)(object)_links[i] == (Object)null) { _links[i] = Ticonderogun.FancyLine(val5, val6, 0.1875f, VFX.Collection.GetSpriteIdByName((i >= 6) ? "whip_segment" : "whip_segment_base")); } else { Vector2 self = val6 - val5; Quaternion localRotation = self.EulerZ(); tk2dSlicedSprite component3 = _links[i].GetComponent(); component3.dimensions = 16f * new Vector2(((Vector2)(ref self)).magnitude, 0.1875f); ((BraveBehaviour)component3).transform.localRotation = localRotation; ((BraveBehaviour)component3).transform.position = Vector2.op_Implicit(val5 + 3f / 32f * ((Vector2)(ref self)).normalized.Rotate(-90f)); } val5 = val6; } ((tk2dBaseSprite)(object)pistolSprite).PlaceAtRotatedPositionByAnchor(Vector2.op_Implicit(val6), (Anchor)3); yield return null; } ((GameActor)_owner).CurrentGun.ToggleRenderers(true); Object.Destroy((Object)(object)((Component)pistolSprite).gameObject); Object.Destroy((Object)(object)((Component)this).gameObject); } } public class RCLauncher : CwaffGun { public static string ItemName = "R.C. Launcher"; public static string ShortDescription = "Pedal to the Metal"; public static string LongDescription = "Launches R.C. cars that explode on impact. Each car follows the car fired before it, or the mouse cursor / controller aim direction if it is the lead car. Reload time scales with the number of shots fired from the gun's clip."; public static string Lore = "A case study of the unreasonable effectiveness of retrofitting children's toys with AI and explosives, this launcher's steerable projectiles ensure swift and accurate destruction in the hands of a competent pilot. The projectiles also still make a surprisingly fun and entertaining diversion for children ages 4-14, provided they never crash into anything."; private const float _FULL_RELOAD_TIME = 2f; internal static ExplosionData _CarExplosion = null; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 30; int? reloadFps = 16; Gun gun2 = gun.SetAttributes((ItemQuality)2, (GunClass)50, 2f, 320, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "rc_car_launch_sound", "rc_car_reload_sound", null, -1, 0, -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); int? clipSize = 7; float? cooldown = 0.1f; float? speed = 20f; float? damage = 9f; float? range = 9999f; bool? pierceBreakables = true; bool? shouldRotate = false; bool? shouldFlipHorizontally = false; bool? shouldFlipVertically = false; bool? stopSoundOnDeath = true; ((Projectile)(object)gun2.InitSpecialProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "rc_car_projectile", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, "rc_car_crash_sound", shouldRotate, 1, shouldFlipHorizontally, shouldFlipVertically, useDummyChargeModule: false, invisibleProjectile: false, "rc_car_engine_sound", stopSoundOnDeath, null, null, null, null, null, null, null, null, null, null, null, 0f, ignoredForReloadPurposes: false, mirror: false, null, null, null, pierceBreakables))).Attach((Action)delegate(RCGuidedProjectile igp) { igp.dumbfireTime = 0.2f; igp.trackingSpeed = 360f; igp.minSpeed = 20f; igp.accel = 15f; igp.followTheLeader = true; }, allowDuplicates: false).Attach(); _CarExplosion = Explosions.ExplosiveRounds.With(100f, 10f, 5f, 0.5f, preventPlayerForce: true, shake: false); } public override void Update() { base.Update(); ((GunBehaviour)this).gun.reloadTime = 2f * (1f - (float)((GunBehaviour)this).gun.ClipShotsRemaining / (float)((GunBehaviour)this).gun.ClipCapacity); } } public class RCProjectileBehavior : MonoBehaviour { private const float _WIPE_OUT_TIME = 0.5f; private const float _WIPE_OUT_SPEED = 10f; private const float _MASTERY_TURN_MULT = 2f; private const int _MAX_CRASHES = 3; private Projectile _projectile; private RCGuidedProjectile _rc; private PlayerController _owner; private tk2dSpriteAnimationClip _clip; private int _numFrames; private EasyTrailBullet _trail; private float _wipeoutAngle; private float _wipeoutTime; private bool _mastered; private int _crashesLeft; private void Start() { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_0133: 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_013f: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) _projectile = ((Component)this).GetComponent(); _rc = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); _mastered = _projectile.Mastered(); ((BraveBehaviour)_projectile).spriteAnimator.Stop(); _clip = ((BraveBehaviour)_projectile).spriteAnimator.CurrentClip; _numFrames = _clip.frames.Length; Color val = default(Color); ((Color)(ref val))..ctor(0.25f + 0.5f * Random.value, 0.25f + 0.5f * Random.value, 0.25f + 0.5f * Random.value); Color val2 = Color.Lerp(val, Color.white, 0.5f); _projectile.AdjustPlayerProjectileTint(val2, 1, 0f); SpriteOutlineManager.AddOutlineToSprite(((BraveBehaviour)_projectile).sprite, val); _trail = ((Component)_projectile).gameObject.AddComponent(); _trail.StartWidth = 0.2f; _trail.EndWidth = 0.01f; _trail.LifeTime = 0.2f; _trail.BaseColor = val2; _trail.StartColor = val2; _trail.EndColor = val2; if (_mastered) { _crashesLeft = 3; _rc.trackingSpeed *= 2f; BounceProjModifier orAddComponent = GameObjectExtensions.GetOrAddComponent(((Component)this).gameObject); orAddComponent.numberOfBounces = _crashesLeft; orAddComponent.OnBounce += OnBounce; } } private void OnBounce() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (_crashesLeft-- > 0) { ((Component)this).gameObject.Play("wipe_out_sound"); _wipeoutAngle = Vector2Extensions.ToAngle(_projectile.Direction) + 180f; _wipeoutTime = 0.5f; _rc.ResetDumbFireTimer(_wipeoutTime); _projectile.SetSpeed(10f); DoSmallExplosion(); } } private void Update() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) float num; if (_wipeoutTime > 0f) { float deltaTime = BraveTime.DeltaTime; _wipeoutTime -= deltaTime; _wipeoutAngle += 1800f * deltaTime; num = _wipeoutAngle; } else { num = Vector2Extensions.ToAngle(_projectile.LastVelocity); } int num2 = Mathf.RoundToInt((float)_numFrames * (1f + num / 360f)) % _numFrames; ((BraveBehaviour)_projectile).sprite.SetSprite(_clip.frames[num2].spriteId); } private void DoSmallExplosion() { //IL_000b: 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) Exploder.Explode(((BraveBehaviour)_projectile).transform.position, RCLauncher._CarExplosion, _projectile.Direction, (Action)null, true, (CoreDamageTypes)0, false); } private void OnDestroy() { DoSmallExplosion(); } } public class RCGuidedProjectile : Projectile { private const float FRICTION = 0.99f; private static List _ExtantCars = new List(); public float trackingSpeed = 45f; public float minSpeed = -1f; public float accel = -1f; public float dumbfireTime; public bool followTheLeader; public Func overrideTargetFunc; private float _dumbfireTimer; private Projectile _currentLeader; public override void Start() { ((Projectile)this).Start(); _ExtantCars.Add((Projectile)(object)this); if (followTheLeader) { overrideTargetFunc = (Func)Delegate.Combine(overrideTargetFunc, new Func(FollowTheLeader)); } } public override void OnDestroy() { _ExtantCars.Remove((Projectile)(object)this); ((Projectile)this).OnDestroy(); } public void ResetDumbFireTimer(float newTime) { _dumbfireTimer = 0f; dumbfireTime = newTime; } public override void Move() { //IL_018b: 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_01a7: 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_00b8: 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_00a9: 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_0087: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) bool flag = true; if (dumbfireTime > 0f && _dumbfireTimer < dumbfireTime) { _dumbfireTimer += BraveTime.DeltaTime; flag = false; } if (flag && ((Projectile)this).Owner is PlayerController) { GameActor owner = ((Projectile)this).Owner; BraveInput instanceForPlayer = BraveInput.GetInstanceForPlayer(((PlayerController)((owner is PlayerController) ? owner : null)).PlayerIDX); Vector2 val = (Vector2)(((??)GetOverrideTarget()) ?? ((!instanceForPlayer.IsKeyboardAndMouse(false)) ? ((TwoAxisInputControl)instanceForPlayer.ActiveActions.Aim).Vector : (Vector3Extensions.XY(((PlayerController)/*isinst with value type is only supported in some contexts*/).unadjustedAimPoint) - ((BraveBehaviour)this).specRigidbody.UnitCenter))); float num = Vector2Extensions.ToAngle(val); if (((BraveBehaviour)this).specRigidbody.Velocity != Vector2.zero) { float num2 = Mathf.MoveTowardsAngle(Vector2Extensions.ToAngle(((BraveBehaviour)this).specRigidbody.Velocity), num, trackingSpeed * BraveTime.DeltaTime); ((BraveBehaviour)this).specRigidbody.Velocity = Vector2.op_Implicit(Quaternion.Euler(0f, 0f, num2) * Vector2.op_Implicit(new Vector2(base.baseData.speed, 0f))); ((Projectile)(object)this).ApplyFriction(0.99f); } else { ((BraveBehaviour)this).specRigidbody.Velocity = base.baseData.speed * ((Vector2)(ref val)).normalized; } if (accel > 0f) { ((Projectile)(object)this).Accelerate(accel); } } else { ((BraveBehaviour)this).specRigidbody.Velocity = base.m_currentDirection * base.m_currentSpeed; } ((Projectile)this).LastVelocity = ((BraveBehaviour)this).specRigidbody.Velocity; } private Vector2? FollowTheLeader(Projectile p) { //IL_0013: 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_001e: 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_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) if (Object.op_Implicit((Object)(object)_currentLeader)) { return _currentLeader.SafeCenter - p.SafeCenter; } int num = _ExtantCars.IndexOf(p); if (num == -1) { return null; } for (int num2 = num - 1; num2 >= 0; num2--) { Projectile val = _ExtantCars[num2]; if (Object.op_Implicit((Object)(object)val)) { _currentLeader = val; return _currentLeader.SafeCenter - p.SafeCenter; } } _currentLeader = null; return null; } private Vector2? GetOverrideTarget() { if (overrideTargetFunc == null) { return null; } return overrideTargetFunc((Projectile)(object)this); } } public class Nycterian : CwaffGun { public static string ItemName = "Nycterian"; public static string ShortDescription = "Locate the Echoes"; public static string LongDescription = "Fires bats that occasionally screech while airborne. Screeches have a chance to draw fire from nearby enemies, with the chance decreasing with distance."; public static string Lore = "Bats. Flittery, noisy, but usually not explosive or otherwise as harmful as their Bullat cousins. They're still weighty enough to pack a punch when launched at high velocity, and their incessant screeching can be weaponized as a useful distraction, making them the 7th most effective blind mammalian projectile known to modern ammunition specialists."; internal static GameObject _DistractedVFX; public static void Init() { //IL_03d9: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 20; int? reloadFps = 20; Items? muzzleFrom = Items.Mailbox; Gun gun2 = gun.SetAttributes((ItemQuality)2, (GunClass)1, 1.1f, 325, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "nycterian_shoot_sound", "nycterian_reload_sound", 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); int? clipSize = 10; float? cooldown = 0.3f; float? damage = 7f; float? speed = 18f; float? range = 100f; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "bat_projectile", 12, (Anchor)4, 1.5f)).Attach((Action)delegate(BounceProjModifier bounce) { bounce.numberOfBounces = 1; }, allowDuplicates: false).Attach((Action)delegate(PierceProjModifier pierce) { pierce.penetration = 99; pierce.penetratesBreakables = true; }, allowDuplicates: false) .Attach(); Color? emissiveColour = Color.magenta; _DistractedVFX = VFX.Create("distracted_vfx", 18f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 1f, emissiveColour); } } public class BatProjectile : MonoBehaviour { private const float _ECHO_INIT_DELAY = 0.1f; private const float _ECHO_DELAY = 0.5f; private static readonly Color _BatGray = new Color(0.2f, 0.2f, 0.3f, 1f); private float _timer = 0.1f; private Projectile _proj; private bool _mastered; private void Start() { //IL_008e: 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_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_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) tk2dBaseSprite sprite = ((BraveBehaviour)((Component)this).GetComponent()).sprite; sprite.usesOverrideMaterial = true; Material material = ((BraveBehaviour)sprite).renderer.material; material.shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTintableTiltedCutoutEmissive"); material.SetFloat(CwaffVFX._EmissivePowerId, 3f); material.SetFloat(CwaffVFX._EmissiveColorPowerId, 1.55f); _proj = ((Component)this).gameObject.GetComponent(); EasyTrailBullet easyTrailBullet = ((Component)_proj).gameObject.AddComponent(); easyTrailBullet.StartWidth = 0.2f; easyTrailBullet.EndWidth = 0.125f; easyTrailBullet.LifeTime = 0.25f; easyTrailBullet.BaseColor = _BatGray; easyTrailBullet.StartColor = _BatGray; easyTrailBullet.EndColor = Color.clear; _mastered = _proj.Mastered(); _timer = 0.1f + Random.value * 0.4f; } private void Update() { if (Object.op_Implicit((Object)(object)_proj) && ((Behaviour)_proj).isActiveAndEnabled && !((_timer -= BraveTime.DeltaTime) > 0f)) { _timer = 0.5f; DoEcho(); } } private void DoEcho() { //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_0041: Unknown result type (might be due to invalid IL or missing references) Lazy.CreateDecoy(Vector2.op_Implicit(_proj.SafeCenter)).AddComponent().mastered = _mastered; ((Component)this).gameObject.Play("bat_screech_sound"); Exploder.DoDistortionWave(_proj.SafeCenter, _mastered ? 3f : 1.5f, 0.05f, _mastered ? 5f : 2.75f, 0.25f); } } public class DecoyEcho : MonoBehaviour { private const float _DECOY_TIME = 1f; private const float _DECOY_MIN_DIST = 2f; private const float _DECOY_MAX_DIST = 10f; private RoomHandler _room; public bool mastered; private void Start() { //IL_002b: 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_0054: 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_00fd: 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_010c: 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) //IL_00a0: 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) ((Component)this).gameObject.ExpireIn(1f); RoomHandler roomFromPosition = GameManager.Instance.Dungeon.GetRoomFromPosition(Vector3Extensions.IntXY(((Component)this).transform.position, (VectorConversions)0)); if (roomFromPosition == null) { return; } _room = roomFromPosition; SpeculativeRigidbody component = ((Component)this).gameObject.GetComponent(); foreach (AIActor allNearbyEnemy in component.UnitCenter.GetAllNearbyEnemies()) { if (!mastered) { if (allNearbyEnemy.IsABoss()) { continue; } Vector2 val = Vector3Extensions.XY(((Component)this).transform.position) - ((GameActor)allNearbyEnemy).CenterPosition; float magnitude = ((Vector2)(ref val)).magnitude; if (magnitude > 10f || Mathf.InverseLerp(10f, 2f, magnitude) < Random.value) { continue; } } allNearbyEnemy.OverrideTarget = component; GameObject obj = SpawnManager.SpawnVFX(Nycterian._DistractedVFX, Vector2.op_Implicit(((BraveBehaviour)allNearbyEnemy).sprite.WorldTopCenter + new Vector2(0f, 1f)), Quaternion.identity, true); ((tk2dBaseSprite)obj.GetComponent()).HeightOffGround = 1f; obj.transform.parent = ((BraveBehaviour)((BraveBehaviour)allNearbyEnemy).sprite).transform; obj.AddComponent().Setup(0.15f, 0.1f, 0f, 0.1f, 0.15f, 50f); ((Component)allNearbyEnemy).gameObject.PlayUnique("distracted_sound"); } } private void OnDestroy() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) SpeculativeRigidbody component = ((Component)this).gameObject.GetComponent(); foreach (AIActor allNearbyEnemy in component.UnitCenter.GetAllNearbyEnemies()) { if ((Object)(object)allNearbyEnemy.OverrideTarget == (Object)(object)component) { allNearbyEnemy.OverrideTarget = null; } } } } public class Deadline : CwaffGun { private class FakeExplosion { private const float _END_SCALE = 1.5f; private const float _RPS = 1080f; private GameObject _theExplosionVFX; private float _lifetime; private float _maxLifetime; public FakeExplosion(GameObject go, float maxLifetime) { _theExplosionVFX = go; _maxLifetime = maxLifetime; ((MonoBehaviour)GameManager.Instance).StartCoroutine(Explode()); } private IEnumerator Explode() { while (_lifetime < _maxLifetime) { _lifetime += BraveTime.DeltaTime; float num = 1.5f * (_lifetime / _maxLifetime); _theExplosionVFX.transform.localScale = new Vector3(num, num, num); _theExplosionVFX.transform.rotation = Quaternion.Euler(0f, 0f, 1080f * _lifetime); yield return null; } Object.Destroy((Object)(object)_theExplosionVFX); yield return null; } } private class DeadlineLaser : MonoBehaviour { private const float _GROWTH_TIME = 0.15f; private const float _EXPLOSION_DELAY_MASTERED = 0.4f; private float _length; private float _angle; private GameObject _laserVfx; private Vector3 _ipoint; private Color _color; private float _power; private float _lifeTime; private bool _mastered; public Vector2 start; public Vector2 end; public tk2dTiledSprite laserComp; public Material laserMat; public bool markedForDestruction; public bool dead; public DeadlineLaser Setup(Vector2 p1, Vector2 p2, float angle, bool mastered) { //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_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_0015: 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_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) start = p1; end = p2; _length = 16f * Vector2.Distance(start, end); _angle = angle; _color = Color.red; _power = 0f; _mastered = mastered; UpdateLaser(); return this; } public void UpdateEndPoint(Vector2 newEnd, bool andUpdate = true) { //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_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) end = newEnd; _length = 16f * Vector2.Distance(start, end); if (andUpdate) { UpdateLaser(); } } public void InitiateDeathSequenceAt(Vector3 ipoint, bool explode, float timer) { //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) if (!markedForDestruction) { markedForDestruction = true; _ipoint = ipoint; ((MonoBehaviour)GameManager.Instance).StartCoroutine(ExplodeViolentlyAt(explode, timer)); } } private void Update() { float value = 200f + 400f * Mathf.Abs(Mathf.Sin(16f * BraveTime.ScaledTimeSinceStartup)); float? emissivePower = value; UpdateLaser(null, emissivePower); } public void UpdateLaser(Color? color = null, float? emissivePower = null) { //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_0087: 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_00ed: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_0148: 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_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0185: 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_018b: Unknown result type (might be due to invalid IL or missing references) if (!dead) { _lifeTime += BraveTime.DeltaTime; float num = _length * Mathf.Min(1f, _lifeTime / 0.15f); bool flag = false; if (color.HasValue) { _color = color.Value; flag = true; } if (emissivePower.HasValue) { _power = emissivePower.Value; } if (flag || (Object)(object)_laserVfx == (Object)null) { _laserVfx.SafeDestroy(); _laserVfx = VFX.CreateLaserSight(start, num, 1f, _angle, _color, _power); laserComp = _laserVfx.GetComponent(); laserMat = ((BraveBehaviour)((BraveBehaviour)laserComp).sprite).renderer.material; } else { laserComp.dimensions = new Vector2(num, 1f); laserMat.SetFloat(CwaffVFX._EmissivePowerId, _power); } if (!markedForDestruction && _mastered && Lazy.NearestEnemyInLineOfSight(out var ipoint, start, start + _angle.ToVector(num)) != null) { UpdateEndPoint(ipoint, andUpdate: false); InitiateDeathSequenceAt(Vector2Extensions.ToVector3ZisY(ipoint, -1f), explode: true, 0.4f); ((Component)ETGModMainBehaviour.Instance).gameObject.Play("gaster_blaster_sound_effect_short"); new FakeExplosion(Object.Instantiate(_SplodeVFX, Vector2.op_Implicit(ipoint), Quaternion.identity), 0.4f); } } } private IEnumerator ExplodeViolentlyAt(bool explode, float timer) { UpdateLaser(Color.cyan); yield return (object)new WaitForSeconds(timer); if (explode) { Exploder.Explode(_ipoint, _DeadlineExplosion, Vector2.zero, (Action)null, false, (CoreDamageTypes)0, false); } DestroyLaser(); yield return null; } private void DestroyLaser() { dead = true; markedForDestruction = true; Object.Destroy((Object)(object)_laserVfx); _laserVfx = null; } public Vector2? Intersects(DeadlineLaser other) { //IL_0001: 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_000d: 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_002b: Unknown result type (might be due to invalid IL or missing references) Vector2 value = default(Vector2); if (!BraveUtility.LineIntersectsLine(start, end, other.start, other.end, ref value)) { return null; } return value; } } public static string ItemName = "Deadline"; public static string ShortDescription = "Mission Improbable"; public static string LongDescription = "Projectiles spawn lasers upon colliding with walls. If two of these lasers intersect, a large explosion is created at the point of intersection."; public static string Lore = "Not intended to be a weapon at all, this gun was used primarily as a tool for setting up dodge roll training rooms for newbie Gungeoneers. After an accidental crossing of the beams (an act generally known not to be a great idea) left seven injured, the engineer responsible for designing the tool publicly apologized for the incident. Immediately afterwards, he returned to a private meeting room with his colleagues, who unanimously agreed the explosion was freakin' awesome. High fives and fist bumps were promptly exchanged all around."; private const float _SIGHT_WIDTH = 2f; private const float _EXPLOSION_DELAY = 1f; internal static ExplosionData _DeadlineExplosion = null; internal static GameObject _SplodeVFX; private static List _MyLasers = new List(); private GameObject _myLaserSight; private GameObject _debugLaserSight; internal static Color _Green = Color.green; internal static Color _Red = Color.red; private const int _RAYCAST_SPREAD = 1; public static void Init() { //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Expected O, but got Unknown //IL_0458: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? idleFps = 10; int? shootFps = 20; int? reloadFps = 30; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)15, 0.9f, 200, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, idleFps, shootFps, reloadFps, null, null, "deadline_fire_sound", "deadline_reload_sound", null, -1, -1, -1, null, modulesAreTiers: false, "muzzle_deadline", 20, 0.4f, (Anchor)4, -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).AddToShop(ModdedShopType.TimeTrader).AddToShop(ModdedShopType.Boomhildr); int? clipSize = 8; float? cooldown = 0.4f; float? angleVariance = 0f; float? speed = 60f; float? range = 30f; bool? collidesWithEnemies = false; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, null, speed, null, range, null, 0f, 0f, 0f, 0f, collidesWithEnemies, null, null, null, null, "deadline_projectile", 2, (Anchor)3)).Attach().Attach((Action)delegate(EasyTrailBullet trail) { //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_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_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) trail.TrailPos = ((BraveBehaviour)trail).transform.position; trail.StartWidth = 0.2f; trail.EndWidth = 0f; trail.LifeTime = 0.1f; trail.BaseColor = Color.green; trail.EndColor = Color.green; }, allowDuplicates: false); _DeadlineExplosion = Explosions.DefaultLarge.With(100f, 30f, 100f, 3f); _DeadlineExplosion.ss = new ScreenShakeSettings { magnitude = 0.5f, speed = 1.5f, time = 1f, falloff = 0f, direction = Vector2.zero, vibrationType = (VibrationType)10, simpleVibrationStrength = (Strength)10, simpleVibrationTime = (Time)5 }; Color? emissiveColour = Color.cyan; _SplodeVFX = VFX.Create("splode", 18f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 100f, emissiveColour); } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); EnableLaserSight(); } public override void OnSwitchedAwayFromThisGun() { DisableLaserSights(); base.OnSwitchedAwayFromThisGun(); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); EnableLaserSight(); } public override void OnDroppedByPlayer(PlayerController player) { DisableLaserSights(); base.OnDroppedByPlayer(player); } public override void OnDestroy() { DisableLaserSights(); base.OnDestroy(); } private void EnableLaserSight() { //IL_001f: 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_003e: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_myLaserSight)) { _myLaserSight = VFX.CreateLaserSight(Vector2.op_Implicit(((Component)((GunBehaviour)this).gun.barrelOffset).transform.position), 1f, 2f, ((GunBehaviour)this).gun.CurrentAngle, Color.cyan, 50f); _myLaserSight.transform.parent = ((Component)((GunBehaviour)this).gun.barrelOffset).transform; UpdateLaserSight(); } } private void DisableLaserSights() { _myLaserSight.SafeDestroy(); _myLaserSight = null; _debugLaserSight.SafeDestroy(); _debugLaserSight = null; } private void UpdateLaserSight() { //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_0044: 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_00c3: 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_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) if (Object.op_Implicit((Object)(object)_myLaserSight)) { int num = CollisionMask.LayerToMask((CollisionLayer)6); RaycastResult val = default(RaycastResult); if (!PhysicsEngine.Instance.Raycast(Vector3Extensions.XY(((Component)((GunBehaviour)this).gun.barrelOffset).transform.position), ((GunBehaviour)this).gun.CurrentAngle.ToVector(), 999f, ref val, true, false, num, (CollisionLayer?)null, false, (Func)null, (SpeculativeRigidbody)null)) { RaycastResult.Pool.Free(ref val); return; } float num2 = 16f * val.Distance; _ = ((CastResult)val).Contact; RaycastResult.Pool.Free(ref val); ((BraveBehaviour)((GunBehaviour)this).gun).sprite.ForceRotationRebuild(); tk2dTiledSprite component = _myLaserSight.GetComponent(); ((BraveBehaviour)component).renderer.enabled = true; component.dimensions = new Vector2(num2, 2f); _myLaserSight.transform.rotation = ((GunBehaviour)this).gun.CurrentAngle.EulerZ(); _myLaserSight.transform.parent = ((GunBehaviour)this).gun.barrelOffset; _myLaserSight.transform.localPosition = Vector2.op_Implicit(Vector2.zero); ((tk2dBaseSprite)component).ForceRotationRebuild(); ((tk2dBaseSprite)component).UpdateZDepth(); MakeLaserMatchGunSpriteColor(component); } } private void MakeLaserMatchGunSpriteColor(tk2dTiledSprite sprite) { //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_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_00ad: 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) int currentFrame = ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.CurrentFrame; string name = ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.CurrentClip.name; float num = 0f; switch (name) { default: return; case "deadline_idle": num = 1f - 0.1f * (float)Mathf.Abs(10 - currentFrame); break; case "deadline_reload": num = 0.1f * (float)((currentFrame < 11) ? currentFrame : (21 - currentFrame)); break; case "deadline_fire": num = 0f; break; } Color val = Color.Lerp(_Green, _Red, num); ((BraveBehaviour)sprite).renderer.material.SetColor(CwaffVFX._OverrideColorId, val); ((BraveBehaviour)sprite).renderer.material.SetColor(CwaffVFX._EmissiveColorId, val); } private void LateUpdate() { if (!Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { return; } if (((GunBehaviour)this).PlayerOwner.m_hideGunRenderers.Value) { if (Object.op_Implicit((Object)(object)_debugLaserSight)) { ((BraveBehaviour)_debugLaserSight.GetComponent()).renderer.enabled = false; } if (Object.op_Implicit((Object)(object)_myLaserSight)) { ((BraveBehaviour)_myLaserSight.GetComponent()).renderer.enabled = false; } } else { EnableLaserSight(); UpdateLaserSight(); } } public void GetSpeculativeLaserEndpoints(out Vector2? start, out Vector2? end) { //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) GetSpeculativeLaserEndpoints(Vector3Extensions.XY(((Component)((GunBehaviour)this).gun.barrelOffset).transform.position), ((GunBehaviour)this).gun.CurrentAngle, out start, out end); } public static void GetSpeculativeLaserEndpoints(Vector2 from, float towardsAngle, out Vector2? start, out Vector2? end) { //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_0056: 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_0072: 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_00ac: 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_00b1: 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_00c4: 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_00e8: 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_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_012b: 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_010c: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_0116: Unknown result type (might be due to invalid IL or missing references) //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_0165: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: 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) //IL_0188: 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_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: 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_01a9: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: 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_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) int num = CollisionMask.LayerToMask((CollisionLayer)6); RaycastResult val = default(RaycastResult); if (!PhysicsEngine.Instance.Raycast(from, towardsAngle.ToVector(), 999f, ref val, true, false, num, (CollisionLayer?)null, false, (Func)null, (SpeculativeRigidbody)null)) { start = null; end = null; RaycastResult.Pool.Free(ref val); return; } start = ((CastResult)val).Contact; Vector2 normal = ((CastResult)val).Normal; Vector2 val2 = (PhysicsEngine.Instance.Raycast(from, (towardsAngle + 1f).ToVector(), 999f, ref val, true, false, num, (CollisionLayer?)null, false, (Func)null, (SpeculativeRigidbody)null) ? ((CastResult)val).Normal : Vector2.zero); Vector2 val3 = (PhysicsEngine.Instance.Raycast(from, (towardsAngle - 1f).ToVector(), 999f, ref val, true, false, num, (CollisionLayer?)null, false, (Func)null, (SpeculativeRigidbody)null) ? ((CastResult)val).Normal : Vector2.zero); RaycastResult.Pool.Free(ref val); Vector2 val4 = ((!(normal == val2) && !(normal == val3) && !(val2 != val3) && !(val2 == Vector2.zero)) ? val2 : normal); Vector2? val5 = start; Vector2 val6 = towardsAngle.ToVector(0.0625f); start = (val5.HasValue ? new Vector2?(val5.GetValueOrDefault() - val6) : ((Vector2?)null)); float num2 = Vector2Extensions.ToAngle(val4).Clamp360(); end = (start.Value + val4).ToNearestWall(out var normal2, num2, 0.01f); if (normal2 != -val4) { start = null; end = null; } else { val5 = end; val6 = num2.ToVector(0.0625f); end = (val5.HasValue ? new Vector2?(val5.GetValueOrDefault() - val6) : ((Vector2?)null)); } } private void DrawSpeculativeLaser() { //IL_0039: 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_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_00cd: 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_00ea: 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_0097: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) GetSpeculativeLaserEndpoints(out var start, out var end); if (!start.HasValue) { if (Object.op_Implicit((Object)(object)_debugLaserSight)) { ((BraveBehaviour)_debugLaserSight.GetComponent()).renderer.enabled = false; } return; } Vector2 val = end.Value - start.Value; if (Object.op_Implicit((Object)(object)_debugLaserSight)) { tk2dTiledSprite component = _debugLaserSight.GetComponent(); ((BraveBehaviour)component).renderer.enabled = true; component.dimensions = new Vector2(16f * ((Vector2)(ref val)).magnitude, 2f); _debugLaserSight.transform.rotation = val.EulerZ(); _debugLaserSight.transform.position = Vector2.op_Implicit(start.Value); ((tk2dBaseSprite)component).ForceRotationRebuild(); ((tk2dBaseSprite)component).UpdateZDepth(); } else { _debugLaserSight = VFX.CreateLaserSight(start.Value, 16f * ((Vector2)(ref val)).magnitude, 2f, Vector2Extensions.ToAngle(val), Color.magenta); _debugLaserSight.SetAlpha(0.3f); } } public static void CreateALaser(Vector2 start, Vector2 end, bool mastered) { //IL_0005: 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_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) _MyLasers.Add(new GameObject().AddComponent().Setup(start, end, Vector2Extensions.ToAngle(end - start), mastered)); CheckForLaserIntersections(); } public static void CheckForLaserIntersections() { //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_00aa: 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_00d2: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_0069: 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_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) if (_MyLasers.Count < 2) { return; } float num = 9999f; int num2 = -1; Vector2 val = Vector2.zero; DeadlineLaser deadlineLaser = _MyLasers[_MyLasers.Count - 1]; for (int i = 0; i < _MyLasers.Count - 1; i++) { if (_MyLasers[i].markedForDestruction) { continue; } Vector2? val2 = deadlineLaser.Intersects(_MyLasers[i]); if (val2.HasValue) { float num3 = Vector2.Distance(deadlineLaser.start, val2.Value); if (!(num3 >= num)) { num = num3; num2 = i; val = val2.Value; } } } if (num2 >= 0) { deadlineLaser.UpdateEndPoint(val); deadlineLaser.InitiateDeathSequenceAt(Vector2.op_Implicit(Vector2.zero), explode: false, 1f); _MyLasers[num2].InitiateDeathSequenceAt(Vector2Extensions.ToVector3ZisY(val, -1f), explode: true, 1f); ((Component)ETGModMainBehaviour.Instance).gameObject.Play("gaster_blaster_sound_effect"); new FakeExplosion(Object.Instantiate(_SplodeVFX, Vector2.op_Implicit(val), Quaternion.identity), 1f); } for (int num4 = _MyLasers.Count - 1; num4 >= 0; num4--) { if (_MyLasers[num4].dead) { _MyLasers.RemoveAt(num4); } } } } public class DeadlineProjectile : MonoBehaviour { private void Start() { //IL_0018: 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_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) Projectile component = ((Component)this).GetComponent(); GameActor owner = component.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null) { Deadline.GetSpeculativeLaserEndpoints(component.SafeCenter, Vector2Extensions.ToAngle(component.Direction), out var start, out var end); if (start.HasValue) { Deadline.CreateALaser(start.Value, end.Value, val.HasSynergy(Synergy.MASTERY_DEADLINE)); component.DieInAir(false, true, true, false); } } } } public class RacketLauncher : CwaffGun { public static string ItemName = "Racket Launcher"; public static string ShortDescription = "Paddle to the Metal"; public static string LongDescription = "Serves a tennis ball that bounces off of walls, enemies, projectiles, and other obstructions. The ball can be volleyed repeatedly and increases in power, speed, and knockback with each successive volley."; public static string Lore = "The amount of speed, dexterity, and awareness required to play table tennis at the highest level is staggering to some when they first learn about it. The Racket takes patience and practice to wield to its full potential, but those willing to invest time honing their skills with it will be able to fearlessly return the most lethal of volleys with a Smile on their face."; internal const float _MAX_REFLECT_DISTANCE = 5f; internal const float _MAX_REFLECT_DISTANCE_MASTERED = 7f; internal const int _IDLE_FPS = 24; internal const int _AMMO = 100; private List _extantTennisBalls = new List(); public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? idleFps = 24; int? shootFps = 60; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)50, 0f, 100, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: true, null, idleFps, shootFps, 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, autoPlay: false); int? clipSize = -1; float? cooldown = 0.1f; bool? preventOrbiting = true; float? damage = 10f; float? speed = 20f; float? range = 300f; float? force = 12f; bool? surviveRigidbodyCollisions = true; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, null, surviveRigidbodyCollisions, null, "tennis_ball", 12, (Anchor)4, 0.6f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, preventOrbiting)).Attach((Action)delegate(BounceProjModifier bounce) { bounce.numberOfBounces = 9999; bounce.chanceToDieOnBounce = 0f; bounce.onlyBounceOffTiles = false; bounce.ExplodeOnEnemyBounce = false; }, allowDuplicates: false).Attach(); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); GunExt.SetAnimationFPS(((GunBehaviour)this).gun, ((GunBehaviour)this).gun.idleAnimation, 24); ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.Play(); } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); GunExt.SetAnimationFPS(((GunBehaviour)this).gun, ((GunBehaviour)this).gun.idleAnimation, 0); ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.StopAndResetFrameToDefault(); } public override void OnTriedToInitiateAttack(PlayerController player) { //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_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_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_0079: 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) base.OnTriedToInitiateAttack(player); if (_extantTennisBalls.Count == 0 && ((GunBehaviour)this).gun.CurrentAmmo > 0) { return; } Vector2 centerPosition = ((GameActor)player).CenterPosition; float num = (base.Mastered ? 7f : 5f); TennisBall tennisBall = null; float num2 = num; foreach (TennisBall extantTennisBall in _extantTennisBalls) { if (extantTennisBall.Whackable()) { Vector2 val = extantTennisBall.Position() - centerPosition; float magnitude = ((Vector2)(ref val)).magnitude; float num3 = Vector2Extensions.ToAngle(val); if (magnitude < num2 && Mathf.Abs(num3 - ((GunBehaviour)this).gun.CurrentAngle) < 90f) { num2 = magnitude; tennisBall = extantTennisBall; } } } if (Object.op_Implicit((Object)(object)tennisBall)) { tennisBall.GotWhacked(((GunBehaviour)this).gun.CurrentAngle.ToVector()); } else if (base.Mastered) { return; } ((BraveBehaviour)this).spriteAnimator.PlayFromFrame(((GunBehaviour)this).gun.shootAnimation, 0); player.SuppressThisClick = true; } public override void OnPostFired(PlayerController player, Gun gun) { ((GunBehaviour)this).OnPostFired(player, gun); player.StopFiringImmediately(); } public override void OnAmmoChanged(PlayerController player, Gun gun) { ((GunBehaviour)this).OnAmmoChanged(player, gun); gun.ClipShotsRemaining = gun.CurrentAmmo; } public void AddExtantTennisBall(TennisBall tennisBall) { _extantTennisBalls.Add(tennisBall); } public void RemoveExtantTennisBall(TennisBall tennisBall) { _extantTennisBalls.Remove(tennisBall); } } public class TennisBall : MonoBehaviour { private const float _RETURN_HOMING_STRENGTH = 0.1f; private const float _SPREAD = 10f; private const float _MAX_DEVIATION = 30f; private const int _MAX_VOLLEYS = 16; private const float _MAX_SPEED_BOOST = 50f; private const float _MAX_DAMAGE_BOOST = 20f; private const float _MAX_FORCE_BOOST = 10f; private Projectile _projectile; private PlayerController _owner; private int _volleys; private bool _returning; private bool _missedPlayer; private bool _dead; private bool _dieNextFrame; private RacketLauncher _parentGun; private EasyTrailBullet _trail; private float _baseSpeed; private float _baseDamage; private float _baseForce; private BounceProjModifier _bounce; private Vector2 _deathVelocity = Vector2.zero; private void Start() { //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: 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: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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 _projectile = ((Component)this).GetComponent(); GameActor owner = _projectile.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null) { _owner = val; _projectile.DestroyMode = (ProjectileDestroyMode)1; if (Object.op_Implicit((Object)(object)(_parentGun = val.FindGun()))) { _parentGun.AddExtantTennisBall(this); _projectile.BulletScriptSettings.surviveRigidbodyCollisions = true; _projectile.collidesWithProjectiles = true; _projectile.collidesOnlyWithPlayerProjectiles = false; _projectile.UpdateCollisionMask(); SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(ReflectProjectiles)); SpeculativeRigidbody specRigidbody2 = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody2.OnRigidbodyCollision = (OnRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody2.OnRigidbodyCollision, (Delegate?)new OnRigidbodyCollisionDelegate(OnRigidbodyCollision)); _projectile.OnDestruction += OnDestruction; ((Component)_projectile).gameObject.Play("monkey_tennis_hit_serve"); } _bounce = ((Component)_projectile).gameObject.GetComponent(); _bounce.OnBounce += ReturnToSender; _trail = ((Component)_projectile).gameObject.AddComponent(); _trail.StartWidth = 0.2f; _trail.EndWidth = 0.1f; _trail.LifeTime = 0.1f; _trail.BaseColor = ExtendedColours.lime; _trail.StartColor = ExtendedColours.lime; _trail.EndColor = Color.green; _baseSpeed = _projectile.baseData.speed; _baseDamage = _projectile.baseData.damage; _baseForce = _projectile.baseData.force; } } private void OnRigidbodyCollision(CollisionData rigidbodyCollision) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) _projectile.SendInDirection(((CastResult)rigidbodyCollision).Normal, false, true); ReturnToSender(); } private void OnDestruction(Projectile p) { if (Object.op_Implicit((Object)(object)_parentGun)) { TennisBall component = ((Component)p).GetComponent(); if (component != null) { _parentGun.RemoveExtantTennisBall(component); } } } private void ReflectProjectiles(SpeculativeRigidbody myRigidbody, PixelCollider myCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherCollider) { Projectile component = ((Component)otherRigidbody).GetComponent(); if (component != null) { if (_returning || component.Owner is PlayerController) { PhysicsEngine.SkipCollision = true; return; } PassiveReflectItem.ReflectBullet(component, true, ((BraveBehaviour)_owner).gameActor, 10f, 1f, 1f, 0f); PhysicsEngine.SkipCollision = true; ReturnToSender(); } } public Vector2 Position() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _projectile.SafeCenter; } public void DieInAir() { //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_0016: 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) _deathVelocity = 0.5f * _projectile.LastVelocity; DebrisObject orAddComponent = GameObjectExtensions.GetOrAddComponent(((Component)this).gameObject); orAddComponent.angularVelocity = 45f; orAddComponent.angularVelocityVariance = 20f; orAddComponent.decayOnBounce = 0.5f; orAddComponent.bounceCount = 4; orAddComponent.canRotate = true; orAddComponent.shouldUseSRBMotion = true; ((BraveBehaviour)orAddComponent).sprite = ((BraveBehaviour)_projectile).sprite; orAddComponent.animatePitFall = true; orAddComponent.audioEventName = "monkey_tennis_bounce_first"; orAddComponent.AssignFinalWorldDepth(-0.5f); orAddComponent.Trigger(Vector2.op_Implicit(_deathVelocity), 0.5f, 1f); ((BraveBehaviour)orAddComponent).spriteAnimator.Stop(); Object.Destroy((Object)(object)((Component)orAddComponent).GetComponent()); Object.Destroy((Object)(object)((Component)orAddComponent).GetComponent()); _dead = true; ((Component)_projectile).gameObject.Play("monkey_tennis_bounce_second"); _projectile.DieInAir(true, true, true, false); Object.Destroy((Object)(object)this); } public bool Whackable() { return _returning; } public void GotWhacked(Vector2 direction) { //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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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) if (_returning) { _volleys = Mathf.Min(_volleys + 1, 16); float num = (float)_volleys / 16f; _projectile.baseData.speed = _baseSpeed + 50f * num; _projectile.baseData.damage = _baseDamage + 20f * num; _projectile.baseData.force = _baseForce + 10f * num; _trail.LifeTime = 0.1f + (float)_volleys * 0.02f; Color val = Color.Lerp(ExtendedColours.lime, Color.red, 0.1f * (float)_volleys); _trail.BaseColor = val; _trail.StartColor = val; _trail.UpdateTrail(); _returning = false; _missedPlayer = false; _projectile.Speed = _projectile.baseData.speed; _projectile.SendInDirection(direction, true, true); ((Component)_projectile).gameObject.Play("monkey_tennis_hit_return_mid"); if (_volleys > 6) { ((Component)_projectile).gameObject.Play("sonic_olympic_smash"); } else if (_volleys > 3) { ((Component)_projectile).gameObject.Play("sonic_olympic_sidespin"); } } } private IEnumerator DieNextFrame() { yield return null; if (Object.op_Implicit((Object)(object)this) && Object.op_Implicit((Object)(object)_projectile)) { DieInAir(); } } private void ReturnToSender() { //IL_0046: 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_008a: Unknown result type (might be due to invalid IL or missing references) if (!_dead) { if (_returning && !_dieNextFrame) { _dieNextFrame = true; Object.Destroy((Object)(object)_bounce); ((MonoBehaviour)this).StartCoroutine(DieNextFrame()); } else { _returning = true; float angle = Vector2Extensions.ToAngle(((GameActor)_owner).CenterPosition - _projectile.SafeCenter); float num = _owner.AccuracyMult(); _projectile.SendInDirection(angle.AddRandomSpread(10f * Mathf.Sqrt(num)).ToVector(), true, true); ((Component)_projectile).gameObject.Play("racket_hit"); } } } private void HomeTowardsTarget(Vector2 targetPos, Vector2 curVelocity) { //IL_0000: 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_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_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_0052: 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_005d: 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_006f: 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_002d: Unknown result type (might be due to invalid IL or missing references) Vector2 val = targetPos - _projectile.SafeCenter; Vector2 normalized = ((Vector2)(ref val)).normalized; if (_returning && Mathf.Abs(Vector2Extensions.ToAngle(curVelocity).Clamp360() - Vector2Extensions.ToAngle(normalized).Clamp360()) > 30f) { _missedPlayer = true; return; } Vector2 val2 = 0.1f * normalized + 0.9f * curVelocity; _projectile.SendInDirection(val2, false, true); } private void Update() { //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_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_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_006f: 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_004e: 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) if (_dead || _missedPlayer || !Object.op_Implicit((Object)(object)_projectile)) { return; } Vector2 lastVelocity = _projectile.LastVelocity; Vector2 normalized = ((Vector2)(ref lastVelocity)).normalized; if (_returning) { if (Object.op_Implicit((Object)(object)_owner)) { HomeTowardsTarget(((GameActor)_owner).CenterPosition, normalized); } return; } AIActor val = Vector2.op_Implicit(((BraveBehaviour)_projectile).transform.position).NearestEnemyWithinConeOfVision(Vector2Extensions.ToAngle(normalized).Clamp360(), 30f); if (Object.op_Implicit((Object)(object)val)) { HomeTowardsTarget(((GameActor)val).CenterPosition, normalized); } } } public class Chroma : CwaffGun { private class ChromaAmmoDisplay : CustomAmmoDisplay { private Gun _gun; private Chroma _chroma; private PlayerController _owner; private string _ammoText = ""; private void Start() { _gun = ((Component)this).GetComponent(); _chroma = ((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) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_owner)) { return false; } if (_chroma._ammoDisplayDirty) { int[] pigmentPowers = _chroma._pigmentPowers; string text = ((_gun.CurrentStrengthTier < 3) ? PigmentDrop._HexPrimaries[_gun.CurrentStrengthTier] : ColorUtility.ToHtmlStringRGB(_chroma._cachedTribeamColor)); _ammoText = $"[sprite \"pigment_red_ui{1 + pigmentPowers[0]}\"] [sprite \"pigment_green_ui{1 + pigmentPowers[1]}\"] [sprite \"pigment_blue_ui{1 + pigmentPowers[2]}\"] \n[color #{text}]"; } uic.GunAmmoCountLabel.Text = _ammoText + CustomAmmoDisplayExtensions.VanillaAmmoDisplay(_owner) + "[/color]"; return true; } } public static string ItemName = "Chroma"; public static string ShortDescription = "Spectroscopic"; public static string LongDescription = "Fires beams that extract pigment from enemies. Reloading cycles through red, green, and blue beams, which gain power from their respective pigments. Each beam is most effective at extracting the next pigment in the cycle (e.g., red > green > blue > red), and deals increased or reduced damage depending on the presence of that pigment in the enemy."; public static string Lore = "A device designed for extracting pigment-containing compounds from inorganic materials for the purpose of high-end nail polish production. Retail models have a carbon scanner preventing the beams from firing at organic material, but removing the scanner is trivial and makes for a bizarrely effective weapon in a pinch."; private const float _BASE_PARTICLE_RATE = 0.5f; private const float _PER_LEVEL_PARTICLE_RATE = 0.05f; private const float _TRIBEAM_COLOR_CYCLE_SPEED = 10f; internal static GameObject _PigmentPrefab = null; public int redPigment; public int greenPigment; public int bluePigment; internal Color _cachedTribeamColor; private readonly int[] _pigmentPowers = new int[4]; private bool _ammoDisplayDirty = true; private Material _cachedTribeamMat; private float _lastParticleSpawn; private const int _MAX_PIGMENT_LEVEL = 10; private static readonly int[] _LEVELS = new int[10] { 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 9999999 }; public static void Init() { //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? idleFps = 20; int? shootFps = 60; gun.SetAttributes((ItemQuality)3, (GunClass)20, 0f, 600, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, idleFps, shootFps, null, null, null, null, null, null, -1, -1, -1, null, modulesAreTiers: true, 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).Attach((Action)null, allowDuplicates: false).AssignGun(out Gun gunRef) .InitProjectile(GunData.New(null, Items.Moonscraper.Projectile(), -1, 0.18f, damage: 7f, speed: -1f, angleVariance: 0f, shootStyle: (ShootStyle)2, sequenceStyle: (ProjectileSequenceStyle)0, chargeTime: 0f, ammoCost: 5, ammoType: null, customClip: false, force: null, range: null, recoil: null, poison: 0f, fire: 0f, freeze: 0f, slow: 0f, collidesWithEnemies: null, ignoreDamageCaps: null, collidesWithProjectiles: null, surviveRigidbodyCollisions: null, collidesWithTilemap: null, sprite: null, fps: 2, anchor: (Anchor)4, scale: 1f, anchorsChangeColliders: true, fixesScales: true, overrideColliderPixelSizes: null, overrideColliderOffsets: null, bossDamageMult: 1f, destroySound: null, shouldRotate: null, barrageSize: 1, shouldFlipHorizontally: null, shouldFlipVertically: null, useDummyChargeModule: false, invisibleProjectile: false, spawnSound: null, stopSoundOnDeath: null, uniqueSounds: null, shrapnelVFX: null, shrapnelCount: null, shrapnelMinVelocity: null, shrapnelMaxVelocity: null, shrapnelLifetime: null, preventOrbiting: null, hitSound: null, hitEnemySound: null, hitWallSound: null, becomeDebris: null, angleFromAim: 0f, ignoredForReloadPurposes: false, mirror: false, electric: null, burstCooldown: null, preventSparks: null, pierceBreakables: null, collidesOnlyWithPlayerProjectiles: null, pierceInternalWalls: null, doBeamSetup: null, beamSprite: "chroma_beam", beamFps: 60, beamStartFps: -1, beamEndFps: -1, beamChargeFps: 8, beamMuzzleFps: -1, beamImpactFps: 30, beamLoopCharge: false, beamEmission: 1500f, beamReflections: 0, beamChargeDelay: 0f)) .Attach(); string[] array = new string[4] { "chroma_red", "chroma_green", "chroma_blue", "chroma_tri" }; for (int i = 0; i < 4; i++) { ProjectileModule val = ((i > 0) ? gunRef.DuplicateDefaultModule() : gunRef.DefaultModule); val.SetupCustomAmmoClip(array[i]); if (i == 3) { val.ammoCost *= 2; } Projectile obj = val.projectiles[0]; ((Component)obj).GetComponent()._pigment = (PigmentType)i; BasicBeamController component = ((Component)obj).gameObject.GetComponent(); Color val2 = PigmentDrop._Primaries[i]; Material material = ((BraveBehaviour)((BraveBehaviour)component).sprite).renderer.material; material.DisableKeyword("BRIGHTNESS_CLAMP_ON"); material.EnableKeyword("BRIGHTNESS_CLAMP_OFF"); material.SetFloat(CwaffVFX._EmissiveColorPowerId, 8f); material.SetColor(CwaffVFX._EmissiveColorId, val2); material.SetColor(CwaffVFX._OverrideColorId, Color.Lerp(val2, Color.white, 0.5f)); } _PigmentPrefab = VFX.Create("pigment_ball_white_small", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1).Attach(); } public override void OnReloadPressed(PlayerController player, Gun gun, bool manualReload) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) base.OnReloadPressed(player, gun, manualReload); if (manualReload && player.AcceptingNonMotionInput) { bool isFiring = gun.IsFiring; ((GunBehaviour)this).gun.CurrentStrengthTier = (((GunBehaviour)this).gun.CurrentStrengthTier + 1) % (base.Mastered ? 4 : 3); if (isFiring) { gun.CeaseAttack(true, (ProjectileData)null); } _ammoDisplayDirty = true; UpdateBeamShaders(); ClearCachedShootData(); if (isFiring) { gun.Attack((ProjectileData)null, (GameObject)null); } } } private void UpdateBeamShaders() { int currentStrengthTier = ((GunBehaviour)this).gun.CurrentStrengthTier; ((BraveBehaviour)((BraveBehaviour)((Component)((GunBehaviour)this).gun.DefaultModule.projectiles[0]).GetComponent()).sprite).renderer.material.SetFloat(CwaffVFX._EmissivePowerId, 300f * (float)(1 + _pigmentPowers[currentStrengthTier])); } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); RecalculateAllPigmentPowers(); UpdateBeamShaders(); ClearCachedShootData(); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); foreach (AIActor allEnemy in StaticReferenceManager.AllEnemies) { OnEnemySpawn(allEnemy); } AIActor.OnPreStart = (Action)Delegate.Remove(AIActor.OnPreStart, new Action(OnEnemySpawn)); AIActor.OnPreStart = (Action)Delegate.Combine(AIActor.OnPreStart, new Action(OnEnemySpawn)); CwaffEvents.OnCorpseCreated = (Action)Delegate.Remove(CwaffEvents.OnCorpseCreated, new Action(TransferDesaturatedShadersToCorpse)); CwaffEvents.OnCorpseCreated = (Action)Delegate.Combine(CwaffEvents.OnCorpseCreated, new Action(TransferDesaturatedShadersToCorpse)); RecalculateAllPigmentPowers(); UpdateBeamShaders(); ClearCachedShootData(); } private static void TransferDesaturatedShadersToCorpse(DebrisObject debris, AIActor original) { Desaturator component = ((Component)original).GetComponent(); if (component == null) { return; } tk2dSprite component2 = ((Component)debris).gameObject.GetComponent(); if (component2 != null) { ((tk2dBaseSprite)component2).usesOverrideMaterial = true; Material material = ((BraveBehaviour)component2).renderer.material; material.shader = CwaffShaders.DesatShader; material.SetFloat(CwaffVFX._SaturationId, component._saturation); if ((Object)(object)original.optionalPalette != (Object)null) { material.SetFloat("_UsePalette", 1f); material.SetTexture("_PaletteTex", (Texture)(object)original.optionalPalette); } } } private void OnEnemySpawn(AIActor enemy) { GameObjectExtensions.GetOrAddComponent(((Component)enemy).gameObject); } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); AIActor.OnPreStart = (Action)Delegate.Remove(AIActor.OnPreStart, new Action(OnEnemySpawn)); CwaffEvents.OnCorpseCreated = (Action)Delegate.Remove(CwaffEvents.OnCorpseCreated, new Action(TransferDesaturatedShadersToCorpse)); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { AIActor.OnPreStart = (Action)Delegate.Remove(AIActor.OnPreStart, new Action(OnEnemySpawn)); CwaffEvents.OnCorpseCreated = (Action)Delegate.Remove(CwaffEvents.OnCorpseCreated, new Action(TransferDesaturatedShadersToCorpse)); } base.OnDestroy(); } public override void Update() { //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_0088: 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_008f: 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_00ac: 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_00b7: 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_0117: Invalid comparison between Unknown and I4 base.Update(); if (!Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { return; } if (((GunBehaviour)this).gun.CurrentStrengthTier == 3) { float num = 10f * BraveTime.ScaledTimeSinceStartup; if ((Object)(object)_cachedTribeamMat == (Object)null) { _cachedTribeamMat = ((BraveBehaviour)((BraveBehaviour)((Component)((GunBehaviour)this).gun.DefaultModule.projectiles[0]).GetComponent()).sprite).renderer.material; } Color val = (_cachedTribeamColor = Color.HSVToRGB(num - Mathf.Floor(num), 0.75f, 1f)); _cachedTribeamMat.SetColor(CwaffVFX._EmissiveColorId, val); _cachedTribeamMat.SetColor(CwaffVFX._OverrideColorId, Color.Lerp(val, Color.white, 0.5f)); _ammoDisplayDirty = true; } if (!((GunBehaviour)this).PlayerOwner.AcceptingNonMotionInput) { return; } ((MonoBehaviour)(object)((GunBehaviour)this).gun).LoopSoundIf(((GunBehaviour)this).gun.IsFiring, "chroma_fire_sound"); if (((GunBehaviour)this).gun.IsFiring) { BeamController extantBeam = GetExtantBeam(); BasicBeamController val2 = (BasicBeamController)(object)((extantBeam is BasicBeamController) ? extantBeam : null); if (val2 != null && (int)val2.State == 2) { UpdateParticles(val2); } } } private void UpdateParticles(BasicBeamController beam) { //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_004e: 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_0055: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; float num = 0.5f - 0.05f * (float)_pigmentPowers[((GunBehaviour)this).gun.CurrentStrengthTier]; if (!(scaledTimeSinceStartup - _lastParticleSpawn < num)) { _lastParticleSpawn = scaledTimeSinceStartup; Vector2 val = Vector2.op_Implicit(((GunBehaviour)this).gun.barrelOffset.position); Vector2 direction = ((BeamController)beam).Direction; Vector2 normalized = ((Vector2)(ref direction)).normalized; float currentBeamDistance = beam.m_currentBeamDistance; int currentStrengthTier = ((GunBehaviour)this).gun.CurrentStrengthTier; for (int i = 0; i < (int)currentBeamDistance; i++) { GameObject singlePixel = VFX.SinglePixel; Vector3 position = Vector2.op_Implicit(val + currentBeamDistance * Random.value * normalized); Vector2? velocity = Lazy.RandomVector(4f); Color? overrideColor = PigmentDrop._Primaries[(currentStrengthTier < 3) ? currentStrengthTier : Random.Range(0, 3)]; CwaffVFX.Spawn(singlePixel, position, null, velocity, 0.4f, null, 2000f, null, fadeIn: false, null, null, null, randomFrame: false, -1, flipX: false, flipY: false, null, overrideColor, 8f); } } } public static void DropPigment(AIActor enemy, PigmentType color) { //IL_0001: 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_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_0060: Unknown result type (might be due to invalid IL or missing references) Vector2 centerPosition = ((GameActor)enemy).CenterPosition; float num = Lazy.RandomAngle(); Vector2 val = centerPosition + BraveMathCollege.DegreesToVector(num, 1f); _PigmentPrefab.Instantiate(Vector2.op_Implicit(val)).GetComponent().Setup(num.ToVector(7f * Random.Range(0.8f, 1.2f)), color); } public static int PigmentPower(int pigmentNum) { return 1 + _LEVELS.FirstLT(pigmentNum); } public void AcquirePigment(PigmentType pigment) { int num = _pigmentPowers[(int)pigment]; switch (pigment) { case PigmentType.RED: _pigmentPowers[(int)pigment] = PigmentPower(++redPigment); break; case PigmentType.GREEN: _pigmentPowers[(int)pigment] = PigmentPower(++greenPigment); break; case PigmentType.BLUE: _pigmentPowers[(int)pigment] = PigmentPower(++bluePigment); break; } if (num != _pigmentPowers[(int)pigment]) { _ammoDisplayDirty = true; } } public override void PostProcessBeam(BeamController beam) { //IL_0060: 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_00ce: 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_00da: 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) ((GunBehaviour)this).PostProcessBeam(beam); Projectile projectile = ((BraveBehaviour)beam).projectile; if (projectile != null && ((GunBehaviour)this).PlayerOwner != null) { int num = _pigmentPowers[((GunBehaviour)this).gun.CurrentStrengthTier]; ProjectileData baseData = projectile.baseData; baseData.damage *= 1f + 0.2f * (float)num; int currentStrengthTier = ((GunBehaviour)this).gun.CurrentStrengthTier; Color val = PigmentDrop._Primaries[currentStrengthTier]; tk2dSprite impactSprite = ((BasicBeamController)((beam is BasicBeamController) ? beam : null)).m_impactSprite; ((tk2dBaseSprite)impactSprite).usesOverrideMaterial = true; Material material = ((BraveBehaviour)impactSprite).renderer.material; material.shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTintableTiltedCutoutEmissive"); material.DisableKeyword("BRIGHTNESS_CLAMP_ON"); material.EnableKeyword("BRIGHTNESS_CLAMP_OFF"); material.SetFloat(CwaffVFX._EmissivePowerId, 400f); material.SetFloat(CwaffVFX._EmissiveColorPowerId, 8f); material.SetColor(CwaffVFX._EmissiveColorId, val); material.SetColor(CwaffVFX._OverrideColorId, Color.Lerp(val, Color.white, 0.5f)); } } private void RecalculateAllPigmentPowers() { _pigmentPowers[0] = PigmentPower(redPigment); _pigmentPowers[1] = PigmentPower(greenPigment); _pigmentPowers[2] = PigmentPower(bluePigment); _pigmentPowers[3] = Mathf.Min(new int[3] { _pigmentPowers[0], _pigmentPowers[1], _pigmentPowers[2] }); _ammoDisplayDirty = true; } public override void MidGameSerialize(List data, int i) { ((GunBehaviour)this).MidGameSerialize(data, i); data.Add(redPigment); data.Add(greenPigment); data.Add(bluePigment); } public override void MidGameDeserialize(List data, ref int i) { ((GunBehaviour)this).MidGameDeserialize(data, ref i); redPigment = (int)data[i++]; greenPigment = (int)data[i++]; bluePigment = (int)data[i++]; RecalculateAllPigmentPowers(); } } public enum PigmentType { RED, GREEN, BLUE, TRI } public class Desaturator : MonoBehaviour { private static readonly Dictionary _PigmentLookupDict = new Dictionary(); internal float _saturation = 1f; private AIActor _enemy; private float _lastKnownHealth = -1f; private bool _didSetup; private bool _addedShader; private List _desatMats = new List(); private bool _gotPigment; private int _rTotal; private int _gTotal; private int _bTotal; private float _rFrac; private float _gFrac; private float _bFrac; private float[] damageScales = new float[4] { 1f, 1f, 1f, 1f }; private void Start() { Setup(); } private void Setup() { if (!_didSetup) { _didSetup = true; _enemy = ((Component)this).gameObject.GetComponent(); } } private void AddShader(tk2dBaseSprite sprite) { sprite.usesOverrideMaterial = true; Material material = ((BraveBehaviour)sprite).renderer.material; material.shader = CwaffShaders.DesatShader; material.SetFloat(CwaffVFX._SaturationId, 1f); _desatMats.Add(material); _addedShader = true; } internal void UpdateLastKnownHealth() { Setup(); if (Object.op_Implicit((Object)(object)_enemy)) { HealthHaver healthHaver = ((BraveBehaviour)_enemy).healthHaver; if (healthHaver != null) { _lastKnownHealth = healthHaver.currentHealth; } } } private static IntVector3 ComputePigmentForEnemy(string guid) { //IL_0050: 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_0081: 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_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) float num = 0f; float num2 = 0f; float num3 = 0f; Color[] pixelColorsForEnemy = Lazy.GetPixelColorsForEnemy(guid); AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); Texture2D val = (Object.op_Implicit((Object)(object)orLoadByGuid.optionalPalette) ? ETGMod.GetRW(orLoadByGuid.optionalPalette) : null); int num4 = pixelColorsForEnemy.Length; float num5 = default(float); float num6 = default(float); float num7 = default(float); for (int i = 0; i < num4; i++) { Color val2 = pixelColorsForEnemy[i]; if (val2.a < 0.5f) { continue; } if (Object.op_Implicit((Object)(object)val)) { val2 = Lazy.GetPaletteColor(val, val2.r); } Color.RGBToHSV(val2, ref num5, ref num6, ref num7); if (!(num6 < 0.25f)) { num5 *= 6f; if (num5 < 0.5f || num5 > 5.5f) { num += 1f; } else if (num5 < 1.5f) { num += 0.5f; num2 += 0.5f; } else if (num5 < 2.5f) { num2 += 1f; } else if (num5 < 3.5f) { num2 += 0.5f; num3 += 0.5f; } else if (num5 < 4.5f) { num3 += 1f; } else if (num5 < 5.5f) { num3 += 0.5f; num += 0.5f; } } } float num8 = Mathf.Clamp(((BraveBehaviour)orLoadByGuid).healthHaver.maximumHealth, 10f, 1000f) / Mathf.Max(1f, num + num2 + num3); num = Mathf.Max(1f, num * num8); num2 = Mathf.Max(1f, num2 * num8); num3 = Mathf.Max(1f, num3 * num8); return new IntVector3(Mathf.CeilToInt(num), Mathf.CeilToInt(num2), Mathf.CeilToInt(num3)); } internal float GetPigmentMult(PigmentType pigment) { return damageScales[(int)pigment]; } internal void DoPigmentChecks(PigmentType hitPigment, bool willKill) { if (!Object.op_Implicit((Object)(object)_enemy)) { return; } HealthHaver healthHaver = ((BraveBehaviour)_enemy).healthHaver; if (healthHaver == null || string.IsNullOrEmpty(_enemy.EnemyGuid)) { return; } string enemyGuid = _enemy.EnemyGuid; if (!_gotPigment) { if (!_PigmentLookupDict.TryGetValue(enemyGuid, out var value)) { IntVector3 intVector = (_PigmentLookupDict[enemyGuid] = ComputePigmentForEnemy(enemyGuid)); value = intVector; } _rTotal = Mathf.CeilToInt(0.25f * (float)value.x); _gTotal = Mathf.CeilToInt(0.25f * (float)value.y); _bTotal = Mathf.CeilToInt(0.25f * (float)value.z); int num = value.x + value.y + value.z; if (num > 0) { float num2 = 1f / (float)num; float num3 = (float)value.x * num2; float num4 = (float)value.y * num2; float num5 = (float)value.z * num2; damageScales[2] = ((num3 < 0.16f) ? 0.25f : ((num3 > 0.45f) ? 2f : 1f)); damageScales[0] = ((num4 < 0.16f) ? 0.25f : ((num4 > 0.45f) ? 2f : 1f)); damageScales[1] = ((num5 < 0.16f) ? 0.25f : ((num5 > 0.45f) ? 2f : 1f)); } damageScales[3] = 6f; _gotPigment = true; } if (_lastKnownHealth >= 0f) { float num6 = (Mathf.Max(0f, _lastKnownHealth) - Mathf.Max(0f, healthHaver.currentHealth)) / healthHaver.AdjustedMaxHealth; if (num6 > 0f) { _rFrac += num6 * (float)_rTotal; _gFrac += num6 * (float)_gTotal; _bFrac += num6 * (float)_bTotal; while (_rFrac >= 1f) { Chroma.DropPigment(((BraveBehaviour)_enemy).aiActor, PigmentType.RED); _rFrac -= 1f; } while (_gFrac >= 1f) { Chroma.DropPigment(((BraveBehaviour)_enemy).aiActor, PigmentType.GREEN); _gFrac -= 1f; } while (_bFrac >= 1f) { Chroma.DropPigment(((BraveBehaviour)_enemy).aiActor, PigmentType.BLUE); _bFrac -= 1f; } _saturation -= num6; } } if (willKill && hitPigment != PigmentType.TRI) { PigmentType color = (PigmentType)((int)(hitPigment + 2) % 3); int num7 = (int)Mathf.Log(Mathf.Max(1f, healthHaver.AdjustedMaxHealth), 2f); for (int i = 0; i < num7; i++) { Chroma.DropPigment(((BraveBehaviour)_enemy).aiActor, color); } } _lastKnownHealth = healthHaver.currentHealth; if (!_addedShader) { _enemy.ApplyShader(AddShader); _enemy.SetOutlines(true); } foreach (Material desatMat in _desatMats) { if (Object.op_Implicit((Object)(object)desatMat)) { desatMat.SetFloat(CwaffVFX._SaturationId, _saturation); } } } } public class ChromaProjectile : MonoBehaviour { [SerializeField] internal PigmentType _pigment; private Projectile _projectile; private PlayerController _owner; private Chroma _gun; private float _baseDamage; private void Start() { _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)) { Gun currentGun = ((GameActor)_owner).CurrentGun; if (currentGun != null) { _gun = ((Component)currentGun).gameObject.GetComponent(); } Projectile projectile = _projectile; projectile.OnHitEnemy = (Action)Delegate.Combine(projectile.OnHitEnemy, new Action(OnHitEnemy)); _baseDamage = _projectile.baseData.damage; } } private void OnHitEnemy(Projectile bullet, SpeculativeRigidbody enemy, bool willKill) { if (Object.op_Implicit((Object)(object)enemy)) { Desaturator orAddComponent = GameObjectExtensions.GetOrAddComponent(((Component)enemy).gameObject); orAddComponent.DoPigmentChecks(_pigment, willKill); float pigmentMult = orAddComponent.GetPigmentMult(_pigment); _projectile.baseData.damage = _baseDamage * pigmentMult; if (pigmentMult > 1f) { ((MonoBehaviour)(object)_owner).LoopSoundIf(play: true, "chroma_drain_sound"); } else if (pigmentMult < 1f) { ((MonoBehaviour)(object)_owner).LoopSoundIf(play: true, "chroma_resist_sound"); } } } } public class PigmentDrop : MonoBehaviour { internal const float _BOB_SPEED = 4f; internal const float _BOB_HEIGHT = 0.2f; private const float _PICKUP_RADIUS_SQR = 2f; private const float _HOME_ACCEL = 44f; private const float _FRICTION = 0.96f; private const float _MAX_LIFE = 10f; private const float _PARTICLE_RATE = 0.167f; internal static readonly List _Primaries = new List(4) { new Color(46f / 51f, 29f / 85f, 0.58431375f), new Color(0.58431375f, 46f / 51f, 29f / 85f), new Color(0.3529412f, 0.7058824f, 46f / 51f), new Color(1f, 1f, 1f) }; internal static readonly List _HexPrimaries = new List(4) { "E65795", "95E657", "5795E6", "FFFFFF" }; internal static int _ChromaId = -1; private bool _setup; private PlayerController _owner; private float _homeSpeed; private tk2dSprite _sprite; private float _lifetime; private Vector2 _velocity = Vector2.zero; private Vector3 _basePos = Vector2.op_Implicit(Vector2.zero); private float _lastParticle; private PigmentType _pigment; private Color _pigmentColor; public void Setup(Vector2 velocity, PigmentType pigment) { //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_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_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_0042: 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_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_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) Color pigmentColor = _Primaries[(int)pigment]; _pigment = pigment; _pigmentColor = pigmentColor; _sprite = ((Component)this).GetComponent(); ((tk2dBaseSprite)(object)_sprite).SetGlowiness(400f, _pigmentColor, Color.Lerp(_pigmentColor, Color.white, 0.5f)); _velocity = velocity; _basePos = ((Component)this).transform.position; _setup = true; } private void Update() { //IL_0056: 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_006f: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: 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_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: 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_01d8: 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_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_034d: 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: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) if (!_setup) { return; } if (GameManager.Instance.PrimaryPlayer.AcceptingAnyInput) { _lifetime += BraveTime.DeltaTime; } float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; if (scaledTimeSinceStartup - _lastParticle >= 0.167f) { _lastParticle = scaledTimeSinceStartup; GameObject singlePixel = VFX.SinglePixel; Vector3 position = ((Component)this).transform.position; Vector2? velocity = Lazy.RandomVector(3f); Color? overrideColor = _pigmentColor; CwaffVFX.Spawn(singlePixel, position, null, velocity, 0.5f, null, 3000f, null, fadeIn: false, null, null, null, randomFrame: false, -1, flipX: false, flipY: false, null, overrideColor, 8f); } if (_ChromaId < 0) { _ChromaId = Lazy.PickupId(); } if (!Object.op_Implicit((Object)(object)_owner)) { PlayerController[] allPlayers = GameManager.Instance.AllPlayers; foreach (PlayerController val in allPlayers) { if (Object.op_Implicit((Object)(object)val) && ((Behaviour)val).isActiveAndEnabled && !val.IsGhost && val.HasGun(_ChromaId)) { _owner = val; } } } if (Object.op_Implicit((Object)(object)_owner)) { Vector2 val2 = ((GameActor)_owner).CenterPosition - Vector3Extensions.XY(((Component)this).transform.position); Vector2 normalized = ((Vector2)(ref val2)).normalized; _homeSpeed += 44f * BraveTime.DeltaTime; float homeSpeed = _homeSpeed; Vector2 val3 = ((Vector2)(ref _velocity)).normalized + normalized; _velocity = homeSpeed * Lazy.SmoothestLerp(((Vector2)(ref val3)).normalized, normalized, 10f); _basePos += Vector2Extensions.ToVector3ZUp(_velocity * BraveTime.DeltaTime, 0f); ((Component)this).transform.position = _basePos.HoverAt(0.2f, 4f); if (!(((Vector2)(ref val2)).sqrMagnitude > 2f)) { _owner.FindGun()?.AcquirePigment(_pigment); ((Component)this).gameObject.PlayUnique("pigment_collect_sound"); GameObject singlePixel2 = VFX.SinglePixel; Vector2 centerPosition = ((GameActor)_owner).CenterPosition; Color? overrideColor = _pigmentColor; CwaffVFX.SpawnBurst(singlePixel2, 4, centerPosition, 0f, null, 0f, 5f, CwaffVFX.Vel.Random, CwaffVFX.Rot.None, 0.5f, null, 3000f, null, fadeIn: false, uniform: false, null, null, null, randomFrame: false, -1, flipX: false, flipY: false, null, overrideColor, 8f); Object.Destroy((Object)(object)((Component)this).gameObject); } } else { if (((Vector2)(ref _velocity)).sqrMagnitude > 1f) { _velocity *= Mathf.Pow(0.96f, 60f * BraveTime.DeltaTime); _basePos += Vector2Extensions.ToVector3ZUp(_velocity * BraveTime.DeltaTime, 0f); } else { _velocity = ((Vector2)(ref _velocity)).normalized; } ((Component)this).transform.position = _basePos.HoverAt(0.2f, 4f); } } } public class Scotsman : CwaffGun { public static string ItemName = "Scotsman"; public static string ShortDescription = "Situationally Sticky"; public static string LongDescription = "Launches sticky bombs that stick to enemies, obstacles, walls, and the floor. Reloading detonates all stationary sticky bombs after a short delay."; public static string Lore = "Hailing straight from the Motherland, this weapon is a favorite among the explosion-loving Scots whose name it bears. The gun's sticky projectiles and ability to detonate them on command takes out much of the guesswork involved when using traditional firearms, ensuring substantial destructive output even when its wielder happens to be drunk, half-blind, or both."; private const float _MAX_RETICLE_RANGE = 16f; private const float _BASE_EXPLOSION_DAMAGE = 24f; internal static ExplosionData _ScotsmanExplosion = null; internal List _extantStickies = new List(); private Vector2 _aimPoint = Vector2.zero; private Vector2 _whereIsThePlayerLooking = Vector2.zero; private LinkedList _roomBreakables = new LinkedList(); private GameObject _coneMeshObject; private Mesh _mesh; private MeshRenderer _meshRenderer; private Vector3[] _vertices; private const int _CONE_SEGMENTS = 4; private const float _CONE_SPREAD = 30f; private const float _CONE_START = -15f; private const float _CONE_GAP = 7.5f; private const float _CONE_MAG = 12f; private const float _CONE_SQR_MAG = 144f; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 24; int? reloadFps = 12; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)45, 2f, 300, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: true, null, null, shootFps, reloadFps, null, null, "stickybomblauncher_shoot", "stickybomblauncher_worldreload", null, -1, -1, -1, null, modulesAreTiers: false, "muzzle_scotsman", 30, 0.5f, (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).AddReticle(VFX.Create("scotsman_reticle", 12f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1), 1f, 0f, 0f, smoothLerp: false, -1f, 16f, 0f, CwaffReticle.Visibility.CONTROLLER).AddToShop((ShopType)3); int? clipSize = 20; float? cooldown = 0.22f; float? damage = 24f; float? speed = 40f; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "stickybomb_projectile", 12, (Anchor)4)).Attach(); _ScotsmanExplosion = Explosions.ExplosiveRounds.With(100f, 10f, 24f, 1.5f, preventPlayerForce: false, shake: false); } public override void OnReloadPressed(PlayerController player, Gun gun, bool manualReload) { base.OnReloadPressed(player, gun, manualReload); DetonateStickies(player); } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); if (Object.op_Implicit((Object)(object)_meshRenderer)) { ((Renderer)_meshRenderer).enabled = true; } } public override void OnSwitchedAwayFromThisGun() { PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null) { playerOwner.forceAimPoint = null; } if (Object.op_Implicit((Object)(object)_meshRenderer)) { ((Renderer)_meshRenderer).enabled = false; } base.OnSwitchedAwayFromThisGun(); } public override void OnPlayerPickup(PlayerController player) { player.OnEnteredCombat = (Action)Delegate.Combine(player.OnEnteredCombat, new Action(OnEnteredCombat)); base.OnPlayerPickup(player); } public override void OnDroppedByPlayer(PlayerController player) { player.OnEnteredCombat = (Action)Delegate.Remove(player.OnEnteredCombat, new Action(OnEnteredCombat)); if (Object.op_Implicit((Object)(object)_meshRenderer)) { ((Renderer)_meshRenderer).enabled = false; } base.OnDroppedByPlayer(player); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((GunBehaviour)this).PlayerOwner.forceAimPoint = null; PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; playerOwner.OnEnteredCombat = (Action)Delegate.Remove(playerOwner.OnEnteredCombat, new Action(OnEnteredCombat)); } if (Object.op_Implicit((Object)(object)_coneMeshObject)) { Object.Destroy((Object)(object)_coneMeshObject); } base.OnDestroy(); } private void OnEnteredCombat() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { return; } RoomHandler currentRoom = ((GunBehaviour)this).PlayerOwner.CurrentRoom; if (currentRoom == null) { return; } _roomBreakables.Clear(); foreach (MinorBreakable allMinorBreakable in StaticReferenceManager.AllMinorBreakables) { if (Object.op_Implicit((Object)(object)allMinorBreakable) && !allMinorBreakable.IsBroken && Vector3Extensions.GetAbsoluteRoom(allMinorBreakable.CenterPoint) == currentRoom) { _roomBreakables.AddLast(allMinorBreakable); } } } public override void Update() { //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) //IL_0039: 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_0050: 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_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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_0070: 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_0081: 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_00a0: 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_00ac: Unknown result type (might be due to invalid IL or missing references) base.Update(); PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null || !playerOwner.AcceptingNonMotionInput) { return; } if (playerOwner.IsKeyboardAndMouse()) { playerOwner.forceAimPoint = null; _aimPoint = Vector3Extensions.XY(playerOwner.unadjustedAimPoint); Vector2 val = TransformExtensions.PositionVector2(((GameActor)playerOwner).CurrentGun.barrelOffset); Vector2 val2 = _aimPoint - ((GameActor)playerOwner).CenterPosition; if (((Vector2)(ref val2)).sqrMagnitude < 32f) { _aimPoint = val + playerOwner.m_currentGunAngle.ToVector(); } } else { CwaffReticle component = ((Component)this).GetComponent(); if (component != null && component.IsVisible()) { _aimPoint = component.GetTargetPos(); playerOwner.forceAimPoint = _aimPoint; } else { _aimPoint = ((GameActor)playerOwner).CenterPosition + playerOwner.m_currentGunAngle.ToVector(16f); } } } private void LateUpdate() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) && base.Mastered) { UpdateExplosiveDecor(); } } public override void PostProcessProjectile(Projectile projectile) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) ((GunBehaviour)this).PostProcessProjectile(projectile); if (((GunBehaviour)this).PlayerOwner != null) { ((Component)projectile).GetComponent().Setup(_aimPoint); } } private void DetonateStickies(PlayerController pc) { List list = new List(); bool flag = false; foreach (Stickybomb extantSticky in _extantStickies) { if (Object.op_Implicit((Object)(object)extantSticky)) { if (extantSticky.Detonate(pc)) { flag = true; } else { list.Add(extantSticky); } } } _extantStickies = list; if (DetonateTheWorld(pc)) { flag = true; } if (flag) { ((Component)pc).gameObject.Play("stickybomblauncher_det"); } } private bool DetonateTheWorld(PlayerController pc) { //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_027c: Unknown result type (might be due to invalid IL or missing references) //IL_027d: 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) //IL_00d6: 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_00db: 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) //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_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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: 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_015d: 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_0258: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) if (base.Mastered && Object.op_Implicit((Object)(object)((GunBehaviour)this).gun) && Object.op_Implicit((Object)(object)((GunBehaviour)this).gun.barrelOffset)) { RoomHandler currentRoom = pc.CurrentRoom; if (currentRoom != null) { bool result = false; int count = _roomBreakables.Count; Vector3 position = ((GunBehaviour)this).gun.barrelOffset.position; float currentGunAngle = pc.m_currentGunAngle; for (int i = 0; i < count; i++) { LinkedListNode first = _roomBreakables.First; _roomBreakables.RemoveFirst(); MinorBreakable value = first.Value; if (value == null || !Object.op_Implicit((Object)(object)value) || !((Behaviour)value).isActiveAndEnabled || value.IsBroken) { continue; } Vector3 val = (Object.op_Implicit((Object)(object)((BraveBehaviour)value).sprite) ? Vector2.op_Implicit(((BraveBehaviour)value).sprite.WorldCenter) : ((BraveBehaviour)value).transform.position); Vector2 val2 = Vector2.op_Implicit(val - position); if (((Vector2)(ref val2)).sqrMagnitude > 144f || Mathf.Abs((Vector2Extensions.ToAngle(val2) - currentGunAngle).Clamp180()) > 15f) { _roomBreakables.AddLast(first); continue; } if (!value.explodesOnBreak || value.explosionData == null) { ExplosionData val3 = GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultSmallExplosionData.Clone(); val3.damageToPlayer = 0f; Exploder.Explode(val, val3, Vector2.zero, (Action)null, true, (CoreDamageTypes)0, false); } else { value.Break(); } result = true; } ReadOnlyCollection roomInteractables = currentRoom.GetRoomInteractables(); for (int j = 0; j < roomInteractables.Count; j++) { if (currentRoom.IsRegistered(roomInteractables[j])) { IPlayerInteractable obj = roomInteractables[j]; FlippableCover val4 = (FlippableCover)(object)((obj is FlippableCover) ? obj : null); if (val4 != null && !val4.IsFlipped && !val4.IsGilded && Object.op_Implicit((Object)(object)val4.m_breakable)) { val4.m_breakable.ApplyDamage(9999f, Vector2.zero, false, true, false); ExplosionData val5 = GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultExplosionData.Clone(); val5.damageToPlayer = 0f; Exploder.Explode(Object.op_Implicit((Object)(object)((BraveBehaviour)val4).sprite) ? Vector2.op_Implicit(((BraveBehaviour)val4).sprite.WorldCenter) : ((BraveBehaviour)val4).transform.position, val5, Vector2.zero, (Action)null, true, (CoreDamageTypes)0, false); result = true; } } } { foreach (AIActor item in Vector3Extensions.XY(position).AllEnemiesWithinConeOfVision(currentGunAngle, 15f, 12f, ignoreWalls: true, includeInvulnerable: false)) { if (!item.IsSignatureEnemy && !((BraveBehaviour)item).healthHaver.IsBoss) { ExplodeOnDeath component = ((Component)item).GetComponent(); if (component != null && !component.immuneToIBombApp) { ((BraveBehaviour)this).healthHaver.ApplyDamage(2.1474836E+09f, Vector2.zero, "DetonateTheWorld", (CoreDamageTypes)0, (DamageCategory)0, true, (PixelCollider)null, false); result = true; } } } return result; } } } return false; } private void UpdateExplosiveDecor() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0181: 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_0187: 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_018e: 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) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)this)) { return; } PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null || (Object)(object)((GameActor)playerOwner).CurrentGun != (Object)(object)((GunBehaviour)this).gun) { return; } if (!Object.op_Implicit((Object)(object)_coneMeshObject) || !Object.op_Implicit((Object)(object)_mesh) || !Object.op_Implicit((Object)(object)_meshRenderer)) { _coneMeshObject = new GameObject("scotsman_targeting_cone"); GameObjectExtensions.SetLayerRecursively(_coneMeshObject, LayerMask.NameToLayer("FG_Critical")); _mesh = new Mesh(); _vertices = (Vector3[])(object)new Vector3[6]; int[] array = new int[12]; for (int i = 0; i < 4; i++) { array[i * 3] = 0; array[i * 3 + 1] = i + 1; array[i * 3 + 2] = i + 2; } _mesh.vertices = _vertices; _mesh.triangles = array; _mesh.uv = (Vector2[])(object)new Vector2[6]; _coneMeshObject.AddComponent().mesh = _mesh; _meshRenderer = _coneMeshObject.AddComponent(); Material val = (((Renderer)_meshRenderer).material = (Material)/*isinst with value type is only supported in some contexts*/); val.shader = ShaderCache.Acquire("tk2d/BlendVertexColorAlphaTintableTilted"); val.SetColor(CwaffVFX._OverrideColorId, new Color(1f, 0f, 0f, 0.15f)); } Vector3 val3 = (_vertices[0] = ((GunBehaviour)this).gun.barrelOffset.position); float num = playerOwner.m_currentGunAngle + -15f; for (int j = 0; j <= 4; j++) { _vertices[j + 1] = val3 + (num + (float)j * 7.5f).ToVector3(12f); } _mesh.vertices = _vertices; _mesh.RecalculateBounds(); _mesh.RecalculateNormals(); } } public class Stickybomb : MonoBehaviour { private const float _DET_TIMER = 0.6f; private const float _BASE_GLOW = 10f; private const float _DET_GLOW = 100f; private const float _FALLBACK_RANGE = 3f; private PlayerController _owner; private Projectile _projectile; private Scotsman _scotsman; private bool _detonateSequenceStarted; private bool _stuck; private Vector2 _startPos; private float _targetDist; private Vector2 _stickPoint = Vector2.zero; private AIActor _stuckEnemy; private bool _setup; private void Start() { //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_0099: Unknown result type (might be due to invalid IL or missing references) _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) && Object.op_Implicit((Object)(object)((GameActor)_owner).CurrentGun) && Object.op_Implicit((Object)(object)(_scotsman = ((Component)((GameActor)_owner).CurrentGun).GetComponent()))) { _scotsman._extantStickies.Add(this); } _detonateSequenceStarted = false; _stuck = false; if (!_setup) { _startPos = Vector3Extensions.XY(((Component)this).transform.position); _targetDist = 3f; } ((MonoBehaviour)this).StartCoroutine(LockAndLoad()); } public void Setup(Vector2 target) { //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_0011: 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_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) _startPos = Vector3Extensions.XY(((Component)this).transform.position); Vector2 val = target - _startPos; _targetDist = ((Vector2)(ref val)).magnitude; _setup = true; } private void StickToSurface(Vector2 stickPoint) { //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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0087: 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_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) SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody.OnRigidbodyCollision = (OnRigidbodyCollisionDelegate)Delegate.Remove((Delegate?)(object)specRigidbody.OnRigidbodyCollision, (Delegate?)new OnRigidbodyCollisionDelegate(StickToSurface)); SpeculativeRigidbody specRigidbody2 = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody2.OnTileCollision = (OnTileCollisionDelegate)Delegate.Remove((Delegate?)(object)specRigidbody2.OnTileCollision, (Delegate?)new OnTileCollisionDelegate(StickToSurface)); ((BraveBehaviour)_projectile).specRigidbody.CollideWithOthers = false; ((BraveBehaviour)_projectile).specRigidbody.CollideWithTileMap = false; _projectile.collidesWithEnemies = false; _stickPoint = stickPoint; ((BraveBehaviour)_projectile).specRigidbody.Position = new Position(_stickPoint); ((BraveBehaviour)_projectile).specRigidbody.UpdateColliderPositions(); _projectile.SetSpeed(0f); ((BraveBehaviour)_projectile).sprite.HeightOffGround = 10f; ((BraveBehaviour)_projectile).sprite.UpdateZDepth(); _stuck = true; } private void StickToSurface(CollisionData coll) { //IL_0002: 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_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) //IL_0051: Unknown result type (might be due to invalid IL or missing references) StickToSurface(((CastResult)coll).Contact); if (Object.op_Implicit((Object)(object)coll.OtherRigidbody)) { AIActor component = ((Component)coll.OtherRigidbody).GetComponent(); if (component != null) { _stuckEnemy = component; _stickPoint -= Vector3Extensions.XY(((BraveBehaviour)((BraveBehaviour)component).specRigidbody).transform.position); ((BraveBehaviour)((BraveBehaviour)_projectile).specRigidbody).transform.parent = ((BraveBehaviour)((BraveBehaviour)component).specRigidbody).transform; } } } private void Update() { //IL_002c: 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_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_0050: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_stuckEnemy) && Object.op_Implicit((Object)(object)((BraveBehaviour)_stuckEnemy).specRigidbody)) { ((BraveBehaviour)_projectile).specRigidbody.Position = new Position(_stickPoint + Vector3Extensions.XY(((BraveBehaviour)((BraveBehaviour)_stuckEnemy).specRigidbody).transform.position)); ((BraveBehaviour)_projectile).specRigidbody.UpdateColliderPositions(); } } private IEnumerator LockAndLoad() { float launchTime = BraveTime.ScaledTimeSinceStartup; _ = _projectile.baseData.damage; ((BraveBehaviour)_projectile).sprite.SetGlowiness(10f, Color.red); _projectile.shouldRotate = false; float explosionDamage = _projectile.baseData.damage; _projectile.baseData.damage = 0f; _projectile.BulletScriptSettings.surviveRigidbodyCollisions = true; _projectile.BulletScriptSettings.surviveTileCollisions = true; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody.OnRigidbodyCollision = (OnRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnRigidbodyCollision, (Delegate?)new OnRigidbodyCollisionDelegate(StickToSurface)); SpeculativeRigidbody specRigidbody2 = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody2.OnTileCollision = (OnTileCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody2.OnTileCollision, (Delegate?)new OnTileCollisionDelegate(StickToSurface)); while (!_stuck) { Vector2 val = Vector3Extensions.XY(((Component)this).transform.position); Vector2 val2 = _startPos - val; if (((Vector2)(ref val2)).magnitude > _targetDist) { StickToSurface(val); break; } float num = BraveTime.ScaledTimeSinceStartup - launchTime; ((BraveBehaviour)((BraveBehaviour)_projectile).sprite).transform.localRotation = (3000f * Mathf.Sin(num)).EulerZ(); yield return null; } _projectile.m_usesNormalMoveRegardless = true; Projectile projectile = _projectile; projectile.damageTypes = (CoreDamageTypes)(projectile.damageTypes & -65); while (!_detonateSequenceStarted && Object.op_Implicit((Object)(object)_scotsman)) { yield return null; } int i = 0; while (i < 3) { ((BraveBehaviour)_projectile).sprite.SetGlowiness(100f, Color.red); yield return (object)new WaitForSeconds(0.1f); ((BraveBehaviour)_projectile).sprite.SetGlowiness(10f, Color.red); yield return (object)new WaitForSeconds(0.1f); int num2 = i + 1; i = num2; } Exploder.Explode(((BraveBehaviour)_projectile).transform.position, Scotsman._ScotsmanExplosion.With(100f, 10f, explosionDamage), Vector2.zero, (Action)null, true, (CoreDamageTypes)0, false); _projectile.DieInAir(true, true, true, false); } public bool Detonate(PlayerController pc) { if ((Object)(object)pc != (Object)(object)_owner) { return false; } if (!_stuck) { return false; } _detonateSequenceStarted = true; return true; } } public class Hallaeribut : CwaffGun { internal enum State { Satiated, Peckish, Hungry, Starving, Famished, Ravenous } [HarmonyPatch(typeof(AmmoPickup), "Interact")] private class AmmoPickupInteractPatch { private static bool Prefix(AmmoPickup __instance, PlayerController interactor) { //IL_007b: 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_00a0: Unknown result type (might be due to invalid IL or missing references) Hallaeribut gun = interactor.GetGun(); if (gun == null) { return true; } gun.UpdateAmmo(); if (gun._state <= State.Peckish) { return true; } if ((Object)(object)((GameActor)interactor).CurrentGun == (Object)(object)((Component)gun).gameObject.GetComponent()) { return true; } foreach (dfLabel extantReloadLabel in GameUIRoot.Instance.m_extantReloadLabels) { extantReloadLabel.ProcessMarkup = true; } GameUIRoot.Instance.InformNeedsReload(interactor, new Vector3(((BraveBehaviour)interactor).specRigidbody.UnitCenter.x - ((BraveBehaviour)interactor).transform.position.x, 1.25f, 0f), 1f, "[color #dd6666]It Hungers[/color]"); return false; } } private class HallaeributAmmoDisplay : CustomAmmoDisplay { private const string _RAVENOUS_STRING = "[color #bb33bb]R[/color][color #bb33aa]a[/color][color #bb3399]v[/color][color #bb3388]e[/color][color #bb3377]n[/color][color #bb3366]o[/color][color #bb3355]u[/color][color #bb3344]s[/color]"; private Gun _gun; private Hallaeribut _hal; private PlayerController _owner; private void Start() { _gun = ((Component)this).GetComponent(); _hal = ((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; } if (_hal._state == State.Ravenous) { uic.GunAmmoCountLabel.Text = "[color #bb33bb]R[/color][color #bb33aa]a[/color][color #bb3399]v[/color][color #bb3388]e[/color][color #bb3377]n[/color][color #bb3366]o[/color][color #bb3355]u[/color][color #bb3344]s[/color]\n" + CustomAmmoDisplayExtensions.VanillaAmmoDisplay(_owner); } else if (_hal._state == State.Famished) { uic.GunAmmoCountLabel.Text = $"[color #bb33bb]{_hal._state}[/color]\n{CustomAmmoDisplayExtensions.VanillaAmmoDisplay(_owner)}"; } else { uic.GunAmmoCountLabel.Text = $"{_hal._state}\n{CustomAmmoDisplayExtensions.VanillaAmmoDisplay(_owner)}"; } return true; } } public static string ItemName = "Hallaeribut"; public static string ShortDescription = "Modern Warfare Cod"; public static string LongDescription = "Fires piranhas that devour any targets in their sight. Becomes increasingly hungry as ammo is depleted, spawning more piranhas per shot but having increasingly negative side effects: when Peckish, cannot be dropped; when Hungry, cannot pick up ammo for other guns; when Starving, cannot switch to other guns; when Famished, feeds on the player to restore 20% ammo when out of ammo."; public static string Lore = "Piranhas are not known to be picky eaters. It's uncertain who first brought them into the Gungeon or for what purpose, but the fact that they're more than willing to eat flesh, metal, and lead is by all means a good enough reason to stick them in a gun and fire away. Just be extra careful whan handling the ammunition...."; private const int _SWARM_SIZE = 2; private const int _BURSTS_PER_CLIP = 5; private const float _FAMISH_AMMO_PERCENT = 0.2f; private static readonly float[] _AmmoThresholds = new float[5] { 1f, 0.9f, 0.7f, 0.4f, 0f }; internal static GameObject _BiteVFX; private State _state; private int _cachedAmmo = -1; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 24; int? reloadFps = 16; Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)15, 1.2f, 800, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "chomp_small_sound", "chomp_small_sound", null, -1, 0, -1, null, modulesAreTiers: true, "muzzle_hallaeribut", 30, 0.5f, (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).Attach().Attach((Action)null, allowDuplicates: false) .AssignGun(out gunRef); int? clipSize = 32; float? cooldown = 0.33f; float? angleVariance = 20f; float? damage = 9f; float? speed = 75f; float? range = 1000f; float? force = 12f; float? burstCooldown = 0.04f; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)4, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "hallaeribut_projectile", 24, (Anchor)4, 0.75f, anchorsChangeColliders: true, fixesScales: true, null, null, 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, burstCooldown)).AudioEvent("snap_sound").Attach() .AttachTrail("hallaeribut_trail", 24, null, -1f, 1f / 60f, 1f); ProjectileModule defaultModule = gunRef.DefaultModule; gunRef.Volley.projectiles = new List(_AmmoThresholds.Length - 1); for (int i = 1; i <= _AmmoThresholds.Length; i++) { ProjectileModule val = ProjectileModule.CreateClone(defaultModule, false, -1); val.burstShotCount = i * 2; val.numberOfShotsInClip = val.burstShotCount * 5; gunRef.Volley.projectiles.Add(val); } _BiteVFX = VFX.Create("bite_vfx", 40f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } public override void Update() { base.Update(); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) && ((GunBehaviour)this).PlayerOwner.AcceptingNonMotionInput) { UpdateAmmo(); UpdateStarvation(); ((GunBehaviour)this).gun.m_prepThrowTime = -999f; } } private void UpdateStarvation() { //IL_006e: 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) if (_state >= State.Famished && ((GunBehaviour)this).gun.CurrentAmmo <= 0 && !((GunBehaviour)this).gun.InfiniteAmmo && !((GunBehaviour)this).gun.LocalInfiniteAmmo && (_state != State.Ravenous || !AttemptRavenousItemConsume(checkInventory: true))) { HealthHaver healthHaver = ((BraveBehaviour)((GunBehaviour)this).PlayerOwner).healthHaver; if (healthHaver != null && !healthHaver.IsDead) { ((BraveBehaviour)((GunBehaviour)this).PlayerOwner).healthHaver.ApplyDamage(0.5f, Vector2.zero, "Insatiable Hunger", (CoreDamageTypes)0, (DamageCategory)5, true, (PixelCollider)null, false); GameObject biteVFX = _BiteVFX; Vector3 position = Vector2.op_Implicit(((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition); float? fadeOutTime = 0.1f; CwaffVFX.Spawn(biteVFX, position, null, null, 0.3f, fadeOutTime); ((Component)((GunBehaviour)this).PlayerOwner).gameObject.Play("chomp_large_sound"); ((GunBehaviour)this).gun.GainAmmo(Mathf.CeilToInt(0.2f * (float)((GunBehaviour)this).gun.AdjustedMaxAmmo)); } } } public override void OnFullClipReload(PlayerController player, Gun gun) { if (base.Mastered && !GameManager.Instance.IsLoadingLevel && !GameManager.Instance.IsPaused && BraveTime.DeltaTime != 0f && !player.IsDodgeRolling && player.AcceptingNonMotionInput) { AttemptRavenousItemConsume(checkInventory: false); } } private bool AttemptRavenousItemConsume(bool checkInventory) { //IL_0045: 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_004a: 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) bool flag = true; PickupObject val = GetNearestEdibleDroppedItem(); if (!Object.op_Implicit((Object)(object)val) && checkInventory) { val = GetWorstItemWeCanEat(); flag = false; } if (!Object.op_Implicit((Object)(object)val)) { return false; } DebrisObject val2 = Lazy.MakeDebrisFromSprite(((BraveBehaviour)val).sprite, Vector2.op_Implicit(flag ? ((BraveBehaviour)val).sprite.WorldCenter : ((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition)); val2.doesDecay = true; val2.bounceCount = 0; ((MonoBehaviour)val2).StartCoroutine(Lazy.DecayOverTime(val2, 0.5f, shrink: true)); GameObject biteVFX = _BiteVFX; Vector3 position = Vector2.op_Implicit(((BraveBehaviour)val2).sprite.WorldCenter); float? fadeOutTime = 0.1f; CwaffVFX.Spawn(biteVFX, position, null, null, 0.3f, fadeOutTime); ((Component)val2).gameObject.Play("chomp_large_sound"); float num = 0f; num = ((val.PickupObjectId != 127) ? ((float)Mathf.Clamp(val.QualityGrade(), 1, 5) * 0.2f) : 0.1f); ((GunBehaviour)this).gun.GainAmmo(Mathf.CeilToInt(num * (float)((GunBehaviour)this).gun.AdjustedMaxAmmo)); if (flag) { Object.Destroy((Object)(object)((Component)val).gameObject); } else { Gun val3 = (Gun)(object)((val is Gun) ? val : null); if (val3 != null) { val3.HasEverBeenAcquiredByPlayer = true; ((GunBehaviour)this).PlayerOwner.inventory.RemoveGunFromInventory(val3); val3.ToggleRenderers(true); Object.Destroy((Object)(object)((Component)val3.DropGun(0.5f)).gameObject); } else { PassiveItem val4 = (PassiveItem)(object)((val is PassiveItem) ? val : null); if (val4 != null) { Object.Destroy((Object)(object)((Component)((GunBehaviour)this).PlayerOwner.DropPassiveItem(val4)).gameObject); } else { PlayerItem val5 = (PlayerItem)(object)((val is PlayerItem) ? val : null); if (val5 != null) { Object.Destroy((Object)(object)((Component)((GunBehaviour)this).PlayerOwner.DropActiveItem(val5, 4f, false)).gameObject); } } } } return true; } private PickupObject GetNearestEdibleDroppedItem() { //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_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_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_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_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) PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; RoomHandler currentRoom = playerOwner.CurrentRoom; if (currentRoom == null) { return null; } PickupObject result = null; float num = 999f; Vector2 centerPosition = ((GameActor)playerOwner).CenterPosition; foreach (PickupObject debrisPickup in CwaffEvents._DebrisPickups) { if (!Object.op_Implicit((Object)(object)debrisPickup) || debrisPickup.IsBeingSold || debrisPickup.QualityGrade() == 0) { continue; } Vector3 position = ((BraveBehaviour)debrisPickup).transform.position; if (Vector3Extensions.GetAbsoluteRoom(position) == currentRoom) { Vector2 val = Vector3Extensions.XY(position) - centerPosition; float sqrMagnitude = ((Vector2)(ref val)).sqrMagnitude; if (!(sqrMagnitude >= num)) { num = sqrMagnitude; result = debrisPickup; } } } return result; } private static float GetItemFoodPriority(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 GetWorstItemWeCanEat() { float num = -1f; PickupObject result = null; PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; foreach (PickupObject item in playerOwner.AllItems()) { float itemFoodPriority = GetItemFoodPriority(item, playerOwner); if (!(itemFoodPriority <= num)) { result = item; num = itemFoodPriority; } } return result; } private void UpdateAmmo() { if (_cachedAmmo != ((GunBehaviour)this).gun.CurrentAmmo) { _cachedAmmo = ((GunBehaviour)this).gun.CurrentAmmo; float val = (float)_cachedAmmo / (float)((GunBehaviour)this).gun.AdjustedMaxAmmo; int num = (base.Mastered ? 5 : _AmmoThresholds.FirstGE(val)); UpdateState((State)num); int num2 = (((GunBehaviour)this).PlayerOwner.HasSynergy(Synergy.STAY_HUNGRY) ? 4 : Mathf.Max(num - 1, 0)); if (((GunBehaviour)this).gun.CurrentStrengthTier != num2) { ((GunBehaviour)this).gun.CurrentStrengthTier = num2; } } } private void UpdateState(State newState) { if (_state != newState) { ((PickupObject)((GunBehaviour)this).gun).CanBeDropped = newState == State.Satiated; ((PickupObject)((GunBehaviour)this).gun).CanBeSold = ((PickupObject)((GunBehaviour)this).gun).CanBeDropped; ((GunBehaviour)this).PlayerOwner.inventory.GunLocked.SetOverride(ItemName, newState >= State.Starving, (float?)null); _state = newState; } } } public class HallaeributProjectile : MonoBehaviour { private enum State { START, DECEL, HALT, RELAUNCH } private const float _DECEL_START = 0.05f; private const float _HALT_START = 0.25f; private const float _RELAUNCH_START = 0.5f; private const float _LERP_RATE = 10f; private Projectile _projectile; private float _lifetime; private State _state; private float _startSpeed; private AIActor _target; private void Start() { _projectile = ((Component)this).GetComponent(); Projectile projectile = _projectile; projectile.OnHitEnemy = (Action)Delegate.Combine(projectile.OnHitEnemy, new Action(OnHitEnemy)); _startSpeed = _projectile.baseData.speed; _projectile.m_usesNormalMoveRegardless = true; } private void OnHitEnemy(Projectile arg1, SpeculativeRigidbody arg2, bool arg3) { //IL_0013: 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_0018: 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_001f: Unknown result type (might be due to invalid IL or missing references) tk2dBaseSprite sprite = ((BraveBehaviour)arg2).sprite; Vector2 val = ((sprite != null) ? sprite.WorldCenter : arg2.UnitCenter); GameObject biteVFX = Hallaeribut._BiteVFX; Vector3 position = Vector2.op_Implicit(val); float? fadeOutTime = 0.1f; CwaffVFX.Spawn(biteVFX, position, null, null, 0.3f, fadeOutTime); ((Component)arg2).gameObject.Play("chomp_large_sound"); } private void Update() { //IL_0071: 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_00fb: 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) _lifetime += BraveTime.DeltaTime; switch (_state) { case State.START: if (_lifetime >= 0.05f) { _state = State.DECEL; } break; case State.DECEL: if (_lifetime >= 0.25f) { _projectile.baseData.speed = 0.01f; _target = Lazy.NearestEnemy(_projectile.SafeCenter); _state = State.HALT; } else { _projectile.baseData.speed = Lazy.SmoothestLerp(_projectile.baseData.speed, 0f, 10f); } _projectile.UpdateSpeed(); break; case State.HALT: if (_lifetime >= 0.5f) { if (Object.op_Implicit((Object)(object)_target)) { _projectile.SendInDirection(((GameActor)_target).CenterPosition - _projectile.SafeCenter, false, true); } _state = State.RELAUNCH; } break; case State.RELAUNCH: _projectile.baseData.speed = Lazy.SmoothestLerp(_projectile.baseData.speed, _startSpeed, 10f); _projectile.UpdateSpeed(); break; } } } public class Natascha : CwaffGun { private class NataschaAmmoDisplay : CustomAmmoDisplay { private Gun _gun; private Natascha _natascha; private PlayerController _owner; private void Start() { _gun = ((Component)this).GetComponent(); _natascha = ((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) || !Object.op_Implicit((Object)(object)_natascha)) { return false; } if (!_natascha._maintainSpinup) { uic.GunAmmoCountLabel.Text = CustomAmmoDisplayExtensions.VanillaAmmoDisplay(_owner); } else { uic.GunAmmoCountLabel.Text = "[color #ddffaa]Revved[/color]\n" + CustomAmmoDisplayExtensions.VanillaAmmoDisplay(_owner); } return true; } } public static string ItemName = "Natascha"; public static string ShortDescription = "Fear no Man"; public static string LongDescription = "Fires projectiles more quickly the longer it is spun up, but proportionally reduces movement speed as well. Reloading toggles whether the gun remains spun up while not firing, maintaining both the increased fire rate and reduced movement speed."; public static string Lore = "The beloved gun of an amicable literature Ph.D., who refused to let anyone else so much as touch his precious Natascha. That is, until convinced by a hulking Australian man to grant ownership rights in exchange for unlimited lifetime access to the \"best sandwiches south of the equator.\""; private const float _SPIN_UP_TIME = 3.5f; private const float _MAX_SPIN_UP = 8f; private const float _BASE_COOLDOWN = 0.05f; private const int _FIRE_ANIM_FRAMES = 8; private float _rawSpinupTime; private float _speedMult = 1f; private bool _maintainSpinup; public static void Init() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 161; Color? muzzleEmissionColor = new Color(0.95f, 0.95f, 0.95f); Gun gun2 = gun.SetAttributes((ItemQuality)1, (GunClass)10, 0f, 1500, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, null, null, null, null, null, null, -1, -1, -1, null, modulesAreTiers: false, "muzzle_natascha", 60, 0.3f, (Anchor)4, 12f, muzzleEmissionColor, 12f, muzzleLit: false, 15f, 0.375f, null, null, preventRotation: false, 0f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: false, rampUpFireRate: true, 0f, suppressReloadAnim: false, (GunHandedness)0, autoPlay: true, attacksThroughWalls: false, suppressReloadLabel: false, 1f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: false, preventRollingWhenCharging: false, 1f, -1f, canAttackWhileRolling: false, isStarterGun: false, 1f, preventDuctTape: false, 0.85f).Attach((Action)null, allowDuplicates: false).SetCasing(Items.Ak47) .AddToShop((ShopType)3) .AddToShop(ModdedShopType.Rusty); int? clipSize = -1; float? cooldown = 0.05f; float? angleVariance = 15f; float? damage = 3f; float? speed = 20f; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, null, null, 0f, 0f, 0f, 1f, null, null, null, null, null, "natascha_bullet", 12, (Anchor)4, 0.5f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, "tomislav_shoot")); } public override void Update() { base.Update(); PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null) { return; } if (playerOwner.IsDodgeRolling || (!_maintainSpinup && !((GunBehaviour)this).gun.IsFiring)) { if (_speedMult != 1f) { ResetSpinup(); } return; } ((MonoBehaviour)(object)((GunBehaviour)this).gun).LoopSoundIf(Object.op_Implicit((Object)(object)((GunBehaviour)this).gun) && (_maintainSpinup || ((GunBehaviour)this).gun.IsFiring), "minigun_spin"); if (_maintainSpinup && ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.currentClip.name != ((GunBehaviour)this).gun.shootAnimation) { if (_speedMult == 1f) { ((Component)((GunBehaviour)this).gun).gameObject.Play("minigun_wind_down_stop"); } ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.currentClip = ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.GetClipByName(((GunBehaviour)this).gun.shootAnimation); ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.Play(); } if (_rawSpinupTime < 3.5f) { _rawSpinupTime += BraveTime.DeltaTime; float num = _rawSpinupTime / 3.5f; float speedMult = 1f + 8f * num * num; ResetSpinup(speedMult); } } public override void OnReloadPressed(PlayerController player, Gun gun, bool manualReload) { base.OnReloadPressed(player, gun, manualReload); if (!player.IsDodgeRolling && player.AcceptingNonMotionInput) { _maintainSpinup = !_maintainSpinup; } } public override void OnPostFired(PlayerController player, Gun gun) { ((GunBehaviour)this).OnPostFired(player, gun); if (_speedMult == 1f) { ((Component)gun).gameObject.Play("minigun_wind_down_stop"); ((Component)gun).gameObject.Play("minigun_spin"); } } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); player.OnRollStarted += OnDodgeRoll; _maintainSpinup = false; ResetSpinup(); } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); player.OnRollStarted -= OnDodgeRoll; _maintainSpinup = false; ResetSpinup(); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((GunBehaviour)this).PlayerOwner.OnRollStarted -= OnDodgeRoll; } base.OnDestroy(); } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); _maintainSpinup = false; ResetSpinup(); } private void OnDodgeRoll(PlayerController player, Vector2 dirVec) { _maintainSpinup = false; ResetSpinup(); } public override void OnFinishAttack(PlayerController player, Gun gun) { if (!_maintainSpinup) { ResetSpinup(); } } private int ComputeAnimationSpeed() { float num = ((GunBehaviour)this).PlayerOwner.stats.GetStatValue((StatType)1) * GetDynamicFireRate(); float num2 = (((GunBehaviour)this).gun.DefaultModule.cooldownTime + ((GunBehaviour)this).gun.gunCooldownModifier) / num; float num3 = 8f / num2; return 1 + Mathf.CeilToInt(num3); } private void ResetSpinup(float speedMult = 1f) { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { if (_speedMult > 1f && speedMult == 1f) { ((Component)((GunBehaviour)this).gun).gameObject.Play("minigun_spin_stop"); ((Component)((GunBehaviour)this).gun).gameObject.Play("minigun_wind_up_stop"); ((Component)((GunBehaviour)this).gun).gameObject.Play("minigun_wind_down"); _rawSpinupTime = 0f; } _speedMult = speedMult; ((BraveBehaviour)(object)((GunBehaviour)this).gun).AdjustAnimation(((GunBehaviour)this).gun.shootAnimation, ComputeAnimationSpeed()); GunTools.RemoveStatFromGun(((GunBehaviour)this).gun, (StatType)0); if (base.Mastered) { ((GunBehaviour)this).gun.AddStatToGun(((StatType)0).Mult(1f)); } else { ((GunBehaviour)this).gun.AddStatToGun(((StatType)0).Mult(1f / (float)Math.Sqrt(_speedMult))); } VolleyRebuildHelpers.RecalculateStatsWithoutRebuildingGunVolleys(((GunBehaviour)this).PlayerOwner.stats, ((GunBehaviour)this).PlayerOwner); } } public override float GetDynamicFireRate() { return _speedMult / 9f; } } public class Flakseed : CwaffGun { public static string ItemName = "Flakseed"; public static string ShortDescription = "Orgunic Gardening"; public static string LongDescription = "Fires flak seeds that grow into flak flowers after 3 seconds. Bullets pollinate flak sprouts they pass over, with stronger bullets causing faster growth. Grown flowers fire flak for 15 seconds before withering. Flowers will not wither while planted in water, and wither instantly when trampled or exposed to hostile terrain."; public static string Lore = "The quintessential tool for both practitioners of warfare-based gardening and practitioners of gardening-based warfare. Disregarding the fact that the combined demographic for both of these hobbies was 0 at the time of this tool's invention, a successful decade-long marketing campaign has since brought that number up to 2. With just a tiny bit of practice, you could be the one to let them technically, legally claim that number is 3!"; internal static GameObject _FlakFlowerPrefab = null; internal static GameObject _MegaFlakFlowerPrefab = null; internal static Projectile _FlakFlowerProjectile = null; internal static GameObject _PetalVFX = null; internal static GameObject _VineVFX = null; public static void Init() { //IL_05f3: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? idleFps = 6; int? shootFps = 30; int? reloadFps = 18; Items? muzzleFrom = Items.Mailbox; Gun gun2 = gun.SetAttributes((ItemQuality)2, (GunClass)1, 1.5f, 300, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, idleFps, shootFps, reloadFps, null, null, "flakseed_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).SetReloadAudio("flakseed_reload_sound", 3, 22).SetReloadAudio("flakseed_deposit_sound", 13, 14, 16, 17); int? clipSize = 12; float? cooldown = 0.16f; bool? preventOrbiting = true; float? damage = 0f; float? speed = 24f; float? force = 10f; float? range = 30f; bool? shouldRotate = false; ((Projectile)(object)gun2.InitSpecialProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "flakseed_bullet", 12, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, shouldRotate, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, preventOrbiting))).Attach((Action)delegate(GrenadeProjectile g) { g.startingHeight = 0.5f; }, allowDuplicates: false).Attach((Action)delegate(BounceProjModifier bounce) { bounce.percentVelocityToLoseOnBounce = 0.5f; bounce.numberOfBounces = Mathf.Max(bounce.numberOfBounces, 0) + 3; }, allowDuplicates: false).Attach(); _FlakFlowerPrefab = VFX.Create("flakseed_sprout", 2f, loops: true, -1, 1f, (Anchor)1, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 1f); _FlakFlowerPrefab.AddAnimation("bloom", "flakseed_flower", 4f, loops: true, -1, (Anchor)1, 1f); _FlakFlowerPrefab.AddComponent(); _FlakFlowerPrefab.AutoRigidBody((CollisionLayer)0); _MegaFlakFlowerPrefab = VFX.Create("mega_flak_flower_sprout", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 1f); _MegaFlakFlowerPrefab.AddAnimation("wait", "mega_flak_flower_wait", 10f, loops: true, -1, (Anchor)4, 1f); _MegaFlakFlowerPrefab.AddAnimation("attack", "mega_flak_flower_attack", 10f, loops: false, -1, (Anchor)4, 1f); _MegaFlakFlowerPrefab.AddAnimation("vanish", "mega_flak_flower_vanish", 10f, loops: false, -1, (Anchor)4, 1f); _MegaFlakFlowerPrefab.AddComponent().mega = true; _MegaFlakFlowerPrefab.AutoRigidBody((CollisionLayer)0); Color lightGreen = new Color(0.7f, 0.85f, 0.65f); range = 1f; force = 50f; speed = 1f; damage = 80f; _FlakFlowerProjectile = Items.Ak47.CloneProjectile(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, range, force, speed, damage, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "flakseed_flower_bullet", 2, (Anchor)4)).Attach((Action)delegate(EasyTrailBullet trail) { //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_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) //IL_0040: 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_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_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) trail.TrailPos = ((BraveBehaviour)trail).transform.position; trail.StartWidth = 0.1f; trail.EndWidth = 0.025f; trail.LifeTime = 0.05f; trail.BaseColor = lightGreen; trail.StartColor = lightGreen; trail.EndColor = Color.Lerp(lightGreen, Color.white, 0.25f); }, allowDuplicates: false); _PetalVFX = VFX.Create("flakseed_petal", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 2f); _VineVFX = VFX.Create("vine_attack_vfx", 60f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 2f); } } public class FlakseedProjectile : MonoBehaviour { private const float _AIR_FRICTION = 0.96f; private GrenadeProjectile _projectile; private PlayerController _owner; private bool _mastered; private void Start() { _projectile = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = ((Projectile)_projectile).Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); _mastered = ((Projectile)(object)_projectile).Mastered(); ProjectileData baseData = ((Projectile)_projectile).baseData; baseData.speed *= 0.95f + 0.1f * Random.value; ((Projectile)_projectile).OnDestruction += CreateSprout; } private void CreateSprout(Projectile projectile) { //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_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_0033: 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_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) Vector2 safeCenter = projectile.SafeCenter; if (!GameManager.Instance.Dungeon.CellIsPit(Vector2.op_Implicit(safeCenter))) { (_mastered ? Flakseed._MegaFlakFlowerPrefab : Flakseed._FlakFlowerPrefab).Instantiate(Vector2.op_Implicit(safeCenter)).GetComponent()._owner = _owner; SpawnManager.SpawnVFX(VFX.MiniPickup, Vector2.op_Implicit(safeCenter), Lazy.RandomEulerZ()); } } private void Update() { if (Object.op_Implicit((Object)(object)_projectile)) { if (_projectile.m_current3DVelocity.z < 0f) { ((Projectile)(object)_projectile).ApplyFriction(0.96f); return; } ((Component)this).gameObject.Play("flak_plant_sound"); ((Projectile)_projectile).DieInAir(true, true, true, false); } } } public class FlakseedFlower : MonoBehaviour { private const float _GROWTH_TIME = 3f; private const float _MIN_FIRE_RATE = 0.5f; private const float _FIRE_RATE_VARIANCE = 0.25f; private const float _WILT_TIME = 15f; private const float _WILT_CHECK_RATE = 0.1f; private const float _WATER_GROWTH_MULT = 3f; private const float _ATTACK_RATE = 2f; private const float _ATTACK_CHECK_RATE = 0.5f; private const float _ATTACK_DAMAGE = 25f; private const float _ATTACK_RADIUS = 5f; private const float _ATTACK_RADIUS_SQR = 25f; private static List _ExtantFlowers = new List(); private bool _grown; private float _growthTimer; private float _fireTimer; private float _wiltTimer; private float _wiltRate = 1f; private float _nextWiltCheck; private float _nextFireRate; private tk2dSprite _sprite; private SpeculativeRigidbody _body; private Vector2 _firePos; private bool _wilting; private float _nextAttackCheck; private tk2dSpriteAnimator _animator; private bool _growsFasterInWater; internal PlayerController _owner; public bool mega; private void Start() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_0092: 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_00a6: 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) _ExtantFlowers.Add(this); _sprite = ((Component)this).GetComponent(); ((BraveBehaviour)_sprite).renderer.material.shader = ShaderCache.Acquire("Brave/PlayerShader"); ((tk2dBaseSprite)_sprite).usesOverrideMaterial = true; _body = ((Component)this).gameObject.GetComponent(); _animator = ((Component)this).gameObject.GetComponent(); SpeculativeRigidbody body = _body; body.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)body.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(PollinatedByBullets)); _firePos = ((tk2dBaseSprite)_sprite).WorldTopCenter + new Vector2(0f, -0.125f); _nextFireRate = 0.5f + 0.25f * Random.value; tk2dSpriteAnimator animator = _animator; animator.AnimationCompleted = (Action)Delegate.Combine(animator.AnimationCompleted, new Action(OnAnimationCompleted)); _growsFasterInWater = Synergy.LAWN_CARE.Active(); } private void OnAnimationCompleted(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip) { if (_wilting) { Wilt(vanish: true); } else if (clip.name.Contains("attack")) { animator.Play("wait"); } } private bool CanTrample(AIActor enemy) { if (mega) { return false; } if (!Object.op_Implicit((Object)(object)enemy) || ((GameActor)enemy).IsFlying || ((GameActor)enemy).IsGone || enemy.IsHarmlessEnemy || !((Behaviour)enemy).isActiveAndEnabled) { return false; } HealthHaver healthHaver = ((BraveBehaviour)enemy).healthHaver; if (healthHaver != null && healthHaver.IsDead) { return false; } return true; } private void PollinatedByBullets(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { PhysicsEngine.SkipCollision = true; if (!Object.op_Implicit((Object)(object)otherRigidbody)) { return; } AIActor component = ((Component)otherRigidbody).gameObject.GetComponent(); if (component != null && CanTrample(component)) { Wilt(); } else if (!_grown) { Projectile component2 = ((Component)otherRigidbody).gameObject.GetComponent(); if (component2 != null) { float num = ((component2.Owner is PlayerController) ? (0.1f * component2.baseData.damage) : 1f); _growthTimer += num; ((Component)this).gameObject.Play("flakseed_pollinate_sound"); DoPollinationVFX(); myRigidbody.RegisterSpecificCollisionException(otherRigidbody); } } } private void DoPollinationVFX() { DoPetalVFX(pollination: true); } private void DoMegaPetalVFX() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) GameObject leafVFX = Yggdrashell._LeafVFX; Vector2 firePos = _firePos; float? startScale = 1f; float? endScale = 0.1f; CwaffVFX.SpawnBurst(leafVFX, 60, firePos, 1f, null, 4f, 4f, CwaffVFX.Vel.Random, CwaffVFX.Rot.Random, 0.5f, null, 0f, null, fadeIn: false, uniform: false, startScale, endScale, null, randomFrame: true); } private void DoTrampleVFX() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) ((Component)this).gameObject.Play("trample_sound"); GameObject earthClod = Groundhog._EarthClod; Vector2 firePos = _firePos; float? fadeOutTime = 0.1f; float? startScale = 1f; float? endScale = 0.2f; CwaffVFX.SpawnBurst(earthClod, 11, firePos, 0.25f, null, 0f, 4f, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.Random, 0.35f, fadeOutTime, 0f, null, fadeIn: false, uniform: false, startScale, endScale); } private void DoPetalVFX(bool pollination = false) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) GameObject prefab = (pollination ? Flakseed._PetalVFX : Flakseed._PetalVFX); Vector2 firePos = _firePos; float? fadeOutTime = 0.1f; float? startScale = 1f; float? endScale = 0.5f; CwaffVFX.SpawnBurst(prefab, 6, firePos, 0.25f, null, 0f, 4f, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.Random, 0.35f, fadeOutTime, 0f, null, fadeIn: false, uniform: true, startScale, endScale); } private void AttackNearbyEnemies() { //IL_001e: 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_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_0075: 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_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_015b: Unknown result type (might be due to invalid IL or missing references) float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; if (scaledTimeSinceStartup < _nextAttackCheck) { return; } _nextAttackCheck = scaledTimeSinceStartup + 0.5f; AIActor val = Lazy.NearestEnemy(_firePos); if (!Object.op_Implicit((Object)(object)val)) { return; } Vector2 val2 = ((GameActor)val).CenterPosition - _firePos; if (((Vector2)(ref val2)).sqrMagnitude > 25f) { return; } _animator.Play("attack"); ((tk2dBaseSprite)_sprite).FlipX = ((BraveBehaviour)val).sprite.WorldCenter.x < ((tk2dBaseSprite)_sprite).WorldCenter.x; ((Component)this).gameObject.Play("vine_attack_sound"); GameObject vineVFX = Flakseed._VineVFX; Vector3 position = Vector2.op_Implicit(((GameActor)val).CenterPosition); float? fadeOutTime = 0.05f; float? height = 10f; CwaffVFX.Spawn(vineVFX, position, null, null, 0.25f, fadeOutTime, 0f, null, fadeIn: false, null, null, height); if (!((GameActor)val).IsGone) { HealthHaver healthHaver = ((BraveBehaviour)val).healthHaver; if (healthHaver != null && healthHaver.IsAlive && healthHaver.IsVulnerable) { healthHaver.ApplyDamage(25f, val2, Flakseed.ItemName, (CoreDamageTypes)0, (DamageCategory)0, false, (PixelCollider)null, false); BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)healthHaver).behaviorSpeculator; if (behaviorSpeculator != null && !behaviorSpeculator.ImmuneToStun) { behaviorSpeculator.Stun(2.1f, true); } } } _nextAttackCheck = scaledTimeSinceStartup + 2f; } private void Update() { //IL_000f: 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_0123: 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_01ee: 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_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0274: 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_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0221: 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) if (_wilting) { return; } GoopDefinition goopDef; GoopPositionData goopData = _body.UnitBottomCenter.GoopData(out goopDef); if (!mega && InHostileSoil(goopData, goopDef)) { Wilt(); return; } if (mega && _grown) { AttackNearbyEnemies(); } bool flag = InNutritiousSoil(goopData, goopDef); float deltaTime = BraveTime.DeltaTime; if (!_grown) { _growthTimer += deltaTime * ((flag && _growsFasterInWater) ? 3f : 1f); if (_growthTimer >= 3f) { ((tk2dBaseSprite)_sprite).scale = Vector3.one; _grown = true; _animator.Play(mega ? "wait" : "bloom"); if (mega) { DoMegaPetalVFX(); } else { DoPetalVFX(); } ((Component)this).gameObject.Play("flak_bloom_sound"); } else { float num = 0.3f + 0.7f * (_growthTimer / 3f); ((tk2dBaseSprite)_sprite).scale = new Vector3(num, num, num); } return; } if (flag) { _wiltTimer = 0f; } else if ((_wiltTimer += deltaTime * RateOfWilting()) >= 15f) { Wilt(); return; } if ((_fireTimer += deltaTime) >= _nextFireRate) { _fireTimer = 0f; _nextFireRate = 0.5f + 0.25f * Random.value; GameActor val = (GameActor)(object)Lazy.NearestEnemy(_firePos); if (!Object.op_Implicit((Object)(object)val)) { val = (GameActor)(object)_owner; } if (!Object.op_Implicit((Object)(object)val)) { _ = _firePos + Lazy.RandomVector(); } else { _ = val.CenterPosition; } float shootAngle = Lazy.RandomAngle(); if (Object.op_Implicit((Object)(object)val)) { Lazy.DeterminePerfectAngleToShootAt(_firePos, val.CenterPosition, (Vector2)(Object.op_Implicit((Object)(object)((BraveBehaviour)val).specRigidbody) ? ((BraveBehaviour)val).specRigidbody.Velocity : default(Vector2)), Flakseed._FlakFlowerProjectile.baseData.speed * _owner.ProjSpeedMult(), out shootAngle, out var _, adjustForTurboMode: false); } Projectile component = SpawnManager.SpawnProjectile(((Component)Flakseed._FlakFlowerProjectile).gameObject, Vector2.op_Implicit(_firePos), shootAngle.EulerZ(), true).GetComponent(); component.SetOwnerAndStats((GameActor)(object)_owner); _owner.DoPostProcessProjectile(component); ((Component)component).gameObject.Play("flak_flower_shoot_sound"); } } private float RateOfWilting() { float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; if (_nextWiltCheck > scaledTimeSinceStartup) { return _wiltRate; } _nextWiltCheck = scaledTimeSinceStartup + 0.1f; _wiltRate = 1f; Object.op_Implicit((Object)(object)_sprite); return _wiltRate; } private bool InHostileSoil(GoopPositionData goopData, GoopDefinition goopDef) { if (!Object.op_Implicit((Object)(object)goopDef)) { return false; } if (goopData.IsOnFire) { return true; } if (goopData.IsFrozen) { return true; } if (goopData.IsElectrified) { return true; } if (goopDef.isOily) { return true; } if (goopDef.AppliesDamageOverTime) { return true; } return false; } private bool InNutritiousSoil(GoopPositionData goopData, GoopDefinition goopDef) { if (Object.op_Implicit((Object)(object)goopDef)) { return goopDef.usesWaterVfx; } return false; } private void OnDestroy() { _ExtantFlowers.Remove(this); } private void Wilt(bool vanish = false) { if (_wilting && !vanish) { return; } if (!_grown) { DoTrampleVFX(); Object.Destroy((Object)(object)((Component)this).gameObject); return; } ((Component)this).gameObject.Play("flak_wilt_sound"); if (!mega) { DoPetalVFX(); Object.Destroy((Object)(object)((Component)this).gameObject); } else if (!vanish) { _animator.Play("vanish"); _wilting = true; } else { Object.Destroy((Object)(object)((Component)this).gameObject); } } } public class Bubblebeam : CwaffGun { public static string ItemName = "Bubblebeam"; public static string ShortDescription = "Next to Godliness"; public static string LongDescription = "Fires a stream of bubbles that capture enemy projectiles, and have a chance to capture enemies proportional to the enemy's size. Captured projectiles can damage enemies but not the player, and are destroyed when popped. Captured enemies cannot move or shoot, and are released when popped. Bubbles can be used to push around captured projectiles and enemies, but other projectiles will pop bubbles."; public static string Lore = "A rather lengthy inscryption is printed on the side: 'First go like this, spin around. Stop! Double take three times: one, two, three. Then, pelvic thrust! Whoooo! Whooooooo! Stop on your right foot, don't forget it! Now it's time to bring it around town. Bring-it-around-town. Then you do this, then this, and this, and that, and-this-and-that-and-this-and-that, and then...' -- the rest is cut off."; internal static GameObject _BubbleVFX = null; internal static GameObject _BurstBubbleVFX = null; private int _lastReloadBubbleFrame; public static void Init() { //IL_0020: 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) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); GunClass uTILITY = CwaffGunClass.UTILITY; int? shootFps = 60; int? reloadFps = 24; IntVector2? carryOffset = new IntVector2(14, 4); Gun gun2 = gun.SetAttributes((ItemQuality)3, uTILITY, 1.25f, 2400, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "bubble_pop_sound", null, null, -1, -1, -1, null, modulesAreTiers: false, null, 60, 1f, (Anchor)3, -1f, null, -1f, muzzleLit: false, 0f, 0f, null, carryOffset, 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("bubblebeam_close_sound", 1).SetReloadAudio("seltzer_insert_sound", 9) .SetReloadAudio("seltzer_shake_sound", 17, 19, 21, 23, 25, 27); int? clipSize = 100; float? cooldown = 0.05f; bool? collidesWithProjectiles = true; float? damage = 0f; float? speed = 35f; float? range = 18f; float? force = 10f; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, collidesWithProjectiles, null, null, "bubblebeam_projectile", 16, (Anchor)4, 0.5f)).Attach(); _BubbleVFX = VFX.Create("capture_bubble", 6f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _BurstBubbleVFX = VFX.Create("burst_bubble_vfx", 16f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } public override void Update() { //IL_0059: 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_0072: Unknown result type (might be due to invalid IL or missing references) base.Update(); if (((GunBehaviour)this).gun.IsReloading) { int currentFrame = ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.CurrentFrame; if (currentFrame >= 17 && currentFrame != _lastReloadBubbleFrame && BraveTime.DeltaTime != 0f) { _lastReloadBubbleFrame = currentFrame; CwaffVFX.SpawnBurst(_BurstBubbleVFX, 2, Vector2.op_Implicit(((GunBehaviour)this).gun.barrelOffset.position), 1f, (Vector2?)new Vector2(0f, 2.5f), 0f, 2.5f, CwaffVFX.Vel.Random, CwaffVFX.Rot.Random, 0.5f, (float?)0.1f, 0f, (Color?)null, fadeIn: false, uniform: false, (float?)null, (float?)null, (float?)null, randomFrame: false, -1, flipX: false, flipY: false, (Transform)null, (Color?)null, 1.55f, 0f, (tk2dSpriteCollectionData)null, -1, 0f, 0f, unoccluded: false, copyShaders: false); } } } public override void OnPostFired(PlayerController player, Gun gun) { //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) ((GunBehaviour)this).OnPostFired(player, gun); GameObject burstBubbleVFX = _BurstBubbleVFX; Vector2 basePosition = Vector2.op_Implicit(((GunBehaviour)this).gun.barrelOffset.position); float? fadeOutTime = 0.1f; CwaffVFX.SpawnBurst(burstBubbleVFX, 4, basePosition, 1f, null, 0f, 5f, CwaffVFX.Vel.Random, CwaffVFX.Rot.Random, 0.5f, fadeOutTime); } } public class BubblebeamProjectile : MonoBehaviour { private Projectile _projectile; private PlayerController _owner; private Bubblebeam _gun; private float _force; private bool _mastered; private const float _BASE_ENBUBBLE_ENEMY_CHANCE = 0.5f; private void Start() { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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)) { Gun currentGun = ((GameActor)_owner).CurrentGun; if (currentGun != null) { _gun = ((Component)currentGun).gameObject.GetComponent(); } _mastered = _owner.HasSynergy(Synergy.MASTERY_BUBBLEBEAM); _force = _projectile.baseData.force; _projectile.baseData.force = 0f; 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(OnHitEnemy)); _projectile.OnDestruction += OnDestruction; } } private static void OnDestruction(Projectile proj) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)proj) && Object.op_Implicit((Object)(object)((Component)proj).gameObject)) { GameObject burstBubbleVFX = Bubblebeam._BurstBubbleVFX; Vector2 safeCenter = proj.SafeCenter; float? fadeOutTime = 0.1f; CwaffVFX.SpawnBurst(burstBubbleVFX, 10, safeCenter, 1f, null, 0f, 5f, CwaffVFX.Vel.Random, CwaffVFX.Rot.Random, 0.5f, fadeOutTime); ((Component)proj).gameObject.Play("bubble_pop_sound"); proj.OnDestruction -= OnDestruction; } } private void OnPreRigidbodyCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { if (!Object.op_Implicit((Object)(object)_projectile)) { return; } Projectile component = ((Component)otherRigidbody).gameObject.GetComponent(); if (component != null) { PhysicsEngine.SkipCollision = true; if (!Object.op_Implicit((Object)(object)((Component)component).gameObject.GetComponent()) && component.Owner is AIActor) { EnbubbleProjectile(component); PopSelf(); } } } private void PopSelf() { _projectile.DieInAir(false, true, true, false); } private void EnbubbleProjectile(Projectile p) { if (Object.op_Implicit((Object)(object)((BraveBehaviour)p).specRigidbody)) { EnbubbledBehaviour orAddComponent = GameObjectExtensions.GetOrAddComponent(((Component)p).gameObject); if (_mastered) { orAddComponent._mastered = true; } orAddComponent.PushBubble(_projectile, _force); } } private void OnHitEnemy(Projectile p, SpeculativeRigidbody enemy, bool _) { EnbubbledBehaviour component = ((Component)enemy).gameObject.GetComponent(); if (component != null) { component.PushBubble(_projectile, _force); return; } tk2dBaseSprite component2 = ((Component)enemy).gameObject.GetComponent(); if (component2 == null) { return; } float num = 0.5f / Mathf.Max(1f, 2f * component2.GetCurrentSpriteDef().boundsDataExtents.y); if (Random.value > num) { return; } AIActor component3 = ((Component)enemy).gameObject.GetComponent(); if (component3 == null) { return; } HealthHaver component4 = ((Component)enemy).gameObject.GetComponent(); if (component4 == null || component4.IsBoss || component4.IsSubboss) { return; } BehaviorSpeculator component5 = ((Component)component3).gameObject.GetComponent(); if (component5 != null && !component5.ImmuneToStun) { EnbubbledBehaviour enbubbledBehaviour = ((Component)component3).gameObject.AddComponent(); if (_mastered) { enbubbledBehaviour._mastered = true; } enbubbledBehaviour.PushBubble(_projectile, _force); } } } public class EnbubbledBehaviour : MonoBehaviour { [HarmonyPatch(typeof(KnockbackDoer), "Update")] private class KnockbackDoerUpdateForBubblePatch { private static bool Prefix(KnockbackDoer __instance) { EnbubbledBehaviour component = ((Component)__instance).gameObject.GetComponent(); if (component == null) { return true; } component.UpdateKnockback(); return false; } } private const float _BUBBLE_FORCE = 0.01f; private const string _FLIGHT_REASON = "Enbubbled"; private const float _MIN_DRIFT = 2.5f; private const float _BUBBLE_DRIFT_DECAY = 1f; internal bool _mastered; private Shader _oldShader; private GameObject _vfx; private AIActor _enemy; private Projectile _proj; private tk2dSprite _bubble; private bool _setup; private Vector2 _drift = Vector2.zero; private float _vfxSize = 1f; private bool _projectileCollisionOverride; private Transform _parent; private tk2dBaseSprite _parentSprite; private Vector3 _startPos; private SpeculativeRigidbody _body; public void PushBubble(Projectile pusher, float force) { Setup(); PushEnemyBubble(pusher, force); PushProjectileBubble(pusher, force); } private void PushEnemyBubble(Projectile pusher, float force) { //IL_005f: 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_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_0088: 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).specRigidbody) && Object.op_Implicit((Object)(object)((BraveBehaviour)_enemy).knockbackDoer)) { float num = 0.1f * Mathf.Max(1f, ((BraveBehaviour)_enemy).knockbackDoer.weight); SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_enemy).specRigidbody; specRigidbody.Velocity += 0.01f * force * pusher.Speed * pusher.Direction / num; UpdateKnockback(); } } private void PushProjectileBubble(Projectile pusher, float force) { //IL_002b: 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_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_0067: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_proj) && Object.op_Implicit((Object)(object)((BraveBehaviour)_proj).specRigidbody)) { Vector2 val = ((BraveBehaviour)_proj).specRigidbody.Velocity + 0.01f * force * pusher.Speed * pusher.Direction; _proj.SetSpeed(((Vector2)(ref val)).magnitude); _proj.SendInDirection(val, true, true); } } private void Start() { Setup(); } private void Setup() { //IL_00ac: 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_00ef: 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 (_setup) { return; } _setup = true; _enemy = ((Component)this).gameObject.GetComponent(); _proj = ((Component)this).gameObject.GetComponent(); if (Object.op_Implicit((Object)(object)_enemy) && Object.op_Implicit((Object)(object)((BraveBehaviour)_enemy).sprite) && Object.op_Implicit((Object)(object)((BraveBehaviour)_enemy).specRigidbody)) { SetupForEnemy(); } else { if (!Object.op_Implicit((Object)(object)_proj) || !Object.op_Implicit((Object)(object)((BraveBehaviour)_proj).sprite) || !Object.op_Implicit((Object)(object)((BraveBehaviour)_proj).specRigidbody)) { return; } SetupForProjectile(); } _vfx = SpawnManager.SpawnVFX(Bubblebeam._BubbleVFX, _startPos, Quaternion.identity, true); _vfx.transform.parent = _parent; _bubble = _vfx.GetComponent(); ((tk2dBaseSprite)(object)_bubble).PlaceAtScaledPositionByAnchor(_startPos, (Anchor)4); ((Component)(object)_bubble).SetAlphaImmediate(0.25f); tk2dSpriteDefinition currentSpriteDef = _parentSprite.GetCurrentSpriteDef(); tk2dSpriteDefinition currentSpriteDef2 = ((tk2dBaseSprite)_bubble).GetCurrentSpriteDef(); _vfxSize = currentSpriteDef2.boundsDataExtents.y; float num = 0.25f + Mathf.Max(currentSpriteDef.boundsDataExtents.x, currentSpriteDef.boundsDataExtents.y) / _vfxSize; ((tk2dBaseSprite)_bubble).scale = new Vector3(num, num, 1f); _vfxSize = 0.5f * currentSpriteDef2.boundsDataExtents.y * num; } private void SetupForEnemy() { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) _body = ((BraveBehaviour)_enemy).specRigidbody; ((GameActor)_enemy).SetIsFlying(true, "Enbubbled", true, true); SpeculativeRigidbody body = _body; body.OnCollision = (Action)Delegate.Combine(body.OnCollision, new Action(OnAnyCollision)); if (!_body.HasCollisionLayerIgnoreOverride(CollisionMask.LayerToMask((CollisionLayer)4))) { _projectileCollisionOverride = true; _enemy.HitByEnemyBullets = true; _body.AddCollisionLayerOverride(CollisionMask.LayerToMask((CollisionLayer)4)); } BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)_enemy).behaviorSpeculator; if (behaviorSpeculator != null && !behaviorSpeculator.ImmuneToStun) { behaviorSpeculator.Stun(36000f, false); } _parent = ((BraveBehaviour)_enemy).transform; _startPos = Vector2.op_Implicit(((GameActor)_enemy).CenterPosition); _parentSprite = ((BraveBehaviour)_enemy).sprite; } private void SetupForProjectile() { //IL_0103: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Expected O, but got Unknown //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Expected O, but got Unknown _body = ((BraveBehaviour)_proj).specRigidbody; _proj.RemoveBulletScriptControl(); if (Object.op_Implicit((Object)(object)_body) && Object.op_Implicit((Object)(object)_proj.Owner) && Object.op_Implicit((Object)(object)((BraveBehaviour)_proj.Owner).specRigidbody)) { _body.DeregisterSpecificCollisionException(((BraveBehaviour)_proj.Owner).specRigidbody); } _proj.baseData.range = 9999f; _proj.allowSelfShooting = true; _proj.collidesWithEnemies = true; _proj.collidesWithPlayer = false; _proj.collidesWithProjectiles = true; _proj.collidesOnlyWithPlayerProjectiles = !_mastered; if (Object.op_Implicit((Object)(object)((BraveBehaviour)_proj).sprite)) { _oldShader = ((BraveBehaviour)((BraveBehaviour)_proj).sprite).renderer.material.shader; _proj.ChangeTintColorShader(0f, Color.cyan); } _proj.baseData.damage = Mathf.Max(new float[3] { 15f, _proj.baseData.damage, ProjectileData.FixedFallbackDamageToEnemies }); _proj.UpdateCollisionMask(); _proj.ResetDistance(); _proj.BulletScriptSettings.surviveTileCollisions = true; SpeculativeRigidbody body = _body; body.OnCollision = (Action)Delegate.Combine(body.OnCollision, new Action(OnAnyCollision)); if (_mastered) { SpeculativeRigidbody body2 = _body; body2.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)body2.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreRigidbodyCollision)); } _proj.OnDestruction += OnDestruction; _parent = ((BraveBehaviour)_proj).transform; _startPos = Vector2.op_Implicit(_proj.SafeCenter); _parentSprite = ((BraveBehaviour)_proj).sprite; } private void OnPreRigidbodyCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)otherRigidbody) || !Object.op_Implicit((Object)(object)((Component)otherRigidbody).gameObject)) { return; } Projectile projectile = ((BraveBehaviour)otherRigidbody).projectile; if (projectile != null && !(projectile.Owner is PlayerController)) { PhysicsEngine.SkipCollision = true; if (Object.op_Implicit((Object)(object)_proj) && _mastered && !Object.op_Implicit((Object)(object)((Component)projectile).gameObject.GetComponent())) { EnbubbledBehaviour enbubbledBehaviour = ((Component)projectile).gameObject.AddComponent(); enbubbledBehaviour._mastered = true; enbubbledBehaviour.PushBubble(_proj, Mathf.Max(_proj.baseData.force, 10f)); PushBubble(projectile, Mathf.Max(projectile.baseData.force, 10f)); GameObject burstBubbleVFX = Bubblebeam._BurstBubbleVFX; Vector2 safeCenter = _proj.SafeCenter; float? fadeOutTime = 0.1f; CwaffVFX.SpawnBurst(burstBubbleVFX, 10, safeCenter, 1f, null, 0f, 5f, CwaffVFX.Vel.Random, CwaffVFX.Rot.Random, 0.5f, fadeOutTime); ((Component)this).gameObject.Play("bubble_pop_sound"); } } } private void OnDestruction(Projectile proj) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown SpeculativeRigidbody specRigidbody = ((BraveBehaviour)proj).specRigidbody; specRigidbody.OnCollision = (Action)Delegate.Remove(specRigidbody.OnCollision, new Action(OnAnyCollision)); SpeculativeRigidbody specRigidbody2 = ((BraveBehaviour)proj).specRigidbody; specRigidbody2.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Remove((Delegate?)(object)specRigidbody2.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreRigidbodyCollision)); proj.OnDestruction -= OnDestruction; if (Object.op_Implicit((Object)(object)((BraveBehaviour)proj).sprite)) { ((BraveBehaviour)proj).sprite.usesOverrideMaterial = false; ((BraveBehaviour)((BraveBehaviour)proj).sprite).renderer.material.shader = _oldShader; } Object.Destroy((Object)(object)this); } private void OnAnyCollision(CollisionData collision) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //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_002f: 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_0039: 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_0020: 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_003e: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_010a: 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_0112: 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_00fc: 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_007a: 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_0118: 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_0150: Unknown result type (might be due to invalid IL or missing references) if ((int)collision.collisionType == 1) { Vector2 velocity = collision.MyRigidbody.Velocity; Vector2 val = (collision.CollidedX ? Vector2Extensions.WithX(velocity, 0f - velocity.x) : Vector2Extensions.WithY(velocity, 0f - velocity.y)); PhysicsEngine.PostSliceVelocity = val; if (Object.op_Implicit((Object)(object)_enemy)) { _enemy.KnockbackVelocity = val; } else if (Object.op_Implicit((Object)(object)_proj)) { _proj.SendInDirection(val, true, true); } return; } SpeculativeRigidbody otherRigidbody = collision.OtherRigidbody; if (otherRigidbody == null) { return; } Projectile component = ((Component)otherRigidbody).gameObject.GetComponent(); if (component != null) { if (component.Owner is PlayerController && !Object.op_Implicit((Object)(object)((Component)component).gameObject.GetComponent())) { component.DieInAir(false, true, true, false); BurstYourBubble(); } return; } if (Object.op_Implicit((Object)(object)((Component)otherRigidbody).gameObject.GetComponent())) { BurstYourBubble(); return; } Vector2 velocity2 = collision.MyRigidbody.Velocity; Vector2 val2 = (collision.CollidedX ? Vector2Extensions.WithX(velocity2, 0f - velocity2.x) : Vector2Extensions.WithY(velocity2, 0f - velocity2.y)); PhysicsEngine.PostSliceVelocity = val2; if (Object.op_Implicit((Object)(object)_enemy)) { _enemy.KnockbackVelocity = val2; } else if (Object.op_Implicit((Object)(object)_proj)) { _proj.SendInDirection(val2, true, true); } } private void BurstYourBubble() { //IL_001b: 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)_parentSprite)) { _ = _parentSprite.GetCurrentSpriteDef().boundsDataExtents; GameObject burstBubbleVFX = Bubblebeam._BurstBubbleVFX; int numToSpawn = Mathf.RoundToInt(10f * _vfxSize); Vector2 worldCenter = _parentSprite.WorldCenter; float vfxSize = _vfxSize; float? fadeOutTime = 0.1f; CwaffVFX.SpawnBurst(burstBubbleVFX, numToSpawn, worldCenter, vfxSize, null, 0f, 5f, CwaffVFX.Vel.Random, CwaffVFX.Rot.Random, 0.5f, fadeOutTime); ((Component)_parentSprite).gameObject.Play("bubble_pop_sound"); } if (Object.op_Implicit((Object)(object)_enemy)) { ((GameActor)_enemy).SetIsFlying(false, "Enbubbled", true, true); BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)_enemy).behaviorSpeculator; if (behaviorSpeculator != null && !behaviorSpeculator.ImmuneToStun) { behaviorSpeculator.EndStun(); } KnockbackDoer knockbackDoer = ((BraveBehaviour)_enemy).knockbackDoer; if (knockbackDoer != null) { knockbackDoer.m_activeKnockbacks.Clear(); knockbackDoer.m_activeContinuousKnockbacks.Clear(); } } if (Object.op_Implicit((Object)(object)_proj)) { _proj.DieInAir(false, true, true, false); } Object.Destroy((Object)(object)this); } private void UpdateKnockback() { //IL_0030: 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).specRigidbody)) { _enemy.KnockbackVelocity = ((BraveBehaviour)_enemy).specRigidbody.Velocity; } } private void Update() { //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_00a6: 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) if (Object.op_Implicit((Object)(object)_proj)) { if (!(_proj.Speed < 2.5f)) { _proj.SetSpeed(Lazy.SmoothestLerp(_proj.Speed, 0f, 1f)); } } else if (Object.op_Implicit((Object)(object)_enemy) && Object.op_Implicit((Object)(object)_body)) { Vector2 velocity = _body.Velocity; if (!(((Vector2)(ref velocity)).sqrMagnitude <= 6.25f)) { float num = Mathf.Max(2.5f, Lazy.SmoothestLerp(((Vector2)(ref velocity)).magnitude, 0f, 1f)); _body.Velocity = num * ((Vector2)(ref velocity)).normalized; UpdateKnockback(); } } } private void LateUpdate() { ((tk2dBaseSprite)_bubble).HeightOffGround = 4f; ((tk2dBaseSprite)_bubble).UpdateZDepth(); } private void OnDestroy() { if (Object.op_Implicit((Object)(object)_enemy) && Object.op_Implicit((Object)(object)((BraveBehaviour)_enemy).specRigidbody)) { SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_enemy).specRigidbody; specRigidbody.OnCollision = (Action)Delegate.Remove(specRigidbody.OnCollision, new Action(OnAnyCollision)); if (_projectileCollisionOverride) { _enemy.HitByEnemyBullets = false; ((BraveBehaviour)_enemy).specRigidbody.RemoveCollisionLayerOverride(CollisionMask.LayerToMask((CollisionLayer)4)); } } else if (Object.op_Implicit((Object)(object)_proj) && Object.op_Implicit((Object)(object)((BraveBehaviour)_proj).specRigidbody)) { SpeculativeRigidbody specRigidbody2 = ((BraveBehaviour)_proj).specRigidbody; specRigidbody2.OnCollision = (Action)Delegate.Remove(specRigidbody2.OnCollision, new Action(OnAnyCollision)); _proj.OnDestruction -= OnDestruction; } if (Object.op_Implicit((Object)(object)_vfx)) { Object.Destroy((Object)(object)_vfx); } } } public class Wavefront : CwaffGun { public static string ItemName = "Wavefront"; public static string ShortDescription = "Particle-larly Interesting"; public static string LongDescription = "Fires bullets that orbit and gravitate towards the player for 15 seconds or until colliding with an enemy."; public static string Lore = "The primary difficulty of working with projectiles that gravitate towards you is, hopefully unsurprisingly, the fact that those projectiles can hit you. The Gungineer in charge of redesigning this gun to meet modern safety standards came up with a rather ingenious workaround for this issue: do nothing, but claim that you have incorporated proprietary technology that reduces the likelihood of shooting yourself so people will buy it anyway. The redesigned gun received 100% approval from those who survived using it, and the Gungineer received an employee of the year award from management shortly after the redesign went live."; internal static GameObject _LinkVFXPrefab = null; public static void Init() { //IL_0061: 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_0192: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? idleFps = 12; int? shootFps = 50; int? reloadFps = 16; Color? muzzleEmissionColor = new Color(0.5f, 0.75f, 0.55f); Gun gun2 = gun.SetAttributes((ItemQuality)4, (GunClass)15, 1f, 320, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, idleFps, shootFps, reloadFps, null, null, "wavefront_fire_sound", null, null, -1, -1, -1, null, modulesAreTiers: false, "muzzle_wavefront", 30, 1f, (Anchor)4, 40f, muzzleEmissionColor, 12f, 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: true, suppressReloadLabel: false, 1f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: false, preventRollingWhenCharging: false, 1f, 0.1f).SetReloadAudio("wavefront_reload_sound", 0, 6, 12, 18); float? damage = 12f; int? clipSize = 12; float? cooldown = 0.125f; float? range = 999999f; float? speed = 60f; bool? shouldRotate = true; muzzleEmissionColor = Color.cyan; float? lightStrength = 10f; float? lightRange = 1f; Color? lightColor = Color.white; bool? uniqueSounds = true; Projectile p = gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "wavefront_projectile_alt", 24, (Anchor)4, 0.25f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, shouldRotate, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, uniqueSounds, null, null, null, null, null, null, null, "wavefront_projectile_zap_sound", null, null, 0f, ignoredForReloadPurposes: false, mirror: false, null, null, null, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: false, 0f, null, 4f, muzzleEmissionColor, null, -1, null, lightStrength, lightRange, lightColor)); lightColor = Color.cyan; muzzleEmissionColor = new Color(0.5f, 0.5f, 1f); p.SetEnemyImpactVFX(VFX.CreatePool("wavefront_impact_particles", 24f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 7f, muzzleEmissionColor, orphaned: false, attached: true, unlit: false, 3f, 1.5f, lightColor, 9f, 0f, 0.35f)).Attach(); _LinkVFXPrefab = VFX.Create("wavefront_lightning", 60f, loops: true, -1, 1f, (Anchor)3, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1).MakeChainLightingVFX(); } } public class TeslaProjectileBehavior : MonoBehaviour { private const float _LIFESPAN = 15f; private const float _ACCEL = 350f; private const float _MIN_SPEED = 50f; private const float _MAX_SPEED = 70f; private const float _PRECESSION = 1f; private const float _MIN_ION_TIME = 0.5f; private const float _ION_VARIANCE = 0.5f; private const float _ION_DAMAGE = 1.5f; private static readonly Color _TrailColor = new Color(0.35f, 1f, 1f, 0.35f); private static readonly List _ExtantTeslas = new List(); private static List _ZappableEnemies = new List(); private Projectile _projectile; private PlayerController _owner; private float _myMaxSpeed; private float _lifespan; private bool _mastered; private float _ionizationTimer; private void Start() { //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 //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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) //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_00e0: Unknown result type (might be due to invalid IL or missing references) _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)) { _myMaxSpeed = Random.Range(50f, 70f) * _owner.ProjSpeedMult(); _lifespan = 15f; ((BraveBehaviour)_projectile).specRigidbody.CollideWithTileMap = false; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreCollision)); EasyTrailBullet easyTrailBullet = ((Component)(object)_projectile).AddComponent(); easyTrailBullet.StartWidth = 0.1f; easyTrailBullet.EndWidth = 0f; easyTrailBullet.LifeTime = 0.15f; easyTrailBullet.BaseColor = _TrailColor; easyTrailBullet.StartColor = _TrailColor; easyTrailBullet.EndColor = _TrailColor; _mastered = _owner.HasSynergy(Synergy.MASTERY_WAVEFRONT); if (_mastered) { _ionizationTimer = 0.5f + 0.5f * Random.value; _ExtantTeslas.Add(this); } } } private void OnDestroy() { _ExtantTeslas.Remove(this); } private void OnPreCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { AIActor component = ((Component)otherRigidbody).GetComponent(); if (component == null || !component.IsHostile(canBeDead: false, canBeNeutral: true)) { PhysicsEngine.SkipCollision = true; } else { ((Component)this).gameObject.Play("wavefront_projectile_impact_sound"); } } private void Update() { //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_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) //IL_0093: 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_009d: 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_00b5: 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_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_00e8: 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) if (!Object.op_Implicit((Object)(object)_owner) || !Object.op_Implicit((Object)(object)_projectile)) { Object.Destroy((Object)(object)this); return; } float deltaTime = BraveTime.DeltaTime; if ((_lifespan -= deltaTime) <= 0f) { _projectile.DieInAir(false, true, true, false); return; } _projectile.OverrideMotionModule = null; Vector2 val = _projectile.m_currentSpeed * _projectile.m_currentDirection; Vector2 val2 = ((GameActor)_owner).CenterPosition - Vector3Extensions.XY(((BraveBehaviour)_projectile).transform.position); Vector2 val3 = val + 350f * BraveTime.DeltaTime * ((Vector2)(ref val2)).normalized.Rotate(1f); _projectile.SetSpeed(Mathf.Min(_myMaxSpeed, ((Vector2)(ref val3)).magnitude)); _projectile.SendInDirection(val3, true, true); if (!_mastered || (_ionizationTimer -= deltaTime) > 0f) { return; } _ionizationTimer = 0.5f + 0.5f * Random.value; bool flag = false; TeslaProjectileBehavior teslaProjectileBehavior = _ExtantTeslas.ChooseRandom(); if (Object.op_Implicit((Object)(object)teslaProjectileBehavior) && (Object)(object)teslaProjectileBehavior != (Object)(object)this && Object.op_Implicit((Object)(object)teslaProjectileBehavior._projectile) && Object.op_Implicit((Object)(object)((BraveBehaviour)teslaProjectileBehavior._projectile).specRigidbody)) { DoTeslaZaps(_projectile, ((BraveBehaviour)teslaProjectileBehavior._projectile).specRigidbody); flag = true; } AIActor val4 = Lazy.NearestEnemy(((BraveBehaviour)_projectile).specRigidbody.UnitCenter); if (Object.op_Implicit((Object)(object)val4)) { SpeculativeRigidbody specRigidbody = ((BraveBehaviour)val4).specRigidbody; if (specRigidbody != null) { DoTeslaZaps(_projectile, specRigidbody); flag = true; } } if (flag) { ((Component)_projectile).gameObject.PlayUnique("wavefront_zap_sound"); } } private static void DoTeslaZaps(Projectile proj, SpeculativeRigidbody target) { //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_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_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) OwnerConnectLightningModifier ownerConnectLightningModifier = ((Component)proj).gameObject.AddComponent(); ownerConnectLightningModifier.owner = proj.Owner; ownerConnectLightningModifier.targetBody = target; ownerConnectLightningModifier.originPos = ((BraveBehaviour)proj).specRigidbody.UnitCenter; ownerConnectLightningModifier.targetPos = target.UnitCenter; ownerConnectLightningModifier.linkPrefab = Wavefront._LinkVFXPrefab; ownerConnectLightningModifier.disownTimer = 0.1f; ownerConnectLightningModifier.fadeTimer = 0.1f; ownerConnectLightningModifier.color = Color.cyan; ownerConnectLightningModifier.emissivePower = 20f; ownerConnectLightningModifier.baseDamage = 1.5f; ownerConnectLightningModifier.MakeGlowy(); } } public class Xelsior : CwaffGun { private class XelsiorAmmoDisplay : CustomAmmoDisplay { private Gun _gun; private Xelsior _xelsior; private PlayerController _owner; private void Start() { _gun = ((Component)this).GetComponent(); _xelsior = ((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) || !Object.op_Implicit((Object)(object)_xelsior) || !_xelsior.Mastered) { return false; } if (_xelsior.autotarget) { uic.GunAmmoCountLabel.Text = "[color #ff44ff]Autotarget On[/color]\n" + CustomAmmoDisplayExtensions.VanillaAmmoDisplay(_owner); } else { uic.GunAmmoCountLabel.Text = "[color #444444]Autotarget Off[/color]\n" + CustomAmmoDisplayExtensions.VanillaAmmoDisplay(_owner); } return true; } } public static string ItemName = "X-elsior"; public static string ShortDescription = "Transcendent Arsenal"; public static string LongDescription = "When fired at a dropped gun, converts that gun into 1-5 pistols depending on its quality and assimilates them into its arsenal. While fired at an enemy, causes all pistols in its arsenal to fire in sequence at that enemy."; public static string Lore = "A weapon borne of grand ammomancy, crafted to release its user from the shackles limiting them to one firearm per hand. Its innate power is mediocre at best, but given a sufficiently large arsenal of weapons, its destructive potential is unrivaled."; internal static GameObject _XelsiorReticle = null; internal static GameObject _HoverGunPrefab = null; internal static GameObject _ShootVFXPrefab = null; internal static GameObject _HoverProjectile = null; private const float _TARGET_COOLDOWN = 0.5f; private List _extantGuns = new List(); private AIActor _target; private float _cooldown; private GameObject _reticle; public int maxGuns; public bool autotarget; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 14; int? reloadFps = 4; gun.SetAttributes((ItemQuality)5, (GunClass)15, 0.9f, 600, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, 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).Attach((Action)null, allowDuplicates: false).InitProjectile(GunData.New(null, Items.Moonscraper.Projectile(), -1, 0.18f, damage: 2f, force: 0f, speed: -1f, angleVariance: 0f, shootStyle: (ShootStyle)2, sequenceStyle: (ProjectileSequenceStyle)0, chargeTime: 0f, ammoCost: 3, ammoType: null, customClip: false, range: null, recoil: null, poison: 0f, fire: 0f, freeze: 0f, slow: 0f, collidesWithEnemies: null, ignoreDamageCaps: null, collidesWithProjectiles: null, surviveRigidbodyCollisions: null, collidesWithTilemap: null, sprite: null, fps: 2, anchor: (Anchor)4, scale: 1f, anchorsChangeColliders: true, fixesScales: true, overrideColliderPixelSizes: null, overrideColliderOffsets: null, bossDamageMult: 1f, destroySound: null, shouldRotate: null, barrageSize: 1, shouldFlipHorizontally: null, shouldFlipVertically: null, useDummyChargeModule: false, invisibleProjectile: false, spawnSound: null, stopSoundOnDeath: null, uniqueSounds: null, shrapnelVFX: null, shrapnelCount: null, shrapnelMinVelocity: null, shrapnelMaxVelocity: null, shrapnelLifetime: null, preventOrbiting: null, hitSound: null, hitEnemySound: null, hitWallSound: null, becomeDebris: null, angleFromAim: 0f, ignoredForReloadPurposes: false, mirror: false, electric: null, burstCooldown: null, preventSparks: null, pierceBreakables: null, collidesOnlyWithPlayerProjectiles: null, pierceInternalWalls: null, doBeamSetup: null, beamSprite: "xelsior_beam", beamFps: 60, beamStartFps: -1, beamEndFps: -1, beamChargeFps: 8, beamMuzzleFps: -1, beamImpactFps: 30, beamLoopCharge: false, beamEmission: 50f, beamReflections: 0, beamChargeDelay: 0f, beamStatusDelay: -1f, beamGoop: null, beamInterpolate: null, beamPiercing: -1, beamPiercesCover: null, beamContinueToWall: null, beamIsRigid: null, beamKnockback: -1f, beamTiling: null, beamEndType: null, beamSeparation: null, beamStartIsMuzzle: false, hideAmmo: true)); _XelsiorReticle = VFX.Create("xelsior_reticle", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _HoverGunPrefab = VFX.Create("xelsior_hover_gun", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _ShootVFXPrefab = VFX.Create("xelsior_shoot_vfx", 60f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _HoverGunPrefab.AddComponent(); float? angleVariance = 0f; float? speed = 100f; float? damage = 3f; float? range = 4f; float? force = 0f; bool? shouldRotate = true; bool? pierceBreakables = true; bool? ignoreDamageCaps = true; bool? collidesWithTilemap = false; _HoverProjectile = ((Component)Items.Ak47.CloneProjectile(GunData.New(null, null, null, null, angleVariance, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, ignoreDamageCaps, null, null, collidesWithTilemap, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, shouldRotate, 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))).gameObject; } public override void PostProcessBeam(BeamController beam) { ((GunBehaviour)this).PostProcessBeam(beam); Projectile projectile = ((BraveBehaviour)beam).projectile; projectile.OnHitEnemy = (Action)Delegate.Combine(projectile.OnHitEnemy, new Action(SetTargets)); } public override void OnReloadPressed(PlayerController player, Gun gun, bool manualReload) { base.OnReloadPressed(player, gun, manualReload); if (!base.Mastered || ((GunBehaviour)this).gun.IsFiring) { return; } autotarget = !autotarget; ((Component)this).gameObject.PlayOnce("xelsior_autofire_toggle"); if (!autotarget) { int count = _extantGuns.Count; for (int i = 0; i < count; i++) { _extantGuns[i].SetTarget(null); } } } private void SetTargets(Projectile projectile, SpeculativeRigidbody rigidbody, bool arg3) { SetTargets(((BraveBehaviour)rigidbody).aiActor); } private void SetTargets(AIActor enemy, bool allowNull = false) { if (!allowNull) { if (!Object.op_Implicit((Object)(object)enemy)) { return; } HealthHaver healthHaver = ((BraveBehaviour)enemy).healthHaver; if (healthHaver == null || healthHaver.IsDead) { return; } } _target = enemy; int count = _extantGuns.Count; for (int i = 0; i < count; i++) { _extantGuns[i].SetTarget(enemy); } if (Object.op_Implicit((Object)(object)_target)) { _cooldown = 0.5f; } } public override void OnMasteryStatusChanged() { base.OnMasteryStatusChanged(); bool mastered = base.Mastered; int count = _extantGuns.Count; for (int i = 0; i < count; i++) { _extantGuns[i]._mastered = mastered; } } private void UpdateReticle() { //IL_0043: 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) //IL_00ec: 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) if (Object.op_Implicit((Object)(object)_reticle)) { ((BraveBehaviour)_reticle.GetComponent()).renderer.enabled = Object.op_Implicit((Object)(object)_target); _reticle.transform.rotation = (180f * BraveTime.ScaledTimeSinceStartup).EulerZ(); _reticle.SetAlpha(0.5f * _cooldown / 0.5f); } if (Object.op_Implicit((Object)(object)_target)) { if (!Object.op_Implicit((Object)(object)_reticle)) { _reticle = SpawnManager.SpawnVFX(_XelsiorReticle, Vector2.op_Implicit(((GameActor)_target).CenterPosition), Quaternion.identity, true); _reticle.SetAlphaImmediate(0.5f); } tk2dSprite component = _reticle.GetComponent(); ((tk2dBaseSprite)component).HeightOffGround = -5f; ((tk2dBaseSprite)component).UpdateZDepth(); _reticle.transform.position = Vector2.op_Implicit(((GameActor)_target).CenterPosition); } } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); DestroyExtantGuns(); if (maxGuns == 0) { maxGuns = 1; } ((MonoBehaviour)this).StartCoroutine(SpawnGunsOnceWeCanMove()); } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); DestroyExtantGuns(); _target = null; if (Object.op_Implicit((Object)(object)_reticle)) { ((BraveBehaviour)_reticle.GetComponent()).renderer.enabled = Object.op_Implicit((Object)(object)_target); } } private void CheckForDroppedGuns() { //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_001d: 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_0069: 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) BeamController extantBeam = GetExtantBeam(); BasicBeamController val = (BasicBeamController)(object)((extantBeam is BasicBeamController) ? extantBeam : null); if (val == null) { return; } Vector2 origin = ((BeamController)val).Origin; Vector2 val2 = val.Endpoint(); Gun val3 = null; foreach (IPlayerInteractable unassignedInteractableObject in RoomHandler.unassignedInteractableObjects) { Gun val4 = (Gun)(object)((unassignedInteractableObject is Gun) ? unassignedInteractableObject : null); if (val4 != null && Object.op_Implicit((Object)(object)val4) && ((Behaviour)val4).isActiveAndEnabled && Object.op_Implicit((Object)(object)((BraveBehaviour)val4).sprite)) { Vector2 val5 = default(Vector2); if (BraveMathCollege.LineSegmentRectangleIntersection(origin, val2, ((BraveBehaviour)val4).sprite.WorldBottomLeft, ((BraveBehaviour)val4).sprite.WorldTopRight, ref val5)) { val3 = val4; break; } } } if (Object.op_Implicit((Object)(object)val3)) { if (RoomHandler.unassignedInteractableObjects.Contains((IPlayerInteractable)(object)val3)) { RoomHandler.unassignedInteractableObjects.Remove((IPlayerInteractable)(object)val3); } int num = Mathf.Max(((PickupObject)(object)val3).QualityGrade(), 1); if (Object.op_Implicit((Object)(object)((BraveBehaviour)val3).sprite)) { ((BraveBehaviour)val3).sprite.DuplicateInWorldAsMesh().Dissipate(3.5f, 0f, 5f, progressive: true); } if (Object.op_Implicit((Object)(object)((Component)val3).gameObject.GetComponentInParent())) { Object.Destroy((Object)(object)((Component)((Component)val3).gameObject.transform.parent).gameObject); } else { Object.Destroy((Object)(object)((Component)val3).gameObject); } for (int i = 0; i < num; i++) { AddNewGun(); } ((Component)this).gameObject.Play("materialize_sound"); ((Component)this).gameObject.Play("vaporized_sound"); } } public override void Update() { base.Update(); UpdateReticle(); CheckForDroppedGuns(); ((MonoBehaviour)(object)((GunBehaviour)this).gun).LoopSoundIf(((GunBehaviour)this).gun.IsFiring, "xelsior_fire_loop", 1300, 500); if (!(_cooldown <= 0f)) { _cooldown -= BraveTime.DeltaTime; if (!(_cooldown > 0f)) { _cooldown = 0f; SetTargets(null, allowNull: true); } } } private void AddNewGun() { maxGuns++; SpawnNewGun(); UpdateGunOffsets(); } private void SpawnNewGun() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) XelsiorHoveringGun component = _HoverGunPrefab.Instantiate(((BraveBehaviour)this).transform.position).GetComponent(); component.Setup(this); component.SetTarget(_target); _extantGuns.Add(component); } private void UpdateGunOffsets() { int count = _extantGuns.Count; float num = (float)(count - 1) / 2f; bool flag = count % 2 == 1; float num2 = 0f; for (int i = 0; i < count; i++) { num2 = num - (float)(i / 2); if (i % 2 == 1) { num2 = 0f - num2; } if (flag && i == count - 1) { num2 = 0f; } _extantGuns[i].offset = num2; _extantGuns[i].numGuns = count; } } public override void OnPlayerPickup(PlayerController player) { GameManager.Instance.OnNewLevelFullyLoaded += OnNewFloor; base.OnPlayerPickup(player); } public override void OnDroppedByPlayer(PlayerController player) { GameManager.Instance.OnNewLevelFullyLoaded -= OnNewFloor; base.OnDroppedByPlayer(player); ((MonoBehaviour)this).StopAllCoroutines(); DestroyExtantGuns(); if (Object.op_Implicit((Object)(object)_reticle)) { Object.Destroy((Object)(object)_reticle); } _target = null; } private void DestroyExtantGuns(bool doVFX = true) { if (_extantGuns.Count <= 0) { return; } ((Component)this).gameObject.Play("vaporized_sound"); for (int i = 0; i < _extantGuns.Count; i++) { if (Object.op_Implicit((Object)(object)_extantGuns[i])) { _extantGuns[i].doVFX = doVFX; Object.Destroy((Object)(object)((Component)_extantGuns[i]).gameObject); } } _extantGuns.Clear(); } public override void OnDestroy() { GameManager.Instance.OnNewLevelFullyLoaded -= OnNewFloor; ((MonoBehaviour)this).StopAllCoroutines(); DestroyExtantGuns(); if (Object.op_Implicit((Object)(object)_reticle)) { ((BraveBehaviour)_reticle.GetComponent()).renderer.enabled = Object.op_Implicit((Object)(object)_target); } base.OnDestroy(); } private void OnNewFloor() { if (Object.op_Implicit((Object)(object)this)) { DestroyExtantGuns(doVFX: false); ((MonoBehaviour)this).StartCoroutine(SpawnGunsOnceWeCanMove()); } } private IEnumerator SpawnGunsOnceWeCanMove() { if (maxGuns <= 0) { yield break; } while (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) && !((GunBehaviour)this).PlayerOwner.AcceptingNonMotionInput) { yield return null; } if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((Component)this).gameObject.Play("materialize_sound"); for (int i = 0; i < maxGuns; i++) { SpawnNewGun(); } UpdateGunOffsets(); } } public override void MidGameSerialize(List data, int i) { ((GunBehaviour)this).MidGameSerialize(data, i); data.Add(maxGuns); } public override void MidGameDeserialize(List data, ref int i) { ((GunBehaviour)this).MidGameDeserialize(data, ref i); maxGuns = (int)data[i++]; } } public class XelsiorHoveringGun : MonoBehaviour { internal const float _CIRCLE_SPEED = 0.5f; private const float _KICKBACK_TIME = 0.5f; private const float _MATERIALIZE_TIME = 0.5f; private const float _MAX_TRANSITION_TIME = 1f; private const float _BASE_DELAY = 0.1f; private const float _MAX_DELAY = 0.5f; private const float _GUN_DIST = 3.5f; private const float _AUTOFIRE_REDUCTION = 2.5f; private static VFXPool _MuzzleVFX; public float curAngle = 90f; public float curOffset; public float offset; public int numGuns; public Vector2 curPos; public tk2dSprite sprite; public bool doVFX = true; internal bool _mastered; private Xelsior _parentGun; private PlayerController _owner; private AIActor _target; private Vector2 _lastTargetPos; private HealthHaver _targetHH; private bool _transitionToPlayer; private float _kickback; private float _transitionTimer; private float _retargetTime; private float _nextShot; private float _targetHoverDist; private tk2dMeshSprite _mesh; private bool _autoTarget; public XelsiorHoveringGun Setup(Xelsior parentGun) { //IL_0048: 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_0094: Unknown result type (might be due to invalid IL or missing references) _parentGun = parentGun; _owner = ((GunBehaviour)parentGun).PlayerOwner; _mastered = Object.op_Implicit((Object)(object)parentGun) && parentGun.Mastered; sprite = ((Component)this).gameObject.GetComponent(); _mesh = Lazy.CreateMeshSpriteObject((tk2dBaseSprite)(object)sprite, ((tk2dBaseSprite)sprite).WorldCenter, pointMesh: true); ((Component)_mesh).gameObject.transform.position = Vector2.op_Implicit(((tk2dBaseSprite)sprite).WorldCenter); ((Component)_mesh).gameObject.transform.rotation = ((Component)this).transform.rotation; ((BraveBehaviour)_mesh).renderer.material.shader = CwaffShaders.ShatterShader; ((BraveBehaviour)_mesh).renderer.material.SetFloat("_Progressive", 1f); ((BraveBehaviour)_mesh).renderer.material.SetFloat(CwaffVFX._FadeId, 1f); ((BraveBehaviour)_mesh).renderer.material.SetFloat("_Amplitude", 0f); ((BraveBehaviour)_mesh).renderer.material.SetFloat("_RandomSeed", Random.value); ((MonoBehaviour)this).StartCoroutine(DoMaterialize(this, _mesh, 0.5f)); ((tk2dBaseSprite)sprite).usesOverrideMaterial = true; ((BraveBehaviour)sprite).renderer.material.shader = ShaderCache.Acquire("Brave/PlayerShader"); ((BraveBehaviour)sprite).renderer.enabled = false; return this; } public void SetTarget(AIActor enemy, bool autoTarget = false) { if (!((Object)(object)enemy == (Object)(object)_target) || autoTarget != _autoTarget) { if (!Object.op_Implicit((Object)(object)_target) || autoTarget != _autoTarget) { float num = ((offset >= 0f) ? offset : ((float)numGuns + offset)); float num2 = 0.1f + 0.4f * (num / (float)numGuns); _nextShot = BraveTime.ScaledTimeSinceStartup + num2 * (autoTarget ? 2.5f : 1f); } _autoTarget = autoTarget; _target = enemy; _targetHH = (Object.op_Implicit((Object)(object)enemy) ? ((BraveBehaviour)enemy).healthHaver : null); _targetHoverDist = Mathf.Max(3.5f, enemy.SpriteRadius() + 2.5f); } } private void HandleQueuedShots(bool targetIsAlive) { //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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00b5: 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_00c1: 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_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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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) if (_nextShot >= BraveTime.ScaledTimeSinceStartup) { return; } _nextShot = BraveTime.ScaledTimeSinceStartup + 0.5f * (_autoTarget ? 2.5f : 1f); if (targetIsAlive) { if (numGuns <= 6) { ((Component)this).gameObject.PlayOnce("xelsior_shoot_sound"); } else { ((Component)this).gameObject.PlayOnce("xelsior_shoot_sound_short"); } _kickback = 0.5f; Vector2 val = Vector3Extensions.XY(((BraveBehaviour)sprite).transform.position) + ((tk2dBaseSprite)sprite).GetRelativePositionFromAnchor((Anchor)5).Rotate(((BraveBehaviour)sprite).transform.eulerAngles.z); Vector2 val2 = ((GameActor)_target).CenterPosition - val; Projectile component = SpawnManager.SpawnProjectile(Xelsior._HoverProjectile, Vector2.op_Implicit(val), val2.EulerZ(), true).GetComponent(); component.SetOwnerAndStats((GameActor)(object)_owner); _owner.DoPostProcessProjectile(component); ((Component)((BraveBehaviour)(object)component).AddTrail(ChekhovsGun._ChekhovTrailPrefab)).gameObject.SetGlowiness(10f); if (_MuzzleVFX == null) { _MuzzleVFX = Items.Mailbox.AsGun().muzzleFlashEffects; } _MuzzleVFX.SpawnAtPosition(Vector2.op_Implicit(val), Vector2Extensions.ToAngle(val2), (Transform)null, (Vector2?)null, (Vector2?)null, (float?)null, false, (SpawnMethod)null, (tk2dBaseSprite)null, false); } } private void DoAutoTarget() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) AIActor val = ((GameActor)_owner).CenterPosition.GetAllNearbyEnemies().ChooseRandom(); if (val != null) { SetTarget(val, autoTarget: true); } } private void Update() { //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) //IL_0136: 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_0143: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: 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_01d2: 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_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032c: 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_0344: 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_034c: 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_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_owner) || !Object.op_Implicit((Object)(object)_parentGun)) { return; } _kickback = Mathf.Max(_kickback - BraveTime.DeltaTime, 0f); float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; bool flag = Object.op_Implicit((Object)(object)_target) && Object.op_Implicit((Object)(object)_targetHH) && _targetHH.IsAlive; if (!flag && _mastered && Object.op_Implicit((Object)(object)_owner) && _owner.IsInCombat && Object.op_Implicit((Object)(object)_parentGun) && _parentGun.autotarget) { DoAutoTarget(); flag = Object.op_Implicit((Object)(object)_target) && Object.op_Implicit((Object)(object)_targetHH) && _targetHH.IsAlive; } Vector2 val; float num; Vector2 val2; if (flag || _retargetTime > scaledTimeSinceStartup) { if (flag) { _lastTargetPos = ((GameActor)_target).CenterPosition; _retargetTime = scaledTimeSinceStartup + 0.5f; } val = _lastTargetPos; num = (180f * BraveTime.ScaledTimeSinceStartup + 360f * offset / (float)numGuns).Clamp360(); val2 = val + num.ToVector(_targetHoverDist); _transitionToPlayer = true; _transitionTimer = 0f; HandleQueuedShots(flag); } else { val = ((GameActor)_owner).CenterPosition; num = (180f + _owner.m_currentGunAngle).Clamp360(); Vector2 val3 = val + num.ToVector(3.5f); Vector2 val4 = (num + 90f).ToVector(0.75f); val2 = val3 + offset * val4; _target = null; _targetHH = null; } Vector2 val5 = curPos - val2; float sqrMagnitude = ((Vector2)(ref val5)).sqrMagnitude; if (sqrMagnitude < 0.04f) { _transitionToPlayer = Object.op_Implicit((Object)(object)_target); } if (sqrMagnitude < 0.01f) { curAngle = num; curPos = val2; curOffset = offset; } else if (Object.op_Implicit((Object)(object)_target) || _transitionToPlayer) { curOffset = offset; float num2 = 7.5f; if (!Object.op_Implicit((Object)(object)_target)) { _transitionTimer += BraveTime.DeltaTime; float num3 = _transitionTimer / 1f; num2 += 10f * num3; } curPos = Lazy.SmoothestLerp(curPos, val2, num2); float b = curAngle.RelAngleTo(num); curAngle = (curAngle + Lazy.SmoothestLerp(0f, b, 7.5f)).Clamp360(); } else { curOffset = Lazy.SmoothestLerp(curOffset, offset, 5f); float b2 = curAngle.RelAngleTo(num); curAngle = (curAngle + Lazy.SmoothestLerp(0f, b2, 9f)).Clamp360(); Vector2 val6 = val + curAngle.ToVector(3.5f); Vector2 val7 = (curAngle + 90f).ToVector(0.75f); curPos = val6 + curOffset * val7; } Vector2 val8 = Vector2.zero; if (_kickback > 0f) { float num4 = _kickback / 0.5f; float magnitude = 1.25f * Mathf.Sin((float)Math.PI * num4 * num4); val8 = curAngle.ToVector(magnitude); } Vector2 val9 = curPos + val8 + new Vector2(0f, 0.5f * Mathf.Sin(3f * BraveTime.ScaledTimeSinceStartup)); ((Component)this).transform.position = Vector2.op_Implicit(dfVectorExtensions.Quantize(val9, 0.0625f)); ((Component)this).transform.localRotation = (180f + curAngle).EulerZ(); ((tk2dBaseSprite)sprite).FlipY = curAngle < 90f || curAngle > 270f; } private void OnDestroy() { //IL_0039: 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) if (Object.op_Implicit((Object)(object)_mesh)) { Object.Destroy((Object)(object)((Component)_mesh).gameObject); _mesh = null; } if (doVFX) { tk2dMeshSprite obj = Lazy.CreateMeshSpriteObject((tk2dBaseSprite)(object)sprite, ((tk2dBaseSprite)sprite).WorldCenter, pointMesh: true); ((Component)obj).gameObject.transform.rotation = ((Component)this).transform.rotation; obj.Dissipate(0.5f, 0f, 10f); } } public static IEnumerator DoMaterialize(XelsiorHoveringGun xg, tk2dMeshSprite ms, float v) { Material mat = ((BraveBehaviour)ms).renderer.material; for (float elapsed = 0f; elapsed < v; elapsed += BraveTime.DeltaTime) { ((BraveBehaviour)ms).transform.position = ((Component)xg).transform.position; ((BraveBehaviour)ms).transform.rotation = ((Component)xg).transform.rotation; ((tk2dBaseSprite)ms).FlipY = ((tk2dBaseSprite)xg.sprite).FlipY; float num = 1f - elapsed / v; mat.SetFloat(CwaffVFX._FadeId, num); mat.SetFloat("_Amplitude", 1f - num * num); yield return null; } Object.Destroy((Object)(object)((Component)xg._mesh).gameObject); xg._mesh = null; ((BraveBehaviour)xg.sprite).renderer.enabled = true; } } public class Pincushion : CwaffGun { public static string ItemName = "Pincushion"; public static string ShortDescription = "Needless Violence"; public static string LongDescription = "Fires a barrage of pins that lose accuracy as the clip is depleted. Pins deal fixed damage, cannot damage anything other than enemies, and are blocked by decor such as barrels, crates, etc."; public static string Lore = "Even when shot out of a gun, a pin won't be particularly harmful to most of the Gungeon's inhabitants. Two pins won't fare much better, nor three, nor ten. But, by firing thousands of pins per second, one of them will in all likelihood eventually lodge itself in a weak point or some other location extremely compromising to its target. Needless to say, the probabilistic nature of this gun threads the line of practicality, but its high drum capacity doesn't leave it without merits in the right situation."; internal const int _SIMULTANEOUS_BULLETS = 4; internal const float _MAX_SPREAD = 45f; internal const float _MIN_SPREAD = 8f; internal const float _DLT_SPREAD = 37f; internal const float _NEEDLE_DAMAGE = 0.35f; internal static GameObject _ImpactVFX = null; public static void Init() { //IL_0182: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); bool? doesScreenShake = false; int? shootFps = 30; int? reloadFps = 24; Gun gun2 = gun.SetAttributes((ItemQuality)1, (GunClass)10, 1.8f, 10000, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, doesScreenShake, null, shootFps, reloadFps, 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).SetReloadAudio("pincushion_reload_start_sound").SetReloadAudio("pincushion_reload_sound", 8, 13, 18, 23, 28, 35); int? clipSize = 250; float? cooldown = 1f / 60f; float? angleVariance = 0f; float? damage = 0f; float? speed = 200f; float? force = 0f; float? range = 999f; bool? preventSparks = true; bool? damagesWalls = false; IntVector2? overrideColliderPixelSizes = new IntVector2(1, 1); gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "needle", 12, (Anchor)3, 1f, anchorsChangeColliders: true, fixesScales: true, overrideColliderPixelSizes, null, 0.65f, null, null, 4, 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, preventSparks, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: false, 0f, null, 0f, null, null, -1, null, null, null, null, null, damagesWalls)).ClearAllImpactVFX().RemoveAnimator() .Attach() .Attach((Action)delegate(EasyTrailBullet trail) { //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_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) //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) trail.StartWidth = 0.1f; trail.EndWidth = 0f; trail.LifeTime = 0.1f; trail.StartColor = Color.gray; trail.BaseColor = Color.gray; trail.EndColor = Color.gray; }, allowDuplicates: false) .RegisterAsPoolable(); _ImpactVFX = VFX.Create("microdust", 30f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } public override void OnPostFired(PlayerController player, Gun gun) { ((GunBehaviour)this).OnPostFired(player, gun); ((Component)this).gameObject.Play("pincushion_fire"); } public override void PostProcessProjectile(Projectile projectile) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) ((GunBehaviour)this).PostProcessProjectile(projectile); PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null) { return; } float num = 8f; if (base.Mastered) { VeryFragileProjectile component = ((Component)projectile).GetComponent(); if (component != null) { component.phasesThroughBreakables = true; } } else { num += 37f * (1f - (float)((GunBehaviour)this).gun.ClipShotsRemaining / (float)((GunBehaviour)this).gun.ClipCapacity); } num *= playerOwner.AccuracyMult(); projectile.SendInDirection((projectile.OriginalDirection() + num * (2f * Random.value - 1f)).ToVector(), false, true); } } public class VeryFragileProjectile : MonoBehaviour, IPPPComponent { private static tk2dSpriteAnimator _ImpactVfxAnimator; private Projectile _projectile; public bool breakNextCollision; public bool phasesThroughBreakables; private void Start() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown if ((Object)(object)_ImpactVfxAnimator == (Object)null) { _ImpactVfxAnimator = Pincushion._ImpactVFX.GetComponent(); } _projectile = ((Component)this).GetComponent(); if (!Object.op_Implicit((Object)(object)((Component)this).gameObject.GetComponent())) { SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreCollision)); specRigidbody.OnCollision = (Action)Delegate.Combine(specRigidbody.OnCollision, new Action(OnCollision)); } } public void PPPInit(PlayerProjectilePoolInfo pppi) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown pppi.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)pppi.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreCollision)); pppi.OnCollision = (Action)Delegate.Combine(pppi.OnCollision, new Action(OnCollision)); } public void PPPReset(GameObject prefab) { breakNextCollision = false; phasesThroughBreakables = false; } public void PPPRespawn() { } private void OnPreCollision(SpeculativeRigidbody me, PixelCollider myPixelCollider, SpeculativeRigidbody other, PixelCollider otherPixelCollider) { if (Object.op_Implicit((Object)(object)((Component)other).GetComponent())) { _projectile.baseData.damage = 0.35f; } else if (phasesThroughBreakables) { PhysicsEngine.SkipCollision = true; } else { breakNextCollision = true; } } private void OnCollision(CollisionData data) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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) if (breakNextCollision) { _projectile.DieInAir(true, true, true, false); } float num = Random.Range(-14f, 14f); float num2 = Random.Range(-14f, 14f); if (((CastResult)data).Normal.x != 0f && ((CastResult)data).Normal.x < 0f == num > 0f) { num = 0f - num; } if (((CastResult)data).Normal.y != 0f && ((CastResult)data).Normal.y < 0f == num2 > 0f) { num2 = 0f - num2; } tk2dSpriteAnimator impactVfxAnimator = _ImpactVfxAnimator; Vector3 position = Vector2.op_Implicit(((CastResult)data).Contact); Vector2? velocity = new Vector2(num, num2); CwaffVFX.Spawn(null, position, null, velocity, 0f, null, 10f, null, fadeIn: false, null, null, null, randomFrame: false, -1, flipX: false, flipY: false, null, null, 1.55f, null, -1, impactVfxAnimator); } internal static bool IsVeryFragile(Projectile p) { if (Object.op_Implicit((Object)(object)p)) { return Object.op_Implicit((Object)(object)((Component)p).GetComponent()); } return false; } } public class Suncaster : CwaffGun { public static string ItemName = "Suncaster"; public static string ShortDescription = "Reflaktive"; public static string LongDescription = "Fires beams of sunlight. Reload to toss a refractive prism. Uncharged shots that hit a prism will refract towards all other prisms. Charged shots continuously refract off of all placed prisms for a short period. Prisms can be reclaimed by interacting with them or by entering a new room. Cannot gain ammo normally, but passively restores ammo over time."; public static string Lore = "An exotic firearm feared throughout the galaxy for its potent solar projectiles. The absence of sunlight in the Gungeon dramatically reduces its ability to gather energy, yet it remains a force to be reckoned with once its energy stores are sufficient."; internal const int _BASE_MAX_PRISMS = 6; internal const int _PRISM_AMMO_COST = 5; internal const float _PRISM_LAUNCH_SPEED = 20f; internal const float _CHARGE_RATE = 0.3f; internal const float _CHARGE_TIME = 0.65f; internal const int _CHARGE_AMMO_COST = 15; internal static GameObject _PrismPrefab = null; internal static GameObject _TraceVFX = null; internal static CwaffTrailController _SunTrailPrefab = null; internal static CwaffTrailController _SunTrailRefractedPrefab = null; internal static CwaffTrailController _SunTrailFinalPrefab = null; internal static Projectile _SuncasterProjectile = null; [SerializeField] private float _lastChargeTime; private bool _cachedSolarFlairSynergy; public List extantPrisms = new List(); public int maxPrisms = 6; public static void Init() { //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Expected O, but got Unknown //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Expected O, but got Unknown //IL_05df: Unknown result type (might be due to invalid IL or missing references) //IL_05e4: Unknown result type (might be due to invalid IL or missing references) //IL_05e6: Unknown result type (might be due to invalid IL or missing references) //IL_05eb: Unknown result type (might be due to invalid IL or missing references) //IL_05f3: Unknown result type (might be due to invalid IL or missing references) //IL_05fb: Unknown result type (might be due to invalid IL or missing references) //IL_0603: Unknown result type (might be due to invalid IL or missing references) //IL_060b: Unknown result type (might be due to invalid IL or missing references) //IL_060d: Unknown result type (might be due to invalid IL or missing references) //IL_0612: Unknown result type (might be due to invalid IL or missing references) //IL_0619: Unknown result type (might be due to invalid IL or missing references) //IL_0625: Expected O, but got Unknown Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); bool? doesScreenShake = false; int? shootFps = 30; int? reloadFps = 40; Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)4, (GunClass)30, 0f, 30, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: false, canReloadNoMatterAmmo: true, doesScreenShake, null, shootFps, reloadFps, 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).Attach().Attach((Action)null, allowDuplicates: false) .AssignGun(out gunRef); int? clipSize = -1; float? cooldown = 0.1f; bool? pierceBreakables = true; bool? pierceInternalWalls = true; float? damage = 2f; float? speed = 100f; float? range = 999999f; bool? uniqueSounds = true; float? lightStrength = 10f; float? lightRange = 3f; Color? lightColor = ExtendedColours.vibrantOrange; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)3, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 12, (Anchor)3, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, "suncaster_fire_sound", null, uniqueSounds, null, null, null, null, null, null, null, null, null, null, 0f, ignoredForReloadPurposes: false, mirror: false, null, null, null, pierceBreakables, null, pierceInternalWalls, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: false, 0f, null, 0f, null, null, -1, null, lightStrength, lightRange, lightColor)).Attach((Action)delegate(PierceProjModifier pierce) { pierce.penetration = 999; }, allowDuplicates: false).Attach() .Assign(out _SuncasterProjectile); gunRef.DefaultModule.chargeProjectiles = new List { new ChargeProjectile { Projectile = _SuncasterProjectile.Clone().Attach(delegate(SuncasterProjectile s) { s.charged = false; }), ChargeTime = 0f, AmmoCost = 1, UsedProperties = (ChargeProjectileProperties)1 }, new ChargeProjectile { Projectile = _SuncasterProjectile.Clone().Attach(delegate(SuncasterProjectile s) { s.charged = true; }), ChargeTime = 0.65f, AmmoCost = 15, UsedProperties = (ChargeProjectileProperties)1 } }; _SunTrailPrefab = VFX.CreateSpriteTrailObject("suncaster_beam_mid", 60, null, -1f, 1f / 60f, 1f); _SunTrailRefractedPrefab = VFX.CreateSpriteTrailObject("suncaster_beam_refracted_mid", 60, null, -1f, 1f / 60f, 1f); _SunTrailFinalPrefab = VFX.CreateSpriteTrailObject("suncaster_beam_final_mid", 60, null, -1f, 1f / 60f, 1f); _TraceVFX = VFX.Create("basic_square", 7f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 10f); _PrismPrefab = VFX.Create("prism_vfx", 7f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 5f); SpeculativeRigidbody orAddComponent = GameObjectExtensions.GetOrAddComponent(_PrismPrefab); orAddComponent.CanBePushed = true; orAddComponent.PixelColliders = new List { new PixelCollider { ColliderGenerationMode = (PixelColliderGeneration)0, ManualOffsetX = -6, ManualOffsetY = -18, ManualWidth = 13, ManualHeight = 24, CollisionLayer = (CollisionLayer)6, Enabled = true, IsTrigger = false } }; } public override void OnReloadPressed(PlayerController player, Gun gun, bool manualReload) { //IL_0043: 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) base.OnReloadPressed(player, gun, manualReload); if (!player.IsDodgeRolling && player.AcceptingNonMotionInput && extantPrisms.Count < maxPrisms) { RoomHandler currentRoom = player.CurrentRoom; if (currentRoom != null) { GameObject obj = _PrismPrefab.Instantiate(gun.barrelOffset.position); obj.AddComponent().Setup(player, this, currentRoom, gun.CurrentAngle.ToVector(20f)); obj.GetComponent().CorrectForWalls(andRigidBodies: true); } } } public override void PostProcessProjectile(Projectile projectile) { //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) ((GunBehaviour)this).PostProcessProjectile(projectile); SuncasterProjectile component = ((Component)projectile).GetComponent(); component.FiredFromGun(this); _lastChargeTime = BraveTime.ScaledTimeSinceStartup; if (!base.Mastered) { return; } foreach (SuncasterPrism extantPrism in extantPrisms) { component.Refract(extantPrism, Vector2.op_Implicit(((BraveBehaviour)projectile).transform.right)); } } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); foreach (SuncasterPrism extantPrism in extantPrisms) { extantPrism.Selfdestruct(); } extantPrisms.Clear(); } public override void OnDestroy() { foreach (SuncasterPrism extantPrism in extantPrisms) { extantPrism.Selfdestruct(); } extantPrisms.Clear(); base.OnDestroy(); } public override void OnMasteryStatusChanged() { base.OnMasteryStatusChanged(); ((GunBehaviour)this).gun.DefaultModule.chargeProjectiles[0].AmmoCost = 0; } public override void Update() { base.Update(); ((Component)((BraveBehaviour)((GunBehaviour)this).gun).sprite).gameObject.SetGlowiness(10f + 40f * Mathf.Abs(Mathf.Sin(10f * BraveTime.ScaledTimeSinceStartup))); if (!Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { return; } float num = BraveTime.ScaledTimeSinceStartup - _lastChargeTime; float num2 = 0.3f * (_cachedSolarFlairSynergy ? 0.5f : 1f); if (num >= num2) { int num3 = Mathf.FloorToInt(num / num2); _lastChargeTime += num2 * (float)num3; if (((GunBehaviour)this).gun.CurrentAmmo < ((GunBehaviour)this).gun.AdjustedMaxAmmo) { ((GunBehaviour)this).gun.ammo = Math.Min(((GunBehaviour)this).gun.ammo + num3, ((GunBehaviour)this).gun.AdjustedMaxAmmo); } _cachedSolarFlairSynergy = ((GunBehaviour)this).PlayerOwner.HasSynergy(Synergy.SOLAR_FLAIR); } ((GunBehaviour)this).gun.DefaultModule.chargeProjectiles[1].ChargeTime = ((((GunBehaviour)this).gun.ammo >= 15) ? 0.65f : 3600f); } public void AddPrism(SuncasterPrism prism) { extantPrisms.Add(prism); } public void RemovePrism(SuncasterPrism prism, bool adjustTargets = true) { extantPrisms.Remove(prism); if (!adjustTargets) { return; } foreach (SuncasterPrism extantPrism in extantPrisms) { if (!((Object)(object)extantPrism.target != (Object)(object)prism)) { extantPrism.target = prism.target; if ((Object)(object)extantPrism.target == (Object)(object)extantPrism) { extantPrism.target = null; } } } } public override void MidGameSerialize(List data, int i) { ((GunBehaviour)this).MidGameSerialize(data, i); data.Add(maxPrisms); } public override void MidGameDeserialize(List data, ref int i) { ((GunBehaviour)this).MidGameDeserialize(data, ref i); maxPrisms = (int)data[i++]; } } public class SuncasterAmmoDisplay : CustomAmmoDisplay { private Gun _gun; private Suncaster _suncaster; private PlayerController _owner; private void Start() { _gun = ((Component)this).GetComponent(); _suncaster = ((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 num = _suncaster.maxPrisms - _suncaster.extantPrisms.Count; uic.GunAmmoCountLabel.Text = $"[sprite \"prism_ui_icon\"][color #6666dd]x{num}[/color]\n{_gun.CurrentAmmo}"; return true; } } public class SuncasterProjectile : MonoBehaviour { private const float _DAMAGE_SCALING = 1f; private const int _MAX_LOOPS = 8; private Projectile _proj; private PlayerController _owner; private Vector2 _lastPos = Vector2.zero; private CwaffTrailController _trail; private Suncaster _gun; private int _prismsLeft; private bool _setup; protected List _hitPrisms = new List(); protected SuncasterPrism _lastPrism; protected bool _canRefract = true; public bool charged; private const float _REFRACT_SOUND_RATE = 0.16f; private static float _LastRefractSound; private void Start() { if (!_setup) { Setup(); } } private void Setup() { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown _proj = ((Component)this).GetComponent(); _owner = ProjectileUtility.ProjectilePlayerOwner(_proj); _trail = ((BraveBehaviour)(object)_proj).AddTrail(charged ? Suncaster._SunTrailRefractedPrefab : (((Object)(object)_gun != (Object)null) ? Suncaster._SunTrailPrefab : Suncaster._SunTrailFinalPrefab)); ((Component)_trail).gameObject.SetGlowiness(100f); if (Object.op_Implicit((Object)(object)_gun)) { _prismsLeft = _gun.extantPrisms.Count * ((!charged) ? 1 : 8); } SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_proj).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreCollision)); _setup = true; } private void OnPreCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { SuncasterPrism component = ((Component)otherRigidbody).GetComponent(); if (component != null) { PhysicsEngine.SkipCollision = true; if ((Object)(object)_lastPrism != (Object)(object)component) { Amplify(component); } } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)_trail)) { ((Component)_trail).gameObject.SafeDestroy(); } } public void Refract(SuncasterPrism prism, Vector2 newDirection) { //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_007f: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)prism)) { if (!_setup) { Setup(); } Projectile component = SpawnManager.SpawnProjectile(((Component)Suncaster._SuncasterProjectile).gameObject, ((Component)prism).transform.position, Quaternion.identity, true).GetComponent(); component.Owner = (GameActor)(object)_owner; component.baseData.speed = _proj.baseData.speed; component.baseData.damage = _proj.baseData.damage; component.SendInDirection(newDirection, true, true); SuncasterProjectile component2 = ((Component)component).GetComponent(); component2._lastPrism = prism; component2._canRefract = false; } } private void Amplify(SuncasterPrism prism) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: 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_00f5: 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_00ff: Unknown result type (might be due to invalid IL or missing references) if (charged) { if (--_prismsLeft <= 0) { return; } _proj.SendInDirection(prism.Angle(), true, true); } _lastPrism = prism; if (_hitPrisms.Contains(prism)) { if (!Object.op_Implicit((Object)(object)_gun)) { return; } } else { _hitPrisms.Add(prism); ProjectileData baseData = _proj.baseData; baseData.damage += 1f; } if (_canRefract) { if (!Object.op_Implicit((Object)(object)_gun) && Object.op_Implicit((Object)(object)_owner)) { _gun = _owner.GetGun(); } if (Object.op_Implicit((Object)(object)_gun)) { foreach (SuncasterPrism extantPrism in _gun.extantPrisms) { if ((Object)(object)extantPrism != (Object)(object)prism) { Refract(prism, Vector2.op_Implicit(((Component)extantPrism).transform.position - ((Component)prism).transform.position)); } } } } ((BraveBehaviour)_proj).sprite.SetGlowiness(_proj.baseData.damage); ((BraveBehaviour)_proj).specRigidbody.Position = new Position(prism.BasePosition()); ((BraveBehaviour)_proj).specRigidbody.UpdateColliderPositions(); if (_LastRefractSound + 0.16f < BraveTime.ScaledTimeSinceStartup) { _LastRefractSound = BraveTime.ScaledTimeSinceStartup; ((Component)prism).gameObject.PlayUnique("suncaster_fire_sound_high"); } } public void FiredFromGun(Suncaster gun) { _gun = gun; } } public class SuncasterPrism : MonoBehaviour, IPlayerInteractable { private const float _FRICTION = 0.9f; private const float _BOB_SPEED = 4f; private const float _BOB_HEIGHT = 0.2f; private const float _MAX_LIFE = 6000f; private const float _TRACE_RATE = 0.15f; private PlayerController _owner; private tk2dSprite _sprite; private bool _setup; private Vector2 _velocity = Vector2.zero; private Vector2 _angle = Vector2.zero; private Vector2 _newAngle = Vector2.zero; private float _lifetime; private SpeculativeRigidbody _body; private Suncaster _gun; private RoomHandler _room; public SuncasterPrism target; public void Setup(PlayerController owner, Suncaster gun, RoomHandler room, Vector2 velocity) { //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_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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //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) ((Component)this).gameObject.Play("fire_coin_sound"); _owner = owner; _velocity = velocity; _angle = ((Vector2)(ref velocity)).normalized; _room = room; _sprite = ((Component)this).GetComponent(); _room.RegisterInteractable((IPlayerInteractable)(object)this); _body = ((Component)this).gameObject.GetComponent(); SpeculativeRigidbody body = _body; body.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)body.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreCollision)); SpeculativeRigidbody body2 = _body; body2.OnCollision = (Action)Delegate.Combine(body2.OnCollision, new Action(OnCollision)); _body.Velocity = _velocity; _body.RegisterTemporaryCollisionException(((BraveBehaviour)owner).specRigidbody, 0.01f, (float?)null); PlayerController otherPlayer = GameManager.Instance.GetOtherPlayer(owner); if (otherPlayer != null) { _body.RegisterTemporaryCollisionException(((BraveBehaviour)otherPlayer).specRigidbody, 0.01f, (float?)null); } _gun = gun; if (Object.op_Implicit((Object)(object)_gun)) { if (_gun.extantPrisms.Count > 0) { target = _gun.extantPrisms.Last(); _gun.extantPrisms.First().target = this; } _gun.AddPrism(this); } _setup = true; } private void OnPreCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { if (Object.op_Implicit((Object)(object)((Component)otherRigidbody).GetComponent()) && !Object.op_Implicit((Object)(object)((Component)otherRigidbody).GetComponent())) { PhysicsEngine.SkipCollision = true; } if (Object.op_Implicit((Object)(object)((Component)otherRigidbody).GetComponent())) { PhysicsEngine.SkipCollision = true; } } private void OnCollision(CollisionData rigidbodyCollision) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_005e: 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_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_005f: Unknown result type (might be due to invalid IL or missing references) if (rigidbodyCollision.CollidedX && rigidbodyCollision.CollidedY) { Selfdestruct(); } else if ((int)rigidbodyCollision.collisionType == 1) { SpeculativeRigidbody myRigidbody = rigidbodyCollision.MyRigidbody; Vector2 velocity = myRigidbody.Velocity; velocity = ((!rigidbodyCollision.CollidedX) ? Vector2Extensions.WithY(velocity, 0f - myRigidbody.Velocity.y) : Vector2Extensions.WithX(velocity, 0f - myRigidbody.Velocity.x)); PhysicsEngine.PostSliceVelocity = velocity; } } private void OnDestroy() { _room.DeregisterInteractable((IPlayerInteractable)(object)this); if (Object.op_Implicit((Object)(object)_gun)) { _gun.RemovePrism(this); } } private void Update() { //IL_003c: 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_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_005e: 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_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_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) if (!_setup) { return; } if (_room != _owner.CurrentRoom) { Selfdestruct(); return; } if (Object.op_Implicit((Object)(object)target)) { Vector3 val = ((Component)target).transform.position - ((Component)this).transform.position; _angle = Vector2.op_Implicit(((Vector3)(ref val)).normalized); } if ((_lifetime += BraveTime.DeltaTime) > 6000f) { Selfdestruct(); return; } if (((Vector2)(ref _body.Velocity)).sqrMagnitude < 1f) { _body.Velocity = Vector2.zero; return; } SpeculativeRigidbody body = _body; body.Velocity *= Mathf.Pow(0.9f, 60f * BraveTime.DeltaTime); } public void SetTarget(SuncasterPrism prism) { target = prism; } public Vector2 Angle() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _angle; } public Vector2 BasePosition() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) return Vector2.op_Implicit(((Component)this).transform.position); } public void Selfdestruct() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) Lazy.DoSmokeAt(((Component)this).transform.position); ((Component)GameManager.Instance).gameObject.PlayUnique("prism_destroy_sound"); Object.Destroy((Object)(object)((Component)this).gameObject); } public void Interact(PlayerController interactor) { if ((Object)(object)interactor == (Object)(object)_owner) { Selfdestruct(); } } public void OnEnteredRange(PlayerController interactor) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)interactor != (Object)(object)_owner)) { SpriteOutlineManager.AddOutlineToSprite((tk2dBaseSprite)(object)_sprite, Color.white, 1f, 0f, (OutlineType)0); ((tk2dBaseSprite)_sprite).UpdateZDepth(); } } public void OnExitRange(PlayerController interactor) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)interactor != (Object)(object)_owner)) { SpriteOutlineManager.AddOutlineToSprite((tk2dBaseSprite)(object)_sprite, Color.black, 1f, 0f, (OutlineType)0); } } public string GetAnimationState(PlayerController interactor, out bool shouldBeFlipped) { shouldBeFlipped = false; return string.Empty; } public float GetDistanceToPoint(Vector2 point) { //IL_0000: 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_000c: Unknown result type (might be due to invalid IL or missing references) return Vector2.Distance(point, Vector2.op_Implicit(((Component)this).transform.position)) * 0.33f; } public float GetOverrideMaxDistance() { return -1f; } } public class CarpetBomber : CwaffGun { public static string ItemName = "Carpet Bomber"; public static string ShortDescription = "Rugged Terrain"; public static string LongDescription = "Fires a barrage of explosive bouncing carpets. Launches more carpets with more force the longer it is charged."; public static string Lore = "Developed by Mike (of 'Mike' fame), this ornate launcher fires carpets that have been tightly rolled using hydraulics, laced with glued-on patches of C4, and vacuum-sealed to preserve freshness."; private const int _MAX_WALL_BOUNCES = 3; private const int _MAX_PROJECTILES = 10; private const float _CHARGE_PER_PROJECTILE = 0.33f; private const float _MAX_SPEED = 20f; private const float _MIN_SPEED = 10f; private const float _DLT_SPEED = 10f; private const float _SPEED_PER_CHARGE = 2.4f; private const float _RANGE_DELTA = 12f; internal static ExplosionData _CarpetExplosion = null; public static void Init() { //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0736: Unknown result type (might be due to invalid IL or missing references) //IL_074c: Expected O, but got Unknown Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 30; int? reloadFps = 20; int? chargeFps = 3; Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)45, 1.5f, 720, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, chargeFps, null, "carpet_bomber_shoot_sound", null, null, 10, -1, -1, null, modulesAreTiers: false, "muzzle_carpet_bomber", 30, 0.5f, (Anchor)4, -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("carpet_bomber_reload_sound", 2, 10, 18).SetChargeAudio("carpet_bomber_charge_stage", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) .AddToShop(ModdedShopType.Boomhildr) .AssignGun(out gunRef); int? clipSize = 3; float? cooldown = 0.15f; float? angleVariance = 10f; float? num = 9999f; bool? shouldRotate = true; bool? shouldFlipHorizontally = true; bool? surviveRigidbodyCollisions = true; IntVector2? overrideColliderPixelSizes = new IntVector2(8, 8); ((Projectile)(object)gun2.InitSpecialProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)3, (ProjectileSequenceStyle)1, 0f, 1, null, customClip: true, null, null, null, num, null, 0f, 0f, 0f, 0f, null, null, null, surviveRigidbodyCollisions, null, "carpet_bomber_projectile", 20, (Anchor)4, 0.5f, anchorsChangeColliders: false, fixesScales: true, overrideColliderPixelSizes, null, 1f, null, shouldRotate, 10, shouldFlipHorizontally))).Attach((Action)delegate(BounceProjModifier bounce) { bounce.numberOfBounces = 3; bounce.onlyBounceOffTiles = false; bounce.ExplodeOnEnemyBounce = false; }, allowDuplicates: false).Attach().Assign(out Projectile projectileRef); for (int num2 = 0; num2 < 10; num2++) { ProjectileModule obj = gunRef.RawSourceVolley.projectiles[num2]; obj.projectiles.Clear(); obj.chargeProjectiles = new List(); obj.triggerCooldownForAnyChargeAmount = true; int j = 0; while (j <= num2) { List chargeProjectiles = gunRef.RawSourceVolley.projectiles[j].chargeProjectiles; ChargeProjectile val = new ChargeProjectile(); Projectile projectile = projectileRef; num = 10f + (10f + 2.4f * (float)num2) * ((num2 == 0) ? 0.5f : ((float)j / (float)num2)); val.Projectile = projectile.Clone(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, null, num, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4)).Attach((Action)delegate(FancyGrenadeProjectile g) { g.startingHeight = 0.5f; g.minBounceAngle = 10f; g.maxBounceAngle = 30f; g.startingVelocity = 0.5f * (float)j; }, allowDuplicates: false); val.ChargeTime = 0.33f * (float)(num2 + 1); chargeProjectiles.Add(val); int num3 = j + 1; j = num3; } } _CarpetExplosion = Explosions.ExplosiveRounds.With(100f, 10f, 10f, 1.5f, preventPlayerForce: true, shake: false); } public override void Update() { base.Update(); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((GunBehaviour)this).gun.SynchronizeReloadAcrossAllModules(); } } public override void OnMasteryStatusChanged() { base.OnMasteryStatusChanged(); GunExt.SetAnimationFPS(((GunBehaviour)this).gun, ((GunBehaviour)this).gun.chargeAnimation, (int)((base.Mastered ? 4f : 1f) / 0.33f)); } } public class CarpetProjectile : MonoBehaviour { private const int _MAX_BOUNCES = 3; private const float _AIR_FRICTION = 0.9f; private const float _BOUNCE_FRICTION = 0.75f; private Projectile _projectile; private PlayerController _owner; private FancyGrenadeProjectile _grenade; private int _bounces; private void Start() { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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); _grenade = ((Component)this).GetComponent(); FancyGrenadeProjectile grenade = _grenade; grenade.OnBounce = (Action)Delegate.Combine(grenade.OnBounce, new Action(OnGroundBounce)); ((Component)this).GetComponent().OnBounce += OnGroundBounce; _projectile.OnDestruction += Explode; if (Object.op_Implicit((Object)(object)((BraveBehaviour)_projectile).specRigidbody)) { SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody.OnRigidbodyCollision = (OnRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnRigidbodyCollision, (Delegate?)new OnRigidbodyCollisionDelegate(OnRigidbodyCollision)); } } private void OnRigidbodyCollision(CollisionData rigidbodyCollision) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_grenade)) { _grenade.Redirect(((CastResult)rigidbodyCollision).Normal); } OnGroundBounce(); } private void Explode(Projectile p) { //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) Exploder.Explode(((BraveBehaviour)p).transform.position, CarpetBomber._CarpetExplosion, p.Direction, (Action)null, true, (CoreDamageTypes)0, false); } private void Update() { if (Object.op_Implicit((Object)(object)_projectile) && _bounces != 0) { if (_bounces >= 3) { _projectile.DieInAir(true, true, true, false); } else { _projectile.ApplyFriction(0.9f); } } } public void OnGroundBounce() { //IL_0033: 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) _projectile.m_usesNormalMoveRegardless = true; ProjectileData baseData = _projectile.baseData; baseData.speed *= 0.75f; Exploder.Explode(((BraveBehaviour)_projectile).transform.position, CarpetBomber._CarpetExplosion, _projectile.Direction, (Action)null, true, (CoreDamageTypes)0, false); _bounces++; } } public class Breegull : CwaffGun { internal class EggData { public Projectile projectile; public string sound; public string clip; public string ui; public int ammo; } private class BreegullAmmoDisplay : CustomAmmoDisplay { private Gun _gun; private Breegull _breegull; private PlayerController _owner; private void Start() { _gun = ((Component)this).GetComponent(); _breegull = ((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; } string ui = _Eggs[_breegull._currentEggType].ui; uic.GunAmmoCountLabel.Text = "[sprite \"" + ui + "\"]\n" + CustomAmmoDisplayExtensions.VanillaAmmoDisplay(_owner); return true; } } public static string ItemName = "Breegull"; public static string ShortDescription = "Rare Wares"; public static string LongDescription = "Fires eggs with varying effects and ammo costs. Reloading with a full clip cycles through the following egg types:\n normal (1 ammo)\n fire (2 ammo)\n grenade (5 ammo)\n ice (2 ammo)\n clockwork (3 ammo)"; public static string Lore = "With bear no more,\n the bird's alone.\nAmidst the Gungeon's\n walls of stone.\nArmed with her trusty\n eggs and beak.\nShe'll help you kill\n the past you seek.\n- Guntilda"; private const float TALON_TROT_TIMER = 0.16f; internal static GameObject _Shrapnel = null; internal static GameObject _TalonDust = null; internal static Projectile _EggNormal = null; internal static Projectile _EggFire = null; internal static Projectile _EggGrenade = null; internal static Projectile _EggIce = null; internal static Projectile _EggClockwork = null; internal static List _Eggs = new List(); internal int _currentEggType; private float _noiseTimer; private bool _altNoise; private int _trueAmmo = -1; public static void Init() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 20; int? reloadFps = 12; int? introFps = 8; IntVector2? carryOffset = new IntVector2(6, 0); Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)15, 1f, 480, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, introFps, "breegull_shoot_sound", null, "breegull_intro_sound", -1, -1, -1, null, modulesAreTiers: false, null, 60, 1f, (Anchor)3, -1f, null, -1f, muzzleLit: false, 0f, 0f, null, carryOffset, preventRotation: false, 0f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: false, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0).SetReloadAudio("breegull_reload_sound", 0, 4, 8).Attach((Action)null, allowDuplicates: false) .AssignGun(out gunRef); int? clipSize = 10; float? cooldown = 0.18f; float? damage = 7f; GameObject shrapnelVFX = VFX.Create("breegull_impact_normal", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); introFps = 10; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "breegull_projectile_normal", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, "egg_hit_enemy_sound", null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, shrapnelVFX, introFps)).Assign(out _EggNormal); gunRef.QuickUpdateGunAnimation("dragon_idle", null, returnToIdle: false, 1); gunRef.SetGunAudio(gunRef.QuickUpdateGunAnimation("dragon_reload", null, returnToIdle: true, 12), "breegull_dragon_reload_sound", 0, 4, 8); gunRef.SetGunAudio(gunRef.QuickUpdateGunAnimation("dragon_fire", null, returnToIdle: true, 20), "breegull_dragon_shoot_sound"); gunRef.SetGunAudio(gunRef.QuickUpdateGunAnimation("dragon_intro", null, returnToIdle: true, 8), "breegull_dragon_intro_sound"); Projectile eggNormal = _EggNormal; shrapnelVFX = VFX.Create("breegull_impact_fire", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _EggFire = eggNormal.Clone(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, null, null, null, null, null, 0f, 1f, 0f, 0f, null, null, null, null, null, "breegull_projectile_fire", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, shrapnelVFX)); Projectile eggNormal2 = _EggNormal; shrapnelVFX = VFX.Create("breegull_impact_grenade", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _EggGrenade = eggNormal2.Clone(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "breegull_projectile_grenade", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, shrapnelVFX)).Attach((Action)delegate(ExplosiveModifier ex) { ex.explosionData = Explosions.DefaultLarge; }, allowDuplicates: false); Projectile eggNormal3 = _EggNormal; shrapnelVFX = VFX.Create("breegull_impact_ice", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _EggIce = eggNormal3.Clone(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, null, null, null, null, null, 0f, 0f, 0.75f, 0f, null, null, null, null, null, "breegull_projectile_ice", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, shrapnelVFX)); Projectile eggNormal4 = _EggNormal; shrapnelVFX = VFX.Create("breegull_impact_clockwork", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _EggClockwork = eggNormal4.Clone(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "breegull_projectile_clockwork", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, shrapnelVFX)).Attach((Action)delegate(ExplosiveModifier ex) { ex.explosionData = Explosions.DefaultSmall.With(20f, 10f, 7f, 0.5f, preventPlayerForce: true, shake: false); }, allowDuplicates: false).Attach((Action)delegate(HomingModifier home) { home.HomingRadius = 10f; home.AngularVelocity = 720f; }, allowDuplicates: false); _Eggs = new List { SetupEggData("normal", _EggNormal, 1), SetupEggData("fire", _EggFire, 2), SetupEggData("grenade", _EggGrenade, 5), SetupEggData("ice", _EggIce, 2), SetupEggData("clockwork", _EggClockwork, 3) }; _TalonDust = VFX.Create("talon_trot_dust", 30f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } private static EggData SetupEggData(string name, Projectile projectile, int ammo) { return new EggData { projectile = projectile, sound = "collect_egg_" + name + "_sound", clip = Lazy.SetupCustomAmmoClip("breegull_" + name), ui = "breegull_" + name + "_ui", ammo = ammo }; } public override void Update() { //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) base.Update(); if (!Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { return; } if (base.Mastered && _currentEggType == 1 && ((GunBehaviour)this).gun.ClipShotsRemaining < ((GunBehaviour)this).gun.DefaultModule.numberOfShotsInClip) { ((GunBehaviour)this).gun.ClipShotsRemaining = ((GunBehaviour)this).gun.DefaultModule.numberOfShotsInClip; } if (((GunBehaviour)this).PlayerOwner.HasSynergy(Synergy.TALON_TROT) && ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.CurrentClip.name.Contains("idle")) { if (!((BraveBehaviour)((GunBehaviour)this).PlayerOwner).spriteAnimator.CurrentClip.name.Contains("run_")) { _noiseTimer = 0f; _altNoise = false; } else if (!((_noiseTimer += BraveTime.DeltaTime) < 0.16f)) { ((Component)((GunBehaviour)this).PlayerOwner).gameObject.Play(_altNoise ? "kazooie_walk_b" : "kazooie_walk_a"); _noiseTimer = 0f; _altNoise = !_altNoise; SpawnManager.SpawnVFX(_TalonDust, Vector2.op_Implicit(((BraveBehaviour)((GunBehaviour)this).PlayerOwner).sprite.WorldBottomCenter), Quaternion.identity); } } } public override Projectile OnPreFireProjectileModifier(Gun gun, Projectile projectile, ProjectileModule mod) { UpdateEggs(); return _Eggs[_currentEggType].projectile; } public override void OnFullClipReload(PlayerController player, Gun gun) { _currentEggType = (_currentEggType + 1) % _Eggs.Count; UpdateEggs(playSound: true); } public override void OnMasteryStatusChanged() { base.OnMasteryStatusChanged(); CheckDragonForm(force: true); } internal void CheckDragonForm(bool force = false) { if (base.Mastered || force) { ((GunBehaviour)this).gun.idleAnimation = "breegull_dragon_idle"; ((GunBehaviour)this).gun.shootAnimation = "breegull_dragon_fire"; ((GunBehaviour)this).gun.reloadAnimation = "breegull_dragon_reload"; ((GunBehaviour)this).gun.introAnimation = "breegull_dragon_intro"; ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.playAutomatically = false; ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.StopAndResetFrameToDefault(); ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.Play(Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) ? ((GunBehaviour)this).gun.introAnimation : ((GunBehaviour)this).gun.idleAnimation); } } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); UpdateEggs(); CheckDragonForm(); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); player.OnRollStarted += OnDodgeRoll; UpdateEggs(); CheckDragonForm(); } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); player.OnRollStarted -= OnDodgeRoll; if (_trueAmmo > -1) { ((GunBehaviour)this).gun.CurrentAmmo = _trueAmmo; _trueAmmo = -1; } } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((GunBehaviour)this).PlayerOwner.OnRollStarted -= OnDodgeRoll; } base.OnDestroy(); } private void OnDodgeRoll(PlayerController player, Vector2 dirVec) { if ((Object)(object)((GameActor)player).CurrentGun == (Object)(object)((GunBehaviour)this).gun && player.HasSynergy(Synergy.TALON_TROT)) { ((Component)player).gameObject.Play("kazooie_roll_sound"); } } private void UpdateEggs(bool playSound = false) { EggData eggData = _Eggs[_currentEggType]; ((GunBehaviour)this).gun.DefaultModule.ammoCost = eggData.ammo; ((GunBehaviour)this).gun.DefaultModule.customAmmoType = eggData.clip; bool localInfiniteAmmo = ((GunBehaviour)this).gun.LocalInfiniteAmmo; if (_currentEggType == 0 && Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) && ((GunBehaviour)this).PlayerOwner.HasSynergy(Synergy.CHEATO_PAGE)) { ((GunBehaviour)this).gun.LocalInfiniteAmmo = true; ((GunBehaviour)this).gun.DefaultModule.ammoCost = 0; } else if (_currentEggType == 1 && Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) && base.Mastered) { ((GunBehaviour)this).gun.LocalInfiniteAmmo = true; ((GunBehaviour)this).gun.DefaultModule.ammoCost = 0; } else if (_currentEggType == 2 && Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) && ((GunBehaviour)this).PlayerOwner.HasSynergy(Synergy.BAZOOKA_LAYLEE)) { ((GunBehaviour)this).gun.LocalInfiniteAmmo = false; ((GunBehaviour)this).gun.DefaultModule.ammoCost = 2; } else { ((GunBehaviour)this).gun.LocalInfiniteAmmo = false; } if (localInfiniteAmmo != ((GunBehaviour)this).gun.LocalInfiniteAmmo) { if (((GunBehaviour)this).gun.LocalInfiniteAmmo) { _trueAmmo = ((GunBehaviour)this).gun.CurrentAmmo; ((GunBehaviour)this).gun.CurrentAmmo = Mathf.Max(_trueAmmo, ((GunBehaviour)this).gun.DefaultModule.numberOfShotsInClip); ((GunBehaviour)this).gun.MoveBulletsIntoClip(((GunBehaviour)this).gun.DefaultModule.numberOfShotsInClip); } else { if (_trueAmmo != -1) { ((GunBehaviour)this).gun.CurrentAmmo = _trueAmmo; } _trueAmmo = -1; } } if (playSound) { ((Component)this).gameObject.Play(eggData.sound); } } } public class Ticonderogun : CwaffGun { public static string ItemName = "Ticonderogun"; public static string ShortDescription = "A Picture is Worth 1000 Swords"; public static string LongDescription = "Creates magic brushstrokes at the cursor while continuously fired. Encircling enemies with brushstrokes damages them, and multiple enemies can be encircled at once for slightly reduced per-enemy damage. (On controller, brushstrokes auto-lock onto nearby enemies.) Increases curse by 2."; public static string Lore = "A truly bizarre relic from another dimension where the pen is mightier than the gun. It radiates with an aura that gives one the sense that the arcane sketches it's capable of producing are lying dormant inside the relic itself, just waiting for the right user to draw out their power."; private const float _BASE_DAMAGE = 10f; private const float _AMMO_DRAIN_TIME = 1f; private const float _DRAW_FX_RATE = 0.2f; private const int _POINT_CAP = 40; private const int _NUM_RUNES = 3; private const float _MIN_SEGMENT_DIST = 0.5f; private const float _TRACKING_SPEED = 40f; private const float _MAX_CONTROLLER_DIST = 12f; private const float _AUTOTARGET_MAX_DELTA = 20f; private const float _ENEMY_TRACK_RADIUS = 4f; private const float _MAX_CONTROLLER_SQR_DIST = 144f; internal static GameObject _SparklePrefab = null; internal static GameObject _RunePrefab = null; internal static int _PencilLineID = -1; internal static int _EraserLineID = -1; private static float _LastWriteSound = 0f; private Vector2? _lastCursorPos; private AIActor _trackedEnemy; private Projectile _trackedProj; private bool _isCharging; private bool _eraserMode; private float _lastDrawTime; private float _timeCharging; private Vector2 _adjustedAimPoint = Vector2.zero; private Vector2 _targetEnemyPos = Vector2.zero; private Vector2 _cameraPositionAtChargeStart = Vector2.zero; private Vector2 _playerPositionAtChargeStart = Vector2.zero; private List _extantPoints = new List(); private List _extantSprites = new List(); public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 1; int? reloadFps = 1; int? chargeFps = 24; gun.SetAttributes((ItemQuality)4, (GunClass)50, 0f, 150, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, chargeFps, 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, 2f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: false, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0, autoPlay: true, attacksThroughWalls: true, suppressReloadLabel: false, 1f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: false, preventRollingWhenCharging: false, 1f, -1f, canAttackWhileRolling: false, isStarterGun: false, 1f, preventDuctTape: true).AddToShop((ShopType)2).AssignGun(out Gun gunRef) .InitProjectile(GunData.New(null, null, -1, 0.1f, null, (ShootStyle)3, (ProjectileSequenceStyle)0, float.MaxValue, 0, null, customClip: true, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4)); gunRef.QuickUpdateGunAnimation("eraser_charge"); gunRef.QuickUpdateGunAnimation("eraser_fire"); gunRef.QuickUpdateGunAnimation("eraser_idle"); gunRef.QuickUpdateGunAnimation("eraser_reload"); _SparklePrefab = VFX.Create("pencil_sparkles", 12f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _RunePrefab = VFX.Create("pencil_runes", 2f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _PencilLineID = VFX.Collection.GetSpriteIdByName("fancy_line"); _EraserLineID = VFX.Collection.GetSpriteIdByName("fancy_eraser_line"); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); _eraserMode = false; } public override void OnDroppedByPlayer(PlayerController player) { EndCharge(); base.OnDroppedByPlayer(player); } public override void OnSwitchedAwayFromThisGun() { EndCharge(); base.OnSwitchedAwayFromThisGun(); } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); ToggleEraserSprites(); } public override void OnReloadPressed(PlayerController player, Gun gun, bool manualReload) { base.OnReloadPressed(player, gun, manualReload); if (!player.IsDodgeRolling && player.AcceptingNonMotionInput && base.Mastered) { _eraserMode = !_eraserMode; ((Component)this).gameObject.PlayOnce(_eraserMode ? "pencil_erase" : "pencil_write"); _trackedEnemy = null; _trackedProj = null; _lastCursorPos = null; ToggleEraserSprites(); } } private void ToggleEraserSprites() { string text = (_eraserMode ? "ticonderogun_eraser" : "ticonderogun"); ((GunBehaviour)this).gun.idleAnimation = text + "_idle"; ((GunBehaviour)this).gun.reloadAnimation = text + "_reload"; ((GunBehaviour)this).gun.chargeAnimation = text + "_charge"; ((GunBehaviour)this).gun.shootAnimation = text + "_fire"; ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.Stop(); ((GunBehaviour)this).gun.PlayIdleAnimation(); } public override void Update() { base.Update(); if (!Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) || BraveTime.DeltaTime == 0f) { return; } if (!((GunBehaviour)this).gun.IsCharging) { if (_isCharging) { EndCharge(); } return; } DrawVFXAtExtantPoints(); if (((GunBehaviour)this).gun.CurrentAmmo != 0) { if (!_isCharging) { BeginCharge(); } ContinueCharge(); } } private void DrawVFXAtExtantPoints() { //IL_0026: 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_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_0037: Unknown result type (might be due to invalid IL or missing references) float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; if (_lastDrawTime + 0.2f > scaledTimeSinceStartup) { return; } foreach (Vector2 extantPoint in _extantPoints) { SpawnManager.SpawnVFX(_SparklePrefab, Vector2.op_Implicit(extantPoint), Quaternion.identity, false); } _lastDrawTime = scaledTimeSinceStartup; } private void CheckIfEnemiesAreEncircled(Vector2 hullCenter) { //IL_0030: 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_008c: Unknown result type (might be due to invalid IL or missing references) ((Component)this).gameObject.Play("pencil_circle_sound"); if (!Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { return; } List list = new List(); foreach (AIActor allNearbyEnemy in ((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition.GetAllNearbyEnemies()) { if (((GameActor)allNearbyEnemy).CenterPosition.IsPointInPolygonHull(_extantPoints)) { list.Add(allNearbyEnemy); } } if (list.Count == 0) { return; } float damage = ComputeCircleDamage(hullCenter, list.Count); foreach (AIActor item in list) { DoEncirclingMagic(item, damage); } } private void CheckIfProjectilesAreEncircled(Vector2 hullCenter) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) ((Component)this).gameObject.Play("pencil_circle_sound"); if (!Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { return; } foreach (Projectile allProjectile in StaticReferenceManager.AllProjectiles) { if (Object.op_Implicit((Object)(object)allProjectile) && ((Behaviour)allProjectile).isActiveAndEnabled && !(allProjectile.Owner is PlayerController) && allProjectile.SafeCenter.IsPointInPolygonHull(_extantPoints)) { PassiveReflectItem.ReflectBullet(allProjectile, true, (GameActor)(object)((GunBehaviour)this).PlayerOwner, 30f, 1f, 1f, 0f); } } } private float ComputeCircleDamage(Vector2 hullCenter, int numEncircled) { float num = 10f * ((GunBehaviour)this).PlayerOwner.DamageMult(); return numEncircled switch { 1 => num, 2 => num * 0.8f, 3 => num * 0.7f, 4 => num * 0.6f, _ => num * 0.5f, }; } private void DoEncirclingMagic(AIActor enemy, float damage) { //IL_0070: 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_0054: Unknown result type (might be due to invalid IL or missing references) if (((BraveBehaviour)enemy).healthHaver.IsVulnerable) { ((BraveBehaviour)enemy).healthHaver.ApplyDamage(damage, Vector2.zero, ItemName, (CoreDamageTypes)2, (DamageCategory)0, false, (PixelCollider)null, false); if (((BraveBehaviour)enemy).healthHaver.IsDead && ((GunBehaviour)this).PlayerOwner.HasSynergy(Synergy.PURPLE_PROSE)) { DeadlyDeadlyGoopManager goopManagerForGoopType = DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(EasyGoopDefinitions.CharmGoopDef); if (goopManagerForGoopType != null) { goopManagerForGoopType.TimedAddGoopCircle(((GameActor)enemy).CenterPosition, 3f, 0.5f, false); } } } GameObject runePrefab = _RunePrefab; Vector2 centerPosition = ((GameActor)enemy).CenterPosition; float? fadeOutTime = 1f; CwaffVFX.SpawnBurst(runePrefab, 3, centerPosition, 0.3f, null, 0f, 2f, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.None, 1f, fadeOutTime, 0f, null, fadeIn: false, uniform: false, null, null, null, randomFrame: true); } private void ResetCharge() { foreach (GameObject extantSprite in _extantSprites) { Object.Destroy((Object)(object)extantSprite); } _extantSprites.Clear(); _extantPoints.Clear(); } private void ResetCharge(Vector2 cursorPos) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) ResetCharge(); _extantPoints.Add(cursorPos); } private void EndCharge(bool lerp = true) { ResetCharge(); _trackedEnemy = null; _trackedProj = null; _lastCursorPos = null; ((Component)this).gameObject.RelinquishCameraControl(lerp); _isCharging = false; } private void BeginCharge() { //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_0033: 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_0052: Unknown result type (might be due to invalid IL or missing references) ResetCharge(); _trackedEnemy = null; _trackedProj = null; _lastCursorPos = null; _playerPositionAtChargeStart = ((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition; _adjustedAimPoint = _playerPositionAtChargeStart + ((GunBehaviour)this).PlayerOwner.m_currentGunAngle.ToVector(); _isCharging = true; } public static GameObject FancyLine(Vector2 start, Vector2 target, float width, int spriteId) { //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_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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0040: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_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) Vector2 self = target - start; Quaternion val = self.EulerZ(); GameObject obj = Object.Instantiate(new GameObject(), Vector2.op_Implicit(start), val); tk2dSlicedSprite obj2 = obj.AddComponent(); ((tk2dBaseSprite)obj2).SetSprite(VFX.Collection, spriteId); obj2.dimensions = 16f * new Vector2(((Vector2)(ref self)).magnitude, width); ((BraveBehaviour)obj2).transform.localRotation = val; ((BraveBehaviour)obj2).transform.position = Vector2.op_Implicit(start + 0.5f * width * ((Vector2)(ref self)).normalized.Rotate(-90f)); return obj; } private AIActor ChooseNewEnemyTarget() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { return null; } return ((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition.NearestEnemyWithinConeOfVision(((GunBehaviour)this).PlayerOwner.m_currentGunAngle, 20f, 12f, useNearestAngleInsteadOfDistance: true, ignoreWalls: true); } private Projectile ChooseNewProjectileTarget() { //IL_005a: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { return null; } float currentGunAngle = ((GunBehaviour)this).PlayerOwner.m_currentGunAngle; float num = 20f; Projectile result = null; foreach (Projectile allProjectile in StaticReferenceManager.AllProjectiles) { if (!Object.op_Implicit((Object)(object)allProjectile) || !((Behaviour)allProjectile).isActiveAndEnabled || allProjectile.Owner is PlayerController) { continue; } Vector2 val = allProjectile.SafeCenter - ((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition; if (!(((Vector2)(ref val)).sqrMagnitude > 144f)) { float num2 = currentGunAngle.AbsAngleTo(Vector2Extensions.ToAngle(val)); if (num2 < num) { num = num2; result = allProjectile; } } } return result; } private Vector2 GetControllerTrackingVector() { //IL_0013: 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_014e: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: 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_0192: 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_019c: 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) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_0088: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) if (((GunBehaviour)this).PlayerOwner.IsKeyboardAndMouse()) { return Vector3Extensions.XY(((GunBehaviour)this).PlayerOwner.unadjustedAimPoint); } bool flag = false; if (_eraserMode) { if (!Object.op_Implicit((Object)(object)_trackedProj) || !((Behaviour)_trackedProj).isActiveAndEnabled || _trackedProj.Owner is PlayerController) { _trackedProj = ChooseNewProjectileTarget(); if (Object.op_Implicit((Object)(object)_trackedProj)) { flag = true; } } if (Object.op_Implicit((Object)(object)_trackedProj)) { Vector2 val = _trackedProj.SafeCenter + 4f * ((TwoAxisInputControl)((GunBehaviour)this).PlayerOwner.m_activeActions.Aim).Vector; if (flag) { ResetCharge(val); } _adjustedAimPoint = val; return val; } } else { if (!Object.op_Implicit((Object)(object)_trackedEnemy) || !_trackedEnemy.IsHostile(canBeDead: false, canBeNeutral: true)) { _trackedEnemy = ChooseNewEnemyTarget(); if (Object.op_Implicit((Object)(object)_trackedEnemy)) { flag = true; } } if (Object.op_Implicit((Object)(object)_trackedEnemy)) { Vector2 val2 = ((GameActor)_trackedEnemy).CenterPosition + 4f * ((TwoAxisInputControl)((GunBehaviour)this).PlayerOwner.m_activeActions.Aim).Vector; if (flag) { ResetCharge(val2); } _adjustedAimPoint = val2; return val2; } } _adjustedAimPoint += ((TwoAxisInputControl)((GunBehaviour)this).PlayerOwner.m_activeActions.Aim).Vector * 40f * BraveTime.DeltaTime; Vector2 val3 = _adjustedAimPoint - ((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition; if (((Vector2)(ref val3)).magnitude > 12f) { _adjustedAimPoint = ((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition + 12f * ((Vector2)(ref val3)).normalized; } return _adjustedAimPoint; } private void ContinueCharge() { //IL_0058: 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_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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_011a: 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_012b: 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_00df: 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_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_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01db: 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_0195: 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_020e: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_023d: 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_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) _timeCharging += BraveTime.DeltaTime; if (_timeCharging > 1f) { _timeCharging -= 1f; ((GunBehaviour)this).gun.LoseAmmo(1); if (((GunBehaviour)this).gun.CurrentAmmo == 0) { EndCharge(); return; } } if ((int)((GunBehaviour)this).PlayerOwner.CurrentInputState != 0) { EndCharge(); return; } _ = ((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition; Vector2 controllerTrackingVector = GetControllerTrackingVector(); if (((GunBehaviour)this).PlayerOwner.IsKeyboardAndMouse()) { if (((Component)this).gameObject.RequestCameraControl()) { _cameraPositionAtChargeStart = GameManager.Instance.MainCameraController.previousBasePosition; _playerPositionAtChargeStart = ((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition; } if (((Component)this).gameObject.HasControlOverCamera()) { GameManager.Instance.MainCameraController.OverridePosition = Vector2.op_Implicit(_cameraPositionAtChargeStart + (((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition - _playerPositionAtChargeStart)); } } else { ((Component)this).gameObject.RelinquishCameraControl(); } if (_lastCursorPos.HasValue) { Vector2 val = controllerTrackingVector - _lastCursorPos.Value; if (((Vector2)(ref val)).magnitude < 0.5f) { return; } } if (_LastWriteSound + 0.1f < BraveTime.ScaledTimeSinceStartup) { _LastWriteSound = BraveTime.ScaledTimeSinceStartup; ((Component)this).gameObject.PlayOnce(_eraserMode ? "pencil_erase" : "pencil_write"); } if (_lastCursorPos.HasValue) { _extantSprites.Add(FancyLine(_lastCursorPos.Value, controllerTrackingVector, 0.3f, _eraserMode ? _EraserLineID : _PencilLineID)); } _lastCursorPos = controllerTrackingVector; _extantPoints.Add(controllerTrackingVector); SpawnManager.SpawnVFX(_SparklePrefab, Vector2.op_Implicit(controllerTrackingVector), Quaternion.identity, false); if (((GunBehaviour)this).PlayerOwner.HasSynergy(Synergy.DRAW_FIRE)) { DeadlyDeadlyGoopManager goopManagerForGoopType = DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(EasyGoopDefinitions.FireDef); if (goopManagerForGoopType != null) { goopManagerForGoopType.AddGoopCircle(controllerTrackingVector, 0.75f, -1, false, -1); } } if (((GunBehaviour)this).PlayerOwner.HasSynergy(Synergy.TOXIC_LANGUAGE)) { DeadlyDeadlyGoopManager goopManagerForGoopType2 = DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(EasyGoopDefinitions.PoisonDef); if (goopManagerForGoopType2 != null) { goopManagerForGoopType2.AddGoopCircle(controllerTrackingVector, 0.75f, -1, false, -1); } } if (_extantPoints.Count >= 40) { ResetCharge(controllerTrackingVector); } else { if (_extantPoints.Count < 5) { return; } Vector2 centroid = _extantPoints.GetConvexHull().GetCentroid(); float other = Vector2Extensions.ToAngle(_extantPoints[0] - centroid); if (Vector2Extensions.ToAngle(controllerTrackingVector - centroid).IsNearAngle(other, 30f)) { if (_eraserMode) { CheckIfProjectilesAreEncircled(centroid); } else { CheckIfEnemiesAreEncircled(centroid); } ResetCharge(controllerTrackingVector); } } } } public static class HullHelper { public static double Cross(Vector2 O, Vector2 A, Vector2 B) { //IL_0000: 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_000d: 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_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_0028: 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) return (A.x - O.x) * (B.y - O.y) - (A.y - O.y) * (B.x - O.x); } public static List GetConvexHull(this List points) { //IL_008f: 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_006b: 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_00e9: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) if (points == null || points.Count <= 1) { return points; } points = new List(points); int count = points.Count; int num = 0; List list = new List((IEnumerable)(object)new Vector2[2 * count]); points.Sort((Vector2 a, Vector2 b) => (a.x != b.x) ? a.x.CompareTo(b.x) : a.y.CompareTo(b.y)); for (int num2 = 0; num2 < count; num2++) { while (num >= 2 && Cross(list[num - 2], list[num - 1], points[num2]) <= 0.0) { num--; } list[num++] = points[num2]; } int num3 = count - 2; int num4 = num + 1; while (num3 >= 0) { while (num >= num4 && Cross(list[num - 2], list[num - 1], points[num3]) <= 0.0) { num--; } list[num++] = points[num3]; num3--; } return list.Take(num - 1).ToList(); } public static bool IsPointInPolygon(this Vector2 point, List polygon) { //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_001f: 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) //IL_0038: 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_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_004e: 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_00d9: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_009d: 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_014e: 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_0105: 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_00bc: 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_0174: 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) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: 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_0124: Unknown result type (might be due to invalid IL or missing references) if (polygon.Count < 3) { return false; } List list = new List(); Vector2 val = polygon.Last(); foreach (Vector2 item2 in polygon) { if (item2.x == point.x && item2.y == point.y) { return true; } if (item2.x == val.x && point.x == val.x && point.x >= Math.Min(val.y, item2.y) && point.y <= Math.Max(val.y, item2.y)) { return true; } if (item2.y == val.y && point.y == val.y && point.x >= Math.Min(val.x, item2.x) && point.x <= Math.Max(val.x, item2.x)) { return true; } if ((item2.y < point.y && val.y >= point.y) || (val.y < point.y && item2.y >= point.y)) { int item = (int)((double)item2.x + 1.0 * (double)(point.y - item2.y) / (double)(val.y - item2.y) * (double)(val.x - item2.x)); list.Add(item); } val = item2; } list.Sort(); if (list.IndexOf((int)point.x) % 2 != 0) { return list.Count((int x) => (float)x < point.x) % 2 == 1; } return true; } public static bool IsPointInPolygonHull(this Vector2 point, List polygonHull) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return point.IsPointInPolygon(polygonHull.GetConvexHull()); } public static Vector2 GetCentroid(this List poly) { //IL_0025: 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_0040: 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_0062: 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_0082: 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_00d3: 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) float num = 0f; float num2 = 0f; float num3 = 0f; int num4 = 0; int index = poly.Count - 1; while (num4 < poly.Count) { float num5 = poly[num4].x * poly[index].y - poly[index].x * poly[num4].y; num += num5; num2 += (poly[num4].x + poly[index].x) * num5; num3 += (poly[num4].y + poly[index].y) * num5; index = num4++; } if (Math.Abs(num) < 1E-07f) { return Vector2.zero; } num *= 3f; return new Vector2(num2 / num, num3 / num); } } public class Overflow : CwaffGun { internal enum ProjType { WATER, FIRE, POISON, OIL, ICE, VOID } [HarmonyPatch(typeof(KickableObject), "Interact")] private class KickableObjectInteractPatch { private static bool Prefix(KickableObject __instance, PlayerController player) { Gun currentGun = ((GameActor)player).CurrentGun; if (currentGun == null) { return true; } Overflow component = ((Component)currentGun).GetComponent(); if (component == null) { return true; } if (!Femtobyte.IsWhiteListedPrefab(((Component)__instance).gameObject, out var trapPrefab)) { return true; } if (!trapPrefab.prefabName.Contains("barrel") && !trapPrefab.prefabName.Contains("drum")) { return true; } component.ConnectBarrel(__instance, trapPrefab.prefabName); return false; } } public static string ItemName = "Overflow"; public static string ShortDescription = "Contents Under Pressure"; public static string LongDescription = "Fires compressed blobs of goop, decreasing in fire rate and accuracy as ammo is depleted. Can be linked to barrels by interacting with them to siphon goop and restore ammo. Siphoning goop different than the currently held type will drain all held goop before siphoning any new goop."; public static string Lore = "Outfitted with a state-of-the-art magneto-hydraulic compression unit, this weapon was designed by Professor Goopton specifically to take advantage of all of the liquid ammunition found in barrels throughout the Gungeon. Nobody had the heart to tell him the 'ammunition' inside these barrels was actually just various household waste products tossed in by residents of the Breach."; private const float _FILL_RATE = 0.04f; private const float _DRAIN_RATE = 0.01f; private const float _SQR_SNAP_DIST = 81f; private const float _PUMP_SOUND_RATE = 0.2f; private const float _MASTERY_AMMO_MULT = 4f; internal static tk2dSpriteAnimationClip[] _Hoses; internal static GameObject _SnapVFX = null; private KickableObject _attachedBarrel; private CwaffBezierMesh _cable; private float _fillTimer; private int _newGoopType; private float _nextLeakTime; public bool didMasteryAmmoAdjust; public int curGoopType; public static void Init() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_138a: Unknown result type (might be due to invalid IL or missing references) //IL_138f: Unknown result type (might be due to invalid IL or missing references) //IL_1620: Expected O, but got Unknown Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 60; int? reloadFps = 4; Color? muzzleEmissionColor = new Color(0.55f, 0.55f, 0.95f); Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)10, 0f, 250, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "overflow_shoot_sound", null, null, -1, -1, -1, null, modulesAreTiers: true, "muzzle_overflow", 120, 0.5f, (Anchor)4, 20f, muzzleEmissionColor, 10f, muzzleLit: false, 0f, 0f, null, null, preventRotation: false, 0f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: false, rampUpFireRate: true, 0f, suppressReloadAnim: false, (GunHandedness)0).AddToShop((ShopType)0).Attach((Action)null, allowDuplicates: false) .AssignGun(out gunRef); int? clipSize = -1; float? cooldown = 0.05f; float? damage = 5f; float? speed = 50f; float? range = 18f; float? force = 12f; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, 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, 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, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: false, 0f, null, 100f)).Assign(out Projectile projectileRef); Projectile[] array = new Projectile[6]; Projectile projectile = projectileRef; force = 6.5f; array[0] = projectile.Clone(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, force, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "overflow_water_projectile", 2, (Anchor)4)).MakeGoop(EasyGoopDefinitions.WaterGoop); array[1] = projectileRef.Clone(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, null, null, null, null, null, 0f, 0.25f, 0f, 0f, null, null, null, null, null, "overflow_fire_projectile", 2, (Anchor)4)).MakeGoop(EasyGoopDefinitions.FireDef); array[2] = projectileRef.Clone(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, null, null, null, null, null, 0.25f, 0f, 0f, 0f, null, null, null, null, null, "overflow_poison_projectile", 2, (Anchor)4)).MakeGoop(EasyGoopDefinitions.PoisonDef); array[3] = projectileRef.Clone(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, null, null, null, null, null, 0f, 0f, 0f, 0.25f, null, null, null, null, null, "overflow_oil_projectile", 2, (Anchor)4)).MakeGoop(EasyGoopDefinitions.OilDef); array[4] = projectileRef.Clone(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, null, null, null, null, null, 0f, 0f, 0.5f, 0f, null, null, null, null, null, "overflow_ice_projectile", 2, (Anchor)4)).MakeGoop(EasyGoopDefinitions.WaterGoop); Projectile projectile2 = projectileRef; force = 8f; array[5] = projectile2.Clone(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, force, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "overflow_void_projectile", 2, (Anchor)4)); Projectile[] array2 = (Projectile[])(object)array; string[] array3 = new string[6] { "overflow_water", "overflow_fire", "overflow_poison", "overflow_oil", "overflow_ice", "overflow_void" }; gunRef.Volley.projectiles = new List(array2.Length); for (int i = 0; i < array2.Length; i++) { gunRef.Volley.projectiles.Add(GunBuilder.SetAttributes(new ProjectileModule { projectiles = new List { array2[i] } }, GunData.New(gunRef, null, -1, 0.05f, 4f, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4)).SetupCustomAmmoClip(array3[i])); } _Hoses = (tk2dSpriteAnimationClip[])(object)new tk2dSpriteAnimationClip[6] { VFX.Create("overflow_hose_water", 120f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1).DefaultAnimation(), VFX.Create("overflow_hose_fire", 120f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1).DefaultAnimation(), VFX.Create("overflow_hose_poison", 120f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1).DefaultAnimation(), VFX.Create("overflow_hose_oil", 120f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1).DefaultAnimation(), VFX.Create("overflow_hose_ice", 120f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1).DefaultAnimation(), VFX.Create("overflow_hose_void", 120f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1).DefaultAnimation() }; _SnapVFX = VFX.Create("overflow_snap_vfx", 30f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } private void ConnectBarrel(KickableObject barrel, string prefabName) { //IL_009a: 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) DisconnectBarrel(); _fillTimer = 0f; _attachedBarrel = barrel; _newGoopType = prefabName switch { "red barrel" => 1, "red drum" => 1, "purple drum" => 3, "yellow drum" => 2, "blue drum" => WaterIsFrozen() ? 4 : 0, _ => 0, }; _cable = CwaffBezierMesh.Create(_Hoses[_newGoopType], ((BraveBehaviour)_attachedBarrel).sprite.WorldCenter, Vector2.op_Implicit(((GunBehaviour)this).gun.PrimaryHandAttachPoint.position)); GameObjectExtensions.SetLayerRecursively(((Component)_cable).gameObject, LayerMask.NameToLayer("BG_Critical")); } private static bool WaterIsFrozen() { return GameManager.Instance.GetLastLoadedLevelDefinition().dungeonSceneName == "tt_catacombs"; } private void DisconnectBarrel() { //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) if (Object.op_Implicit((Object)(object)_cable)) { ((Component)((GunBehaviour)this).gun).gameObject.Play("overflow_snap_sound"); for (int i = 1; i < 9; i++) { CwaffVFX.Spawn(_SnapVFX, Vector2.op_Implicit(_cable.GetPointOnMainBezier(0.1f * (float)i))); } Object.Destroy((Object)(object)((Component)_cable).gameObject); } _cable = null; _attachedBarrel = null; } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); if (((GunBehaviour)this).gun.CurrentStrengthTier != curGoopType) { ((GunBehaviour)this).gun.CurrentStrengthTier = curGoopType; } } public override void OnSwitchedAwayFromThisGun() { DisconnectBarrel(); base.OnSwitchedAwayFromThisGun(); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); if (((GunBehaviour)this).gun.CurrentStrengthTier != curGoopType) { ((GunBehaviour)this).gun.CurrentStrengthTier = curGoopType; } } public override void OnDroppedByPlayer(PlayerController player) { DisconnectBarrel(); base.OnDroppedByPlayer(player); } public override void OnDestroy() { DisconnectBarrel(); base.OnDestroy(); } private void HandleGoopOverflow() { //IL_007a: 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_00b2: Unknown result type (might be due to invalid IL or missing references) int effectiveMaxAmmo = GetEffectiveMaxAmmo(); if (((GunBehaviour)this).gun.CurrentAmmo <= effectiveMaxAmmo) { return; } float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; if (!(scaledTimeSinceStartup < _nextLeakTime)) { int num = Mathf.CeilToInt((float)(((GunBehaviour)this).gun.CurrentAmmo - effectiveMaxAmmo) / (float)(((GunBehaviour)this).gun.AdjustedMaxAmmo - effectiveMaxAmmo) * 7f); float currentGunAngle = ((GunBehaviour)this).PlayerOwner.m_currentGunAngle; for (int i = 0; i < num; i++) { float self = currentGunAngle.AddRandomSpread(3f * (float)num); self.ToVector(); Projectile component = SpawnManager.SpawnProjectile(((Component)((GunBehaviour)this).gun.DefaultModule.projectiles[0]).gameObject, ((GameActor)((GunBehaviour)this).PlayerOwner).CurrentGun.barrelOffset.position, self.EulerZ(), true).GetComponent(); component.Owner = (GameActor)(object)((GunBehaviour)this).PlayerOwner; component.Shooter = ((BraveBehaviour)((GunBehaviour)this).PlayerOwner).specRigidbody; } ((Component)((GunBehaviour)this).PlayerOwner).gameObject.PlayOnce("overflow_shoot_sound"); Gun gun = ((GunBehaviour)this).gun; gun.CurrentAmmo -= num; _nextLeakTime = scaledTimeSinceStartup + 0.1f; } } public override void OwnedUpdatePlayer(PlayerController player, GunInventory inventory) { ((GunBehaviour)this).OwnedUpdatePlayer(player, inventory); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).gun) && base.Mastered && !Object.op_Implicit((Object)(object)_cable)) { HandleGoopOverflow(); } } public override void Update() { //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_00a6: 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_00bb: 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_00cb: 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) base.Update(); if (!didMasteryAmmoAdjust && base.Mastered) { ((GunBehaviour)this).gun.SetBaseMaxAmmo(Mathf.CeilToInt(4f * (float)((GunBehaviour)this).gun.GetBaseMaxAmmo())); didMasteryAmmoAdjust = true; } if (!Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { return; } if (!Object.op_Implicit((Object)(object)_attachedBarrel) || !((Behaviour)_attachedBarrel).isActiveAndEnabled) { DisconnectBarrel(); } if (Object.op_Implicit((Object)(object)_cable)) { _cable.startPos = ((BraveBehaviour)_attachedBarrel).sprite.WorldCenter; _cable.endPos = Vector2.op_Implicit(((GunBehaviour)this).gun.PrimaryHandAttachPoint.position); Vector2 val = _cable.startPos - _cable.endPos; if (((Vector2)(ref val)).sqrMagnitude > 81f) { DisconnectBarrel(); } } if (!Object.op_Implicit((Object)(object)_cable)) { _fillTimer = 0f; return; } bool flag = ((GunBehaviour)this).gun.CurrentStrengthTier != _newGoopType; float num = ((flag || base.Mastered) ? 0.01f : 0.04f); _fillTimer += BraveTime.DeltaTime; while (_fillTimer > num) { ((Component)((GunBehaviour)this).gun).gameObject.Play("overflow_pump_sound", 0.2f); _fillTimer -= num; if (flag) { if (((GunBehaviour)this).gun.CurrentAmmo == 0) { ((GunBehaviour)this).gun.CurrentStrengthTier = _newGoopType; curGoopType = _newGoopType; flag = false; } else { ((GunBehaviour)this).gun.LoseAmmo(1); } } else if (((GunBehaviour)this).gun.CurrentAmmo < ((GunBehaviour)this).gun.AdjustedMaxAmmo) { ((GunBehaviour)this).gun.GainAmmo(1); } } } internal int GetEffectiveMaxAmmo() { if (!didMasteryAmmoAdjust) { return ((GunBehaviour)this).gun.AdjustedMaxAmmo; } return Mathf.FloorToInt((float)((GunBehaviour)this).gun.AdjustedMaxAmmo / 4f); } public override float GetDynamicFireRate() { return Mathf.Clamp((float)((GunBehaviour)this).gun.CurrentAmmo / (float)GetEffectiveMaxAmmo(), 0.2f, 1f); } public override float GetDynamicAccuracy() { return 1f / Mathf.Clamp((float)((GunBehaviour)this).gun.CurrentAmmo / (float)GetEffectiveMaxAmmo(), 0.2f, 1f); } public override void MidGameSerialize(List data, int i) { ((GunBehaviour)this).MidGameSerialize(data, i); data.Add(curGoopType); data.Add(didMasteryAmmoAdjust); } public override void MidGameDeserialize(List data, ref int i) { ((GunBehaviour)this).MidGameDeserialize(data, ref i); curGoopType = (int)data[i++]; if (((GunBehaviour)this).gun.CurrentStrengthTier != curGoopType) { ((GunBehaviour)this).gun.CurrentStrengthTier = curGoopType; } didMasteryAmmoAdjust = (bool)data[i++]; } } public class OverflowAmmoDisplay : CustomAmmoDisplay { private Overflow _overflow; private Gun _gun; private PlayerController _owner; private string _goopText; private int _cachedTier = -1; private float _phase; private void Start() { _gun = ((Component)this).GetComponent(); _overflow = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor currentOwner = _gun.CurrentOwner; owner = (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null); } public override bool DoCustomAmmoDisplay(GameUIAmmoController uic) { //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_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_01c4: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_owner)) { return false; } if (_cachedTier != _gun.CurrentStrengthTier) { _cachedTier = _gun.CurrentStrengthTier; _goopText = (Overflow.ProjType)_cachedTier switch { Overflow.ProjType.WATER => "[color #6666dd]Water[/color]", Overflow.ProjType.FIRE => "[color #dd6666]Fire[/color]", Overflow.ProjType.POISON => "[color #66dd66]Poison[/color]", Overflow.ProjType.OIL => "[color #ddaa66]Oil[/color]", Overflow.ProjType.ICE => "[color #9999ee]Ice[/color]", Overflow.ProjType.VOID => "[color #dd66dd]Void[/color]", _ => "[color #dddddd]???[/color]", }; } if (!_overflow.didMasteryAmmoAdjust || _gun.InfiniteAmmo) { uic.GunAmmoCountLabel.Text = _goopText + "\n" + CustomAmmoDisplayExtensions.VanillaAmmoDisplay(_owner); return true; } int effectiveMaxAmmo = _overflow.GetEffectiveMaxAmmo(); string text = $"{_gun.CurrentAmmo}/{effectiveMaxAmmo}"; if (_gun.CurrentAmmo <= effectiveMaxAmmo) { _phase = 0f; uic.GunAmmoCountLabel.Text = _goopText + "\n" + text; return true; } float num = 1.5f + 6f * (float)(_gun.CurrentAmmo - effectiveMaxAmmo) / (float)(_gun.AdjustedMaxAmmo - effectiveMaxAmmo); _phase += num * BraveTime.DeltaTime; Color val = Color.Lerp(Color.magenta, Color.white, Mathf.Abs(Mathf.Sin(_phase))); uic.GunAmmoCountLabel.Text = _goopText + "\n[color #" + ColorUtility.ToHtmlStringRGB(val) + "]" + text + "[/color]"; return true; } } public static class OverflowHelpers { public static Projectile MakeGoop(this Projectile p, GoopDefinition goop) { return p.Attach((Action)delegate(GoopModifier g) { g.goopDefinition = goop; g.SpawnGoopOnCollision = true; g.CollisionSpawnRadius = 1f; g.SpawnGoopInFlight = false; }, allowDuplicates: false); } } public class RLTSRTSGTSBTSLB : CwaffGun { private class MasteryProcessor : MonoBehaviour { private void Start() { Projectile component = ((Component)this).gameObject.GetComponent(); if (component == null) { return; } GameActor owner = component.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null && val.HasSynergy(Synergy.MASTERY_RLTSRTSGTSBTSLB)) { ExplosiveModifier component2 = ((Component)component).gameObject.GetComponent(); if (component2 == null || !component2.doExplosion) { component2 = GameObjectExtensions.GetOrAddComponent(((Component)component).gameObject); component2.doExplosion = true; component2.IgnoreQueues = true; component2.explosionData = Explosions.DefaultSmall; } } } } public static string ItemName = "RLTSRTSGTSBTSLB"; public static string ShortDescription = "Surprisingly Underwhelming"; public static string LongDescription = "Fires a rocket that shoots guns that shoot bullets that shoot laser beams. Cannot move or dodge roll while reloading."; public static string Lore = "This weapon's entire production budget was spent on ammo development. No funds remained for hiring a PR team to write a description."; public static void Init() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 30; IntVector2? carryOffset = new IntVector2(4, 0); Gun gun2 = gun.SetAttributes((ItemQuality)1, (GunClass)50, 2.75f, 6, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, null, null, null, "rocket_fire_sound", null, null, -1, -1, -1, null, modulesAreTiers: false, null, 60, 1f, (Anchor)3, -1f, null, -1f, muzzleLit: false, 0f, 0f, null, carryOffset, 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: false, 0f).SetReloadAudio("rocket_plonk_sound", 17).SetReloadAudio("rocket_wiggle_sound", 24, 26, 28, 30, 32, 34) .SetMuzzleVFX(Items.TheExotic, onlyCopyBasicEffects: false) .AddToShop((ShopType)3); Projectile baseProjectile = Items.TheExotic.Projectile(); int? clipSize = 2; float? cooldown = 1f; float? recoil = 50f; gun2.InitProjectile(GunData.New(null, baseProjectile, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, null, null, null, null, recoil, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4)).Assign(out Projectile projectileRef); Projectile val = Items.FlashRay.Projectile().Clone(); ((Component)val).gameObject.AddComponent(); Projectile val2 = ((Component)Items.Bullet.Projectile()).gameObject.GetComponent().projectileToSpawnInFlight.Clone(); Projectile val3 = Items.Bullet.Projectile().Clone(); SpawnProjModifier obj = ((Component)(object)val2).AddComponent(); obj.spawnProjectilesOnCollision = true; obj.projectileToSpawnOnCollision = val; obj.numberToSpawnOnCollison = 2; obj.spawnOnObjectCollisions = true; obj.alignToSurfaceNormal = true; obj.collisionSpawnStyle = (CollisionSpawnStyle)0; ((Component)val3).GetComponent().projectileToSpawnInFlight = val2; ((Component)projectileRef).GetComponent().projectileToSpawnOnCollision = val3; } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null) { playerOwner.forceAimPoint = null; playerOwner.ToggleRenderer(true, ItemName); playerOwner.ToggleHandRenderers(true, ItemName); } } public override void Update() { //IL_00a6: 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) base.Update(); PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null) { return; } tk2dSpriteAnimator spriteAnimator = ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator; if (spriteAnimator == null) { return; } tk2dSpriteAnimationClip currentClip = spriteAnimator.currentClip; if (currentClip == null) { return; } bool flag = currentClip.name == ((GunBehaviour)this).gun.reloadAnimation; ((GunBehaviour)this).gun.preventRotation = flag; ((BraveBehaviour)((GunBehaviour)this).gun).sprite.HeightOffGround = 0.4f; if (!flag || playerOwner.IsDodgeRolling) { playerOwner.forceAimPoint = null; playerOwner.ToggleRenderer(true, ItemName); playerOwner.ToggleHandRenderers(true, ItemName); ((BraveBehaviour)((GunBehaviour)this).gun).sprite.UpdateZDepth(); return; } playerOwner.forceAimPoint = ((GameActor)playerOwner).CenterPosition + Vector2.up; if (spriteAnimator.CurrentFrame >= 43) { playerOwner.ToggleRenderer(true, ItemName); playerOwner.ToggleHandRenderers(true, ItemName); } else if (spriteAnimator.CurrentFrame >= 14) { playerOwner.ToggleRenderer(false, ItemName); playerOwner.ToggleHandRenderers(false, ItemName); } ((BraveBehaviour)((GunBehaviour)this).gun).sprite.HeightOffGround = -0.075f; ((BraveBehaviour)((GunBehaviour)this).gun).sprite.UpdateZDepth(); } } public class SchrodingersGat : CwaffGun { public static string ItemName = "Schrodinger's Gat"; public static string ShortDescription = "Proba-ballistic"; public static string LongDescription = "Fires bullets that leave enemies in a quantum state until they are observed by either dealing or receiving damage. Once observed, enemies have a 50% chance of already being dead, revealing themselves and their projectiles as illusions. Bullets from this gun cannot affect the same enemy twice."; public static string Lore = "Famously used by a mad scientist who would often fire dozens of rounds into a locked box with an animal inside, claiming it was both alive and dead until the box was opened. That scientist eventually landed in prison on charges for kidnapping and murdering dozens of pet cats, insisting \"we don't know if I kidnapped and murdered dozens of cats until we observe it!\" throughout the entire court proceedings."; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? idleFps = 24; int? shootFps = 24; Gun gun2 = gun.SetAttributes((ItemQuality)4, (GunClass)10, 0f, 250, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, idleFps, shootFps, 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: true, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0); int? clipSize = -1; float? cooldown = 0.125f; float? angleVariance = 15f; float? damage = 0f; float? speed = 32f; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "schrodingers_gat_projectile", 12, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, "schrodingers_gat_fire_sound")).Attach(); } public override void OnPlayerPickup(PlayerController player) { StaticReferenceManager.ProjectileAdded -= CheckFromQuantumEnemyOwner; StaticReferenceManager.ProjectileAdded += CheckFromQuantumEnemyOwner; base.OnPlayerPickup(player); } internal static void CheckFromQuantumEnemyOwner(Projectile p) { if (!Object.op_Implicit((Object)(object)p)) { return; } GameActor owner = p.Owner; AIActor val = (AIActor)(object)((owner is AIActor) ? owner : null); if (val != null && Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Component)val).gameObject)) { SchrodingersStat component = ((Component)val).gameObject.GetComponent(); if (component != null && component.IsActuallyDead()) { GameObjectExtensions.GetOrAddComponent(((Component)p).gameObject); } } } } public class SchrodingersEnemyProjectile : MonoBehaviour { private Projectile _projectile; private AIActor _enemy; private void Start() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown _projectile = ((Component)this).GetComponent(); ref AIActor enemy = ref _enemy; GameActor owner = _projectile.Owner; enemy = (AIActor)(object)((owner is AIActor) ? owner : null); SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreCollision)); } private void OnPreCollision(SpeculativeRigidbody me, PixelCollider myPixelCollider, SpeculativeRigidbody other, PixelCollider otherPixelCollider) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)other) && ((BraveBehaviour)other).gameActor is PlayerController) { PhysicsEngine.SkipCollision = true; ((BraveBehaviour)_enemy).healthHaver.ApplyDamage(9999f, Vector2.zero, "Quantum", (CoreDamageTypes)1, (DamageCategory)5, true, (PixelCollider)null, true); if (Object.op_Implicit((Object)(object)_projectile)) { _projectile.DieInAir(false, true, true, false); } } } } public class SchrodingersGatProjectile : MonoBehaviour { 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 SpeculativeRigidbody specRigidbody = ((BraveBehaviour)((Component)this).GetComponent()).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreCollision)); Projectile component = ((Component)this).GetComponent(); component.OnHitEnemy = (Action)Delegate.Combine(component.OnHitEnemy, new Action(OnHitEnemy)); } private void OnHitEnemy(Projectile p, SpeculativeRigidbody body, bool _) { AIActor component = ((Component)body).GetComponent(); if (component != null && component.IsHostileAndNotABoss() && !Object.op_Implicit((Object)(object)((Component)component).gameObject.GetComponent())) { SchrodingersStat schrodingersStat = ((Component)component).gameObject.AddComponent(); GameActor owner = p.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null && val.HasSynergy(Synergy.MASTERY_SCHRODINGERS_GAT)) { schrodingersStat.Observe(); } } } private void OnPreCollision(SpeculativeRigidbody me, PixelCollider myPixelCollider, SpeculativeRigidbody other, PixelCollider otherPixelCollider) { GameActor gameActor = ((BraveBehaviour)other).gameActor; AIActor val = (AIActor)(object)((gameActor is AIActor) ? gameActor : null); if (val != null && Object.op_Implicit((Object)(object)((Component)val).gameObject.GetComponent())) { PhysicsEngine.SkipCollision = true; } } } public class SchrodingersStat : MonoBehaviour { private const float _FLICKER_SPEED = 0.1f; private bool _observed; private bool _actuallyDead; private bool _doneUpdating; private AIActor _enemy; private Renderer _renderer; private float _flickerTimer; private IEnumerator _flickerCR; private bool _didSetup; private void Start() { Setup(); } private void Setup() { //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown if (_didSetup) { return; } _didSetup = true; _enemy = ((Component)this).GetComponent(); _doneUpdating = false; _actuallyDead = Lazy.CoinFlip(); _renderer = ((Component)_enemy).GetComponent(); _flickerTimer = 0f; if (_observed) { Observe(); ((Component)this).gameObject.Play("schrodinger_bullet_hit"); return; } if (_actuallyDead) { SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_enemy).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreCollision)); foreach (Projectile allProjectile in StaticReferenceManager.AllProjectiles) { SchrodingersGat.CheckFromQuantumEnemyOwner(allProjectile); } } ((BraveBehaviour)_enemy).healthHaver.OnDamaged += new OnDamagedEvent(OnDamaged); _flickerCR = Quantum(); ((MonoBehaviour)this).StartCoroutine(_flickerCR); ((Component)this).gameObject.Play("schrodinger_bullet_hit"); } public void Observe() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_00ec: 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) Setup(); _observed = true; ((BraveBehaviour)_enemy).healthHaver.OnDamaged -= new OnDamagedEvent(OnDamaged); if (!_actuallyDead) { return; } ((GameActor)_enemy).DeregisterOverrideColor(SchrodingersGat.ItemName); for (int num = StaticReferenceManager.AllProjectiles.Count - 1; num >= 0; num--) { Projectile val = StaticReferenceManager.AllProjectiles[num]; if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((BraveBehaviour)val).sprite) && !((Object)(object)val.Owner != (Object)(object)_enemy)) { tk2dBaseSprite obj = ((BraveBehaviour)val).sprite.DuplicateInWorld(); ((BraveBehaviour)obj).renderer.material.shader = CwaffShaders.WiggleShader; ((MonoBehaviour)obj).StartCoroutine(PhaseOut(obj, Vector2.right, 25f, 90f, 1f)); val.DieInAir(false, true, true, false); } } tk2dBaseSprite obj2 = _enemy.DuplicateInWorld(copyShader: true); ((MonoBehaviour)obj2).StartCoroutine(PhaseOut(obj2, Vector2.right, 25f, 90f, 1f)); ((Component)this).gameObject.Play("schrodinger_dead_sound"); _enemy.EraseFromExistenceWithRewards(false); } private void OnPreCollision(SpeculativeRigidbody me, PixelCollider myPixelCollider, SpeculativeRigidbody other, PixelCollider otherPixelCollider) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)other) && ((BraveBehaviour)other).gameActor is PlayerController) { PhysicsEngine.SkipCollision = true; ((BraveBehaviour)_enemy).healthHaver.ApplyDamage(9999f, Vector2.zero, "Quantum", (CoreDamageTypes)1, (DamageCategory)5, true, (PixelCollider)null, true); } } public bool IsActuallyDead() { return _actuallyDead; } private static void Quantumize(tk2dBaseSprite sprite) { sprite.usesOverrideMaterial = true; ((BraveBehaviour)sprite).renderer.material.shader = CwaffShaders.WiggleShader; } private IEnumerator Quantum() { ((BraveBehaviour)_enemy).sprite.usesOverrideMaterial = true; Material material = ((BraveBehaviour)((BraveBehaviour)_enemy).sprite).renderer.material; Shader oShader = material.shader; _enemy.ApplyShader(Quantumize); SpriteOutlineManager.RemoveOutlineFromSprite(((BraveBehaviour)_enemy).sprite, false); while (!_observed) { yield return null; _flickerTimer += BraveTime.DeltaTime; if (!(_flickerTimer < 0.1f)) { _flickerTimer = 0f; tk2dBaseSprite obj = _enemy.DuplicateInWorld(copyShader: true); ((MonoBehaviour)obj).StartCoroutine(obj.PhaseOut(Lazy.RandomVector(), 5f, 90f, 0.5f)); } } if (Object.op_Implicit((Object)(object)((BraveBehaviour)_enemy).sprite)) { SpriteOutlineManager.AddOutlineToSprite(((BraveBehaviour)_enemy).sprite, Color.black); } _enemy.ApplyShader(delegate(tk2dBaseSprite s) { ((BraveBehaviour)s).renderer.material.shader = oShader; }); } private void LateUpdate() { if (_doneUpdating || !_observed) { return; } ((GameActor)_enemy).DeregisterOverrideColor(SchrodingersGat.ItemName); _renderer.enabled = true; if (_flickerCR != null) { while (_flickerCR.MoveNext()) { } _flickerCR = null; } _doneUpdating = true; } private void OnDamaged(float resultValue, float maxValue, CoreDamageTypes damageTypes, DamageCategory damageCategory, Vector2 damageDirection) { if (Object.op_Implicit((Object)(object)_enemy)) { Observe(); } } internal static IEnumerator PhaseOut(tk2dBaseSprite sprite, Vector2 direction, float amplitude, float frequency, float lifetime) { //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) Material mat = ((BraveBehaviour)sprite).renderer.material; for (float elapsed = 0f; elapsed < lifetime; elapsed += BraveTime.DeltaTime) { mat.SetFloat("_Fade", 1f - elapsed / lifetime); Transform transform = ((BraveBehaviour)sprite).transform; transform.position += Vector2Extensions.ToVector3ZUp(amplitude * Mathf.Sin(frequency * elapsed) * BraveTime.DeltaTime * direction, 0f); yield return null; } Object.Destroy((Object)(object)((Component)sprite).gameObject); } } public class Gradius : CwaffGun { private class GradiusCommandProjectile : WeirdProjectile { protected override bool OnFiredByPlayer(bool primaryGun) { //IL_002c: 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_0050: 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) if (Object.op_Implicit((Object)(object)base.sourceGun) && base.sourceMod != null) { Gradius component = ((Component)base.sourceGun).gameObject.GetComponent(); if (component != null) { Vector2 direction = Vector2Extensions.ToAngle(((Projectile)this).Direction).AddRandomSpread(base.sourceMod.angleVariance).ToVector(); for (int num = component._extantShips.Count - 1; num >= 0; num--) { if (Object.op_Implicit((Object)(object)component._extantShips[num])) { component._extantShips[num].AttemptToFire(direction); } } return false; } } return true; } protected override void OnFiredByAnything() { SpawnDifferentProjectile(GradiusShip.GetGradiusProjectile()); } } [HarmonyPatch] private class GradiusBlankPatch { [HarmonyPatch(typeof(PlayerController), "ForceBlank")] [HarmonyILManipulator] private static void PlayerControllerForceBlankPatchIL(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.MatchLdstr(instr, "Play_OBJ_silenceblank_use_01") })) { val.Emit(OpCodes.Ldarg_0); val.CallPrivate(typeof(GradiusBlankPatch), "ReplaceBlankSound"); } } private static string ReplaceBlankSound(string origString, PlayerController player) { if (Object.op_Implicit((Object)(object)player)) { Gun currentGun = ((GameActor)player).CurrentGun; if (currentGun != null && Object.op_Implicit((Object)(object)((Component)currentGun).gameObject.GetComponent())) { return "gradius_blank_sound"; } } return origString; } } public static string ItemName = "Gradius"; public static string ShortDescription = "Command and Conquer"; public static string LongDescription = "Grants command over a fleet of spaceships. Each ship type has its own projectile, and can be upgraded by picking up various collectibles:\n\n- Blue: blaster, upgraded by picking up ammo\n\n- Orange: beam, upgraded by picking up health or armor\n\n- Pink: missile, upgraded by picking up keys\n\n- Green: pulse, upgraded by picking up blanks"; public static string Lore = "A child's favorite toy spaceship, lost in the Gungeon like so many other toys before it. The vivid imagination of its previous owner has evidently manifested in ludicrous amounts of miniaturized firepower. Rather inconveniently, the child's prefontal cortex was developed *just* enough to imagine the ship running out of ammo during its battles, slightly disrupting an otherwise immaculate barrage of explosions."; private const float _MAX_ZIP_DIST = 20f; private const float _TOTAL_ZIP_TIME = 0.4f; private const float _LINEAR_ZIP_TIME = 0.2f; private const int _NORMAL_SHIPS = 7; private const int _MASTERED_SHIPS = 13; internal const int _MAX_SHIP_LEVEL = 5; internal const int _SHIP_TYPES = 4; internal static GameObject[] _ShipPrefab = (GameObject[])(object)new GameObject[4]; internal static string[] _ShipNames = new string[4] { "gradius_falchion", "gradius_jade", "gradius_lord", "gradius_vic" }; internal static Projectile _RoundLaserProjectile = null; internal static Projectile _WeakseekerProjectile = null; internal static GameObject _JadeRingImpactVFX = null; private List _extantShips = new List(); private Vector2 _basePos; private float _relativeBarrelY; private float _zipDist; private float _zipTime; private bool _spawningShips; internal float _lerpGunAngle; public int[] shipLevels = new int[4] { 1, 1, 1, 1 }; private static GradiusShip.Ship[] ships = new GradiusShip.Ship[13] { GradiusShip.Ship.Vic, GradiusShip.Ship.Vic, GradiusShip.Ship.Falchion, GradiusShip.Ship.Falchion, GradiusShip.Ship.Lord, GradiusShip.Ship.Lord, GradiusShip.Ship.Jade, GradiusShip.Ship.Vic, GradiusShip.Ship.Vic, GradiusShip.Ship.Falchion, GradiusShip.Ship.Falchion, GradiusShip.Ship.Lord, GradiusShip.Ship.Lord }; private static Vector2[] shipOffsets = (Vector2[])(object)new Vector2[13] { new Vector2(0.5f, -0.375f), new Vector2(0.5f, 0.375f), new Vector2(-0.125f, -2f), new Vector2(-0.125f, 2f), new Vector2(-1.5f, -1.125f), new Vector2(-1.5f, 1.125f), new Vector2(-2.25f, 0f), new Vector2(0.875f, -0.875f), new Vector2(0.875f, 0.875f), new Vector2(-0.125f, -2.75f), new Vector2(-0.125f, 2.75f), new Vector2(-1.9375f, -1.625f), new Vector2(-1.9375f, 1.625f) }; public static void Init() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_0925: Unknown result type (might be due to invalid IL or missing references) //IL_0931: Unknown result type (might be due to invalid IL or missing references) //IL_0993: Unknown result type (might be due to invalid IL or missing references) Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore).SetAttributes(reloadTime: 0f, ammo: 1985, audioFrom: Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, shootFps: (int?)14, reloadFps: (int?)4, carryOffset: (IntVector2?)new IntVector2(16, 0), quality: (ItemQuality)5, gunClass: (GunClass)10, doesScreenShake: (bool?)false, idleFps: (int?)null, chargeFps: (int?)null, introFps: (int?)null, fireAudio: (string)null, reloadAudio: (string)null, introAudio: (string)null, loopChargeAt: -1, loopReloadAt: -1, loopFireAt: -1, muzzleFrom: (Items?)null, modulesAreTiers: false, muzzleVFX: (string)null, muzzleFps: 60, muzzleScale: 1f, muzzleAnchor: (Anchor)3, muzzleEmission: -1f, muzzleEmissionColor: (Color?)null, muzzleEmissionColorPower: -1f, muzzleLit: false, muzzleLightStrength: 0f, muzzleLightRange: 0f, muzzleLightColor: (Color?)null, preventRotation: false, curse: 0f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: false, rampUpFireRate: false, rampUpFactor: 0f, suppressReloadAnim: false, handedness: (GunHandedness)0, autoPlay: true, attacksThroughWalls: false, suppressReloadLabel: false, percentSpeedWhileCharging: 1f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: false, preventRollingWhenCharging: false, percentSpeedWhileFiring: 1f, smoothReload: -1f, canAttackWhileRolling: false, isStarterGun: false, percentSpeedWhileReloading: 1f, preventDuctTape: false, muzzleEmissionSensitivity: 0.5f, preventVolleyModifications: false, undroppableStarter: false).AssignGun(out Gun _) .InitSpecialProjectile(GunData.New(null, Items.HegemonyRifle.DefaultProjectile(), -1, 0.04f, damage: 10f, angleVariance: 0f, shootStyle: (ShootStyle)1, sequenceStyle: (ProjectileSequenceStyle)0, chargeTime: 0f, ammoCost: 1, ammoType: null, customClip: false, speed: null, force: null, range: null, recoil: null, poison: 0f, fire: 0f, freeze: 0f, slow: 0f, collidesWithEnemies: null, ignoreDamageCaps: null, collidesWithProjectiles: null, surviveRigidbodyCollisions: null, collidesWithTilemap: null, sprite: null, fps: 2, anchor: (Anchor)4, scale: 1f, anchorsChangeColliders: true, fixesScales: true, overrideColliderPixelSizes: null, overrideColliderOffsets: null, bossDamageMult: 1f, destroySound: null, shouldRotate: null, barrageSize: 1, shouldFlipHorizontally: null, shouldFlipVertically: null, useDummyChargeModule: false, invisibleProjectile: false, spawnSound: null, stopSoundOnDeath: null, uniqueSounds: null, shrapnelVFX: null, shrapnelCount: null, shrapnelMinVelocity: null, shrapnelMaxVelocity: null, shrapnelLifetime: null, preventOrbiting: null, hitSound: null, hitEnemySound: null, hitWallSound: null, becomeDebris: null, angleFromAim: 0f, ignoredForReloadPurposes: false, mirror: false, electric: null, burstCooldown: null, preventSparks: null, pierceBreakables: null, collidesOnlyWithPlayerProjectiles: null, pierceInternalWalls: null, doBeamSetup: null, beamSprite: null, beamFps: -1, beamStartFps: -1, beamEndFps: -1, beamChargeFps: -1, beamMuzzleFps: -1, beamImpactFps: -1, beamLoopCharge: true, beamEmission: -1f, beamReflections: -1, beamChargeDelay: -1f, beamStatusDelay: -1f, beamGoop: null, beamInterpolate: null, beamPiercing: -1, beamPiercesCover: null, beamContinueToWall: null, beamIsRigid: null, beamKnockback: -1f, beamTiling: null, beamEndType: null, beamSeparation: null, beamStartIsMuzzle: false, hideAmmo: true)); Color? emissiveColour = ExtendedColours.vibrantOrange; Color? lightColor = ExtendedColours.lime; _JadeRingImpactVFX = VFX.Create("jade_projectile_impact_vfx", 60f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 0.5f, emissiveColour, orphaned: false, attached: true, unlit: false, 7f, 1.5f, lightColor, 1.5f); Projectile projectile = Items._38Special.DefaultProjectile(); float? damage = 25f; _RoundLaserProjectile = (Projectile)(object)projectile.Clone(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, damage, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4)).ConvertToSpecialtyType(); damage = 300f; Projectile p = Items._38Special.CloneProjectile(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, null, damage, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4)); lightColor = new Color(1f, 0.85f, 0.5f); emissiveColour = ExtendedColours.vibrantOrange; _WeakseekerProjectile = p.SetAllImpactVFX(VFX.CreatePool("lord_projectile_impact_vfx", 60f, loops: false, -1, 0.75f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 2f, lightColor, orphaned: false, attached: true, unlit: false, 7f, 1.5f, emissiveColour, 10f, 0f, 0.6f)).AttachTrail("weakseeker_trail", 60, null, -1f, 1f / 60f, 0.25f, destroyOnEmpty: false, Lazy.DispersalParticles(ExtendedColours.vibrantOrange)); for (int i = 0; i < _ShipNames.Length; i++) { _ShipPrefab[i] = VFX.Create(_ShipNames[i], 2f, loops: true, -1, 0.5f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 3f).Attach(); } } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); CreateShips(); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); CwaffEvents.OnWillPickUpMinorInteractible = (Action)Delegate.Combine(CwaffEvents.OnWillPickUpMinorInteractible, new Action(DoPickupChecks)); GameManager.Instance.OnNewLevelFullyLoaded += OnNewFloor; } public override void OnDroppedByPlayer(PlayerController player) { GameManager.Instance.OnNewLevelFullyLoaded -= OnNewFloor; CwaffEvents.OnWillPickUpMinorInteractible = (Action)Delegate.Remove(CwaffEvents.OnWillPickUpMinorInteractible, new Action(DoPickupChecks)); base.OnDroppedByPlayer(player); } private void CreateShips() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) _lerpGunAngle = BraveMathCollege.QuantizeFloat(((GunBehaviour)this).gun.gunAngle, 90f); if (_extantShips.Count <= 0) { int num = (base.Mastered ? 13 : 7); for (int i = 0; i < num; i++) { GradiusShip component = Object.Instantiate(_ShipPrefab[(int)ships[i]]).GetComponent(); component.Setup(((GunBehaviour)this).PlayerOwner, this, shipOffsets[i], ships[i], i < 7); _extantShips.Add(component); } _zipDist = 20f; _zipTime = 0.4f; ((Component)this).gameObject.PlayUnique("gradius_ship_spawn_sound"); SmoothlyMoveShips(); } } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); DestroyShips(); } public override void OnTriedToInitiateAttack(PlayerController player) { base.OnTriedToInitiateAttack(player); if (_zipTime > 0f) { player.SuppressThisClick = true; } } private void DestroyShips() { int count = _extantShips.Count; bool flag = false; for (int num = count - 1; num >= 0; num--) { if (Object.op_Implicit((Object)(object)_extantShips[num])) { Object.Destroy((Object)(object)((Component)_extantShips[num]).gameObject); flag = true; } } if (flag) { ((Component)this).gameObject.PlayUnique("gradius_ship_destroy_sound"); } _extantShips.Clear(); } public override void Update() { base.Update(); ((GunBehaviour)this).gun.OverrideAngleSnap = 90f; _lerpGunAngle = _lerpGunAngle.SmoothRotateTo(((GunBehaviour)this).gun.gunAngle, 12f); } private void LateUpdate() { SmoothlyMoveShips(); } private void SmoothlyMoveShips() { //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_001c: 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_005b: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_0100: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)((GunBehaviour)this).gun.barrelOffset).transform; Vector2 val = Vector3Extensions.XY(transform.position); float y = transform.localPosition.y; _relativeBarrelY = Lazy.SmoothestLerp(_relativeBarrelY, y, 12f); Vector2 basePos = default(Vector2); ((Vector2)(ref basePos))..ctor(val.x + 1.125f * (_relativeBarrelY - y) / 0.75f, val.y); _basePos = basePos; if (!(_zipTime <= 0f)) { _zipTime = Mathf.Max(_zipTime - BraveTime.DeltaTime, 0f); _zipDist = Lazy.SmoothestLerp(_zipDist, 0f, 16f); if (_zipTime <= 0.2f) { float num = 20f * (_zipTime / 0.4f); _zipDist = Mathf.Min(_zipDist, num); } _basePos += new Vector2(0f, _zipDist); } } internal Vector2 GetBasePos() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _basePos; } public override void OnDestroy() { DestroyShips(); ((MonoBehaviour)this).StopAllCoroutines(); CwaffEvents.OnWillPickUpMinorInteractible = (Action)Delegate.Remove(CwaffEvents.OnWillPickUpMinorInteractible, new Action(DoPickupChecks)); GameManager.Instance.OnNewLevelFullyLoaded -= OnNewFloor; base.OnDestroy(); } private void OnNewFloor() { if (Object.op_Implicit((Object)(object)this)) { DestroyShips(); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) && (Object)(object)((GameActor)((GunBehaviour)this).PlayerOwner).CurrentGun == (Object)(object)((GunBehaviour)this).gun) { ((MonoBehaviour)((GunBehaviour)this).PlayerOwner).StartCoroutine(SpawnShipsOnceWeCanMove()); } } } private IEnumerator SpawnShipsOnceWeCanMove() { if (!_spawningShips) { _spawningShips = true; while (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) && !((GunBehaviour)this).PlayerOwner.AcceptingNonMotionInput) { yield return null; } if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { CreateShips(); _spawningShips = false; } } } private void DoPickupChecks(PlayerController player, PickupObject pickup) { if (!GameManager.Instance.IsLoadingLevel) { if (pickup is KeyBulletPickup) { UpgradeShip(GradiusShip.Ship.Falchion); } else if (pickup is SilencerItem) { UpgradeShip(GradiusShip.Ship.Jade); } else if (pickup is HealthPickup) { UpgradeShip(GradiusShip.Ship.Lord); } else if (pickup is AmmoPickup) { UpgradeShip(GradiusShip.Ship.Vic); } } } private void UpgradeShip(GradiusShip.Ship shipType) { //IL_009b: 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 (shipLevels[(int)shipType] >= 5) { return; } shipLevels[(int)shipType]++; PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if ((Object)(object)((GunBehaviour)this).gun == (Object)(object)((GameActor)playerOwner).CurrentGun) { foreach (GradiusShip extantShip in _extantShips) { if (Object.op_Implicit((Object)(object)extantShip) && extantShip._shipType == shipType) { extantShip.DoUpgrade(); } } } else { GameObject singlePixel = VFX.SinglePixel; int numToSpawn = 10 * shipLevels[(int)shipType]; Transform transform = ((BraveBehaviour)playerOwner).transform; Vector2 centerPosition = ((GameActor)playerOwner).CenterPosition; Color? overrideColor = GradiusShip._ShipColors[(int)shipType]; CwaffVFX.SpawnBurst(singlePixel, numToSpawn, centerPosition, 5f, null, 0f, 0f, CwaffVFX.Vel.InwardToCenter, CwaffVFX.Rot.None, 0.5f, null, 200f, null, fadeIn: false, uniform: false, null, null, null, randomFrame: false, -1, flipX: false, flipY: false, transform, overrideColor, 8f); } ((Component)this).gameObject.PlayUnique("gradius_powerup_sound"); } internal void DelayMastered(GradiusShip.Ship shipType, bool mastered, float delay) { foreach (GradiusShip extantShip in _extantShips) { if (Object.op_Implicit((Object)(object)extantShip) && extantShip._shipType == shipType && extantShip._mastered == mastered) { extantShip._cooldown = delay; } } } public override void MidGameSerialize(List data, int i) { ((GunBehaviour)this).MidGameSerialize(data, i); for (int j = 0; j < 4; j++) { data.Add(shipLevels[j]); } } public override void MidGameDeserialize(List data, ref int i) { ((GunBehaviour)this).MidGameDeserialize(data, ref i); for (int j = 0; j < 4; j++) { shipLevels[j] = (int)data[i++]; } } } public class RoundLaser : Projectile { private const float _LIFETIME = 1f; private const float _BASE_MAX_RADIUS = 3f; private const float _LVL_RADIUS = 1.5f; private const float _THICKNESS = 0.25f; private static readonly Color _StartColor = new Color(0.5f, 1f, 0.6f, 1f); private static readonly Color _EndColor = new Color(0.5f, 1f, 0.6f, 0f); private Geometry _laserRing; private float _lifetime; public tk2dBaseSprite ship; public int level = 1; private List _hitEnemies = new List(); public override void Start() { //IL_0040: 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) ((Projectile)this).Start(); base.m_usesNormalMoveRegardless = true; base.collidesWithEnemies = false; base.collidesWithPlayer = false; base.collidesWithProjectiles = false; tk2dBaseSprite sprite = ((BraveBehaviour)this).sprite; if (sprite != null) { ((BraveBehaviour)sprite).renderer.enabled = false; } ((Projectile)this).UpdateCollisionMask(); base.damageTypes = (CoreDamageTypes)(base.damageTypes & -65); _laserRing = Geometry.Create(Geometry.Shape.RING); } public override void Move() { //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_00a9: 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_00b5: 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) //IL_00c5: 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_008a: 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_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_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) //IL_016d: 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) //IL_018d: Unknown result type (might be due to invalid IL or missing references) _lifetime += BraveTime.DeltaTime; if (_lifetime > 1f) { if (Object.op_Implicit((Object)(object)_laserRing)) { Object.Destroy((Object)(object)((Component)_laserRing).gameObject); _laserRing = null; } ((Projectile)this).DieInAir(true, true, true, false); return; } float num = _lifetime / 1f; float num2 = num * (3f + 1.5f * (float)level); if (Object.op_Implicit((Object)(object)ship)) { ((BraveBehaviour)this).transform.position = Vector2.op_Implicit(ship.WorldCenter); } Vector2 val = Vector2.op_Implicit(((BraveBehaviour)this).transform.position); Geometry laserRing = _laserRing; Color? color = Color.Lerp(_StartColor, _EndColor, num); Vector2? pos = val; float? radius = num2 + 0.25f; float? radiusInner = num2; laserRing.Place(color, pos, null, radius, null, null, radiusInner); foreach (AIActor allNearbyEnemy in val.GetAllNearbyEnemies(num2)) { if (!_hitEnemies.Contains(allNearbyEnemy)) { _hitEnemies.Add(allNearbyEnemy); HealthHaver healthHaver = ((BraveBehaviour)allNearbyEnemy).healthHaver; float damage = base.baseData.damage; Vector2 val2 = ((GameActor)allNearbyEnemy).CenterPosition - val; healthHaver.ApplyDamage(damage, ((Vector2)(ref val2)).normalized, Gradius.ItemName, (CoreDamageTypes)0, (DamageCategory)0, false, (PixelCollider)null, false); CwaffVFX.Spawn(Gradius._JadeRingImpactVFX, Vector2.op_Implicit(((GameActor)allNearbyEnemy).CenterPosition)); ((Component)allNearbyEnemy).gameObject.Play("gradius_round_laser_impact_sound"); } } } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)_laserRing)) { Object.Destroy((Object)(object)((Component)_laserRing).gameObject); _laserRing = null; } ((Projectile)this).OnDestroy(); } } public class GradiusShip : MonoBehaviour { public enum Ship { Falchion, Jade, Lord, Vic } private const float _FREQ = 5f; private const float _AMP = 0.0625f; private static VFXPool _MuzzleVFX = null; private bool _didSetup; private Vector2 _relPos; private PlayerController _owner; private Gradius _gun; private tk2dBaseSprite _sprite; private float _phase; private ParticleSystem _ps; private int _level = 1; private Geometry[] _levelBlips = new Geometry[5]; private int _lastFiredFrame; internal bool _mastered; internal float _cooldown; internal Ship _shipType; internal static Color[] _ShipColors = (Color[])(object)new Color[4] { ExtendedColours.pink, ExtendedColours.lime, ExtendedColours.vibrantOrange, Color.cyan }; private static GameObject[] _ShipParticleSystem = (GameObject[])(object)new GameObject[4] { MakeShipParticleSystem(_ShipColors[0]), MakeShipParticleSystem(_ShipColors[1]), MakeShipParticleSystem(_ShipColors[2]), MakeShipParticleSystem(_ShipColors[3]) }; private static readonly float[] _FalchionCooldowns = new float[5] { 2.5f, 1.8f, 1.2f, 0.7f, 0.5f }; private static readonly float[] _JadeCooldowns = new float[5] { 2.1f, 1.9f, 1.7f, 1.5f, 1.4f }; private static readonly float[] _LordCooldowns = new float[5] { 3f, 2f, 1.5f, 1.1f, 0.9f }; private static readonly float[] _VicCooldowns = new float[5] { 0.2f, 0.15f, 0.12f, 0.1f, 0.08f }; private static GameObject MakeShipParticleSystem(Color particleColor) { //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_0065: 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_008f: 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) //IL_00bc: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_0147: 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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0151: 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_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Expected O, but got Unknown //IL_01c0: 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_01d2: 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) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: 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_0225: 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_023b: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Expected O, but got Unknown //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Expected O, but got Unknown //IL_041e: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(((Component)Items.CombinedRifle.AsGun().alternateVolley.projectiles[0].projectiles[0]).GetComponent().ParticleSystemToSpawn).RegisterPrefab(); ParticleSystem component = val.GetComponent(); float num = 2f; MainModule main = component.main; ((MainModule)(ref main)).duration = 3600f; ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(1f); ((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(0.0625f); ((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)1; ((MainModule)(ref main)).startRotation = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).startRotation3D = false; ((MainModule)(ref main)).startRotationMultiplier = 0f; ((MainModule)(ref main)).maxParticles = 200; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(particleColor); ((MainModule)(ref main)).emitterVelocityMode = (ParticleSystemEmitterVelocityMode)0; ForceOverLifetimeModule forceOverLifetime = component.forceOverLifetime; ((ForceOverLifetimeModule)(ref forceOverLifetime)).enabled = false; VelocityOverLifetimeModule velocityOverLifetime = component.velocityOverLifetime; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)0; AnimationCurve val2 = new AnimationCurve(); val2.AddKey(0f, 6f); val2.AddKey(0.5f, 0.5f); val2.AddKey(1f, 0f); MinMaxCurve val3 = default(MinMaxCurve); ((MinMaxCurve)(ref val3))..ctor(1f, val2); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).z = val3; MinMaxCurve x = (((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = val3); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = x; float num2 = (((VelocityOverLifetimeModule)(ref velocityOverLifetime)).zMultiplier = 1f); float xMultiplier = (((VelocityOverLifetimeModule)(ref velocityOverLifetime)).yMultiplier = num2); ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).xMultiplier = xMultiplier; ((VelocityOverLifetimeModule)(ref velocityOverLifetime)).xMultiplier = 0f; RotationOverLifetimeModule rotationOverLifetime = component.rotationOverLifetime; ((RotationOverLifetimeModule)(ref rotationOverLifetime)).enabled = false; RotationBySpeedModule rotationBySpeed = component.rotationBySpeed; ((RotationBySpeedModule)(ref rotationBySpeed)).enabled = false; Gradient val5 = new Gradient(); val5.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(particleColor, 0f), new GradientColorKey(particleColor, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[5] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(0.5f, 0.25f), new GradientAlphaKey(0.15f, 0.5f), new GradientAlphaKey(0.01f, 0.75f), new GradientAlphaKey(0.01f, 1f) }); ColorOverLifetimeModule colorOverLifetime = component.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val5); EmissionModule emission = component.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(14f); ParticleSystemRenderer component2 = val.GetComponent(); ((Renderer)component2).material.SetFloat("_InvFade", 3f); ((Renderer)component2).material.SetFloat("_EmissionGain", 0.1f); ((Renderer)component2).material.SetColor("_EmissionColor", particleColor); ((Renderer)component2).material.SetColor("_DiffuseColor", particleColor); ((Renderer)component2).sortingLayerName = "Foreground"; SizeOverLifetimeModule sizeOverLifetime = component.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; AnimationCurve val6 = new AnimationCurve(); val6.AddKey(0f, 1f); val6.AddKey(0.9f, 0f); ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1.5f, val6); ShapeModule shape = component.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)12; ((ShapeModule)(ref shape)).randomDirectionAmount = 0f; ((ShapeModule)(ref shape)).alignToDirection = false; ((ShapeModule)(ref shape)).scale = Vector3.one; ((ShapeModule)(ref shape)).radiusThickness = 1f; ((ShapeModule)(ref shape)).radiusMode = (ParticleSystemShapeMultiModeValue)0; ((ShapeModule)(ref shape)).length = 2f; ((ShapeModule)(ref shape)).radius = 0.25f; ((ShapeModule)(ref shape)).rotation = Vector3.up; ((ShapeModule)(ref shape)).arc = 360f; ((ShapeModule)(ref shape)).arcMode = (ParticleSystemShapeMultiModeValue)0; ((ShapeModule)(ref shape)).arcSpeed = MinMaxCurve.op_Implicit(num); ((ShapeModule)(ref shape)).meshShapeType = (ParticleSystemMeshShapeType)0; InheritVelocityModule inheritVelocity = component.inheritVelocity; ((InheritVelocityModule)(ref inheritVelocity)).enabled = true; ((InheritVelocityModule)(ref inheritVelocity)).mode = (ParticleSystemInheritVelocityMode)1; ((InheritVelocityModule)(ref inheritVelocity)).curveMultiplier = 1f; AnimationCurve val7 = new AnimationCurve(); val7.AddKey(0f, 1f); val7.AddKey(1f, 1f); ((InheritVelocityModule)(ref inheritVelocity)).curve = new MinMaxCurve(1f, val7); return val; } private static AIActor GetWeakestVisibleEnemy(Vector2 pos, Quaternion rot) { //IL_0008: 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) AIActor result = null; float num = float.MaxValue; foreach (AIActor item in pos.AllEnemiesWithinConeOfVision(((Quaternion)(ref rot)).eulerAngles.z, 90f, 100f, ignoreWalls: false, includeInvulnerable: false)) { HealthHaver healthHaver = ((BraveBehaviour)item).healthHaver; if (!(healthHaver.currentHealth >= num)) { num = healthHaver.currentHealth; result = item; } } return result; } public static GameObject GetGradiusProjectile(Ship? ship = null) { return (GameObject)((Ship)(((int?)ship) ?? Random.Range(0, 4)) switch { Ship.Falchion => ((Component)Lazy.GunDefaultProjectile(129)).gameObject, Ship.Jade => ((Component)Gradius._RoundLaserProjectile).gameObject, Ship.Lord => ((Component)Gradius._WeakseekerProjectile).gameObject, Ship.Vic => ((Component)Lazy.GunDefaultProjectile(59)).gameObject, _ => ((Component)Lazy.GunDefaultProjectile(Lazy.PickupId())).gameObject, }); } public void AttemptToFire(Vector2 direction) { //IL_0032: 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_0038: 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_0082: 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_00ba: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_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_00b8: 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_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_owner)) { return; } int frameCount = Time.frameCount; if (_cooldown > 0f && _lastFiredFrame < frameCount) { return; } _lastFiredFrame = frameCount; Quaternion val = direction.EulerZ(); _cooldown = GetCooldown() / _owner.FireRateMult(); _gun.DelayMastered(_shipType, !_mastered, 0.5f * _cooldown); Vector2 val2 = _sprite.WorldCenterRight(); GameObject gradiusProjectile = GetGradiusProjectile(_shipType); if (_shipType == Ship.Lord) { AIActor weakestVisibleEnemy = GetWeakestVisibleEnemy(val2, val); if (weakestVisibleEnemy != null) { val = (((GameActor)weakestVisibleEnemy).CenterPosition - val2).EulerZ(); } } Projectile component = SpawnManager.SpawnProjectile(gradiusProjectile, Vector2.op_Implicit(val2), val, true).GetComponent(); component.SetOwnerAndStats((GameActor)(object)_owner); _owner.DoPostProcessProjectile(component); switch (_shipType) { case Ship.Falchion: { component.RuntimeUpdateScale(0.5f); ProjectileData baseData = component.baseData; baseData.speed *= 0.65f + 0.35f * (float)_level; ((Component)this).gameObject.PlayUnique("gradius_missile_sound"); break; } case Ship.Jade: { ((Component)this).gameObject.PlayUnique("gradius_shield_sound"); RoundLaser component2 = ((Component)component).gameObject.GetComponent(); component2.ship = _sprite; component2.level = _level; break; } case Ship.Lord: ((Component)this).gameObject.PlayUnique("gradius_beam_sound"); break; case Ship.Vic: ((Component)this).gameObject.PlayUnique("gradius_blaster_sound"); break; } if (_MuzzleVFX == null) { _MuzzleVFX = Items.Mailbox.AsGun().muzzleFlashEffects; } _MuzzleVFX.SpawnAtPosition(Vector2.op_Implicit(val2), ((Quaternion)(ref val)).eulerAngles.z.Clamp360(), (Transform)null, (Vector2?)null, (Vector2?)null, (float?)null, false, (SpawnMethod)null, (tk2dBaseSprite)null, false); } private float GetCooldown() { return _shipType switch { Ship.Falchion => _FalchionCooldowns[_level - 1], Ship.Jade => _JadeCooldowns[_level - 1], Ship.Lord => _LordCooldowns[_level - 1], Ship.Vic => _VicCooldowns[_level - 1], _ => 0.5f + Random.value, }; } public void Setup(PlayerController owner, Gradius gun, Vector2 relPos, Ship ship, bool mastered) { //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_0092: 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_00d5: 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) _shipType = ship; _relPos = relPos; _owner = owner; _gun = gun; _mastered = mastered; _sprite = ((Component)this).gameObject.GetComponent(); _level = _gun.shipLevels[(int)_shipType]; _cooldown = GetCooldown() / _owner.FireRateMult(); _phase = (float)Math.PI * Random.value; GameObjectExtensions.SetLayerRecursively(((Component)this).gameObject, LayerMask.NameToLayer("Unpixelated")); SpriteOutlineManager.AddOutlineToSprite(_sprite, Color.black, 2f, 0f, (OutlineType)0); _sprite.UpdateZDepth(); GameObject val = Object.Instantiate(_ShipParticleSystem[(int)_shipType]); val.transform.position = Vector2.op_Implicit(_sprite.WorldCenterLeft()); val.transform.parent = ((Component)this).gameObject.transform; val.transform.localRotation = 90f.EulerZ(); _ps = val.GetComponent(); _didSetup = true; } internal void DoUpgrade() { //IL_0021: 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_003d: Unknown result type (might be due to invalid IL or missing references) UpdateLevelIndicators(); GameObject singlePixel = VFX.SinglePixel; int numToSpawn = 10 * _level; Transform transform = ((Component)this).transform; Vector2 basePosition = Vector2.op_Implicit(((Component)this).transform.position); Color? overrideColor = _ShipColors[(int)_shipType]; CwaffVFX.SpawnBurst(singlePixel, numToSpawn, basePosition, 5f, null, 0f, 0f, CwaffVFX.Vel.InwardToCenter, CwaffVFX.Rot.None, 0.5f, null, 200f, null, fadeIn: false, uniform: false, null, null, null, randomFrame: false, -1, flipX: false, flipY: false, transform, overrideColor, 8f); } private void LateUpdate() { //IL_005a: 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_0065: 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_00ac: 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) //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_00bd: Unknown result type (might be due to invalid IL or missing references) if (_didSetup && Object.op_Implicit((Object)(object)_owner) && Object.op_Implicit((Object)(object)_sprite) && Object.op_Implicit((Object)(object)_gun) && !((Object)(object)((GameActor)_owner).CurrentGun != (Object)(object)((GunBehaviour)_gun).gun)) { float lerpGunAngle = _gun._lerpGunAngle; Vector2 val = _relPos.Rotate(lerpGunAngle); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0f, 0.0625f * Mathf.Sin(5f * (BraveTime.ScaledTimeSinceStartup + _phase))); ((Component)this).transform.localRotation = lerpGunAngle.EulerZ(); ((Component)this).transform.position = Vector2.op_Implicit(_gun.GetBasePos() + val + val2); UpdateLevelIndicators(); if (_cooldown > 0f) { _cooldown -= BraveTime.DeltaTime; } } } private void UpdateLevelIndicators() { //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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_00da: 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_00f2: 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_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_0106: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_owner) || _owner.IsInCombat) { for (int i = 0; i < 5; i++) { if (Object.op_Implicit((Object)(object)_levelBlips[i])) { _levelBlips[i].Disable(); } } return; } int shipType = (int)_shipType; int num = (_level = _gun.shipLevels[shipType]); Vector3 position = ((Component)this).transform.position; Quaternion localRotation = ((Component)this).transform.localRotation; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(0.5625f, -0.25f, 0f); for (int j = 0; j < num; j++) { if (!Object.op_Implicit((Object)(object)_levelBlips[j])) { _levelBlips[j] = Geometry.Create(Geometry.Shape.RING); } Geometry obj = _levelBlips[j]; Color? color = _ShipColors[shipType]; Vector2? pos = Vector2.op_Implicit(position + localRotation * Vector2.op_Implicit(new Vector2(val.x, val.y + 0.125f * (float)j))); float? radius = 1f / 32f; float? radiusInner = 0f; obj.Place(color, pos, null, radius, null, null, radiusInner); } } private void OnDestroy() { //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_0030: Unknown result type (might be due to invalid IL or missing references) GameObject singlePixel = VFX.SinglePixel; Transform transform = ((Component)this).transform; Vector2 basePosition = Vector2.op_Implicit(((Component)this).transform.position); Color? overrideColor = _ShipColors[(int)_shipType]; CwaffVFX.SpawnBurst(singlePixel, 10, basePosition, 1f, null, 0f, 10f, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.None, 0.35f, null, 200f, null, fadeIn: false, uniform: false, null, null, null, randomFrame: false, -1, flipX: false, flipY: false, transform, overrideColor, 8f, 0f, null, -1, 0.15f); for (int i = 0; i < 5; i++) { if (Object.op_Implicit((Object)(object)_levelBlips[i])) { Object.Destroy((Object)(object)((Component)_levelBlips[i]).gameObject); } } if (Object.op_Implicit((Object)(object)_ps)) { _ps.Stop(true); ((Component)_ps).gameObject.transform.parent = null; ((Component)_ps).gameObject.ExpireIn(0.1f); _ps = null; } } } public class Mtara : CwaffGun { private class MtaraAmmoDisplay : CustomAmmoDisplay { private const int NUM_BARS = 8; private static StringBuilder _SB = new StringBuilder("", 1000); private Mtara _mtara; private PlayerController _owner; private void Start() { Gun component = ((Component)this).GetComponent(); _mtara = ((Component)component).GetComponent(); ref PlayerController owner = ref _owner; GameActor currentOwner = component.CurrentOwner; owner = (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null); } public override bool DoCustomAmmoDisplay(GameUIAmmoController uic) { if (!Object.op_Implicit((Object)(object)_owner)) { return false; } _SB.Length = 0; int num = Mathf.CeilToInt(8f * _mtara.HeatPercent()); if (_mtara._overheated && _mtara._allowOverheatFire) { for (int num2 = num; num2 > 0; num2--) { _SB.AppendFormat("[sprite \"mtara_heat_max_ui{0}\"]", Random.Range(1, 5).ToString()); } } else { for (int num3 = num; num3 > 0; num3--) { _SB.AppendFormat("[sprite \"mtara_heat_ui{0}\"]", (_mtara._overheated ? 8 : num3).ToString()); } } _SB.Append("\n"); _SB.Append(CustomAmmoDisplayExtensions.VanillaAmmoDisplay(_owner)); uic.GunAmmoCountLabel.Text = _SB.ToString(); return true; } } public static string ItemName = "M'tara"; public static string ShortDescription = "Maintain Focus"; public static string LongDescription = "Fires a beam that quickly melts targets. Firing too long will overheat the weapon, preventing usage for a few seconds. Substantially slows movement while firing."; public static string Lore = "A rifle whose effectiveness in melting its targets is matched only by its effectiveness in melting its user's hands. Experienced soldiers quickly learned to get the most use out of the rifle by alternating between firing it for a few seconds and using the excess heat to cook their instant rations."; private const float _OVERHEAT_TIME = 3f; private const float _COOLDOWN_RATE_NORMAL = 3f; private const float _COOLDOWN_RATE_OVERHEATED = 1f; private float _heat; private bool _overheated; private bool _allowOverheatFire; public static void Init() { //IL_01ba: 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) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 14; int? num = 4; bool? doesScreenShake = false; int? reloadFps = num; Color? val = null; gun.SetAttributes((ItemQuality)4, (GunClass)20, 0f, 100, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, doesScreenShake, null, shootFps, reloadFps, null, null, null, null, null, -1, -1, -1, null, modulesAreTiers: true, null, 60, 1f, (Anchor)3, -1f, null, -1f, muzzleLit: false, 0f, 0f, val, 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, 0.1f).Attach((Action)null, allowDuplicates: false).AssignGun(out Gun gunRef); for (int i = 0; i < 2; i++) { bool flag = i == 1; Gun gun2 = gunRef; Projectile baseProjectile = Items.Moonscraper.Projectile(); int? clipSize = -1; float? cooldown = 0.25f; float? damage = 50f; float? force = 0f; float? speed = -1f; float? angleVariance = 0f; string beamSprite = (flag ? "mtara_overheat_beam" : "mtara_beam"); string hitEnemySound = (flag ? "mtara_overheat_impact_sound" : "mtara_impact_sound"); float beamChargeDelay = (flag ? 0f : 0.05f); val = (flag ? new Color(0.75f, 1f, 0.75f) : new Color(1f, 1f, 0.5f)); float fire = (flag ? 1f : 0f); GunData b = GunData.New(gun2, baseProjectile, clipSize, cooldown, angleVariance, (ShootStyle)2, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, null, null, 0f, fire, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, null, null, hitEnemySound, null, null, 0f, ignoredForReloadPurposes: false, mirror: false, null, null, null, null, null, null, null, beamSprite, 60, -1, -1, 120, -1, 60, beamLoopCharge: false, 40f, 0, beamChargeDelay, 0f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: false, 0f, null, 0f, null, null, -1, null, null, null, null, null, null, val, 10f, 50f, 0f, -1f, 0.6f, useBetterEmissiveShader: false, 0.5f, greenFire: true); if (i == 0) { gunRef.InitProjectile(b); } else { gunRef.DuplicateDefaultModule(cloneProjectiles: false).InitSingleProjectileModule(b); } } } public override void OnTriedToInitiateAttack(PlayerController player) { base.OnTriedToInitiateAttack(player); if (_overheated && !base.Mastered) { player.SuppressThisClick = true; } } private void Start() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) ((BraveBehaviour)((GunBehaviour)this).gun).sprite.MakeGlowyBetter((float?)0.9f, (Color?)new Color(0f, 0.7f, 0.5f), (float?)20f, 0.1f, (Color?)null, skipSetup: false); } public override void Update() { //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Invalid comparison between Unknown and I4 base.Update(); if (base.Mastered) { percentSpeedWhileFiring = 1f; } Material material = ((BraveBehaviour)((BraveBehaviour)((GunBehaviour)this).gun).sprite).renderer.material; material.SetFloat(CwaffVFX._EmissivePowerId, 0.1f); PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null) { return; } bool flag = Object.op_Implicit((Object)(object)((GunBehaviour)this).gun) && ((GunBehaviour)this).gun.IsFiring && !playerOwner.IsDodgeRolling; if (_allowOverheatFire && !flag) { if (((GunBehaviour)this).gun.IsFiring) { ((GunBehaviour)this).gun.CeaseAttack(true, (ProjectileData)null); } _allowOverheatFire = false; ((GunBehaviour)this).gun.CurrentStrengthTier = 0; ((Component)this).gameObject.Play("mtara_overheat_sound"); } UpdateHeat(flag); _ = _overheated; if (_allowOverheatFire) { ((MonoBehaviour)(object)((GunBehaviour)this).gun).LoopSoundIf(flag, "focus_rifle_overheat_fire_sound", 800, 199); } else { ((MonoBehaviour)(object)((GunBehaviour)this).gun).LoopSoundIf(flag, "focus_rifle_fire_sound", 800, 199); } BeamController extantBeam = GetExtantBeam(); BasicBeamController val = (BasicBeamController)(object)((extantBeam is BasicBeamController) ? extantBeam : null); if (val != null && (int)val.State == 2) { UpdateLights(); material.SetFloat(CwaffVFX._EmissivePowerId, 0.9f + 0.8f * Mathf.Abs(Mathf.Sin(15f * BraveTime.ScaledTimeSinceStartup))); } } private float HeatPercent() { return _heat / 3f; } private void UpdateHeat(bool firing) { if (_allowOverheatFire) { return; } float deltaTime = BraveTime.DeltaTime; if (!firing) { _heat -= (_overheated ? 1f : 3f) * deltaTime; if (_heat <= 0f) { _heat = 0f; if (_overheated) { ToggleOverheat(isOverheated: false); } } } else if (!(_heat >= 3f)) { _heat += deltaTime; if (!(_heat < 3f)) { _heat = 3f; ToggleOverheat(isOverheated: true); } } } private void ToggleOverheat(bool isOverheated) { //IL_00f5: 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_00ff: 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_0112: 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_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_0127: 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) _overheated = isOverheated; ((GunBehaviour)this).PlayerOwner.inventory.GunLocked.SetOverride(ItemName, isOverheated, (float?)null); ((PickupObject)((GunBehaviour)this).gun).CanBeDropped = !isOverheated; if (!isOverheated) { return; } if (base.Mastered) { _allowOverheatFire = true; ((GunBehaviour)this).gun.CurrentStrengthTier = 1; bool isFiring = ((GunBehaviour)this).gun.IsFiring; if (isFiring) { ((Component)((GunBehaviour)this).gun).gameObject.Stop("focus_rifle_fire_sound"); ((GunBehaviour)this).gun.CeaseAttack(true, (ProjectileData)null); } ClearCachedShootData(); if (isFiring) { ((GunBehaviour)this).gun.Attack((ProjectileData)null, (GameObject)null); } } else { ((GunBehaviour)this).gun.CeaseAttack(true, (ProjectileData)null); ((Component)this).gameObject.Play("mtara_overheat_sound"); GameObject effect = Jugglernaut._ImpactVFX[5].effects[0].effects[0].effect; Vector2 val = Vector2.op_Implicit(((Component)((GunBehaviour)this).gun.barrelOffset).transform.position); Vector2 centerPosition = ((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition; for (int i = 0; i < 4; i++) { tk2dSprite component = SpawnManager.SpawnVFX(effect, Vector2.op_Implicit(Vector2.Lerp(val, centerPosition, 0.25f * (float)i)), Quaternion.identity).GetComponent(); ((tk2dBaseSprite)component).HeightOffGround = 10f; ((tk2dBaseSprite)component).UpdateZDepth(); } } } private void UpdateLights() { float num = 40f + 20f * Mathf.Sin(40f * BraveTime.ScaledTimeSinceStartup); for (int num2 = ((GunBehaviour)this).gun.m_activeBeams.Count - 1; num2 >= 0; num2--) { BeamController beam = ((GunBehaviour)this).gun.m_activeBeams[num2].beam; BasicBeamController val = (BasicBeamController)(object)((beam is BasicBeamController) ? beam : null); while (Object.op_Implicit((Object)(object)val)) { ((BraveBehaviour)((BraveBehaviour)val).sprite).renderer.material.SetFloat(CwaffVFX._EmissivePowerId, num); val = val.m_reflectedBeam; } } } } public class KingsLaw : CwaffGun { public static string ItemName = "King's Law"; public static string ShortDescription = "Accept Your Fate"; public static string LongDescription = "Conjures projectiles that hover behind the player as long as the fire button is held. Projectiles are launched with a short delay when fire is released, when reloading, or when changing weapons."; public static string Lore = "The trusty weapon of an ancient sorcerer-king who ruled Gunymede with an iron fist. Imbued with only a small fraction of his power and weakened further by the passage of time, this gun still resonates with enough destructive magic to wipe out hordes of lesser Gundead in the blink of an eye."; internal const float _ANGLE_GAP = 20f; internal const float _MAG_GAP = 0.75f; internal const float _MIN_MAG = 3f; internal const float _MAX_SPREAD = 45f; internal const int _MAX_BULLETS = 400; internal const float _SPAWN_RATE = 0.1f; internal const float _RUNE_ROT_MID = 59f; internal static List _OffsetAnglesMagsAndRings = new List(400); internal static GameObject _RuneLarge; internal static GameObject _RuneSmall; internal static GameObject _RuneMuzzle; private int _nextIndex; private int _curBatch; private GameObject _extantMuzzleRune; private float _muzzleRuneAlpha; public static void Init() { //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore).SetAttributes((ItemQuality)4, (GunClass)60, 0.75f, 1000, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, false, null, null, null, null, null, null, "knife_gun_reload", 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, autoPlay: true, attacksThroughWalls: true).AddToShop(ModdedShopType.TimeTrader); int? clipSize = 20; float? damage = 7.5f; float? speed = 40f; float? range = 999999f; float? force = 9f; float? cooldown = 0.1f; bool? shouldRotate = false; gun.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "kings_law_projectile", 12, (Anchor)4, 0.5f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, shouldRotate, 1, null, null, useDummyChargeModule: true, invisibleProjectile: false, null, null, null, null, null, null, null, null, null, "knife_gun_hit")).Attach(); int num = 0; int num2 = 0; float num3 = 0f; float num4 = 0f; float num5 = 0f; float num6 = 0f; for (int i = 0; i < 400; i++) { if (num2 > num) { num3 = num5; num4 = 3f + 0.75f * (float)(num * 2 - num2); } else { num3 = num6 * (float)num2; num4 = 3f + 0.75f * (float)num; } _OffsetAnglesMagsAndRings.Add(new Vector3(num3, num4, (float)num2)); if (num2 > 0) { _OffsetAnglesMagsAndRings.Add(new Vector3(0f - num3, num4, (float)num2)); i++; num2--; } else { num++; num2 = num; num5 = 45f * ((float)num / (float)(num + 1)); num6 = num5 / (float)num; } } _RuneLarge = VFX.Create("law_rune_large", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _RuneSmall = VFX.Create("law_rune_small", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _RuneMuzzle = VFX.Create("muzzle_kings_law", 10f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } public override void OnPostFired(PlayerController player, Gun gun) { ((GunBehaviour)this).OnPostFired(player, gun); ((Component)this).gameObject.Play("snd_undynedis"); } public override void OnReloadPressed(PlayerController player, Gun gun, bool manualReload) { base.OnReloadPressed(player, gun, manualReload); Reset(); } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); Reset(); _muzzleRuneAlpha = 0f; if (Object.op_Implicit((Object)(object)_extantMuzzleRune)) { _extantMuzzleRune.SetAlphaImmediate(0f); } } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); Reset(); } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); Reset(); } private void Reset(bool clearVfx = true) { if (clearVfx) { if (Object.op_Implicit((Object)(object)_extantMuzzleRune)) { _extantMuzzleRune.SetAlpha(0f); } _muzzleRuneAlpha = 0f; } if (_nextIndex != 0) { _nextIndex = 0; _curBatch++; } } public int GetNextIndex() { return _nextIndex++; } public int GetBatch() { return _curBatch; } public override void Update() { //IL_0040: 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_00da: Unknown result type (might be due to invalid IL or missing references) base.Update(); if (BraveTime.DeltaTime == 0f || ((GunBehaviour)this).PlayerOwner == null) { return; } if ((Object)(object)_extantMuzzleRune == (Object)null) { _extantMuzzleRune = SpawnManager.SpawnVFX(_RuneMuzzle, ((Component)((GunBehaviour)this).gun.barrelOffset).transform.position, Quaternion.identity); _extantMuzzleRune.SetAlphaImmediate(0f); _extantMuzzleRune.transform.parent = ((GunBehaviour)this).gun.barrelOffset; } if (((GunBehaviour)this).gun.IsCharging) { _muzzleRuneAlpha = Mathf.Min(1f, _muzzleRuneAlpha + 2f * BraveTime.DeltaTime); _extantMuzzleRune.SetAlpha(Mathf.Clamp01(_muzzleRuneAlpha)); _extantMuzzleRune.transform.localRotation = (-59f * BraveTime.ScaledTimeSinceStartup).EulerZ(); return; } if (!((GunBehaviour)this).gun.IsReloading && ((GunBehaviour)this).gun.ClipShotsRemaining < Mathf.Min(((GunBehaviour)this).gun.ClipCapacity, ((GunBehaviour)this).gun.CurrentAmmo)) { ((GunBehaviour)this).gun.Reload(); } _muzzleRuneAlpha = Mathf.Max(0f, _muzzleRuneAlpha - 4f * BraveTime.DeltaTime); if (Object.op_Implicit((Object)(object)_extantMuzzleRune)) { _extantMuzzleRune.SetAlpha(Mathf.Clamp01(_muzzleRuneAlpha)); } Reset(clearVfx: false); ((GunBehaviour)this).gun.SynchronizeReloadAcrossAllModules(); } public override void PostProcessProjectile(Projectile projectile) { ((GunBehaviour)this).PostProcessProjectile(projectile); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((Component)projectile).gameObject.GetComponent()?.Setup(this, base.Mastered); } } } public class KingsLawBullets : MonoBehaviour { private const float _TIME_BEFORE_STASIS = 0.2f; private const float _GLOW_TIME = 0.5f; private const float _GLOW_MAX = 10f; private const float _LAUNCH_DELAY = 0.04f; private const float _LAUNCH_SPEED = 50f; private const float _RUNE_ALPHA = 0.3f; private const float _RUNE_ROT_FAST = 69f; private const float _RUNE_ROT_SLOW = 47f; private PlayerController _owner; private Projectile _projectile; private GameObject _runeLarge; private GameObject _runeSmall; private float _offsetAngle; private float _offsetMag; private float _offsetRing; private int _index; private int _batch; private bool _naturalSpawn; private KingsLaw _king; private Gun _gun; private bool _mastered; public void Setup(KingsLaw king, bool mastered) { _index = king.GetNextIndex(); _batch = king.GetBatch(); _naturalSpawn = true; _king = king; _gun = ((Component)king).gameObject.GetComponent(); _mastered = mastered; } private void Start() { //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) //IL_0048: 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: 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: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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)) { Vector3 val = KingsLaw._OffsetAnglesMagsAndRings[_index % 400]; _offsetAngle = val.x * Mathf.Min(1.5f, 0.5f + 0.5f * _owner.AccuracyMult()); _offsetMag = val.y; _offsetRing = val.z; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(SkipCorpseAndDoorCollisions)); if (_mastered) { _projectile.PenetratesInternalWalls = true; SpeculativeRigidbody specRigidbody2 = ((BraveBehaviour)_projectile).specRigidbody; OnPreTileCollisionDelegate onPreTileCollision = specRigidbody2.OnPreTileCollision; Projectile projectile = _projectile; specRigidbody2.OnPreTileCollision = (OnPreTileCollisionDelegate)Delegate.Combine((Delegate?)(object)onPreTileCollision, (Delegate?)new OnPreTileCollisionDelegate(projectile.OnPreTileCollision)); } ((MonoBehaviour)this).StartCoroutine(TheLaw()); } } private void OnDestroy() { _runeLarge.SafeDestroy(); _runeSmall.SafeDestroy(); } private void SkipCorpseAndDoorCollisions(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { AIActor component = ((Component)otherRigidbody).GetComponent(); if (component != null && (!Object.op_Implicit((Object)(object)((BraveBehaviour)component).healthHaver) || ((BraveBehaviour)component).healthHaver.IsDead)) { PhysicsEngine.SkipCollision = true; } else if (Object.op_Implicit((Object)(object)((BraveBehaviour)otherRigidbody).transform.parent) && ((Component)((BraveBehaviour)otherRigidbody).transform.parent).GetComponent() != null && !((BraveBehaviour)_projectile).specRigidbody.CollideWithTileMap) { PhysicsEngine.SkipCollision = true; } } private IEnumerator TheLaw() { _projectile.SetSpeed(0.01f); ((BraveBehaviour)_projectile).specRigidbody.CollideWithTileMap = false; ((BraveBehaviour)_projectile).specRigidbody.CollideWithOthers = false; ((BraveBehaviour)_projectile).specRigidbody.Reinitialize(); _runeLarge = SpawnManager.SpawnVFX(KingsLaw._RuneLarge, ((BraveBehaviour)_projectile).transform.position, Quaternion.identity); _runeLarge.SetAlphaImmediate(0.3f); _runeLarge.transform.parent = ((BraveBehaviour)_projectile).transform; _runeSmall = SpawnManager.SpawnVFX(KingsLaw._RuneSmall, ((BraveBehaviour)_projectile).transform.position, Quaternion.identity); _runeSmall.SetAlphaImmediate(0.3f); _runeSmall.transform.parent = ((BraveBehaviour)_projectile).transform; float earlyRelease = 0f; float targetAngle = _owner.m_currentGunAngle; Vector2 originalPlayerPosition = TransformExtensions.PositionVector2(((GameActor)_owner).CurrentGun.barrelOffset); Vector2 ownerCenter = ((GameActor)_owner).CenterPosition; for (float elapsed = 0f; elapsed < 0.2f; elapsed += BraveTime.DeltaTime) { if (_naturalSpawn && earlyRelease == 0f && (!Object.op_Implicit((Object)(object)_gun) || !_gun.IsCharging || !Object.op_Implicit((Object)(object)_king) || _batch != _king.GetBatch())) { earlyRelease = 0.2f - elapsed; } if (earlyRelease == 0f) { ownerCenter = ((GameActor)_owner).CenterPosition; targetAngle = _owner.m_currentGunAngle; originalPlayerPosition = TransformExtensions.PositionVector2(((GameActor)_owner).CurrentGun.barrelOffset); } float num = 1f - elapsed / 0.2f; float num2 = 1f - num * num * num; Vector2 val = (targetAngle + 180f + _offsetAngle).Clamp360().ToVector(_offsetMag); Vector2 val2 = Vector2.Lerp(originalPlayerPosition, ownerCenter + val, num2); ((BraveBehaviour)_projectile).specRigidbody.Position = new Position(val2); _projectile.SendInDirection(targetAngle.ToVector(), true, true); ((BraveBehaviour)_projectile).transform.localRotation = targetAngle.EulerZ(); ((BraveBehaviour)_projectile).specRigidbody.UpdateColliderPositions(); _runeLarge.transform.localRotation = (69f * BraveTime.ScaledTimeSinceStartup).EulerZ(); _runeSmall.transform.localRotation = (-47f * BraveTime.ScaledTimeSinceStartup).EulerZ(); yield return null; } while (_naturalSpawn && Object.op_Implicit((Object)(object)_owner) && Object.op_Implicit((Object)(object)_gun) && _gun.IsCharging && Object.op_Implicit((Object)(object)_king) && _batch == _king.GetBatch()) { ownerCenter = ((GameActor)_owner).CenterPosition; targetAngle = _owner.m_currentGunAngle; originalPlayerPosition = TransformExtensions.PositionVector2(((GameActor)_owner).CurrentGun.barrelOffset) + targetAngle.ToVector(2f); Vector2 val3 = (targetAngle + 180f + _offsetAngle).Clamp360().ToVector(_offsetMag); ((BraveBehaviour)_projectile).specRigidbody.Position = new Position(ownerCenter + val3); _projectile.SendInDirection(targetAngle.ToVector(), true, true); ((BraveBehaviour)_projectile).transform.localRotation = targetAngle.EulerZ(); ((BraveBehaviour)_projectile).specRigidbody.UpdateColliderPositions(); _runeLarge.transform.localRotation = (69f * BraveTime.ScaledTimeSinceStartup).EulerZ(); _runeSmall.transform.localRotation = (-47f * BraveTime.ScaledTimeSinceStartup).EulerZ(); yield return null; } Vector2 targetDir = targetAngle.ToVector(); _runeLarge.transform.parent = null; _runeSmall.transform.parent = null; ((BraveBehaviour)_projectile).sprite.SetGlowiness(0f, Color.cyan); Material m = ((BraveBehaviour)((BraveBehaviour)_projectile).sprite).renderer.material; ((Component)_projectile).gameObject.PlayUnique("knife_gun_glow"); float moveTimer = 0.5f - earlyRelease; while (moveTimer > 0f) { float a = 0.3f * moveTimer / 0.5f; _runeLarge.SetAlpha(a); _runeSmall.SetAlpha(a); float num3 = (0.5f - moveTimer) / 0.5f; m.SetFloat(CwaffVFX._EmissivePowerId, num3 * 10f); moveTimer -= BraveTime.DeltaTime; yield return null; } _runeLarge.SetAlpha(0f); _runeSmall.SetAlpha(0f); moveTimer = 0.04f * _offsetRing + 1f / 60f * ((float)_index - _offsetRing * _offsetRing); while (moveTimer > 0f) { moveTimer -= BraveTime.DeltaTime; yield return null; } _projectile.SetSpeed(50f * (Object.op_Implicit((Object)(object)_owner) ? _owner.ProjSpeedMult() : 1f)); ((BraveBehaviour)_projectile).specRigidbody.CollideWithOthers = true; ((BraveBehaviour)_projectile).specRigidbody.Reinitialize(); _projectile.SendInDirection(targetDir, true, true); ((Component)_projectile).gameObject.Play("knife_gun_launch"); if (_mastered) { _projectile.shouldRotate = true; HomingModifier obj = ((Component)_projectile).gameObject.AddComponent(); obj.AngularVelocity = Mathf.Max(obj.AngularVelocity, 360f); obj.HomingRadius = Mathf.Max(obj.HomingRadius, 36f); } float ignoreTileTime = 2f; while (Object.op_Implicit((Object)(object)_owner) && Object.op_Implicit((Object)(object)_projectile) && ((Behaviour)_projectile).isActiveAndEnabled) { float num4; ignoreTileTime = (num4 = ignoreTileTime - BraveTime.DeltaTime); if (num4 <= 0f || Vector2Extensions.ToAngle(Vector3Extensions.XY(((BraveBehaviour)_projectile).transform.position) - originalPlayerPosition).IsNearAngle(targetAngle, 90f)) { break; } yield return null; } ((BraveBehaviour)_projectile).specRigidbody.CollideWithTileMap = true; } } public class Cleansweep : CwaffGun { [HarmonyPatch] private static class CleansweepDeathPageEasterEggPatch { [HarmonyPatch(typeof(AmmonomiconPageRenderer), "InitializeDeathPageRight")] [HarmonyILManipulator] private static void AmmonomiconPageRendererInitializeDeathPageRightPatchIL(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) //IL_0047: 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.MatchCallvirt(instr, "get_DefaultSpriteID") })) { val.Emit(OpCodes.Ldloc_S, (byte)8); val.Emit(OpCodes.Ldarg_0); val.CallPrivate(typeof(CleansweepDeathPageEasterEggPatch), "CleanSweepEasterEggSprite"); } } private static int CleanSweepEasterEggSprite(int curSpriteId, Gun gun, AmmonomiconPageRenderer apr) { if (((Component)gun).gameObject.GetComponent() == null) { return curSpriteId; } if (Object.op_Implicit((Object)(object)apr.guiManager)) { AmmonomiconDeathPageController component = ((Component)apr.guiManager).GetComponent(); if (component != null) { if (component.isVictoryPage) { return gun.GetSprite().Collection.spriteNameLookupDict["cleansweep_special_victory"]; } return gun.GetSprite().Collection.spriteNameLookupDict["cleansweep_special_defeat"]; } } return curSpriteId; } } public static string ItemName = "Cleansweep"; public static string ShortDescription = "Mine Craft?"; public static string LongDescription = "First shot in every combat room deploys a Minesweeper grid for 10 ammo. Mines can be tripped by enemies, players, or Cleansweep's projectiles. Reloading with a full clip deploys a new grid for 20 ammo."; public static string Lore = "A groundbreaking achievement in landmine clearing technology, this was the weapon of choice for infantrymen in the 999 Second War. Historical evidence is inconclusive regarding against whom or for what reason this war was fought, with recent research even suggesting the entire war was manufactured by ACNE corporation for the sole purpose of selling their latest mine-clearing lineup."; private const float _MINE_EXPLOSION_DAMAGE = 100f; private const int _GAME_AMMO_COST = 10; private const int _RESTART_AMMO_COST = 20; private const float _RESET_DELAY = 1f; internal static ExplosionData _MineExplosion = null; private static float _NextResetTime = 0f; private static readonly List _IdleAnimations = new List(); private static readonly List _FireAnimations = new List(); public static void Init() { Gun gunRef; Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore).SetAttributes((ItemQuality)2, (GunClass)50, 1.05f, 440, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, null, null, null, null, "cleansweep_shoot_sound", 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, autoPlay: true, attacksThroughWalls: false, suppressReloadLabel: false, 1f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: false, preventRollingWhenCharging: false, 1f, 0.1f).AssignGun(out gunRef); int? clipSize = 7; float? cooldown = 0.28f; float? damage = 7f; bool? shouldRotate = false; bool? shouldFlipHorizontally = false; bool? shouldFlipVertically = false; gun.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "cleansweeper_projectile", 12, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, shouldRotate, 1, shouldFlipHorizontally, shouldFlipVertically)).Attach(); for (int i = 0; i < 9; i++) { _IdleAnimations.Add(gunRef.QuickUpdateGunAnimation($"{i}_idle")); } for (int j = 0; j <= 6; j++) { _FireAnimations.Add(gunRef.QuickUpdateGunAnimation($"{j + 2}_fire", null, returnToIdle: true, 10)); gunRef.SetGunAudio(_FireAnimations[j], "cleansweep_shoot_sound"); } gunRef.SetReloadAudio("cleansweep_reload_sound", 4, 9, 14, 19, 24, 29, 34); _MineExplosion = GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultExplosionData.Clone(); _MineExplosion.damage = 100f; ExplosionData mineExplosion = _MineExplosion; mineExplosion.damageRadius *= 0.65f; _MineExplosion.doScreenShake = false; } public override void OverrideShootAnimation(ref string overrideAnimation) { overrideAnimation = _FireAnimations[7 - Mathf.Clamp(((GunBehaviour)this).gun.ClipShotsRemaining, 1, 7)]; } private void LateUpdate() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).gun.m_anim) && !_FireAnimations.Contains(((GunBehaviour)this).gun.m_anim.currentClip.name)) { int clipShotsRemaining = ((GunBehaviour)this).gun.ClipShotsRemaining; ((GunBehaviour)this).gun.idleAnimation = _IdleAnimations[8 - Mathf.Min(clipShotsRemaining, 7)]; if (((GunBehaviour)this).gun.IsReloading) { ((GunBehaviour)this).gun.idleAnimation = _IdleAnimations[1]; } else { ((GunBehaviour)this).gun.PlayIfExists(((GunBehaviour)this).gun.idleAnimation, true); } } } public override void OnTriedToInitiateAttack(PlayerController player) { base.OnTriedToInitiateAttack(player); if (player.IsInCombat && ((GunBehaviour)this).gun.CurrentAmmo >= 10 && !MinesweeperGame.IsGameActive) { ((GunBehaviour)this).gun.LoseAmmo(10); MinesweeperGame.StartGame(player, base.Mastered); _NextResetTime = BraveTime.ScaledTimeSinceStartup + 1f; player.SuppressThisClick = true; } } public override void OnFullClipReload(PlayerController player, Gun gun) { if (MinesweeperGame.IsGameActive && player.IsInCombat && gun.CurrentAmmo >= 20) { float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; if (!(scaledTimeSinceStartup < _NextResetTime)) { _NextResetTime = scaledTimeSinceStartup + 1f; gun.LoseAmmo(20); MinesweeperGame.StartGame(player, base.Mastered); } } } } public class SweepProjectile : MonoBehaviour { private Projectile _projectile; private PlayerController _owner; private void Start() { _projectile = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); } private void Update() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_projectile) || !MinesweeperGame.IsGameActive) { return; } MinesweeperTile minesweeperTile = MinesweeperGame.ActiveGame.TileAtPosition(_projectile.SafeCenter); if (minesweeperTile != null && !minesweeperTile.IsRevealed) { minesweeperTile.Reveal(); if (minesweeperTile.IsMine) { _projectile.DieInAir(false, true, true, false); } } } } public class MinesweeperTile : MonoBehaviour { internal const float _MINE_CHANCE = 0.125f; private static readonly Color[] _NumberColors = (Color[])(object)new Color[9] { new Color(0.75f, 0.75f, 0.75f), new Color(0f, 0f, 1f), new Color(0f, 0.5f, 0f), new Color(1f, 0f, 0f), new Color(0f, 0f, 0.5f), new Color(0.5f, 0f, 0f), new Color(0f, 0.5f, 0.5f), new Color(0f, 0f, 0f), new Color(0.5f, 0.5f, 0.5f) }; internal bool _setup; internal IntVector2 _pos; internal Vector2 _tl; internal Vector2 _br; internal Vector2 _center; internal Vector2 _labelPos; internal float _lifetime; internal Geometry _square; internal int _number; internal dfLabel _numberLabel; internal Transform _numberLabelT; internal Color _color; internal bool _revealed; internal bool _flagged; internal float _lastAlpha; private static LinkedList _InactiveTiles = new LinkedList(); private static LinkedList _ActiveTiles = new LinkedList(); public bool IsRevealed => _revealed; public bool IsFlagged => _flagged; public bool IsSafe => _number == 0; public bool IsMine => _number == -1; public IntVector2 Pos => _pos; public void ToggleFlag() { if (!_revealed) { _flagged = !_flagged; ((Component)this).gameObject.PlayOnce("minesweeper_place_sound"); } } private static MinesweeperTile Rent() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (_InactiveTiles.Count == 0) { _InactiveTiles.AddLast(new LinkedListNode(null)); } LinkedListNode last = _InactiveTiles.Last; _InactiveTiles.RemoveLast(); if (!Object.op_Implicit((Object)(object)last.Value)) { MinesweeperTile minesweeperTile = new GameObject("minesweeper tile").AddComponent(); minesweeperTile._square = Geometry.Create(Geometry.Shape.RECTANGLE); minesweeperTile._numberLabel = EasyLabel.Create(unicode: false, outline: false, (TextAlignment)1); minesweeperTile._numberLabelT = ((Component)minesweeperTile._numberLabel).transform; last.Value = minesweeperTile; } MinesweeperTile value = last.Value; last.Value = null; _ActiveTiles.AddLast(last); return value; } public void Return() { _setup = false; if (Object.op_Implicit((Object)(object)_numberLabel)) { ((dfControl)_numberLabel).IsVisible = false; ((dfControl)_numberLabel).Opacity = 0f; } if (Object.op_Implicit((Object)(object)_square)) { _square.Disable(); } LinkedListNode last = _ActiveTiles.Last; _ActiveTiles.RemoveLast(); last.Value = this; _InactiveTiles.AddLast(last); } public static MinesweeperTile Setup(IntVector2 pos, int number, int tileSize) { //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_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_0034: 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_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_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_006d: 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_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_0093: 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_00a3: 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_010b: 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_0110: Unknown result type (might be due to invalid IL or missing references) MinesweeperTile minesweeperTile = Rent(); minesweeperTile._lifetime = 0f; minesweeperTile._revealed = false; minesweeperTile._flagged = false; minesweeperTile._pos = pos; minesweeperTile._tl = ((IntVector2)(ref pos)).ToVector2(); minesweeperTile._center = minesweeperTile._tl + new Vector2(0.5f * (float)tileSize, 0.5f * (float)tileSize); minesweeperTile._br = minesweeperTile._tl + new Vector2((float)tileSize, (float)tileSize); minesweeperTile._labelPos = minesweeperTile._tl + new Vector2((float)tileSize * 0.6f, (float)tileSize * 0.3f); minesweeperTile._color = ((number < 0) ? Color.red : _NumberColors[0]); minesweeperTile._number = number; minesweeperTile._numberLabel.Text = ((number <= 0) ? string.Empty : $"{number}"); minesweeperTile._numberLabel.TextScale = 0.5f * (float)tileSize; ((dfControl)minesweeperTile._numberLabel).Color = Color32.op_Implicit((number < 0) ? Color.magenta : _NumberColors[number]); ((dfControl)minesweeperTile._numberLabel).Opacity = 0f; ((dfControl)minesweeperTile._numberLabel).IsVisible = number > 0; minesweeperTile._numberLabel.TextAlignment = (TextAlignment)1; minesweeperTile._numberLabel.VerticalAlignment = (dfVerticalAlignment)1; minesweeperTile._setup = true; int num = LayerMask.NameToLayer("BG_Critical"); GameObjectExtensions.SetLayerRecursively(((Component)minesweeperTile).gameObject, num); GameObjectExtensions.SetLayerRecursively(((Component)minesweeperTile._square).gameObject, num); GameObjectExtensions.SetLayerRecursively(((Component)minesweeperTile._numberLabel).gameObject, num); return minesweeperTile; } public void Reveal(bool detonateMines = true, bool playSounds = true) { //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_003d: Unknown result type (might be due to invalid IL or missing references) if (!_revealed && !_flagged) { _revealed = true; _lifetime = 0f; if (IsMine && detonateMines) { Exploder.Explode(Vector2.op_Implicit(_center), Cleansweep._MineExplosion, Vector2.zero, (Action)null, true, (CoreDamageTypes)0, true); } else if (playSounds) { ((Component)this).gameObject.PlayOnce("minesweeper_place_sound"); } } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)_square)) { Object.Destroy((Object)(object)((Component)_square).gameObject); } if (Object.op_Implicit((Object)(object)_numberLabel)) { Object.Destroy((Object)(object)((Component)_numberLabel).gameObject); } } } public class MinesweeperGame : MonoBehaviour { private const int _SAFETY_BUFFER = 4; private const float SPAWN_DELAY = 0.1f; private const float SETUP_DELAY = 0.05f; private const float _MINE_CHANCE = 0.16f; private const int ITER_DELAY = 5; private const float DISMISS_TIME = 1f; private const float _SHWOOP_TIME = 0.18f; private const float _NUM_OPACITY = 0.85f; private static readonly Color _UnknownColor = new Color(0.15f, 0.25f, 0.65f); private static readonly Color _FlaggedColor = new Color(0.55f, 0.95f, 0.65f); private static MinesweeperGame _Game = null; private PlayerController _player; private bool _setup; private bool _populated; private IntVector2 _gameCenter; private List _tiles; private Dictionary _tileMap; private Coroutine _spawner; private MinesweeperTile _targetTile; private RoomHandler _gameRoom; private bool _dismissing; private float _dismissTime; private Queue _revealQueue = new Queue(); private float _nextRevealTime; private int _tileSize = 2; private static Queue _Frontier = new Queue(); private static HashSet _Processed = new HashSet(); private static HashSet _Mines = new HashSet(); private const float _PROFILE_RATE = 0.5f; public static bool IsGameActive => (Object)(object)_Game != (Object)null; public static MinesweeperGame ActiveGame { get { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_Game) || !Object.op_Implicit((Object)(object)((Component)_Game).gameObject)) { _Game = new GameObject("MinesweeperGame").AddComponent(); } return _Game; } } public static void StartGame(PlayerController player, bool mastered) { //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_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_0059: Unknown result type (might be due to invalid IL or missing references) RoomHandler currentRoom = player.CurrentRoom; if (currentRoom == null) { return; } IntVector2 val = Vector3Extensions.XY(player.SpriteBottomCenter).QuantizeTileRound(mastered ? 1 : 2); if (IsValidStartingTile(val, GameManager.Instance.Dungeon.data, currentRoom)) { if (Object.op_Implicit((Object)(object)_Game)) { _Game.Teardown(); } ActiveGame.Setup(player, val, mastered); } } public void Setup(PlayerController player, IntVector2 startingTile, bool mastered) { //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) if (!_setup) { _player = player; _gameCenter = startingTile; _tileSize = (mastered ? 1 : 2); _tiles = new List(); _tileMap = new Dictionary(); _gameRoom = _player.CurrentRoom; RoomHandler gameRoom = _gameRoom; gameRoom.OnEnemiesCleared = (Action)Delegate.Combine(gameRoom.OnEnemiesCleared, new Action(OnRoomCleared)); _spawner = ((MonoBehaviour)this).StartCoroutine(PopulateGrid()); RegisterEvents(); _setup = true; } } private void DismissGameInternal() { if (!_dismissing) { _dismissing = true; _dismissTime = 1f; if (_gameRoom != null) { RoomHandler gameRoom = _gameRoom; gameRoom.OnEnemiesCleared = (Action)Delegate.Remove(gameRoom.OnEnemiesCleared, new Action(OnRoomCleared)); } ((Component)this).gameObject.Play("minesweeper_place_sound"); } } public static void DismissGame() { if (Object.op_Implicit((Object)(object)_Game)) { _Game.DismissGameInternal(); } } private void OnRoomCleared() { RoomHandler gameRoom = _gameRoom; gameRoom.OnEnemiesCleared = (Action)Delegate.Remove(gameRoom.OnEnemiesCleared, new Action(OnRoomCleared)); DismissGameInternal(); } public void Teardown(bool calledFromDestroy = false) { DeregisterEvents(); if (_gameRoom != null) { RoomHandler gameRoom = _gameRoom; gameRoom.OnEnemiesCleared = (Action)Delegate.Remove(gameRoom.OnEnemiesCleared, new Action(OnRoomCleared)); } for (int num = _tiles.Count - 1; num >= 0; num--) { if (Object.op_Implicit((Object)(object)_tiles[num])) { _tiles[num].Return(); } } _tiles.Clear(); if (_spawner != null) { ((MonoBehaviour)this).StopCoroutine(_spawner); } if ((Object)(object)_Game == (Object)(object)this) { _Game = null; } if (!calledFromDestroy) { Object.Destroy((Object)(object)this); } } public static bool FlagTarget() { if (!Object.op_Implicit((Object)(object)_Game) || !Object.op_Implicit((Object)(object)_Game._targetTile) || _Game._targetTile.IsRevealed) { return false; } _Game._targetTile.ToggleFlag(); return true; } private static bool IsValidStartingTile(IntVector2 v, DungeonData dd, RoomHandler room) { //IL_0001: 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_001b: Invalid comparison between Unknown and I4 CellData val = dd[v]; if (val == null || val.parentRoom != room || (int)val.type != 2) { return false; } return true; } private static bool IsValidMineTile(IntVector2 v, DungeonData dd, RoomHandler room) { //IL_0001: 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_001b: Invalid comparison between Unknown and I4 CellData val = dd[v]; if (val == null || val.parentRoom != room || (int)val.type != 2 || !val.IsPassable || val.isOccludedByTopWall) { return false; } return true; } private IEnumerator PopulateGrid() { DungeonData dd = GameManager.Instance.Dungeon.data; if (dd == null) { yield break; } _Processed.Clear(); _Frontier.Clear(); _Mines.Clear(); _Frontier.Enqueue(_gameCenter); _Processed.Add(_gameCenter); int num = 0; int num2 = 4 / _tileSize; IntVector2 val2 = default(IntVector2); while (_Frontier.Count > 0) { num++; for (int num3 = _Frontier.Count - 1; num3 >= 0; num3--) { IntVector2 val = _Frontier.Dequeue(); for (int i = -_tileSize; i <= _tileSize; i += _tileSize) { for (int j = -_tileSize; j <= _tileSize; j += _tileSize) { ((IntVector2)(ref val2))..ctor(val.x + i, val.y + j); if (_Processed.Contains(val2)) { continue; } _Processed.Add(val2); bool flag = true; for (int k = 0; k < _tileSize; k++) { for (int l = 0; l < _tileSize; l++) { if (!IsValidStartingTile(new IntVector2(val2.x + k, val2.y + l), dd, _gameRoom)) { flag = false; break; } } } if (flag) { _Frontier.Enqueue(val2); if (num > num2 && Random.value < 0.16f && IsValidMineTile(val2, dd, _gameRoom)) { _Mines.Add(val2); } } } } } } _Processed.Clear(); _Frontier.Clear(); _Frontier.Enqueue(_gameCenter); _Processed.Add(_gameCenter); int iter = 5; IntVector2 val4 = default(IntVector2); while (_Frontier.Count > 0) { for (int num4 = _Frontier.Count - 1; num4 >= 0; num4--) { IntVector2 val3 = _Frontier.Dequeue(); int num5 = 0; for (int m = -_tileSize; m <= _tileSize; m += _tileSize) { for (int n = -_tileSize; n <= _tileSize; n += _tileSize) { ((IntVector2)(ref val4))..ctor(val3.x + m, val3.y + n); if (_Mines.Contains(val4)) { num5++; } if (_Processed.Contains(val4)) { continue; } _Processed.Add(val4); bool flag2 = true; for (int num6 = 0; num6 < _tileSize; num6++) { for (int num7 = 0; num7 < _tileSize; num7++) { if (!IsValidStartingTile(new IntVector2(val4.x + num6, val4.y + num7), dd, _gameRoom)) { flag2 = false; break; } } } if (flag2) { _Frontier.Enqueue(val4); } } } MinesweeperTile minesweeperTile = MinesweeperTile.Setup(val3, _Mines.Contains(val3) ? (-1) : num5, _tileSize); if (_tiles.Count == 0) { _revealQueue.Enqueue(minesweeperTile); } _tiles.Add(minesweeperTile); _tileMap[val3] = minesweeperTile; } ((Component)_player).gameObject.PlayOnce("minesweeper_place_sound"); yield return (object)new WaitForSeconds(0.05f); int num8 = iter - 1; iter = num8; if (num8 == 0) { _populated = true; } } _populated = true; } private void RevealTile(MinesweeperTile tile) { //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_0037: 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_0052: Unknown result type (might be due to invalid IL or missing references) if (tile.IsRevealed) { return; } tile.Reveal(); if (!tile.IsSafe) { return; } IntVector2 pos = tile.Pos; IntVector2 key = default(IntVector2); for (int i = -_tileSize; i <= _tileSize; i += _tileSize) { for (int j = -_tileSize; j <= _tileSize; j += _tileSize) { ((IntVector2)(ref key))..ctor(pos.x + i, pos.y + j); if (_tileMap.TryGetValue(key, out var value) && !value.IsRevealed) { _revealQueue.Enqueue(value); } } } } public MinesweeperTile TileAtPosition(Vector2 pos) { //IL_0018: 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) if (_tileMap == null || _dismissing) { return null; } if (_tileMap.TryGetValue(pos.QuantizeTileRound(_tileSize), out var value)) { return value; } return null; } private void LateUpdate() { if (!_setup || _tiles == null || !GameManager.Instance.IsPaused) { return; } foreach (MinesweeperTile tile in _tiles) { if (Object.op_Implicit((Object)(object)tile) && Object.op_Implicit((Object)(object)tile._numberLabel)) { ((dfControl)tile._numberLabel).IsVisible = false; } } } private void OnFinishedFrame() { //IL_0104: 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) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_026c: 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_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: 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_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) if (!_setup) { return; } if (!Object.op_Implicit((Object)(object)_player) || _player.CurrentRoom != _gameRoom) { Teardown(); return; } float deltaTime = BraveTime.DeltaTime; if (_dismissing) { _dismissTime -= deltaTime; if (_dismissTime <= 0f) { Teardown(); return; } } float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; float num = Pixelator.Instance.ScaleTileScale / Pixelator.Instance.CurrentTileScale; float num2 = (_dismissing ? _dismissTime : 1f); if (_tiles.Count > 0 && Object.op_Implicit((Object)(object)_tiles[0])) { _ = ((dfControl)_tiles[0]._numberLabel).PixelsToUnits() / num; } _ = 0.1f / (float)_tileSize; CameraController mainCameraController = GameManager.Instance.MainCameraController; Camera camera = mainCameraController.Camera; Camera renderCamera = GameUIRoot.Instance.m_manager.RenderCamera; Matrix4x4 val = camera.projectionMatrix * camera.worldToCameraMatrix; Matrix4x4 val2 = renderCamera.projectionMatrix * renderCamera.worldToCameraMatrix; Matrix4x4 val3 = ((Matrix4x4)(ref val2)).inverse * val; if (GameManager.Instance.IsPaused) { foreach (MinesweeperTile tile in _tiles) { ((dfControl)tile._numberLabel).IsVisible = false; } } else { foreach (MinesweeperTile tile2 in _tiles) { if (_dismissing || tile2._lifetime < 0.18f) { tile2._lifetime += deltaTime; float num3 = Mathf.Min(tile2._lifetime / 0.18f, 1f); float num4 = Ease.InQuad((num3 < 0.33f) ? (4f * num3) : (1.33f - 0.5f * (num3 - 0.33f))) - 1f; if (tile2._lifetime >= 0.18f) { num4 = 0f; } Color val4 = (tile2._revealed ? tile2._color : (tile2._flagged ? _FlaggedColor : _UnknownColor)); tile2._square.Place(Vector3Extensions.WithAlpha(val4, num2 * (0.75f - 0.5f * num3)), tile2._tl - num4 * Vector2.one, tile2._br + num4 * Vector2.one); } if (tile2._number > 0) { if (tile2._revealed && num2 > 0f && mainCameraController.PointIsVisible(tile2._labelPos)) { ((dfControl)tile2._numberLabel).IsVisible = true; ((dfControl)tile2._numberLabel).Opacity = num2 * 0.85f; Vector4 val5 = val3 * new Vector4(tile2._labelPos.x, tile2._labelPos.y, 0f, 1f); tile2._numberLabelT.position = new Vector3(val5.x, val5.y, 0f); } else { ((dfControl)tile2._numberLabel).IsVisible = false; } } } } if (_dismissing || !_populated || _player.IsGhost || !Object.op_Implicit((Object)(object)((GameActor)_player).CurrentGun) || GameManager.Instance.IsPaused) { return; } foreach (AIActor allNearbyEnemy in ((GameActor)_player).CenterPosition.GetAllNearbyEnemies(100f, ignoreWalls: true, includeDead: false, includeGone: false, includeInvulnerable: true)) { SpeculativeRigidbody specRigidbody = ((BraveBehaviour)allNearbyEnemy).specRigidbody; if (specRigidbody != null) { MinesweeperTile value = null; if (_tileMap.TryGetValue(specRigidbody.UnitBottomCenter.QuantizeTileRound(_tileSize), out value)) { RevealTile(value); } if (_tileMap.TryGetValue(specRigidbody.UnitBottomLeft.QuantizeTileRound(_tileSize), out value)) { RevealTile(value); } if (_tileMap.TryGetValue(specRigidbody.UnitBottomRight.QuantizeTileRound(_tileSize), out value)) { RevealTile(value); } } } HandlePlayerReveals(_player); PlayerController otherPlayer = GameManager.Instance.GetOtherPlayer(_player); if (otherPlayer != null) { HandlePlayerReveals(otherPlayer); } int count = _revealQueue.Count; if (count > 0 && _nextRevealTime <= scaledTimeSinceStartup) { for (int i = 0; i < count; i++) { RevealTile(_revealQueue.Dequeue()); } _nextRevealTime = scaledTimeSinceStartup + 0.1f; } } private void HandlePlayerReveals(PlayerController player) { //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_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_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_0028: Unknown result type (might be due to invalid IL or missing references) IntVector2 key = Vector2Extensions.ToIntVector2(dfVectorExtensions.FloorToInt(Vector3Extensions.XY(player.SpriteBottomCenter)), (VectorConversions)2).QuantizeRound(_tileSize); if (_tileMap.TryGetValue(key, out var value) && !value.IsFlagged) { _revealQueue.Enqueue(value); } } private void RegisterEvents() { CameraController mainCameraController = GameManager.Instance.MainCameraController; if (mainCameraController != null) { mainCameraController.OnFinishedFrame = (Action)Delegate.Remove(mainCameraController.OnFinishedFrame, new Action(OnFinishedFrame)); mainCameraController.OnFinishedFrame = (Action)Delegate.Combine(mainCameraController.OnFinishedFrame, new Action(OnFinishedFrame)); } } private void DeregisterEvents() { CameraController mainCameraController = GameManager.Instance.MainCameraController; if (mainCameraController != null) { mainCameraController.OnFinishedFrame = (Action)Delegate.Remove(mainCameraController.OnFinishedFrame, new Action(OnFinishedFrame)); } } private void OnDestroy() { Teardown(calledFromDestroy: true); } } public class ChainDriver : CwaffGun { public static string ItemName = "Chain Driver"; public static string ShortDescription = "The Strongest Links"; public static string LongDescription = "Fires chains that shackle enemies. Shackled enemies are dragged towards the current aim point, and can be slammed into solid objects. Enemy weight and damage stat influence drag speed. Reloading releases shackled enemies. Increases curse by 1 while in inventory."; public static string Lore = "They say a chain is only as strong as its weakest link. By breaking and reassembling chains millions of times until only the strongest links survived, gunsmiths were able to produce a chain so powerful it developed arcane self-regenerating properties. In typical fashion, they ignored all the potential good an infinite supply of iron could offer, and instead chose to stuff it inside a firearm."; internal static GameObject[] _ChainDebris = (GameObject[])(object)new GameObject[2]; internal static GameObject _ChainImpact = null; internal static tk2dSpriteAnimationClip _ChainLink = null; private List _attachedLinks = new List(); public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 30; int? reloadFps = 4; Items? muzzleFrom = Items.Mailbox; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)50, 0f, 200, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "chain_launch_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, 1f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: false, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0, autoPlay: true, attacksThroughWalls: false, suppressReloadLabel: true); int? clipSize = 1; float? cooldown = 1f; float? damage = 5.5f; float? speed = 75f; 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: true, 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, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: true, null, null, null, null, null, null, null, null, null, "chain_impact_sound_b", null, null, null, 0f, ignoredForReloadPurposes: false, mirror: false, null, null, null, pierceBreakables)).Attach(); _ChainLink = VFX.Create("chain_link", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1).DefaultAnimation(); _ChainImpact = VFX.Create("chain_impact_vfx", 20f, loops: false, -1, 1f, (Anchor)3, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); for (int i = 0; i < 2; i++) { _ChainDebris[i] = ((Component)BreakableAPIToolbox.GenerateDebrisObject($"chain_debris_{i + 1}", true, 1f, 1f, 0f, 180f, (tk2dSprite)null, 1f, (string)null, (GameObject)null, 1, false, (GoopDefinition)null, 1f)).gameObject; } } public override void PostProcessProjectile(Projectile projectile) { ((GunBehaviour)this).PostProcessProjectile(projectile); ((Component)projectile).gameObject.GetComponent()?.Setup(this); } public override void OnReloadPressed(PlayerController player, Gun gun, bool manualReload) { base.OnReloadPressed(player, gun, manualReload); if (!manualReload) { return; } for (int num = _attachedLinks.Count - 1; num >= 0; num--) { if (Object.op_Implicit((Object)(object)_attachedLinks[num])) { _attachedLinks[num].Disconnect(manual: true); } } _attachedLinks.Clear(); } public override void OnTriedToInitiateAttack(PlayerController player) { base.OnTriedToInitiateAttack(player); if (AnyAttachedChains()) { player.SuppressThisClick = true; } } public static void DoChainDebrisAt(Vector2 pos, int num) { //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_0031: 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) for (int i = 0; i < num; i++) { Object.Instantiate(_ChainDebris[Random.Range(0, 2)], Vector2.op_Implicit(pos), Lazy.RandomEulerZ()).GetComponent().Trigger(Vector2Extensions.ToVector3ZUp(Lazy.RandomVector(2f * Random.value), 2f), 0.25f, 1f); } } private bool AnyAttachedChains() { for (int num = _attachedLinks.Count - 1; num >= 0; num--) { if (Object.op_Implicit((Object)(object)_attachedLinks[num]) && _attachedLinks[num].AttachedToGun) { return true; } _attachedLinks.RemoveAt(num); } return false; } internal void RegisterChain(ChainkLink chain) { _attachedLinks.Add(chain); } internal void DeregisterChain(ChainkLink chain) { _attachedLinks.Remove(chain); } } public class ChainLinkDoer : MonoBehaviour { private Projectile _proj; private bool _setup; public void Setup(ChainDriver gun) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) _proj = ((Component)this).gameObject.GetComponent(); if (Object.op_Implicit((Object)(object)_proj)) { _proj.OnDestruction += OnProjectileDestruction; new GameObject("chainlink").AddComponent().Setup(Object.op_Implicit((Object)(object)gun) ? ((GunBehaviour)gun).PlayerOwner : null, _proj, gun); } _setup = true; } private void Start() { if (!_setup) { Setup(null); } } private void OnProjectileDestruction(Projectile projectile) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)projectile) && !((Object)(object)projectile != (Object)(object)_proj)) { _proj.OnDestruction -= OnProjectileDestruction; ChainDriver.DoChainDebrisAt(_proj.SafeCenter, 3); } } } public class ChainkLink : MonoBehaviour { private const int SEGMENTS = 40; private PlayerController _owner; private ChainDriver _gun; private Projectile _projectile; private AIActor _enemy; private SpeculativeRigidbody _enemyBody; private CwaffRopeMesh _mesh; private bool _connectedToGun; private bool _connectedToProjectile; private bool _connectedToEnemy; private bool _setup; private bool _active; private int _knockbackId = -1; private float _nextSlamTime; private float _forceMultiplier; private bool _mastered; private static List _ExtantChainsOnFloor = new List(); public bool AttachedToGun { get { if (_active && _connectedToGun) { return (Object)(object)_gun != (Object)null; } return false; } } private void Start() { _ExtantChainsOnFloor.Add(this); } public void Setup(PlayerController owner, Projectile proj, ChainDriver gun) { //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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0166: 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_016e: Unknown result type (might be due to invalid IL or missing references) CwaffEvents.OnFloorEnded = (Action)Delegate.Remove(CwaffEvents.OnFloorEnded, new Action(CleanUpExtantChains)); CwaffEvents.OnFloorEnded = (Action)Delegate.Combine(CwaffEvents.OnFloorEnded, new Action(CleanUpExtantChains)); if (!Object.op_Implicit((Object)(object)proj)) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } _connectedToProjectile = true; _projectile = proj; proj.OnHitEnemy = (Action)Delegate.Combine(proj.OnHitEnemy, new Action(OnHitEnemy)); _owner = owner; _forceMultiplier = (Object.op_Implicit((Object)(object)owner) ? owner.DamageMult() : 1f); if (Object.op_Implicit((Object)(object)_owner) && owner.HasSynergy(Synergy.CHAIN_SMOKER)) { _forceMultiplier += 0.1f * Mathf.Max(owner.Coolness(), 0f); } _gun = gun; if (Object.op_Implicit((Object)(object)_gun)) { _gun.RegisterChain(this); _mastered = _gun.Mastered; } _connectedToGun = (Object)(object)gun != (Object)null; Vector2 val = (Object.op_Implicit((Object)(object)gun) ? Vector2.op_Implicit(((Component)((GunBehaviour)gun).gun.barrelOffset).transform.position) : proj.SafeCenter); _mesh = CwaffRopeMesh.Create(ChainDriver._ChainLink, val, val, 40, null, RopeSim.StretchPolicy.GROWTEMPORARY); ((tk2dBaseSprite)_mesh.sprite).HeightOffGround = -10f; _active = true; _setup = true; } private static void CleanUpExtantChains() { for (int num = _ExtantChainsOnFloor.Count - 1; num >= 0; num--) { if (Object.op_Implicit((Object)(object)_ExtantChainsOnFloor[num])) { Object.Destroy((Object)(object)((Component)_ExtantChainsOnFloor[num]).gameObject); } } _ExtantChainsOnFloor.Clear(); } private void OnHitEnemy(Projectile projectile, SpeculativeRigidbody rigidbody, bool arg3) { projectile.OnHitEnemy = (Action)Delegate.Remove(projectile.OnHitEnemy, new Action(OnHitEnemy)); if (Object.op_Implicit((Object)(object)this) && !_connectedToEnemy && Object.op_Implicit((Object)(object)rigidbody) && Object.op_Implicit((Object)(object)_gun) && _connectedToGun && Object.op_Implicit((Object)(object)((BraveBehaviour)rigidbody).aiActor) && TryChainLinkEnemy(((BraveBehaviour)rigidbody).aiActor)) { projectile.DieInAir(false, true, true, false); } } private bool TryChainLinkEnemy(AIActor enemy) { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Expected O, but got Unknown //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)enemy)) { HealthHaver healthHaver = ((BraveBehaviour)enemy).healthHaver; if (healthHaver != null && !healthHaver.IsBoss && !healthHaver.IsSubboss) { if (Object.op_Implicit((Object)(object)((Component)enemy).gameObject.GetComponent())) { return false; } KnockbackDoer knockbackDoer = ((BraveBehaviour)enemy).knockbackDoer; if (knockbackDoer == null || knockbackDoer.m_isImmobile.Value) { return false; } BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)enemy).behaviorSpeculator; if (behaviorSpeculator == null || behaviorSpeculator.ImmuneToStun) { return false; } SpeculativeRigidbody specRigidbody = ((BraveBehaviour)enemy).specRigidbody; if (specRigidbody == null) { return false; } _connectedToProjectile = false; _projectile = null; _connectedToEnemy = true; _enemy = enemy; _enemy.HitByEnemyBullets = true; _enemyBody = specRigidbody; SpeculativeRigidbody enemyBody = _enemyBody; enemyBody.OnTileCollision = (OnTileCollisionDelegate)Delegate.Combine((Delegate?)(object)enemyBody.OnTileCollision, (Delegate?)new OnTileCollisionDelegate(OnSlammedIntoSolidObject)); SpeculativeRigidbody enemyBody2 = _enemyBody; enemyBody2.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)enemyBody2.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPossiblySlammedIntoOtherEnemy)); SpeculativeRigidbody enemyBody3 = _enemyBody; enemyBody3.OnRigidbodyCollision = (OnRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)enemyBody3.OnRigidbodyCollision, (Delegate?)new OnRigidbodyCollisionDelegate(OnSlammedIntoAnything)); _enemyBody.AddCollisionLayerOverride(CollisionMask.LayerToMask((CollisionLayer)2)); ((Component)_enemy).gameObject.AddComponent(); if (Object.op_Implicit((Object)(object)_owner)) { _enemyBody.RegisterSpecificCollisionException(((BraveBehaviour)_owner).specRigidbody); } behaviorSpeculator.Stun(3600f, true); _mesh.endPos = ((GameActor)enemy).CenterPosition; ((Component)this).gameObject.Play("chain_shackle_sound"); return true; } } return false; } private void OnPossiblySlammedIntoOtherEnemy(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { //IL_006d: 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_009b: 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_00c8: 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_00ce: 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) if (!Object.op_Implicit((Object)(object)otherRigidbody)) { return; } AIActor aiActor = ((BraveBehaviour)otherRigidbody).aiActor; if (aiActor == null) { return; } PhysicsEngine.SkipCollision = true; myRigidbody.RegisterTemporaryCollisionException(otherRigidbody, 0.25f, (float?)null); otherRigidbody.RegisterTemporaryCollisionException(myRigidbody, 0.25f, (float?)null); if (!aiActor.IsNormalEnemy) { return; } HealthHaver healthHaver = ((BraveBehaviour)aiActor).healthHaver; if (healthHaver == null) { return; } float num = 0.25f * ((Vector2)(ref myRigidbody.Velocity)).magnitude; healthHaver.ApplyDamage(num, myRigidbody.Velocity, "Chain Slam", (CoreDamageTypes)0, (DamageCategory)0, false, (PixelCollider)null, false); Vector2 val = Vector2Extensions.ToAngle(myRigidbody.Velocity).AddRandomSpread(15f).ToVector(); if (healthHaver.IsAlive) { KnockbackDoer knockbackDoer = ((BraveBehaviour)aiActor).knockbackDoer; if (knockbackDoer != null) { knockbackDoer.ApplyKnockback(val, 10f * num, false); } } OnSlammedCommon(otherRigidbody.UnitCenter, -val, tile: false); } private void OnSlammedIntoAnything(CollisionData collisionData) { SpeculativeRigidbody otherRigidbody = collisionData.OtherRigidbody; if (otherRigidbody != null && ((BraveBehaviour)otherRigidbody).aiActor == null) { MinorBreakable component = ((Component)otherRigidbody).gameObject.GetComponent(); if (component != null && !component.IsBroken) { component.Break(); } OnSlammedIntoSolidObject(collisionData); } } private void OnSlammedIntoSolidObject(CollisionData collisionData) { //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) float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; if (!Object.op_Implicit((Object)(object)_enemyBody) || scaledTimeSinceStartup < _nextSlamTime || !Object.op_Implicit((Object)(object)_enemy)) { _nextSlamTime = scaledTimeSinceStartup + 0.05f; return; } _nextSlamTime = scaledTimeSinceStartup + 0.05f; OnSlammedCommon(((CastResult)collisionData).Contact, ((CastResult)collisionData).Normal, tile: true); } private void OnSlammedCommon(Vector2 contact, Vector2 normal, bool tile) { //IL_0057: 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_00c0: 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_00c6: 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_00dd: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown float num = 30f; KnockbackDoer knockbackDoer = ((BraveBehaviour)_enemy).knockbackDoer; if (knockbackDoer != null) { num = knockbackDoer.weight; } float magnitude = ((Vector2)(ref _enemyBody.Velocity)).magnitude; float num2 = 0.001f * (num * magnitude); float num3 = 0.01f * magnitude * magnitude; HealthHaver healthHaver = ((BraveBehaviour)_enemy).healthHaver; if (healthHaver != null) { healthHaver.ApplyDamage(num3, -normal, "slammed", (CoreDamageTypes)0, (DamageCategory)2, false, (PixelCollider)null, false); } ((Component)this).gameObject.Play((num2 > 1f) ? "wall_slam_heavy" : (((double)num2 > 0.5) ? "wall_slam_medium" : "wall_slam_light")); ((Component)this).gameObject.Play("chain_snap_sound"); GameObject chainImpact = ChainDriver._ChainImpact; Vector3 position = Vector2.op_Implicit(contact); Quaternion? rotation = Vector2Extensions.ToAngle(normal).EulerZ(); Vector2? velocity = 2f * ((Vector2)(ref normal)).normalized; Color? emissiveColor = Color.white; float? startScale = Mathf.Clamp01(num2); float? endScale = Mathf.Clamp01(num2); CwaffVFX.Spawn(chainImpact, position, rotation, velocity, 0f, null, 5f, emissiveColor, fadeIn: false, startScale, endScale); GameManager.Instance.MainCameraController.DoScreenShake(new ScreenShakeSettings(num2, num2, 0.3f * Mathf.Min(num2, 1f), 0f), (Vector2?)contact, false); } private void LateUpdate() { //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_0050: 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_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_0072: 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_0084: 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_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: 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_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_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: 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_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_027a: 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_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) Vector2 val2; if (!_active) { PlayerController val = _owner; if (!Object.op_Implicit((Object)(object)val)) { val = GameManager.Instance.BestActivePlayer; } bool flag = (Object)(object)val == (Object)null || (Object)(object)_mesh == (Object)null; if (!flag) { Vector2 centerPosition = ((GameActor)val).CenterPosition; val2 = centerPosition - _mesh.startPos; if (((Vector2)(ref val2)).sqrMagnitude >= 900f) { val2 = centerPosition - _mesh.endPos; if (((Vector2)(ref val2)).sqrMagnitude >= 900f) { flag = true; } } } if (flag) { Object.Destroy((Object)(object)((Component)this).gameObject); } return; } if (!_setup || BraveTime.DeltaTime == 0f || GameManager.Instance.IsPaused) { return; } if (_connectedToGun) { if (!Object.op_Implicit((Object)(object)_owner) || !Object.op_Implicit((Object)(object)_gun) || !Object.op_Implicit((Object)(object)((GunBehaviour)_gun).gun)) { Disconnect(); return; } if ((Object)(object)((GameActor)_owner).CurrentGun != (Object)(object)((GunBehaviour)_gun).gun) { if (_connectedToEnemy) { Disconnect(); } else { _connectedToGun = false; } } } if (_connectedToProjectile && !Object.op_Implicit((Object)(object)_projectile)) { Disconnect(); return; } if (_connectedToEnemy) { if (Object.op_Implicit((Object)(object)_enemy) && Object.op_Implicit((Object)(object)_enemyBody)) { HealthHaver healthHaver = ((BraveBehaviour)_enemy).healthHaver; if (healthHaver == null || !healthHaver.IsDead) { goto IL_0197; } } Disconnect(); return; } goto IL_0197; IL_0197: if (_connectedToGun && Object.op_Implicit((Object)(object)_gun)) { _mesh.startPos = Vector2.op_Implicit(((Component)((GunBehaviour)_gun).gun.barrelOffset).transform.position); } if (Object.op_Implicit((Object)(object)_projectile)) { _mesh.endPos = _projectile.SafeCenter; return; } if (Object.op_Implicit((Object)(object)_gun) && Object.op_Implicit((Object)(object)_enemy) && Object.op_Implicit((Object)(object)_enemyBody)) { KnockbackDoer knockbackDoer = ((BraveBehaviour)_enemy).knockbackDoer; if (knockbackDoer != null) { BraveInput instanceForPlayer = BraveInput.GetInstanceForPlayer(_owner.PlayerIDX); Vector2 val3 = (((Object)(object)instanceForPlayer == (Object)null || _owner.IsKeyboardAndMouse()) ? Vector3Extensions.XY(_owner.unadjustedAimPoint) : (((GameActor)_owner).CenterPosition + 20f * ((TwoAxisInputControl)instanceForPlayer.ActiveActions.Aim).Vector)); Vector2 unitCenter = _enemyBody.UnitCenter; Vector2 val4 = val3 - unitCenter; knockbackDoer.m_activeContinuousKnockbacks.Clear(); val2 = val3 - _mesh.endPos; if (((Vector2)(ref val2)).magnitude >= 0.25f) { float num = _forceMultiplier * 12f * ((Vector2)(ref val4)).magnitude; if (_mastered) { num *= Mathf.Max(knockbackDoer.weight / 15f, 1f); } _knockbackId = knockbackDoer.ApplyContinuousKnockback(val4, num); } else { _knockbackId = knockbackDoer.ApplyContinuousKnockback(val4, 0f); } _mesh.endPos = unitCenter; return; } } Disconnect(); } internal void Disconnect(bool manual = false) { //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_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_0058: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) DeregisterEvents(); if (Object.op_Implicit((Object)(object)_enemy)) { BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)_enemy).behaviorSpeculator; if (behaviorSpeculator != null) { behaviorSpeculator.EndStun(); } KnockbackDoer knockbackDoer = ((BraveBehaviour)_enemy).knockbackDoer; if (knockbackDoer != null) { Vector2 val = Vector2.zero; foreach (Vector2 activeContinuousKnockback in knockbackDoer.m_activeContinuousKnockbacks) { val += activeContinuousKnockback; } knockbackDoer.ClearContinuousKnockbacks(); knockbackDoer.ApplySourcedKnockback(val, ((Vector2)(ref val)).magnitude, ((Component)this).gameObject, false); } KnockbackUnleasher component = ((Component)_enemy).gameObject.GetComponent(); if (component != null) { Object.Destroy((Object)(object)component); } if (Object.op_Implicit((Object)(object)_enemyBody) && Object.op_Implicit((Object)(object)_owner)) { _enemyBody.DeregisterSpecificCollisionException(((BraveBehaviour)_owner).specRigidbody); } } if (Object.op_Implicit((Object)(object)_gun)) { _gun.DeregisterChain(this); } _connectedToEnemy = false; _enemy = null; _gun = null; _connectedToGun = false; _projectile = null; _connectedToProjectile = false; ((Component)this).gameObject.Play("chain_snap_sound"); if (Object.op_Implicit((Object)(object)_mesh)) { _mesh.LockWhenStationary(); } _active = false; } private void DeregisterEvents() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)_enemyBody)) { SpeculativeRigidbody enemyBody = _enemyBody; enemyBody.OnTileCollision = (OnTileCollisionDelegate)Delegate.Remove((Delegate?)(object)enemyBody.OnTileCollision, (Delegate?)new OnTileCollisionDelegate(OnSlammedIntoSolidObject)); SpeculativeRigidbody enemyBody2 = _enemyBody; enemyBody2.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Remove((Delegate?)(object)enemyBody2.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPossiblySlammedIntoOtherEnemy)); SpeculativeRigidbody enemyBody3 = _enemyBody; enemyBody3.OnRigidbodyCollision = (OnRigidbodyCollisionDelegate)Delegate.Remove((Delegate?)(object)enemyBody3.OnRigidbodyCollision, (Delegate?)new OnRigidbodyCollisionDelegate(OnSlammedIntoAnything)); } if (Object.op_Implicit((Object)(object)_projectile)) { Projectile projectile = _projectile; projectile.OnHitEnemy = (Action)Delegate.Remove(projectile.OnHitEnemy, new Action(OnHitEnemy)); } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)_gun)) { _gun.DeregisterChain(this); } DeregisterEvents(); if (Object.op_Implicit((Object)(object)_mesh)) { Object.Destroy((Object)(object)((Component)_mesh).gameObject); } } } public class BBGun : CwaffGun { public class PinProjectile : MonoBehaviour { private const float _ROTSPEED = 2160f; private float _rotspeed; private Projectile _proj; private tk2dBaseSprite _sprite; private Transform _transform; private float _rot; private void Start() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown _proj = ((Component)this).gameObject.GetComponent(); _sprite = ((Component)this).gameObject.GetComponent(); _transform = ((Component)this).gameObject.transform; _rot = Lazy.RandomAngle(); _rotspeed = 2160f; _proj.BulletScriptSettings.surviveRigidbodyCollisions = true; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_proj).specRigidbody; specRigidbody.OnRigidbodyCollision = (OnRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnRigidbodyCollision, (Delegate?)new OnRigidbodyCollisionDelegate(OnRigidbodyCollision)); _proj.DestroyMode = (ProjectileDestroyMode)1; _proj.OnDestruction += OnProjectileDestroyed; } private void BecomeDebris(Vector2 force, float angularVelocity) { //IL_005d: 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) DebrisObject orAddComponent = GameObjectExtensions.GetOrAddComponent(((Component)this).gameObject); orAddComponent.angularVelocity = angularVelocity; orAddComponent.angularVelocityVariance = angularVelocity / 3f; orAddComponent.decayOnBounce = 0.5f; orAddComponent.bounceCount = 2; orAddComponent.canRotate = true; orAddComponent.shouldUseSRBMotion = true; ((BraveBehaviour)orAddComponent).sprite = _sprite; orAddComponent.animatePitFall = true; orAddComponent.AssignFinalWorldDepth(-0.5f); orAddComponent.Trigger(Vector2.op_Implicit(force), 0.5f, 1f); _proj.DieInAir(false, true, true, false); _proj = null; Object.Destroy((Object)(object)this); } private void OnProjectileDestroyed(Projectile projectile) { //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) _proj.OnDestruction -= OnProjectileDestroyed; BecomeDebris(0.5f * ((BraveBehaviour)_proj).specRigidbody.Velocity, 8f * _proj.baseData.speed); } private void OnRigidbodyCollision(CollisionData rigidbodyCollision) { //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)_proj)) { if (Object.op_Implicit((Object)(object)((BraveBehaviour)_proj).specRigidbody)) { SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_proj).specRigidbody; specRigidbody.OnRigidbodyCollision = (OnRigidbodyCollisionDelegate)Delegate.Remove((Delegate?)(object)specRigidbody.OnRigidbodyCollision, (Delegate?)new OnRigidbodyCollisionDelegate(OnRigidbodyCollision)); } _proj.OnDestruction -= OnProjectileDestroyed; BecomeDebris(0.5f * _proj.baseData.speed * ((CastResult)rigidbodyCollision).Normal, 8f * _proj.baseData.speed); } } private void Update() { //IL_008a: 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) if (Object.op_Implicit((Object)(object)_proj) && _proj.baseData.speed < 2f) { BecomeDebris(Vector2.zero, 0f); } else if (!(_rotspeed <= 0f)) { _rotspeed = Mathf.Max(0f, _rotspeed - 1000f * BraveTime.DeltaTime); _rot += BraveTime.DeltaTime * _rotspeed; _transform.rotation = _rot.EulerZ(); } } } public static string ItemName = "B. B. Gun"; public static string ShortDescription = "Spare No One"; public static string LongDescription = "Fires a heavy ricocheting projectile that can be caught while in motion, restoring ammo but knocking the player back. Projectile damage and knockback scale with projectile speed. Ammo is regained upon room clear, or upon catching or interacting with a projectile."; public static string Lore = "This gun was originally used in the mid-18th century for hunting turkeys, as they were the only birds slow enough to actually hit with any degree of reliability. While hunters quickly decided that using a large, slow, rolling projectile wasn't ideal for hunting, the gun's legacy lives on today in shooting arenas known as \"alleys\", where sporting enthusiasts roll similar projectiles against red and white wooden objects in hopes of scoring a \"turkey\" themselves."; private const float _BOUNCE_SPEED_DECAY = 0.8f; private static readonly float[] _CHARGE_LEVELS = new float[4] { 0.25f, 0.5f, 1f, 2f }; internal static Projectile _PinProjectile = null; private readonly List _extantBbs = new List(); public static void Init() { //IL_0145: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 10; int? chargeFps = 16; Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)60, 0.5f, 1, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: false, canReloadNoMatterAmmo: false, null, null, shootFps, null, chargeFps, null, "Play_WPN_seriouscannon_shot_01", "Play_ENM_flame_veil_01", null, 32, -1, -1, null, modulesAreTiers: false, "muzzle_b_b_gun", 30, 0.5f, (Anchor)4, -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).AssignGun(out gunRef); int? clipSize = -1; float? cooldown = 0.7f; float? angleVariance = 10f; float? speed = 20f; float? range = 999999f; Color? glowColor = Color.magenta; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)3, (ProjectileSequenceStyle)1, 0f, 1, null, customClip: true, null, speed, null, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "bball", 20, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, null, "bb_impact_sound", null, null, null, 0f, ignoredForReloadPurposes: false, mirror: false, null, null, null, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: false, 0f, null, 1000f, glowColor)).Attach((Action)delegate(PierceProjModifier pierce) { pierce.penetration = Mathf.Max(pierce.penetration, 999); pierce.penetratesBreakables = true; }, allowDuplicates: false).Attach((Action)delegate(BounceProjModifier bounce) { bounce.numberOfBounces = Mathf.Max(bounce.numberOfBounces, 999); bounce.chanceToDieOnBounce = 0f; bounce.percentVelocityToLoseOnBounce = 0.19999999f; bounce.onlyBounceOffTiles = true; }, allowDuplicates: false) .Attach() .CopyAllImpactVFX(Items.Crestfaller) .SetupChargeProjectiles(gunRef.DefaultModule, _CHARGE_LEVELS.Length, delegate(int i, Projectile p) { //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_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Expected O, but got Unknown ChargeProjectile val = new ChargeProjectile(); float? speed2 = 40f + 20f * (float)i; val.Projectile = p.Clone(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, null, speed2, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4)); val.ChargeTime = _CHARGE_LEVELS[i]; return val; }); range = 20f; speed = 40f; float? force = 40f; float? range2 = 80f; bool? shouldRotate = false; _PinProjectile = Items.Ak47.CloneProjectile(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, range, speed, force, range2, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "bowling_pin_projectile", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, shouldRotate)).Attach().Attach((Action)delegate(EasyTrailBullet trail) { //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_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_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_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_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) trail.TrailPos = ((BraveBehaviour)trail).transform.position; trail.StartWidth = 0.2f; trail.EndWidth = 0.025f; trail.LifeTime = 0.1f; trail.BaseColor = Color.grey; trail.StartColor = Color.grey; trail.EndColor = Color.Lerp(Color.grey, Color.white, 0.25f); }, allowDuplicates: false); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); player.OnRoomClearEvent += OnRoomClear; } public override void OnDroppedByPlayer(PlayerController player) { player.OnRoomClearEvent -= OnRoomClear; base.OnDroppedByPlayer(player); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((GunBehaviour)this).PlayerOwner.OnRoomClearEvent -= OnRoomClear; } base.OnDestroy(); } private void OnRoomClear(PlayerController player) { ((GunBehaviour)this).gun.CurrentAmmo = ((GunBehaviour)this).gun.AdjustedMaxAmmo; ((GunBehaviour)this).gun.ForceImmediateReload(false); foreach (TheBB extantBb in _extantBbs) { if (Object.op_Implicit((Object)(object)extantBb)) { extantBb.EraseFromExistence(); } } _extantBbs.Clear(); } public override void PostProcessProjectile(Projectile projectile) { ((GunBehaviour)this).PostProcessProjectile(projectile); TheBB component = ((Component)projectile).gameObject.GetComponent(); if (component != null) { _extantBbs.Add(component); } } } public class TheBB : MonoBehaviour { private const float _BB_DAMAGE_SCALE = 2f; private const float _BB_FORCE_SCALE = 2f; private const float _BB_SPEED_DECAY = 3f; private const float _BASE_EMISSION = 3f; private const float _EXTRA_EMISSION = 30f; private const float _BASE_ANIM_SPEED = 2f; private const float _MIN_REFLECT_RADIUS = 1f; private const float _MAX_REFLECT_RADIUS = 2f; private const float _REFLECT_ANGLE_SNAP = 30f; private const float _DRAG = 0.9f; internal Projectile _projectile; private PlayerController _owner; private float _maxSpeed; private float _damageMult = 2f; private float _knockbackMult = 2f; private bool _mastered; private bool _freebie; private DebrisObject _debris; private tk2dBaseSprite _sprite; private void Start() { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown _projectile = ((Component)this).GetComponent(); _projectile.baseData.damping = 0.05f; ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); if (Object.op_Implicit((Object)(object)_owner)) { _damageMult = 2f * _owner.DamageMult(); _knockbackMult = 2f * _owner.KnockbackMult(); _mastered = _projectile.Mastered(); _projectile.collidesWithPlayer = true; _projectile.UpdateCollisionMask(); SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnMightCollideWithPlayer)); ((BraveBehaviour)_projectile).specRigidbody.m_specificCollisionExceptions.Remove(((BraveBehaviour)_owner).specRigidbody); } _freebie = _projectile.FiredForFree(); if (!_freebie) { _projectile.DestroyMode = (ProjectileDestroyMode)1; _projectile.OnDestruction += BecomeDebrisImmediate; } _maxSpeed = _projectile.baseData.speed; ((Component)this).GetComponent().OnBounce += OnBounce; } private void BecomeDebrisImmediate(Projectile proj) { ((Component)this).gameObject.AllowFallingIntoPits(); _debris = ((Component)this).gameObject.GetComponent(); _sprite = ((Component)this).gameObject.GetComponentInChildren(); tk2dSpriteAnimator spriteAnimator = ((BraveBehaviour)_sprite).spriteAnimator; if (spriteAnimator != null) { spriteAnimator.Pause(); } } public void EraseFromExistence() { //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_0051: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_debris)) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } _projectile.DestroyMode = (ProjectileDestroyMode)0; _projectile.OnDestruction -= BecomeDebrisImmediate; SpawnManager.SpawnVFX(VFX.MiniPickup, Vector2.op_Implicit(_projectile.SafeCenter), Lazy.RandomEulerZ()); _projectile.DieInAir(false, false, false, true); } private void ReturnToGun(Gun gun) { gun.CanGainAmmo = true; gun.GainAmmo(1); gun.CanGainAmmo = false; gun.ForceImmediateReload(false); gun.UnprepGunForThrow(); } private void OnMightCollideWithPlayer(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { //IL_0050: 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_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_0062: 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_00a5: 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_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_0111: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)_owner) || (Object)(object)((BraveBehaviour)_owner).specRigidbody != (Object)(object)otherRigidbody) { if (Object.op_Implicit((Object)(object)((Component)otherRigidbody).gameObject.GetComponent())) { PhysicsEngine.SkipCollision = true; } return; } Gun val = _owner.FindBaseGun(); if (val != null) { ReturnToGun(val); } Vector2 unitCenter = myRigidbody.UnitCenter; float angle = Vector2Extensions.ToAngle(((GameActor)_owner).CenterPosition - unitCenter); float other = Vector2Extensions.ToAngle(((BraveBehaviour)_projectile).specRigidbody.Velocity); if (angle.AbsAngleTo(other) < 85f) { ((Component)otherRigidbody).gameObject.GetComponent().ApplyKnockback(((BraveBehaviour)_projectile).specRigidbody.Velocity, _projectile.baseData.force, false); } float currentSpeed = _projectile.m_currentSpeed; if (currentSpeed > 10f) { if (currentSpeed > 20f) { GameManager.Instance.MainCameraController.DoScreenShake(new ScreenShakeSettings(0.01f * currentSpeed, 6f, 0.1f, 0f), (Vector2?)unitCenter, false); } GameObject earthClod = Groundhog._EarthClod; float velocityVariance = 0.1f * currentSpeed; float? fadeOutTime = 0.25f; float? startScale = 1f; float? endScale = 0.1f; CwaffVFX.SpawnBurst(earthClod, 10, unitCenter, 1f, null, 0f, velocityVariance, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.None, 0.5f, fadeOutTime, 0f, null, fadeIn: false, uniform: true, startScale, endScale, null, randomFrame: true); } ((Component)otherRigidbody).gameObject.Play((currentSpeed > 20f) ? "bb_catch_sound" : "bb_impact_sound"); EraseFromExistence(); PhysicsEngine.SkipCollision = true; } private static AIActor CheckValidEnemyOwner(Projectile proj) { GameActor owner = proj.Owner; AIActor val = (AIActor)(object)((owner is AIActor) ? owner : null); if (val == null) { return null; } if (!Object.op_Implicit((Object)(object)val) || !((Behaviour)val).isActiveAndEnabled || ((GameActor)val).IsGone) { return null; } HealthHaver healthHaver = ((BraveBehaviour)val).healthHaver; if (healthHaver == null || healthHaver.IsDead) { return null; } return val; } private void ReflectNearbyProjectiles() { //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_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_0081: 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) //IL_00b5: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00c3: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_00dd: 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) float speed = _projectile.baseData.speed; float num = Mathf.Min(1f + 0.01f * speed, 2f); float num2 = num * num; Vector2 safeCenter = _projectile.SafeCenter; bool flag = false; ReadOnlyCollection allProjectiles = StaticReferenceManager.AllProjectiles; for (int num3 = allProjectiles.Count - 1; num3 >= 0; num3--) { Projectile val = allProjectiles[num3]; if (Object.op_Implicit((Object)(object)val) && !(val.Owner is PlayerController)) { Vector2 safeCenter2 = val.SafeCenter; Vector2 val2 = safeCenter2 - safeCenter; if (!(((Vector2)(ref val2)).sqrMagnitude > num2)) { AIActor val3 = CheckValidEnemyOwner(val); Vector2 val4 = ((val3 != null) ? (((GameActor)val3).CenterPosition - safeCenter2) : (-val.Direction)); if (Vector2Extensions.ToAngle(val4).AbsAngleTo(Vector2Extensions.ToAngle(val2)) < 30f) { val2 = val4; } val.DieInAir(true, false, false, true); Projectile component = SpawnManager.SpawnProjectile(((Component)BBGun._PinProjectile).gameObject, Vector2.op_Implicit(safeCenter2), val2.EulerZ(), true).GetComponent(); component.SetOwnerAndStats((GameActor)(object)_owner); component.SetSpeed(speed + 10f); flag = true; } } } if (flag) { ((Component)this).gameObject.Play("bowling_pin_sound"); } } public void OnBounce() { ((Component)this).gameObject.Play("bb_impact_sound"); } private void DoDebrisChecks() { //IL_0025: 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_0018: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_00aa: Unknown result type (might be due to invalid IL or missing references) Vector2 val = (Object.op_Implicit((Object)(object)_sprite) ? _sprite.WorldCenter : Vector2.op_Implicit(((Component)this).transform.position)); for (int i = 0; i < GameManager.Instance.AllPlayers.Length; i++) { PlayerController val2 = GameManager.Instance.AllPlayers[i]; if (!Object.op_Implicit((Object)(object)val2) || val2.IsGhost || ((BraveBehaviour)val2).healthHaver.IsDead) { continue; } Vector2 val3 = ((GameActor)val2).CenterPosition - val; if (!(((Vector2)(ref val3)).sqrMagnitude > 9f)) { Gun val4 = val2.FindBaseGun(); if (val4 != null) { ReturnToGun(val4); ((Component)val2).gameObject.PlayUnique("card_pickup_sound"); SpawnManager.SpawnVFX(VFX.MiniPickup, Vector2.op_Implicit(val), Lazy.RandomEulerZ()); Object.Destroy((Object)(object)((Component)this).gameObject); break; } } } } private void Update() { if (Object.op_Implicit((Object)(object)_debris)) { DoDebrisChecks(); return; } float currentSpeed = _projectile.m_currentSpeed; if (currentSpeed <= 1f) { _projectile.DieInAir(true, true, true, false); return; } if (currentSpeed <= 10f) { _projectile.baseData.damping = 0.25f; } Material material = ((BraveBehaviour)((BraveBehaviour)_projectile).sprite).renderer.material; material.SetFloat(CwaffVFX._EmissivePowerId, 3f + 30f * (currentSpeed / _maxSpeed)); material.SetFloat("_Cutoff", 0.1f); _projectile.baseData.damage = _damageMult * currentSpeed; _projectile.baseData.force = _knockbackMult * currentSpeed; ((BraveBehaviour)_projectile).spriteAnimator.ClipFps = Mathf.Min(2f * currentSpeed, 60f); ((MonoBehaviour)(object)_projectile).LoopSoundIf(play: true, "bb_rolling"); if (_mastered) { ReflectNearbyProjectiles(); } } } public class Oddjob : CwaffGun { public static string ItemName = "Oddjob"; public static string ShortDescription = "Hat Tricks"; public static string LongDescription = "Travels in a circular arc towards the enemy closest to the player's line of sight, sawing through anything in its path before returning to the player. Cannot be switched out or dropped while in flight. Increases curse by 1."; public static string Lore = "A hat that once belonged to an aggravatingly short gunman. One would think from his profession that he lost his life either in a gun fight or from accidentally decapitating himself with his hat, but the reality is he was done in by another gungeoneer that left their Battery Bullets lying around near a water barrel."; internal static GameObject _Sparks = null; internal static Hat _OddjobHat = null; internal static Projectile _OddjobFlakProjectile = null; private Projectile _extantOddjobProj; public static void Init() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 60; int? reloadFps = 4; Items? muzzleFrom = Items.Mailbox; IntVector2? carryOffset = new IntVector2(3, 11); Gun gun2 = gun.SetAttributes((ItemQuality)4, (GunClass)50, 0f, 1, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: false, 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, carryOffset, preventRotation: false, 1f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: false, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0, autoPlay: true, attacksThroughWalls: false, suppressReloadLabel: true, 1f, onlyUsesIdleInWeaponBox: true).Attach(); int? clipSize = 1; float? cooldown = 0.1f; float? damage = 25f; float? speed = 40f; float? range = 9999f; float? force = 12f; bool? shouldRotate = false; bool? preventOrbiting = true; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "oddjob_projectile", 30, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, shouldRotate, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, preventOrbiting, null, "paintball_impact_enemy_sound", "paintball_impact_wall_sound")).Attach((Action)delegate(PierceProjModifier pierce) { pierce.penetration = 100; pierce.penetratesBreakables = true; }, allowDuplicates: false).Attach(); _Sparks = VFX.Create("oddjob_sparks", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _OddjobHat = CwaffHats.EasyHat("oddjob_hat", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: true, (bool?)null, (HatDepthType?)null); force = 0f; range = 20f; speed = 6f; preventOrbiting = false; damage = 2160f; _OddjobFlakProjectile = Items.Ak47.CloneProjectile(GunData.New(null, null, null, null, force, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, speed, range, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "oddjob_flak_projectile", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, preventOrbiting, 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, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: false, 0f, null, 10f, null, null, -1, damage)).SetAllImpactVFX(VFX.CreatePool("oddjob_flak_impact", 20f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1)); } public override void PostProcessProjectile(Projectile projectile) { ((GunBehaviour)this).PostProcessProjectile(projectile); if (!projectile.FiredForFree()) { _extantOddjobProj = projectile; RemoveHatFromHead(); } } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); PutHatOnHead(); } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); RemoveHatFromHead(); } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); RemoveHatFromHead(); } private void ReturnHatProjectile() { if (Object.op_Implicit((Object)(object)_extantOddjobProj)) { _extantOddjobProj.DieInAir(false, true, true, false); } ((GunBehaviour)this).gun.CurrentAmmo = 1; ((GunBehaviour)this).gun.MoveBulletsIntoClip(1); } private void PutHatOnHead() { ((GunBehaviour)this).PlayerOwner?.OverrideHat(_OddjobHat, doPoof: false); } private void RemoveHatFromHead() { ((GunBehaviour)this).PlayerOwner?.ClearHatOverride(_OddjobHat, doPoof: false); } public override void OnDestroy() { RemoveHatFromHead(); base.OnDestroy(); } public override void Update() { //IL_0051: 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) base.Update(); bool flag = !Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner); if (flag != ((BraveBehaviour)((BraveBehaviour)((GunBehaviour)this).gun).sprite).renderer.enabled) { ((BraveBehaviour)((BraveBehaviour)((GunBehaviour)this).gun).sprite).renderer.enabled = flag; if (flag) { SpriteOutlineManager.AddOutlineToSprite(((BraveBehaviour)((GunBehaviour)this).gun).sprite, Color.black, 0.2f, 0.05f, (OutlineType)0); } else if (SpriteOutlineManager.HasOutline(((BraveBehaviour)((GunBehaviour)this).gun).sprite)) { SpriteOutlineManager.RemoveOutlineFromSprite(((BraveBehaviour)((GunBehaviour)this).gun).sprite, false); } } if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { bool flag2 = !Object.op_Implicit((Object)(object)_extantOddjobProj); ((PickupObject)((GunBehaviour)this).gun).CanBeDropped = flag2; ((PickupObject)((GunBehaviour)this).gun).CanBeSold = flag2; ((GunBehaviour)this).PlayerOwner.inventory.GunLocked.SetOverride(ItemName, !flag2, (float?)null); if (flag2 && ((GunBehaviour)this).gun.CurrentAmmo == 0) { ReturnHatProjectile(); PutHatOnHead(); SpawnManager.SpawnVFX(Breegull._TalonDust, Vector2.op_Implicit(((BraveBehaviour)((GunBehaviour)this).PlayerOwner).sprite.WorldTopCenter), Quaternion.identity); ((GunBehaviour)this).gun.PlayIdleAnimation(); } } } public override void OnTriedToInitiateAttack(PlayerController player) { base.OnTriedToInitiateAttack(player); if (Object.op_Implicit((Object)(object)_extantOddjobProj)) { player.SuppressThisClick = true; } } } public class OddjobProjectile : MonoBehaviour { private const float _SPARK_RATE = 0.05f; private const float _FLAK_TIMER = 0.15f; private const int _FLAK_COUNT = 5; private const float _FLAK_SPACING = 72f; internal bool _collidedLastFrame; internal bool _returning; private Projectile _proj; private PlayerController _owner; private float _lastSparkTime; private bool _mastered; private float _nextFlakTime; private List _hitThisFrame = new List(); private List _hitLastFrame = new List(); private void Start() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //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_00f6: 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_0105: 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_0110: 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) _proj = ((Component)this).GetComponent(); ((BraveBehaviour)_proj).specRigidbody.CollideWithTileMap = false; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_proj).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreRigidbodyCollision)); OddjobProjectileMotionModule oddjobProjectileMotionModule = new OddjobProjectileMotionModule(); _proj.OverrideMotionModule = (ProjectileMotionModule)(object)oddjobProjectileMotionModule; GameActor owner = _proj.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null) { _owner = val; oddjobProjectileMotionModule.ForceInvert = ((GameActor)val).SpriteFlipped; _mastered = val.HasSynergy(Synergy.MASTERY_ODDJOB); _nextFlakTime = BraveTime.ScaledTimeSinceStartup + 0.15f; } else { oddjobProjectileMotionModule.ForceInvert = Lazy.CoinFlip(); } EasyTrailBullet easyTrailBullet = ((Component)this).gameObject.AddComponent(); easyTrailBullet.StartWidth = 0.5f; easyTrailBullet.EndWidth = 0.05f; easyTrailBullet.LifeTime = 0.1f; easyTrailBullet.BaseColor = new Color(0.5f, 0.5f, 0.5f); easyTrailBullet.StartColor = Color.Lerp(easyTrailBullet.BaseColor, Color.white, 0.5f); easyTrailBullet.EndColor = easyTrailBullet.BaseColor; ((BraveBehaviour)_proj).sprite.HeightOffGround = 4f; ((BraveBehaviour)_proj).sprite.UpdateZDepth(); } private void OnPreRigidbodyCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_proj)) { return; } GameActor gameActor = ((BraveBehaviour)otherRigidbody).gameActor; AIActor val = (AIActor)(object)((gameActor is AIActor) ? gameActor : null); if (val == null) { return; } PhysicsEngine.SkipCollision = true; if (_returning || !Object.op_Implicit((Object)(object)((BraveBehaviour)val).healthHaver) || ((BraveBehaviour)val).healthHaver.IsDead) { return; } _hitThisFrame.Add(((BraveBehaviour)val).healthHaver); if (!((BraveBehaviour)val).healthHaver.IsBoss && !((BraveBehaviour)val).healthHaver.IsSubboss) { val.ClearPath(); if (((BraveBehaviour)val).behaviorSpeculator.IsInterruptable) { ((BraveBehaviour)val).behaviorSpeculator.Interrupt(); } ((BraveBehaviour)val).behaviorSpeculator.Stun(1f, true); } _collidedLastFrame = true; float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; if (scaledTimeSinceStartup - _lastSparkTime >= 0.05f) { _lastSparkTime = scaledTimeSinceStartup; GameObject sparks = Oddjob._Sparks; Vector2 unitBottomCenter = myRigidbody.UnitBottomCenter; float? height = 4f; float? fadeOutTime = 0.05f; CwaffVFX.SpawnBurst(sparks, 10, unitBottomCenter, 0f, null, 10f, 5f, CwaffVFX.Vel.Random, CwaffVFX.Rot.Random, 0.2f, fadeOutTime, 0f, null, fadeIn: false, uniform: false, null, null, height); } } private void OnDestroy() { ((MonoBehaviour)(object)this).LoopSoundIf(play: false, "oddjob_saw_sound"); _hitThisFrame.Clear(); UpdateCollisionData(); } private void UpdateCollisionData() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) foreach (HealthHaver item in _hitLastFrame) { if (Object.op_Implicit((Object)(object)item) && !item.IsDead && item.IsVulnerable && !_hitThisFrame.Contains(item)) { item.ApplyDamage(_proj.baseData.damage, Vector2.zero, _proj.OwnerName, (CoreDamageTypes)0, (DamageCategory)0, false, (PixelCollider)null, false); if (Object.op_Implicit((Object)(object)((BraveBehaviour)item).specRigidbody)) { ((BraveBehaviour)_proj).specRigidbody.RegisterTemporaryCollisionException(((BraveBehaviour)item).specRigidbody, 0.1f, (float?)null); } } } BraveUtility.Swap>(ref _hitThisFrame, ref _hitLastFrame); _hitThisFrame.Clear(); _collidedLastFrame = false; } private void Update() { //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_009b: Unknown result type (might be due to invalid IL or missing references) if (BraveTime.DeltaTime == 0f) { return; } ((MonoBehaviour)(object)this).LoopSoundIf(_collidedLastFrame, "oddjob_saw_sound"); ((MonoBehaviour)(object)this).LoopSoundIf(!_collidedLastFrame, "oddjob_spin_sound"); UpdateCollisionData(); if (!_mastered) { return; } float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; if (scaledTimeSinceStartup < _nextFlakTime) { return; } _nextFlakTime = scaledTimeSinceStartup + 0.15f; float num = 360f * Random.value; for (int i = 0; i < 5; i++) { Projectile component = SpawnManager.SpawnProjectile(((Component)Oddjob._OddjobFlakProjectile).gameObject, Vector2.op_Implicit(_proj.SafeCenter), (num + (float)i * 72f).EulerZ(), true).GetComponent(); component.SetOwnerAndStats((GameActor)(object)_owner); foreach (HealthHaver item in _hitLastFrame) { SpeculativeRigidbody specRigidbody = ((BraveBehaviour)item).specRigidbody; if (specRigidbody != null) { ((BraveBehaviour)component).specRigidbody.RegisterSpecificCollisionException(specRigidbody); } } } ((Component)this).gameObject.Play("oddjob_flak_sound"); } } public class OddjobProjectileMotionModule : ProjectileMotionModule { public bool ForceInvert; private bool _initialized; private Vector2 _initialRightVector; private Vector2 _initialUpVector; private Vector2 _privateLastPosition; private AIActor _nextEnemyInPath; private Vector2 _circleCenter; private float _circleRadius; private float _circleSqrRadius; private float _circleCircum; private float _startAngleFromCenter; private float _curAngleFromCenter; private float _circleTraveled; private RoomHandler _startRoom; private float _returnTime; private OddjobProjectile _oddProj; private const float _MIN_TOSS_RADIUS = 3f; private const float _MAX_TOSS_RADIUS = 10f; private const float _NO_TARGET_TOSS_RADIUS = 5f; private const float _SCAN_DELTA = 45f; private const float _MAX_SQR_DEVIATION = 16f; private const float _RADIAL_SHIFT_RATE = 8f; private const float _RETURN_PERCENT = 0.75f; private const float _MAX_RETURN_TIME = 1f; private const float _MAX_RETURN_SQR_RADIUS = 0.2f; private const float _SAW_SPEED = 0.1f; private void ResetAngle(float angleDiff) { //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_001b: 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_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_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_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_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) if (!float.IsNaN(angleDiff)) { Quaternion val = Quaternion.Euler(0f, 0f, angleDiff); _initialUpVector = Vector2.op_Implicit(val * Vector2.op_Implicit(_initialUpVector)); _initialRightVector = Vector2.op_Implicit(val * Vector2.op_Implicit(_initialRightVector)); } } public override void UpdateDataOnBounce(float angleDiff) { ResetAngle(angleDiff); } public override void AdjustRightVector(float angleDiff) { ResetAngle(angleDiff); } private void Initialize(Vector2 lastPosition, Transform projectileTransform, float m_timeElapsed, Vector2 m_currentDirection, bool shouldRotate) { //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_0019: 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_0012: 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_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_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_0026: 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_005f: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0088: 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_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_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_00ae: 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_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) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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) _privateLastPosition = lastPosition; _initialRightVector = ((!shouldRotate) ? m_currentDirection : Vector3Extensions.XY(projectileTransform.right)); _initialUpVector = Vector2.op_Implicit((!shouldRotate) ? (Quaternion.Euler(0f, 0f, 90f) * Vector2.op_Implicit(m_currentDirection)) : projectileTransform.up); _initialized = true; float num = Vector2Extensions.ToAngle(_initialRightVector); AIActor val = lastPosition.NearestEnemyWithinConeOfVision(num, 45f, 20f, useNearestAngleInsteadOfDistance: false, ignoreWalls: true); if (Object.op_Implicit((Object)(object)val)) { Vector2 val2 = ((GameActor)val).CenterPosition - lastPosition; _circleCenter = lastPosition + num.ToVector(0.5f * ((Vector2)(ref val2)).magnitude); } else { _circleCenter = lastPosition + 5f * ((Vector2)(ref _initialRightVector)).normalized; } Vector2 val3 = lastPosition - _circleCenter; _circleRadius = ((Vector2)(ref val3)).magnitude; _circleSqrRadius = _circleRadius * _circleRadius; _circleCircum = (float)Math.PI * 2f * _circleRadius; _startAngleFromCenter = Vector2Extensions.ToAngle(val3); _curAngleFromCenter = _startAngleFromCenter; _circleTraveled = 0f; _startRoom = Vector3Extensions.GetAbsoluteRoom(lastPosition); } private bool NextEnemyInPathIsReachable(float targetAngle, bool clockwise) { if (!Object.op_Implicit((Object)(object)_nextEnemyInPath) || !Object.op_Implicit((Object)(object)((BraveBehaviour)_nextEnemyInPath).healthHaver) || !((BraveBehaviour)_nextEnemyInPath).healthHaver.IsAlive) { return false; } float angularDistance; return EnemyIsReachable(_nextEnemyInPath, targetAngle, clockwise, out angularDistance); } private bool EnemyIsReachable(AIActor actor, float targetAngle, bool clockwise, out float angularDistance) { //IL_0009: 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_0019: 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) angularDistance = 0f; Vector2 val = ((GameActor)actor).CenterPosition - _circleCenter; float sqrMagnitude = ((Vector2)(ref val)).sqrMagnitude; if (Mathf.Abs(_circleSqrRadius - sqrMagnitude) > 16f) { return false; } angularDistance = (float)(clockwise ? 1 : (-1)) * (Vector2Extensions.ToAngle(val) - targetAngle).Clamp180(); if (angularDistance > 0f) { return angularDistance < 90f; } return false; } private AIActor FindUpcomingTargets(float targetAngle, bool clockwise) { //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) if (_startRoom == null) { return null; } if (NextEnemyInPathIsReachable(targetAngle, clockwise)) { return _nextEnemyInPath; } _nextEnemyInPath = null; float num = 360f; foreach (AIActor allNearbyEnemy in Vector3Extensions.XY(((Component)_oddProj).transform.position).GetAllNearbyEnemies()) { if (EnemyIsReachable(allNearbyEnemy, targetAngle, clockwise, out var angularDistance) && !(angularDistance > num)) { num = angularDistance; _nextEnemyInPath = allNearbyEnemy; } } return _nextEnemyInPath; } public override void Move(Projectile source, Transform projectileTransform, tk2dBaseSprite projectileSprite, SpeculativeRigidbody specRigidbody, ref float m_timeElapsed, ref Vector2 m_currentDirection, bool Inverted, bool shouldRotate) { //IL_004e: 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_0046: 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_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_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: 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_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0231: 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_0244: 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_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025a: 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) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: 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_0132: 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_0156: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_oddProj)) { _oddProj = ((Component)source).gameObject.GetComponent(); if (!Object.op_Implicit((Object)(object)_oddProj)) { Lazy.RuntimeWarn("Moving Oddjob projectile without a projectile!"); return; } } ProjectileData baseData = source.baseData; Vector2 val = ((!Object.op_Implicit((Object)(object)projectileSprite)) ? Vector3Extensions.XY(projectileTransform.position) : projectileSprite.WorldCenter); if (!_initialized) { Initialize(val, projectileTransform, m_timeElapsed, m_currentDirection, shouldRotate); } m_timeElapsed += BraveTime.DeltaTime; float num = (_oddProj._collidedLastFrame ? 0.1f : 1f); _circleTraveled += BraveTime.DeltaTime * baseData.speed * num; float num2 = _circleTraveled / _circleCircum; if (num2 > 0.75f && !_oddProj._collidedLastFrame) { _oddProj._returning = true; if (!Object.op_Implicit((Object)(object)source.Owner) || (_returnTime += BraveTime.DeltaTime) > 1f) { source.DieInAir(false, true, true, false); return; } Vector2 val2 = ((BraveBehaviour)source.Owner).sprite.WorldTopCenter - val; if (((Vector2)(ref val2)).sqrMagnitude < 0.2f) { source.DieInAir(false, true, true, false); } else { specRigidbody.Velocity = Lazy.SmoothestLerp(specRigidbody.Velocity, baseData.speed * ((Vector2)(ref val2)).normalized, 5f + 10f * (_returnTime / 1f)); } return; } bool flag = Inverted == ForceInvert; float num3 = _startAngleFromCenter + (flag ? 360f : (-360f)) * num2; FindUpcomingTargets(num3, flag); float num4 = _circleRadius; Vector2 val3; if (Object.op_Implicit((Object)(object)_nextEnemyInPath)) { val3 = ((GameActor)_nextEnemyInPath).CenterPosition - _circleCenter; num4 = ((Vector2)(ref val3)).magnitude; } val3 = val - _circleCenter; float magnitude = ((Vector2)(ref val3)).magnitude; float num5 = 8f * BraveTime.DeltaTime; float magnitude2 = magnitude + Mathf.Clamp(num4 - magnitude, 0f - num5, num5); Vector2 velocity = (_circleCenter + num3.ToVector(magnitude2) - val) / BraveTime.DeltaTime; specRigidbody.Velocity = velocity; } public override void SentInDirection(ProjectileData baseData, Transform projectileTransform, tk2dBaseSprite projectileSprite, SpeculativeRigidbody specRigidbody, ref float m_timeElapsed, ref Vector2 m_currentDirection, bool shouldRotate, Vector2 dirVec, bool resetDistance, bool updateRotation) { //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_000a: 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) Initialize((!Object.op_Implicit((Object)(object)projectileSprite)) ? Vector3Extensions.XY(projectileTransform.position) : projectileSprite.WorldCenter, projectileTransform, m_timeElapsed, m_currentDirection, shouldRotate); } } public class Retina : CwaffGun { public static string ItemName = "Retina"; public static string ShortDescription = "Breach of Covenant"; public static string LongDescription = "Shoots lethal piercing directed energy blasts. Press fire once to scope in, and again to shoot. Scope out by shooting, dodging, reloading, or taking damage."; public static string Lore = "An engineering marvel developed by three tech-savvy track athletes and their coach under contract by the Department of Defense. Featuring a state-of-the-art digital scope, mach 4 directed energy projectiles, and enough power to wipe out a Gun Nut, this four-runner-designed weapon is perfect for fighting from an extremely comfortable distance."; private RetinaHUD _hud; public static void Init() { //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? idleFps = 10; int? shootFps = 24; int? reloadFps = 30; Gun gun2 = gun.SetAttributes((ItemQuality)5, (GunClass)15, 2.5f, 50, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, idleFps, shootFps, reloadFps, null, null, "retina_fire_sound", "retina_reload_sound", 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, autoPlay: true, attacksThroughWalls: false, suppressReloadLabel: false, 1f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: false, preventRollingWhenCharging: false, 1f, 0.1f); int? clipSize = 4; float? cooldown = 1.25f; float? angleVariance = 1f; float? damage = 300f; float? speed = 900f; float? force = 10f; float? range = 1000f; bool? pierceBreakables = true; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "retina_projectile", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 0.6f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, null, "retina_impact_sound", null, null, null, 0f, ignoredForReloadPurposes: false, mirror: false, null, null, null, pierceBreakables)).AttachTrail("retina_beam", 60, null, 0f, -1f, -1f, destroyOnEmpty: true, Lazy.DispersalParticles(ExtendedColours.vibrantOrange)).Attach((Action)delegate(PierceProjModifier pierce) { pierce.penetration = 999; pierce.penetratesBreakables = true; }, allowDuplicates: false) .Attach() .Assign(out Projectile projectileRef); Color? emissiveColour = new Color(1f, 0.85f, 0.5f); VFXPool val = VFX.CreatePool("retina_impact_vfx", 30f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 2f, emissiveColour, orphaned: false, attached: true, unlit: false, 0f, 0f, null, 10f, 0f, 0.6f); val.effects[0].effects[0].effect.AddComponent(); projectileRef.SetAllImpactVFX(val); } private void RegisterEvents(PlayerController player) { if (Object.op_Implicit((Object)(object)player)) { player.OnReceivedDamage -= OnReceivedDamage; player.OnReceivedDamage += OnReceivedDamage; } } private void OnReceivedDamage(PlayerController player) { DismissHUD(); } private void DeregisterEvents(PlayerController player) { if (Object.op_Implicit((Object)(object)player)) { player.OnReceivedDamage -= OnReceivedDamage; } } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); CreateHUDIfNecessary(); RegisterEvents(((GunBehaviour)this).PlayerOwner); } public override void OnTriedToInitiateAttack(PlayerController player) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) base.OnTriedToInitiateAttack(player); if (player.IsDodgeRolling || (int)player.CurrentInputState != 0 || ((GunBehaviour)this).gun.IsReloading || ((GunBehaviour)this).gun.ClipShotsRemaining == 0 || ((GunBehaviour)this).gun.CurrentAmmo == 0) { return; } CreateHUDIfNecessary(); if (Object.op_Implicit((Object)(object)_hud) && !_hud.Active) { player.SuppressThisClick = true; if (!((GunBehaviour)this).gun.m_moduleData[((GunBehaviour)this).gun.DefaultModule].onCooldown) { _hud.Toggle(); } } } public override void OnDroppedByPlayer(PlayerController player) { DismissHUD(); DeregisterEvents(player); base.OnDroppedByPlayer(player); } public override void OnDestroy() { DismissHUD(); DeregisterEvents(((GunBehaviour)this).PlayerOwner); base.OnDestroy(); } public override void OnSwitchedAwayFromThisGun() { DismissHUD(); DeregisterEvents(((GunBehaviour)this).PlayerOwner); base.OnSwitchedAwayFromThisGun(); } public override bool OnManualReloadAttempted(PlayerController player) { if (!Object.op_Implicit((Object)(object)_hud) || !_hud.Active) { return true; } _hud.Dismiss(); return false; } public override void OnPostFired(PlayerController player, Gun gun) { ((GunBehaviour)this).OnPostFired(player, gun); if (Object.op_Implicit((Object)(object)_hud)) { _hud.Dismiss(); } } private void CreateHUDIfNecessary() { if (!Object.op_Implicit((Object)(object)_hud)) { _hud = ((Component)this).gameObject.AddComponent(); _hud.Setup(); } } private void DismissHUD() { if (Object.op_Implicit((Object)(object)_hud)) { _hud.Dismiss(); } } } public class RetinaHUD : MonoBehaviour { private const float _SHWOOP_TIME = 0.25f; private const float _FADE_TIME = 0.125f; private const float _ENGAGE_TIME = 0.375f; private const int MAX_TARGETS = 4; private const float _FIRST_TEXT_LINE = 0.05f; private const float _TARGET_SPRITE_MAIN_X = 0.175f; private const float _TARGET_SPRITE_EXTRA_X = 0.3f; private const float _TARGET_SPRITE_MIN_Y = 0.01f; private const float _TARGET_SPACING = 0.13f; private const float _INFO_LABEL_X = 0.075f; private const float _HEALTH_W = 0.075f; private const float _HEALTH_LEFT = 0.0375f; private const float _PANEL_SIZE_X = 0.35f; private const float _PANEL_SIZE_Y = 0.4f; private const float MIN_TIMESCALE = 0.25f; private static readonly Color _HeaderColor = Color.Lerp(Color.green, Color.black, 0.6f); private static readonly Color _LabelColor = Color.Lerp(Color.green, Color.black, 0.35f); private static readonly string[] _CollateralLabels = new string[4] { "Low", "Medium", "High", "Extreme" }; private bool _setup; private bool _active; private Retina _gun; private float _shwoop; private List _geometry = new List(); private List _labels = new List(); private CameraController _camera; private Vector2 _worldBottomLeft; private Vector2 _worldTopRight; private Vector2 _basePos; private Geometry _base; private Geometry _targetInfoRectangle; private Geometry _healthbarBack; private Geometry _healthbarHurt; private Geometry _healthbarFore; private dfLabel _nameHeader; private dfLabel _nameLabel; private dfLabel _collateralHeader; private dfLabel _collateralLabel; private dfLabel _rangeHeader; private dfLabel _rangeLabel; private dfLabel _vulnHeader; private dfLabel _vulnLabel; private tk2dSprite _targetSprite; private List _extraTargetSprites; private static Dictionary _EnemyScales = new Dictionary(); public bool Active => _active; public void Setup() { //IL_0019: 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_0076: 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_00d3: 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_0130: 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) //IL_018d: 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_01f1: 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_021f: 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_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0264: 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_02d0: Unknown result type (might be due to invalid IL or missing references) _gun = ((Component)this).gameObject.GetComponent(); _base = Geom(Geometry.Shape.RECTANGLE).Place(Vector3Extensions.WithAlpha(ExtendedColours.vibrantOrange, 0.1f)); _targetInfoRectangle = Geom(Geometry.Shape.RECTANGLE).Place(Vector3Extensions.WithAlpha(ExtendedColours.vibrantOrange, 0.2f)); _healthbarBack = Geom(Geometry.Shape.RECTANGLE).Place(Color.black); _healthbarHurt = Geom(Geometry.Shape.RECTANGLE).Place(Vector3Extensions.WithAlpha(Color.green, 0.85f)); _healthbarFore = Geom(Geometry.Shape.RECTANGLE).Place(Vector3Extensions.WithAlpha(Color.red, 0.85f)); _nameHeader = Lab(Color.cyan, (TextAlignment)1); _nameLabel = Lab(Color.cyan, (TextAlignment)1); _collateralHeader = Lab(Color.cyan, (TextAlignment)1); _collateralLabel = Lab(Color.cyan, (TextAlignment)1); _rangeHeader = Lab(Color.cyan, (TextAlignment)1); _rangeLabel = Lab(Color.cyan, (TextAlignment)1); _vulnHeader = Lab(Color.cyan, (TextAlignment)1); _vulnLabel = Lab(Color.cyan, (TextAlignment)1); _nameLabel.AutoHeight = true; _nameLabel.WordWrap = true; _nameLabel.VerticalAlignment = (dfVerticalAlignment)0; ((dfControl)_nameLabel).Pivot = (dfPivotPoint)1; ((dfControl)_nameLabel).Size = new Vector2(160f, 48f); _extraTargetSprites = new List(); for (int i = 0; i < 4; i++) { tk2dSprite item = CreateNewTargetSprite(i); _extraTargetSprites.Add(item); } _targetSprite = _extraTargetSprites[0]; Dismiss(force: true); _setup = true; _camera = GameManager.Instance.MainCameraController; if (Object.op_Implicit((Object)(object)_camera)) { CameraController camera = _camera; camera.OnFinishedFrame = (Action)Delegate.Remove(camera.OnFinishedFrame, new Action(OnFinishedFrame)); CameraController camera2 = _camera; camera2.OnFinishedFrame = (Action)Delegate.Combine(camera2.OnFinishedFrame, new Action(OnFinishedFrame)); } } private static tk2dSprite CreateNewTargetSprite(int i) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) tk2dSprite obj = new GameObject($"retina target preview {i + 1}").AddComponent(); GameObjectExtensions.SetLayerRecursively(((Component)obj).gameObject, LayerMask.NameToLayer("Unoccluded")); ((BraveBehaviour)obj).renderer.enabled = false; return obj; } private Geometry Geom(Geometry.Shape shape) { Geometry geometry = Geometry.Create(shape).UseGUILayer(); _geometry.Add(geometry); return geometry; } private dfLabel Lab(Color? color = null, TextAlignment align = (TextAlignment)1) { //IL_0002: 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_0015: 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) dfLabel val = EasyLabel.Create(unicode: false, outline: false, align); ((dfControl)val).Color = Color32.op_Implicit((Color)(((??)color) ?? Color.white)); _labels.Add(val); return val; } private void Update() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (!_setup) { return; } if (Object.op_Implicit((Object)(object)_camera) && Object.op_Implicit((Object)(object)_gun)) { Gun gun = ((GunBehaviour)_gun).gun; if (gun != null) { PlayerController playerOwner = ((GunBehaviour)_gun).PlayerOwner; if (playerOwner != null) { if (GameManager.Instance.IsPaused) { Dismiss(force: false, deactivate: false); } else if (playerOwner.IsDodgeRolling || gun.IsReloading || (int)playerOwner.CurrentInputState != 0) { Dismiss(); } return; } } } Dismiss(); Object.Destroy((Object)(object)this); } private void UpdateLabelsForUISize() { } private void OnFinishedFrame() { if (_setup && _active && Object.op_Implicit((Object)(object)_camera) && !GameManager.Instance.IsPaused) { Engage(); UpdateLabelsForUISize(); if (_active) { PlaceHUDElements(); } } } private void Place(Geometry g, Vector2 topLeft, Vector2 bottomRight, Color? newColor = null) { //IL_0023: 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_0084: 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_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) Vector2 value = default(Vector2); ((Vector2)(ref value))..ctor(Mathf.Lerp(_worldBottomLeft.x, _worldTopRight.x, _basePos.x + topLeft.x), Mathf.Lerp(_worldBottomLeft.y, _worldTopRight.y, _basePos.y + topLeft.y)); Vector2 value2 = default(Vector2); ((Vector2)(ref value2))..ctor(Mathf.Lerp(_worldBottomLeft.x, _worldTopRight.x, _basePos.x + bottomRight.x), Mathf.Lerp(_worldBottomLeft.y, _worldTopRight.y, _basePos.y + bottomRight.y)); Vector2? pos = value; Vector2? pos2 = value2; g.Place(newColor, pos, pos2); } private void Place(dfLabel d, string text, Vector2 screenPos, Color? newColor = null) { //IL_0023: 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_00ad: 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_0073: 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) Vector2 pos = default(Vector2); ((Vector2)(ref pos))..ctor(Mathf.Lerp(_worldBottomLeft.x, _worldTopRight.x, _basePos.x + screenPos.x), Mathf.Lerp(_worldBottomLeft.y, _worldTopRight.y, _basePos.y + screenPos.y)); if (newColor.HasValue) { Color valueOrDefault = newColor.GetValueOrDefault(); ((dfControl)d).Color = Color32.op_Implicit(Vector3Extensions.WithAlpha(valueOrDefault, 1f)); } ((dfControl)d).Opacity = Mathf.Clamp01((_shwoop - 0.25f) / 0.125f); d.Text = text; d.Place(pos); } private void Place(tk2dSprite sprite, Vector2 screenPos, float scale = 1f, bool outline = false, Anchor anchor = (Anchor)1, Texture2D palette = null) { //IL_0023: 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_00d2: 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) //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_00fd: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(Mathf.Lerp(_worldBottomLeft.x, _worldTopRight.x, _basePos.x + screenPos.x), Mathf.Lerp(_worldBottomLeft.y, _worldTopRight.y, _basePos.y + screenPos.y)); Material material = ((BraveBehaviour)sprite).renderer.material; material.shader = ShaderCache.Acquire(((Object)(object)palette == (Object)null) ? "Brave/PlayerShader" : "Brave/LitCutoutUber"); material.SetFloat("_UsePalette", ((Object)(object)palette == (Object)null) ? 0f : 1f); material.SetFloat("_EmissivePower", 10f); material.SetTexture("_PaletteTex", (Texture)(object)palette); ((tk2dBaseSprite)sprite).scale = new Vector3(scale, scale, 1f); ((tk2dBaseSprite)(object)sprite).PlaceAtScaledPositionByAnchor(Vector2.op_Implicit(val), anchor); ((tk2dBaseSprite)sprite).UpdateZDepth(); if (outline) { if (!SpriteOutlineManager.HasOutline((tk2dBaseSprite)(object)sprite)) { SpriteOutlineManager.AddOutlineToSprite((tk2dBaseSprite)(object)sprite, Color.white, 0.1f, 0f, (OutlineType)0); } tk2dSprite[] outlineSprites = SpriteOutlineManager.GetOutlineSprites((tk2dBaseSprite)(object)sprite); for (int i = 0; i < outlineSprites.Length; i++) { ((tk2dBaseSprite)outlineSprites[i]).UpdateZDepth(); } } } private static float GetScaleForEnemy(AIActor enemy) { //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_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) string enemyGuid = enemy.EnemyGuid; if (_EnemyScales.TryGetValue(enemyGuid, out var value)) { return value; } value = 1f; if (((BraveBehaviour)enemy).sprite.collection.spriteDefinitions != null) { Lazy.GetCollectionAndIdForBestIdleAnimation(enemy, out var spriteCol, out var spriteId); Vector3 boundsDataExtents = spriteCol.spriteDefinitions[spriteId].boundsDataExtents; float num = 16f * Mathf.Max(boundsDataExtents.x, boundsDataExtents.y); value = ((num < 40f) ? 2f : ((num < 80f) ? 1f : 0.5f)); } HealthHaver healthHaver = ((BraveBehaviour)enemy).healthHaver; if (healthHaver != null && (healthHaver.IsBoss || healthHaver.IsSubboss)) { value = Mathf.Min(value, 1f); } return _EnemyScales[enemyGuid] = value; } private static float GetNextLine(ref float y, float skip = 1f) { float result = y; y += -0.03f * skip; return result; } private string Status(AIActor target, out float projectedDamage) { projectedDamage = 0f; if (!Object.op_Implicit((Object)(object)target)) { return string.Empty; } HealthHaver healthHaver = ((BraveBehaviour)target).healthHaver; if (healthHaver == null) { return "Immortal"; } if (healthHaver.IsDead) { return "Deceased"; } if (((GameActor)target).IsGone || !healthHaver.IsVulnerable || healthHaver.PreventAllDamage || healthHaver.OnlyAllowSpecialBossDamage) { return "Invulnerable"; } if (healthHaver.healthIsNumberOfHits) { if (healthHaver.GetCurrentHealth() <= 1f) { return "Faltering"; } return "Steeled"; } Projectile projectile = ((BraveBehaviour)((GunBehaviour)_gun).gun.DefaultModule.projectiles[0]).projectile; projectedDamage = projectile.baseData.damage; if (((GunBehaviour)_gun).PlayerOwner != null) { projectedDamage *= ((GunBehaviour)_gun).PlayerOwner.DamageMult(); if (healthHaver.IsBoss) { projectedDamage *= ((GunBehaviour)_gun).PlayerOwner.BossDamageMult(); } } projectedDamage *= healthHaver.AllDamageMultiplier; if (healthHaver.IsBoss) { projectedDamage *= projectile.BossDamageMultiplier; } bool flag = false; if (projectedDamage <= 999f && !projectile.ignoreDamageCaps) { float num = projectedDamage; if (healthHaver.m_damageCap > 0f) { projectedDamage = Mathf.Min(healthHaver.m_damageCap, projectedDamage); } if (healthHaver.m_bossDpsCap > 0f) { projectedDamage = Mathf.Min(projectedDamage, healthHaver.m_bossDpsCap * 3f - healthHaver.m_recentBossDps); } flag = projectedDamage < num; } if (projectedDamage >= healthHaver.GetCurrentHealth()) { return "Threatened"; } if (flag) { return "Resistant"; } return "Vulnerable"; } private void PlaceHUDElements() { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_01bd: 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) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: 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_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: 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_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: 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_051a: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_0526: Unknown result type (might be due to invalid IL or missing references) //IL_065d: Unknown result type (might be due to invalid IL or missing references) //IL_0608: Unknown result type (might be due to invalid IL or missing references) PlayerController playerOwner = ((GunBehaviour)_gun).PlayerOwner; if (!Object.op_Implicit((Object)(object)playerOwner) || (Object)(object)((GameActor)playerOwner).CurrentGun != (Object)(object)((GunBehaviour)_gun).gun) { Dismiss(); return; } float deltaTime = Time.deltaTime; _shwoop += deltaTime; float num = Ease.OutQuad(Mathf.Clamp01(_shwoop / 0.25f)); bool flag = Mathf.Abs(playerOwner.m_currentGunAngle.Clamp180()) < 90f; float num2 = (flag ? (0.35f * (num - 1f)) : (1f - num * 0.35f)); _basePos = new Vector2(num2, 0.3f); _worldBottomLeft = _camera.MinVisiblePoint; _worldTopRight = _camera.MaxVisiblePoint; float y = 0.35f; float num3 = (flag ? 0.075f : 0.27499998f); float num4 = (flag ? 0.0375f : 0.3125f); float num5 = (flag ? 0.075f : (-0.075f)); bool flag2 = _shwoop > 0.25f; BraveTime.SetTimeScaleMultiplier(Mathf.Lerp(1f, 0.25f, num), ((Component)this).gameObject); ReadOnlyCollection readOnlyCollection = ((GunBehaviour)_gun).gun.AllEnemiesInLineOfSight(canBeNeutral: true, accountForWalls: true, sort: true); float realtimeSinceStartup = Time.realtimeSinceStartup; Vector2 val = Vector3Extensions.XY(((GunBehaviour)_gun).gun.barrelOffset.position); float currentAngle = ((GunBehaviour)_gun).gun.CurrentAngle; AIActor val2 = ((readOnlyCollection.Count > 0) ? readOnlyCollection[0] : null); string text = (Object.op_Implicit((Object)(object)val2) ? val2.AmmonomiconName() : string.Empty); Vector2 val3 = (Object.op_Implicit((Object)(object)val2) ? (((GameActor)val2).CenterPosition - val) : Vector2.right); Mathf.RoundToInt(Vector2Extensions.ToAngle(val3).AbsAngleTo(currentAngle)); string text2 = (Object.op_Implicit((Object)(object)val2) ? $"{(float)Mathf.RoundToInt(10f * ((Vector2)(ref val3)).magnitude) / 10f:0.0}m" : string.Empty); float num6 = 0.85f * Mathf.Clamp01((_shwoop - 0.25f) / 0.125f); Color value = Vector3Extensions.WithAlpha(Color.Lerp(Color.green, Color.red, Mathf.Abs(Mathf.Sin(9f * realtimeSinceStartup))), num6); float projectedDamage; string text3 = Status(val2, out projectedDamage); string text4 = (Object.op_Implicit((Object)(object)val2) ? _CollateralLabels[Mathf.Clamp(readOnlyCollection.Count - 1, 0, _CollateralLabels.Length - 1)] : string.Empty); Place(_targetInfoRectangle, Vector2.zero, new Vector2(0.35f, 0.4f), Vector3Extensions.WithAlpha(ExtendedColours.vibrantOrange, 0.2f * num)); Place(_nameHeader, "Species", new Vector2(num3, GetNextLine(ref y, 0f)), _HeaderColor); Place(_nameLabel, text, new Vector2(num3, GetNextLine(ref y, 3.25f)), _LabelColor); Place(_rangeHeader, "Range", new Vector2(num3, GetNextLine(ref y)), _HeaderColor); Place(_rangeLabel, text2, new Vector2(num3, GetNextLine(ref y, 1.25f)), _LabelColor); Place(_collateralHeader, "Collateral", new Vector2(num3, GetNextLine(ref y)), _HeaderColor); Place(_collateralLabel, text4, new Vector2(num3, GetNextLine(ref y, 1.25f)), _LabelColor); Place(_vulnHeader, "Status", new Vector2(num3, GetNextLine(ref y)), _HeaderColor); Place(_vulnLabel, text3, new Vector2(num3, GetNextLine(ref y)), _LabelColor); float nextLine = GetNextLine(ref y); float nextLine2 = GetNextLine(ref y); if (Object.op_Implicit((Object)(object)val2)) { HealthHaver healthHaver = ((BraveBehaviour)val2).healthHaver; if (healthHaver != null) { float currentHealthPercentage = healthHaver.GetCurrentHealthPercentage(); float num7 = Mathf.Max(healthHaver.GetCurrentHealth() - projectedDamage, 0f) / healthHaver.GetMaxHealth(); Place(_healthbarHurt, new Vector2(num4, nextLine2), new Vector2(num4 + num7 * num5, nextLine), Vector3Extensions.WithAlpha(Color.green, num6)); Place(_healthbarFore, new Vector2(num4 + num7 * num5, nextLine2), new Vector2(num4 + currentHealthPercentage * num5, nextLine), value); Place(_healthbarBack, new Vector2(num4 + currentHealthPercentage * num5, nextLine2), new Vector2(num4 + num5, nextLine), Vector3Extensions.WithAlpha(Color.black, num6)); goto IL_055b; } } _healthbarBack.Disable(); _healthbarHurt.Disable(); _healthbarFore.Disable(); goto IL_055b; IL_055b: for (int i = 0; i < 4; i++) { AIActor val4 = ((readOnlyCollection.Count > i) ? readOnlyCollection[i] : null); if (flag2 && Object.op_Implicit((Object)(object)val4)) { tk2dBaseSprite sprite = ((BraveBehaviour)val4).sprite; tk2dSprite val5 = (tk2dSprite)(object)((sprite is tk2dSprite) ? sprite : null); if (val5 != null) { ((BraveBehaviour)_extraTargetSprites[i]).renderer.enabled = true; ((tk2dBaseSprite)_extraTargetSprites[i]).SetSprite(((tk2dBaseSprite)val5).collection, ((tk2dBaseSprite)val5).spriteId); if (i == 0) { float num8 = (flag ? 0.175f : 0.175f); Place(_extraTargetSprites[i], new Vector2(num8, 0.01f), GetScaleForEnemy(val4), outline: true, (Anchor)1, val4.optionalPalette); } else { float num9 = (flag ? 0.3f : 0.049999982f); float num10 = 0.01f + 0.13f * (float)(i - 1); Place(_extraTargetSprites[i], new Vector2(num9, num10), 0.5f * GetScaleForEnemy(val4), outline: true, (Anchor)1, val4.optionalPalette); } continue; } } if (SpriteOutlineManager.HasOutline((tk2dBaseSprite)(object)_extraTargetSprites[i])) { SpriteOutlineManager.RemoveOutlineFromSprite((tk2dBaseSprite)(object)_extraTargetSprites[i], false); } ((BraveBehaviour)_extraTargetSprites[i]).renderer.enabled = false; } } private void OnDestroy() { if (GameManager.HasInstance && Object.op_Implicit((Object)(object)GameManager.Instance.MainCameraController)) { CameraController mainCameraController = GameManager.Instance.MainCameraController; mainCameraController.OnFinishedFrame = (Action)Delegate.Remove(mainCameraController.OnFinishedFrame, new Action(OnFinishedFrame)); } if (!_setup) { return; } if (_geometry != null) { for (int num = _geometry.Count - 1; num >= 0; num--) { if (Object.op_Implicit((Object)(object)_geometry[num])) { Object.Destroy((Object)(object)((Component)_geometry[num]).gameObject); } } } if (_labels != null) { for (int num2 = _labels.Count - 1; num2 >= 0; num2--) { if (Object.op_Implicit((Object)(object)_labels[num2])) { Object.Destroy((Object)(object)((Component)_labels[num2]).gameObject); } } } if (_extraTargetSprites == null) { return; } for (int i = 0; i < _extraTargetSprites.Count; i++) { if (Object.op_Implicit((Object)(object)_extraTargetSprites[i])) { Object.Destroy((Object)(object)((Component)_extraTargetSprites[i]).gameObject); } } } public void Toggle() { if (_active) { Dismiss(); } else { Engage(); } } public void Engage() { if (!_active) { _shwoop = 0f; _active = true; ((Component)this).gameObject.Play("retina_hud_engage_sound"); } } public void Dismiss(bool force = false, bool deactivate = true) { if (!_active && !force) { return; } foreach (Geometry item in _geometry) { if (Object.op_Implicit((Object)(object)item)) { item.Disable(); } } foreach (dfLabel label in _labels) { if (!((Object)(object)label == (Object)null)) { ((dfControl)label).Opacity = 0f; ((dfControl)label).IsVisible = false; } } foreach (tk2dSprite extraTargetSprite in _extraTargetSprites) { if (Object.op_Implicit((Object)(object)extraTargetSprite)) { if (SpriteOutlineManager.HasOutline((tk2dBaseSprite)(object)extraTargetSprite)) { SpriteOutlineManager.RemoveOutlineFromSprite((tk2dBaseSprite)(object)extraTargetSprite, false); } ((BraveBehaviour)extraTargetSprite).renderer.enabled = false; } } if (deactivate) { _active = false; BraveTime.ClearMultiplier(((Component)this).gameObject); } } } public class RetinaLightburstDoer : MonoBehaviour { private void OnSpawned() { //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_0016: Unknown result type (might be due to invalid IL or missing references) EasyLight.Create((Vector2?)Vector2.op_Implicit(((Component)this).transform.position), (Transform)null, (Color?)ExtendedColours.vibrantOrange, 0.5f, 4f, true, 10f, 0.2f, 0.2f, true, false, 30f, 0f, true, true); } } public class RetinaProjectile : MonoBehaviour { private Projectile _projectile; private PlayerController _owner; private bool _killedEnemy; private int _killTracker; private void Start() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown _projectile = ((Component)this).GetComponent(); Projectile projectile = _projectile; projectile.OnWillKillEnemy = (Action)Delegate.Combine(projectile.OnWillKillEnemy, new Action(OnWillKillEnemy)); SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody.OnRigidbodyCollision = (OnRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnRigidbodyCollision, (Delegate?)new OnRigidbodyCollisionDelegate(OnRigidbodyCollision)); ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); CwaffTrailController componentInChildren = ((Component)this).GetComponentInChildren(); if (componentInChildren != null) { ((Component)componentInChildren).gameObject.GetComponent().SetGlowiness(100f); } } private void OnWillKillEnemy(Projectile projectile, SpeculativeRigidbody enemy) { HealthHaver healthHaver = ((BraveBehaviour)enemy).healthHaver; if (healthHaver == null || healthHaver.IsBoss || healthHaver.IsSubboss) { return; } AIActor aiActor = ((BraveBehaviour)enemy).aiActor; if (aiActor != null) { tk2dBaseSprite sprite = ((BraveBehaviour)aiActor).sprite; if (sprite != null) { sprite.DuplicateInWorldAsMesh(pointMesh: true, aiActor.optionalPalette).Dissipate(1.5f, 0.0625f, 4f, progressive: false, 0f, 50f, RetinaEmit, easeFade: RetinaFade, easeAmp: RetinaAmp, sound: "retina_impact_burst_sound", soundTime: 0.4f); aiActor.EraseFromExistenceWithRewards(true); _killedEnemy = true; _killTracker++; } } } private void OnRigidbodyCollision(CollisionData collision) { //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) _projectile.ResetPiercing(); if (_killedEnemy) { _killedEnemy = false; SpawnManager.SpawnVFX(_projectile.hitEffects.enemy.effects[0].effects[0].effect, Vector2.op_Implicit(((CastResult)collision).Contact), Quaternion.identity, true); } } private void OnDestroy() { //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_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_00bc: 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) //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_00a9: Unknown result type (might be due to invalid IL or missing references) if (_killTracker < 2 || !Object.op_Implicit((Object)(object)_owner) || !_owner.HasSynergy(Synergy.MASTERY_RETINA)) { return; } Gun currentGun = ((GameActor)_owner).CurrentGun; if (currentGun == null || ((Component)currentGun).gameObject.GetComponent() == null) { return; } currentGun.MoveBulletsIntoClip(1); currentGun.GainAmmo(1); if (_killTracker < 3) { ((Component)currentGun).gameObject.Play("halo_double_kill_sound"); return; } Vector2 val = ((GameActor)_owner).CenterPosition; RoomHandler currentRoom = _owner.CurrentRoom; if (currentRoom != null) { bool flag = default(bool); IntVector2 centeredVisibleClearSpot = currentRoom.GetCenteredVisibleClearSpot(2, 2, ref flag, false); Vector2 val2 = ((IntVector2)(ref centeredVisibleClearSpot)).ToVector2(); if (flag) { val = val2; } } LootEngine.SpawnItem(((Component)ItemHelper.Get(Items.Armor)).gameObject, Vector2.op_Implicit(val), Vector2.zero, 0f, true, true, false); if (_killTracker < 4) { ((Component)currentGun).gameObject.Play("halo_triple_kill_sound"); return; } currentGun.GainAmmo(currentGun.AdjustedMaxAmmo); currentGun.MoveBulletsIntoClip(currentGun.DefaultModule.numberOfShotsInClip); ((Component)currentGun).gameObject.Play("halo_overkill_sound"); } private static float RetinaEmit(float t) { if (t < 0.4f) { return 0f; } if (t < 0.5f) { return 10f * (t - 0.4f); } return 1f; } private static float RetinaFade(float t) { if (t < 0.5f) { return t * 0.1f; } return 0.05f + 2f * (t - 0.5f); } private static float RetinaAmp(float t) { if (t < 0.5f) { return t * 0.05f; } return 0.025f + 2f * (t - 0.5f); } } public class OmnidirectionalLaser : CwaffGun { public class OmnidirectionalProjectile : MonoBehaviour { public bool mastered; } [HarmonyPatch(typeof(Gun), "HandleAimRotation")] private class OmnidirectionalLaserAimPatch { [HarmonyILManipulator] private static void OmnidirectionalLaserAimIL(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0066: 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_009a: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int num2 = 0; if (val.TryGotoNext((MoveType)0, new Func[2] { (Instruction instr) => ILPatternMatchingExt.MatchLdloc(instr, ref num2), (Instruction instr) => ILPatternMatchingExt.MatchStfld(instr, "prevGunAngleUnmodified") })) { int index = val.Index + 1; val.Index = index; val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc_S, (byte)num2); val.CallPrivate(typeof(OmnidirectionalLaser), "ForceGunAngle"); val.Emit(OpCodes.Stloc_S, (byte)num2); } } } public static string ItemName = "Omnidirectional Laser"; public static string ShortDescription = "Hula Hooplah"; public static string LongDescription = "Fires a strong laser in the direction of an orbiting targeting reticle. The reticle orbits more quickly each time a laser is fired, and orbits more slowly after a short period of inactivity."; public static string Lore = "Initially designed with hundreds of AI-guided lasers around its perimeter, budget cuts during production led to replacing the hundreds of lasers with a single laser that circled around the weapon's perimeter. Further budget cuts let to the removal of the AI targeting system, resulting in a final product that, while potent, is incredibly inconvenient to aim."; private const int _BASE_FPS = 8; private const int _MAX_FPS = 24; private const int _FPS_STEP = 1; private const float _FPS_RESET_TIME = 1f; private const float _FPS_RESET_SPEED = 0.125f; private const int _NUM_MASTERY_PROJ = 4; private const float _MASTERY_GAP = 72f; private const float _SNAP_DEVIATION = 30f; internal static CwaffTrailController _OmniTrailPrefab = null; internal static CwaffTrailController _OmniTrailMasteredPrefab = null; private static List _BackSpriteIds = new List(); private static List _BarrelOffsets = new List(); private static GameObject _OmniReticle = null; private tk2dSprite _backside; private tk2dSprite _reticle; private Vector2 _laserAngle = Vector2.zero; private int _currentFps = 8; private float _timeSinceLastShot; public static void Init() { //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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_016e: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: 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_01c8: 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_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: 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_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_07f4: Unknown result type (might be due to invalid IL or missing references) //IL_0a93: Expected O, but got Unknown //IL_0b01: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? idleFps = 8; int? shootFps = 8; Gun gun2 = gun.SetAttributes((ItemQuality)2, (GunClass)50, 0f, 250, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, idleFps, shootFps, null, null, null, null, null, null, -1, -1, 0, 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: true, (GunHandedness)4, autoPlay: true, attacksThroughWalls: false, suppressReloadLabel: false, 1f, onlyUsesIdleInWeaponBox: true).SetFireAudio("omni_spin_sound", 0, 1, 2, 3, 4, 5, 6, 7).Attach(); IntVector2 offset = new IntVector2(5, -4); IntVector2 flippedOffset = new IntVector2(4, -4); IntVector2? offsetPilot = new IntVector2(5, -4); IntVector2? flippedOffsetPilot = new IntVector2(5, -4); IntVector2? offsetConvict = new IntVector2(5, -4); IntVector2? flippedOffsetConvict = new IntVector2(5, -4); IntVector2? offsetRobot = new IntVector2(5, -4); IntVector2? flippedOffsetRobot = new IntVector2(4, -4); IntVector2? offsetSoldier = new IntVector2(6, -4); IntVector2? flippedOffsetSoldier = new IntVector2(6, -4); IntVector2? offsetGuide = new IntVector2(7, -4); IntVector2? flippedOffsetGuide = new IntVector2(7, -4); IntVector2? offsetCoopCultist = new IntVector2(5, -4); IntVector2? flippedOffsetCoopCultist = new IntVector2(5, -4); IntVector2? offsetBullet = new IntVector2(8, -4); IntVector2? flippedOffsetBullet = new IntVector2(8, -4); IntVector2? offsetEevee = new IntVector2(5, -4); IntVector2? flippedOffsetEevee = new IntVector2(5, -4); IntVector2? offsetGunslinger = new IntVector2(5, -4); IntVector2? flippedOffsetGunslinger = new IntVector2(5, -4); Gun gunRef; Gun gun3 = gun2.AddFlippedCarryPixelOffsets(offset, flippedOffset, offsetPilot, flippedOffsetPilot, offsetConvict, flippedOffsetConvict, offsetRobot, flippedOffsetRobot, null, null, null, null, offsetSoldier, flippedOffsetSoldier, offsetGuide, flippedOffsetGuide, offsetCoopCultist, flippedOffsetCoopCultist, offsetBullet, flippedOffsetBullet, offsetEevee, flippedOffsetEevee, offsetGunslinger, flippedOffsetGunslinger).AssignGun(out gunRef); int? clipSize = -1; float? cooldown = 0.1f; float? angleVariance = 0f; float? speed = 200f; float? damage = 16f; bool? uniqueSounds = true; gun3.InitProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "omnilaser_projectile", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, "omnilaser_shoot_sound", null, uniqueSounds)).Attach(delegate(OmnidirectionalProjectile o) { o.mastered = false; }).Assign(out Widowmaker._WidowTurretLaser); ProjectileModule[] array = (ProjectileModule[])(object)new ProjectileModule[4]; Projectile baseProjectile = Widowmaker._WidowTurretLaser.Clone(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "omnilaser_mastered_projectile", 2, (Anchor)4)).Attach(delegate(OmnidirectionalProjectile o) { o.mastered = true; }); for (int num = 0; num < 4; num++) { int num2 = num; ProjectileModule val = new ProjectileModule(); Gun gun4 = gunRef; shootFps = -1; damage = 0.1f; float angleFromAim = 72f * (float)(num + 1); speed = 0f; float? speed2 = 200f; float? damage2 = 8f; array[num2] = GunBuilder.InitSingleProjectileModule(val, GunData.New(gun4, baseProjectile, shootFps, damage, speed, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 0, null, customClip: false, damage2, speed2, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, null, null, null, null, null, angleFromAim, ignoredForReloadPurposes: true)); } gunRef.AddSynergyModules(Synergy.MASTERY_OMNIDIRECTIONAL_LASER, array); gunRef.shootAnimation = null; gunRef.PreventOutlines = true; for (int num3 = 1; num3 <= 8; num3++) { foreach (AttachPoint item in gunRef.AttachPointsForClip("omnidirectional_laser_idle", num3 - 1).EmptyIfNull()) { if (item.name == "Casing") { _BarrelOffsets.Add(item.position); } } _BackSpriteIds.Add(((BraveBehaviour)gunRef).sprite.Collection.GetSpriteIdByName($"omnidirectional_laser_fire_back_00{num3}")); } _OmniTrailPrefab = VFX.CreateSpriteTrailObject("omnilaser_projectile_trail", 60, null, -1f, 1f / 60f, 1f, destroyOnEmpty: true); _OmniTrailMasteredPrefab = VFX.CreateSpriteTrailObject("omnilaser_mastered_projectile_trail", 60, null, -1f, 1f / 60f, 1f, destroyOnEmpty: true); _OmniReticle = VFX.Create("omnilaser_reticle", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } private void CreateRenderersIfNecessary() { //IL_0014: 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_00d9: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) || (int)((GunBehaviour)this).PlayerOwner.CurrentInputState != 0) { return; } if (!Object.op_Implicit((Object)(object)_reticle)) { GameObject val = SpawnManager.SpawnVFX(_OmniReticle, ((BraveBehaviour)((GunBehaviour)this).gun).transform.position, Quaternion.identity); if (!Object.op_Implicit((Object)(object)val)) { return; } _reticle = val.GetComponent(); ((Component)(object)_reticle).SetAlphaImmediate(0f); } if (!Object.op_Implicit((Object)(object)_backside)) { _backside = Lazy.SpriteObject(((BraveBehaviour)((GunBehaviour)this).gun).sprite.Collection, ((BraveBehaviour)((GunBehaviour)this).gun).sprite.Collection.GetSpriteIdByName(((GunBehaviour)this).gun.InternalSpriteName() + "_idle_back_001")); ((BraveBehaviour)_backside).transform.position = ((BraveBehaviour)((GunBehaviour)this).gun).transform.position; ((BraveBehaviour)_backside).transform.parent = ((BraveBehaviour)((GunBehaviour)this).gun).transform; ((tk2dBaseSprite)_backside).HeightOffGround = -0.5f; ((tk2dBaseSprite)_backside).UpdateZDepth(); ((BraveBehaviour)((GunBehaviour)this).gun).sprite.AttachRenderer((tk2dBaseSprite)(object)_backside); } } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)_backside)) { ((BraveBehaviour)((GunBehaviour)this).gun).sprite.DetachRenderer((tk2dBaseSprite)(object)_backside); ((BraveBehaviour)_backside).transform.parent = null; Object.Destroy((Object)(object)((Component)_backside).gameObject); } _backside = null; if (Object.op_Implicit((Object)(object)_reticle)) { ((Component)_reticle).gameObject.SafeDestroy(); } _reticle = null; base.OnDestroy(); } public override void Update() { base.Update(); CreateRenderersIfNecessary(); } private void LateUpdate() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: 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_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: 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_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: 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) if (!Object.op_Implicit((Object)(object)_reticle) || !Object.op_Implicit((Object)(object)_backside)) { return; } if (!Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((BraveBehaviour)_backside).transform.position = ((BraveBehaviour)((GunBehaviour)this).gun).transform.position; ((BraveBehaviour)_backside).transform.parent = null; return; } ((GunBehaviour)this).gun.m_prepThrowTime = -999f; if ((_timeSinceLastShot += BraveTime.DeltaTime) > 1f && _currentFps >= 8) { _timeSinceLastShot -= 0.125f; _currentFps = Math.Max(_currentFps - 1, 8); ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.ClipFps = _currentFps; } if (!(((BraveBehaviour)_backside).renderer.enabled = ((Renderer)((GunBehaviour)this).gun.m_meshRenderer).enabled)) { ((BraveBehaviour)_backside).transform.parent = null; ((Component)(object)_reticle).SetAlpha(0f); return; } ((Component)(object)_reticle).SetAlpha(Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) ? 1f : 0f); if (!Object.op_Implicit((Object)(object)((BraveBehaviour)_backside).transform.parent)) { ((BraveBehaviour)_backside).transform.parent = ((BraveBehaviour)((GunBehaviour)this).gun).transform; ((BraveBehaviour)_backside).transform.position = ((BraveBehaviour)((GunBehaviour)this).gun).transform.position; } ((BraveBehaviour)_backside).transform.rotation = Quaternion.identity; ((tk2dBaseSprite)_backside).HeightOffGround = -0.5f; ((tk2dBaseSprite)_backside).UpdateZDepth(); int currentFrame = ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.CurrentFrame; ((BraveBehaviour)_backside).sprite.SetSprite(_BackSpriteIds[currentFrame]); ((GunBehaviour)this).gun.barrelOffset.localPosition = _BarrelOffsets[currentFrame]; if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { tk2dSpriteAnimationClip clipByName = ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.GetClipByName(((GunBehaviour)this).gun.InternalSpriteName() + "_fire"); if (((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.currentClip != clipByName) { ((BraveBehaviour)((GunBehaviour)this).gun).sprite.spriteId = clipByName.frames[0].spriteId; ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.currentClip = clipByName; ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.Play(); } _laserAngle = (292.5f - 45f * ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.clipTime).ToVector(); ((BraveBehaviour)_reticle).transform.position = Vector2.op_Implicit(((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition + 1.5f * _laserAngle); } } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { if (Object.op_Implicit((Object)(object)_backside) && Object.op_Implicit((Object)(object)((BraveBehaviour)_backside).renderer)) { ((BraveBehaviour)_backside).transform.parent = null; ((BraveBehaviour)_backside).renderer.enabled = false; } if (Object.op_Implicit((Object)(object)_reticle)) { ((Component)(object)_reticle).SetAlpha(0f); } ((GunBehaviour)this).PlayerOwner.forceAimPoint = null; } } public override void PostProcessProjectile(Projectile projectile) { //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_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_0053: 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_0067: 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_009a: Unknown result type (might be due to invalid IL or missing references) ((GunBehaviour)this).PostProcessProjectile(projectile); AIActor val = Vector2.op_Implicit(((GunBehaviour)this).gun.barrelOffset.position).NearestEnemyWithinConeOfVision(projectile.OriginalDirection(), 30f); if (Object.op_Implicit((Object)(object)val) && Lazy.DeterminePerfectAngleToShootAt(Vector2.op_Implicit(((GunBehaviour)this).gun.barrelOffset.position), ((GameActor)val).CenterPosition, (Vector2)(Object.op_Implicit((Object)(object)((BraveBehaviour)val).specRigidbody) ? ((BraveBehaviour)val).specRigidbody.Velocity : default(Vector2)), projectile.baseData.speed, out var shootAngle, out var _, adjustForTurboMode: false)) { projectile.SendInDirection(shootAngle.ToVector(), true, true); } OmnidirectionalProjectile component = ((Component)projectile).gameObject.GetComponent(); if (component != null) { ((Component)((BraveBehaviour)(object)projectile).AddTrail(component.mastered ? _OmniTrailMasteredPrefab : _OmniTrailPrefab)).gameObject.SetGlowiness(10f); } } public override void OnPostFired(PlayerController player, Gun gun) { ((GunBehaviour)this).OnPostFired(player, gun); _timeSinceLastShot = 0f; _currentFps = Math.Min(_currentFps + 1, 24); ((BraveBehaviour)gun).spriteAnimator.ClipFps = _currentFps; } private static float ForceGunAngle(Gun gun, float oldAngle) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) OmnidirectionalLaser component = ((Component)gun).GetComponent(); if (component == null) { return oldAngle; } return Vector2Extensions.ToAngle(component._laserAngle); } } public class Akelus : CwaffGun { public static string ItemName = "Akelus"; public static string ShortDescription = "Brute Force"; public static string LongDescription = "Leaps forward to smash the ground, destroying nearby bullets and sending enemies flying."; public static string Lore = "A warhammer that should by all appearances be far too heavy to wield for anyone not built like a Greek god. Two gravitic impellers (colloquially known as 'alien magic') are embedded in either side of the hammerhead, allowing the wielder to make the hammer's otherworldly weight someone else's problem."; internal static GameObject _ShockwaveVFX = null; private bool _isDoingAttack; private int _leapKnockbackId = -1; private static readonly int _IgnoreCollisions = CollisionMask.LayerToMask((CollisionLayer)4, (CollisionLayer)2, (CollisionLayer)3); public static void Init() { //IL_03aa: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 30; int? reloadFps = 4; Items? muzzleFrom = Items.Mailbox; gun.SetAttributes((ItemQuality)4, (GunClass)50, 0f, 20, Items.Banana, defaultAudio: false, infiniteAmmo: true, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "chain_launch_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, 1f, continuousFire: false, dynamicBarrelOffsets: true, banFromBlessedRuns: false, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0, autoPlay: true, attacksThroughWalls: false, suppressReloadLabel: true).AssignGun(out Gun gunRef).LoopAnimation(gunRef.shootAnimation, 1) .InitProjectile(GunData.New(null, null, -1, null, null, (ShootStyle)3, (ProjectileSequenceStyle)0, float.MaxValue, 1, null, customClip: false, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 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, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: true)); Color? emissiveColour = new Color(0.5f, 0.5f, 1f); _ShockwaveVFX = VFX.Create("akelus_impact_vfx", 12f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 10f, emissiveColour, orphaned: false, attached: true, unlit: false, 0f, 0f, null, 10f, 0f, useBetterEmission: true, 1f); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); if (base.Mastered) { player.SetImmuneToExplosions(value: true, ItemName); } } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); if (base.Mastered && Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((GunBehaviour)this).PlayerOwner.SetImmuneToExplosions(value: true, ItemName); } } public override void OnMasteryStatusChanged() { base.OnMasteryStatusChanged(); if (base.Mastered && Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((GunBehaviour)this).PlayerOwner.SetImmuneToExplosions(value: true, ItemName); } } public override void OnDroppedByPlayer(PlayerController player) { player.SetImmuneToExplosions(value: false, ItemName); base.OnDroppedByPlayer(player); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((GunBehaviour)this).PlayerOwner.SetImmuneToExplosions(value: false, ItemName); } base.OnDestroy(); } public override void OnSwitchedAwayFromThisGun() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((GunBehaviour)this).PlayerOwner.SetImmuneToExplosions(value: false, ItemName); } base.OnSwitchedAwayFromThisGun(); } public override void OnTriedToInitiateAttack(PlayerController player) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) base.OnTriedToInitiateAttack(player); player.SuppressThisClick = true; if (!player.IsDodgeRolling && (int)player.CurrentInputState == 0 && !((GunBehaviour)this).gun.IsReloading && (((GunBehaviour)this).gun.CurrentAmmo != 0 || ((GunBehaviour)this).gun.InfiniteAmmo) && !_isDoingAttack) { _isDoingAttack = true; if (!((GunBehaviour)this).gun.InfiniteAmmo) { ((GunBehaviour)this).gun.LoseAmmo(1); } ((MonoBehaviour)player).StartCoroutine(LungeAttack(player)); } } private static float GetHeight(float velocity, float gravity, float time) { return velocity * time - 0.5f * gravity * time * time; } private IEnumerator LungeAttack(PlayerController player) { bool delayInvulnerability = false; bool mastered = base.Mastered; Vector2 val = Vector3Extensions.XY(player.unadjustedAimPoint) - ((BraveBehaviour)player).sprite.WorldCenter; Vector2 val2 = (player.lockedDodgeRollDirection = ((Vector2)(ref val)).normalized); ((GameActor)player).SetIsFlying(true, ItemName, false, false); ((BraveBehaviour)player).spriteAnimator.Play(player.DodgeRollClipForDirection(val2), 0f, 40f, false); player.m_handlingQueuedAnimation = true; player.SetInputOverride(ItemName); ((PickupObject)((GunBehaviour)this).gun).CanBeDropped = false; player.IsGunLocked = true; player.inventory.GunLocked.AddOverride(ItemName, (float?)null); HealthHaver hh = ((BraveBehaviour)player).healthHaver; if (hh.vulnerable) { hh.TriggerInvulnerabilityPeriod(0.43333337f); } else { delayInvulnerability = true; } ((BraveBehaviour)player).specRigidbody.AddCollisionLayerIgnoreOverride(_IgnoreCollisions); int originalLayer = ((Component)player).gameObject.layer; GameObjectExtensions.SetLayerRecursively(((Component)player).gameObject, LayerMask.NameToLayer("Unoccluded")); Vector2 val3 = Vector2.op_Implicit(((BraveBehaviour)player).transform.position); Vector2 val4 = (((GameActor)player).CenterPosition + 6f * val2 - val3) / (1f / 3f); KnockbackDoer kb = ((BraveBehaviour)player).knockbackDoer; _leapKnockbackId = kb.ApplyContinuousKnockback(((Vector2)(ref val4)).normalized, ((Vector2)(ref val4)).magnitude * 0.1f * kb.weight); Transform spriteTransform = ((BraveBehaviour)((BraveBehaviour)player).sprite).transform; ((Component)this).gameObject.Play("akelus_lunge_sound"); for (float elapsed = 0f; elapsed < 1f / 3f; elapsed += BraveTime.DeltaTime) { spriteTransform.localPosition = Vector3Extensions.WithY(spriteTransform.localPosition, GetHeight(25f, 150f, elapsed)); yield return null; if (delayInvulnerability && hh.vulnerable) { delayInvulnerability = false; hh.TriggerInvulnerabilityPeriod(0.43333337f - elapsed); } } player.m_handlingQueuedAnimation = false; kb.EndContinuousKnockback(_leapKnockbackId); kb.SetImmobile(true, ItemName); _leapKnockbackId = -1; GameObjectExtensions.SetLayerRecursively(((Component)player).gameObject, originalLayer); ((GunBehaviour)this).gun.PlayIfExists(((GunBehaviour)this).gun.shootAnimation, false); yield return null; ((GunBehaviour)this).gun.DoSwingVFX(); Vector2 val5 = Vector2.op_Implicit(((GunBehaviour)this).gun.barrelOffset.position); Lazy.ScorchGroundAt(val5); Exploder.DoDistortionWave(val5, 1.25f, 0.5f, 1.5f, 0.175f); float num = 150f * player.DamageMult(); float num2 = 20f; float num3 = (mastered ? 25f : 16f); float horizontalForce = 100f * player.KnockbackMult(); float num4 = Mathf.Min(Mathf.Sqrt(num3), 10f); if (mastered) { PassiveReflectItem.ReflectBulletsInRange(val5, 3f, false, (GameActor)(object)player, 30f, 1f, 1f, false); } else { SilencerInstance.DestroyBulletsInRange(val5, 2f, true, false, player, false, (float?)null, false, (Action)null); } ((Component)this).gameObject.Play("akelus_impact_sound"); Lazy.LaunchAllEnemiesAroundPoint(num, num2, val5, 0f, num4, horizontalForce, 0.85f, 0.3f); Exploder.DoRadialMinorBreakableBreak(Vector2.op_Implicit(val5), num4); Exploder.DoRadialMajorBreakableDamage(num, Vector2.op_Implicit(val5), num4); Exploder.DoRadialPush(Vector2.op_Implicit(val5), num2, num4); GameManager.Instance.MainCameraController.DoScreenShake(new ScreenShakeSettings(0.5f, 2f, 0.1f, 0f), (Vector2?)val5, false); CwaffVFX.SpawnBurst(_ShockwaveVFX, (int)(num4 * 12f), val5, 0.95f * num4, null, 0f, 5f, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.Velocity); player.ClearTableSlides(); for (float elapsed = 0f; elapsed < 0.05f; elapsed += BraveTime.DeltaTime) { yield return null; if (delayInvulnerability && hh.vulnerable) { delayInvulnerability = false; hh.TriggerInvulnerabilityPeriod(0.1f - elapsed); } } ((GameActor)player).SetIsFlying(false, ItemName, false, false); ((BraveBehaviour)player).specRigidbody.RemoveCollisionLayerIgnoreOverride(_IgnoreCollisions); float num5 = 0.5f * Mathf.Min(1f / player.FireRateMult(), player.ReloadRateMult()); yield return (object)new WaitForSeconds(num5); player.inventory.GunLocked.RemoveOverride(ItemName); player.IsGunLocked = false; ((PickupObject)((GunBehaviour)this).gun).CanBeDropped = true; ((GunBehaviour)this).gun.DoSwingVFX(reverse: true); ((GunBehaviour)this).gun.PlayIdleAnimation(); player.ClearInputOverride(ItemName); kb.SetImmobile(false, ItemName); _isDoingAttack = false; } } public class Nightlighter : CwaffGun { public static string ItemName = "Nightlighter"; public static string ShortDescription = "Energy Efficient"; public static string LongDescription = "Fires strings of lights that entangle enemies and weigh them down. Up to 16 strings can be attached to an enemy, with each string reducing an enemy's speed by 10%."; public static string Lore = "The LED light string is an iconic staple of many a festivity and celebration. They're cheap, pretty, and easy to set up...at least the first time. When it comes time to tear them down, they have a propensity for magically tangling themselves up and becoming impossible to untangle the next time you want to use them. At least you can put this magical self-tangling to use in the Gungeon."; internal static tk2dSpriteAnimationClip _LightString = null; internal static tk2dSpriteAnimationClip _ShinyLightString = null; internal static Projectile _NightlighterProjectile = null; internal static bool _UseFancyLights = false; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 12; Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)2, (GunClass)50, 1.6f, 300, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, null, null, null, "nightlighter_fire_sound", 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, autoPlay: true, attacksThroughWalls: false, suppressReloadLabel: false, 1f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: false, preventRollingWhenCharging: false, 1f, 0.1f).SetReloadAudio("bulb_unscrew_sound_2", 0, 2).SetReloadAudio("bulb_replace_sound", 4) .SetReloadAudio("bulb_unscrew_sound_2", 8, 10) .AddDualWieldSynergy(Synergy.CABLE_MANAGEMENT) .AssignGun(out gunRef) .LoopAnimation(gunRef.emptyAnimation, 7); int? clipSize = 12; float? cooldown = 0.4f; float? damage = 11f; float? speed = 75f; float? range = 30f; float? force = 12f; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, 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, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: true, null, null, null, null, null, null, null, null, null, "nightlighter_impact_sound")).Attach().Assign(out _NightlighterProjectile); _LightString = VFX.Create("nightlighter_light_string", 12f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1).DefaultAnimation(); _ShinyLightString = VFX.Create("nightlighter_light_string_shiny", 12f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1).DefaultAnimation(); } public override void PostProcessProjectile(Projectile projectile) { ((GunBehaviour)this).PostProcessProjectile(projectile); ((Component)projectile).gameObject.GetComponent()?.Setup(this); } } public class LightStringDoer : MonoBehaviour { private bool _setup; public void Setup(Nightlighter gun, AIActor anchorEnemy = null, List enemyChain = null) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) Projectile component = ((Component)this).gameObject.GetComponent(); if (component != null) { new GameObject("lightstring").AddComponent().Setup(component, gun, anchorEnemy, enemyChain); } _setup = true; } private void Start() { if (!_setup) { Setup(null); } } } public class LightString : MonoBehaviour { private const int SEGMENTS = 20; private const int _MAX_ATTACHMENTS = 16; private const float _SPEED_MULT_PER_CHAIN = 0.8f; private PlayerController _owner; private Nightlighter _gun; private Projectile _projectile; private AIActor _enemy; private SpeculativeRigidbody _enemyBody; private AIActor _anchorEnemy; private SpeculativeRigidbody _anchorEnemyBody; private List _enemyChain; private CwaffRopeMesh _mesh; private Vector2 _endTransformOffset; private bool _connectedToGun; private bool _connectedToProjectile; private bool _connectedToEnemy; private bool _anchoredToEnemy; private bool _mastered; private bool _setup; private bool _active; private Material _mat; private float _lifetime; private bool _fancy; private static List _ExtantChainsOnFloor = new List(); private static ListDictionary _Attachments = new ListDictionary(); private static readonly List _ColorsPerFrame = new List(6) { new Color(1f, 0.45f, 0.4f), new Color(1f, 0.5f, 0.25f), new Color(1f, 0.85f, 0f), new Color(0.4f, 1f, 0.35f), new Color(0.6f, 0.85f, 1f), new Color(1f, 0.45f, 1f) }; public bool AttachedToGun { get { if (_active && _connectedToGun) { return (Object)(object)_gun != (Object)null; } return false; } } private void Start() { _ExtantChainsOnFloor.Add(this); } public void Setup(Projectile proj, Nightlighter gun, AIActor anchorEnemy, List enemyChain) { //IL_0198: 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_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) if (_setup) { return; } CwaffEvents.OnFloorEnded = (Action)Delegate.Remove(CwaffEvents.OnFloorEnded, new Action(CleanUpExtantChains)); CwaffEvents.OnFloorEnded = (Action)Delegate.Combine(CwaffEvents.OnFloorEnded, new Action(CleanUpExtantChains)); if (!Object.op_Implicit((Object)(object)proj)) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } _connectedToProjectile = true; _projectile = proj; proj.OnHitEnemy = (Action)Delegate.Combine(proj.OnHitEnemy, new Action(OnHitEnemy)); _enemyChain = enemyChain; if (_enemyChain == null) { _enemyChain = new List(); } ref PlayerController owner = ref _owner; GameActor owner2 = proj.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); _gun = gun; _anchorEnemy = anchorEnemy; _anchorEnemyBody = (Object.op_Implicit((Object)(object)anchorEnemy) ? ((BraveBehaviour)anchorEnemy).specRigidbody : null); _anchoredToEnemy = Object.op_Implicit((Object)(object)_anchorEnemy) && Object.op_Implicit((Object)(object)_anchorEnemyBody); _connectedToGun = (Object)(object)gun != (Object)null && !_anchoredToEnemy; _mastered = Object.op_Implicit((Object)(object)gun) && gun.Mastered; if (_mastered) { proj.pierceMinorBreakables = true; } Vector2 val = (Object.op_Implicit((Object)(object)anchorEnemy) ? _anchorEnemyBody.UnitCenter : (Object.op_Implicit((Object)(object)gun) ? Vector2.op_Implicit(((Component)((GunBehaviour)gun).gun.barrelOffset).transform.position) : proj.SafeCenter)); _fancy = Nightlighter._UseFancyLights; _mesh = CwaffRopeMesh.Create(_fancy ? Nightlighter._ShinyLightString : Nightlighter._LightString, val, val, 20, null, RopeSim.StretchPolicy.GROWPERMANENT); ((tk2dBaseSprite)_mesh.sprite).HeightOffGround = -10f; if (_fancy) { tk2dTiledSprite sprite = _mesh.sprite; float? glowAmount = 10f; float? glowColorPower = 10f; ((tk2dBaseSprite)(object)sprite).MakeGlowyBetter(glowAmount, null, glowColorPower, 0.125f); } else { tk2dTiledSprite sprite2 = _mesh.sprite; Color? glowColor = Color.white; float? glowColorPower = 10f; ((tk2dBaseSprite)(object)sprite2).SetGlowiness(50f, glowColor, null, null, glowColorPower); } _mat = ((BraveBehaviour)_mesh.sprite).renderer.material; _active = true; _setup = true; } private static void CleanUpExtantChains() { for (int num = _ExtantChainsOnFloor.Count - 1; num >= 0; num--) { if (Object.op_Implicit((Object)(object)_ExtantChainsOnFloor[num])) { Object.Destroy((Object)(object)((Component)_ExtantChainsOnFloor[num]).gameObject); } } _ExtantChainsOnFloor.Clear(); } private void OnHitEnemy(Projectile projectile, SpeculativeRigidbody rigidbody, bool arg3) { projectile.OnHitEnemy = (Action)Delegate.Remove(projectile.OnHitEnemy, new Action(OnHitEnemy)); if (Object.op_Implicit((Object)(object)this) && !_connectedToEnemy && Object.op_Implicit((Object)(object)rigidbody) && Object.op_Implicit((Object)(object)((BraveBehaviour)rigidbody).aiActor) && TryChainLinkEnemy(((BraveBehaviour)rigidbody).aiActor)) { projectile.DieInAir(false, true, true, false); } } private bool TryChainLinkEnemy(AIActor enemy) { //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_00dd: 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_00e8: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: 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) if (!Object.op_Implicit((Object)(object)enemy) || ((BraveBehaviour)enemy).healthHaver == null) { return false; } if (_enemyChain.Contains(enemy)) { return false; } SpeculativeRigidbody specRigidbody = ((BraveBehaviour)enemy).specRigidbody; if (specRigidbody == null) { return false; } _connectedToProjectile = false; _projectile = null; _connectedToGun = false; _connectedToEnemy = true; _enemy = enemy; _enemyBody = specRigidbody; SpeculativeRigidbody enemyBody = _enemyBody; enemyBody.OnPreMovement = (Action)Delegate.Combine(enemyBody.OnPreMovement, new Action(ChainDown)); if (!_Attachments.TryGetValue>(enemy, out var value)) { value = (List)(_Attachments[enemy] = new List()); } if (value.Count >= 16) { value.ChooseRandom().Disconnect(); } value.Add(this); _enemyChain.Add(enemy); Bounds bounds = ((BraveBehaviour)_enemy).sprite.GetBounds(); Vector3 size = ((Bounds)(ref bounds)).size; float num = 0.25f * size.x * Random.value * BraveUtility.RandomSign(); float num2 = 0.25f * size.y * Random.value * BraveUtility.RandomSign(); _endTransformOffset += new Vector2(num, num2); _mesh.endPos = ((GameActor)enemy).CenterPosition + _endTransformOffset; ((Component)this).gameObject.Play("light_string_attach_sound"); if (!_mastered) { return true; } foreach (AIActor item in ((GameActor)enemy).CenterPosition.GetAllNearbyEnemies(12f, ignoreWalls: false).InRandomOrder()) { if (!_enemyChain.Contains(item) && ((BraveBehaviour)item).specRigidbody != null) { Vector2 val = ((GameActor)item).CenterPosition - ((GameActor)enemy).CenterPosition; Projectile val2 = VolleyUtility.ShootSingleProjectile(Nightlighter._NightlighterProjectile, ((GameActor)enemy).CenterPosition, Vector2Extensions.ToAngle(val), false, (GameActor)(object)_owner); val2.SetOwnerAndStats((GameActor)(object)_owner); _owner.DoPostProcessProjectile(val2); ((BraveBehaviour)val2).specRigidbody.RegisterSpecificCollisionException(specRigidbody); ((Component)val2).gameObject.GetComponent().Setup(_gun, enemy, _enemyChain); break; } } return true; } private void ChainDown(SpeculativeRigidbody rigidbody) { //IL_0002: 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) rigidbody.Velocity *= 0.8f; } private void LateUpdate() { //IL_0071: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_031f: 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_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) float deltaTime = BraveTime.DeltaTime; if (_fancy) { _lifetime += deltaTime; float num = 5f * _lifetime; int num2 = (int)num; float num3 = num - (float)num2; if (num3 > 0.5f) { num3 = 1f - num3; } _mat.SetFloat(CwaffVFX._EmissivePowerId, 50f * num3); _mat.SetColor(CwaffVFX._EmissiveColorId, _ColorsPerFrame[num2 % 6]); } if (!_active) { PlayerController val = _owner; if (!Object.op_Implicit((Object)(object)val)) { val = GameManager.Instance.BestActivePlayer; } bool flag = (Object)(object)val == (Object)null || (Object)(object)_mesh == (Object)null; if (!flag) { Vector2 centerPosition = ((GameActor)val).CenterPosition; Vector2 val2 = centerPosition - _mesh.startPos; if (((Vector2)(ref val2)).sqrMagnitude >= 900f) { val2 = centerPosition - _mesh.endPos; if (((Vector2)(ref val2)).sqrMagnitude >= 900f) { flag = true; } } } if (flag) { Object.Destroy((Object)(object)((Component)this).gameObject); } return; } if (!_setup || deltaTime == 0f || GameManager.Instance.IsPaused) { return; } if (_anchoredToEnemy) { if (Object.op_Implicit((Object)(object)_anchorEnemy) && Object.op_Implicit((Object)(object)_anchorEnemyBody) && ((Behaviour)_anchorEnemyBody).enabled && !((GameActor)_anchorEnemy).IsGone) { HealthHaver healthHaver = ((BraveBehaviour)_anchorEnemy).healthHaver; if (healthHaver == null || !healthHaver.IsDead) { goto IL_01a7; } } _anchoredToEnemy = false; _anchorEnemy = null; _anchorEnemyBody = null; } goto IL_01a7; IL_0295: if (_connectedToGun && Object.op_Implicit((Object)(object)_gun)) { _mesh.startPos = Vector2.op_Implicit(((Component)((GunBehaviour)_gun).gun.barrelOffset).transform.position); } else if (_anchoredToEnemy && Object.op_Implicit((Object)(object)_anchorEnemyBody)) { _mesh.startPos = _anchorEnemyBody.UnitCenter; } if (Object.op_Implicit((Object)(object)_projectile)) { _mesh.endPos = _projectile.SafeCenter; return; } if (!Object.op_Implicit((Object)(object)_enemy) || !Object.op_Implicit((Object)(object)_enemyBody)) { Disconnect(); return; } BraveInput instanceForPlayer = BraveInput.GetInstanceForPlayer(_owner.PlayerIDX); if (!((Object)(object)instanceForPlayer == (Object)null) && !_owner.IsKeyboardAndMouse()) { _ = ((GameActor)_owner).CenterPosition + 20f * ((TwoAxisInputControl)instanceForPlayer.ActiveActions.Aim).Vector; } else { Vector3Extensions.XY(_owner.unadjustedAimPoint); } _mesh.endPos = _enemyBody.UnitCenter + _endTransformOffset; return; IL_01a7: if (_connectedToGun && (!Object.op_Implicit((Object)(object)_owner) || !Object.op_Implicit((Object)(object)_gun) || !Object.op_Implicit((Object)(object)((GunBehaviour)_gun).gun) || ((Object)(object)((GameActor)_owner).CurrentGun != (Object)(object)((GunBehaviour)_gun).gun && (Object)(object)_owner.CurrentSecondaryGun != (Object)(object)((GunBehaviour)_gun).gun))) { Disconnect(); return; } if (_connectedToProjectile && !Object.op_Implicit((Object)(object)_projectile)) { Disconnect(); return; } if (_connectedToEnemy) { if (Object.op_Implicit((Object)(object)_enemy) && Object.op_Implicit((Object)(object)_enemyBody) && ((Behaviour)_enemyBody).enabled && !((GameActor)_enemy).IsGone) { HealthHaver healthHaver2 = ((BraveBehaviour)_enemy).healthHaver; if (healthHaver2 == null || !healthHaver2.IsDead) { goto IL_0295; } } Disconnect(); return; } goto IL_0295; } internal void Disconnect(bool forDestroy = false) { DeregisterEvents(); if (_connectedToEnemy && _Attachments.TryGetValue>(_enemy, out var value)) { value.Remove(this); if (value.Count == 0) { _Attachments.Remove(_enemy); } } if (Object.op_Implicit((Object)(object)_enemyBody)) { SpeculativeRigidbody enemyBody = _enemyBody; enemyBody.OnPreMovement = (Action)Delegate.Remove(enemyBody.OnPreMovement, new Action(ChainDown)); } _connectedToEnemy = false; _enemy = null; _connectedToGun = false; _projectile = null; _connectedToProjectile = false; if (!forDestroy && Object.op_Implicit((Object)(object)_mesh)) { _mesh.LockWhenStationary(0.01f, keepAnimating: true); } _active = false; } private void DeregisterEvents() { if (Object.op_Implicit((Object)(object)_projectile)) { Projectile projectile = _projectile; projectile.OnHitEnemy = (Action)Delegate.Remove(projectile.OnHitEnemy, new Action(OnHitEnemy)); } } private void OnDestroy() { Disconnect(forDestroy: true); if (Object.op_Implicit((Object)(object)_mesh)) { Object.Destroy((Object)(object)((Component)_mesh).gameObject); } } } public class Zealot : CwaffGun { public static string ItemName = "Zealot"; public static string ShortDescription = "Relentless Drive"; public static string LongDescription = "Rapidly fires high damage rounds. Upon firing once, autofires until running out of ammo or exiting the current floor. Cannot be dropped or switched out while autofiring."; public static string Lore = "A gun with an unyielding fervor for combat. It's said that even the Lich himself could not contain its rampage upon firing it once. While the Lich likely didn't have to worry about running out of ammo, accidentally breaking chests, or cheesing off Bello, you unfortunately do not have those same luxuries."; private bool _zealous; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 60; int? reloadFps = 12; Gun gun2 = gun.SetAttributes((ItemQuality)2, (GunClass)55, 0.75f, 1200, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "zealot_shoot_sound", null, null, -1, -1, -1, null, modulesAreTiers: false, null, 60, 0.5f, (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: true); int? clipSize = -1; float? cooldown = 0.1f; float? damage = 10f; float? speed = 60f; float? range = 9999f; float? force = 12f; Projectile p = gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "zealot_projectile", 2, (Anchor)4, 0.5f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, null, "zealot_impact_sound")).Attach((Action)delegate(EasyTrailBullet trail) { //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_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_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_0052: 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_005d: Unknown result type (might be due to invalid IL or missing references) trail.TrailPos = ((BraveBehaviour)trail).transform.position; trail.StartWidth = 0.3f; trail.EndWidth = 0.05f; trail.LifeTime = 0.07f; trail.BaseColor = Color.red; trail.StartColor = Color.Lerp(Color.red, Color.white, 0.25f); trail.EndColor = Color.red; }, allowDuplicates: false); PickupObject obj = ItemHelper.Get(Items.WitchPistol); p.SetAllImpactVFX(((Gun)((obj is Gun) ? obj : null)).DefaultModule.projectiles[0].hitEffects.enemy); } public override void OnPostFired(PlayerController player, Gun gun) { ((GunBehaviour)this).OnPostFired(player, gun); if (!_zealous && gun.CurrentAmmo > 0) { Zealify(zealous: true, player); } else if (_zealous && gun.CurrentAmmo == 0) { Zealify(zealous: false, player); } } private void Zealify(bool zealous, PlayerController player) { _zealous = zealous; player.forceFire = zealous; ((PickupObject)((GunBehaviour)this).gun).CanBeDropped = !zealous; ((PickupObject)((GunBehaviour)this).gun).CanBeSold = !zealous; player.inventory.GunLocked.SetOverride(ItemName, zealous, (float?)null); } public override void Update() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 base.Update(); if (_zealous) { PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null && !playerOwner.AcceptingNonMotionInput && (int)playerOwner.CurrentInputState != 1) { playerOwner.HandleGunFiringInternal(((GunBehaviour)this).gun, BraveInput.GetInstanceForPlayer(playerOwner.PlayerIDX), (Object)(object)((GunBehaviour)this).gun == (Object)(object)playerOwner.CurrentSecondaryGun); } } } public override void OnMasteryStatusChanged() { base.OnMasteryStatusChanged(); canAttackWhileRolling = (((GunBehaviour)this).gun.LocalInfiniteAmmo = base.Mastered); } private void OnNewFloorLoaded(PlayerController player) { if (_zealous) { Zealify(zealous: false, player); } } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); player.OnNewFloorLoaded = (Action)Delegate.Combine(player.OnNewFloorLoaded, new Action(OnNewFloorLoaded)); canAttackWhileRolling = (((GunBehaviour)this).gun.LocalInfiniteAmmo = base.Mastered); Zealify(zealous: false, player); } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); player.OnReceivedDamage -= OnNewFloorLoaded; if (_zealous) { ((GunBehaviour)this).gun.CurrentAmmo = 0; } Zealify(zealous: false, player); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((GunBehaviour)this).PlayerOwner.OnReceivedDamage -= OnNewFloorLoaded; } base.OnDestroy(); } } public class Sextant : CwaffGun { public static string ItemName = "Sextant"; public static string ShortDescription = "Deadly Precision"; public static string LongDescription = "Fires a calculated, single-target shot that deals more damage the longer Sextant is trained on its target before firing. When completely locked on, fires a critical shot that heavily damages bosses and instantly kills non-boss enemies. Reloading toggles focus mode, which slows down movement speed to assist with aiming."; public static string Lore = "An essential instrument among mariners for centuries, repurposed against all odds as a deadly weapon. Holding it in your hands evokes painful memories of 10th grade trigonometry lessons. Should you ever be allowed a few seconds of respite in combat, you're certain this device will let you hit your enemies physically and psychologically *exactly* where it hurts most."; private const float _PHASE_TIME = 0.35f; private const float _SOUND_GAP = 0.0875f; private const int _MAX_PHASE = 6; private const float CALCULATOR_SYNERGY_MULT = 1.3f; internal static GameObject _MathSymbols = null; internal static CwaffTrailController _SextantTrailPrefab = null; private dfLabel _shotAngleLabel; private dfLabel _spreadLabel; private dfLabel _shotDistanceLabel; private dfLabel _reboundAngleLabel; private dfLabel _widthLabel; private dfLabel _heightLabel; private dfLabel _damageLabel; private List _labels = new List(); private Geometry _aimAngleArc; private Geometry _perfectShot; private Geometry _reboundShot; private Geometry _reboundArc; private Geometry _leftFocus; private Geometry _rightFocus; private Geometry _leftAdjSpread; private Geometry _rightAdjSpread; private Geometry _topBbox; private Geometry _bottomBbox; private Geometry _leftBbox; private Geometry _rightBbox; private Geometry _weakPointL; private Geometry _weakPointR; private Geometry _weakPointT; private Geometry _weakPointB; private Geometry _weakPointArcL; private Geometry _weakPointArcR; private Geometry _weakPointArcT; private Geometry _weakPointArcB; private List _shapes = new List(); private float _drawTimer; private float _soundTimer; private int _maxDrawablePhase; private float _lastAimAngle; private float _lastSpread; private float _lastTargetMag; private float _freezeTimer; private float _cooldownTimer; private float _slidingAngleWindow; private float _slidingMagWindow; private float _timeFocusing; private PixelCollider _lastCollider; private AIActor _targetActor; private Vector2 _lastNormal = Vector2.zero; private Vector2? _lastContact; private Vector2? _lastRebound; private bool _focused; private bool _uiElementsValid; public bool canDoCrit; private float[] phaseCompetion = new float[6]; public static void Init() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 14; int? reloadFps = 4; Items? muzzleFrom = Items.Mailbox; IntVector2? carryOffset = new IntVector2(6, 0); ((Projectile)(object)gun.SetAttributes((ItemQuality)3, (GunClass)15, 0.9f, 80, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "sextant_shoot_sound", null, null, -1, -1, -1, muzzleFrom, modulesAreTiers: false, null, 60, 1f, (Anchor)3, -1f, null, -1f, muzzleLit: false, 0f, 0f, null, carryOffset, preventRotation: false, 0f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: false, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0).InitSpecialProjectile(GunData.New(null, null, 1, 0.25f, damage: 50f, speed: 900f, range: 18f, force: 12f, angleVariance: 0f, shootStyle: (ShootStyle)0, sequenceStyle: (ProjectileSequenceStyle)0, chargeTime: 0f, ammoCost: 1, ammoType: null, customClip: true, recoil: null, poison: 0f, fire: 0f, freeze: 0f, slow: 0f, collidesWithEnemies: null, ignoreDamageCaps: null, collidesWithProjectiles: null, surviveRigidbodyCollisions: null, collidesWithTilemap: null, sprite: null, fps: 2, anchor: (Anchor)4, scale: 1f, anchorsChangeColliders: true, fixesScales: true, overrideColliderPixelSizes: null, overrideColliderOffsets: null, bossDamageMult: 1f, destroySound: null, shouldRotate: null, barrageSize: 1, shouldFlipHorizontally: null, shouldFlipVertically: null, useDummyChargeModule: false, invisibleProjectile: true))).Assign(out Projectile projectileRef); _MathSymbols = VFX.Create("math_symbols", 2f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _SextantTrailPrefab = CwaffTrailController.Convert(((Component)Items.Awp.AsGun().DefaultModule.projectiles[0]).gameObject.GetComponentInChildren()); _SextantTrailPrefab.usesStartAnimation = false; _SextantTrailPrefab.globalTimer = 0f; _SextantTrailPrefab.cascadeTimer = 0.02f; ((BraveBehaviour)(object)projectileRef).AddTrail(_SextantTrailPrefab); } private void Start() { RegenerateGeometry(); RegenerateLabels(); _uiElementsValid = true; } private void RegenerateGeometry() { foreach (Geometry shape in _shapes) { if (Object.op_Implicit((Object)(object)shape)) { Object.Destroy((Object)(object)((Component)shape).gameObject); } } _shapes.Clear(); _shapes.Add(_perfectShot = Geometry.Create(Geometry.Shape.LINE)); _shapes.Add(_reboundShot = Geometry.Create(Geometry.Shape.LINE)); _shapes.Add(_reboundArc = Geometry.Create(Geometry.Shape.CIRCLE)); _shapes.Add(_leftFocus = Geometry.Create(Geometry.Shape.LINE)); _shapes.Add(_rightFocus = Geometry.Create(Geometry.Shape.LINE)); _shapes.Add(_leftAdjSpread = Geometry.Create(Geometry.Shape.DASHEDLINE)); _shapes.Add(_rightAdjSpread = Geometry.Create(Geometry.Shape.DASHEDLINE)); _shapes.Add(_aimAngleArc = Geometry.Create(Geometry.Shape.CIRCLE)); _shapes.Add(_topBbox = Geometry.Create(Geometry.Shape.DASHEDLINE)); _shapes.Add(_bottomBbox = Geometry.Create(Geometry.Shape.DASHEDLINE)); _shapes.Add(_leftBbox = Geometry.Create(Geometry.Shape.DASHEDLINE)); _shapes.Add(_rightBbox = Geometry.Create(Geometry.Shape.DASHEDLINE)); _shapes.Add(_weakPointL = Geometry.Create(Geometry.Shape.DASHEDLINE)); _shapes.Add(_weakPointR = Geometry.Create(Geometry.Shape.DASHEDLINE)); _shapes.Add(_weakPointT = Geometry.Create(Geometry.Shape.DASHEDLINE)); _shapes.Add(_weakPointB = Geometry.Create(Geometry.Shape.DASHEDLINE)); _shapes.Add(_weakPointArcL = Geometry.Create(Geometry.Shape.CIRCLE)); _shapes.Add(_weakPointArcR = Geometry.Create(Geometry.Shape.CIRCLE)); _shapes.Add(_weakPointArcT = Geometry.Create(Geometry.Shape.CIRCLE)); _shapes.Add(_weakPointArcB = Geometry.Create(Geometry.Shape.CIRCLE)); } private void RegenerateLabels() { foreach (dfLabel label in _labels) { if (Object.op_Implicit((Object)(object)label)) { Object.Destroy((Object)(object)((Component)label).gameObject); } } _labels.Clear(); _labels.Add(_shotAngleLabel = EasyLabel.Create(unicode: true, outline: false, (TextAlignment)1)); _labels.Add(_spreadLabel = EasyLabel.Create(unicode: true, outline: false, (TextAlignment)1)); _labels.Add(_shotDistanceLabel = EasyLabel.Create(unicode: true, outline: false, (TextAlignment)1)); _labels.Add(_reboundAngleLabel = EasyLabel.Create(unicode: true, outline: false, (TextAlignment)1)); _labels.Add(_widthLabel = EasyLabel.Create(unicode: true, outline: false, (TextAlignment)1)); _labels.Add(_heightLabel = EasyLabel.Create(unicode: true, outline: false, (TextAlignment)0)); _labels.Add(_damageLabel = EasyLabel.Create(unicode: true, outline: false, (TextAlignment)1)); } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); ResetCalculations(); SetFocus(focus: false); } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); ResetCalculations(); SetFocus(focus: false); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); SetFocus(focus: false); player.OnRollStarted += OnDodgeRoll; } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); player.OnRollStarted -= OnDodgeRoll; SetFocus(focus: false); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((GunBehaviour)this).PlayerOwner.OnRollStarted -= OnDodgeRoll; SetFocus(focus: false); } foreach (Geometry shape in _shapes) { if (Object.op_Implicit((Object)(object)shape)) { Object.Destroy((Object)(object)((Component)shape).gameObject); } } foreach (dfLabel label in _labels) { if (Object.op_Implicit((Object)(object)label)) { Object.Destroy((Object)(object)((Component)label).gameObject); } } base.OnDestroy(); } public override void OnFullClipReload(PlayerController player, Gun gun) { base.OnFullClipReload(player, gun); if (!gun.IsReloading && !player.IsDodgeRolling && player.AcceptingNonMotionInput) { SetFocus(!_focused); ((Component)this).gameObject.Play(_focused ? "sextant_focus_sound" : "sextant_unfocus_sound"); } } private void ForceFireGun() { PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null && !((Object)(object)((GameActor)playerOwner).CurrentGun != (Object)(object)((GunBehaviour)this).gun)) { playerOwner.forceFireDown = true; } } private void SetFocus(bool focus) { if (focus != _focused) { _focused = focus; GunTools.RemoveStatFromGun(((GunBehaviour)this).gun, (StatType)0); ((GunBehaviour)this).gun.AddStatToGun(((StatType)0).Mult(focus ? 0.25f : 1f)); ((GunBehaviour)this).PlayerOwner.stats.RecalculateStats(((GunBehaviour)this).PlayerOwner, false, false); } } private void ResetCalculations(bool postShotCooldown = false) { canDoCrit = false; _drawTimer = 0f; _soundTimer = 0f; _freezeTimer = 0f; _slidingAngleWindow = 0f; _slidingMagWindow = 0f; _timeFocusing = 0f; if (postShotCooldown) { _cooldownTimer = Mathf.Max(_cooldownTimer, ((GunBehaviour)this).gun.AdjustedReloadTime); return; } _cooldownTimer = 0f; HideHUDElements(); } private void HideHUDElements() { foreach (Geometry shape in _shapes) { if (Object.op_Implicit((Object)(object)shape)) { shape.Disable(); } } foreach (dfLabel label in _labels) { if (Object.op_Implicit((Object)(object)label)) { ((dfControl)label).Opacity = 0f; ((dfControl)label).IsVisible = false; } } } public override void PostProcessProjectile(Projectile projectile) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_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_00bb: 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_00d9: 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) ((GunBehaviour)this).PostProcessProjectile(projectile); if (projectile is PrecisionProjectile precisionProjectile) { precisionProjectile.isCrit = canDoCrit; precisionProjectile.target = _targetActor; ProjectileData baseData = ((Projectile)precisionProjectile).baseData; baseData.damage *= GetDamageMultFromFocusTime(); Vector2? val = _lastRebound ?? _lastContact; if (val.HasValue) { Vector2 valueOrDefault = val.GetValueOrDefault(); float num = (canDoCrit ? 5f : 2f); Vector2 val2 = (_lastRebound.HasValue ? _lastContact.Value : Vector2.op_Implicit(((GunBehaviour)this).gun.barrelOffset.position)) - valueOrDefault; CwaffVFX.SpawnBurst(_MathSymbols, canDoCrit ? 20 : 6, valueOrDefault, 1f, num * ((Vector2)(ref val2)).normalized, 0f, num - 1f, CwaffVFX.Vel.Radial, CwaffVFX.Rot.None, 0.5f, 0.5f, 0f, null, fadeIn: false, uniform: false, null, null, null, randomFrame: true); } } } public override void OnPostFired(PlayerController player, Gun gun) { //IL_0021: 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_0037: Unknown result type (might be due to invalid IL or missing references) ((GunBehaviour)this).OnPostFired(player, gun); ResetCalculations(postShotCooldown: true); float num = 3f; CwaffVFX.SpawnBurst(_MathSymbols, 8, Vector2.op_Implicit(gun.barrelOffset.position), 1f, gun.gunAngle.ToVector(num), 0f, num - 1f, CwaffVFX.Vel.Radial, CwaffVFX.Rot.None, 0.5f, 0.5f, 0f, null, fadeIn: false, uniform: false, null, null, null, randomFrame: true); SetFocus(focus: false); } private void OnDodgeRoll(PlayerController player, Vector2 dirVec) { SetFocus(focus: false); } private float GetDamageMultFromFocusTime() { return Mathf.Clamp01(_drawTimer / 0.35f / (float)_maxDrawablePhase); } public bool Untargetable(SpeculativeRigidbody body) { int num; if (Object.op_Implicit((Object)(object)body)) { AIActor aiActor = ((BraveBehaviour)body).aiActor; if (aiActor != null && ((Behaviour)aiActor).isActiveAndEnabled && aiActor.IsWorthShootingAt && !Object.op_Implicit((Object)(object)aiActor.CompanionOwner)) { HealthHaver healthHaver = ((BraveBehaviour)aiActor).healthHaver; if (healthHaver != null && healthHaver.IsAlive) { num = ((!healthHaver.isPlayerCharacter) ? 1 : 0); goto IL_004d; } } } num = 0; goto IL_004d; IL_004d: return num == 0; } public override void Update() { //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_0312: 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_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0338: 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_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0351: 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_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0386: 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_038d: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: 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_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_017b: 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_051f: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: 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_0578: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_0586: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: 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_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_05b8: Unknown result type (might be due to invalid IL or missing references) //IL_05c0: Unknown result type (might be due to invalid IL or missing references) //IL_05c5: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_04ed: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_05d7: Unknown result type (might be due to invalid IL or missing references) //IL_05df: Unknown result type (might be due to invalid IL or missing references) //IL_05e4: 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_0518: Unknown result type (might be due to invalid IL or missing references) //IL_066d: Unknown result type (might be due to invalid IL or missing references) //IL_05ef: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_0651: Unknown result type (might be due to invalid IL or missing references) //IL_07b8: Unknown result type (might be due to invalid IL or missing references) //IL_07ba: Unknown result type (might be due to invalid IL or missing references) //IL_080e: Unknown result type (might be due to invalid IL or missing references) //IL_0815: Unknown result type (might be due to invalid IL or missing references) //IL_0896: Unknown result type (might be due to invalid IL or missing references) //IL_0898: Unknown result type (might be due to invalid IL or missing references) //IL_08b5: Unknown result type (might be due to invalid IL or missing references) //IL_08be: Unknown result type (might be due to invalid IL or missing references) //IL_08c3: Unknown result type (might be due to invalid IL or missing references) //IL_08d5: Unknown result type (might be due to invalid IL or missing references) //IL_08da: 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_0932: Unknown result type (might be due to invalid IL or missing references) //IL_0937: Unknown result type (might be due to invalid IL or missing references) //IL_093c: Unknown result type (might be due to invalid IL or missing references) //IL_093e: Unknown result type (might be due to invalid IL or missing references) //IL_094d: Unknown result type (might be due to invalid IL or missing references) //IL_0952: Unknown result type (might be due to invalid IL or missing references) //IL_0957: Unknown result type (might be due to invalid IL or missing references) //IL_0959: Unknown result type (might be due to invalid IL or missing references) //IL_0968: Unknown result type (might be due to invalid IL or missing references) //IL_096d: Unknown result type (might be due to invalid IL or missing references) //IL_0972: Unknown result type (might be due to invalid IL or missing references) //IL_097a: Unknown result type (might be due to invalid IL or missing references) //IL_0981: Unknown result type (might be due to invalid IL or missing references) //IL_0988: Unknown result type (might be due to invalid IL or missing references) //IL_098a: Unknown result type (might be due to invalid IL or missing references) //IL_098e: Unknown result type (might be due to invalid IL or missing references) //IL_09cd: Unknown result type (might be due to invalid IL or missing references) //IL_09d4: Unknown result type (might be due to invalid IL or missing references) //IL_09db: Unknown result type (might be due to invalid IL or missing references) //IL_09dd: Unknown result type (might be due to invalid IL or missing references) //IL_09e1: Unknown result type (might be due to invalid IL or missing references) //IL_0a37: Unknown result type (might be due to invalid IL or missing references) //IL_0a3e: Unknown result type (might be due to invalid IL or missing references) //IL_0a91: Unknown result type (might be due to invalid IL or missing references) //IL_0a98: Unknown result type (might be due to invalid IL or missing references) //IL_0b07: Unknown result type (might be due to invalid IL or missing references) //IL_0b09: Unknown result type (might be due to invalid IL or missing references) //IL_0b26: Unknown result type (might be due to invalid IL or missing references) //IL_0b2f: Unknown result type (might be due to invalid IL or missing references) //IL_0b34: Unknown result type (might be due to invalid IL or missing references) //IL_0b46: Unknown result type (might be due to invalid IL or missing references) //IL_0b4b: Unknown result type (might be due to invalid IL or missing references) //IL_0b74: Unknown result type (might be due to invalid IL or missing references) //IL_0b7b: Unknown result type (might be due to invalid IL or missing references) //IL_0bf5: Unknown result type (might be due to invalid IL or missing references) //IL_0bf7: Unknown result type (might be due to invalid IL or missing references) //IL_0c14: Unknown result type (might be due to invalid IL or missing references) //IL_0c23: Unknown result type (might be due to invalid IL or missing references) //IL_0c28: Unknown result type (might be due to invalid IL or missing references) //IL_0c3a: Unknown result type (might be due to invalid IL or missing references) //IL_0c3f: Unknown result type (might be due to invalid IL or missing references) //IL_0c63: Unknown result type (might be due to invalid IL or missing references) //IL_0c72: Unknown result type (might be due to invalid IL or missing references) //IL_0c79: Unknown result type (might be due to invalid IL or missing references) //IL_0cdc: Unknown result type (might be due to invalid IL or missing references) //IL_0ce0: Unknown result type (might be due to invalid IL or missing references) //IL_0ce2: Unknown result type (might be due to invalid IL or missing references) //IL_0ce7: Unknown result type (might be due to invalid IL or missing references) //IL_0cec: Unknown result type (might be due to invalid IL or missing references) //IL_0d0b: Unknown result type (might be due to invalid IL or missing references) //IL_0d12: Unknown result type (might be due to invalid IL or missing references) //IL_0d24: Unknown result type (might be due to invalid IL or missing references) //IL_0d8d: Unknown result type (might be due to invalid IL or missing references) //IL_0d8f: Unknown result type (might be due to invalid IL or missing references) //IL_0dac: Unknown result type (might be due to invalid IL or missing references) //IL_0db6: Unknown result type (might be due to invalid IL or missing references) //IL_0db8: Unknown result type (might be due to invalid IL or missing references) //IL_0dbd: Unknown result type (might be due to invalid IL or missing references) //IL_0dc2: Unknown result type (might be due to invalid IL or missing references) //IL_0e3b: Unknown result type (might be due to invalid IL or missing references) //IL_0e40: Unknown result type (might be due to invalid IL or missing references) //IL_0e4d: Unknown result type (might be due to invalid IL or missing references) //IL_0e54: Unknown result type (might be due to invalid IL or missing references) //IL_0e59: Unknown result type (might be due to invalid IL or missing references) //IL_0e5e: Unknown result type (might be due to invalid IL or missing references) //IL_0e68: Unknown result type (might be due to invalid IL or missing references) //IL_0e6d: Unknown result type (might be due to invalid IL or missing references) //IL_0e71: Unknown result type (might be due to invalid IL or missing references) //IL_0e76: Unknown result type (might be due to invalid IL or missing references) //IL_0e78: Unknown result type (might be due to invalid IL or missing references) //IL_0e8a: Unknown result type (might be due to invalid IL or missing references) //IL_0e8f: Unknown result type (might be due to invalid IL or missing references) //IL_0e91: Unknown result type (might be due to invalid IL or missing references) //IL_0e96: Unknown result type (might be due to invalid IL or missing references) //IL_0e9b: Unknown result type (might be due to invalid IL or missing references) //IL_0ea0: Unknown result type (might be due to invalid IL or missing references) //IL_0ea2: Unknown result type (might be due to invalid IL or missing references) //IL_0eb4: Unknown result type (might be due to invalid IL or missing references) //IL_0eb9: Unknown result type (might be due to invalid IL or missing references) //IL_0ebb: Unknown result type (might be due to invalid IL or missing references) //IL_0ec0: Unknown result type (might be due to invalid IL or missing references) //IL_0ec5: Unknown result type (might be due to invalid IL or missing references) //IL_0eca: Unknown result type (might be due to invalid IL or missing references) //IL_0ecc: Unknown result type (might be due to invalid IL or missing references) //IL_0ede: Unknown result type (might be due to invalid IL or missing references) //IL_0ee3: Unknown result type (might be due to invalid IL or missing references) //IL_0ee5: Unknown result type (might be due to invalid IL or missing references) //IL_0eea: Unknown result type (might be due to invalid IL or missing references) //IL_0eef: Unknown result type (might be due to invalid IL or missing references) //IL_0ef4: Unknown result type (might be due to invalid IL or missing references) //IL_0ef6: Unknown result type (might be due to invalid IL or missing references) //IL_0f08: Unknown result type (might be due to invalid IL or missing references) //IL_0f0d: Unknown result type (might be due to invalid IL or missing references) //IL_0f0f: Unknown result type (might be due to invalid IL or missing references) //IL_0f14: Unknown result type (might be due to invalid IL or missing references) //IL_0f19: Unknown result type (might be due to invalid IL or missing references) //IL_0f1e: Unknown result type (might be due to invalid IL or missing references) //IL_0f26: Unknown result type (might be due to invalid IL or missing references) //IL_0f2d: Unknown result type (might be due to invalid IL or missing references) //IL_0f34: Unknown result type (might be due to invalid IL or missing references) //IL_0f70: Unknown result type (might be due to invalid IL or missing references) //IL_0f77: Unknown result type (might be due to invalid IL or missing references) //IL_0f7e: Unknown result type (might be due to invalid IL or missing references) //IL_0fba: Unknown result type (might be due to invalid IL or missing references) //IL_0fc1: Unknown result type (might be due to invalid IL or missing references) //IL_0fc8: Unknown result type (might be due to invalid IL or missing references) //IL_1004: Unknown result type (might be due to invalid IL or missing references) //IL_100b: Unknown result type (might be due to invalid IL or missing references) //IL_1012: Unknown result type (might be due to invalid IL or missing references) //IL_1058: Unknown result type (might be due to invalid IL or missing references) //IL_105f: Unknown result type (might be due to invalid IL or missing references) //IL_1082: Unknown result type (might be due to invalid IL or missing references) //IL_1084: Unknown result type (might be due to invalid IL or missing references) //IL_10a6: Unknown result type (might be due to invalid IL or missing references) //IL_10a8: Unknown result type (might be due to invalid IL or missing references) //IL_10aa: Unknown result type (might be due to invalid IL or missing references) //IL_10af: Unknown result type (might be due to invalid IL or missing references) //IL_10be: Unknown result type (might be due to invalid IL or missing references) //IL_10c3: Unknown result type (might be due to invalid IL or missing references) //IL_10e3: Unknown result type (might be due to invalid IL or missing references) //IL_10ea: Unknown result type (might be due to invalid IL or missing references) //IL_110d: Unknown result type (might be due to invalid IL or missing references) //IL_110f: Unknown result type (might be due to invalid IL or missing references) //IL_1131: Unknown result type (might be due to invalid IL or missing references) //IL_1133: Unknown result type (might be due to invalid IL or missing references) //IL_1135: Unknown result type (might be due to invalid IL or missing references) //IL_113a: Unknown result type (might be due to invalid IL or missing references) //IL_1149: Unknown result type (might be due to invalid IL or missing references) //IL_114e: Unknown result type (might be due to invalid IL or missing references) //IL_1173: Unknown result type (might be due to invalid IL or missing references) //IL_1175: Unknown result type (might be due to invalid IL or missing references) //IL_1177: Unknown result type (might be due to invalid IL or missing references) //IL_117c: Unknown result type (might be due to invalid IL or missing references) //IL_1181: Unknown result type (might be due to invalid IL or missing references) //IL_1188: Unknown result type (might be due to invalid IL or missing references) //IL_118a: Unknown result type (might be due to invalid IL or missing references) //IL_118c: Unknown result type (might be due to invalid IL or missing references) //IL_1191: Unknown result type (might be due to invalid IL or missing references) //IL_1196: Unknown result type (might be due to invalid IL or missing references) //IL_119d: Unknown result type (might be due to invalid IL or missing references) //IL_119f: Unknown result type (might be due to invalid IL or missing references) //IL_11a1: Unknown result type (might be due to invalid IL or missing references) //IL_11a6: Unknown result type (might be due to invalid IL or missing references) //IL_11ab: Unknown result type (might be due to invalid IL or missing references) //IL_11b2: Unknown result type (might be due to invalid IL or missing references) //IL_11b4: Unknown result type (might be due to invalid IL or missing references) //IL_11b6: Unknown result type (might be due to invalid IL or missing references) //IL_11bb: Unknown result type (might be due to invalid IL or missing references) //IL_11c0: Unknown result type (might be due to invalid IL or missing references) //IL_11c7: Unknown result type (might be due to invalid IL or missing references) //IL_11ce: Unknown result type (might be due to invalid IL or missing references) //IL_11d6: Unknown result type (might be due to invalid IL or missing references) //IL_11dd: Unknown result type (might be due to invalid IL or missing references) //IL_11fd: Unknown result type (might be due to invalid IL or missing references) //IL_1204: Unknown result type (might be due to invalid IL or missing references) //IL_120b: Unknown result type (might be due to invalid IL or missing references) //IL_120f: Unknown result type (might be due to invalid IL or missing references) //IL_1211: Unknown result type (might be due to invalid IL or missing references) //IL_1213: Unknown result type (might be due to invalid IL or missing references) //IL_1218: Unknown result type (might be due to invalid IL or missing references) //IL_121d: Unknown result type (might be due to invalid IL or missing references) //IL_125c: Unknown result type (might be due to invalid IL or missing references) //IL_1263: Unknown result type (might be due to invalid IL or missing references) //IL_126a: Unknown result type (might be due to invalid IL or missing references) //IL_126e: Unknown result type (might be due to invalid IL or missing references) //IL_1270: Unknown result type (might be due to invalid IL or missing references) //IL_1272: Unknown result type (might be due to invalid IL or missing references) //IL_1277: Unknown result type (might be due to invalid IL or missing references) //IL_127c: Unknown result type (might be due to invalid IL or missing references) //IL_12bb: Unknown result type (might be due to invalid IL or missing references) //IL_12c2: Unknown result type (might be due to invalid IL or missing references) //IL_12c9: Unknown result type (might be due to invalid IL or missing references) //IL_12cd: Unknown result type (might be due to invalid IL or missing references) //IL_12cf: Unknown result type (might be due to invalid IL or missing references) //IL_12d1: Unknown result type (might be due to invalid IL or missing references) //IL_12d6: Unknown result type (might be due to invalid IL or missing references) //IL_12db: Unknown result type (might be due to invalid IL or missing references) //IL_131a: Unknown result type (might be due to invalid IL or missing references) //IL_1321: Unknown result type (might be due to invalid IL or missing references) //IL_1328: Unknown result type (might be due to invalid IL or missing references) //IL_132c: Unknown result type (might be due to invalid IL or missing references) //IL_132e: Unknown result type (might be due to invalid IL or missing references) //IL_1330: Unknown result type (might be due to invalid IL or missing references) //IL_1335: Unknown result type (might be due to invalid IL or missing references) //IL_133a: Unknown result type (might be due to invalid IL or missing references) //IL_1379: Unknown result type (might be due to invalid IL or missing references) //IL_1380: Unknown result type (might be due to invalid IL or missing references) //IL_13cc: Unknown result type (might be due to invalid IL or missing references) //IL_13d3: Unknown result type (might be due to invalid IL or missing references) //IL_141f: Unknown result type (might be due to invalid IL or missing references) //IL_1426: Unknown result type (might be due to invalid IL or missing references) //IL_1472: Unknown result type (might be due to invalid IL or missing references) //IL_1479: Unknown result type (might be due to invalid IL or missing references) base.Update(); float deltaTime = BraveTime.DeltaTime; if (GameManager.Instance.IsLoadingLevel) { _uiElementsValid = false; return; } if (!_uiElementsValid || _shapes.Count == 0 || !Object.op_Implicit((Object)(object)_shapes[0]) || _labels.Count == 0 || !Object.op_Implicit((Object)(object)_labels[0])) { RegenerateGeometry(); RegenerateLabels(); _uiElementsValid = true; } if (GameManager.Instance.IsPaused) { HideHUDElements(); } else { if (deltaTime == 0f) { return; } PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null) { return; } playerOwner.forceFireDown = false; float num = deltaTime; if (playerOwner.HasSynergy(Synergy.YOU_MAY_USE_A_CALCULATOR)) { num *= 1.3f; } if (!((GunBehaviour)this).gun.IsReloading && ((GunBehaviour)this).gun.ClipShotsRemaining < Mathf.Min(((GunBehaviour)this).gun.ClipCapacity, ((GunBehaviour)this).gun.CurrentAmmo)) { ((GunBehaviour)this).gun.Reload(); } if (((GunBehaviour)this).gun.IsReloading || _cooldownTimer > 0f) { _cooldownTimer = Mathf.Max(_cooldownTimer - num, 0f); float num2 = num / ((GunBehaviour)this).gun.AdjustedReloadTime; float num3 = _cooldownTimer / ((GunBehaviour)this).gun.AdjustedReloadTime; foreach (Geometry shape in _shapes) { if (shape.shape != Geometry.Shape.NONE) { shape.Place(Vector3Extensions.WithAlpha(shape.color, num3)); } } { foreach (dfLabel label in _labels) { ((dfControl)label).Opacity = Mathf.Max(((dfControl)label).Opacity - num2, 0f); StabilizeLabel(label); } return; } } _freezeTimer = Mathf.Max(_freezeTimer - num, 0f); if (_freezeTimer == 0f) { _drawTimer += num; _soundTimer += num; if (_soundTimer >= 0.0875f && _drawTimer <= (float)_maxDrawablePhase * 0.35f + 0.05f) { _soundTimer -= 0.0875f; ((Component)this).gameObject.Play("sextant_calculate_sound"); } } _ = Pixelator.Instance.ScaleTileScale / Pixelator.Instance.CurrentTileScale / 64f; Gun currentGun = ((GameActor)playerOwner).CurrentGun; ProjectileModule defaultModule = currentGun.DefaultModule; float statValue = playerOwner.stats.GetStatValue((StatType)2); _ = ((BraveBehaviour)playerOwner).sprite.WorldBottomCenter; Vector2 val = Vector2.op_Implicit(currentGun.barrelOffset.position + currentGun.gunAngle.EulerZ() * defaultModule.positionOffset); float num4 = defaultModule.angleVariance * statValue; float num5 = Vector2Extensions.ToAngle(Vector3Extensions.XY(playerOwner.unadjustedAimPoint) - val); int num6 = CollisionMask.LayerToMask((CollisionLayer)2, (CollisionLayer)3, (CollisionLayer)8); int num7 = CollisionMask.LayerToMask((CollisionLayer)6); Vector2 val2 = Vector2.zero; Vector2 val3 = Vector2.zero; Vector2 val4 = num5.ToVector(); Vector2 val5 = val4; float num8 = 5f; PixelCollider lastCollider = null; float num9 = 1f; Color val6 = Color.red; Color value = ExtendedColours.pink; Color val7 = ExtendedColours.vibrantOrange; Color val8 = Color.green; Color val9 = Color.cyan; Color val10 = Color.yellow; Color value2 = Color.magenta; if (canDoCrit) { value2 = (val10 = (val9 = (val8 = (val7 = (value = (val6 = Color.Lerp(Color.white, Color.gray, Mathf.Abs(Mathf.Sin(10f * BraveTime.ScaledTimeSinceStartup))))))))); } AIActor targetActor = _targetActor; _targetActor = null; _lastContact = null; _lastRebound = null; bool flag = false; RaycastResult val11 = default(RaycastResult); bool flag2 = PhysicsEngine.Instance.Raycast(val, val4, 999f, ref val11, true, false, num7, (CollisionLayer?)null, false, (Func)null, (SpeculativeRigidbody)null); if (flag2 && ((CastResult)val11).Normal != Vector2.zero) { num8 = val11.Distance; val2 = ((CastResult)val11).Contact; val3 = ((CastResult)val11).Normal; if (PhysicsEngine.Instance.Raycast(val, val4.Rotate(1f), 999f, ref val11, true, false, num7, (CollisionLayer?)null, false, (Func)null, (SpeculativeRigidbody)null) && ((CastResult)val11).Normal != val3 && PhysicsEngine.Instance.Raycast(val, val4.Rotate(-1f), 999f, ref val11, true, false, num7, (CollisionLayer?)null, false, (Func)null, (SpeculativeRigidbody)null)) { val3 = ((CastResult)val11).Normal; } } PhysicsEngine instance = PhysicsEngine.Instance; Func func = Untargetable; bool flag3 = instance.Raycast(val, val4, 999f, ref val11, false, true, num6, (CollisionLayer?)null, false, func, (SpeculativeRigidbody)null); if (flag3 && flag2 && val11.Distance > num8) { flag3 = false; } if (flag3) { flag2 = false; num8 = val11.Distance; val2 = ((CastResult)val11).Contact; val3 = ((CastResult)val11).Normal; lastCollider = ((CastResult)val11).OtherPixelCollider; ref AIActor targetActor2 = ref _targetActor; GameActor gameActor = ((BraveBehaviour)val11.SpeculativeRigidbody).gameActor; targetActor2 = (AIActor)(object)((gameActor is AIActor) ? gameActor : null); } if (val3.x != 0f) { val5 = Vector2Extensions.WithX(val5, 0f - val5.x); } if (val3.y != 0f) { val5 = Vector2Extensions.WithY(val5, 0f - val5.y); } if (flag2) { PhysicsEngine instance2 = PhysicsEngine.Instance; Vector2 val12 = val2; Vector2 val13 = val5; func = Untargetable; if (instance2.Raycast(val12, val13, 999f, ref val11, false, true, num6, (CollisionLayer?)null, false, func, (SpeculativeRigidbody)null)) { num9 = val11.Distance; lastCollider = ((CastResult)val11).OtherPixelCollider; ref AIActor targetActor3 = ref _targetActor; GameActor gameActor2 = ((BraveBehaviour)val11.SpeculativeRigidbody).gameActor; targetActor3 = (AIActor)(object)((gameActor2 is AIActor) ? gameActor2 : null); _lastRebound = ((GameActor)_targetActor).CenterPosition; } } RaycastResult.Pool.Free(ref val11); _lastContact = val2; float num10 = _lastAimAngle.AbsAngleTo(currentGun.gunAngle); _slidingAngleWindow = Mathf.Max(0f, _slidingAngleWindow + num10 - deltaTime * 48f); float num11 = 16f * Mathf.Abs(_lastTargetMag - num8); _slidingMagWindow = Mathf.Max(0f, _slidingMagWindow + num11 - deltaTime * 40f); int num12; if (!Object.op_Implicit((Object)(object)_targetActor) || _slidingAngleWindow > 48f) { num12 = 0; _slidingAngleWindow = 0f; _slidingMagWindow = 0f; } else if (_lastSpread != num4) { num12 = 1; _slidingMagWindow = 0f; } else if (!(num11 > 40f)) { num12 = ((!((Object)(object)targetActor != (Object)(object)_targetActor)) ? 6 : 4); } else { num12 = 2; _slidingMagWindow = 0f; } if (num12 < 6) { float num13 = (float)num12 * 0.35f; if (_drawTimer > num13) { _drawTimer = num13; _soundTimer = 0f; _freezeTimer = 0.1f; } } _lastAimAngle = currentGun.gunAngle; _lastSpread = num4; _lastTargetMag = num8; _lastNormal = val3; _lastCollider = lastCollider; for (int i = 0; i < 6; i++) { phaseCompetion[i] = Mathf.Clamp01(_drawTimer / 0.35f - (float)i); } int maxDrawablePhase = 0; float num14 = phaseCompetion[maxDrawablePhase++]; Geometry aimAngleArc = _aimAngleArc; Color? color = val6; Vector2? pos = val; float? radius = 3f; float? angle = num5.Clamp360(); float? arc = 180f * num14; aimAngleArc.Place(color, pos, null, radius, angle, arc); _shotAngleLabel.Text = $"θ={Mathf.RoundToInt(playerOwner.m_currentGunAngle.Clamp180())}°"; ((dfControl)_shotAngleLabel).Color = Color32.op_Implicit(val6); ((dfControl)_shotAngleLabel).Opacity = num14; _shotAngleLabel.Place(val + num5.ToVector(3.125f) + (num5 - 90f).ToVector(1.5f), num5 - 90f); _timeFocusing = Mathf.Clamp(_timeFocusing + (_focused ? deltaTime : (0f - deltaTime)), 0f, 0.35f); float num15 = Mathf.Clamp01(_timeFocusing / 0.35f); Vector2 val14 = val + num5.ToVector(3f); Vector2 val15 = val + (num5 + 90f).ToVector(3f); Vector2 val16 = val + (num5 - 90f).ToVector(3f); _leftFocus.Place(value, val14, Vector2.Lerp(val14, val15, num15)); _rightFocus.Place(value, val14, Vector2.Lerp(val14, val16, num15)); num14 = phaseCompetion[maxDrawablePhase++]; float num16 = num4 * num14; Geometry leftAdjSpread = _leftAdjSpread; Color? color2 = val7; Vector2? pos2 = val; arc = num8 * num14; angle = (num5 - num16).Clamp360(); leftAdjSpread.Place(color2, pos2, null, arc, angle); Geometry rightAdjSpread = _rightAdjSpread; Color? color3 = val7; Vector2? pos3 = val; angle = num8 * num14; arc = (num5 + num16).Clamp360(); rightAdjSpread.Place(color3, pos3, null, angle, arc); _spreadLabel.Text = $"±{num16:0.0}°"; ((dfControl)_spreadLabel).Color = Color32.op_Implicit(val7); ((dfControl)_spreadLabel).Opacity = num14; _spreadLabel.Place(val + num5.ToVector(3.625f) + (num5 - 90f).ToVector(1.75f), num5 - 90f); num14 = phaseCompetion[maxDrawablePhase++]; Geometry perfectShot = _perfectShot; Color? color4 = val8; Vector2? pos4 = val; arc = num8 * num14; angle = num5.Clamp360(); perfectShot.Place(color4, pos4, null, arc, angle); _shotDistanceLabel.Text = $"Δ={Mathf.RoundToInt(16f * num8 * num14)}"; ((dfControl)_shotDistanceLabel).Color = Color32.op_Implicit(val8); ((dfControl)_shotDistanceLabel).Opacity = num14; _shotDistanceLabel.Place(val + num5.ToVector(0.5f * num8 * num14) + (num5 - 90f).ToVector(-0.25f), num5); if (flag2) { num14 = phaseCompetion[maxDrawablePhase++]; float num17 = Vector2Extensions.ToAngle(val5); Geometry reboundShot = _reboundShot; Color? color5 = val9; Vector2? pos5 = val2; angle = num9 * num14; arc = num17; reboundShot.Place(color5, pos5, null, angle, arc); float num18 = Mathf.Min(2f, 0.5f * num8); float num19 = 0.5f * num18; Vector2 value3 = val2 + num19 * val3; float num20 = 2f * (num5 + 180f).AbsAngleTo(num17); Geometry reboundArc = _reboundArc; Color? color6 = val9; Vector2? pos6 = value3; arc = num19; angle = Vector2Extensions.ToAngle(val3); radius = num20 * num14; reboundArc.Place(color6, pos6, null, arc, angle, radius); _reboundAngleLabel.Text = $"∠{Mathf.RoundToInt(0.5f * num20 * num14)}°"; ((dfControl)_reboundAngleLabel).Color = Color32.op_Implicit(val9); ((dfControl)_reboundAngleLabel).Opacity = num14; _reboundAngleLabel.Place(val2 + (num18 + 0.125f) * val3, Vector2Extensions.ToAngle(val3) - 90f); } else { _reboundShot.Disable(); _reboundArc.Disable(); ((dfControl)_reboundAngleLabel).IsVisible = false; } if (Object.op_Implicit((Object)(object)_targetActor) && Object.op_Implicit((Object)(object)((BraveBehaviour)_targetActor).sprite)) { num14 = phaseCompetion[maxDrawablePhase++]; Bounds bounds = ((BraveBehaviour)_targetActor).sprite.GetBounds(); Rect val17 = Extensions.Inset(new Rect(((BraveBehaviour)_targetActor).sprite.WorldBottomLeft, Vector2.op_Implicit(((Bounds)(ref bounds)).size)), -0.5f); Vector2 center = ((Rect)(ref val17)).center; Vector2 val18 = center + num14 * (new Vector2(((Rect)(ref val17)).xMin, ((Rect)(ref val17)).yMax) - center); Vector2 val19 = center + num14 * (new Vector2(((Rect)(ref val17)).xMin, ((Rect)(ref val17)).yMin) - center); Vector2 val20 = center + num14 * (new Vector2(((Rect)(ref val17)).xMax, ((Rect)(ref val17)).yMax) - center); Vector2 val21 = center + num14 * (new Vector2(((Rect)(ref val17)).xMax, ((Rect)(ref val17)).yMin) - center); _topBbox.Place(val10, val18, val20); _bottomBbox.Place(val10, val19, val21); _leftBbox.Place(val10, val18, val19); _rightBbox.Place(val10, val20, val21); _widthLabel.Text = $"w={Mathf.RoundToInt(16f * (val20.x - val18.x))}"; ((dfControl)_widthLabel).Color = Color32.op_Implicit(val10); ((dfControl)_widthLabel).Opacity = num14; _widthLabel.Place(0.5f * (val20 + val18) + new Vector2(0f, 0.25f)); _heightLabel.Text = $"h={Mathf.RoundToInt(16f * (val20.y - val21.y))}"; ((dfControl)_heightLabel).Color = Color32.op_Implicit(val10); ((dfControl)_heightLabel).Opacity = num14; _heightLabel.Place(0.5f * (val20 + val21) + new Vector2(0.25f, 0f)); num14 = phaseCompetion[maxDrawablePhase++]; Vector2 val22 = 0.5f * (val18 + val19); Vector2 val23 = 0.5f * (val20 + val21); Vector2 val24 = 0.5f * (val18 + val20); Vector2 val25 = 0.5f * (val19 + val21); float value4 = 0.5f * Mathf.Min(val23.x - val22.x, val24.y - val25.y); float value5 = 90f * num14; _weakPointL.Place(value2, val22, val22 + num14 * (center - val22)); _weakPointR.Place(value2, val23, val23 + num14 * (center - val23)); _weakPointT.Place(value2, val24, val24 + num14 * (center - val24)); _weakPointB.Place(value2, val25, val25 + num14 * (center - val25)); Geometry weakPointArcR = _weakPointArcR; Color? color7 = value2; Vector2? pos7 = center; radius = value4; angle = 45f; arc = value5; weakPointArcR.Place(color7, pos7, null, radius, angle, arc); Geometry weakPointArcT = _weakPointArcT; Color? color8 = value2; Vector2? pos8 = center; arc = value4; angle = 135f; radius = value5; weakPointArcT.Place(color8, pos8, null, arc, angle, radius); Geometry weakPointArcL = _weakPointArcL; Color? color9 = value2; Vector2? pos9 = center; radius = value4; angle = 225f; arc = value5; weakPointArcL.Place(color9, pos9, null, radius, angle, arc); Geometry weakPointArcB = _weakPointArcB; Color? color10 = value2; Vector2? pos10 = center; arc = value4; angle = 315f; radius = value5; weakPointArcB.Place(color10, pos10, null, arc, angle, radius); flag = num14 >= 1f; HealthHaver healthHaver = ((BraveBehaviour)_targetActor).healthHaver; float num21 = GetDamageMultFromFocusTime() * ((GunBehaviour)this).gun.DefaultModule.projectiles[0].baseData.damage * playerOwner.stats.GetStatValue((StatType)5); if (healthHaver.IsBoss) { num21 *= playerOwner.stats.GetStatValue((StatType)22); } if ((canDoCrit || num21 >= healthHaver.GetCurrentHealth()) && base.Mastered) { ForceFireGun(); } } else { _topBbox.Disable(); _bottomBbox.Disable(); _leftBbox.Disable(); _rightBbox.Disable(); _weakPointL.Disable(); _weakPointR.Disable(); _weakPointT.Disable(); _weakPointB.Disable(); _weakPointArcL.Disable(); _weakPointArcR.Disable(); _weakPointArcT.Disable(); _weakPointArcB.Disable(); ((dfControl)_widthLabel).IsVisible = false; ((dfControl)_heightLabel).IsVisible = false; ((dfControl)_damageLabel).IsVisible = false; } _maxDrawablePhase = maxDrawablePhase; if (flag && !canDoCrit) { ((Component)this).gameObject.Play("sextant_crit_ready_sound"); } canDoCrit = flag; } } private static void StabilizeLabel(dfLabel label) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) LabelExt component = ((Component)label).gameObject.GetComponent(); label.Place(component.lastPos, component.lastRot); } } public class PrecisionProjectile : Projectile { public const float BOSS_DAMAGE_MULT_ON_CRIT = 2f; public AIActor target; public bool isCrit; public Vector2 lastPos; public override void Start() { //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_006d: Unknown result type (might be due to invalid IL or missing references) ((Projectile)this).Start(); base.m_usesNormalMoveRegardless = true; SpeculativeRigidbody specRigidbody = ((BraveBehaviour)this).specRigidbody; specRigidbody.OnCollision = (Action)Delegate.Combine(specRigidbody.OnCollision, new Action(OnCollision)); if (isCrit) { base.BossDamageMultiplier *= 2f; base.pierceMinorBreakables = true; base.ignoreDamageCaps = true; } lastPos = Vector2.op_Implicit(((BraveBehaviour)this).transform.position); } private void OnCollision(CollisionData data) { if (!isCrit) { return; } SpeculativeRigidbody otherRigidbody = data.OtherRigidbody; if (otherRigidbody == null) { return; } AIActor aiActor = ((BraveBehaviour)otherRigidbody).aiActor; if (aiActor == null || !((Behaviour)aiActor).isActiveAndEnabled || ((GameActor)aiActor).IsGone) { return; } HealthHaver healthHaver = ((BraveBehaviour)aiActor).healthHaver; if (healthHaver != null && !healthHaver.IsDead && healthHaver.IsVulnerable) { StickyFrictionManager.Instance.RegisterCustomStickyFriction(0.75f, 0f, true, false); ((Component)this).gameObject.Play("sextant_critical_hit_sound"); if (!healthHaver.IsBoss && !healthHaver.IsSubboss) { aiActor.DuplicateInWorldAsMesh().Dissipate(1.5f, 0f, 5f, progressive: true); aiActor.EraseFromExistenceWithRewards(false); } } } public override void Move() { DoTrailParticles(); ((Projectile)this).Move(); } public void DoTrailParticles() { //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_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_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) //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_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_0049: 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_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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_00ab: 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_00a4: 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_00c1: Unknown result type (might be due to invalid IL or missing references) float num = (isCrit ? 0.3f : 1.5f); Vector2 val = lastPos; Vector2 val2 = Vector2.op_Implicit(base.m_transform.position); lastPos = val; Vector2 val3 = val2 - val; Vector2 normalized = ((Vector2)(ref val3)).normalized; Vector2 val4 = num * normalized; Vector2 val5 = normalized.Rotate(90f); int num2 = Mathf.FloorToInt(((Vector2)(ref val3)).magnitude / num); for (int i = 0; i < num2; i++) { GameObject mathSymbols = Sextant._MathSymbols; Vector3 position = Vector2.op_Implicit(val + (float)i * val4); Vector2? velocity = (Random.Range(1f, 4f) * (Lazy.CoinFlip() ? val5 : (-val5))).Rotate(Random.Range(1f, 10f)); CwaffVFX.Spawn(fadeOutTime: 0.5f, prefab: mathSymbols, position: position, rotation: null, velocity: velocity, lifetime: 0.5f, emissivePower: 0f, emissiveColor: null, fadeIn: false, startScale: null, endScale: null, height: null, randomFrame: true); } } } public class Gunbrella : CwaffGun { public static string ItemName = "Gunbrella"; public static string ShortDescription = "Cloudy with a Chance of Pain"; public static string LongDescription = "Fires projectiles that hail from the sky at the cursor's position after a charging period."; public static string Lore = "A normal umbrella that was genetically modified to fire bullets, older models fired projectiles from the front much like a traditional firearm. Gungeoneers quickly grew frustrated at being unable to actually see where they were shooting at due to the Gunbrella's large frame. With modern advances in technology and magic, newer models include a touchscreen and GPS that allows the user to target enemies directly with projectiles summoned from the sky itself."; private const float _MIN_CHARGE_TIME = 0.75f; private const int _BARRAGE_SIZE = 16; private const float _BARRAGE_DELAY = 0.04f; private const float _PROJ_DAMAGE = 8f; private const float _MAX_RETICLE_RANGE = 10f; private const float _MAX_ALPHA = 0.5f; internal static ProjectileModule _MasteryModule = null; private bool _wasCharging; private Vector2 _chargeStartPos = Vector2.zero; private int _nextProjectileNumber; private bool _masteryVolleyReplaced; public static void Init() { //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_071b: Expected O, but got Unknown Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 60; int? chargeFps = 16; Gun gun2 = gun.SetAttributes((ItemQuality)4, (GunClass)60, 1f, 960, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, null, chargeFps, null, null, null, null, 17, -1, -1, null, modulesAreTiers: false, "muzzle_gunbrella", 30, 0.5f, (Anchor)4, -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: true); Color? emissiveColour = Color.cyan; Gun gunRef; Gun gun3 = gun2.AddReticle(VFX.Create("gunbrella_target_reticle", 12f, loops: true, -1, 0.75f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 10f, emissiveColour), 0.25f, 0.75f, 0.25f, smoothLerp: false, 10f, 11f, 0f, CwaffReticle.Visibility.CHARGING, aimFromPlayerCenter: false, background: true).AssignGun(out gunRef); int? clipSize = 1; float? damage = 8f; gun3.InitProjectile(GunData.New(null, null, clipSize, null, null, (ShootStyle)3, (ProjectileSequenceStyle)0, 0.75f, 1, null, customClip: true, damage, null, null, null, null, 0f, 0f, 0.33f, 0f, null, null, null, null, null, "gunbrella_projectile", 16, (Anchor)3, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 0.6f, "icicle_crash", null, 16)).SetAllImpactVFX(VFX.CreatePool("icicle_crash_particles", 30f, loops: false, -1, 0.35f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1)).Attach() .Assign(out Projectile projectileRef); _MasteryModule = GunBuilder.SetAttributes(new ProjectileModule { projectiles = new List { projectileRef } }, GunData.New(gunRef, null, -1, 0.05f, null, (ShootStyle)1, (ProjectileSequenceStyle)1, 0f, 1, null, customClip: true, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4)); } public override void Update() { //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_0129: 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) base.Update(); PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null || BraveTime.DeltaTime == 0f) { return; } if (base.Mastered && !_masteryVolleyReplaced) { ProjectileVolleyData val = ScriptableObject.CreateInstance(); val.projectiles = new List { ProjectileModule.CreateClone(_MasteryModule, true, -1) }; ((GunBehaviour)this).gun.RawSourceVolley = val; playerOwner.stats.RecalculateStats(playerOwner, false, false); _masteryVolleyReplaced = true; } if (!((GunBehaviour)this).gun.IsCharging && !((GunBehaviour)this).gun.IsFiring) { _wasCharging = false; return; } Lazy.PlaySoundUntilDeathOrTimeout("gunbrella_charge_sound", ((Component)((GunBehaviour)this).gun).gameObject, 0.05f); if (!_wasCharging) { _nextProjectileNumber = 0; _chargeStartPos = TransformExtensions.PositionVector2(((GunBehaviour)this).gun.barrelOffset); _wasCharging = true; } _chargeStartPos = ((Component)this).GetComponent().GetTargetPos(); if (!GameManager.Instance.Dungeon.data.CheckInBoundsAndValid(Vector2Extensions.ToIntVector2(_chargeStartPos, (VectorConversions)0))) { Vector2 val2 = TransformExtensions.PositionVector2(((GunBehaviour)this).gun.barrelOffset); _chargeStartPos = val2.ToNearestWall(out var _, Vector2Extensions.ToAngle(_chargeStartPos - val2), 0f); } } public override void PostProcessProjectile(Projectile projectile) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) ((GunBehaviour)this).PostProcessProjectile(projectile); ((Component)projectile).GetComponent().Setup(this, _nextProjectileNumber++, _chargeStartPos, base.Mastered); } public Vector2 CurrentTarget() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _chargeStartPos; } } public class GunbrellaProjectile : MonoBehaviour { private const float _SPREAD = 1.5f; private const float _LAUNCH_SPEED = 80f; private const float _LAUNCH_TIME = 0.35f; private const float _HANG_TIME = 0.05f; private const float _FALL_TIME = 0.3f; private const float _SPEAR_TIME = 0.1f; private const float _HOME_STRENGTH = 0.1f; private const float _DELAY = 0.03f; private const float _TIME_TO_REACH_TARGET = 0.70000005f; private static float _LastLaunchTime; private static int _LastLaunchIndex; private Projectile _projectile; private PlayerController _owner; private float _lifetime; private bool _intangible = true; private Vector2 _exactTarget = Vector2.zero; private Vector2 _startVelocity = Vector2.zero; private float _extraDelay; private bool _naturalSpawn; private bool _mastered; private Gunbrella _gunbrella; public void Setup(Gunbrella gunbrella, int index, Vector2 target, bool mastered) { //IL_0028: 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) _naturalSpawn = true; _gunbrella = gunbrella; _extraDelay = (mastered ? 0f : (0.03f * (float)index)); _exactTarget = target; _mastered = mastered; } private void Start() { //IL_00f0: 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_00f8: 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_011f: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Expected O, but got Unknown //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Expected O, but got Unknown //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: 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_00df: 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_00e4: Unknown result type (might be due to invalid IL or missing references) _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)) { if (_naturalSpawn && !_mastered && _LastLaunchTime < BraveTime.ScaledTimeSinceStartup) { _LastLaunchIndex = 0; _LastLaunchTime = BraveTime.ScaledTimeSinceStartup; ((Component)_projectile).gameObject.PlayUnique("gunbrella_fire_sound"); } if (!_naturalSpawn) { _extraDelay = 0.03f * (float)_LastLaunchIndex++; ReadOnlyCollection allNearbyEnemies = ((GameActor)_owner).CenterPosition.GetAllNearbyEnemies(); AIActor val = ((allNearbyEnemies.Count > 0) ? allNearbyEnemies.ChooseRandom() : null); _exactTarget = (Object.op_Implicit((Object)(object)val) ? ((GameActor)val).CenterPosition : ((GameActor)_owner).CenterPosition); } Projectile projectile = _projectile; projectile.damageTypes = (CoreDamageTypes)(projectile.damageTypes & -65); SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreCollision)); SpeculativeRigidbody specRigidbody2 = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody2.OnPreTileCollision = (OnPreTileCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody2.OnPreTileCollision, (Delegate?)new OnPreTileCollisionDelegate(OnPreTileCollision)); _startVelocity = Vector2Extensions.ToAngle(_projectile.Direction).AddRandomSpread(10f).ToVector(); _projectile.collidesWithEnemies = false; ((BraveBehaviour)_projectile).specRigidbody.CollideWithOthers = false; ((BraveBehaviour)_projectile).specRigidbody.CollideWithTileMap = false; ((MonoBehaviour)this).StartCoroutine(TakeToTheSkies()); } } private void OnPreCollision(SpeculativeRigidbody me, PixelCollider myPixelCollider, SpeculativeRigidbody other, PixelCollider otherPixelCollider) { if (_intangible) { PhysicsEngine.SkipCollision = true; } } private void OnPreTileCollision(SpeculativeRigidbody me, PixelCollider myPixelCollider, Tile other, PixelCollider otherPixelCollider) { if (_intangible) { PhysicsEngine.SkipCollision = true; } } private IEnumerator TakeToTheSkies() { float speedMult = (Object.op_Implicit((Object)(object)_owner) ? _owner.ProjSpeedMult() : 1f); GameObjectExtensions.SetLayerRecursively(((Component)_projectile).gameObject, LayerMask.NameToLayer("Unoccluded")); if (!_mastered || !Object.op_Implicit((Object)(object)_gunbrella)) { Vector2 targetLaunchVelocity = (85f + 10f * Random.value).ToVector(); _projectile.IgnoreTileCollisionsFor(0.70000005f); _projectile.SetSpeed(80f * speedMult); _projectile.baseData.range = float.MaxValue; float launchTime = 0.35f / speedMult; float homeStrength = 0.1f * speedMult; while (_lifetime < launchTime) { _startVelocity = (1f - homeStrength) * _startVelocity + homeStrength * targetLaunchVelocity; _projectile.SendInDirection(_startVelocity, true, true); yield return null; _lifetime += BraveTime.DeltaTime; } _lifetime -= launchTime; _projectile.SetSpeed(0.01f); while (_lifetime < 0.05f + _extraDelay) { yield return null; _lifetime += BraveTime.DeltaTime; } _lifetime -= 0.05f + _extraDelay; } else { _projectile.IgnoreTileCollisionsFor(0.1f); yield return null; _projectile.IgnoreTileCollisionsFor(0.1f); _projectile.baseData.range = float.MaxValue; _exactTarget = _gunbrella.CurrentTarget(); } float fallTime = (_mastered ? 0.1f : 0.3f) / speedMult; float num = (_mastered ? 3f : 1f) * 80f * speedMult; Vector2 val = (250f + 40f * Random.value).ToVector(); _projectile.SetSpeed(num); Vector2 offsetTarget = _exactTarget + Lazy.RandomVector(1.5f * Random.value * (Object.op_Implicit((Object)(object)_owner) ? _owner.AccuracyMult() : 1f)); ((BraveBehaviour)_projectile).specRigidbody.Position = new Position(offsetTarget + fallTime * num * -val); ((BraveBehaviour)_projectile).specRigidbody.UpdateColliderPositions(); _projectile.SendInDirection(val, true, true); EasyTrailBullet easyTrailBullet = ((Component)_projectile).gameObject.AddComponent(); easyTrailBullet.StartWidth = 0.2f; easyTrailBullet.EndWidth = 0.01f; easyTrailBullet.LifeTime = 0.1f; easyTrailBullet.BaseColor = Vector3Extensions.WithAlpha(Color.cyan, 0.6f); easyTrailBullet.StartColor = Vector3Extensions.WithAlpha(Color.cyan, 0.6f); easyTrailBullet.EndColor = Vector3Extensions.WithAlpha(Color.cyan, 0.2f); while (_lifetime + BraveTime.DeltaTime < fallTime) { _lifetime += BraveTime.DeltaTime; yield return null; } _lifetime -= fallTime; ((BraveBehaviour)_projectile).specRigidbody.Velocity = ((Vector2)(ref ((BraveBehaviour)_projectile).specRigidbody.Velocity)).normalized; ((BraveBehaviour)_projectile).specRigidbody.Position = new Position(offsetTarget); ((BraveBehaviour)_projectile).specRigidbody.UpdateColliderPositions(); _projectile.collidesWithEnemies = true; ((BraveBehaviour)_projectile).specRigidbody.CollideWithOthers = true; ((BraveBehaviour)_projectile).specRigidbody.CollideWithTileMap = true; _intangible = false; yield return null; _projectile.DieInAir(false, true, true, false); } } public class Maestro : CwaffGun { public static string ItemName = "Maestro"; public static string ShortDescription = "Guided by the Winds"; public static string LongDescription = "Redirects enemy projectiles near the cursor towards the targeted enemy while fire is held. Reloading changes the targeted enemy to the enemy closest to the cursor. On controller, projectiles and enemies are targeted using angle from aim instead of distance from the cursor. Redirected projectiles cannot harm the player."; public static string Lore = "A conductor's baton that was lost at sea near Dragun's Roost long ago, eventually finding its way into the Gungeon via the sewers. Though unable to fire projectiles itself, it grants its wielder the ability to redirect projectiles by bending the ether around them, providing excellent offensive and defensive utility alike."; private const float _MAX_PROJECTILE_TARGET_ANGLE = 20f; private const float _MAX_PROJECTILE_TARGET_RADIUS = 3f; private const float _SQR_TARGET_RADIUS = 9f; private const int _MAX_STEPS = 30; internal static GameObject _LaunchVFX = null; private int _targetEnemyIndex; private AIActor _targetEnemy; private Projectile _targetProjectile; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore).SetAttributes(reloadTime: 0f, ammo: 500, audioFrom: Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, shootFps: 24, muzzleFrom: Items.FaceMelter, quality: (ItemQuality)2, gunClass: (GunClass)40, doesScreenShake: false, idleFps: null, reloadFps: null, chargeFps: null, introFps: null, fireAudio: null, reloadAudio: null, introAudio: null, loopChargeAt: -1, loopReloadAt: -1, loopFireAt: -1, modulesAreTiers: false, muzzleVFX: null, muzzleFps: 60, muzzleScale: 1f, muzzleAnchor: (Anchor)3, muzzleEmission: -1f, muzzleEmissionColor: null, muzzleEmissionColorPower: -1f, muzzleLit: false, muzzleLightStrength: 0f, muzzleLightRange: 0f, muzzleLightColor: null, carryOffset: null, preventRotation: false, curse: 1f, continuousFire: true, dynamicBarrelOffsets: true, banFromBlessedRuns: true, rampUpFireRate: false, rampUpFactor: 0f, suppressReloadAnim: false, handedness: (GunHandedness)0, autoPlay: true, attacksThroughWalls: true).AddToShop((ShopType)2) .AddReticle(VFX.Create("maestro_target_enemy_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1), 0.5f, 0f, 0f, smoothLerp: true, -1f, 1f, 270f, CwaffReticle.Visibility.WITHTARGET, aimFromPlayerCenter: true) .AddReticle(VFX.Create("maestro_target_projectile_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1), 0.75f, 0f, 0f, smoothLerp: true, -1f, 1f, 270f, CwaffReticle.Visibility.WITHTARGET, aimFromPlayerCenter: true); int? clipSize = -1; float? cooldown = 0.2f; float? angleVariance = 15f; float? damage = 9f; float? speed = 60f; gun.InitProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "maestro_bullet", 12, (Anchor)4, 0.5f)); _LaunchVFX = VFX.Create("maestro_launch_vfx", 60f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } private GameObject GetTargetEnemy(CwaffReticle reticle) { if (!Object.op_Implicit((Object)(object)_targetEnemy)) { return null; } return ((Component)_targetEnemy).gameObject; } private GameObject GetTargetProjectile(CwaffReticle reticle) { if (!Object.op_Implicit((Object)(object)_targetProjectile)) { return null; } return ((Component)_targetProjectile).gameObject; } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); ((Component)((GunBehaviour)this).gun).GetComponent().targetObjFunc = GetTargetEnemy; ((Component)((GunBehaviour)this).gun).GetComponent().targetObjFunc = GetTargetProjectile; } private void RedirectProjectile(Projectile p, AIActor targetEnemy, Projectile launcher) { //IL_0065: 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_0026: 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_0033: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: 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_015c: Unknown result type (might be due to invalid IL or missing references) PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null) { p.RemoveBulletScriptControl(); if (Object.op_Implicit((Object)(object)targetEnemy)) { Vector2 val = ((GameActor)targetEnemy).CenterPosition - ((BraveBehaviour)p).specRigidbody.UnitCenter; p.Direction = ((Vector2)(ref val)).normalized; p.Direction = p.Direction.Rotate(Random.Range(-4f, 4f)); } else { p.Direction = Lazy.RandomVector(); } if (Object.op_Implicit((Object)(object)p.Owner) && Object.op_Implicit((Object)(object)((BraveBehaviour)p.Owner).specRigidbody)) { ((BraveBehaviour)p).specRigidbody.DeregisterSpecificCollisionException(((BraveBehaviour)p.Owner).specRigidbody); } p.baseData.damage = launcher.baseData.damage; p.baseData.speed = launcher.baseData.speed; p.baseData.force = launcher.baseData.force; p.baseData.range = launcher.baseData.range; p.SetOwnerAndStats((GameActor)(object)playerOwner); p.allowSelfShooting = false; ((BraveBehaviour)p).specRigidbody.CollideWithTileMap = false; p.UpdateCollisionMask(); p.ResetDistance(); p.Reflected(); playerOwner.DoPostProcessProjectile(p); p.Speed = Mathf.Max(60f, p.Speed); CwaffVFX.Spawn(_LaunchVFX, Vector2.op_Implicit(p.SafeCenter), p.Direction.EulerZ()); switch (Random.Range(0, 5)) { case 0: ((Component)p).gameObject.Play("maestro_launch_asharp"); break; case 1: ((Component)p).gameObject.Play("maestro_launch_csharp"); break; case 2: ((Component)p).gameObject.Play("maestro_launch_dsharp"); break; case 3: ((Component)p).gameObject.Play("maestro_launch_fsharp"); break; case 4: ((Component)p).gameObject.Play("maestro_launch_gsharp"); break; } } } private Projectile GetTargetProjectile() { //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_0023: 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_0099: 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_00b4: 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_00d6: Unknown result type (might be due to invalid IL or missing references) PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null) { return null; } Projectile result = null; bool flag = playerOwner.IsKeyboardAndMouse(); Vector2 val = (flag ? Vector3Extensions.XY(playerOwner.unadjustedAimPoint) : TransformExtensions.PositionVector2(((GunBehaviour)this).gun.barrelOffset)); float currentAngle = ((GunBehaviour)this).gun.CurrentAngle; float num = float.MaxValue; foreach (Projectile allProjectile in StaticReferenceManager.AllProjectiles) { if (!Object.op_Implicit((Object)(object)allProjectile) || !((Behaviour)allProjectile).isActiveAndEnabled || allProjectile.Owner is PlayerController || !GameManager.Instance.MainCameraController.PointIsVisible(allProjectile.SafeCenter)) { continue; } float num2 = 0f; Vector2 val2 = allProjectile.SafeCenter - val; if (flag) { float sqrMagnitude = ((Vector2)(ref val2)).sqrMagnitude; if (sqrMagnitude > 9f) { continue; } num2 = sqrMagnitude; } else { float num3 = Mathf.Abs(Vector2Extensions.ToAngle(val2).RelAngleTo(currentAngle)); if (num3 > 20f) { continue; } num2 = ((Vector2)(ref val2)).sqrMagnitude * num3 * num3; } if (!(num2 > num)) { result = allProjectile; num = num2; } } return result; } private AIActor SwitchTargetEnemy() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_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_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_0046: 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_011a: 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_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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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) PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null || !playerOwner.AcceptingNonMotionInput) { return null; } ReadOnlyCollection allNearbyEnemies = ((GameActor)playerOwner).CenterPosition.GetAllNearbyEnemies(); AIActor result = null; float num = float.MaxValue; if (playerOwner.IsKeyboardAndMouse()) { Vector2 val = Vector3Extensions.XY(playerOwner.unadjustedAimPoint); { foreach (AIActor item in allNearbyEnemies) { if (!IsUntargetable(item)) { Vector2 val2 = ((GameActor)item).CenterPosition - val; float sqrMagnitude = ((Vector2)(ref val2)).sqrMagnitude; if (!(sqrMagnitude > num)) { result = item; num = sqrMagnitude; } } } return result; } } Vector2 vector = ((TwoAxisInputControl)playerOwner.m_activeActions.Aim).Vector; if (vector == Vector2.zero) { int count = allNearbyEnemies.Count; for (int i = 1; i <= count; i++) { int num2 = (_targetEnemyIndex + i) % count; AIActor val3 = allNearbyEnemies[num2]; if (!IsUntargetable(val3)) { _targetEnemyIndex = num2; return val3; } } return null; } Vector2 val4 = TransformExtensions.PositionVector2(((GunBehaviour)this).gun.barrelOffset); float other = Vector2Extensions.ToAngle(vector); foreach (AIActor item2 in allNearbyEnemies) { if (!IsUntargetable(item2)) { float num3 = Mathf.Abs(Vector2Extensions.ToAngle(((GameActor)item2).CenterPosition - val4).RelAngleTo(other)); if (!(num3 > num)) { result = item2; num = num3; } } } return result; } public override void OnReloadPressed(PlayerController player, Gun gun, bool manualReload) { base.OnReloadPressed(player, gun, manualReload); AIActor targetEnemy = _targetEnemy; _targetEnemy = SwitchTargetEnemy(); if (Object.op_Implicit((Object)(object)_targetEnemy) && (Object)(object)_targetEnemy != (Object)(object)targetEnemy) { ((Component)this).gameObject.PlayOnce("maestro_target_sound"); } } public override void Update() { base.Update(); if (!GameManager.Instance.IsLoadingLevel && Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) && ((GunBehaviour)this).PlayerOwner.AcceptingNonMotionInput) { _targetProjectile = GetTargetProjectile(); DetermineTargetEnemyIfNecessary(); if (((GunBehaviour)this).gun.m_isCurrentlyFiring) { Lazy.PlaySoundUntilDeathOrTimeout("maestro_fire_sound_looped", ((Component)this).gameObject, 0.05f); } } } private static bool IsUntargetable(AIActor enemy) { if (Object.op_Implicit((Object)(object)enemy) && Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).healthHaver) && !((BraveBehaviour)enemy).healthHaver.IsDead && !((GameActor)enemy).IsGone && !((GameActor)enemy).IsStealthed) { return !enemy.IsWorthShootingAt; } return true; } private void DetermineTargetEnemyIfNecessary() { if (IsUntargetable(_targetEnemy)) { _targetEnemy = SwitchTargetEnemy(); } } public override void PostProcessProjectile(Projectile projectile) { ((GunBehaviour)this).PostProcessProjectile(projectile); DetermineTargetEnemyIfNecessary(); if (Object.op_Implicit((Object)(object)_targetProjectile)) { RedirectProjectile(_targetProjectile, _targetEnemy, projectile); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((GunBehaviour)this).PlayerOwner.DoPostProcessProjectile(_targetProjectile); } } if (((GunBehaviour)this).gun.CanGainAmmo && !projectile.FiredForFree() && !Object.op_Implicit((Object)(object)_targetProjectile) && base.Mastered) { ((GunBehaviour)this).gun.GainAmmo(1); ((GunBehaviour)this).gun.MoveBulletsIntoClip(1); } projectile.DieInAir(true, false, false, false); } } public class Jugglernaut : CwaffGun { [HarmonyPatch(typeof(GameUIAmmoController), "GetOffsetVectorForGun")] private class JugglernautWeaponBoxPatch { private static readonly Vector3 _WeaponBoxCorrection = new Vector3(-0.125f, -0.125f, 0f); private static void Postfix(Gun newGun, bool isFlippingGun, ref Vector3 __result) { //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_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) if (Object.op_Implicit((Object)(object)((Component)newGun).GetComponent())) { __result += _WeaponBoxCorrection; } } } [HarmonyPatch(typeof(Gun), "CeaseAttack")] private class JugglernautCeaseAttackPatch { [HarmonyILManipulator] private static void JugglernautCeaseAttackIL(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.MatchLdfld(instr, "LockedHorizontalOnCharge") })) { val.Emit(OpCodes.Ldarg_0); val.CallPrivate(typeof(JugglernautCeaseAttackPatch), "ShouldUpdateAttachPoints"); } } private static bool ShouldUpdateAttachPoints(bool origVal, Gun gun) { if (origVal) { return !Object.op_Implicit((Object)(object)((Component)gun).GetComponent()); } return false; } } public static string ItemName = "Jugglernaut"; public static string ShortDescription = "Balancing Act"; public static string LongDescription = "Fires projectiles whose damage scales with the number of unique enemies hit in a row. The juggling multiplier caps at 6 and resets upon switching guns or taking damage."; public static string Lore = "Somehow even more impressive and dangerous than juggling swords, gun juggling is a burgeoning art form among Gungeoneers trying to justify their ever-growing collections of guns. Several enthusiasts have attempted at various points to establish gun juggling as a mainstream circus act, an international olympic sport, and a legitimate martial art, with each of these attempts resulting in some variation of the response: 'absolutely not, and please stop throwing those things around near us, it's terrifying and we're scared for our lives.'"; internal const int _IDLE_FPS = 16; internal const float _DEBRIS_GLOW = 500f; internal static Projectile _JugglingBallProjectile = null; internal static List _JuggleAnimations = new List(6); internal static List _MinEmission = new List { 10f, 50f, 100f, 200f, 300f, 400f }; internal static string _TrueIdleAnimation; internal static IntVector2 _CarryOffset = new IntVector2(-14, -8); internal static IntVector2 _FlippedCarryOffset = new IntVector2(21, -8); internal static List _Colors = new List { Color.red, Color.blue, Color.yellow, Color.green, new Color(0.627f, 0.125f, 0.941f), new Color(1f, 0.647f, 0f, 1f) }; internal static List _ImpactVFX = new List { null, null, null, null, null, null }; internal static List _ColorIndices = new List { 0, 2, 0, 5, 0, 0, 0, 3, 0, 1, 0, 4, 0, 2, 0, 5, 0, 0, 0, 3, 0, 1, 0, 4 }; private int _juggleLevel; private Coroutine _glowRoutine; private List _juggledEnemies = new List(); public static void Init() { //IL_00f8: 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_0498: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_092e: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 30; int? reloadFps = 40; Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)50, 0f, 240, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, 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).AddFlippedCarryPixelOffsets(_CarryOffset, _FlippedCarryOffset).AssignGun(out gunRef); int? clipSize = -1; float? cooldown = 0.4f; float? damage = 10f; float? speed = 70f; bool? shouldRotate = false; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "jugglernaut_projectile", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, "wall_thunk", shouldRotate, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, "jugglernaut_throw_sound", null, null, null, null, null, null, null, null, null, null, null, null, 0f, ignoredForReloadPurposes: false, mirror: false, null, null, null, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: false, 0f, null, 500f)); gunRef.LockedHorizontalOnCharge = true; gunRef.LockedHorizontalCenterFireOffset = 0f; Transform transform = ((Component)gunRef.barrelOffset).transform; transform.position -= 0.0625f * ((IntVector2)(ref _CarryOffset)).ToVector3(); gunRef.reloadAnimation = null; gunRef.shootAnimation = null; _TrueIdleAnimation = gunRef.idleAnimation; for (int i = 0; i < 6; i++) { _JuggleAnimations.Add(gunRef.QuickUpdateGunAnimation($"{i + 1}_gun", null, returnToIdle: false, 16)); gunRef.SetGunAudio(_JuggleAnimations[i], "juggle_toss_sound", 5, 17); if (i > 0) { gunRef.SetGunAudio(_JuggleAnimations[i], "juggle_toss_sound", 9, 21); } if (i > 1) { gunRef.SetGunAudio(_JuggleAnimations[i], "juggle_toss_sound", 1, 13); } if (i > 2) { gunRef.SetGunAudio(_JuggleAnimations[i], "juggle_toss_sound", 7, 19); } if (i > 3) { gunRef.SetGunAudio(_JuggleAnimations[i], "juggle_toss_sound", 11, 23); } if (i > 4) { gunRef.SetGunAudio(_JuggleAnimations[i], "juggle_toss_sound", 3, 15); } } speed = 2f; damage = 50f; float? force = 2f; float? range = 80f; _JugglingBallProjectile = Items.Ak47.CloneProjectile(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, speed, damage, force, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "jugglernaut_ball_gray_projectile", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 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, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: false, 0f, null, 500f)); List list = new List(6) { "jugglernaut_impact_vfx_red", "jugglernaut_impact_vfx_blue", "jugglernaut_impact_vfx_yellow", "jugglernaut_impact_vfx_green", "jugglernaut_impact_vfx_purple", "jugglernaut_impact_vfx_orange" }; for (int j = 0; j < 6; j++) { List impactVFX = _ImpactVFX; int index = j; string name = list[j]; Color? emissiveColour = new Color(0.5f, 0.5f, 0.5f); impactVFX[index] = VFX.CreatePool(name, 60f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 10f, emissiveColour, orphaned: false, attached: true, unlit: false, 0f, 0f, null, 10f, 0f, 1f); } } public override void OnPlayerPickup(PlayerController player) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown base.OnPlayerPickup(player); ((BraveBehaviour)player).healthHaver.OnDamaged += new OnDamagedEvent(OnPlayerDamaged); ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.StopAndResetFrameToDefault(); ResetJuggle(); ((Component)((BraveBehaviour)((GunBehaviour)this).gun).sprite).gameObject.SetGlowiness(0f); } public override void OnDroppedByPlayer(PlayerController player) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown base.OnDroppedByPlayer(player); ((BraveBehaviour)player).healthHaver.OnDamaged -= new OnDamagedEvent(OnPlayerDamaged); ResetJuggle(); ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.currentClip = ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.GetClipByName(_TrueIdleAnimation); ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.StopAndResetFrameToDefault(); } public override void OnDestroy() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) && Object.op_Implicit((Object)(object)((BraveBehaviour)((GunBehaviour)this).PlayerOwner).healthHaver)) { ((BraveBehaviour)((GunBehaviour)this).PlayerOwner).healthHaver.OnDamaged -= new OnDamagedEvent(OnPlayerDamaged); } base.OnDestroy(); } private void OnPlayerDamaged(float resultValue, float maxValue, CoreDamageTypes damageTypes, DamageCategory damageCategory, Vector2 damageDirection) { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) && !((GunBehaviour)this).PlayerOwner.HasSynergy(Synergy.SOLID_FOOTING)) { ResetJuggle(); } } private void DropGuns(PlayerController player, int oldGuns, int newGuns) { //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_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_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_004f: 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_00c3: Expected O, but got Unknown //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) if (newGuns < oldGuns) { Vector2 centerPosition = ((GameActor)player).CenterPosition; tk2dSpriteAnimationClip defaultClip = ((Component)((BraveBehaviour)((GunBehaviour)this).gun.DefaultModule.projectiles[0]).sprite).GetComponent().DefaultClip; for (int i = newGuns; i < oldGuns; i++) { GameObject val = new GameObject(); val.transform.position = Vector2.op_Implicit(centerPosition); tk2dSprite val2 = val.AddComponent(); ((tk2dBaseSprite)val2).SetSprite(defaultClip.frames[i].spriteCollection, defaultClip.frames[i].spriteId); ((tk2dBaseSprite)(object)val2).SetGlowiness(500f); Extensions.AutoRigidBody(val, (CollisionLayer)14); DebrisObject obj = val.AddComponent(); obj.angularVelocity = 45f; obj.angularVelocityVariance = 20f; obj.decayOnBounce = 0.5f; obj.bounceCount = 2; obj.canRotate = true; obj.shouldUseSRBMotion = true; ((BraveBehaviour)obj).sprite = (tk2dBaseSprite)(object)val2; obj.animatePitFall = true; obj.AssignFinalWorldDepth(-0.5f); obj.Trigger(Vector2.op_Implicit(Lazy.RandomVector(4f)), 1f, 1f); } } } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.StopAndResetFrameToDefault(); tk2dSpriteAnimator spriteAnimator = ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator; spriteAnimator.AnimationEventTriggered = (Action)Delegate.Remove(spriteAnimator.AnimationEventTriggered, new Action(ShootAndJuggle)); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) && base.Mastered) { tk2dSpriteAnimator spriteAnimator2 = ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator; spriteAnimator2.AnimationEventTriggered = (Action)Delegate.Combine(spriteAnimator2.AnimationEventTriggered, new Action(ShootAndJuggle)); } ResetJuggle(); } private void ShootAndJuggle(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frame) { //IL_001b: 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_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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00ac: Unknown result type (might be due to invalid IL or missing references) Projectile component = SpawnManager.SpawnProjectile(((Component)_JugglingBallProjectile).gameObject, ((GunBehaviour)this).gun.barrelOffset.position, ((GunBehaviour)this).PlayerOwner.m_currentGunAngle.EulerZ(), true).GetComponent(); component.baseData.damage = 2f; component.SetOwnerAndStats((GameActor)(object)((GunBehaviour)this).PlayerOwner); Color tint = _Colors[_ColorIndices[frame]]; component.Attach((Action)delegate(EasyTrailBullet trail) { //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_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) //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_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) trail.StartWidth = 0.2f; trail.EndWidth = 0.05f; trail.LifeTime = 0.05f; trail.BaseColor = tint; trail.StartColor = tint; trail.EndColor = Color.Lerp(tint, Color.white, 0.25f); }, allowDuplicates: false); ((BraveBehaviour)component).sprite.SetGlowiness(250f, tint, Color.Lerp(tint, Color.white, 0.75f)); ((Component)this).gameObject.PlayUnique("jugglernaut_ball_throw_sound"); } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ResetJuggle(); } } public override void PostProcessProjectile(Projectile projectile) { ((GunBehaviour)this).PostProcessProjectile(projectile); int num = Random.Range(0, 1 + _juggleLevel); ((Component)projectile).gameObject.AddComponent().Setup(this, num); projectile.SetAllImpactVFX(_ImpactVFX[num]); ProjectileData baseData = projectile.baseData; baseData.damage *= 1f + (float)_juggleLevel; projectile.DestroyMode = (ProjectileDestroyMode)2; } public void RegisterEnemyHit(AIActor enemy) { for (int num = _juggledEnemies.Count - 1; num >= 0; num--) { if (!((Object)(object)_juggledEnemies[num] != (Object)(object)enemy)) { for (int num2 = num; num2 >= 0; num2--) { _juggledEnemies.RemoveAt(num2); } break; } } _juggledEnemies.Add(enemy); UpdateLevel(returnIfUnchanged: true); } private void ResetJuggle() { _juggledEnemies.Clear(); UpdateLevel(); } private void UpdateLevel(bool returnIfUnchanged = false) { int juggleLevel = _juggleLevel; _juggleLevel = Mathf.Clamp(_juggledEnemies.Count - 1, 0, _JuggleAnimations.Count - 1); if (returnIfUnchanged && _juggleLevel == juggleLevel) { return; } if (_juggleLevel > juggleLevel) { if (_glowRoutine != null) { ((MonoBehaviour)((GunBehaviour)this).gun).StopCoroutine(_glowRoutine); } _glowRoutine = ((MonoBehaviour)((GunBehaviour)this).gun).StartCoroutine(GlowUp()); } else { ((BraveBehaviour)((BraveBehaviour)((GunBehaviour)this).gun).sprite).renderer.material.SetFloat(CwaffVFX._EmissivePowerId, _MinEmission[_juggleLevel]); if (_juggleLevel < juggleLevel) { if (_juggledEnemies.Count == 0) { ((Component)((GunBehaviour)this).PlayerOwner).gameObject.Play("juggle_drop_sound"); } DropGuns(((GunBehaviour)this).PlayerOwner, 1 + juggleLevel, 1 + _juggleLevel); } } UpdateIdleAnimation(); } private void UpdateIdleAnimation() { ((GunBehaviour)this).gun.idleAnimation = _JuggleAnimations[_juggleLevel]; ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.currentClip = ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.GetClipByName(((GunBehaviour)this).gun.idleAnimation); ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.Play(); ((BraveBehaviour)((GunBehaviour)this).gun).sprite.usesOverrideMaterial = true; } private IEnumerator GlowUp() { float minEmit = _MinEmission[_juggleLevel]; Material m = ((BraveBehaviour)((BraveBehaviour)((GunBehaviour)this).gun).sprite).renderer.material; m.SetFloat(CwaffVFX._EmissivePowerId, 0f); ((Component)((GunBehaviour)this).gun).gameObject.Play("juggle_add_sound"); for (float elapsed = 0f; elapsed < 0.25f; elapsed += BraveTime.DeltaTime) { float num = elapsed / 0.25f; m.SetFloat(CwaffVFX._EmissivePowerId, 800f * num * num); yield return null; } for (float elapsed = 0f; elapsed < 1f; elapsed += BraveTime.DeltaTime) { float num2 = 1f - elapsed / 1f; m.SetFloat(CwaffVFX._EmissivePowerId, minEmit + (800f - minEmit) * num2 * num2); yield return null; } } public override void Update() { base.Update(); PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null) { Lazy.PlaySoundUntilDeathOrTimeout("circus_music", ((Component)playerOwner).gameObject, 0.1f); UpdateIdleAnimation(); } } private void LateUpdate() { PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null) { if (playerOwner.m_currentGunAngle > 25f && playerOwner.m_currentGunAngle < 155f) { ((BraveBehaviour)((GunBehaviour)this).gun).sprite.HeightOffGround = -0.075f; } else { ((BraveBehaviour)((GunBehaviour)this).gun).sprite.HeightOffGround = 0.4f; } ((BraveBehaviour)((GunBehaviour)this).gun).sprite.UpdateZDepth(); } } } public class JugglernautProjectile : MonoBehaviour { private const float _ROT_RATE = 24f; private Projectile _projectile; private PlayerController _owner; private Jugglernaut _jugglernaut; private float _rotation; private int _frame; public void Setup(Jugglernaut jugglernaut, int frame) { _projectile = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); _jugglernaut = jugglernaut; _frame = frame; Projectile projectile = _projectile; projectile.OnHitEnemy = (Action)Delegate.Combine(projectile.OnHitEnemy, new Action(OnHitEnemy)); Projectile projectile2 = _projectile; projectile2.OnBecameDebris = (Action)Delegate.Combine(projectile2.OnBecameDebris, new Action(OnBecameDebris)); } private void OnDestroy() { CleanupSelf(); } private void CleanupSelf() { if (Object.op_Implicit((Object)(object)_projectile)) { Projectile projectile = _projectile; projectile.OnHitEnemy = (Action)Delegate.Remove(projectile.OnHitEnemy, new Action(OnHitEnemy)); Projectile projectile2 = _projectile; projectile2.OnBecameDebris = (Action)Delegate.Remove(projectile2.OnBecameDebris, new Action(OnBecameDebris)); _projectile = null; } } private void OnBecameDebris(DebrisObject obj) { CleanupSelf(); Object.Destroy((Object)(object)this); } private void Start() { _projectile.PickFrame(_frame); _rotation = 360f * Random.value; } private void Update() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_projectile) && Object.op_Implicit((Object)(object)((BraveBehaviour)_projectile).specRigidbody)) { _rotation += Mathf.Sign(((BraveBehaviour)_projectile).specRigidbody.Velocity.x) * 24f * _projectile.baseData.speed * BraveTime.DeltaTime; ((BraveBehaviour)_projectile).transform.localRotation = _rotation.EulerZ(); } } private void OnHitEnemy(Projectile bullet, SpeculativeRigidbody body, bool killed) { if (Object.op_Implicit((Object)(object)_projectile) && Object.op_Implicit((Object)(object)_jugglernaut)) { AIActor aiActor = ((BraveBehaviour)body).aiActor; if (aiActor != null) { _jugglernaut.RegisterEnemyHit(aiActor); } } } } public class PortableHydroTurret : CwaffGun { public static string ItemName = "Portable Hydro Turret"; public static string ShortDescription = "Power Rinse"; public static string LongDescription = "Fires short bursts of compressed water. Infinite ammo. Does not reveal secret walls."; public static string Lore = "A portable variant of the hydro turret, capable of blasting water with 100 times more force than your average water gun. This sounds impressive, until you consider the combat effectiveness of your average water gun. Maybe you can trigger a bit of rust or snuff out a Muzzle Wisp, if you're lucky."; public static void Init() { //IL_0194: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 30; Gun gun2 = gun.SetAttributes((ItemQuality)(-100), (GunClass)55, 0.5f, 100, Items.Banana, defaultAudio: false, infiniteAmmo: true, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, null, null, null, "portable_hydro_turret_fire_sound", 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, autoPlay: true, attacksThroughWalls: false, suppressReloadLabel: false, 1f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: false, preventRollingWhenCharging: false, 1f, 0.1f, canAttackWhileRolling: false, isStarterGun: true, 1f, preventDuctTape: false, 0.5f, preventVolleyModifications: false, undroppableStarter: true).SetReloadAudio("portable_hydro_turret_reload_sound", 0, 2, 4, 6); PickupObject obj = ItemHelper.Get(Items.EyeOfTheBeholster); Gun gun3 = gun2.SetMuzzleVFX(((Gun)((obj is Gun) ? obj : null)).DefaultModule.finalProjectile.hitEffects.enemy); int? clipSize = 10; float? cooldown = 0.1f; float? damage = 3f; float? speed = 60f; float? range = 10f; float? force = 1f; float? glowColorPower = 7f; Color? glowColor = new Color(0.5f, 0.5f, 1f); Projectile p = gun3.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, "portable_hydro_turret_projectile", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, null, "portable_hydro_turret_impact_sound", null, null, null, 0f, ignoredForReloadPurposes: false, mirror: false, null, null, null, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: false, 0f, null, 7f, glowColor, glowColorPower, -1, null, null, null, null, null, null, null, 1.55f, -1f, 0f, -1f, -1f, useBetterEmissiveShader: true, 2f)); PickupObject obj2 = ItemHelper.Get(Items.EyeOfTheBeholster); p.SetAllImpactVFX(((Gun)((obj2 is Gun) ? obj2 : null)).DefaultModule.finalProjectile.hitEffects.enemy); } } public class KALI : CwaffGun { public static string ItemName = "K.A.L.I."; public static string ShortDescription = "Fission"; public static string LongDescription = "Fires high-velocity piercing particles with high recoil. Projectile damage, velocity, and recoil are doubled at level 2 charge and again at level 3 charge. Destroys enemy projectiles at level 3 charge. Continuously drains ammo while charging. Killed enemies are obliterated and do not drop casings or pickups. "; public static string Lore = "Developed by the nation of Gundia's Department of the Best Defense is a Good Offense, this high-powered handheld electron accelerator can instantaneously ionize most targets and anything in direct contact with them. Various ongoing attempts by the government to market the device to the nation's citizens as a children's toy, a water purifier, and a flashlight have all been criticized by major media outlets as 'irresponsible and asinine', although surveys suggest high market interest from the age 12-17 demographic."; private const float _AMMO_DRAIN_RATE = 1f; internal static GameObject _IonizeVFX = null; internal static Projectile _KaliProjectile = null; internal static List _ChargeAnimations = null; internal GameObject _timeShifter; private int _chargeLevel = -1; private float _timeCharging; public static void Init() { //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_06c3: Unknown result type (might be due to invalid IL or missing references) //IL_06d3: Expected O, but got Unknown //IL_06d4: Unknown result type (might be due to invalid IL or missing references) //IL_06d9: Unknown result type (might be due to invalid IL or missing references) //IL_097b: Unknown result type (might be due to invalid IL or missing references) //IL_098b: Expected O, but got Unknown //IL_098c: Unknown result type (might be due to invalid IL or missing references) //IL_0991: Unknown result type (might be due to invalid IL or missing references) //IL_0c33: Unknown result type (might be due to invalid IL or missing references) //IL_0c43: Expected O, but got Unknown Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore).SetAttributes((ItemQuality)3, (GunClass)60, 0.1f, 200, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, null, null, null, null, "kali_shoot_sound", 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).AssignGun(out Gun gunRef) .InitProjectile(GunData.New(null, null, range: 9999f, force: 3f, cooldown: 0.1f, collidesWithProjectiles: true, clipSize: 1, angleVariance: null, shootStyle: (ShootStyle)3, sequenceStyle: (ProjectileSequenceStyle)0, chargeTime: 0f, ammoCost: 1, ammoType: null, customClip: true, damage: null, speed: null, recoil: null, poison: 0f, fire: 0f, freeze: 0f, slow: 0f, collidesWithEnemies: null, ignoreDamageCaps: null, surviveRigidbodyCollisions: null, collidesWithTilemap: null, sprite: "kali_projectile", fps: 2, anchor: (Anchor)4)) .Attach((Action)delegate(PierceProjModifier pierce) { pierce.penetration = 999; pierce.penetratesBreakables = true; }, allowDuplicates: false) .AttachTrail("kali_trail", 60, null, -1f, 1f / 60f, 1f, destroyOnEmpty: false, Lazy.DispersalParticles(Color.cyan)) .Assign(out _KaliProjectile); ProjectileModule defaultModule = gunRef.DefaultModule; defaultModule.projectiles.Clear(); List list = new List(); ChargeProjectile val = new ChargeProjectile(); Projectile kaliProjectile = _KaliProjectile; float? damage = 25f; float? speed = 175f; float? recoil = 100f; val.Projectile = kaliProjectile.Clone(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, damage, speed, null, null, recoil, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4)).Attach(delegate(KaliProjectile k) { k.SetChargeLevel(1); }); val.ChargeTime = 1f; list.Add(val); ChargeProjectile val2 = new ChargeProjectile(); Projectile kaliProjectile2 = _KaliProjectile; recoil = 50f; speed = 350f; damage = 200f; val2.Projectile = kaliProjectile2.Clone(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, recoil, speed, null, null, damage, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4)).Attach(delegate(KaliProjectile k) { k.SetChargeLevel(2); }); val2.ChargeTime = 2f; list.Add(val2); ChargeProjectile val3 = new ChargeProjectile(); Projectile kaliProjectile3 = _KaliProjectile; damage = 100f; speed = 700f; recoil = 400f; val3.Projectile = kaliProjectile3.Clone(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, damage, speed, null, null, recoil, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4)).Attach(delegate(KaliProjectile k) { k.SetChargeLevel(3); }); val3.ChargeTime = 3f; list.Add(val3); defaultModule.chargeProjectiles = list; _ChargeAnimations = new List { gunRef.QuickUpdateGunAnimation("charge", null, returnToIdle: false, 20), gunRef.QuickUpdateGunAnimation("charge_more", null, returnToIdle: false, 40), gunRef.QuickUpdateGunAnimation("charge_most", null, returnToIdle: false, 60) }; gunRef.SetGunAudio(_ChargeAnimations[2], "kali_charge_sound"); _IonizeVFX = VFX.Create("kali_ionize_particle", 7f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 100f); } public override void Update() { base.Update(); if (BraveTime.DeltaTime == 0f || ((GunBehaviour)this).PlayerOwner == null) { return; } if (!((GunBehaviour)this).gun.IsCharging) { _chargeLevel = -1; _timeCharging = 0f; ((GunBehaviour)this).gun.chargeAnimation = _ChargeAnimations[0]; ((BraveBehaviour)((GunBehaviour)this).gun).sprite.usesOverrideMaterial = false; ((BraveBehaviour)((BraveBehaviour)((GunBehaviour)this).gun).sprite).renderer.material.SetFloat(CwaffVFX._EmissivePowerId, 0f); ((BraveBehaviour)((GunBehaviour)this).gun).sprite.UpdateMaterial(); return; } if ((_timeCharging += BraveTime.DeltaTime) > 1f) { _timeCharging -= 1f; ((GunBehaviour)this).gun.LoseAmmo(1); } int num = 1 + ((GunBehaviour)this).gun.GetChargeLevel(); if (num != _chargeLevel) { _chargeLevel = num; ((GunBehaviour)this).gun.chargeAnimation = _ChargeAnimations[Math.Max(num - 1, 0)]; ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.currentClip = ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.GetClipByName(((GunBehaviour)this).gun.chargeAnimation); if (num == 0) { ((Component)this).gameObject.Play("kali_activate_sound"); ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.Play(); } else if (num < 3) { ((Component)this).gameObject.Play("kali_charge_sound"); ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.Play(); } else { ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.PlayFromFrame(0); } ((Component)((BraveBehaviour)((GunBehaviour)this).gun).sprite).gameObject.SetGlowiness(25f + 25f * (float)num); } } public override void OnPlayerPickup(PlayerController player) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown base.OnPlayerPickup(player); _timeShifter.SafeDestroy(); _timeShifter = new GameObject(); _timeShifter.AddComponent(); _timeShifter.transform.parent = ((BraveBehaviour)player).transform; ((Component)((BraveBehaviour)((GunBehaviour)this).gun).sprite).gameObject.SetGlowiness(0f); } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); _timeShifter.SafeDestroy(); } public override void OnDestroy() { _timeShifter.SafeDestroy(); base.OnDestroy(); } public override void PostProcessProjectile(Projectile projectile) { ((GunBehaviour)this).PostProcessProjectile(projectile); KaliProjectile component = ((Component)projectile).GetComponent(); if (component != null) { component.Mastered = base.Mastered; if (component.GetChargeLevel() == 3) { _timeShifter.GetComponent().Reset(); } ((BraveBehaviour)projectile).transform.DoMovingDistortionWave(2.5f, 0.25f, 0.25f, 0.75f); } } } public class KaliProjectile : MonoBehaviour { [SerializeField] private int _chargeLevel; public bool Mastered { get; internal set; } private void Start() { //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 //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown CwaffTrailController componentInChildren = ((Component)this).GetComponentInChildren(); if (componentInChildren != null) { ((Component)componentInChildren).gameObject.SetGlowiness(100f); } Projectile component = ((Component)this).GetComponent(); component.OnWillKillEnemy = (Action)Delegate.Combine(component.OnWillKillEnemy, new Action(OnWillKillEnemy)); component.OnHitEnemy = (Action)Delegate.Combine(component.OnHitEnemy, new Action(OnHitEnemy)); if (Object.op_Implicit((Object)(object)((BraveBehaviour)component).specRigidbody)) { SpeculativeRigidbody specRigidbody = ((BraveBehaviour)component).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(MaybeVaporizeProjectiles)); SpeculativeRigidbody specRigidbody2 = ((BraveBehaviour)component).specRigidbody; specRigidbody2.OnRigidbodyCollision = (OnRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody2.OnRigidbodyCollision, (Delegate?)new OnRigidbodyCollisionDelegate(VaporizeProjectiles)); } } private void MaybeVaporizeProjectiles(SpeculativeRigidbody me, PixelCollider myPixelCollider, SpeculativeRigidbody other, PixelCollider otherPixelCollider) { Projectile component = ((Component)other).GetComponent(); if (component != null) { if (_chargeLevel != 3) { PhysicsEngine.SkipCollision = true; } else if (component.Owner is PlayerController) { PhysicsEngine.SkipCollision = true; } } } private void VaporizeProjectiles(CollisionData rigidbodyCollision) { //IL_003d: 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 (_chargeLevel == 3) { Projectile component = ((Component)rigidbodyCollision.OtherRigidbody).GetComponent(); if (component != null && !(component.Owner is PlayerController)) { tk2dBaseSprite obj = ((BraveBehaviour)component).sprite.DuplicateInWorld(); obj.SetGlowiness(300f, overrideColor: Color.cyan, glowColor: Color.cyan, clampBrightness: false); ((MonoBehaviour)obj).StartCoroutine(CriticalGlow(obj)); component.DieInAir(true, false, false, true); } } } public void SetChargeLevel(int level) { _chargeLevel = level; } public int GetChargeLevel() { return _chargeLevel; } private void OnHitEnemy(Projectile p, SpeculativeRigidbody enemy, bool killed) { ((Component)enemy).gameObject.Play("kali_impact_sound"); } private void OnWillKillEnemy(Projectile p, SpeculativeRigidbody body) { //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) if (Object.op_Implicit((Object)(object)((BraveBehaviour)body).aiActor) && !((BraveBehaviour)body).aiActor.IsABoss(canBeDead: true)) { tk2dBaseSprite obj = ((BraveBehaviour)body).aiActor.DuplicateInWorld(); obj.SetGlowiness(300f, overrideColor: Color.cyan, glowColor: Color.cyan, clampBrightness: false); ((MonoBehaviour)obj).StartCoroutine(CriticalGlow(obj)); if (Mastered) { ((BraveBehaviour)body).aiActor.EraseFromExistenceWithRewards(true); } else { ((BraveBehaviour)body).aiActor.EraseFromExistence(true); } } } private static IEnumerator CriticalGlow(tk2dBaseSprite sprite) { Material m = ((BraveBehaviour)sprite).renderer.material; for (float elapsed = 0f; elapsed < 0.5f; elapsed += BraveTime.DeltaTime) { float num = elapsed / 0.5f; m.SetFloat(CwaffVFX._EmissivePowerId, 300f + 2700f * num); yield return null; } GameObject ionizeVFX = KALI._IonizeVFX; Vector2 worldCenter = sprite.WorldCenter; Color? emissiveColor = Color.cyan; float? startScale = 1f; float? endScale = 1f; CwaffVFX.SpawnBurst(ionizeVFX, 50, worldCenter, 1f, null, 40f, 40f, CwaffVFX.Vel.Away, CwaffVFX.Rot.None, 0.5f, null, 300f, emissiveColor, fadeIn: false, uniform: false, startScale, endScale); ((Component)sprite).gameObject.PlayUnique("kali_explode_sound"); Object.Destroy((Object)(object)((Component)sprite).gameObject); } } public class KaliTimeshifter : MonoBehaviour { private const float _MIN_TIME_SCALE = 0.1f; private const float _DLT_TIME_SCALE = 0.9f; private const float _EASE_TIME = 0.7f; private float _curTime; private void Start() { _curTime = 0.7f; } private void Update() { if (BraveTime.DeltaTime != 0f) { _curTime += Time.unscaledDeltaTime; if (_curTime >= 0.7f) { BraveTime.ClearMultiplier(((Component)this).gameObject); return; } float num = _curTime / 0.7f; float num2 = num * num * num; BraveTime.SetTimeScaleMultiplier(0.1f + 0.9f * num2, ((Component)this).gameObject); } } public void Reset() { _curTime = 0f; } private void OnDestroy() { BraveTime.ClearMultiplier(((Component)this).gameObject); } } public class AlienNailgun : CwaffGun { public static string ItemName = "Alien Nailgun"; public static string ShortDescription = "Attack, Adapt, Assimilate"; public static string LongDescription = "Fires nails that extract enemy DNA on kill. Can be charged to consume 16 ammo and assemble a replicant enemy from DNA. Replicants are invulnerable, have no collision, cannot harm the player with projectiles or contact damage, and dissipate when combat ends. Reloading with a full clip cycles through extracted DNA sequences."; public static string Lore = "Having arrived on Earth en masse in a strange meteorite, this gadget launches fingers that quickly retract on impact to physically scrape data off of recently-deceased life forms. Unbeknownst to Gungeoneers, the meteorite was actually an intergalactic standard wastebin, and this eons-old prototype was discarded after its inventors discovered light-based replicators were cheaper, faster, less convoluted, and ultimately less weird."; private const float _RECONSTRUCT_DELAY = 0.2f; private const float _RECONSTRUCT_TIME = 0.8f; private const int _RECONSTRUCT_COST = 16; private const float _FRAGMENT_SPAWN_TIME = 0.3f; private const float _PREVIEW_TIME = 0.8f; private const int _FRAGMENT_EDGE = 4; private const int _FRAGMENTS = 16; private const float _FRAGMENT_GAP = 0.05f; private static HashSet _Replicants = new HashSet(); private Coroutine _dnaReconstruct; private int _spawnIndex = -1; private string _targetGuid; private bool _constructionComplete; private List _fragments = new List(); private GameObject _preview; [SerializeField] private List _registeredEnemies = new List(); public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? idleFps = 24; int? shootFps = 24; int? reloadFps = 60; Items? muzzleFrom = Items.Mailbox; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)1, 0.7f, 480, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, idleFps, shootFps, reloadFps, null, null, "alien_nailgun_shoot_sound", "gorgun_eye_activate", null, -1, 0, -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).AddToShop((ShopType)0); int? clipSize = 16; float? cooldown = 0.14f; float? damage = 5f; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)3, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "alien_nailgun_projectile", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: true)).Attach(); } public override void OnFullClipReload(PlayerController player, Gun gun) { if (!player.IsDodgeRolling && _registeredEnemies.Count != 0) { if (Object.op_Implicit((Object)(object)_preview)) { _spawnIndex = (_spawnIndex + 1) % _registeredEnemies.Count; } if (_spawnIndex < 0) { _spawnIndex = 0; } SwitchEnemyToSpawn(_registeredEnemies[_spawnIndex]); } } private void SwitchEnemyToSpawn(string guid, bool isNew = false) { //IL_0048: 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) PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null) { _targetGuid = guid; if (Object.op_Implicit((Object)(object)_preview)) { _preview.SafeDestroy(); } Lazy.GetCollectionAndIdForBestIdleAnimation(EnemyDatabase.GetOrLoadByGuid(guid), out var spriteCol, out var spriteId); tk2dSprite val = Lazy.SpriteObject(spriteCol, spriteId); ((tk2dBaseSprite)val).PlaceAtPositionByAnchor(Vector2.op_Implicit(((BraveBehaviour)playerOwner).sprite.WorldTopCenter + new Vector2(0f, 0.5f)), (Anchor)1); ((tk2dBaseSprite)(object)val).MakeHolographic(green: true); _preview = ((Component)val).gameObject; _preview.transform.parent = ((BraveBehaviour)playerOwner).transform; _preview.ExpireIn(0.8f); if (isNew) { _preview.Play("replicant_select_new_sound"); } else { _preview.Play("replicant_select_sound"); } } } public override void Update() { base.Update(); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) && BraveTime.DeltaTime != 0f) { if (!((GunBehaviour)this).gun.IsCharging || !((GunBehaviour)this).PlayerOwner.IsInCombat) { StopReconstruction(); ((GunBehaviour)this).gun.SynchronizeReloadAcrossAllModules(); } else if (!_constructionComplete && !string.IsNullOrEmpty(_targetGuid) && ((GunBehaviour)this).gun.CurrentAmmo >= 16 && _dnaReconstruct == null) { _dnaReconstruct = ((MonoBehaviour)this).StartCoroutine(ReconstructFromDNA(_targetGuid)); } } } private static void ApplyReplicantShaders(tk2dBaseSprite sprite) { sprite.MakeHolographic(green: true); } private IEnumerator ReconstructFromDNA(string guid) { Vector2 position = ((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition; for (float elapsed = 0f; elapsed < 0.2f; elapsed += BraveTime.DeltaTime) { yield return null; } float timer = 0f; int i = 0; while (i < 16) { while (timer > 0.05f) { Vector2 startPosition = ((Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) && Object.op_Implicit((Object)(object)((GameActor)((GunBehaviour)this).PlayerOwner).CurrentGun)) ? Vector2.op_Implicit(((GameActor)((GunBehaviour)this).PlayerOwner).CurrentGun.barrelOffset.position) : (position + Lazy.RandomVector(4f))); GameObject val = CreateEnemyFragment(guid, i, position, startPosition, 0.3f); _fragments.Add(val); val.Play("replicant_assemble_sound"); timer -= 0.05f; int num = i + 1; i = num; if (num >= 16) { break; } } yield return null; timer += BraveTime.DeltaTime; } yield return (object)new WaitForSeconds(0.3f); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((Component)((GunBehaviour)this).PlayerOwner).gameObject.Play("replicant_created_sound"); } AIActor val2 = Replicant.Create(guid, position, ApplyReplicantShaders, hasCollision: false); if (Object.op_Implicit((Object)(object)val2)) { _Replicants.Add(val2); } foreach (GameObject fragment in _fragments) { fragment.SafeDestroy(); } _fragments.Clear(); ((GunBehaviour)this).gun.LoseAmmo(16); _constructionComplete = true; } public override void OnPlayerPickup(PlayerController player) { StaticReferenceManager.ProjectileAdded -= CheckFromReplicantOwner; StaticReferenceManager.ProjectileAdded += CheckFromReplicantOwner; CwaffEvents.OnBankBulletOwnerAssigned = (Action)Delegate.Remove(CwaffEvents.OnBankBulletOwnerAssigned, new Action(CheckFromReplicantOwner)); CwaffEvents.OnBankBulletOwnerAssigned = (Action)Delegate.Combine(CwaffEvents.OnBankBulletOwnerAssigned, new Action(CheckFromReplicantOwner)); player.OnAnyEnemyReceivedDamage = (Action)Delegate.Remove(player.OnAnyEnemyReceivedDamage, new Action(CheckIfEnemyKilled)); player.OnAnyEnemyReceivedDamage = (Action)Delegate.Combine(player.OnAnyEnemyReceivedDamage, new Action(CheckIfEnemyKilled)); base.OnPlayerPickup(player); player.OnRoomClearEvent += DestroyReplicants; } public override void OnDroppedByPlayer(PlayerController player) { player.OnRoomClearEvent -= DestroyReplicants; player.OnAnyEnemyReceivedDamage = (Action)Delegate.Remove(player.OnAnyEnemyReceivedDamage, new Action(CheckIfEnemyKilled)); StopReconstruction(); DestroyReplicants(player); base.OnDroppedByPlayer(player); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; playerOwner.OnAnyEnemyReceivedDamage = (Action)Delegate.Remove(playerOwner.OnAnyEnemyReceivedDamage, new Action(CheckIfEnemyKilled)); } base.OnDestroy(); } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); StopReconstruction(); } private void CheckIfEnemyKilled(float damage, bool fatal, HealthHaver enemy) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)this)) { Lazy.RuntimeWarn("Calling an event from a nonexistent Alien Nailgun, tell pretzel"); } else { if (!fatal) { return; } PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null || !playerOwner.IsInCombat || !base.Mastered) { return; } AIActor aiActor = ((BraveBehaviour)enemy).aiActor; if (aiActor != null && !string.IsNullOrEmpty(aiActor.EnemyGuid) && _registeredEnemies.Contains(aiActor.EnemyGuid)) { AIActor val = Replicant.Create(aiActor.EnemyGuid, ((GameActor)aiActor).CenterPosition, ApplyReplicantShaders, hasCollision: false); if (Object.op_Implicit((Object)(object)val)) { _Replicants.Add(val); ((Component)playerOwner).gameObject.Play("replicant_created_sound"); } } } } private static void CheckFromReplicantOwner(Projectile p) { if (Object.op_Implicit((Object)(object)p)) { GameActor owner = p.Owner; AIActor val = (AIActor)(object)((owner is AIActor) ? owner : null); if (val != null && _Replicants.Contains(val)) { p.StopCollidingWithPlayers(); p.collidesWithEnemies = true; ((Component)(object)p).AddComponent(); } } } private void StopReconstruction() { if (_dnaReconstruct != null) { ((MonoBehaviour)this).StopCoroutine(_dnaReconstruct); _dnaReconstruct = null; foreach (GameObject fragment in _fragments) { fragment.SafeDestroy(); } _fragments.Clear(); } _constructionComplete = false; } private static GameObject CreateEnemyFragment(string guid, int index, Vector2 targetPosition, Vector2 startPosition, float travelTime, float delay = 0f, bool autoDestroy = false) { //IL_0089: 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_009b: 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) Lazy.GetCollectionAndIdForBestIdleAnimation(EnemyDatabase.GetOrLoadByGuid(guid), out var spriteCol, out var spriteId); tk2dSpriteDefinition spriteFragment = Lazy.GetSpriteFragment(spriteCol.spriteDefinitions[spriteId], index % 4, index / 4, 4); string name = spriteFragment.name; if (spriteCol.spriteNameLookupDict == null) { spriteCol.InitDictionary(); } if (!spriteCol.spriteNameLookupDict.TryGetValue(name, out var value)) { value = spriteCol.spriteDefinitions.Length; Array.Resize(ref spriteCol.spriteDefinitions, spriteCol.spriteDefinitions.Length + 1); spriteCol.spriteDefinitions[value] = spriteFragment; spriteCol.spriteNameLookupDict[name] = value; } tk2dSprite obj = Lazy.SpriteObject(spriteCol, value); ((tk2dBaseSprite)obj).PlaceAtPositionByAnchor(Vector2.op_Implicit(startPosition), (Anchor)4); ((Component)(object)obj).AddComponent().Setup(startPosition, targetPosition, travelTime, delay, autoDestroy); ((tk2dBaseSprite)(object)obj).MakeHolographic(green: true); return ((Component)obj).gameObject; } private static void DestroyReplicants(PlayerController player) { //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) //IL_002f: 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_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) foreach (AIActor replicant in _Replicants) { if (Object.op_Implicit((Object)(object)replicant)) { Vector2 centerPosition = ((GameActor)replicant).CenterPosition; for (int i = 0; i < 16; i++) { CreateEnemyFragment(replicant.EnemyGuid, i, centerPosition + Lazy.RandomVector(16f), centerPosition, 0.2f, 0.05f * (float)i, autoDestroy: true); } replicant.EraseFromExistence(false); } } _Replicants.Clear(); } public void RegisterEnemyDNA(string guid) { if (!_registeredEnemies.Contains(guid)) { _registeredEnemies.Add(guid); _spawnIndex = _registeredEnemies.Count - 1; SwitchEnemyToSpawn(_registeredEnemies[_spawnIndex], isNew: true); } } public override void MidGameSerialize(List data, int i) { ((GunBehaviour)this).MidGameSerialize(data, i); data.Add(_registeredEnemies.Count); foreach (string registeredEnemy in _registeredEnemies) { data.Add(registeredEnemy); } } public override void MidGameDeserialize(List data, ref int i) { ((GunBehaviour)this).MidGameDeserialize(data, ref i); int num = (int)data[i++]; for (int j = 0; j < num; j++) { _registeredEnemies.Add((string)data[i++]); } if (num > 0) { _spawnIndex = 0; } } } public class ReplicantProjectile : MonoBehaviour { private Shader _oldShader; private void Start() { Projectile component = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)((BraveBehaviour)component).sprite)) { _oldShader = ((BraveBehaviour)((BraveBehaviour)component).sprite).renderer.material.shader; ((BraveBehaviour)component).sprite.MakeHolographic(green: true); component.OnDestruction += DestroyReplicantProjectile; } } private void DestroyReplicantProjectile(Projectile p) { ((BraveBehaviour)p).sprite.usesOverrideMaterial = false; ((BraveBehaviour)((BraveBehaviour)p).sprite).renderer.material.shader = _oldShader; this.SafeDestroy(); } } public class ExtractDNAOnKill : MonoBehaviour { private Projectile _projectile; private PlayerController _owner; private AlienNailgun _gun; private void Start() { _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) && Object.op_Implicit((Object)(object)((GameActor)_owner).CurrentGun) && Object.op_Implicit((Object)(object)(_gun = ((Component)((GameActor)_owner).CurrentGun).gameObject.GetComponent()))) { Projectile projectile = _projectile; projectile.OnWillKillEnemy = (Action)Delegate.Combine(projectile.OnWillKillEnemy, new Action(OnWillKillEnemy)); } } private void OnWillKillEnemy(Projectile bullet, SpeculativeRigidbody enemyBody) { AIActor component = ((Component)enemyBody).GetComponent(); if (component != null && Object.op_Implicit((Object)(object)_gun) && component.IsHostileAndNotABoss(canBeDead: true)) { _gun.RegisterEnemyDNA(component.EnemyGuid); } } } public class Sunderbuss : CwaffGun { public static string ItemName = "Sunderbuss"; public static string ShortDescription = "Smashed to Oblivion"; public static string LongDescription = "Smashes the ground with extreme force, releasing projectiles in all directions. Slows the user down immensely while charging. User receives double damage from all sources while this weapon is equipped."; public static string Lore = "An ancient artifact created by the first great gunsmith, Lord Kagreflak. It lacks the sleek form and versatility of a modern blunderbuss, instead functioning more like a primitive war hammer. Though it doesn't seem to draw the ire of the Jammed, you curiously still feel vulnerable wielding it."; internal static readonly string[] _ColorNames = new string[7] { "red", "yellow", "green", "cyan", "blue", "magenta", "gray" }; internal static GameObject _BlunderbussProjectile = null; internal static GameObject[] _ShatterDebris = (GameObject[])(object)new GameObject[7]; internal static SunderbussShockwave _ShockwavePrefab = null; internal const float _SHOCKWAVE_DAMAGE = 50f; private const int _IDLE_FPS = 6; private const float _RUN_SPEED_WHEN_CHARGING = 0.65f; private const int _CHARGE_FPS = 12; private const float _CHARGE_TIME = 1.5f; private const float _COOLDOWN = 1f; private bool _hasLichguard; public static void Init() { //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Expected O, but got Unknown Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 60; int? idleFps = 6; int? chargeFps = 12; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)60, 0f, 100, Items.Banana, defaultAudio: false, infiniteAmmo: true, canGainAmmo: true, canReloadNoMatterAmmo: false, null, idleFps, shootFps, null, chargeFps, null, "sunderbuss_fire", null, null, 18, -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, autoPlay: false, attacksThroughWalls: true, suppressReloadLabel: false, 0.65f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: false, preventRollingWhenCharging: true).IncreaseLootChance(typeof(Lichguard), 20f); int? clipSize = -1; float? cooldown = 1f; float? angleVariance = 0f; float? damage = 50f; float? speed = 1f; float? range = 0.01f; gun2.InitSpecialProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)3, (ProjectileSequenceStyle)0, 1.5f, 1, null, customClip: false, damage, speed, null, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "sunderbuss_projectile", 30, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 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, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: true)); for (int i = 0; i < 7; i++) { _ShatterDebris[i] = ((Component)BreakableAPIToolbox.GenerateDebrisObject("sunderbuss_debris_" + _ColorNames[i], true, 1f, 1f, 0f, 1080f, (tk2dSprite)null, 1f, (string)null, (GameObject)null, 2, false, (GoopDefinition)null, 1f)).gameObject; } _BlunderbussProjectile = ((Component)Items.Blunderbuss.AsGun().rawVolley.projectiles[0].chargeProjectiles[0].Projectile).gameObject.ClonePrefab(); Object.Destroy((Object)(object)_BlunderbussProjectile.GetComponent()); _BlunderbussProjectile.GetComponent().baseData.speed = 20f; _ShockwavePrefab = Extensions.RegisterPrefab(new GameObject()).AddComponent(); } public override void OnPlayerPickup(PlayerController player) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown base.OnPlayerPickup(player); GunExt.SetAnimationFPS(((GunBehaviour)this).gun, ((GunBehaviour)this).gun.idleAnimation, 6); ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.Play(); HealthHaver healthHaver = ((BraveBehaviour)player).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Combine(healthHaver.ModifyDamage, new Action(ModifyDamage)); ((BraveBehaviour)player).healthHaver.OnDamaged += new OnDamagedEvent(OnDamaged); CwaffEvents.OnStatsRecalculated = (Action)Delegate.Combine(CwaffEvents.OnStatsRecalculated, new Action(CheckForLichguard)); CheckForLichguard(player); } public override void OnDroppedByPlayer(PlayerController player) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown base.OnDroppedByPlayer(player); GunExt.SetAnimationFPS(((GunBehaviour)this).gun, ((GunBehaviour)this).gun.idleAnimation, 0); ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.StopAndResetFrameToDefault(); HealthHaver healthHaver = ((BraveBehaviour)player).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Remove(healthHaver.ModifyDamage, new Action(ModifyDamage)); ((BraveBehaviour)player).healthHaver.OnDamaged -= new OnDamagedEvent(OnDamaged); CwaffEvents.OnStatsRecalculated = (Action)Delegate.Remove(CwaffEvents.OnStatsRecalculated, new Action(CheckForLichguard)); CheckForLichguard(player); } private void ModifyDamage(HealthHaver hh, ModifyDamageEventArgs data) { if (!_hasLichguard) { GameActor currentOwner = ((GunBehaviour)this).gun.CurrentOwner; PlayerController val = (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null); if (val != null && (Object)(object)((GameActor)val).CurrentGun == (Object)(object)((GunBehaviour)this).gun) { data.ModifiedDamage *= 2f; } } } private void OnDamaged(float resultValue, float maxValue, CoreDamageTypes damageTypes, DamageCategory damageCategory, Vector2 damageDirection) { if (!_hasLichguard) { GameActor currentOwner = ((GunBehaviour)this).gun.CurrentOwner; PlayerController val = (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null); if (val != null && (Object)(object)((GameActor)val).CurrentGun == (Object)(object)((GunBehaviour)this).gun) { ((Component)this).gameObject.Play("lichguard_curse_sound"); } } } public override void OnDestroy() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { HealthHaver healthHaver = ((BraveBehaviour)((GunBehaviour)this).PlayerOwner).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Remove(healthHaver.ModifyDamage, new Action(ModifyDamage)); ((BraveBehaviour)((GunBehaviour)this).PlayerOwner).healthHaver.OnDamaged -= new OnDamagedEvent(OnDamaged); CwaffEvents.OnStatsRecalculated = (Action)Delegate.Remove(CwaffEvents.OnStatsRecalculated, new Action(CheckForLichguard)); } base.OnDestroy(); } private void CheckForLichguard(PlayerController player) { _hasLichguard = player.HasPassive(); percentSpeedWhileCharging = (_hasLichguard ? 1f : 0.65f); float num = (_hasLichguard ? 2f : 1f); GunExt.SetAnimationFPS(((GunBehaviour)this).gun, ((GunBehaviour)this).gun.chargeAnimation, Mathf.RoundToInt(num * 12f)); ((GunBehaviour)this).gun.DefaultModule.chargeProjectiles[0].ChargeTime = 1.5f / num; ((GunBehaviour)this).gun.DefaultModule.cooldownTime = 1f / num; } } public class SunderbussProjectile : Projectile { private static readonly Dictionary _HueLookupDict = new Dictionary(); public override void Start() { ((Projectile)this).Start(); base.m_usesNormalMoveRegardless = true; } public override void Move() { //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_0023: 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_004a: 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_0065: 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_0089: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_0032: 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_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_01a2: 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_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: 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) Projectile component = ((Component)this).gameObject.GetComponent(); Vector2 val = Vector3Extensions.XY(((BraveBehaviour)this).transform.position); RoomHandler absoluteRoom = Vector3Extensions.GetAbsoluteRoom(((BraveBehaviour)this).transform.position); if (absoluteRoom != null) { absoluteRoom.ApplyActionToNearbyEnemies(val, 3.5f, (Action)ProcessEnemy); } Exploder.DoRadialMinorBreakableBreak(Vector2.op_Implicit(val), 3f); Exploder.DoRadialMajorBreakableDamage(component.baseData.damage, Vector2.op_Implicit(val), 3f); Exploder.DoRadialPush(Vector2.op_Implicit(val), 100f, 3f); Lazy.ScorchGroundAt(val); GameManager.Instance.MainCameraController.DoScreenShake(new ScreenShakeSettings(0.5f, 6f, 0.5f, 0f), (Vector2?)val, false); for (int i = 1; (float)i <= 3f; i++) { GameObject earthClod = Groundhog._EarthClod; int numToSpawn = i * 10; float positionVariance = i; float? fadeOutTime = 0.5f; float? startScale = 1f; float? endScale = 0.1f; CwaffVFX.SpawnBurst(earthClod, numToSpawn, val, positionVariance, null, 0f, 4f, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.Random, 0.5f, fadeOutTime, 0f, null, fadeIn: false, uniform: true, startScale, endScale, null, randomFrame: true); } GameActor owner = component.Owner; PlayerController val2 = (PlayerController)(object)((owner is PlayerController) ? owner : null); for (int j = 0; j < 16; j++) { float self = 22.5f * (float)j; Vector2 val3 = self.ToVector(); Projectile component2 = SpawnManager.SpawnProjectile(Sunderbuss._BlunderbussProjectile, Vector2.op_Implicit(val + 3f * val3), self.EulerZ(), true).GetComponent(); component2.Owner = ((Projectile)this).Owner; component2.Shooter = ((Projectile)this).Shooter; if (Object.op_Implicit((Object)(object)val2)) { val2.DoPostProcessProjectile(component2); } } if (Object.op_Implicit((Object)(object)val2) && val2.HasSynergy(Synergy.MASTERY_SUNDERBUSS)) { ((Component)Sunderbuss._ShockwavePrefab).gameObject.Instantiate(Vector2.op_Implicit(component.SafeCenter)).GetComponent().Setup(50f, Vector2Extensions.ToAngle(Vector3Extensions.XY(((BraveBehaviour)component).transform.right)), 25f, 20f, 2f); } ((Projectile)this).DieInAir(false, true, true, false); } private void ProcessEnemy(AIActor a, float b) { //IL_004c: 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) if (Object.op_Implicit((Object)(object)a) && a.IsNormalEnemy && Object.op_Implicit((Object)(object)((BraveBehaviour)a).healthHaver) && !((GameActor)a).IsGone) { SpawnEnemyOnDeath component = ((Component)a).gameObject.GetComponent(); if (component != null) { component.chanceToSpawn = 0f; } ((BraveBehaviour)a).healthHaver.ApplyDamage(((Projectile)this).ModifiedDamage, Vector2.zero, Object.op_Implicit((Object)(object)((Projectile)this).Owner) ? ((Projectile)this).OwnerName : "projectile", base.damageTypes, (DamageCategory)0, false, (PixelCollider)null, false); if (((BraveBehaviour)a).healthHaver.IsDead && !((BraveBehaviour)a).healthHaver.IsBoss && !((BraveBehaviour)a).healthHaver.IsSubboss) { ShatterViolentlyIntoAMillionPieces(a); a.EraseFromExistenceWithRewards(true); } else if (Object.op_Implicit((Object)(object)((BraveBehaviour)a).behaviorSpeculator) && !((BraveBehaviour)a).behaviorSpeculator.ImmuneToStun) { ((BraveBehaviour)a).behaviorSpeculator.Stun(2f, true); } } } internal static void ShatterViolentlyIntoAMillionPieces(AIActor enemy) { //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_005f: 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_0083: Unknown result type (might be due to invalid IL or missing references) string enemyGuid = enemy.EnemyGuid; if (!_HueLookupDict.TryGetValue(enemyGuid, out var value)) { float[] array = (_HueLookupDict[enemyGuid] = ComputeHuesForEnemy(enemyGuid)); value = array; } int num = Mathf.CeilToInt(value[7] / 20f); for (int i = 0; i < num; i++) { int num2 = value.FirstLE(Random.value); Object.Instantiate(Sunderbuss._ShatterDebris[num2], Vector2.op_Implicit(((GameActor)enemy).CenterPosition), Lazy.RandomEulerZ()).GetComponent().Trigger(Vector2Extensions.ToVector3ZUp(Lazy.RandomVector(10f * Random.value), 6f), 0.25f, 1f); } } private static float[] ComputeHuesForEnemy(string guid) { //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) //IL_0048: 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_005f: 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) float[] array = new float[8]; Color[] pixelColorsForEnemy = Lazy.GetPixelColorsForEnemy(guid); AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid(guid); Texture2D val = (Object.op_Implicit((Object)(object)orLoadByGuid.optionalPalette) ? ETGMod.GetRW(orLoadByGuid.optionalPalette) : null); int num = pixelColorsForEnemy.Length; int num2 = 0; float num3 = default(float); float num4 = default(float); float num5 = default(float); for (int i = 0; i < num; i++) { Color val2 = pixelColorsForEnemy[i]; if (!(val2.a < 0.5f)) { if (Object.op_Implicit((Object)(object)val)) { val2 = Lazy.GetPaletteColor(val, val2.r); } Color.RGBToHSV(val2, ref num3, ref num4, ref num5); array[(num4 < 0.25f) ? 6 : (Mathf.RoundToInt(num3 * 6f) % 6)] += 1f; num2++; } } for (int j = 0; j < 7; j++) { array[j] /= num2; if (j > 0) { array[j] += array[j - 1]; } } array[7] = num2; return array; } } public class SunderbussShockwave : MonoBehaviour { private const float _SHOCKWAVE_KB = 150f; private Vector2 _velocity; private float _damage; private float _speed; private float _timeBetweenShockwaves; private float _radius; private float _sqrRadius; private Vector2 _start; private float _nextShockwaveTime; private float _lifetime; private RoomHandler _room; private List _hitEnemies = new List(); public void Setup(float damage, float angle, float speed, float spacing, float radius) { //IL_0021: 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_0061: 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_0072: Unknown result type (might be due to invalid IL or missing references) _lifetime = 0f; _damage = damage; _speed = speed; _velocity = angle.ToVector(_speed); _timeBetweenShockwaves = spacing / (16f * speed); _radius = radius; _sqrRadius = radius * radius; _nextShockwaveTime = _timeBetweenShockwaves; _start = Vector2.op_Implicit(((Component)this).transform.position); _room = Vector3Extensions.GetAbsoluteRoom(_start); if (_room == null) { Object.Destroy((Object)(object)((Component)this).gameObject); } } private void Update() { //IL_001f: 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_0035: 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_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_008e: 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_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) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: 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_0178: 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_01ad: Unknown result type (might be due to invalid IL or missing references) if ((_lifetime += BraveTime.DeltaTime) < _nextShockwaveTime) { return; } Vector2 val = _start + _lifetime * _velocity; if (!val.InBounds(wallsOk: true) || Vector3Extensions.GetAbsoluteRoom(val) != _room) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } _nextShockwaveTime += _timeBetweenShockwaves; ((Component)this).gameObject.Play("earthquake_sound"); GameObject earthClod = Groundhog._EarthClod; float? fadeOutTime = 0.25f; float? startScale = 1f; float? endScale = 0.1f; CwaffVFX.SpawnBurst(earthClod, 10, val, 1f, null, 0f, 5f, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.None, 0.25f, fadeOutTime, 0f, null, fadeIn: false, uniform: true, startScale, endScale, null, randomFrame: true); foreach (AIActor allNearbyEnemy in val.GetAllNearbyEnemies(_radius)) { if (!_hitEnemies.Contains(allNearbyEnemy) && Object.op_Implicit((Object)(object)((BraveBehaviour)allNearbyEnemy).specRigidbody)) { Vector2 val2 = ((GameActor)allNearbyEnemy).CenterPosition - val; Vector2 normalized = ((Vector2)(ref val2)).normalized; ((BraveBehaviour)allNearbyEnemy).healthHaver.ApplyDamage(_damage, normalized, "Sunderwave", (CoreDamageTypes)0, (DamageCategory)3, false, (PixelCollider)null, false); if (Object.op_Implicit((Object)(object)((BraveBehaviour)allNearbyEnemy).knockbackDoer)) { ((BraveBehaviour)allNearbyEnemy).knockbackDoer.ApplyKnockback(normalized, 150f, false); } _hitEnemies.Add(allNearbyEnemy); } } } } public class English : CwaffGun { public static string ItemName = "English"; public static string ShortDescription = "Racking Up Frags"; public static string LongDescription = "Fires a cue ball towards a rack of billiard balls that grows as the gun is charged. Balls bounce off of walls, objects, and each other, dealing damage proportional to their velocity. Grounded balls can be reactivated by other balls. Increases curse by 1."; public static string Lore = "This weapon appears to be an ordinary pool cue at first glance. The second, third, and fourth glances are much the same. The fifth glance, however, reveals a tiny spark at the tip of the cue, ready to materialize a cue ball with unforetold power and disregard for the conservation of momentum at the wielder's first intention to strike. The sixth glance reveals you have gone partially insane from staring at the tip of an ordinary pool cue for so long, and that it is, in fact, just an ordinary pool cue."; private const float _CHARGE_PER_LEVEL = 0.4f; private const int _MAX_CHARGE_LEVEL = 7; private const int _NORM_CHARGE_LEVEL = 5; private const int _MAX_PHANTOMS = 29; private const float _MAX_GLOW = 5f; private const float _H_SPACE = 0.625f; private const float _V_SPACE = 0.625f; private static readonly int[] _BALL_ORDER = new int[16] { 8, 6, 11, 14, 7, 0, 5, 9, 2, 13, 10, 1, 12, 3, 4, 15 }; private static GameObject _BilliardBallPhantom = null; private static GameObject _BilliardBallPlaceholder = null; private static Projectile _BilliardBall = null; private static LinkedList _ExtantBilliards = new LinkedList(); private RoomHandler _lastRoom; private List _phantoms; private List _placeholders; private bool _wasCharging; private float _chargeTime; private int _chargeLevel; private int _currentMaxCharge; private Vector2 _BasePhantomOffset => ((GunBehaviour)this).gun.CurrentAngle.ToVector(1.875f); public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 40; int? chargeFps = 10; Items? muzzleFrom = Items.Mailbox; Gun gun2 = gun.SetAttributes((ItemQuality)2, (GunClass)60, 0.9f, 960, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, null, chargeFps, null, "billiard_first_strike_sound", null, null, 5, -1, -1, muzzleFrom, modulesAreTiers: false, null, 60, 1f, (Anchor)3, -1f, null, -1f, muzzleLit: false, 0f, 0f, null, null, preventRotation: false, 1f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: false, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0).AddToShop((ShopType)2); int? clipSize = -1; float? cooldown = 0.25f; float? angleVariance = 5f; bool? pierceBreakables = true; float? damage = 2.5f; float? speed = 81f; float? range = 9999f; bool? collidesWithProjectiles = true; bool? collidesOnlyWithPlayerProjectiles = true; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)3, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, range, null, 0f, 0f, 0f, 0f, null, null, collidesWithProjectiles, null, null, "billiard_ball_projectile_small", 12, (Anchor)4, 1.5f, anchorsChangeColliders: true, fixesScales: true, null, null, 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, collidesOnlyWithPlayerProjectiles)).Attach().SetAirImpactVFX(Items.Winchester.AsGun().DefaultModule.projectiles[0].hitEffects.overrideMidairDeathVFX, alwaysUseMidair: true) .Assign(out _BilliardBall); _BilliardBallPhantom = VFX.Create("billiard_ball_small_vfx", 2f, loops: true, -1, 1.5f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 10f); _BilliardBallPlaceholder = VFX.Create("billiard_ball_placeholder_vfx", 10f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); CwaffEvents.OnChangedRooms = (Action)Delegate.Remove(CwaffEvents.OnChangedRooms, new Action(OnChangedRooms)); CwaffEvents.OnChangedRooms = (Action)Delegate.Combine(CwaffEvents.OnChangedRooms, new Action(OnChangedRooms)); _lastRoom = player.CurrentRoom; UpdateBilliardCollisionStatuses(_lastRoom); EnsurePhantoms(); } private static void OnChangedRooms(PlayerController player, RoomHandler oldRoom, RoomHandler newRoom) { UpdateBilliardCollisionStatuses(newRoom); } private static void UpdateBilliardCollisionStatuses(RoomHandler newRoom) { LinkedListNode linkedListNode = _ExtantBilliards.First; while (linkedListNode != null) { if (!Object.op_Implicit((Object)(object)linkedListNode.Value)) { LinkedListNode node = linkedListNode; linkedListNode = linkedListNode.Next; _ExtantBilliards.Remove(node); } else { BilliardBall value = linkedListNode.Value; linkedListNode = linkedListNode.Next; value.UpdateCollisionStatus(newRoom); } } } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); DismissPhantoms(); } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); EnsurePhantoms(); } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); DismissPhantoms(); } public override void OnDestroy() { if (_phantoms != null) { for (int num = _phantoms.Count - 1; num >= 0; num--) { _phantoms[num].SafeDestroy(); } } if (_placeholders != null) { for (int num2 = _placeholders.Count - 1; num2 >= 0; num2--) { _placeholders[num2].SafeDestroy(); } } base.OnDestroy(); } private void EnsurePhantoms() { //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_00c2: 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) if (_phantoms == null) { _phantoms = Lazy.DefaultList(29); } if (_placeholders == null) { _placeholders = Lazy.DefaultList(29); } for (int i = 0; i < 29; i++) { if (!Object.op_Implicit((Object)(object)_phantoms[i])) { _phantoms[i] = SpawnManager.SpawnVFX(_BilliardBallPhantom, ((BraveBehaviour)this).transform.position, Quaternion.identity, true); _phantoms[i].GetComponent().PickFrame(_BALL_ORDER[i % 15]); _phantoms[i].SetActive(false); } if (!Object.op_Implicit((Object)(object)_placeholders[i])) { _placeholders[i] = SpawnManager.SpawnVFX(_BilliardBallPlaceholder, ((BraveBehaviour)this).transform.position, Quaternion.identity, true); _placeholders[i].SetActive(false); } } } private void DismissPhantoms() { if (_phantoms != null) { for (int i = 0; i < _phantoms.Count; i++) { if (Object.op_Implicit((Object)(object)_phantoms[i])) { _phantoms[i].SetActive(false); } } } if (_placeholders == null) { return; } for (int j = 0; j < _placeholders.Count; j++) { if (Object.op_Implicit((Object)(object)_placeholders[j])) { _placeholders[j].SetActive(false); } } } public override void Update() { base.Update(); PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null) { return; } if (((GunBehaviour)this).gun.IsCharging) { if (!_wasCharging) { EnsurePhantoms(); _currentMaxCharge = (base.Mastered ? 7 : 5); } if ((_chargeTime += BraveTime.DeltaTime * playerOwner.ChargeMult()) > 0.4f) { _chargeTime -= 0.4f; if (_chargeLevel < _currentMaxCharge) { _chargeLevel++; ((Component)this).gameObject.Play("billiard_materialize_sound"); } } UpdatePhantomBilliards(); } else { if (_wasCharging) { DismissPhantoms(); } _chargeLevel = 0; _chargeTime = 0f; } _wasCharging = ((GunBehaviour)this).gun.IsCharging; } private void UpdatePhantomBilliards() { //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_001e: 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_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_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_00ab: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0277: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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) //IL_00e9: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: 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_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_020a: 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_0142: 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_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) if (((GunBehaviour)this).PlayerOwner == null) { return; } Vector2 val = Vector2.op_Implicit(((GunBehaviour)this).gun.barrelOffset.position); bool flag = val.HasLineOfSight(val + _BasePhantomOffset); float currentAngle = ((GunBehaviour)this).gun.CurrentAngle; float self = ((GunBehaviour)this).gun.CurrentAngle + 90f; Vector2 basePhantomOffset = _BasePhantomOffset; int num = 0; float num2 = (flag ? (0.5f + Mathf.Max(-0.5f, Mathf.Sin((float)Math.PI * 2f * (_chargeTime / 0.4f)))) : 0f); int num3 = Mathf.Min(_chargeLevel + 1, _currentMaxCharge); for (int i = 0; i < num3; i++) { Vector2 val2 = basePhantomOffset + currentAngle.ToVector(0.625f * (float)i); for (int j = 0; j <= i; j++) { Vector2 val3 = self.ToVector(0.625f * (0.5f * (float)i - (float)j)); Vector2 val4 = val + val2 + val3; if (flag && i < _chargeLevel) { _placeholders[num].SetActive(false); _phantoms[num].SetActive(true); _phantoms[num].transform.position = Vector2.op_Implicit(val4); _phantoms[num].GetComponent().PickFrame(flag ? _BALL_ORDER[num % 15] : 7); tk2dSprite component = _phantoms[num].GetComponent(); ((tk2dBaseSprite)(object)component).PlaceAtScaledPositionByAnchor(Vector2.op_Implicit(val4), (Anchor)4); ((BraveBehaviour)component).renderer.material.SetFloat(CwaffVFX._EmissivePowerId, 5f * num2); } else { _phantoms[num].SetActive(false); _placeholders[num].SetActive(true); _placeholders[num].transform.position = Vector2.op_Implicit(val4); ((tk2dBaseSprite)(object)_placeholders[num].GetComponent()).PlaceAtScaledPositionByAnchor(Vector2.op_Implicit(val4), (Anchor)4); } num++; } } num = 28; _placeholders[num].SetActive(false); _phantoms[num].SetActive(true); _phantoms[num].transform.position = Vector2.op_Implicit(val); _phantoms[num].GetComponent().PickFrame(flag ? _BALL_ORDER[15] : 7); tk2dSprite component2 = _phantoms[num].GetComponent(); ((tk2dBaseSprite)(object)component2).PlaceAtScaledPositionByAnchor(Vector2.op_Implicit(val), (Anchor)4); ((BraveBehaviour)component2).renderer.material.SetFloat(CwaffVFX._EmissivePowerId, 5f * num2); } public override void PostProcessProjectile(Projectile projectile) { //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_004e: 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_0055: Unknown result type (might be due to invalid IL or missing references) ((GunBehaviour)this).PostProcessProjectile(projectile); PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(((BraveBehaviour)projectile).specRigidbody, (int?)null, false); projectile.SetFrame(15); if (_wasCharging) { _wasCharging = false; Vector2 val = Vector3Extensions.XY(((GunBehaviour)this).gun.barrelOffset.position); if (val.HasLineOfSight(val + _BasePhantomOffset)) { MaterializePhantoms(); } DismissPhantoms(); } } private void MaterializePhantoms() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_0046: Unknown result type (might be due to invalid IL or missing references) UpdatePhantomBilliards(); int num = _chargeLevel * (_chargeLevel + 1) / 2; for (int i = 0; i < num; i++) { Vector2 worldCenter = ((tk2dBaseSprite)_phantoms[i].GetComponent()).WorldCenter; GameObject obj = SpawnManager.SpawnProjectile(((Component)_BilliardBall).gameObject, Vector2.op_Implicit(worldCenter), Quaternion.identity, true); Projectile component = obj.GetComponent(); component.SetOwnerAndStats((GameActor)(object)((GunBehaviour)this).PlayerOwner); component.SetFrame(_BALL_ORDER[i % 15]); obj.GetComponent().Setup(fired: false, (i == 0) ? new float?(((GunBehaviour)this).gun.CurrentAngle) : ((float?)null)); } ((GunBehaviour)this).gun.LoseAmmo(num); } internal static void AddExtantBilliard(BilliardBall billiardBall) { _ExtantBilliards.AddLast(billiardBall); } } public class BilliardBall : MonoBehaviour { internal enum State { UNSET, FIRED, DEACTIVATED, ACTIVATED } private const float _FRICTION = 0.965f; private const float _COLLISON_DAMPING = 0.9f; private const float _MIN_SPEED = 1f; private const int _MAX_COLLISIONS = 10; private const int _RESTORE_COLLISIONS = 5; private const float _MERCY_TIME = 0.5f; private const float _FAILSAFE_TIME = 0.05f; private const float _ROT_RATE = 90f; private const float _DAMAGE_SCALE = 0.5f; private const float _MAX_ADJUST = 45f; private tk2dBaseSprite _sprite; private Projectile _projectile; private State _state; private PlayerController _owner; private List _frameCollisions = new List(); private float _baseDamage; private float _baseSpeed; private SpeculativeRigidbody _body; private bool _setup; private int _remainingCollisions; private float _spawnTime; private float _rotation; private bool _useFailsafeLaunch; private float _failsafeLaunchAngle; private void Start() { Setup(fired: true); if (_body.InsideWall()) { _projectile.DieInAir(true, false, false, true); } } public void Setup(bool fired, float? failsafeLaunchAngle = null) { //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Expected O, but got Unknown //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Expected O, but got Unknown //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Expected O, but got Unknown //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Expected O, but got Unknown //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Expected O, but got Unknown //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Expected O, but got Unknown if (_setup) { return; } _projectile = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); _baseDamage = 0.5f * _projectile.baseData.damage; _baseSpeed = _projectile.baseData.speed; _body = ((BraveBehaviour)_projectile).specRigidbody; _sprite = ((BraveBehaviour)_projectile).sprite; _remainingCollisions = 10; _spawnTime = BraveTime.ScaledTimeSinceStartup; _rotation = 360f * Random.value; _projectile.BulletScriptSettings.surviveRigidbodyCollisions = true; _projectile.BulletScriptSettings.surviveTileCollisions = true; Projectile projectile = _projectile; projectile.OnWillKillEnemy = (Action)Delegate.Combine(projectile.OnWillKillEnemy, new Action(OnWillKillEnemy)); SpeculativeRigidbody body = _body; body.OnRigidbodyCollision = (OnRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)body.OnRigidbodyCollision, (Delegate?)new OnRigidbodyCollisionDelegate(OnRigidbodyCollision)); SpeculativeRigidbody body2 = _body; body2.OnRigidbodyCollision = (OnRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)body2.OnRigidbodyCollision, (Delegate?)new OnRigidbodyCollisionDelegate(OnAnyCollision)); SpeculativeRigidbody body3 = _body; body3.OnTileCollision = (OnTileCollisionDelegate)Delegate.Combine((Delegate?)(object)body3.OnTileCollision, (Delegate?)new OnTileCollisionDelegate(OnTileCollision)); SpeculativeRigidbody body4 = _body; body4.OnTileCollision = (OnTileCollisionDelegate)Delegate.Combine((Delegate?)(object)body4.OnTileCollision, (Delegate?)new OnTileCollisionDelegate(OnAnyCollision)); SpeculativeRigidbody body5 = _body; body5.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)body5.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreCollision)); if (fired) { Activate(State.FIRED); tk2dSpriteAnimator spriteAnimator = ((BraveBehaviour)_projectile).spriteAnimator; if (spriteAnimator != null && spriteAnimator.Playing) { spriteAnimator.PickFrame(); spriteAnimator.Stop(); } } else { Deactivate(); } if (failsafeLaunchAngle.HasValue) { _failsafeLaunchAngle = failsafeLaunchAngle.Value; _useFailsafeLaunch = true; } English.AddExtantBilliard(this); _setup = true; } private void OnWillKillEnemy(Projectile proj, SpeculativeRigidbody body) { //IL_001a: 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) GameActor owner = proj.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null && val.HasSynergy(Synergy.BANK_SHOTS)) { LootEngine.SpawnCurrency(proj.SafeCenter, 1, false, (Vector2?)proj.m_currentDirection, (float?)10f, 4f, 0.05f); } } internal void UpdateCollisionStatus(RoomHandler newRoom) { //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_002a: 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 (Object.op_Implicit((Object)(object)_body) && _state == State.DEACTIVATED) { Vector2 safeCenter = _projectile.SafeCenter; ((Behaviour)_body).enabled = newRoom == Vector3Extensions.GetAbsoluteRoom(safeCenter); if (!((Behaviour)_body).enabled && !safeCenter.OnScreen(1f)) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } private void OnPreCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { //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 if (_state != State.FIRED || BraveTime.ScaledTimeSinceStartup - _spawnTime > 0.5f) { SpeculativeRigidbody body = _body; body.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Remove((Delegate?)(object)body.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreCollision)); return; } GameObject gameObject = ((Component)otherRigidbody).gameObject; if (!Object.op_Implicit((Object)(object)gameObject.GetComponent()) && !Object.op_Implicit((Object)(object)gameObject.GetComponent())) { PhysicsEngine.SkipCollision = true; } } private void OnAnyCollision(CollisionData tileCollision) { if (!(BraveTime.ScaledTimeSinceStartup - _spawnTime < 0.5f) && _remainingCollisions-- <= 0) { _projectile.DieInAir(false, true, true, false); } } private static Vector2 HandleSimpleBounce(CollisionData collision, float damping = 1f) { //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_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_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_0038: 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_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_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) Vector2 val = collision.MyRigidbody.Velocity; if (collision.CollidedX) { val = Vector2Extensions.WithX(val, 0f - val.x); } if (collision.CollidedY) { val = Vector2Extensions.WithY(val, 0f - val.y); } return val * damping; } private void OnTileCollision(CollisionData collision) { //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_0033: 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) //IL_0040: 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) Vector2 val = HandleSimpleBounce(collision, 0.9f); _projectile.m_currentSpeed = (_projectile.baseData.speed = ((Vector2)(ref val)).magnitude); val = AdjustTowardsNearbyEnemiesOrBalls(this, this, val); _projectile.SendInDirection(val, true, true); PhysicsEngine.PostSliceVelocity = val; } private void OnRigidbodyCollision(CollisionData collision) { //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_0063: 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) SpeculativeRigidbody otherRigidbody = collision.OtherRigidbody; if (otherRigidbody != null) { BilliardBall component = ((Component)otherRigidbody).gameObject.GetComponent(); if (component != null) { DoElasticCollision(collision, component); return; } } if (_state != State.DEACTIVATED) { Vector2 val = HandleSimpleBounce(collision, 0.9f); _projectile.m_currentSpeed = (_projectile.baseData.speed = ((Vector2)(ref val)).magnitude); _projectile.SendInDirection(val, true, true); PhysicsEngine.PostSliceVelocity = val; ((Component)this).gameObject.PlayUnique("billiard_collide_sound"); } } private void DoElasticCollision(CollisionData collision, BilliardBall other) { //IL_0015: 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_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_0036: 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_0042: 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_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_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_0076: 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_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_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_0081: 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_008e: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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) if (!_frameCollisions.Contains(other)) { 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; Vector2 origDir = velocity2 - Vector2.Dot(velocity2 - velocity, -val) * num * -val; float num2 = Mathf.Sqrt(Mathf.Max(((Vector2)(ref velocity)).sqrMagnitude, ((Vector2)(ref velocity2)).sqrMagnitude)); PhysicsEngine.PostSliceVelocity = num2 * ((Vector2)(ref val2)).normalized; Activate(); _projectile.baseData.speed = num2; _projectile.UpdateSpeed(); _projectile.SendInDirection(val2, true, true); other.Activate(); Projectile component = ((Component)other).GetComponent(); component.baseData.speed = num2; component.UpdateSpeed(); component.SendInDirection(AdjustTowardsNearbyEnemiesOrBalls(this, other, origDir), true, true); _frameCollisions.Add(other); other._frameCollisions.Add(this); ((Component)this).gameObject.Play("billiard_collide_sound"); } } private static Vector2 AdjustTowardsNearbyEnemiesOrBalls(BilliardBall self, BilliardBall other, Vector2 origDir) { //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_000c: 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_0036: 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_0030: Unknown result type (might be due to invalid IL or missing references) Vector2 worldCenter = self._sprite.WorldCenter; AIActor val = worldCenter.NearestEnemyWithinConeOfVision(Vector2Extensions.ToAngle(origDir), 45f, 20f); if (val != null) { return ((GameActor)val).CenterPosition - worldCenter; } return origDir; } private void Update() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) _frameCollisions.Clear(); if (_useFailsafeLaunch && BraveTime.ScaledTimeSinceStartup - _spawnTime > 0.05f) { Activate(); _projectile.baseData.speed = _baseSpeed; _projectile.UpdateSpeed(); _projectile.SendInDirection(_failsafeLaunchAngle.ToVector(), true, true); } else { if (_state != State.FIRED && _state != State.ACTIVATED) { return; } _projectile.ApplyFriction(0.965f); float speed = _projectile.baseData.speed; if (speed < 1f) { Deactivate(); return; } _rotation += Mathf.Sign(((BraveBehaviour)_projectile).specRigidbody.Velocity.x) * 90f * speed * BraveTime.DeltaTime; ((BraveBehaviour)_projectile).transform.localRotation = _rotation.EulerZ(); if (_state == State.ACTIVATED) { _projectile.baseData.damage = _baseDamage * Mathf.Log(speed, 3f); } else if (_state == State.FIRED) { _projectile.baseData.damage = _baseDamage; } } } private void AddTrailIfMissing() { //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_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_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_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_007d: 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) if (!Object.op_Implicit((Object)(object)((Component)_projectile).GetComponent())) { EasyTrailBullet easyTrailBullet = ((Component)_projectile).gameObject.AddComponent(); easyTrailBullet.StartWidth = 0.15f; easyTrailBullet.EndWidth = 0.025f; easyTrailBullet.LifeTime = 0.1f; easyTrailBullet.BaseColor = Color.Lerp(Color.white, Color.clear, 0.2f); easyTrailBullet.StartColor = Color.Lerp(Color.white, Color.clear, 0.2f); easyTrailBullet.EndColor = Color.Lerp(Color.white, Color.clear, 0.5f); } } private void Activate(State state = State.ACTIVATED) { if (_state != state) { DebrisObject component = ((Component)this).gameObject.GetComponent(); if (component != null) { Object.Destroy((Object)(object)component); } ((Behaviour)_projectile).enabled = true; _body.CollideWithTileMap = true; _projectile.collidesWithEnemies = true; _projectile.collidesWithProjectiles = true; _projectile.UpdateCollisionMask(); if (_remainingCollisions < 5) { _remainingCollisions = 5; } AddTrailIfMissing(); _useFailsafeLaunch = false; _state = state; } } private void Deactivate() { //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) if (_state != State.DEACTIVATED) { _body.Velocity = Vector2.zero; _body.CollideWithTileMap = false; _projectile.collidesWithEnemies = false; _projectile.collidesWithProjectiles = false; _projectile.UpdateCollisionMask(); ((Behaviour)_projectile).enabled = false; ((Component)this).gameObject.AllowFallingIntoPits(); _state = State.DEACTIVATED; } } } public class DerailGun : CwaffGun { [HarmonyPatch(/*Could not decode attribute arguments.*/)] private class PlayerControllerReceivesTouchDamagePatch { private static bool Prefix(PlayerController __instance, ref bool __result) { if (!__instance.HasSynergy(Synergy.TANK_ENGINE) || ((PickupObject)((GameActor)__instance).CurrentGun).PickupObjectId != 177) { return true; } __result = false; return false; } } public static string ItemName = "Derail Gun"; public static string ShortDescription = "Chugga Chugga Pew Pew"; public static string LongDescription = "Fires high-velocity miniature train engines that spread oil as they travel and explode violently upon impact."; public static string Lore = "The brainchild of a smart alec researcher who was tasked with designing a rail gun that used the most highly-conductive materials available. In a rare case of two wrongs making a right, the heat generated when launching the cheap plastic train projectiles had the tendency to melt them back into petroleum in transit, posing a hilarious fire hazard when properly misused."; private static DeadlyDeadlyGoopManager _OilGooper = null; public static void Init() { //IL_043f: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? idleFps = 11; int? reloadFps = 11; int? shootFps = 2; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)15, 2.2f, 66, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, idleFps, shootFps, reloadFps, null, null, "train_bell_sound", 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, autoPlay: false, attacksThroughWalls: false, suppressReloadLabel: false, 1f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: false, preventRollingWhenCharging: false, 1f, 0.1f).SetIdleAudio("steam_engine_a", 1).SetIdleAudio("steam_engine_b", 3, 5, 7) .SetReloadAudio("steam_engine_a", 7, 15) .SetReloadAudio("steam_engine_b", 9, 11, 13, 17, 19, 21) .AddToShop(ModdedShopType.Boomhildr); int? clipSize = 1; float? cooldown = 0.5f; float? damage = 30f; float? speed = 100f; float? range = 100f; float? force = 100f; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "derail_gun_projectile", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, null, "train_launch_sound")).Attach((Action)delegate(ExplosiveModifier e) { e.explosionData = Explosions.DefaultLarge.With(100f, 30f, 20f, 3f); }, allowDuplicates: false).Attach((Action)delegate(GoopModifier g) { g.goopDefinition = EasyGoopDefinitions.OilDef; g.SpawnGoopOnCollision = true; g.CollisionSpawnRadius = 5f; g.SpawnGoopInFlight = true; g.InFlightSpawnRadius = 2f; g.InFlightSpawnFrequency = 0.01f; }, allowDuplicates: false) .AttachTrail("derail_gun_beam", 15, (string)null, -1f, 1f / 30f, 1f, destroyOnEmpty: true, (GameObject)null, (Vector2?)new Vector2(0f, -0.375f), (float?)null, (float?)null, (Color?)null); } public override void OnReloadPressed(PlayerController player, Gun gun, bool manualReload) { base.OnReloadPressed(player, gun, manualReload); if (manualReload && gun.DefaultModule.numberOfShotsInClip == Mathf.Min(gun.ClipShotsRemaining, gun.AdjustedMaxAmmo)) { ((Component)gun).gameObject.PlayUnique("toy_train_whistle_sound"); } } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); HealthHaver healthHaver = ((BraveBehaviour)player).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Combine(healthHaver.ModifyDamage, new Action(OnMightTakeDamage)); player.OnReceivedDamage += OnReceivedDamage; GunExt.SetAnimationFPS(((GunBehaviour)this).gun, ((GunBehaviour)this).gun.idleAnimation, 11); ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.Play(); } private void OnMightTakeDamage(HealthHaver haver, ModifyDamageEventArgs args) { GameActor gameActor = ((BraveBehaviour)haver).gameActor; PlayerController val = (PlayerController)(object)((gameActor is PlayerController) ? gameActor : null); if (val != null && Object.op_Implicit((Object)(object)((GameActor)val).CurrentGun) && ((GameActor)val).CurrentGun.IsFiring && ((PickupObject)((GameActor)val).CurrentGun).PickupObjectId == 177 && val.HasSynergy(Synergy.TANK_ENGINE)) { args.ModifiedDamage = 0f; } } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); HealthHaver healthHaver = ((BraveBehaviour)player).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Remove(healthHaver.ModifyDamage, new Action(OnMightTakeDamage)); player.OnReceivedDamage -= OnReceivedDamage; GunExt.SetAnimationFPS(((GunBehaviour)this).gun, ((GunBehaviour)this).gun.idleAnimation, 0); ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.StopAndResetFrameToDefault(); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { HealthHaver healthHaver = ((BraveBehaviour)((GunBehaviour)this).PlayerOwner).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Remove(healthHaver.ModifyDamage, new Action(OnMightTakeDamage)); ((GunBehaviour)this).PlayerOwner.OnReceivedDamage -= OnReceivedDamage; } base.OnDestroy(); } private void OnReceivedDamage(PlayerController player) { if (!player.HasSynergy(Synergy.TROLLEY_PROBLEM)) { return; } PassiveItem passive = player.GetPassive(645); MulticompanionItem val = (MulticompanionItem)(object)((passive is MulticompanionItem) ? passive : null); if (val != null) { for (int i = 0; i < 5; i++) { val.CreateNewCompanion(player); } } } public override void Update() { //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_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) base.Update(); if (!Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) || !((GunBehaviour)this).PlayerOwner.AcceptingNonMotionInput) { return; } if (!((GunBehaviour)this).gun.IsReloading && ((GunBehaviour)this).gun.ClipShotsRemaining < Mathf.Min(((GunBehaviour)this).gun.ClipCapacity, ((GunBehaviour)this).gun.CurrentAmmo)) { ((GunBehaviour)this).gun.Reload(); } if (base.Mastered) { if (!Object.op_Implicit((Object)(object)_OilGooper)) { _OilGooper = DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(EasyGoopDefinitions.GreenOilGoop); } _OilGooper.AddGoopCircle(Vector3Extensions.XY(((GunBehaviour)this).PlayerOwner.SpriteBottomCenter) - ((GunBehaviour)this).PlayerOwner.m_currentGunAngle.ToVector(), 0.75f, -1, false, -1); } } public override void PostProcessProjectile(Projectile projectile) { ((GunBehaviour)this).PostProcessProjectile(projectile); if (base.Mastered) { ((Component)projectile).GetComponent().goopDefinition = EasyGoopDefinitions.GreenOilGoop; } } } public class FuelRodGun : CwaffGun { public enum FuelRodAmmoType { WATER, EXPLOSIVE, OIL, POISON } private class FuelRodGunAmmoDisplay : CustomAmmoDisplay { private FuelRodGun _frg; private PlayerController _owner; private string _ammoString = string.Empty; private static StringBuilder _SB = new StringBuilder("", 1000); private void Start() { _frg = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor currentOwner = ((GunBehaviour)_frg).gun.CurrentOwner; owner = (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null); } public override bool DoCustomAmmoDisplay(GameUIAmmoController uic) { if (!Object.op_Implicit((Object)(object)_owner) || !Object.op_Implicit((Object)(object)_frg)) { return false; } if (_frg._ammoDisplayDirty || string.IsNullOrEmpty(_ammoString)) { _SB.Length = 0; for (int i = 0; i < _Rods.Count; i++) { if (_frg.ammoOfEachType[i] == 0) { if (_frg.curAmmoType == i) { _SB.Append("[sprite \"fuel_rod_ui_006\"]"); } else { _SB.Append("[sprite \"fuel_rod_ui_001\"]"); } } else if (_frg.curAmmoType == i) { _SB.Append($"[sprite \"fuel_rod_ui_0{7 + i:D2}\"]"); } else { _SB.Append($"[sprite \"fuel_rod_ui_0{2 + i:D2}\"]"); } } _ammoString = _SB.ToString(); } uic.GunAmmoCountLabel.Text = _ammoString + "\n" + CustomAmmoDisplayExtensions.VanillaAmmoDisplay(_owner); return true; } } [HarmonyPatch(typeof(KickableObject), "Interact")] private class KickableObjectInteractPatch { private static bool Prefix(KickableObject __instance, PlayerController player) { Gun currentGun = ((GameActor)player).CurrentGun; if (currentGun == null) { return true; } FuelRodGun component = ((Component)currentGun).GetComponent(); if (component == null) { return true; } if (!Femtobyte.IsWhiteListedPrefab(((Component)__instance).gameObject, out var trapPrefab)) { return true; } if (!trapPrefab.prefabName.Contains("barrel") && !trapPrefab.prefabName.Contains("drum")) { return true; } component.ConvertBarrelToAmmo(__instance, trapPrefab.prefabName); return false; } } public static string ItemName = "Fuel Rod Gun"; public static string ShortDescription = "Barely Contained"; public static string LongDescription = "Launches highly explosive fuel rods. Cannot use conventional ammo, but can extract fuel by interacting with barrels while equipped. Reloading cycles through available fuel types."; public static string Lore = "A highly destructive support weapon, manufactured in an alternate timeline by an advanced alien race waging war against humanity. It was designed with several mechanisms for rendering it inoperable should it fall into the wrong hands. Naturally, it was most frequently wielded by low-level grunts with these mechanisms completely disabled."; private const int _AMMO_PER_BARREL = 5; internal static readonly List _Rods = new List(); internal static readonly List _AmmoCells = new List(); internal static readonly List _AmmoSprites = new List(); private int _newGoopType; private bool _ammoDisplayDirty = true; private int _cachedAmmo = 1; private int _uiAmmoType = -1; public int curAmmoType; public List ammoOfEachType = new List(); public static void Init() { //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_070f: Unknown result type (might be due to invalid IL or missing references) //IL_0a2a: Unknown result type (might be due to invalid IL or missing references) //IL_0d49: Unknown result type (might be due to invalid IL or missing references) //IL_1068: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 24; Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)45, 1f, 15, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: false, canReloadNoMatterAmmo: true, null, null, shootFps, null, null, null, "fuel_rod_gun_fire_sound", 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, autoPlay: true, attacksThroughWalls: false, suppressReloadLabel: false, 1f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: false, preventRollingWhenCharging: false, 1f, 0f).SetReloadAudio("fuel_rod_reload_place_sound", 8).SetReloadAudio("fuel_rod_reload_click_sound", 14) .AddToShop((ShopType)0) .AddToShop((ShopType)3) .Attach((Action)null, allowDuplicates: false) .AssignGun(out gunRef); int? clipSize = 1; float? cooldown = 0.5f; float? damage = 40f; float? speed = 50f; float? range = 100f; float? force = 25f; float? recoil = 20f; bool? shouldRotate = true; bool? pierceBreakables = true; Color? glowColor = ExtendedColours.lime; bool? becomeDebris = true; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, range, recoil, 0f, 0f, 0f, 0f, null, null, null, null, null, "fuel_rod_cannon_projectile_empty", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, shouldRotate, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, null, null, null, null, becomeDebris, 0f, ignoredForReloadPurposes: false, mirror: false, null, null, null, pierceBreakables, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: false, 0f, null, 100f, glowColor)).AttachTrail("fuel_rod_trail", 120, (string)null, 0f, -1f, -1f, destroyOnEmpty: true, emissivePower: (float?)10f, emissiveColorPower: (float?)7f, emissiveColor: (Color?)new Color(0.5f, 0.6f, 0f), dispersalPrefab: Lazy.DispersalParticles(ExtendedColours.lime), boneSpawnOffset: (Vector2?)null).Attach((Action)delegate(ExplosiveModifier ex) { ex.explosionData = Explosions.DefaultLarge.Scale(1.5f); }, allowDuplicates: false) .Assign(out Projectile projectileRef); _Rods.Add(projectileRef.Clone(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "fuel_rod_cannon_projectile_water", 2, (Anchor)4)).MakeFuelRodProjectile(EasyGoopDefinitions.WaterGoop)); List ammoCells = _AmmoCells; Color? emissiveColour = new Color(0f, 0.5f, 1f); ammoCells.Add(VFX.Create("fuel_rod_cannon_ammo_water", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 10f, emissiveColour, orphaned: false, attached: true, unlit: false, 0f, 0f, null, 5f, 0f, useBetterEmission: true, 0.1f)); _AmmoSprites.Add(Lazy.SetupCustomAmmoClip("fuel_rod_gun_water")); _Rods.Add(projectileRef.Clone(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "fuel_rod_cannon_projectile_fire", 2, (Anchor)4)).MakeFuelRodProjectile(null, 2f)); List ammoCells2 = _AmmoCells; emissiveColour = new Color(1f, 0f, 0f); ammoCells2.Add(VFX.Create("fuel_rod_cannon_ammo_fire", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 10f, emissiveColour, orphaned: false, attached: true, unlit: false, 0f, 0f, null, 5f, 0f, useBetterEmission: true, 0.1f)); _AmmoSprites.Add(Lazy.SetupCustomAmmoClip("fuel_rod_gun_fire")); _Rods.Add(projectileRef.Clone(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "fuel_rod_cannon_projectile_oil", 2, (Anchor)4)).MakeFuelRodProjectile(EasyGoopDefinitions.OilDef)); List ammoCells3 = _AmmoCells; emissiveColour = new Color(0.5f, 0f, 1f); ammoCells3.Add(VFX.Create("fuel_rod_cannon_ammo_oil", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 10f, emissiveColour, orphaned: false, attached: true, unlit: false, 0f, 0f, null, 5f, 0f, useBetterEmission: true, 0.1f)); _AmmoSprites.Add(Lazy.SetupCustomAmmoClip("fuel_rod_gun_oil")); _Rods.Add(projectileRef.Clone(GunData.New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "fuel_rod_cannon_projectile_poison", 2, (Anchor)4)).MakeFuelRodProjectile(EasyGoopDefinitions.PoisonDef)); List ammoCells4 = _AmmoCells; emissiveColour = new Color(0.9f, 0.9f, 0f); ammoCells4.Add(VFX.Create("fuel_rod_cannon_ammo_poison", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 10f, emissiveColour, orphaned: false, attached: true, unlit: false, 0f, 0f, null, 5f, 0f, useBetterEmission: true, 0.1f)); _AmmoSprites.Add(Lazy.SetupCustomAmmoClip("fuel_rod_gun_poison")); } public override Projectile OnPreFireProjectileModifier(Gun gun, Projectile projectile, ProjectileModule mod) { return _Rods[curAmmoType % _Rods.Count]; } public override void PostProcessProjectile(Projectile projectile) { ((GunBehaviour)this).PostProcessProjectile(projectile); projectile.OnBecameDebris = (Action)Delegate.Combine(projectile.OnBecameDebris, new Action(OnBecameDebris)); } private void OnBecameDebris(DebrisObject debris) { ((BraveBehaviour)debris).sprite.spriteId = ((BraveBehaviour)debris).sprite.collection.GetSpriteIdByName("fuel_rod_cannon_projectile_empty"); ((BraveBehaviour)debris).sprite.SetGlowiness(1f); } public override void OnReloadPressed(PlayerController player, Gun gun, bool manualReload) { base.OnReloadPressed(player, gun, manualReload); if (manualReload) { curAmmoType = (curAmmoType + 1) % _Rods.Count; ((GunBehaviour)this).gun.CurrentAmmo = ammoOfEachType[curAmmoType]; UpdateAmmo(); ((Component)player).gameObject.Play("replicant_select_sound"); _ammoDisplayDirty = true; } } public override void Update() { base.Update(); if (_cachedAmmo != ((GunBehaviour)this).gun.CurrentAmmo) { _cachedAmmo = ((GunBehaviour)this).gun.CurrentAmmo; UpdateAmmo(); } if (_uiAmmoType != curAmmoType) { _uiAmmoType = curAmmoType; ((GunBehaviour)this).gun.DefaultModule.customAmmoType = _AmmoSprites[curAmmoType]; } } public override void OnMasteryStatusChanged() { base.OnMasteryStatusChanged(); ((GunBehaviour)this).gun.CanGainAmmo = base.Mastered; } public override void OnFirstPickup(PlayerController player) { base.OnFirstPickup(player); for (int i = 0; i < _Rods.Count; i++) { if (ammoOfEachType.Count <= i) { ammoOfEachType.Add(0); } else { ammoOfEachType[i] = 0; } } ((GunBehaviour)this).gun.CurrentAmmo = 0; } private void ConvertBarrelToAmmo(KickableObject barrel, string prefabName) { //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_009d: 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) _newGoopType = prefabName switch { "red barrel" => 1, "red drum" => 1, "purple drum" => 2, "yellow drum" => 3, "blue drum" => 0, _ => 0, }; Lazy.DoPickupAt(Vector2.op_Implicit(((BraveBehaviour)barrel).specRigidbody.UnitCenter)); MinorBreakable component = ((Component)barrel).gameObject.GetComponent(); component.destroyOnBreak = true; component.makeParallelOnBreak = false; component.explodesOnBreak = false; component.goopsOnBreak = false; component.Break(Vector2.zero); int amount = ((!base.Mastered) ? 1 : 3) * 5; new GameObject().AddComponent().Setup((FuelRodAmmoType)_newGoopType, amount, this, ((GunBehaviour)this).PlayerOwner); } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); UpdateAmmo(); } private void UpdateAmmo() { PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null) { return; } _ammoDisplayDirty = true; if (((GunBehaviour)this).gun.InfiniteAmmo || ((GunBehaviour)this).gun.LocalInfiniteAmmo || playerOwner.InfiniteAmmo.Value) { return; } int num = (ammoOfEachType[curAmmoType] = ((GunBehaviour)this).gun.CurrentAmmo); if (num > 0) { return; } int count = _Rods.Count; for (int num2 = count - 1; num2 >= 0; num2--) { curAmmoType = (curAmmoType + 1) % count; if (ammoOfEachType[curAmmoType] != 0) { ((GunBehaviour)this).gun.CurrentAmmo = ammoOfEachType[curAmmoType]; break; } } } public override void OnAmmoChanged(PlayerController player, Gun gun) { ((GunBehaviour)this).OnAmmoChanged(player, gun); if (base.Mastered && _cachedAmmo < ((GunBehaviour)this).gun.CurrentAmmo) { int num = ((GunBehaviour)this).gun.CurrentAmmo - _cachedAmmo; for (int i = 0; i < _Rods.Count; i++) { ammoOfEachType[i] = Mathf.Min(ammoOfEachType[i] + num, ((GunBehaviour)this).gun.AdjustedMaxAmmo); } } UpdateAmmo(); } public override void MidGameSerialize(List data, int i) { ((GunBehaviour)this).MidGameSerialize(data, i); data.Add(curAmmoType); for (int j = 0; j < _Rods.Count; j++) { data.Add(ammoOfEachType[j]); } } public override void MidGameDeserialize(List data, ref int i) { ((GunBehaviour)this).MidGameDeserialize(data, ref i); curAmmoType = (int)data[i++]; for (int j = 0; j < _Rods.Count; j++) { if (ammoOfEachType.Count <= j) { ammoOfEachType.Add((int)data[i++]); } else { ammoOfEachType[j] = (int)data[i++]; } } } } public class FuelRodAmmoCollector : MonoBehaviour { public void Setup(FuelRodGun.FuelRodAmmoType ammoType, int amount, FuelRodGun gun, PlayerController player) { ((MonoBehaviour)this).StartCoroutine(Run(ammoType, amount, gun, player)); } private IEnumerator Run(FuelRodGun.FuelRodAmmoType ammoType, int amount, FuelRodGun gun, PlayerController player) { GameObject original = FuelRodGun._AmmoCells[(int)ammoType]; List vfx = new List(); Vector2 centerPosition = ((GameActor)player).CenterPosition; for (int i = 0; i < amount; i++) { tk2dSprite component = original.Instantiate(Vector2.op_Implicit(centerPosition)).GetComponent(); ((BraveBehaviour)component).transform.localRotation = 90f.EulerZ(); vfx.Add(component); } float spreadDelta = 80f / (float)amount; float staggerDelta = 0.5f / (float)Mathf.Max(amount - 1, 1); for (float elapsed = 0f; elapsed < 1.3000001f; elapsed += BraveTime.DeltaTime) { centerPosition = ((GameActor)player).CenterPosition; float num = 50f; float num2 = elapsed; for (int j = 0; j < amount; j++) { if (Object.op_Implicit((Object)(object)vfx[j])) { float num3 = 0f; if (num2 < 0.35f) { num3 = Ease.OutQuad(num2 / 0.35f); } else if (num2 < 0.7f) { num3 = 1f - Ease.OutQuad((num2 - 0.35f) / 0.35f); } else { if (Object.op_Implicit((Object)(object)gun)) { gun.curAmmoType = (int)ammoType; Gun gun2 = ((GunBehaviour)gun).gun; int currentAmmo = (gun.ammoOfEachType[gun.curAmmoType] = Mathf.Min(gun.ammoOfEachType[gun.curAmmoType] + 1, ((GunBehaviour)gun).gun.AdjustedMaxAmmo)); gun2.CurrentAmmo = currentAmmo; } ((Component)vfx[j]).gameObject.Play("fuel_rod_cell_collect_sound"); Object.Destroy((Object)(object)((Component)vfx[j]).gameObject); vfx[j] = null; } if (Object.op_Implicit((Object)(object)vfx[j])) { float magnitude = 2.5f * num3; Vector2 val = (centerPosition + num.ToVector(magnitude)).HoverAt(0.1875f, 3f, 0f, (float)j / (float)amount); ((tk2dBaseSprite)vfx[j]).scale = num3 * Vector3.one; ((tk2dBaseSprite)(object)vfx[j]).PlaceAtRotatedPositionByAnchor(Vector2.op_Implicit(val), (Anchor)4); } } num += spreadDelta; num2 = Mathf.Max(num2 - staggerDelta, 0f); } yield return null; } for (int k = 0; k < amount; k++) { if (Object.op_Implicit((Object)(object)vfx[k])) { Object.Destroy((Object)(object)((Component)vfx[k]).gameObject); } } Object.Destroy((Object)(object)((Component)this).gameObject); } } public static class FuelRodGunHelpers { public static Projectile MakeFuelRodProjectile(this Projectile p, GoopDefinition goop = null, float power = 1f) { if ((Object)(object)goop != (Object)null) { p.Attach((Action)delegate(GoopModifier g) { g.goopDefinition = goop; g.SpawnGoopOnCollision = true; g.CollisionSpawnRadius = 6f; g.SpawnGoopInFlight = false; }, allowDuplicates: false); } if (power != 1f) { p.Attach((Action)delegate(ExplosiveModifier ex) { ex.explosionData = ex.explosionData.Clone(); ExplosionData explosionData = ex.explosionData; explosionData.damage *= power; }, allowDuplicates: false); } return p; } } public class Gadulo : CwaffGun { private class GaduloDamageAdjuster : DamageAdjuster { public override ApplyPriority Priority => ApplyPriority.Bottom; protected override float AdjustDamage(float currentDamage, Projectile proj, AIActor enemy) { HealthHaver healthHaver = ((BraveBehaviour)enemy).healthHaver; if (healthHaver == null || !(healthHaver.currentHealth <= currentDamage)) { return 0f; } return currentDamage; } } public static string ItemName = "Gadulo"; public static string ShortDescription = "Authentic Subanese"; public static string LongDescription = "Fires shards that have very high base damage, but cannot damage enemies that they don't kill outright. Shards inflict 3 seconds of stun on enemies they don't kill."; public static string Lore = "This weapon's crystals have a propensity for violently exploding when enough are embedded in the same organism. While incredibly effective in theory, inexperienced combatants often struggle getting them to stick to anything other than lightly-defended targets and their own sleeves."; internal static readonly List _IdleAnimations = new List(4); internal static readonly List _FireAnimations = new List(4); private const int _SHOOT_FPS = 60; public static void Init() { //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) Gun gunRef; Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore).SetAttributes((ItemQuality)3, (GunClass)15, 1.25f, 150, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, null, null, null, null, "needle_rifle_fire_sound", 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, autoPlay: true, attacksThroughWalls: false, suppressReloadLabel: false, 1f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: false, preventRollingWhenCharging: false, 1f, 0.1f).SetReloadAudio("needle_rifle_reload_hatch_sound") .SetReloadAudio("needle_rifle_reload_plant_sound", 5) .AssignGun(out gunRef); int? clipSize = 3; float? cooldown = 0.45f; float? damage = 40f; float? speed = 200f; float? range = 99f; float? force = 10f; Projectile target = gun.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "needle_rifle_projectile", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, null, null, "needler_impact_enemy_sound", "needle_rifle_impact_wall_sound", null, 0f, ignoredForReloadPurposes: false, mirror: false, null, null, null, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: false, 0f, null, 20f, null, null, -1, null, null, null, null, null, null, null, 1.55f, -1f, 0f, 3f)).Attach().Attach(); float? emissivePower = 10f; float? emissiveColorPower = 8f; Color? emissiveColor = new Color(1f, 0.5f, 0.5f); Projectile p = target.AttachTrail("needle_rifle_trail", 60, null, -1f, 1f / 120f, 1f, destroyOnEmpty: true, null, null, emissivePower, emissiveColorPower, emissiveColor); emissiveColor = new Color(1f, 0.3f, 1f); p.SetAllImpactVFX(VFX.CreatePool("needle_rifle_impact_vfx", 60f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 75f, emissiveColor, orphaned: false, attached: true, unlit: false, 0f, 0f, null, 2f)).StickToEnemies(10f, ((Component)Items.CatClaw.DefaultProjectile()).GetComponent().explosionData.effect.CreatePoolFromVFXGameObject(), delegate(NoKillHealthModificationBuff b) { ((HealthModificationBuff)b).vfx.AddComponent(); }); for (int num = 0; num < 4; num++) { _IdleAnimations.Add(gunRef.QuickUpdateGunAnimation($"idle_{num}clip")); _FireAnimations.Add(gunRef.QuickUpdateGunAnimation((num < 3) ? $"fire_{num}clip" : "fire", null, returnToIdle: true, 60)); gunRef.SetGunAudio(_FireAnimations[num], "needle_rifle_fire_sound"); } gunRef.idleAnimation = _IdleAnimations[3]; gunRef.shootAnimation = _FireAnimations[3]; } private void UpdateAnimations() { if (((GunBehaviour)this).gun.IsReloading) { ((GunBehaviour)this).gun.idleAnimation = _IdleAnimations[_IdleAnimations.Count - 1]; ((GunBehaviour)this).gun.shootAnimation = _FireAnimations[_FireAnimations.Count - 1]; } else { ((GunBehaviour)this).gun.idleAnimation = _IdleAnimations[Mathf.Clamp(((GunBehaviour)this).gun.ClipShotsRemaining, 0, _IdleAnimations.Count - 1)]; ((GunBehaviour)this).gun.shootAnimation = _FireAnimations[Mathf.Clamp(((GunBehaviour)this).gun.ClipShotsRemaining - 1, 0, _FireAnimations.Count - 1)]; } ((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 class NoKillHealthModificationBuff : HealthModificationBuff { public override void AddSelfToTarget(GameObject target) { HealthHaver component = target.GetComponent(); if (component != null && !component.IsDead) { ((HealthModificationBuff)this).AddSelfToTarget(target); } } } public class CrystalFlicker : MonoBehaviour { private Material _mat; private void Start() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) tk2dSprite component = ((Component)this).gameObject.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { Object.Destroy((Object)(object)this); return; } ((tk2dBaseSprite)component).usesOverrideMaterial = true; _mat = ((BraveBehaviour)component).renderer.material; _mat.shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTiltedCutoutEmissive"); _mat.SetColor(CwaffVFX._EmissiveColorId, Color.magenta); _mat.SetFloat(CwaffVFX._EmissiveColorPowerId, 0.65f); } private void Update() { _mat.SetFloat(CwaffVFX._EmissivePowerId, 75f + 50f * Mathf.Sin(60f * BraveTime.ScaledTimeSinceStartup)); } } public class SuperCombiner : MonoBehaviour { private Projectile _proj; private void Start() { _proj = ((Component)this).gameObject.GetComponent(); if (Object.op_Implicit((Object)(object)_proj)) { GameActor owner = _proj.m_owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null && val.HasSynergy(Synergy.MASTERY_GADULO)) { Projectile proj = _proj; proj.OnHitEnemy = (Action)Delegate.Combine(proj.OnHitEnemy, new Action(RegisterSuperCombine)); return; } } HealthModificationBuff component = ((Component)this).gameObject.GetComponent(); if (component != null) { Object.Destroy((Object)(object)component); } Object.Destroy((Object)(object)this); } private static void RegisterSuperCombine(Projectile projectile, SpeculativeRigidbody rigidbody, bool killed) { if (!killed) { GameObjectExtensions.GetOrAddComponent(((Component)rigidbody).gameObject).AddDamage(projectile.baseData.damage); } } } public class SuperCombineDamage : MonoBehaviour { private HealthHaver _hh; private float _damage; private bool _setup; private int _count; private void Start() { if (!_setup && !Setup()) { Object.Destroy((Object)(object)this); } } private bool Setup() { _hh = ((Component)this).gameObject.GetComponent(); if (!Object.op_Implicit((Object)(object)_hh)) { return false; } _setup = true; return true; } public void AddDamage(float damage) { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) if (!_setup && !Setup()) { Object.Destroy((Object)(object)this); return; } if (!Object.op_Implicit((Object)(object)_hh) || _hh.IsDead) { Object.Destroy((Object)(object)this); return; } _damage += damage; _count++; if (!(_damage < _hh.currentHealth)) { if (!(((BraveBehaviour)_hh).gameActor is AIActor)) { Object.Destroy((Object)(object)this); return; } ((Component)this).gameObject.Play("supercombine_sound"); _hh.ApplyDamage(_damage, Lazy.RandomVector(), "supercombine", (CoreDamageTypes)0, (DamageCategory)5, true, (PixelCollider)null, true); Object.Destroy((Object)(object)this); } } } public class SubMachineGun : CwaffGun { public static string ItemName = "Sub Machine Gun"; public static string ShortDescription = "The Hero You Deserve"; public static string LongDescription = "Fires harmless sandwiches that have a chance to permacharm and fully heal enemies equal to twice the percent of health they have lost. Enemies at 50% health or less are 100% susceptible to charm. Can be eaten when out of ammo to restore 1.5 hearts."; public static string Lore = "Calling this object a gun stretches the definition of the word to its absolute limits, but it evidently scrapes by just enough to get a pass from both the legal system and the Breach's marketing division. Even so, this 'gun' doesn't seem to be particularly useful as a conventional firearm."; private const float _HEAL_AMOUNT = 1.5f; internal static GameObject _NourishVFX; internal static GameObject _NourishSelfVFX; public static void Init() { //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 20; int? reloadFps = 10; Gun gun2 = gun.SetAttributes((ItemQuality)2, (GunClass)40, 1.5f, 200, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "sub_machine_gun_fire_sound", "sub_machine_gun_reload_sound", null, -1, -1, -1, null, modulesAreTiers: false, "muzzle_sub_machine_gun", 30, 0.5f, (Anchor)4, -1f, null, -1f, muzzleLit: false, 0f, 0f, null, null, preventRotation: false, 0f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: true, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0, autoPlay: true, attacksThroughWalls: false, suppressReloadLabel: false, 1f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: false, preventRollingWhenCharging: false, 1f, 0.1f); int? clipSize = 5; float? cooldown = 0.2f; float? damage = 0f; bool? shouldRotate = false; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "sandwich_projectile", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, shouldRotate)).Attach(); Color? emissiveColour = Color.Lerp(Color.green, Color.white, 0.5f); _NourishVFX = VFX.Create("nourish_vfx", 18f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 1f, emissiveColour); _NourishSelfVFX = ((Component)Items.Ration.AsActive()).gameObject.GetComponent().healVFX; } public override bool OnAttemptedGunThrow() { base.OnAttemptedGunThrow(); PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null) { return true; } Consume(playerOwner); return false; } private void Consume(PlayerController pc, bool preventedDeath = false) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (preventedDeath) { NourishingProjectile.DoActorNourishVFX((GameActor)(object)pc); } else { ((Component)pc).gameObject.Play("nourished_sound"); } ((Component)pc).gameObject.Play("sub_machine_gun_reload_sound"); ((BraveBehaviour)pc).healthHaver.ApplyHealing(base.Mastered ? 999f : 1.5f); ((GameActor)pc).PlayEffectOnActor(_NourishSelfVFX, Vector3.zero, true, false, false); Object.Destroy((Object)(object)((Component)pc.ForceDropGun(((GunBehaviour)this).gun)).gameObject); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); if (!player.ForceZeroHealthState) { HealthHaver healthHaver = ((BraveBehaviour)player).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Combine(healthHaver.ModifyDamage, new Action(ModifyDamage)); } } public override void OnDroppedByPlayer(PlayerController player) { HealthHaver healthHaver = ((BraveBehaviour)player).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Remove(healthHaver.ModifyDamage, new Action(ModifyDamage)); base.OnDroppedByPlayer(player); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { HealthHaver healthHaver = ((BraveBehaviour)((GunBehaviour)this).PlayerOwner).healthHaver; healthHaver.ModifyDamage = (Action)Delegate.Remove(healthHaver.ModifyDamage, new Action(ModifyDamage)); } base.OnDestroy(); } private void ModifyDamage(HealthHaver hh, ModifyDamageEventArgs data) { if (base.Mastered && hh.PlayerWillDieFromHit(data)) { data.ModifiedDamage = 0f; hh.ModifyDamage = (Action)Delegate.Remove(hh.ModifyDamage, new Action(ModifyDamage)); hh.TriggerInvulnerabilityPeriod(-1f); Lazy.DoDamagedFlash(hh); Consume(((GunBehaviour)this).PlayerOwner, preventedDeath: true); } } } public class NourishingProjectile : MonoBehaviour { private Projectile _proj; private void Start() { _proj = ((Component)this).GetComponent(); Projectile proj = _proj; proj.OnHitEnemy = (Action)Delegate.Combine(proj.OnHitEnemy, new Action(OnHitEnemy)); } private void OnHitEnemy(Projectile p, SpeculativeRigidbody body, bool killed) { HealthHaver healthHaver = ((BraveBehaviour)body).healthHaver; if (healthHaver == null || !healthHaver.IsAlive || killed) { return; } AIActor aiActor = ((BraveBehaviour)body).aiActor; if (aiActor == null || aiActor.CanTargetEnemies || 1f - healthHaver.GetCurrentHealthPercentage() <= 0.5f * Random.value) { return; } ? val = aiActor; PickupObject obj = ItemHelper.Get(Items.YellowChamber); ((GameActor)val).ApplyEffect((GameActorEffect)(object)((YellowChamberItem)((obj is YellowChamberItem) ? obj : null)).CharmEffect, 1f, (Projectile)null); if (!aiActor.CanTargetPlayers && aiActor.CanTargetEnemies) { GameActor owner = _proj.Owner; PlayerController val2 = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val2 != null && val2.HasSynergy(Synergy.I_NEED_A_HERO)) { aiActor.ReplaceGun(Items.Heroine); } healthHaver.FullHeal(); DoActorNourishVFX((GameActor)(object)aiActor); } } internal static void DoActorNourishVFX(GameActor actor) { //IL_000b: 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_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) GameObject obj = SpawnManager.SpawnVFX(SubMachineGun._NourishVFX, Vector2.op_Implicit(((BraveBehaviour)actor).sprite.WorldTopCenter + new Vector2(0f, 1f)), Quaternion.identity, true); ((tk2dBaseSprite)obj.GetComponent()).HeightOffGround = 1f; obj.transform.parent = ((BraveBehaviour)((BraveBehaviour)actor).sprite).transform; obj.AddComponent().Setup(0.15f, 0.2f, 0f, 0.2f, 0.15f, 5f); ((Component)actor).gameObject.Play("nourished_sound"); } } public class Grandmaster : CwaffGun { public static string ItemName = "Grandmaster"; public static string ShortDescription = "Mate in Gun"; public static string LongDescription = "Fires assorted chess pieces that home towards enemies in bursts of movement corresponding to their piece type."; public static string Lore = "This gun was wielded by the legendary Magnum Carlsen in his bullet chess world championship match against the equally legendary Garry Makarov. While the match ended in a draw, it was notable for being Makarov's final match before retiring to a life of mentorship for the new generation of aspiring Gungeoneers."; internal static tk2dSpriteAnimationClip _PawnSprite; internal static tk2dSpriteAnimationClip _RookSprite; internal static tk2dSpriteAnimationClip _BishopSprite; internal static tk2dSpriteAnimationClip _KnightSprite; internal static tk2dSpriteAnimationClip _QueenSprite; internal static tk2dSpriteAnimationClip _KingSprite; internal static tk2dSpriteAnimationClip _BlackPawnSprite; internal static tk2dSpriteAnimationClip _BlackRookSprite; internal static tk2dSpriteAnimationClip _BlackBishopSprite; internal static tk2dSpriteAnimationClip _BlackKnightSprite; internal static tk2dSpriteAnimationClip _BlackQueenSprite; internal static tk2dSpriteAnimationClip _BlackKingSprite; internal static Projectile _Projectile; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 24; int? reloadFps = 16; Items? muzzleFrom = Items.Mailbox; Gun gun2 = gun.SetAttributes((ItemQuality)4, (GunClass)50, 1f, 350, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "chess_gun_fire", "chess_gun_reload", 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).AddDualWieldSynergy(Synergy.BOARD_AND_CARD_GAME_NIGHT); int? clipSize = 20; float? cooldown = 0.1f; float? speed = 30f; float? damage = 10f; float? force = 9f; float? range = 1000f; bool? shouldRotate = false; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, 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, null, shouldRotate)).AddAnimations(AnimatedBullet.Create(ref _PawnSprite, "chess_pawn", 2, (Anchor)4, 0.8f), AnimatedBullet.Create(ref _RookSprite, "chess_rook", 2, (Anchor)4, 0.8f), AnimatedBullet.Create(ref _BishopSprite, "chess_bishop", 2, (Anchor)4, 0.8f), AnimatedBullet.Create(ref _KnightSprite, "chess_knight", 2, (Anchor)4, 0.8f), AnimatedBullet.Create(ref _QueenSprite, "chess_queen", 2, (Anchor)4, 0.8f), AnimatedBullet.Create(ref _KingSprite, "chess_king", 2, (Anchor)4, 0.8f), AnimatedBullet.Create(ref _BlackPawnSprite, "chess_pawn_black", 2, (Anchor)4, 0.8f), AnimatedBullet.Create(ref _BlackRookSprite, "chess_rook_black", 2, (Anchor)4, 0.8f), AnimatedBullet.Create(ref _BlackBishopSprite, "chess_bishop_black", 2, (Anchor)4, 0.8f), AnimatedBullet.Create(ref _BlackKnightSprite, "chess_knight_black", 2, (Anchor)4, 0.8f), AnimatedBullet.Create(ref _BlackQueenSprite, "chess_queen_black", 2, (Anchor)4, 0.8f), AnimatedBullet.Create(ref _BlackKingSprite, "chess_king_black", 2, (Anchor)4, 0.8f)).Attach() .Assign(out _Projectile); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); player.OnChestBroken = (Action)Delegate.Combine(player.OnChestBroken, new Action(OnChestBroken)); } public override void OnDroppedByPlayer(PlayerController player) { player.OnChestBroken = (Action)Delegate.Remove(player.OnChestBroken, new Action(OnChestBroken)); base.OnDroppedByPlayer(player); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; playerOwner.OnChestBroken = (Action)Delegate.Remove(playerOwner.OnChestBroken, new Action(OnChestBroken)); } base.OnDestroy(); } private void OnChestBroken(PlayerController player, Chest chest) { //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) if (player.HasSynergy(Synergy.CHEST_BATTLE_ADVANCED)) { int num = DetermineCasingValueOfChest(chest); if (num > 0) { LootEngine.SpawnCurrency(Vector2.op_Implicit(((BraveBehaviour)chest).transform.position), num, false); } } } private static int DetermineCasingValueOfChest(Chest chest) { if (!Object.op_Implicit((Object)(object)chest) || chest.IsOpen) { return 0; } if (chest.IsRainbowChest) { return 200; } LootData lootTable = chest.lootTable; if (lootTable == null) { return 10; } float num = lootTable.S_Chance + lootTable.A_Chance + lootTable.B_Chance + lootTable.C_Chance + lootTable.D_Chance; return Mathf.Max(10, Mathf.FloorToInt((50f * lootTable.S_Chance + 40f * lootTable.A_Chance + 30f * lootTable.B_Chance + 20f * lootTable.C_Chance + 10f * lootTable.D_Chance) / num)); } } public enum ChessPieces { Pawn, Rook, Bishop, Knight, Queen } public abstract class ChessPiece : MonoBehaviour { protected static float _BaseMoveDist = 180f; protected static float _BaseMoveTime = 0.1f; protected static float _BaseMovePause = 0.4f; protected tk2dSpriteAnimationClip _sprite; protected Projectile _projectile; protected PlayerController _owner; protected float _lifetime; protected int _movePhase = 1; protected float _speed; protected EasyTrailBullet _trail; protected Vector2? _target; protected Vector2 _targetVec = Vector2.zero; protected AIActor _targetEnemy; protected bool _twoPhaseMove; protected bool _mastered; protected float _moveTime; protected float _pauseTime; protected bool _spawnBlack; protected bool _isBlack; private void Update() { //IL_0061: 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_0109: 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) //IL_009c: 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) _lifetime += BraveTime.DeltaTime; if (_movePhase == 0) { if (_lifetime >= _pauseTime) { StartMoving(); _projectile.collidesWithEnemies = true; _movePhase = 1; _lifetime = 0f; if (_twoPhaseMove) { _projectile.SendInDirection(_targetVec.LargerComponent(), true, true); } } } else if (_twoPhaseMove && _movePhase == 1) { if (_lifetime >= _moveTime) { _projectile.SendInDirection(_targetVec.SmallerComponent(), true, true); _movePhase = 2; } } else if (_lifetime >= _moveTime * (float)_movePhase) { StopMoving(); _projectile.collidesWithEnemies = false; _movePhase = 0; _lifetime = 0f; if (_spawnBlack) { _spawnBlack = false; ((Component)VolleyUtility.ShootSingleProjectile(Grandmaster._Projectile, _projectile.SafeCenter, 0f - Vector2Extensions.ToAngle(_targetVec), false, (GameActor)(object)_owner)).GetComponent().isBlackPiece = true; } } } public virtual void Setup(Projectile projectile, PlayerController owner, bool isBlackPiece) { //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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) _projectile = projectile; _owner = owner; _mastered = _owner.HasSynergy(Synergy.MASTERY_GRANDMASTER); _spawnBlack = _mastered && !isBlackPiece; _isBlack = isBlackPiece; _sprite = GetSprite(); _moveTime = _BaseMoveTime * (_mastered ? 0.5f : 1f); _pauseTime = _BaseMovePause * (_mastered ? 0.5f : 1f) / owner.ProjSpeedMult(); _speed = GetMoveDistance() / (_BaseMoveTime * 60f); _movePhase = ((!_twoPhaseMove) ? 1 : 2); _trail = ((Component)_projectile).gameObject.AddComponent(); _trail.StartWidth = 0.2f; _trail.EndWidth = 0.1f; _trail.LifeTime = 0.1f; _trail.BaseColor = GetTrailColor(); _trail.StartColor = GetTrailColor(); _trail.EndColor = GetTrailColor(); _projectile.SetAnimation(_sprite); _targetVec = _projectile.m_currentDirection; UpdateCreate(); } protected abstract tk2dSpriteAnimationClip GetSprite(); protected abstract float GetMoveDistance(); protected abstract Color GetTrailColor(); protected virtual Vector2? ChooseNewTarget() { return null; } protected virtual void UpdateCreate() { } public void StartMoving() { //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) //IL_0025: 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_0036: 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_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_00b5: 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_007a: 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) _target = ChooseNewTarget(); Vector2? target = _target; if (target.HasValue) { Vector2 valueOrDefault = target.GetValueOrDefault(); _targetVec = valueOrDefault - _projectile.SafeCenter; float num = ((Vector2)(ref _targetVec)).magnitude / _moveTime; _projectile.SetSpeed(Mathf.Min(_speed, num)); goto IL_00cb; } if (_twoPhaseMove) { Vector2 val = _targetVec.LargerComponent(); if (((Vector2)(ref val)).sqrMagnitude != 0f) { goto IL_00ba; } } _targetVec = _speed * GetBestValidAngleForPiece(Vector2Extensions.ToAngle(_projectile.m_currentDirection)).ToVector(); goto IL_00ba; IL_00ba: _projectile.SetSpeed(_speed); goto IL_00cb; IL_00cb: _projectile.SendInDirection(_targetVec, true, true); } public void StopMoving() { ((Component)this).gameObject.Play("chess_move"); if (Object.op_Implicit((Object)(object)_projectile)) { _projectile.SetSpeed(0.001f); _projectile.m_usesNormalMoveRegardless = true; } } protected float LockAngleToOneOf(float angle, IEnumerable angles) { float num = angle.Clamp360(); float result = angle; float num2 = 999f; foreach (float angle2 in angles) { float num3 = Mathf.Abs(angle2 - num); if (!(num3 > num2)) { num2 = num3; result = angle2; } } return result; } protected float GetBestValidAngleForPiece(float angle) { return LockAngleToOneOf(angle, GetValidAnglesForPiece()); } protected virtual IEnumerable GetValidAnglesForPiece() { return Enumerable.Empty(); } protected Vector2? ScanForTarget() { //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_0099: 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_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_004c: 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_0062: 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_00f5: 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_00f8: 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_0118: 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_0137: 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_017c: 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) if (Object.op_Implicit((Object)(object)_targetEnemy)) { if (!((BraveBehaviour)_targetEnemy).healthHaver.IsDead) { float bestValidAngleForPiece = GetBestValidAngleForPiece(Vector2Extensions.ToAngle(((GameActor)_targetEnemy).CenterPosition - _projectile.SafeCenter)); return Lazy.PointOrthognalTo(_projectile.SafeCenter, ((GameActor)_targetEnemy).CenterPosition, bestValidAngleForPiece.ToVector()); } _targetEnemy = null; } Vector2 safeCenter = _projectile.SafeCenter; Vector2? result = null; float num = 999999f; foreach (AIActor allNearbyEnemy in _projectile.SafeCenter.GetAllNearbyEnemies(100f, ignoreWalls: false)) { if (!allNearbyEnemy.IsNormalEnemy || !Object.op_Implicit((Object)(object)((BraveBehaviour)allNearbyEnemy).healthHaver) || allNearbyEnemy.IsHarmlessEnemy) { continue; } Vector2 centerPosition = ((GameActor)allNearbyEnemy).CenterPosition; Vector2 val = centerPosition - safeCenter; float magnitude = ((Vector2)(ref val)).magnitude; if (magnitude >= num) { continue; } Vector2? val2 = null; _ = Vector2.zero; foreach (float item in GetValidAnglesForPiece()) { val2 = Lazy.PointOrthognalTo(safeCenter, centerPosition, item.ToVector()); if (val2.HasValue) { break; } } if (val2.HasValue && safeCenter.HasLineOfSight(val2.Value)) { num = magnitude; result = val2; _targetEnemy = allNearbyEnemy; } } return result; } } public class PawnPiece : ChessPiece { protected override tk2dSpriteAnimationClip GetSprite() { if (!_isBlack) { return Grandmaster._PawnSprite; } return Grandmaster._BlackPawnSprite; } protected override float GetMoveDistance() { return ChessPiece._BaseMoveDist; } protected override Color GetTrailColor() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return Color.white; } } public class RookPiece : ChessPiece { private static readonly List _AnglesOf90 = new List { 0f, 90f, 180f, 270f }; protected override tk2dSpriteAnimationClip GetSprite() { if (!_isBlack) { return Grandmaster._RookSprite; } return Grandmaster._BlackRookSprite; } protected override float GetMoveDistance() { return 450f; } protected override Color GetTrailColor() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return Color.magenta; } protected override IEnumerable GetValidAnglesForPiece() { return _AnglesOf90; } protected override Vector2? ChooseNewTarget() { return ScanForTarget(); } protected override void UpdateCreate() { //IL_0008: 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_0021: Unknown result type (might be due to invalid IL or missing references) _targetVec = GetBestValidAngleForPiece(Vector2Extensions.ToAngle(_projectile.m_currentDirection)).ToVector(); } } public class BishopPiece : ChessPiece { private static readonly List _AnglesOf45 = new List { 45f, 135f, 225f, 315f }; protected override tk2dSpriteAnimationClip GetSprite() { if (!_isBlack) { return Grandmaster._BishopSprite; } return Grandmaster._BlackBishopSprite; } protected override float GetMoveDistance() { return 350f; } protected override Color GetTrailColor() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return Color.cyan; } protected override IEnumerable GetValidAnglesForPiece() { return _AnglesOf45; } protected override Vector2? ChooseNewTarget() { return ScanForTarget(); } protected override void UpdateCreate() { //IL_0008: 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_0021: Unknown result type (might be due to invalid IL or missing references) _targetVec = GetBestValidAngleForPiece(Vector2Extensions.ToAngle(_projectile.m_currentDirection)).ToVector(); } } public class KnightPiece : ChessPiece { private static List _AnglesOf30 = new List { 30f, 60f, 120f, 150f, 210f, 240f, 300f, 330f }; protected override tk2dSpriteAnimationClip GetSprite() { if (!_isBlack) { return Grandmaster._KnightSprite; } return Grandmaster._BlackKnightSprite; } protected override float GetMoveDistance() { return 200f; } protected override Color GetTrailColor() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return Color.green; } protected override IEnumerable GetValidAnglesForPiece() { return _AnglesOf30; } protected override Vector2? ChooseNewTarget() { return ScanForTarget(); } protected override void UpdateCreate() { //IL_0008: 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_0021: Unknown result type (might be due to invalid IL or missing references) _targetVec = GetBestValidAngleForPiece(Vector2Extensions.ToAngle(_projectile.m_currentDirection)).ToVector(); _twoPhaseMove = true; _movePhase = 2; } } public class QueenPiece : ChessPiece { private static List _AnglesOf45And90 = new List { 0f, 45f, 90f, 135f, 180f, 225f, 270f, 315f }; protected override tk2dSpriteAnimationClip GetSprite() { if (!_isBlack) { return Grandmaster._QueenSprite; } return Grandmaster._BlackQueenSprite; } protected override float GetMoveDistance() { return 500f; } protected override Color GetTrailColor() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return Color.yellow; } protected override IEnumerable GetValidAnglesForPiece() { return _AnglesOf45And90; } protected override Vector2? ChooseNewTarget() { return ScanForTarget(); } protected override void UpdateCreate() { //IL_0008: 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_0021: Unknown result type (might be due to invalid IL or missing references) _targetVec = GetBestValidAngleForPiece(Vector2Extensions.ToAngle(_projectile.m_currentDirection)).ToVector(); } } public class PlayChessBehavior : MonoBehaviour { public bool isBlackPiece; private Projectile _projectile; private PlayerController _owner; private ChessPiece _piece; private static readonly List _PiecePool = new List { ChessPieces.Pawn, ChessPieces.Pawn, ChessPieces.Pawn, ChessPieces.Pawn, ChessPieces.Pawn, ChessPieces.Pawn, ChessPieces.Pawn, ChessPieces.Pawn, ChessPieces.Rook, ChessPieces.Rook, ChessPieces.Bishop, ChessPieces.Bishop, ChessPieces.Knight, ChessPieces.Knight, ChessPieces.Queen }; private static readonly List _MasteredPiecePool = new List { ChessPieces.Rook, ChessPieces.Rook, ChessPieces.Bishop, ChessPieces.Bishop, ChessPieces.Knight, ChessPieces.Knight, ChessPieces.Queen }; private void Start() { _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)) { switch ((_owner.HasSynergy(Synergy.MASTERY_GRANDMASTER) ? _MasteredPiecePool : _PiecePool).ChooseRandom()) { case ChessPieces.Pawn: _piece = ((Component)_projectile).gameObject.AddComponent(); break; case ChessPieces.Rook: _piece = ((Component)_projectile).gameObject.AddComponent(); break; case ChessPieces.Bishop: _piece = ((Component)_projectile).gameObject.AddComponent(); break; case ChessPieces.Knight: _piece = ((Component)_projectile).gameObject.AddComponent(); break; case ChessPieces.Queen: _piece = ((Component)_projectile).gameObject.AddComponent(); break; default: _piece = ((Component)_projectile).gameObject.AddComponent(); break; } _piece.Setup(_projectile, _owner, isBlackPiece); } } } public class Tranquilizer : CwaffGun { public static string ItemName = "Tranquilizer"; public static string ShortDescription = "Zzzzzz"; public static string LongDescription = "Fires darts that permastun enemies after a few seconds. Each subsequent dart decreases an enemy's tranquilization timer by 3 seconds. Any enemy tranquilized while holding a gun has a 10% chance to drop their held gun and a 25% chance to drop a small ammo pickup."; public static string Lore = "Most commonly used for sedating loudly-opinionated supermarket shoppers and other similarly aggressive wild animals, the tranquilizer gun is the pinnacle of non-lethal firearm technology. What it lacks in visual spectacle or firepower it more than makes up for with raw practicality, able to completely pacify all but the mightiest of the Gungeon's denizens with a single shot and a few seconds of your time. As long as you have a plan in place for not getting shot for those few precious seconds, it's hard to beat in terms of ammo-efficiency for dispatching the Gundead."; internal static GameObject _DrowsyVFX = null; internal static GameObject _SleepyVFX = null; internal static GameObject _TranqImpactVFX = null; internal static GameObject _SleepImpactVFX = null; public static void Init() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); GunClass uTILITY = CwaffGunClass.UTILITY; int? shootFps = 30; int? reloadFps = 40; Items? muzzleFrom = Items.Mailbox; Gun gun2 = gun.SetAttributes((ItemQuality)1, uTILITY, 1.2f, 80, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "blowgun_fire_sound", "blowgun_reload_sound", 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: true, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0, autoPlay: true, attacksThroughWalls: false, suppressReloadLabel: false, 1f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: false, preventRollingWhenCharging: false, 1f, 0.1f); int? clipSize = 1; float? cooldown = 0.1f; float? damage = 0f; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "tranquilizer_projectile", 12, (Anchor)3)).Attach(); _DrowsyVFX = VFX.Create("drowsy_cloud", 6f, loops: true, -1, 0.5f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _SleepyVFX = VFX.Create("sheep_vfx", 6f, loops: true, -1, 0.75f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _TranqImpactVFX = VFX.Create("tranquilizer_impact", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _SleepImpactVFX = VFX.Create("sleep_impact_vfx", 6f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } private void LateUpdate() { if (((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.currentClip.name == ((GunBehaviour)this).gun.shootAnimation) { ((GunBehaviour)this).gun.RenderInFrontOfPlayer(); } } } public class TranquilizerBehavior : MonoBehaviour { private class EnemyTranquilizedBehavior : MonoBehaviour { private const float _DROP_GUN_CHANCE = 0.1f; private const float _DROP_AMMO_CHANCE = 0.25f; private AIActor _enemy; private OrbitalEffect _orb; private bool _stunned; public float timeUntilStun = 9999f; private void Start() { _enemy = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)_enemy) && Object.op_Implicit((Object)(object)((BraveBehaviour)_enemy).healthHaver) && !(((BraveBehaviour)_enemy).healthHaver.currentHealth <= 0f)) { _orb = ((Component)_enemy).gameObject.AddComponent(); _orb.SetupOrbitals(Tranquilizer._DrowsyVFX, 1, 0.2f, isEmissive: false, isOverhead: true); ((Component)_enemy).gameObject.Play("drowsy_sound"); timeUntilStun = Mathf.Max(1, Mathf.CeilToInt(Mathf.Log(((BraveBehaviour)_enemy).healthHaver.currentHealth) / Mathf.Log(2f))); } } private void Update() { if (!_stunned && (timeUntilStun -= BraveTime.DeltaTime) <= 0f) { Permastun(); } } private void Permastun() { //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) _stunned = true; if (Object.op_Implicit((Object)(object)((BraveBehaviour)_enemy).behaviorSpeculator)) { ((BraveBehaviour)_enemy).behaviorSpeculator.Stun(3600f, false); ((BraveBehaviour)_enemy).behaviorSpeculator.OverrideBehaviors.Clear(); ((BraveBehaviour)_enemy).behaviorSpeculator.TargetBehaviors.Clear(); ((BraveBehaviour)_enemy).behaviorSpeculator.MovementBehaviors.Clear(); ((BraveBehaviour)_enemy).behaviorSpeculator.AttackBehaviors.Clear(); ((BraveBehaviour)_enemy).behaviorSpeculator.OtherBehaviors.Clear(); ((BraveBehaviour)_enemy).behaviorSpeculator.m_behaviors.Clear(); } _enemy.IgnoreForRoomClear = true; _enemy.CollisionDamage = 0f; _enemy.CollisionKnockbackStrength = 0f; GameObject sleepImpactVFX = Tranquilizer._SleepImpactVFX; Vector3 position = Vector2.op_Implicit(((GameActor)_enemy).CenterPosition); Quaternion? rotation = Quaternion.identity; float? fadeOutTime = 1f; float? startScale = 0.25f; float? endScale = 2f; float? height = 10f; CwaffVFX.Spawn(sleepImpactVFX, position, rotation, null, 0.5f, fadeOutTime, 0f, null, fadeIn: false, startScale, endScale, height); ((Component)_enemy).gameObject.Play("fall_asleep_sound"); _orb.ClearOrbitals(); _orb.SetupOrbitals(Tranquilizer._SleepyVFX, 2, 0.4f, isEmissive: false, isOverhead: true, rotates: false, flips: true, fades: true, 0.25f); AIShooter aiShooter = ((BraveBehaviour)_enemy).aiShooter; if (aiShooter == null) { return; } Gun currentGun = aiShooter.CurrentGun; if (currentGun != null) { bool num = Synergy.MASTERY_TRANQUILIZER.Active(); if (num || Random.value <= 0.25f) { LootEngine.SpawnItem(ScavengingArms._SmallAmmoPickup, _enemy.Position, Vector2.zero, 0f, false, false, false); } if (num || Random.value <= 0.1f) { aiShooter.ToggleHandRenderers(false, "tranquilized"); if ((Object)(object)aiShooter.m_cachedBraveBulletSource != (Object)null) { ((Behaviour)aiShooter.m_cachedBraveBulletSource).enabled = false; } Gun componentInChildren = ((Component)currentGun.DropGun(0.5f)).gameObject.GetComponentInChildren(); if (componentInChildren != null) { componentInChildren.CurrentAmmo = Mathf.CeilToInt(0.05f * (float)componentInChildren.GetBaseMaxAmmo()); } } } Object.Destroy((Object)(object)aiShooter); } } private const int _STUN_TIME = 3600; private void Start() { Projectile component = ((Component)this).GetComponent(); component.OnHitEnemy = (Action)Delegate.Combine(component.OnHitEnemy, new Action(OnHitEnemy)); component.OnDestruction += OnDestruction; } private void OnHitEnemy(Projectile p, SpeculativeRigidbody enemy, bool killed) { if (Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).aiActor) && ((BraveBehaviour)enemy).aiActor.IsHostileAndNotABoss() && Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).behaviorSpeculator) && !((BraveBehaviour)enemy).behaviorSpeculator.ImmuneToStun) { EnemyTranquilizedBehavior component = ((Component)((BraveBehaviour)enemy).aiActor).gameObject.GetComponent(); if (component != null) { component.timeUntilStun -= 3f; } else { ((Component)((BraveBehaviour)enemy).aiActor).gameObject.AddComponent(); } } } public void OnDestruction(Projectile p) { //IL_0007: 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) CwaffVFX.SpawnBurst(Tranquilizer._TranqImpactVFX, 4, p.SafeCenter, 0f, Vector2.zero, 0f, 2f, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.None, 0.5f, 0.5f, 0f, null, fadeIn: false, uniform: true); } } public class Groundhog : CwaffGun { private class GroundhogProjectile : WeirdProjectile { protected override bool OnFreeFired() { ((Projectile)this).baseData.range = Mathf.Min(((Projectile)this).baseData.range, 16f); return true; } protected override void OnFiredByAnything() { //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_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) GameObject val = new GameObject("groundhog shockwave"); val.transform.position = Vector2.op_Implicit(((Projectile)this).SafeCenter); GroundhogShockwaveDoer groundhogShockwaveDoer = val.AddComponent(); ((MonoBehaviour)groundhogShockwaveDoer).StartCoroutine(groundhogShockwaveDoer.GroundhogShockwaveCR(((Projectile)this).baseData.damage, ((Projectile)this).baseData.force, ((Projectile)this).baseData.range, 0f)); ((Projectile)this).DieInAir(true, false, false, false); } } public class GroundhogShockwaveDoer : MonoBehaviour { public IEnumerator GroundhogShockwaveCR(float damage, float force, float sqrRange, float horizontalForce) { float num = Mathf.Min(Mathf.Sqrt(sqrRange), 10f); int intRange = 2 * Mathf.FloorToInt(num); Vector2 shockwaveCenter = Vector2.op_Implicit(((Component)this).transform.position); int i = 1; while (i < intRange) { ((Component)this).gameObject.Play("earthquake_sound"); Lazy.LaunchAllEnemiesAroundPoint(damage, force, shockwaveCenter, Mathf.Max((float)i - 1.5f, 0f), (float)i + 0.5f, horizontalForce); Exploder.DoRadialMinorBreakableBreak(Vector2.op_Implicit(shockwaveCenter), (float)i); Exploder.DoRadialMajorBreakableDamage(damage, Vector2.op_Implicit(shockwaveCenter), (float)intRange); Exploder.DoRadialPush(Vector2.op_Implicit(shockwaveCenter), force, (float)i); GameManager.Instance.MainCameraController.DoScreenShake(new ScreenShakeSettings(0.5f, 6f, 0.5f, 0f), (Vector2?)shockwaveCenter, false); GameObject earthClod = _EarthClod; int numToSpawn = i * 10; float positionVariance = i; float? fadeOutTime = 0.25f; float? startScale = 1f; float? endScale = 0.1f; CwaffVFX.SpawnBurst(earthClod, numToSpawn, shockwaveCenter, positionVariance, null, 0f, 5f, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.None, 0.25f, fadeOutTime, 0f, null, fadeIn: false, uniform: true, startScale, endScale, null, randomFrame: true); yield return (object)new WaitForSeconds(0.025f); int num2 = i + 1; i = num2; } Object.Destroy((Object)(object)((Component)this).gameObject); } } public static string ItemName = "Groundhog"; public static string ShortDescription = "Deep Impact"; public static string LongDescription = "Penetrates the ground and detonates a warhead when charged, creating a massive shockwave that launches enemies within a large radius skyward. Immobilizes the player while charging."; public static string Lore = "A highly experimental weapon, its indiscriminate shattering of everything in a 100 foot radius makes it impractical for anything other than single-person infiltrations. The Groundhog is notable for having the most expensive ammunition of any handheld weapon in commission, with each projectile costing as much as a small house. This is partially related to the fact that the projectile's quality assurance process involves using it to destroy a small house."; private const float _BASE_FPS = 20f; internal static GameObject _EarthClod = null; private bool _wasCharging; private bool _setupAnimator; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 14; int? reloadFps = 4; int? chargeFps = 20; Gun gun2 = gun.SetAttributes((ItemQuality)4, (GunClass)60, 0f, 50, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, chargeFps, null, null, null, null, 15, -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, autoPlay: true, attacksThroughWalls: true, suppressReloadLabel: false, 0f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: false, preventRollingWhenCharging: true).SetChargeAudio("groundhog_burrow_sound", 11); int? clipSize = 1; float? cooldown = 0.75f; float? damage = 50f; float? speed = 25f; float? range = 100f; float? force = 30f; gun2.InitSpecialProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)3, (ProjectileSequenceStyle)0, 2f, 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, 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", null, 0f, ignoredForReloadPurposes: false, mirror: false, null, null, null, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: true)); _EarthClod = VFX.Create("groundhog_rock_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } public override void Update() { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) base.Update(); if (!_setupAnimator) { tk2dSpriteAnimator component = ((Component)this).gameObject.GetComponent(); component.AnimationEventTriggered = (Action)Delegate.Combine(component.AnimationEventTriggered, new Action(AnimationEventTriggered)); _setupAnimator = true; } ((GunBehaviour)this).gun.OverrideAngleSnap = ((((GunBehaviour)this).gun.IsCharging || ((GunBehaviour)this).gun.IsReloading) ? new float?(180f) : ((float?)null)); PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null) { if (!((GunBehaviour)this).gun.IsCharging) { playerOwner.forceAimPoint = null; } else if (!_wasCharging) { playerOwner.forceAimPoint = ((GameActor)playerOwner).CenterPosition + new Vector2(((BraveBehaviour)playerOwner).sprite.FlipX ? (-4f) : 4f, 0f); } _wasCharging = ((GunBehaviour)this).gun.IsCharging; } } private void AnimationEventTriggered(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frame) { //IL_005c: 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_0061: 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_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_00a7: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) if (base.Mastered && frame == 11 && Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) && !(clip.name != "groundhog_charge")) { Vector2 val = (((BraveBehaviour)((GunBehaviour)this).gun).sprite.FlipY ? ((BraveBehaviour)((GunBehaviour)this).gun).sprite.WorldTopCenter : ((BraveBehaviour)((GunBehaviour)this).gun).sprite.WorldBottomCenter); Lazy.DoMicroBlankAt(val, ((GunBehaviour)this).PlayerOwner); GameManager.Instance.MainCameraController.DoScreenShake(new ScreenShakeSettings(0.2f, 6f, 0.2f, 0f), (Vector2?)val, false); for (int i = 1; i <= 3; i++) { GameObject earthClod = _EarthClod; int numToSpawn = 10 * i; float positionVariance = i; float? fadeOutTime = 0.25f; float? startScale = 1f; float? endScale = 0.1f; CwaffVFX.SpawnBurst(earthClod, numToSpawn, val, positionVariance, null, 0f, 5f, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.None, 0.25f, fadeOutTime, 0f, null, fadeIn: false, uniform: true, startScale, endScale, null, randomFrame: true); } } } private void UpdateChargeAnimation(PlayerController controller) { if ((Object)(object)controller == (Object)(object)((GunBehaviour)this).PlayerOwner) { GunExt.SetAnimationFPS(((GunBehaviour)this).gun, ((GunBehaviour)this).gun.chargeAnimation, Mathf.RoundToInt(20f * ((GunBehaviour)this).PlayerOwner.ChargeMult())); } } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); CwaffEvents.OnStatsRecalculated = (Action)Delegate.Combine(CwaffEvents.OnStatsRecalculated, new Action(UpdateChargeAnimation)); } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); player.forceAimPoint = null; CwaffEvents.OnStatsRecalculated = (Action)Delegate.Remove(CwaffEvents.OnStatsRecalculated, new Action(UpdateChargeAnimation)); } public override void OnDestroy() { CwaffEvents.OnStatsRecalculated = (Action)Delegate.Remove(CwaffEvents.OnStatsRecalculated, new Action(UpdateChargeAnimation)); base.OnDestroy(); } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((GunBehaviour)this).PlayerOwner.forceAimPoint = null; } } } public class PaintballCannon : CwaffGun { public static string ItemName = "Paintball Cannon"; public static string ShortDescription = "The T is Silent"; public static string LongDescription = "Shoots various colored projectiles that stain enemies and leave colored goop in their wake."; public static string Lore = "Paintball guns are traditionally known for their usage in niche sporting events moreso than their viability in actual combat. A product of executive meddling and rebranding, the paintball cannon is a slightly beefed-up paintball gun with the potential to do at least a passable amount of damage. The increased projectile size has led to the leakage of paint as the gun's projectiles are in transit. Ironically, many Gungeoneers find the resulting paint streaks charming and therapeutic, making this design flaw the gun's primary selling point that sets it apart from otherwise more functional weapons."; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 14; int? reloadFps = 4; Items? muzzleFrom = Items.Mailbox; Gun gun2 = gun.SetAttributes((ItemQuality)2, (GunClass)15, 0.9f, 600, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "paintball_shoot_sound", "paintball_reload_sound", 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).AddToShop((ShopType)0); int? clipSize = 12; float? cooldown = 0.18f; float? damage = 5.5f; float? speed = 25f; float? range = 18f; float? force = 12f; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "paintball_cannon_projectile", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 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")).Attach().Attach((Action)delegate(GoopModifier g) { g.SpawnGoopOnCollision = true; g.CollisionSpawnRadius = 1f; g.SpawnGoopInFlight = true; g.InFlightSpawnRadius = 0.4f; g.InFlightSpawnFrequency = 0.01f; }, allowDuplicates: false) .SetAllImpactVFX(VFX.CreatePool("paint_splatter_vfx", 60f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1)); } public override void PostProcessProjectile(Projectile projectile) { ((GunBehaviour)this).PostProcessProjectile(projectile); PaintballColorizer component = ((Component)projectile).GetComponent(); if (component == null) { return; } if (base.Mastered) { component.mastered = true; } PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null) { PlayerItem active = playerOwner.GetActive(64); ReflectShieldPlayerItem val = (ReflectShieldPlayerItem)(object)((active is ReflectShieldPlayerItem) ? active : null); if (val != null && ((PlayerItem)val).IsCurrentlyActive && playerOwner.HasSynergy(Synergy.LEAD_PAINT)) { component.reflectsProjectiles = true; } } } } public class PaintballColorizer : MonoBehaviour { private enum Goop { CHARM, FIRE, CHEESE, ELECTRIC, POISON, WATER, WEB, ICE } private Color _tint; private Projectile _proj; public bool mastered; public bool reflectsProjectiles; private void Start() { //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_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Expected O, but got Unknown //IL_00e2: 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_00f7: 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_00fe: Unknown result type (might be due to invalid IL or missing references) Projectile val = (_proj = ((Component)this).GetComponent()); int num = Random.Range(0, EasyGoopDefinitions.ColorGoopColors.Count); Goop goop = (Goop)num; _tint = EasyGoopDefinitions.ColorGoopColors[num]; GoopModifier component = ((Component)val).GetComponent(); if (mastered) { component.CollisionSpawnRadius *= 2f; GoopModifier val2 = component; val2.goopDefinition = (GoopDefinition)(goop switch { Goop.CHARM => EasyGoopDefinitions.CharmGoopDef, Goop.FIRE => EasyGoopDefinitions.FireDef, Goop.CHEESE => EasyGoopDefinitions.CheeseDef, Goop.ELECTRIC => EasyGoopDefinitions.WaterGoop, Goop.POISON => EasyGoopDefinitions.PoisonDef, Goop.WATER => EasyGoopDefinitions.WaterGoop, Goop.WEB => EasyGoopDefinitions.WebGoop, Goop.ICE => EasyGoopDefinitions.WaterGoop, _ => throw new NotSupportedException(), }); switch (goop) { case Goop.ELECTRIC: val.damageTypes = (CoreDamageTypes)(val.damageTypes | 0x40); break; case Goop.ICE: val.damageTypes = (CoreDamageTypes)(val.damageTypes | 8); break; } } else { component.goopDefinition = EasyGoopDefinitions.ColorGoops[num]; } if (reflectsProjectiles) { val.collidesWithProjectiles = true; val.collidesOnlyWithPlayerProjectiles = false; val.UpdateCollisionMask(); SpeculativeRigidbody specRigidbody = ((BraveBehaviour)val).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(ReflectProjectiles)); } val.AdjustPlayerProjectileTint(_tint, 1, 0f); val.OnHitEnemy = (Action)Delegate.Combine(val.OnHitEnemy, new Action(OnHitEnemy)); } private void ReflectProjectiles(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { if (!Object.op_Implicit((Object)(object)_proj) || !Object.op_Implicit((Object)(object)otherRigidbody)) { return; } Projectile component = ((Component)otherRigidbody).gameObject.GetComponent(); if (component != null) { PhysicsEngine.SkipCollision = true; if (((Behaviour)component).isActiveAndEnabled && component.Owner is AIActor) { PassiveReflectItem.ReflectBullet(component, true, _proj.Owner, _proj.baseData.speed, 1f, 1f, 0f); } } } private void OnHitEnemy(Projectile bullet, SpeculativeRigidbody enemy, bool killed) { //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_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_0011: 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_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) //IL_0024: 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_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_0054: Expected O, but got Unknown GameActorHealthEffect val = new GameActorHealthEffect { TintColor = _tint, DeathTintColor = _tint, AppliesTint = true, AppliesDeathTint = true, AffectsEnemies = true, DamagePerSecondToEnemies = 0f, duration = 10000000f, effectIdentifier = "Paintballed" }; if (Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).aiActor)) { ((GameActor)((BraveBehaviour)enemy).aiActor).RemoveEffect("Paintballed"); ((GameActor)((BraveBehaviour)enemy).aiActor).ApplyEffect((GameActorEffect)(object)val, 1f, (Projectile)null); } } } public class Widowmaker : CwaffGun { public static string ItemName = "Widowmaker"; public static string ShortDescription = "Itsy Bitsy Turrets"; public static string LongDescription = "Fires pods that deploy spider drones upon colliding with a wall. Drones will crawl along walls and shoot enemies within their range."; public static string Lore = "Much like the black widow is one of the deadliest known spiders on earth, the Widowmaker is one of the deadliest known firearms with spider-based projectiles. The first model of the weapon failed every safety test thrown at it, while the second model ended up permanently dismembering its own creator. The penultimate model had ironed out all issues besides a slight gunpowder leak and the drones becoming sentient and conspiring against humanity, but fortunately, these were fixed in the fourteenth and final model."; private const float _SCALE = 0.75f; internal static GameObject _WidowmakerPrefab = null; internal static Projectile _WidowTurretProjectile = null; internal static Projectile _WidowTurretLaser = null; public static void Init() { //IL_047d: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 20; int? reloadFps = 12; Gun gun2 = gun.SetAttributes((ItemQuality)3, (GunClass)15, 1.4f, 160, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "widowmaker_fire_sound", 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, autoPlay: true, attacksThroughWalls: false, suppressReloadLabel: false, 1f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: false, preventRollingWhenCharging: false, 1f, 0.1f).SetReloadAudio("widowmaker_reload_sound", 0, 4, 8, 10, 12, 14); int? clipSize = 5; float? cooldown = 0.18f; float? damage = 3.5f; bool? pierceBreakables = true; bool? preventOrbiting = true; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "widowmaker_projectile", 12, (Anchor)3, 0.75f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, preventOrbiting, null, null, null, null, 0f, ignoredForReloadPurposes: false, mirror: false, null, null, null, pierceBreakables)).Attach(); _WidowmakerPrefab = VFX.Create("spider_turret", 16f, loops: true, -1, 0.75f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 0f); _WidowmakerPrefab.AddAnimation("deploy", "widowmaker_deploy_vfx", 12f, loops: false, -1, (Anchor)4, 0f); _WidowmakerPrefab.AddAnimation("crawl", "widowmaker_crawl_vfx", 12f, loops: true, -1, (Anchor)4, 0f); tk2dSpriteAnimationClip[] clips = _WidowmakerPrefab.GetComponent().clips; for (int i = 0; i < clips.Length; i++) { clips[i].OffsetAllFrames(new Vector2(-0.25f, 0f)); } _WidowmakerPrefab.AutoRigidBody((CollisionLayer)4); _WidowmakerPrefab.AddComponent(); damage = 10f; float? speed = 50f; float? force = 10f; float? range = 80f; preventOrbiting = true; _WidowTurretProjectile = 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, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, "widowmaker_turret_shoot_sound", null, preventOrbiting)).Attach((Action)delegate(EasyTrailBullet trail) { //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_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_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_0052: Unknown result type (might be due to invalid IL or missing references) trail.TrailPos = ((BraveBehaviour)trail).transform.position; trail.StartWidth = 0.3f; trail.EndWidth = 0.05f; trail.LifeTime = 0.07f; trail.BaseColor = ExtendedColours.paleYellow; trail.EndColor = Color.Lerp(ExtendedColours.paleYellow, Color.white, 0.25f); }, allowDuplicates: false); range = 0f; force = 200f; speed = 12f; preventOrbiting = true; pierceBreakables = true; _WidowTurretLaser = Items.Ak47.CloneProjectile(GunData.New(null, null, null, null, range, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, speed, force, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "widowmaker_laser_projectile", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, preventOrbiting, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, "widowmaker_laser_sound", null, null, null, null, null, null, null, null, null, null, null, null, 0f, ignoredForReloadPurposes: false, mirror: false, null, null, null, pierceBreakables)); } } public class WidowmakerProjectile : MonoBehaviour { private const float _MIN_TRAVEL_TIME = 0.02f; private Projectile _projectile; private PlayerController _owner; private float _startTime; private void Start() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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); SpeculativeRigidbody component = ((Component)this).GetComponent(); _startTime = BraveTime.ScaledTimeSinceStartup; component.OnTileCollision = (OnTileCollisionDelegate)Delegate.Combine((Delegate?)(object)component.OnTileCollision, (Delegate?)new OnTileCollisionDelegate(OnTileCollision)); } private void OnTileCollision(CollisionData tileCollision) { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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) if (!(BraveTime.ScaledTimeSinceStartup - _startTime < 0.02f)) { Object.Instantiate(Widowmaker._WidowmakerPrefab, Vector2.op_Implicit(dfVectorExtensions.Quantize(((CastResult)tileCollision).Contact, 0.0625f)), Quaternion.identity).GetComponent().Setup(_owner, ((CastResult)tileCollision).Normal, ((BraveBehaviour)_projectile).specRigidbody.Velocity, _projectile.baseData.damage); _projectile.DieInAir(false, true, true, false); } } } public class Crawlyboi : MonoBehaviour { private const float _CRAWL_SPEED = 10f; private const float _SHOOT_TIMER = 0.4f; private const float _SHOOT_TIMER_MASTERED = 0.25f; private const float _SOUND_TIMER = 0.18f; private const float _EXPIRE_TIMER = 8f; private const float _SIGHT_CONE = 90f; private const float _SIGHT_DIST = 12f; private const float _STUCK_TIME = 0.15f; private SpeculativeRigidbody _body; private tk2dSprite _sprite; private Vector2 _velocity; private Vector2 _wallNormal; private bool _deployed; private float _shootTimer; private float _soundTimer; private float _expireTimer; private PlayerController _owner; private float _rotateDir; private float _damage; private bool _oddStep; private Vector3 _lastPosition; private float _stuckTime; private bool _mastered; private float _shootRate; public void Setup(PlayerController owner, Vector2 wallNormal, Vector2 projVelocity, float damage) { //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_000b: 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) //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) //IL_0089: 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_00bb: 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_0108: 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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Expected O, but got Unknown //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Expected O, but got Unknown //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Expected O, but got Unknown //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Expected O, but got Unknown bool flag = Vector2Extensions.ToAngle(-wallNormal).RelAngleTo(Vector2Extensions.ToAngle(projVelocity)) > 0f; _rotateDir = (flag ? (-90f) : 90f); _owner = owner; _mastered = Object.op_Implicit((Object)(object)owner) && owner.HasSynergy(Synergy.MASTERY_WIDOWMAKER); _damage = damage; _shootRate = (_mastered ? 0.25f : 0.4f); _wallNormal = wallNormal; _velocity = wallNormal.Rotate(_rotateDir); _sprite = ((Component)this).GetComponent(); ((tk2dBaseSprite)_sprite).HeightOffGround = 3f; ((BraveBehaviour)_sprite).transform.rotation = _wallNormal.EulerZ(); ((tk2dBaseSprite)_sprite).UpdateZDepth(); _body = ((Component)this).GetComponent(); ((BraveBehaviour)_body).transform.position = ((Component)this).transform.position; _body.Reinitialize(); _body.PullOutOfWall(Vector2Extensions.ToIntVector2(wallNormal, (VectorConversions)2)); SpeculativeRigidbody body = _body; body.OnTileCollision = (OnTileCollisionDelegate)Delegate.Combine((Delegate?)(object)body.OnTileCollision, (Delegate?)new OnTileCollisionDelegate(OnTileCollision)); SpeculativeRigidbody body2 = _body; body2.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)body2.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreRigidbodyCollision)); SpeculativeRigidbody body3 = _body; body3.OnRigidbodyCollision = (OnRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)body3.OnRigidbodyCollision, (Delegate?)new OnRigidbodyCollisionDelegate(OnRigidbodyCollision)); SpeculativeRigidbody body4 = _body; body4.OnPostRigidbodyMovement = (Action)Delegate.Combine(body4.OnPostRigidbodyMovement, new Action(OnPostRigidbodyMovement)); } private void Start() { ((Component)this).GetComponent().Play("deploy"); ((Component)this).gameObject.Play("widowmaker_deploy_sound_alt"); } private void Update() { //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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_0069: 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_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: 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) //IL_0184: 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_01c5: 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_01cc: 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_01d2: 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) if (BraveTime.DeltaTime == 0f) { return; } ((BraveBehaviour)_sprite).transform.rotation = _wallNormal.EulerZ(); if (!_deployed) { if (((Component)this).GetComponent().IsPlaying("deploy")) { return; } ((Component)this).GetComponent().Play("crawl"); _body.Velocity = 10f * _velocity; _deployed = true; } if (((Component)this).transform.position == _lastPosition) { if ((_stuckTime += BraveTime.DeltaTime) >= 0.15f) { Explode(); return; } } else { _stuckTime = 0f; _lastPosition = ((Component)this).transform.position; } if ((_expireTimer += BraveTime.DeltaTime) >= 8f) { Explode(); return; } if ((_soundTimer += BraveTime.DeltaTime) > 0.18f) { _soundTimer = 0f; ((Component)this).gameObject.PlayUnique(_oddStep ? "widowmaker_turret_crawl_sound_2" : "widowmaker_turret_crawl_sound"); _oddStep = !_oddStep; } if ((_shootTimer += BraveTime.DeltaTime) < _shootRate) { return; } Vector2 val = Vector3Extensions.XY(((Component)this).transform.position) + _wallNormal; AIActor val2 = val.NearestEnemyWithinConeOfVision(Vector2Extensions.ToAngle(_wallNormal), 90f, 12f); if (Object.op_Implicit((Object)(object)val2)) { Projectile component = SpawnManager.SpawnProjectile(((Component)(_mastered ? Widowmaker._WidowTurretLaser : Widowmaker._WidowTurretProjectile)).gameObject, Vector2.op_Implicit(val), (((GameActor)val2).CenterPosition - val).EulerZ(), true).GetComponent(); component.baseData.damage = _damage; component.SetOwnerAndStats((GameActor)(object)_owner); _owner.DoPostProcessProjectile(component); if (_mastered) { ((Component)((BraveBehaviour)(object)component).AddTrail(OmnidirectionalLaser._OmniTrailMasteredPrefab)).gameObject.SetGlowiness(10f); } _shootTimer = 0f; } } private void Explode() { //IL_0006: 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) Exploder.Explode(((Component)this).transform.position, Scotsman._ScotsmanExplosion, Vector2.zero, (Action)null, true, (CoreDamageTypes)0, false); Object.Destroy((Object)(object)((Component)this).gameObject); } private void OnPreRigidbodyCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { //IL_0054: 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) if (!Object.op_Implicit((Object)(object)((BraveBehaviour)otherRigidbody).transform.parent) || ((Component)((BraveBehaviour)otherRigidbody).transform.parent).GetComponent() == null) { PhysicsEngine.SkipCollision = true; if (otherRigidbody.IsActuallyOubiletteEntranceRoom() || Object.op_Implicit((Object)(object)((Component)otherRigidbody).GetComponent()) || Object.op_Implicit((Object)(object)((Component)otherRigidbody).GetComponent()) || !_body.IsAgainstWall(-Vector2Extensions.ToIntVector2(_wallNormal, (VectorConversions)2))) { Explode(); } } } private void OnRigidbodyCollision(CollisionData rigidbodyCollision) { //IL_0007: 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_0012: 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_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) //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) if (!_body.IsAgainstWall(-Vector2Extensions.ToIntVector2(_wallNormal, (VectorConversions)2))) { Explode(); return; } _velocity = -_velocity; PhysicsEngine.PostSliceVelocity = 10f * _velocity; } private void OnTileCollision(CollisionData tileCollision) { //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_0013: 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_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) _velocity = ((Vector2)(ref _wallNormal)).normalized; _wallNormal = ((CastResult)tileCollision).Normal; PhysicsEngine.PostSliceVelocity = 10f * _velocity; } private void OnPostRigidbodyMovement(SpeculativeRigidbody specRigidbody, Vector2 unitDelta, IntVector2 pixelDelta) { //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) //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) //IL_0039: 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_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_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_0081: 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_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_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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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) if (_deployed && !_body.IsAgainstWall(-Vector2Extensions.ToIntVector2(_wallNormal, (VectorConversions)2))) { Vector2 val = -((Vector2)(ref _wallNormal)).normalized; Transform transform = ((BraveBehaviour)_body).transform; transform.position += Vector2Extensions.ToVector3ZUp(0.0625f * val, 0f); _body.Reinitialize(); _body.PushAgainstWalls(-Vector2Extensions.ToIntVector2(((Vector2)(ref _velocity)).normalized, (VectorConversions)2)); _wallNormal = ((Vector2)(ref _velocity)).normalized; _velocity = val; _body.Velocity = 10f * _velocity; } } } public class HatchlingGun : CwaffGun { public static string ItemName = "Hatchling Gun"; public static string ShortDescription = "Yolked In"; public static string LongDescription = "Fires eggs which spawn chicks on impact. Chicks randomly wander the room, blocking enemies and their projectiles until taking damage."; public static string Lore = "The age-old question \"which came first, the chicken or the egg?\" is mostly of academic interest. Questions of more practical interest to gunsmiths include \"what is the fastest an egg can be fired out of a gun without it breaking in transit?\" and \"how much damage can a singular egg inflict on the Gundead?\" The answers to these questions turn out to be \"not very fast\" and \"not very much,\" respectively. As such, most gunsmiths have no interest in forging guns that fire eggs as projectiles, and the Hatchling Gun's existence can be largely attributed to an excessive supply of eggs moreso than an excessive demand of egg-shooting firearms."; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 40; int? reloadFps = 20; Items? muzzleFrom = Items.Mailbox; Gun gun2 = gun.SetAttributes((ItemQuality)1, (GunClass)15, 1.25f, 500, Items.Banana, defaultAudio: false, infiniteAmmo: false, 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("hatchling_gun_bounce_sound", 0, 6, 14); int? clipSize = 12; float? cooldown = 0.2f; float? angleVariance = 15f; float? damage = 3f; float? speed = 24f; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "egg", 12, (Anchor)4, 1.5f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, "hatchling_gun_shoot_sound")).SetAllImpactVFX(VFX.CreatePool("egg_break", 16f, loops: false, -1, 0.75f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1)).Attach(); } } public class HatchlingProjectile : MonoBehaviour { private const float _HATCH_CHANCE = 1f; private const float _PATH_INTERVAL = 10f; private const float _COLLISION_DAMAGE = 10f; private Projectile _projectile; private PlayerController _owner; private GameObject _hatchling; private void Start() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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)) { _projectile.OnDestruction += Hatch; SpeculativeRigidbody component = ((Component)_projectile).GetComponent(); component.OnRigidbodyCollision = (OnRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)component.OnRigidbodyCollision, (Delegate?)new OnRigidbodyCollisionDelegate(OnRigidbodyCollision)); } } private void OnRigidbodyCollision(CollisionData obj) { if (Object.op_Implicit((Object)(object)_hatchling) && Object.op_Implicit((Object)(object)obj.OtherRigidbody) && ((Component)obj.OtherRigidbody).GetComponent() != null) { _hatchling.GetComponent().RegisterTemporaryCollisionException(obj.OtherRigidbody, 0.5f, (float?)null); } } private void Hatch(Projectile p) { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: 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_0190: 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_01a3: Expected O, but got Unknown //IL_024c: Unknown result type (might be due to invalid IL or missing references) if (!(Random.value > 1f)) { CompanionController orAddComponent = GameObjectExtensions.GetOrAddComponent(_hatchling = ((Component)AIActor.Spawn(EnemyDatabase.GetOrLoadByGuid("7bd9c670f35b4b8d84280f52a5cc47f6"), Vector2.op_Implicit(p.LastPosition), Vector3Extensions.GetAbsoluteRoom(((BraveBehaviour)p).transform.position), true, (AwakenAnimationType)0, true)).gameObject); bool flag = _owner.HasSynergy(Synergy.MASTERY_HATCHLING_GUN); orAddComponent.m_owner = _owner; ((BraveBehaviour)orAddComponent).aiActor.ForceBlackPhantom = flag; ((BraveBehaviour)orAddComponent).aiActor.CollisionDamage = (flag ? 10f : 0f); ((BraveBehaviour)orAddComponent).aiActor.IsHarmlessEnemy = true; ((BraveBehaviour)orAddComponent).aiActor.IsWorthShootingAt = false; ((BraveBehaviour)orAddComponent).aiActor.IsNormalEnemy = false; ((BraveBehaviour)orAddComponent).aiActor.CompanionOwner = _owner; ((BraveBehaviour)orAddComponent).aiActor.CanTargetPlayers = false; ((BraveBehaviour)orAddComponent).aiActor.CanTargetEnemies = true; ((BraveBehaviour)orAddComponent).aiActor.State = (ActorState)2; ((BraveBehaviour)orAddComponent).aiActor.ParentRoom = Vector3Extensions.GetAbsoluteRoom(((BraveBehaviour)p).transform.position); SpeculativeRigidbody component = ((Component)orAddComponent).GetComponent(); if (component != null) { component.AddCollisionLayerIgnoreOverride(CollisionMask.LayerToMask((CollisionLayer)0, (CollisionLayer)1)); PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(component, (int?)null, false); } BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)orAddComponent).behaviorSpeculator; if (behaviorSpeculator != null) { behaviorSpeculator.m_aiActor = ((BraveBehaviour)orAddComponent).aiActor; ((BaseBehavior)(object)behaviorSpeculator)._serializedStateKeys.Clear(); ((BaseBehavior)(object)behaviorSpeculator)._serializedStateValues.Clear(); behaviorSpeculator.TargetBehaviors.Clear(); behaviorSpeculator.MovementBehaviors.Clear(); behaviorSpeculator.MovementBehaviors.Add((MovementBehaviorBase)new MoveErraticallyBehavior { PathInterval = 10f, StayOnScreen = false, UseTargetsRoom = false, AvoidTarget = false }); behaviorSpeculator.FullyRefreshBehaviors(); } ((BraveBehaviour)orAddComponent).transform.localScale = new Vector3(0.5f, 0.5f, 1f); ((BraveBehaviour)((BraveBehaviour)orAddComponent).sprite).transform.localScale = new Vector3(0.5f, 0.5f, 1f); ((BraveBehaviour)orAddComponent).aiActor.procedurallyOutlined = false; ((GameActor)((BraveBehaviour)orAddComponent).aiActor).HasShadow = false; ((BraveBehaviour)orAddComponent).sprite.usesOverrideMaterial = true; if (!flag) { ((BraveBehaviour)((BraveBehaviour)orAddComponent).sprite).renderer.material.shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTintableTiltedCutoutEmissive"); ((GameActor)((BraveBehaviour)orAddComponent).aiActor).RegisterOverrideColor(new Color(1f, 1f, 0f, 0.5f), "little chicky"); } else { ((BraveBehaviour)((BraveBehaviour)orAddComponent).sprite).renderer.material.shader = ShaderCache.Acquire("Brave/LitCutoutUberPhantom"); } ((Component)orAddComponent).gameObject.AddComponent().Setup(_owner); } } } public class HatchlingBehavior : MonoBehaviour { private const float _CHECK_INTERVAL = 1f; private RoomHandler _startRoom; private PlayerController _owner; private AIActor _actor; private float _lastCheck; private void Start() { //IL_000c: 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_0059: Expected O, but got Unknown _startRoom = Vector3Extensions.GetAbsoluteRoom(((Component)this).gameObject.transform.position); _actor = ((Component)this).gameObject.GetComponent(); ((Component)this).gameObject.Play("bird_chirp"); ((Component)this).GetComponent().OnDamaged += new OnDamagedEvent(OnDamaged); SpeculativeRigidbody component = ((Component)this).GetComponent(); component.OnCollision = (Action)Delegate.Combine(component.OnCollision, new Action(OnCollision)); } private void OnCollision(CollisionData obj) { if (Object.op_Implicit((Object)(object)obj.OtherRigidbody) && ((Component)obj.OtherRigidbody).GetComponent() != null) { ((Component)this).gameObject.Play("bird_chirp"); Object.Destroy((Object)(object)((Component)this).gameObject); } } private void OnDamaged(float resultValue, float maxValue, CoreDamageTypes damageTypes, DamageCategory damageCategory, Vector2 damageDirection) { ((Component)this).gameObject.Play("bird_chirp"); Object.Destroy((Object)(object)((Component)this).gameObject); } public void Setup(PlayerController pc) { _owner = pc; } private void Update() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!((_lastCheck += BraveTime.DeltaTime) < 1f)) { _lastCheck = 0f; if (_owner.CurrentRoom != _startRoom && !_actor.Position.OnScreen()) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } } public class Bouncer : CwaffGun { public static string ItemName = "Bouncer"; public static string ShortDescription = "Rebound to Go Wrong"; public static string LongDescription = "Fires slow but rapidly accelerating projectiles that phase through enemies and objects until bouncing. Each projectile's damage scales with its bounce speed. Projectiles bounce up to 3 times and create a small explosion upon their final impact."; public static string Lore = "Originally developed as a proof-of-concept back in a time before true bouncing bullets existed, many Gungeoneers today still prefer this older design for flexing their \"mad trickshotting skillz yo\" and its ability to hit enemies behind cover."; internal static ExplosionData _MiniExplosion = null; internal const float _DAMAGE_FACTOR = 0.3f; internal const float _FORCE_FACTOR = 0.5f; internal const float _ACCELERATION = 1.9f; public static void Init() { //IL_0167: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 14; int? reloadFps = 30; Items? muzzleFrom = Items.Magnum; Gun gun2 = gun.SetAttributes((ItemQuality)1, (GunClass)1, 1.3f, 300, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "MC_RocsCape", 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("bouncer_reload_short", 5, 10, 15, 20).SetReloadAudio("bouncer_reload", 25) .AddToShop(ModdedShopType.Boomhildr) .AddToShop(ModdedShopType.Rusty); int? clipSize = 6; float? cooldown = 0.16f; float? damage = 1.9f; float? speed = 1.9f; float? range = 9999f; IntVector2? overrideColliderPixelSizes = new IntVector2(1, 1); gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)0, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "energy_bounce", 10, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, overrideColliderPixelSizes)).Attach((Action)delegate(BounceProjModifier bounce) { bounce.numberOfBounces = 3; bounce.chanceToDieOnBounce = 0f; bounce.onlyBounceOffTiles = true; }, allowDuplicates: false).Attach(); _MiniExplosion = Explosions.DefaultSmall.With(30f, 10f, 5f, 0.5f, preventPlayerForce: true, shake: false); } } public class HarmlessUntilBounce : MonoBehaviour { private const float _MIN_SOUND_GAP = 0.25f; private const float _MASTERED_HOMING_SPREAD = 60f; private const float _HOMING_SPREAD = 20f; private const float _BOUNCE_TIME = 0.1f; private static float _LastBouncePlayed; private Projectile _projectile; private PlayerController _owner; private bool _bounceStarted; private bool _bounceFinished; private int _currentBounces; private int _maxBounces; private float _damageMult = 1f; private bool _mastered; private void Start() { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown _projectile = ((Component)this).GetComponent(); GameActor owner = _projectile.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null) { _owner = val; _damageMult = _owner.DamageMult(); BounceProjModifier component = ((Component)this).gameObject.GetComponent(); _maxBounces = component.numberOfBounces; component.OnBounce += OnBounce; _mastered = _projectile.Mastered(); if (_mastered) { PierceProjModifier orAddComponent = GameObjectExtensions.GetOrAddComponent(((Component)_projectile).gameObject); orAddComponent.penetration = 99; orAddComponent.penetratesBreakables = true; } SpeculativeRigidbody specRigidbody = ((BraveBehaviour)_projectile).specRigidbody; specRigidbody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreCollision)); _projectile.OnDestruction += OnDestruction; } } private void Update() { if (!_bounceStarted) { _projectile.Accelerate(114f); } } private void OnDestruction(Projectile p) { //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_0011: Unknown result type (might be due to invalid IL or missing references) Exploder.Explode(Vector2.op_Implicit(p.SafeCenter), Bouncer._MiniExplosion, p.Direction, (Action)null, false, (CoreDamageTypes)0, false); } private void OnPreCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { if (_mastered && Object.op_Implicit((Object)(object)_projectile)) { _projectile.ResetPiercing(); } if (!_bounceFinished) { if (!otherRigidbody.PrimaryPixelCollider.IsTileCollider) { PhysicsEngine.SkipCollision = true; } else if (Object.op_Implicit((Object)(object)((Component)otherRigidbody).GetComponent())) { PhysicsEngine.SkipCollision = true; } else if (Object.op_Implicit((Object)(object)((Component)otherRigidbody).GetComponent())) { PhysicsEngine.SkipCollision = true; } } } private void HandleBounceSounds() { float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; if (!(scaledTimeSinceStartup - _LastBouncePlayed < 0.25f)) { _LastBouncePlayed = scaledTimeSinceStartup; ((Component)_projectile).gameObject.Play("MC_RocsCape"); ((Component)_projectile).gameObject.Play("MC_Mushroom_Bounce"); } } private void OnBounce() { _currentBounces++; _projectile.m_usesNormalMoveRegardless = true; _bounceStarted = true; ((MonoBehaviour)_projectile).StartCoroutine(DoElasticBounce()); } private IEnumerator DoElasticBounce() { float oldSpeed = _projectile.baseData.speed; Vector3 oldScale = ((BraveBehaviour)((BraveBehaviour)_projectile).spriteAnimator).transform.localScale; ((BraveBehaviour)_projectile).specRigidbody.CollideWithTileMap = false; ((BraveBehaviour)_projectile).specRigidbody.CollideWithOthers = false; _projectile.baseData.damage = _damageMult * oldSpeed * 0.3f; _projectile.baseData.force = oldSpeed * 0.5f; _projectile.SetSpeed(0.001f); ((BraveBehaviour)_projectile).specRigidbody.Reinitialize(); for (float elapsed = 0f; elapsed < 0.1f; elapsed += BraveTime.DeltaTime) { float num = elapsed / 0.1f; ((BraveBehaviour)((BraveBehaviour)_projectile).spriteAnimator).transform.localScale = Vector3Extensions.WithX(oldScale, Mathf.Max(0.1f, 1f - num)); yield return null; } HandleBounceSounds(); ((BraveBehaviour)_projectile).sprite.SetGlowiness(0f, Color.yellow, Color.yellow); Material m = ((BraveBehaviour)((BraveBehaviour)_projectile).sprite).renderer.material; for (float elapsed = 0f; elapsed < 0.1f; elapsed += BraveTime.DeltaTime) { float num2 = elapsed / 0.1f; Color val = Color.Lerp(Color.white, Color.yellow, 0.8f * num2); m.SetFloat(CwaffVFX._EmissivePowerId, 100f * num2); m.SetColor(CwaffVFX._EmissiveColorId, val); m.SetColor(CwaffVFX._OverrideColorId, val); ((BraveBehaviour)((BraveBehaviour)_projectile).spriteAnimator).transform.localScale = Vector3Extensions.WithX(oldScale, Mathf.Max(0.1f, num2)); yield return null; } ((BraveBehaviour)((BraveBehaviour)_projectile).spriteAnimator).transform.localScale = oldScale; _projectile.SetSpeed(oldSpeed); AIActor val2 = _projectile.SafeCenter.NearestEnemyWithinConeOfVision(Vector2Extensions.ToAngle(_projectile.Direction), _mastered ? 60f : 20f); if (val2 != null && Lazy.DeterminePerfectAngleToShootAt(_projectile.SafeCenter, ((GameActor)val2).CenterPosition, (Vector2)(Object.op_Implicit((Object)(object)((BraveBehaviour)val2).specRigidbody) ? ((BraveBehaviour)val2).specRigidbody.Velocity : default(Vector2)), oldSpeed, out var shootAngle, out var _, adjustForTurboMode: false)) { _projectile.SendInDirection(shootAngle.ToVector(), true, true); } ((BraveBehaviour)_projectile).specRigidbody.Reinitialize(); _bounceFinished = true; ((BraveBehaviour)_projectile).specRigidbody.CollideWithTileMap = true; ((BraveBehaviour)_projectile).specRigidbody.CollideWithOthers = true; _projectile.m_usesNormalMoveRegardless = false; } } public class Alligator : CwaffGun { private class AlligatorAmmoDisplay : CustomAmmoDisplay { private Gun _gun; private Alligator _alligator; private PlayerController _owner; private void Start() { _gun = ((Component)this).GetComponent(); _alligator = ((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; } string text = Mathf.RoundToInt(10f * _alligator.energyProduction).ToString(); uic.GunAmmoCountLabel.Text = "[color #00ffff]" + text + "[/color][sprite \"charge_ui\"]\n" + CustomAmmoDisplayExtensions.VanillaAmmoDisplay(_owner); return true; } } public static string ItemName = "Alligator"; public static string ShortDescription = "Shockingly Effective"; public static string LongDescription = "Fires clips that clamp onto enemies and channel electricity from the player. Each clip's energy output is proportional to the player's damage stat, and increases further while rolling, walking over carpet, or standing in electrified goop. Up to 8 clips can be attached to each enemy. Passively grants electric immunity."; public static string Lore = "Most of the Gundead are either made of metal or carrying metal weaponry on them, making them rather hilariously susceptible to contact with live wires. Thanks to some fancy electrical engineering far beyond your comprehension, the Alligator allows you to channel the ambient static electricity you passively collect directly into the bodies of anything you can clip onto. Outside the Gungeon, it also doubles as an extremely handy tool for do-it-yourself home wiring projects."; private const float _ELECTRIFIED_ENERGY_BONUS = 4f; private const float _ROLLING_ENERGY_BONUS = 3f; private const float _CARPET_ENERGY_BONUS = 1.5f; private const float _ELECTRIC_SLIDE_ENERGY_BONUS = 3f; private const float _ELECTRIC_DECAY_FACTOR = 1f; private const float _ENERGY_MULT = 10f; internal static GameObject _SparkVFX = null; internal static GameObject _ClipVFX = null; internal static readonly Color _RedClipColor = Color.Lerp(Color.red, Color.magenta, 0.25f); internal static readonly Color _BlackClipColor = Color.Lerp(Color.black, Color.blue, 0.25f); public float energyProduction; internal HashSet _cables = new HashSet(); private DamageTypeModifier _electricImmunity; private bool _ownerElectrified; private float _lastElectrifyCheck; private Material _mat; public static void Init() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 20; int? reloadFps = 16; Color? muzzleEmissionColor = new Color(0.85f, 0.85f, 0.9f); Gun gun2 = gun.SetAttributes((ItemQuality)2, (GunClass)60, 2f, 300, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "alligator_shoot_sound", "alligator_reload_sound", null, -1, -1, -1, null, modulesAreTiers: false, "muzzle_alligator", 60, 0.5f, (Anchor)4, 5f, muzzleEmissionColor, 10f, muzzleLit: false, 0f, 0f, null, null, preventRotation: false, 0f, continuousFire: false, dynamicBarrelOffsets: true, banFromBlessedRuns: false, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0, autoPlay: true, attacksThroughWalls: false, suppressReloadLabel: false, 1f, onlyUsesIdleInWeaponBox: false, continuousFireAnimation: false, preventRollingWhenCharging: false, 1f, -1f, canAttackWhileRolling: false, isStarterGun: false, 1f, preventDuctTape: false, 0.75f).AddDualWieldSynergy(Synergy.CABLE_MANAGEMENT).Attach((Action)null, allowDuplicates: false); int? clipSize = 8; float? cooldown = 0.4f; float? angleVariance = 15f; float? damage = 1f; float? speed = 50f; bool? electric = true; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "alligator_projectile", 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 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, electric)).Attach(); _SparkVFX = VFX.Create("spark_vfx", 16f, loops: true, -1, 0.35f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 50f); _ClipVFX = VFX.Create("alligator_clamped_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } public override void OnPlayerPickup(PlayerController player) { //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_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_0026: Expected O, but got Unknown if (_electricImmunity == null) { _electricImmunity = new DamageTypeModifier { damageType = (CoreDamageTypes)64, damageMultiplier = 0f }; } base.OnPlayerPickup(player); AdjustGunShader(on: true); ((BraveBehaviour)player).healthHaver.damageTypeModifiers.AddUnique(_electricImmunity); } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); AdjustGunShader(on: false); ((BraveBehaviour)player).healthHaver.damageTypeModifiers.Remove(_electricImmunity); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((BraveBehaviour)((GunBehaviour)this).PlayerOwner).healthHaver.damageTypeModifiers.Remove(_electricImmunity); } base.OnDestroy(); } public void AdjustGunShader(bool on) { Material val = (_mat = ((BraveBehaviour)((BraveBehaviour)((GunBehaviour)this).gun).sprite).renderer.material); if (!on) { ((BraveBehaviour)((GunBehaviour)this).gun).sprite.usesOverrideMaterial = false; val.shader = ShaderCache.Acquire("Brave/PlayerShader"); return; } ((BraveBehaviour)((GunBehaviour)this).gun).sprite.usesOverrideMaterial = true; val.shader = CwaffShaders.ElectricShader; val.SetTexture("_ShaderTex", (Texture)(object)CwaffShaders.NoiseTexture); val.SetFloat("_Strength", 6f); val.SetFloat(CwaffVFX._EmissivePowerId, 400f); } public override void OwnedUpdate(GameActor owner, GunInventory inventory) { ((GunBehaviour)this).OwnedUpdate(owner, inventory); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { CheckIfOwnerIsElectrified(); CalculateEnergyProduction(); } } public override void Update() { base.Update(); if (Object.op_Implicit((Object)(object)_mat)) { float num = Mathf.Max(2f, 6f - Mathf.Log(Mathf.Max(10f * (energyProduction - 1f), 1f), 4f)); _mat.SetFloat("_Strength", num); } } private void CalculateEnergyProduction() { //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_007d: Invalid comparison between Unknown and I4 float num = 1f; _ = BraveTime.ScaledTimeSinceStartup; num *= ((GunBehaviour)this).PlayerOwner.DamageMult(); if (((GunBehaviour)this).PlayerOwner.IsDodgeRolling) { num *= 3f; } if (_ownerElectrified) { num *= 4f; } else if (((Vector2)(ref ((BraveBehaviour)((GunBehaviour)this).PlayerOwner).specRigidbody.Velocity)).sqrMagnitude > 0.1f && (int)GameManager.Instance.Dungeon.GetFloorTypeFromPosition(((BraveBehaviour)((GunBehaviour)this).PlayerOwner).specRigidbody.UnitBottomCenter) == 2) { num *= 1.5f; if (((GunBehaviour)this).PlayerOwner.HasSynergy(Synergy.ELECTRIC_SLIDE)) { num *= 3f; } } if (num >= energyProduction) { energyProduction = num; return; } float num2 = 1f; if (base.Mastered) { num2 *= 0.1f; } energyProduction = Mathf.Max(num, Lazy.SmoothestLerp(energyProduction, 0f, num2)); } private void CheckIfOwnerIsElectrified() { //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_0040: 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) float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; if (scaledTimeSinceStartup - _lastElectrifyCheck < 0.1f) { return; } _lastElectrifyCheck = scaledTimeSinceStartup; _ownerElectrified = false; RoomHandler currentRoom = ((GunBehaviour)this).PlayerOwner.CurrentRoom; Vector2 position = Vector2.op_Implicit(((GunBehaviour)this).PlayerOwner.SpriteBottomCenter); if (currentRoom == null || currentRoom.RoomGoops == null) { return; } foreach (DeadlyDeadlyGoopManager roomGoop in currentRoom.RoomGoops) { if (roomGoop.IsPositionElectrified(position)) { _ownerElectrified = true; break; } } } } public class AlligatorProjectile : MonoBehaviour { private void Start() { //IL_0056: 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_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) Projectile component = ((Component)this).gameObject.GetComponent(); component.OnHitEnemy = (Action)Delegate.Combine(component.OnHitEnemy, new Action(HandleHitEnemy)); AlligatorCableHandler alligatorCableHandler = ((Component)this).gameObject.AddComponent(); GameActor owner = component.Owner; alligatorCableHandler.Initialize((PlayerController)(object)((owner is PlayerController) ? owner : null), null, ((BraveBehaviour)component).transform, ((BraveBehaviour)component).specRigidbody.HitboxPixelCollider.UnitCenter - Vector3Extensions.XY(((BraveBehaviour)component).transform.position)); } private void HandleHitEnemy(Projectile projectile, SpeculativeRigidbody body, bool _) { //IL_0027: 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_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) AIActor aiActor = ((BraveBehaviour)body).aiActor; if (aiActor != null && ((BraveBehaviour)body).healthHaver != null && aiActor.IsHostile(canBeDead: false, canBeNeutral: true) && !AlligatorCableHandler.MaxClipsAttachedToEnemy(aiActor)) { AlligatorCableHandler alligatorCableHandler = new GameObject().AddComponent(); GameActor owner = projectile.Owner; alligatorCableHandler.Initialize((PlayerController)(object)((owner is PlayerController) ? owner : null), aiActor, ((BraveBehaviour)aiActor).transform, ((GameActor)aiActor).CenterPosition - Vector3Extensions.XY(((BraveBehaviour)aiActor).transform.position)); } } } public class AlligatorCableHandler : MonoBehaviour { private const int _SEGMENTS = 10; private const float _SPARK_TRAVEL_TIME = 0.3f; private const float _MIN_DROP_SPEED = 5f; private const float _MAX_DROP_SPEED = 20f; private const float _DROP_FRICTION = 0.9f; private const float _SPARK_DAMAGE = 2f; private MeshFilter _stringFilter; private Transform _startTransform; private Transform _endTransform; private Mesh _mesh; private Vector3[] _vertices; private PlayerController _owner; private AIActor _enemy; private int _ownerId = -1; private bool _targetingEnemy; private GameObject _clippyboi; private Vector2 _ownerOffset = Vector2.zero; private Vector2 _endTransformOffset = Vector2.zero; private float _energyProduced; private Alligator _alligator; private bool _fallen; private bool _settled; private Vector3 _dropVelocity = Vector3.zero; private Vector3 _dropOffsetVector = Vector3.zero; private Vector3 _lastGoodEndPos = Vector3.zero; private static readonly Dictionary _ClipCounter = new Dictionary(); internal List _extantSparks = new List(); internal List _extantSpawnTimes = new List(); public void Initialize(PlayerController owner, AIActor target, Transform clipTransform, Vector2 clipTransformOffset) { //IL_0009: 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_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) //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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Expected O, but got Unknown //IL_0160: 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) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_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_01f9: 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_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: 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_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_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) _owner = owner; _ownerOffset = ((GameActor)owner).CenterPosition - Vector3Extensions.XY(((BraveBehaviour)owner).transform.position); _ownerId = owner.PlayerIDX; _enemy = target; _targetingEnemy = (Object)(object)target != (Object)null; _startTransform = ((GameActor)owner).CurrentGun.barrelOffset; _endTransform = clipTransform; _endTransformOffset = clipTransformOffset; _mesh = new Mesh(); _vertices = (Vector3[])(object)new Vector3[20]; _mesh.vertices = _vertices; int[] array = new int[54]; Vector2[] uv = (Vector2[])(object)new Vector2[20]; int num = 0; for (int i = 0; i < 9; i++) { array[i * 6] = num; array[i * 6 + 1] = num + 2; array[i * 6 + 2] = num + 1; array[i * 6 + 3] = num + 2; array[i * 6 + 4] = num + 3; array[i * 6 + 5] = num + 1; num += 2; } _mesh.triangles = array; _mesh.uv = uv; GameObject val = new GameObject("cableguy"); _stringFilter = val.AddComponent(); _stringFilter.mesh = _mesh; MeshRenderer obj = val.AddComponent(); ? val2 = obj; Object obj2 = BraveResources.Load("Global VFX/WhiteMaterial", ".mat"); ((Renderer)val2).material = (Material)(object)((obj2 is Material) ? obj2 : null); ((Renderer)obj).material.SetColor(CwaffVFX._OverrideColorId, Alligator._RedClipColor); if (!Object.op_Implicit((Object)(object)_owner) || !_targetingEnemy) { return; } float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; _extantSparks.Add(SpawnManager.SpawnVFX(Alligator._SparkVFX, _startTransform.position, Quaternion.identity)); _extantSpawnTimes.Add(scaledTimeSinceStartup); Bounds bounds = ((BraveBehaviour)_enemy).sprite.GetBounds(); Vector3 size = ((Bounds)(ref bounds)).size; float num2 = 0.25f * size.x * Random.value * BraveUtility.RandomSign(); float num3 = 0.25f * size.y * Random.value * BraveUtility.RandomSign(); _endTransformOffset += new Vector2(num2, num3); _clippyboi = SpawnManager.SpawnVFX(Alligator._ClipVFX, clipTransform.position, Quaternion.identity); _clippyboi.transform.parent = clipTransform; _clippyboi.transform.localPosition = Vector2.op_Implicit(_endTransformOffset); ((tk2dBaseSprite)_clippyboi.GetComponent()).HeightOffGround = 10f; Alligator component = ((Component)((GameActor)_owner).CurrentGun).GetComponent(); if (component != null) { _alligator = component; } else { Alligator gun = _owner.GetGun(); if (gun != null) { _alligator = gun; } } if (Object.op_Implicit((Object)(object)_alligator)) { _alligator._cables.Add(this); } if (!_ClipCounter.ContainsKey(_enemy)) { _ClipCounter[_enemy] = 1; } else { _ClipCounter[_enemy]++; } } public static bool MaxClipsAttachedToEnemy(AIActor enemy) { if (_ClipCounter.TryGetValue(enemy, out var value)) { return value >= 8; } return false; } private void FallOnFloor() { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_0141: 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_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_alligator)) { _alligator._cables.Remove(this); _alligator = null; } if (Object.op_Implicit((Object)(object)_enemy)) { _ClipCounter[_enemy]--; } for (int num = _extantSparks.Count - 1; num >= 0; num--) { if (Object.op_Implicit((Object)(object)_extantSparks[num])) { Object.Destroy((Object)(object)_extantSparks[num]); } } _extantSparks.Clear(); GameObjectExtensions.SetLayerRecursively(((Component)this).gameObject, LayerMask.NameToLayer("BG_Critical")); ((Component)this).transform.position = Vector3Extensions.WithZ(_startTransform.position, 10f); _startTransform = ((Component)this).transform; _endTransform = new GameObject().transform; _endTransform.position = _lastGoodEndPos; if (Object.op_Implicit((Object)(object)_clippyboi)) { _clippyboi.transform.parent = _endTransform; _clippyboi.transform.localRotation = Lazy.RandomEulerZ(); } _dropVelocity = Vector2Extensions.ToVector3ZUp(Lazy.RandomVector(Random.Range(5f, 20f)), 0f); _dropOffsetVector = Vector2Extensions.ToVector3ZUp(Lazy.RandomVector(0.5f + 1.5f * Random.value), 0f); _enemy = null; _targetingEnemy = false; _fallen = true; _settled = false; } private void HandleFallenOnFloor() { //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_0027: 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_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_0052: 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_006d: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00d4: 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) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00ec: 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_00f2: Unknown result type (might be due to invalid IL or missing references) if (!_settled) { float deltaTime = BraveTime.DeltaTime; Transform endTransform = _endTransform; endTransform.position += deltaTime * _dropVelocity; _startTransform.position = Vector2.op_Implicit(Lazy.SmoothestLerp(Vector2.op_Implicit(_startTransform.position), Vector2.op_Implicit(_endTransform.position), 10f)); _dropVelocity *= Mathf.Pow(0.9f, deltaTime * 60f); if (((Vector3)(ref _dropVelocity)).sqrMagnitude < 1f) { _settled = true; } Vector3 position = _startTransform.position; Vector3 val = _endTransform.position + Vector2Extensions.ToVector3ZisY(_endTransformOffset, 0f); BuildMeshAlongCurveAndUpdateSparks(Vector2.op_Implicit(position), Vector2.op_Implicit(position), Vector2.op_Implicit(val + _dropOffsetVector), Vector2.op_Implicit(val)); _mesh.vertices = _vertices; _mesh.RecalculateBounds(); _mesh.RecalculateNormals(); } } private void LateUpdate() { //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_0156: 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_016a: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: 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_0178: 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) //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) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0198: 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) //IL_012e: Unknown result type (might be due to invalid IL or missing references) if (_fallen) { HandleFallenOnFloor(); return; } if (_targetingEnemy && (!Object.op_Implicit((Object)(object)_enemy) || !Object.op_Implicit((Object)(object)((BraveBehaviour)_enemy).healthHaver) || !((BraveBehaviour)_enemy).healthHaver.IsAlive)) { FallOnFloor(); return; } if (!Object.op_Implicit((Object)(object)_owner) || !Object.op_Implicit((Object)(object)((GameActor)_owner).CurrentGun)) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } if (!Object.op_Implicit((Object)(object)_startTransform)) { _startTransform = ((GameActor)_owner).CurrentGun.barrelOffset; } if (!Object.op_Implicit((Object)(object)_startTransform) || !Object.op_Implicit((Object)(object)_endTransform)) { return; } Gun val = ((GameActor)_owner).CurrentGun; if (!Object.op_Implicit((Object)(object)((Component)val).GetComponent())) { Gun currentSecondaryGun = _owner.CurrentSecondaryGun; if (currentSecondaryGun != null) { val = currentSecondaryGun; } } Vector3 val2 = ((Object.op_Implicit((Object)(object)((Component)val).GetComponent()) && ((BraveBehaviour)val).renderer.enabled) ? Vector2Extensions.ToVector3ZisY(Vector3Extensions.XY(_startTransform.position), -3f) : Vector2Extensions.ToVector3ZisY(((GameActor)_owner).CenterPosition, 0f)); _lastGoodEndPos = _endTransform.position; Vector3 val3 = Vector2Extensions.ToVector3ZisY(Vector3Extensions.XY(_lastGoodEndPos), -3f) + Vector2Extensions.ToVector3ZisY(_endTransformOffset, 0f); BuildMeshAlongCurveAndUpdateSparks(Vector2.op_Implicit(val2), Vector2.op_Implicit(val2), Vector2.op_Implicit(val3 + new Vector3(0f, -2f, -2f)), Vector2.op_Implicit(val3)); _mesh.vertices = _vertices; _mesh.RecalculateBounds(); _mesh.RecalculateNormals(); } private void OnDestroy() { if (Object.op_Implicit((Object)(object)_alligator)) { _alligator._cables.Remove(this); } if (Object.op_Implicit((Object)(object)_enemy)) { _ClipCounter[_enemy]--; } for (int num = _extantSparks.Count - 1; num >= 0; num--) { if (Object.op_Implicit((Object)(object)_extantSparks[num])) { Object.Destroy((Object)(object)_extantSparks[num]); } } if (Object.op_Implicit((Object)(object)_clippyboi)) { Object.Destroy((Object)(object)_clippyboi); } if (Object.op_Implicit((Object)(object)_stringFilter)) { Object.Destroy((Object)(object)((Component)_stringFilter).gameObject); } if (_fallen && Object.op_Implicit((Object)(object)_endTransform)) { Object.Destroy((Object)(object)((Component)_endTransform).gameObject); } } private void BuildMeshAlongCurveAndUpdateSparks(Vector2 p0, Vector2 p1, Vector2 p2, Vector2 p3, float meshWidth = 1f / 32f) { //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) //IL_0035: 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_0038: 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_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_005e: 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_0061: 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_007d: 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_0080: 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_0093: 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_009d: 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_00a6: 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_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_00f4: 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_00fa: 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_00b6: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00d6: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: 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_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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_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_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: 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_02fa: 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_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_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0313: 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_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) Vector3[] vertices = _vertices; Vector2? val = null; Quaternion val2 = Quaternion.Euler(0f, 0f, 90f); for (int i = 0; i < 10; i++) { Vector2 val3 = BraveMathCollege.CalculateBezierPoint((float)i / 9f, p0, p1, p2, p3); Vector2? val4 = ((i != 9) ? new Vector2?(BraveMathCollege.CalculateBezierPoint((float)i / 9f, p0, p1, p2, p3)) : ((Vector2?)null)); Vector2 val5 = Vector2.zero; Vector2 val7; if (val.HasValue) { Vector2 val6 = val5; val7 = Vector3Extensions.XY(val2 * Vector2.op_Implicit(val3 - val.Value)); val5 = val6 + ((Vector2)(ref val7)).normalized; } if (val4.HasValue) { Vector2 val8 = val5; val7 = Vector3Extensions.XY(val2 * Vector2.op_Implicit(val4.Value - val3)); val5 = val8 + ((Vector2)(ref val7)).normalized; } val5 = ((Vector2)(ref val5)).normalized; vertices[i * 2] = Vector2Extensions.ToVector3ZisY(val3 + val5 * meshWidth, _fallen ? 10f : (-10f)); vertices[i * 2 + 1] = Vector2Extensions.ToVector3ZisY(val3 + -val5 * meshWidth, _fallen ? 10f : (-10f)); val = val3; } if (!_targetingEnemy) { return; } float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; if (Object.op_Implicit((Object)(object)_alligator) && _alligator.energyProduction > 0f) { _energyProduced += _alligator.energyProduction * BraveTime.DeltaTime; if (_energyProduced > 1f) { _energyProduced -= 1f; _extantSparks.Add(SpawnManager.SpawnVFX(Alligator._SparkVFX, _startTransform.position, Quaternion.identity)); _extantSpawnTimes.Add(scaledTimeSinceStartup); } } int num = _extantSparks.Count - 1; while (num >= 0 && Object.op_Implicit((Object)(object)_enemy) && Object.op_Implicit((Object)(object)((BraveBehaviour)_enemy).healthHaver)) { float num2 = (scaledTimeSinceStartup - _extantSpawnTimes[num]) / 0.3f; if (num2 > 1f) { ((BraveBehaviour)_enemy).healthHaver.ApplyDamage(2f, Vector2.zero, Alligator.ItemName, (CoreDamageTypes)64, (DamageCategory)0, false, (PixelCollider)null, false); ((Component)this).gameObject.PlayUnique("electrocution_sound"); Object.Destroy((Object)(object)_extantSparks[num]); _extantSparks.RemoveAt(num); _extantSpawnTimes.RemoveAt(num); } else { Vector2 val9 = BraveMathCollege.CalculateBezierPoint(num2, p0, p1, p2, p3); _extantSparks[num].transform.position = Vector2.op_Implicit(val9); if (Random.value < 0.2f) { Vector3 val10 = Vector2.op_Implicit(val9); Vector3 val11 = Vector2.op_Implicit(val9); Vector3 val12 = Vector2.op_Implicit(Lazy.RandomVector(4f)); float? num3 = 0.2f; Color? val13 = Color.cyan; GlobalSparksDoer.DoRandomParticleBurst(5, val10, val11, val12, 360f, 0f, (float?)null, num3, val13, (SparksType)0); } } num--; } } } public class HolyWaterGun : CwaffGun { public static string ItemName = "Holy Water Gun"; public static string ShortDescription = "Water, Gun, & Holy Soak"; public static string LongDescription = "Deals 8x damage to the Jammed. Killing a Jammed enemy reduces curse by 0.5."; public static string Lore = "Rumored to have been used in exorcisms by the High Priest back while he was still the Low Priest. While the exact composition of the holy water is unknown, scientists have been able to reasonably ascertain the fluid contains koi pond water, primer, rat saliva, and moonshine. In any case, it has proven extremely effective at exorcising the Jammed and nauseating everyone else."; internal static GameObject _ExorcismParticleVFX = null; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore).SetAttributes((ItemQuality)2, (GunClass)20, 1f, 100, Items.MegaDouser, defaultAudio: true, infiniteAmmo: false, 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).AddToShop((ShopType)2) .AddToShop((ShopType)0); Projectile baseProjectile = Items.MegaDouser.Projectile(); int? clipSize = -1; float? damage = 15f; float? speed = 50f; float? force = 15f; bool? beamInterpolate = false; gun.InitProjectile(GunData.New(null, baseProjectile, clipSize, null, null, (ShootStyle)2, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, force, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 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, null, null, null, null, "holy_water_gun", 20, -1, -1, -1, -1, -1, beamLoopCharge: true, 15f, -1, -1f, -1f, null, beamInterpolate, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: true)).Attach(); _ExorcismParticleVFX = VFX.Create("exorcism_particles", 12f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 2f); } } public class ExorcismJuice : MonoBehaviour { private const float _HOLY_GOOP_RADIUS = 5f; private const float _JAMMED_DAMAGE_MULT = 4f; private const float _MASTERY_JAMMED_DAMAGE_MULT = 16f; private PlayerController _owner; private bool _mastered; private void Start() { Projectile component = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = component.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); _mastered = Object.op_Implicit((Object)(object)_owner) && _owner.HasSynergy(Synergy.MASTERY_HOLY_WATER_GUN); component.BlackPhantomDamageMultiplier = (_mastered ? 16f : 4f); component.OnHitEnemy = (Action)Delegate.Combine(component.OnHitEnemy, new Action(ExorciseTheJammed)); } private void ExorciseTheJammed(Projectile proj, SpeculativeRigidbody body, bool willKill) { //IL_0038: 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) //IL_0052: 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_005d: 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_0174: 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) if (!Object.op_Implicit((Object)(object)body)) { return; } AIActor component = ((Component)body).GetComponent(); if (component == null) { return; } Lazy.PlaySoundUntilDeathOrTimeout("exorcism_noises_intensify", ((Component)component).gameObject, 0.2f); if (Random.value < 0.25f) { Vector2 val = ((GameActor)component).CenterPosition + Lazy.RandomVector(); CwaffVFX.Spawn(HolyWaterGun._ExorcismParticleVFX, Vector2Extensions.ToVector3ZisY(val, -1f), Lazy.RandomEulerZ(), Lazy.RandomVector(0.5f), 0.34f, 0.34f); } if (!willKill || !component.IsBlackPhantom) { return; } BasicBeamController component2 = ((Component)proj).GetComponent(); if (component2 == null) { return; } _owner.ownerlessStatModifiers.Add(((StatType)14).Add(-0.5f)); _owner.stats.RecalculateStats(_owner, false, false); tk2dBaseSprite obj = ((BraveBehaviour)component).sprite.DuplicateInWorld(component.optionalPalette); obj.ApplyShader(CwaffShaders.DesatShader, component.optionalPalette); ((BraveBehaviour)obj).renderer.material.SetFloat(CwaffVFX._SaturationId, 0f); ((BraveBehaviour)obj).renderer.material.SetFloat(CwaffVFX._FadeId, 1f); ((MonoBehaviour)obj).StartCoroutine(GhostlyDeath(obj, ((BeamController)component2).Direction)); if (_mastered) { ((Component)_owner).gameObject.Play("holy_sound"); DeadlyDeadlyGoopManager goopManagerForGoopType = DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(EasyGoopDefinitions.HolyGoop); if (goopManagerForGoopType != null) { goopManagerForGoopType.AddGoopCircle(((GameActor)component).CenterPosition, 5f, -1, false, -1); } } } private static IEnumerator GhostlyDeath(tk2dBaseSprite sprite, Vector2 direction) { //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) Vector3 velocity = Vector2Extensions.ToVector3ZUp(1.5f * ((Vector2)(ref direction)).normalized, 0f); ((Component)sprite).gameObject.Play("ghost_soul_sound"); for (float elapsed = 0f; elapsed < 2.5f; elapsed += BraveTime.DeltaTime) { Transform transform = ((BraveBehaviour)sprite).transform; transform.position += velocity * BraveTime.DeltaTime; ((BraveBehaviour)sprite).renderer.material.SetFloat(CwaffVFX._FadeId, 1f - elapsed / 2.5f); yield return null; } Object.Destroy((Object)(object)((Component)sprite).gameObject); } } public class GameActorHolyGoopEffect : GameActorSpeedEffect { public override void OnEffectApplied(GameActor actor, RuntimeGameActorEffectData effectData, float partialAmount = 1f) { ((GameActorSpeedEffect)this).OnEffectApplied(actor, effectData, partialAmount); PlayerController val = (PlayerController)(object)((actor is PlayerController) ? actor : null); if (val == null) { return; } val.InfiniteAmmo.AddOverride("Holy Goop", (float?)null); Material[] array = val.SetOverrideShader(ShaderCache.Acquire("Brave/Internal/RainbowChestShader")); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)null) { array[i].SetFloat("_AllColorsToggle", 1f); } } ((BraveBehaviour)val).healthHaver.IsVulnerable = false; } public override void OnEffectRemoved(GameActor actor, RuntimeGameActorEffectData effectData) { ((GameActorSpeedEffect)this).OnEffectRemoved(actor, effectData); PlayerController val = (PlayerController)(object)((actor is PlayerController) ? actor : null); if (val != null) { val.InfiniteAmmo.RemoveOverride("Holy Goop"); val.ClearOverrideShader(); ((BraveBehaviour)val).healthHaver.IsVulnerable = true; } } } public class Gunflower : CwaffGun { public static string ItemName = "Gunflower"; public static string ShortDescription = "Petal to the Metal"; public static string LongDescription = "Fires a highly concentrated beam of sunlight. Replenishes ammo when exposed to water and water-like goops. Depletes ammo when exposed to fire and various unhealthy goops."; public static string Lore = "A living sunflower that has been cybernetically enhanced with a generator and a refraction chamber. The botanist who invented it had originally been trying to produce a flower capable of growing itself, a million-dollar idea so it seemed. Several failed attempts and a refresher on the first law of thermodynamics later, they eventually tossed all of their prototypes into the wind, which carried some of them all the way into the Gungeon."; private const float _LIGHT_SPACING = 2f; private const float _PASSIVE_AMMO_REGEN_TIME = 5f; private const float _PASSIVE_AMMO_REGEN_PERCENT = 0.1f; internal static GameObject _GrowthSparkles; internal static GameObject _DecayVFX; private List _lights = new List(); private bool _revved; private float _lastRegenTime; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 4; int? reloadFps = 4; Items? muzzleFrom = Items.Mailbox; gun.SetAttributes((ItemQuality)4, (GunClass)20, 0f, 100, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: false, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, null, null, null, -1, -1, 4, muzzleFrom, modulesAreTiers: false, null, 60, 1f, (Anchor)3, -1f, null, -1f, muzzleLit: false, 0f, 0f, null, null, preventRotation: false, 0f, continuousFire: false, dynamicBarrelOffsets: true, banFromBlessedRuns: false, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0).InitProjectile(GunData.New(null, Items.Moonscraper.Projectile(), -1, 0.18f, damage: 100f, speed: -1f, angleVariance: 0f, shootStyle: (ShootStyle)2, sequenceStyle: (ProjectileSequenceStyle)0, chargeTime: 0f, ammoCost: 3, ammoType: null, customClip: true, force: null, range: null, recoil: null, poison: 0f, fire: 0f, freeze: 0f, slow: 0f, collidesWithEnemies: null, ignoreDamageCaps: null, collidesWithProjectiles: null, surviveRigidbodyCollisions: null, collidesWithTilemap: null, sprite: null, fps: 2, anchor: (Anchor)4, scale: 1f, anchorsChangeColliders: true, fixesScales: true, overrideColliderPixelSizes: null, overrideColliderOffsets: null, bossDamageMult: 1f, destroySound: null, shouldRotate: null, barrageSize: 1, shouldFlipHorizontally: null, shouldFlipVertically: null, useDummyChargeModule: false, invisibleProjectile: false, spawnSound: null, stopSoundOnDeath: null, uniqueSounds: null, shrapnelVFX: null, shrapnelCount: null, shrapnelMinVelocity: null, shrapnelMaxVelocity: null, shrapnelLifetime: null, preventOrbiting: null, hitSound: null, hitEnemySound: null, hitWallSound: null, becomeDebris: null, angleFromAim: 0f, ignoredForReloadPurposes: false, mirror: false, electric: null, burstCooldown: null, preventSparks: null, pierceBreakables: null, collidesOnlyWithPlayerProjectiles: null, pierceInternalWalls: null, doBeamSetup: null, beamSprite: "gunflower_beam", beamFps: 17, beamStartFps: -1, beamEndFps: -1, beamChargeFps: 8, beamMuzzleFps: -1, beamImpactFps: 14, beamLoopCharge: false, beamEmission: 40f, beamReflections: 0, beamChargeDelay: 0.8f)); _GrowthSparkles = VFX.Create("gunflower_growth_sparkles", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 100f); _DecayVFX = VFX.Create("gunflower_decay_vfx", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 100f); } public override void Update() { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Invalid comparison between Unknown and I4 base.Update(); PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null) { return; } if (((GunBehaviour)this).gun.CurrentAmmo > 0 && ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.IsPlaying(((GunBehaviour)this).gun.outOfAmmoAnimation)) { ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.PlayFromFrame(((GunBehaviour)this).gun.idleAnimation, 0); } if (base.Mastered && !((GunBehaviour)this).gun.IsFiring) { DoPassiveAmmoRegen(); } UpdateNutrients(); bool play = Object.op_Implicit((Object)(object)((GunBehaviour)this).gun) && ((GunBehaviour)this).gun.IsFiring && !playerOwner.IsDodgeRolling; ((MonoBehaviour)(object)((GunBehaviour)this).gun).LoopSoundIf(play, "gunflower_fire_sound", 1750, 573); BeamController extantBeam = GetExtantBeam(); BasicBeamController val = (BasicBeamController)(object)((extantBeam is BasicBeamController) ? extantBeam : null); if (val != null && (int)val.State == 2) { if (!_revved) { GunExt.SetAnimationFPS(((GunBehaviour)this).gun, ((GunBehaviour)this).gun.shootAnimation, 20); ((BraveBehaviour)((GunBehaviour)this).gun).spriteAnimator.PlayFromFrame(((GunBehaviour)this).gun.shootAnimation, 4); _revved = true; } UpdateLights(); } else { if (_revved) { GunExt.SetAnimationFPS(((GunBehaviour)this).gun, ((GunBehaviour)this).gun.shootAnimation, 4); _revved = false; } DismissLights(); } } private void DoPassiveAmmoRegen() { if (!((float)((GunBehaviour)this).gun.CurrentAmmo / (float)((GunBehaviour)this).gun.AdjustedMaxAmmo >= 0.1f)) { float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; float num = 5f / (0.1f * (float)((GunBehaviour)this).gun.AdjustedMaxAmmo); if (!(scaledTimeSinceStartup - _lastRegenTime < num)) { _lastRegenTime = scaledTimeSinceStartup; ((GunBehaviour)this).gun.GainAmmo(1); ((Component)((GunBehaviour)this).gun).gameObject.PlayOnce("starmageddon_bullet_impact_sound_2"); SpawnParticles(nutritious: true); } } } private void UpdateNutrients() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null) { return; } GoopDefinition currentGoop = ((GameActor)playerOwner).CurrentGoop; if (!Object.op_Implicit((Object)(object)currentGoop)) { return; } GoopPositionData val = ((BraveBehaviour)playerOwner).specRigidbody.UnitCenter.GoopData(); if (val == null) { return; } bool flag; int num; if (base.Mastered) { flag = true; num = 1; } else if (currentGoop.DrainsAmmo) { flag = false; num = 0; } else if (((GameActor)playerOwner).m_currentGoopFrozen) { flag = false; num = 0; } else { if (val.IsOnFire) { GameActorFireEffect fireEffect = currentGoop.fireEffect; if (fireEffect != null && ((GameActorEffect)fireEffect).AffectsPlayers) { flag = true; num = -1; goto IL_00c5; } } if (currentGoop.AppliesDamageOverTime) { flag = true; num = -1; } else if (currentGoop.isOily) { flag = true; num = -1; } else if (currentGoop.usesWaterVfx) { flag = true; num = 1; } else if (currentGoop.SpeedModifierEffect != null) { flag = false; num = 0; } else { flag = true; num = -1; } } goto IL_00c5; IL_00c5: if (num > 0) { Gun gun = ((GunBehaviour)this).gun; gun.CurrentAmmo += num; if (playerOwner.HasSynergy(Synergy.PHOTOSYNTHESIS)) { Gun gun2 = playerOwner.GetGun(481); if (gun2 != null) { gun2.GainAmmo(num); } } ((Component)((GunBehaviour)this).gun).gameObject.PlayOnce("starmageddon_bullet_impact_sound_2"); SpawnParticles(nutritious: true); } else if (num < 0) { ((GunBehaviour)this).gun.LoseAmmo(-num); ((Component)((GunBehaviour)this).gun).gameObject.PlayOnce("lightwing_impact_sound"); SpawnParticles(nutritious: false); } if (flag) { DeadlyDeadlyGoopManager.DelayedClearGoopsInRadius(((GameActor)playerOwner).CenterPosition, 1f); } } private void SpawnParticles(bool nutritious) { //IL_0021: 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_005e: Unknown result type (might be due to invalid IL or missing references) GameObject prefab = (nutritious ? _GrowthSparkles : _DecayVFX); int numToSpawn = ((!nutritious) ? 1 : 2); Vector2 basePosition = Vector2.op_Implicit(((GunBehaviour)this).gun.barrelOffset.position); float velocityVariance = (nutritious ? 3f : 5f); float? fadeOutTime = 0.5f; float emissivePower = (nutritious ? 100f : 0f); Color? emissiveColor = Color.yellow; CwaffVFX.SpawnBurst(prefab, numToSpawn, basePosition, 1f, null, 0f, velocityVariance, CwaffVFX.Vel.Radial, CwaffVFX.Rot.None, 0.5f, fadeOutTime, emissivePower, emissiveColor); } private void DismissLights(int startIndex = 0) { for (int i = startIndex; i < _lights.Count; i++) { if (Object.op_Implicit((Object)(object)_lights[i])) { _lights[i].LightIntensity = 0f; } } } private void UpdateLightsForBeam(BasicBeamController beam, ref int i) { //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_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_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_0022: 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_009b: 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_0132: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_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) Vector2 origin = ((BeamController)beam).Origin; Vector2 direction = ((BeamController)beam).Direction; Vector2 normalized = ((Vector2)(ref direction)).normalized; Vector2 val = 2f * normalized; float currentBeamDistance = beam.m_currentBeamDistance; int num = Mathf.CeilToInt(currentBeamDistance / 2f); for (int j = 0; j <= num; j++) { i++; if (_lights.Count < i + 1) { _lights.Add(null); } if (!Object.op_Implicit((Object)(object)_lights[i])) { _lights[i] = new GameObject().AddComponent(); _lights[i].LightColor = Color.white; _lights[i].LightRadius = 2f; _lights[i].Initialize(); } if (j == num) { ((Component)_lights[i]).gameObject.transform.position = Vector2.op_Implicit(origin + currentBeamDistance * normalized); _lights[i].LightIntensity = 100f; } else { ((Component)_lights[i]).gameObject.transform.position = Vector2.op_Implicit(origin + (float)j * val); _lights[i].LightIntensity = 10f; } } } private void UpdateLights() { int i = -1; for (int num = ((GunBehaviour)this).gun.m_activeBeams.Count - 1; num >= 0; num--) { BeamController beam = ((GunBehaviour)this).gun.m_activeBeams[num].beam; BasicBeamController val = (BasicBeamController)(object)((beam is BasicBeamController) ? beam : null); while (Object.op_Implicit((Object)(object)val)) { UpdateLightsForBeam(val, ref i); val = val.m_reflectedBeam; } } while (++i < _lights.Count) { if (Object.op_Implicit((Object)(object)_lights[i])) { _lights[i].LightIntensity = 0f; } } } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); DismissLights(); } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); DismissLights(); } public override void OnDestroy() { base.OnDestroy(); if (!Object.op_Implicit((Object)(object)this) || _lights == null) { return; } for (int i = 0; i < _lights.Count; i++) { if (Object.op_Implicit((Object)(object)_lights[i]) && Object.op_Implicit((Object)(object)((Component)_lights[i]).gameObject)) { Object.Destroy((Object)(object)((Component)_lights[i]).gameObject); } } } } public class Entropynnium : CwaffGun { private class EntropynniumAmmoDisplay : CustomAmmoDisplay { private Entropynnium _ent; private PlayerController _owner; private static readonly Color _AmmoLabelColor = Color.Lerp(ExtendedColours.purple, Color.white, 0.5f); private void Start() { Gun component = ((Component)this).GetComponent(); _ent = ((Component)component).GetComponent(); ref PlayerController owner = ref _owner; GameActor currentOwner = component.CurrentOwner; owner = (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null); } public override bool DoCustomAmmoDisplay(GameUIAmmoController uic) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_owner)) { return false; } uic.SetAmmoCountLabelColor(_AmmoLabelColor); uic.GunAmmoCountLabel.Text = $"{_ent._storedMana}[sprite \"mana_ui\"]"; return true; } } public static string ItemName = "Entropynnium"; public static string ShortDescription = "Applied Botanics"; public static string LongDescription = "Passively gathers mana from explosions. Can be charged to consume mana and detonate enemies around the player. Longer charges result in a larger detonation range and more potent detonations, but consume dramatically more mana."; public static string Lore = "A flower from another dimension where the nutritional needs of plants are significantly more complicated than soil, water, and sunlight. This particular specimen draws its nutrients from ambient explosions in its environment, a trait powerful in its natural habitat and even more so in the Gungeon. If only Gungeoneers had the same diet...."; private const int _MAX_MANA = 10000; private const float _CHARGE_TIME = 5f; private const float _THICKNESS = 0.5f; private const float _PARTICLE_TIMER = 0.1f; private const float _SOUND_TIMER = 0.75f; internal const float _MAX_RADIUS = 16f; internal const float _MANA_ROI = 0.25f; internal const float _MANA_DRAIN = 10f; internal static GameObject _ManaParticlePrefab = null; internal static GameObject _ExplosionManaPrefab = null; internal static ExplosionData _SmallManaExplosion = null; [SerializeField] private int _storedMana; private float _manaRadius; private float _nextParticleTime; private int _manaDrainedThisCharge; private Geometry _extantManaRing; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 20; int? chargeFps = 20; Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)2, (GunClass)45, 0f, 720, Items.Banana, defaultAudio: false, infiniteAmmo: true, canGainAmmo: false, canReloadNoMatterAmmo: true, null, null, shootFps, null, chargeFps, null, null, null, null, -1, -1, -1, null, modulesAreTiers: false, null, 30, 1f, (Anchor)4, -1f, null, -1f, muzzleLit: false, 0f, 0f, null, null, preventRotation: false, 0f, continuousFire: false, dynamicBarrelOffsets: false, banFromBlessedRuns: true, rampUpFireRate: false, 0f, suppressReloadAnim: false, (GunHandedness)0, autoPlay: true, attacksThroughWalls: true).Attach((Action)null, allowDuplicates: false).AssignGun(out gunRef); int? clipSize = -1; float? cooldown = 0.15f; float? damage = 25f; float? range = 9999f; ((Projectile)(object)gun2.InitSpecialProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)3, (ProjectileSequenceStyle)1, 0f, 1, null, customClip: false, damage, null, null, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: true, null, null, null, null, null, null, null, null, null, null, null, null, null, 0f, ignoredForReloadPurposes: false, mirror: false, null, null, null, null, null, null, null, null, -1, -1, -1, -1, -1, -1, beamLoopCharge: true, -1f, -1, -1f, -1f, null, null, -1, null, null, null, -1f, null, null, null, beamStartIsMuzzle: false, hideAmmo: true))).SetupChargeProjectiles(gunRef.DefaultModule, 1, (int i, Projectile p) => new ChargeProjectile { Projectile = p, ChargeTime = 0.5f }); _ManaParticlePrefab = VFX.Create("mana_particle", 30f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _SmallManaExplosion = GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultSmallExplosionData.Clone(); _SmallManaExplosion.damageToPlayer = 0f; _ExplosionManaPrefab = _ManaParticlePrefab.ClonePrefab(); _ExplosionManaPrefab.AddComponent(); } public override void Update() { base.Update(); ((BraveBehaviour)((BraveBehaviour)((GunBehaviour)this).gun).sprite).renderer.material.SetFloat(CwaffVFX._EmissivePowerId, 5f + 10f * Mathf.Abs(Mathf.Sin(BraveTime.ScaledTimeSinceStartup))); UpdateDetonationRing(); } internal void UpdateMana(int mana) { _storedMana = Mathf.Min(_storedMana + mana, 10000); } private void UpdateDetonationRing() { //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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_01b9: 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_0255: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) if (!((GunBehaviour)this).gun.IsCharging || (_manaDrainedThisCharge == 0 && (float)_storedMana < 2.5f)) { DestroyDetonationRing(); _manaDrainedThisCharge = 0; return; } float deltaTime = BraveTime.DeltaTime; float num = Mathf.Min(_manaRadius + 3.2f * deltaTime, 16f); int num2 = Mathf.CeilToInt((base.Mastered ? 0.5f : 1f) * num * num * 10f) - _manaDrainedThisCharge; if (num2 <= _storedMana) { _storedMana -= num2; _manaDrainedThisCharge += num2; _manaRadius = num; } if (_manaRadius < 0.5f) { return; } if (!Object.op_Implicit((Object)(object)_extantManaRing)) { _extantManaRing = Geometry.Create(Geometry.Shape.RING); } Transform transform = ((Component)((GunBehaviour)this).gun.barrelOffset).transform; Vector2 val = Vector2.op_Implicit(transform.position); Geometry extantManaRing = _extantManaRing; Color? color = Vector3Extensions.WithAlpha(ExtendedColours.purple, 0.05f); Vector2? pos = val; float? radius = _manaRadius; float? radiusInner = _manaRadius - 0.5f; extantManaRing.Place(color, pos, null, radius, null, null, radiusInner); ((Component)this).gameObject.Play("entropynnium_charge_sound", 0.75f); float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; if (!(_nextParticleTime < scaledTimeSinceStartup)) { return; } _nextParticleTime = scaledTimeSinceStartup + 0.1f; float num3 = 0.25f * Mathf.Sqrt(_manaRadius); float num4 = _manaRadius + 3.2f * num3; GameObject manaParticlePrefab = _ManaParticlePrefab; float minVariance = num4 - 0.5f; float lifetime = num3; radiusInner = 0.6f; radius = 0.2f; Color? emissiveColor = ExtendedColours.purple; Transform anchorTransform = transform; CwaffVFX.SpawnBurst(manaParticlePrefab, 16, val, num4, null, 0f, 0f, CwaffVFX.Vel.OutwardFromCenter, CwaffVFX.Rot.Random, lifetime, null, 100f, emissiveColor, fadeIn: false, uniform: false, radiusInner, radius, null, randomFrame: false, -1, flipX: false, flipY: false, anchorTransform, null, 1.55f, 0f, null, -1, 0f, minVariance, unoccluded: true); foreach (AIActor allNearbyEnemy in val.GetAllNearbyEnemies(_manaRadius)) { tk2dBaseSprite obj = allNearbyEnemy.DuplicateInWorld(); obj.ApplyShader(CwaffShaders.WiggleShader, allNearbyEnemy.optionalPalette); ((MonoBehaviour)obj).StartCoroutine(obj.PhaseOut(Lazy.RandomVector(), 32f, 200f, 0.75f)); } } private void DestroyDetonationRing() { _manaRadius = 0f; if (Object.op_Implicit((Object)(object)_extantManaRing)) { Object.Destroy((Object)(object)_extantManaRing); } _extantManaRing = null; ((Component)this).gameObject.Play("entropynnium_charge_sound_stop"); } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); DestroyDetonationRing(); } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); CustomActions.OnExplosionComplex = (Action)(object)Delegate.Combine((Delegate?)(object)CustomActions.OnExplosionComplex, (Delegate?)(object)new Action(HandleExplosion)); } public override void OnDroppedByPlayer(PlayerController player) { CustomActions.OnExplosionComplex = (Action)(object)Delegate.Remove((Delegate?)(object)CustomActions.OnExplosionComplex, (Delegate?)(object)new Action(HandleExplosion)); DestroyDetonationRing(); base.OnDroppedByPlayer(player); } public override void OnDestroy() { CustomActions.OnExplosionComplex = (Action)(object)Delegate.Remove((Delegate?)(object)CustomActions.OnExplosionComplex, (Delegate?)(object)new Action(HandleExplosion)); DestroyDetonationRing(); base.OnDestroy(); } public override void PostProcessProjectile(Projectile projectile) { ((GunBehaviour)this).PostProcessProjectile(projectile); if (!(projectile is ManaExplosionProjectile manaExplosionProjectile)) { return; } if (_manaRadius == 16f && base.Mastered) { PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null) { playerOwner.ForceBlank(25f, 0.5f, false, true, (Vector2?)null, true, -1f); } } manaExplosionProjectile.Setup(_manaRadius, 1f); DestroyDetonationRing(); } private void HandleExplosion(Vector3 position, ExplosionData data, Vector2 dir, Action onbegin, bool ignoreQueues, CoreDamageTypes damagetypes, bool ignoreDamageCaps) { //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_005d: 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_0080: Unknown result type (might be due to invalid IL or missing references) PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null) { return; } float damage = data.damage; float definedDamageRadius = data.GetDefinedDamageRadius(); int num = Mathf.CeilToInt(0.25f * damage * definedDamageRadius * definedDamageRadius); while (num > 0) { ExplosionMana component = Object.Instantiate(_ExplosionManaPrefab, position, Quaternion.identity).GetComponent(); if (num > 25) { num -= 25; component.Setup(this, playerOwner, 25, 1f, Lazy.RandomVector(15f)); } else if (num > 5) { num -= 5; component.Setup(this, playerOwner, 5, 0.5f, Lazy.RandomVector(15f)); } else { num--; component.Setup(this, playerOwner, 1, 0.25f, Lazy.RandomVector(15f)); } } } public override void MidGameSerialize(List data, int i) { ((GunBehaviour)this).MidGameSerialize(data, i); data.Add(_storedMana); } public override void MidGameDeserialize(List data, ref int i) { ((GunBehaviour)this).MidGameDeserialize(data, ref i); _storedMana = (int)data[i++]; } } public class ExplosionMana : MonoBehaviour { private const float _MAX_RADIUS = 1f; private const float _MAX_SQR_RADIUS = 1f; private const float _MAX_SPEED = 50f; private const float _MAX_SPEED_SQR = 2500f; private const float _BOB_SPEED = 2f; private const float _BOB_HEIGHT = 0.3f; private const float _HOME_ACCEL = 4f; private const float _FRICTION = 0.96f; private Entropynnium _gun; private PlayerController _owner; private int _mana = 1; private float _homeStrength; private bool _setup; private Vector2 _velocity; private Vector3 _basePos; public void Setup(Entropynnium gun, PlayerController owner, int mana, float scale, Vector2 velocity) { //IL_001d: 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_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_004a: 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) _gun = gun; _owner = owner; _mana = mana; _setup = true; _velocity = velocity; _basePos = ((Component)this).transform.position; tk2dBaseSprite component = ((Component)this).gameObject.GetComponent(); component.scale = new Vector3(scale, scale, 1f); component.SetGlowiness(100f, ExtendedColours.purple); } private void Update() { //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) //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_003f: 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_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) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017c: 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_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: 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_0099: 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) if (!_setup) { return; } if (!Object.op_Implicit((Object)(object)_owner)) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } Vector2 val = Vector2.op_Implicit(((Component)this).transform.position); Vector2 centerPosition = ((GameActor)_owner).CenterPosition; Vector2 val2 = centerPosition - val; float sqrMagnitude = ((Vector2)(ref val2)).sqrMagnitude; if (sqrMagnitude < 1f) { if (Object.op_Implicit((Object)(object)_gun)) { _gun.UpdateMana(_mana); ((Component)_gun).gameObject.PlayOnce("mana_gather"); } GameObject manaParticlePrefab = Entropynnium._ManaParticlePrefab; float? startScale = 0.5f; float? endScale = 0.2f; Color? emissiveColor = ExtendedColours.purple; CwaffVFX.SpawnBurst(manaParticlePrefab, 4, centerPosition, 1f, null, 2f, 2f, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.Random, 0.2f, null, 100f, emissiveColor, fadeIn: false, uniform: false, startScale, endScale, null, randomFrame: false, -1, flipX: false, flipY: false, null, null, 1.55f, 0f, null, -1, 0f, 0.5f); Object.Destroy((Object)(object)((Component)this).gameObject); } else { float deltaTime = BraveTime.DeltaTime; Vector2 normalized = ((Vector2)(ref val2)).normalized; _homeStrength += 4f * deltaTime; _velocity = Lazy.SmoothestLerp(_velocity, Mathf.Clamp(sqrMagnitude, 10f * _homeStrength, 50f) * normalized, _homeStrength); _basePos += Vector2Extensions.ToVector3ZUp(_velocity * deltaTime, 0f); ((Component)this).transform.position = _basePos.HoverAt(0.3f, 2f); } } } public class ManaExplosionProjectile : Projectile { private const float _DEFAULT_RADIUS = 4f; private float _radius = -1f; private float _forceMult; internal static GameObject _ExplosionPrefab; public void Setup(float radius, float forceMult) { _radius = radius; _forceMult = forceMult; } public override void Start() { ((Projectile)this).Start(); base.m_usesNormalMoveRegardless = true; base.collidesWithEnemies = false; } public override void Move() { Detonate(); ((Projectile)this).DieInAir(true, false, false, false); } private void DoParticles(Vector2 pos, int num) { //IL_0006: 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) GameObject manaParticlePrefab = Entropynnium._ManaParticlePrefab; float? startScale = 0.6f; float? endScale = 0.2f; Color? emissiveColor = ExtendedColours.purple; float? height = 8f; CwaffVFX.SpawnBurst(manaParticlePrefab, num, pos, 1f, null, 8f, 4f, CwaffVFX.Vel.AwayRadial, CwaffVFX.Rot.Random, 0.4f, null, 100f, emissiveColor, fadeIn: false, uniform: false, startScale, endScale, height, randomFrame: false, -1, flipX: false, flipY: false, null, null, 1.55f, 0f, null, -1, 0f, 0.5f); } private void Detonate() { //IL_0021: 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_00fd: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) if (_radius == 0f || !(((Projectile)this).Owner is PlayerController)) { return; } Vector2 center = Vector2.op_Implicit(base.m_transform.position); if (_radius < 0f) { _radius = 4f; } float num = Mathf.Min(_radius / 10.72f, 1f); float num2 = base.baseData.damage * Mathf.Sqrt(_radius); float force = num2 * _forceMult; ExplosionData val = Entropynnium._SmallManaExplosion.Clone(); val.damage = num2; val.force = force; bool flag = false; foreach (AIActor allNearbyEnemy in center.GetAllNearbyEnemies(_radius, ignoreWalls: true, includeDead: false, includeGone: false, includeInvulnerable: true)) { HealthHaver healthHaver = ((BraveBehaviour)allNearbyEnemy).healthHaver; if (healthHaver != null) { val.damage = Mathf.Max(num2, healthHaver.AdjustedMaxHealth * num * ((healthHaver.IsBoss || healthHaver.IsSubboss) ? 0.5f : 1f)); Exploder.Explode(Vector2.op_Implicit(((GameActor)allNearbyEnemy).CenterPosition), val, Vector2.zero, (Action)null, true, (CoreDamageTypes)0, true); DoParticles(((GameActor)allNearbyEnemy).CenterPosition, 32); flag = true; } } if (flag) { ((Component)this).gameObject.Play("mana_detonate"); } } } public class Starmageddon : CwaffGun { public static string ItemName = "Starmageddon"; public static string ShortDescription = "Heavenly Wrath"; public static string LongDescription = "Fires projectiles that orbit the player while fire is held. Projectiles ascend when fire is released and fall upon semi-random enemies after a short delay. Enemies closer to the player are more likely to be targeted."; public static string Lore = "A mythical weapon feared and revered by many as the 'Gun That Shall Fire the Final Shot', it is said to launch projectiles heavenward and rain meteoric destruction upon the lands. Fortunately for humanity, the weapon's projectiles only get to ascend about 50 feet before hitting the Gungeon's ceiling, making it a rare example of a gun that is actually *weakened* by the Gungeon's magic."; internal static ProjectileModule _MasteryModule = null; internal static CwaffTrailController _StarmageddonTrailPrefab = null; internal static CwaffTrailController _MeteorTrailPrefab = null; private static List _EnemyWeights = new List(16); private int _nextIndex; private int _curBatch; private bool _masteryVolleyReplaced; private DamageTypeModifier _fireImmunity; private ListDictionary _EffectiveHealth = new ListDictionary(); public static void Init() { //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0756: Expected O, but got Unknown Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 20; int? chargeFps = 20; int? reloadFps = 30; Gun gunRef; Gun gun2 = gun.SetAttributes((ItemQuality)5, (GunClass)10, 1f, 900, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, chargeFps, null, null, null, null, -1, 0, -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, autoPlay: true, attacksThroughWalls: true).AssignGun(out gunRef); int? clipSize = 30; float? cooldown = 0.125f; float? angleVariance = 15f; float? damage = 11f; float? speed = 60f; float? range = 999999f; GameObject shrapnelVFX = VFX.Create("starmageddon_shrapnel", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); reloadFps = 5; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, angleVariance, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, range, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "starmageddon_bullet", 12, (Anchor)4, 0.5f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: true, invisibleProjectile: false, "starmageddon_fire_sound", null, null, shrapnelVFX, reloadFps)).Attach(); _StarmageddonTrailPrefab = VFX.CreateSpriteTrailObject("starmageddon_trail", 60, null, -1f, 1f / 60f, 1f, destroyOnEmpty: true); _MeteorTrailPrefab = VFX.CreateSpriteTrailObject("starmageddon_meteor_trail", 60, null, -1f, 1f / 60f, 1f, destroyOnEmpty: true); _MasteryModule = GunBuilder.InitSingleProjectileModule(new ProjectileModule(), GunData.New(clipSize: 30, cooldown: 0.125f, angleVariance: 15f, damage: 16f, speed: 60f, range: 999999f, shrapnelMinVelocity: 8f, shrapnelMaxVelocity: 16f, shrapnelVFX: VFX.Create("meteor_shrapnel", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1), shrapnelCount: 10, baseProjectile: Items._38Special.Projectile(), gun: gunRef, shootStyle: (ShootStyle)1, sequenceStyle: (ProjectileSequenceStyle)0, chargeTime: 0f, ammoCost: 1, ammoType: null, customClip: true, force: null, recoil: null, poison: 0f, fire: 1f, freeze: 0f, slow: 0f, collidesWithEnemies: null, ignoreDamageCaps: null, collidesWithProjectiles: null, surviveRigidbodyCollisions: null, collidesWithTilemap: null, sprite: "meteor_projectile", fps: 12, anchor: (Anchor)4, scale: 1f, anchorsChangeColliders: true, fixesScales: true, overrideColliderPixelSizes: null, overrideColliderOffsets: null, bossDamageMult: 1f, destroySound: null, shouldRotate: null, barrageSize: 1, shouldFlipHorizontally: null, shouldFlipVertically: null, useDummyChargeModule: false, invisibleProjectile: false, spawnSound: "starmageddon_fire_sound")); _MasteryModule.projectiles[0].Attach().Attach((Action)delegate(GoopModifier g) { g.goopDefinition = EasyGoopDefinitions.FireDef; g.SpawnGoopOnCollision = true; g.CollisionSpawnRadius = 1f; g.SpawnGoopInFlight = false; }, allowDuplicates: false).Attach((Action)delegate(ExplosiveModifier e) { e.IgnoreQueues = true; e.explosionData = Explosions.DefaultSmall.With(100f, 10f, 10f, 1f, preventPlayerForce: true, shake: false); }, allowDuplicates: false); } public override void Update() { base.Update(); if (BraveTime.DeltaTime == 0f) { return; } PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null) { return; } if (base.Mastered && !_masteryVolleyReplaced) { ((BraveBehaviour)playerOwner).healthHaver.damageTypeModifiers.AddUnique(_fireImmunity); ProjectileVolleyData val = ScriptableObject.CreateInstance(); val.projectiles = new List { ProjectileModule.CreateClone(_MasteryModule, true, -1), ProjectileModule.CreateClone(((GunBehaviour)this).gun.RawSourceVolley.projectiles[1], true, -1) }; ((GunBehaviour)this).gun.RawSourceVolley = val; playerOwner.stats.RecalculateStats(playerOwner, false, false); _masteryVolleyReplaced = true; } if (!((GunBehaviour)this).gun.IsCharging) { if (!((GunBehaviour)this).gun.IsReloading && ((GunBehaviour)this).gun.ClipShotsRemaining < Mathf.Min(((GunBehaviour)this).gun.ClipCapacity, ((GunBehaviour)this).gun.CurrentAmmo)) { ((Component)this).gameObject.PlayOnce("starmageddon_reload_sound"); ((GunBehaviour)this).gun.Reload(); } Reset(); ((GunBehaviour)this).gun.SynchronizeReloadAcrossAllModules(); } } public override void OnReloadPressed(PlayerController player, Gun gun, bool manualReload) { base.OnReloadPressed(player, gun, manualReload); Reset(); } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); Reset(); } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); ((BraveBehaviour)player).healthHaver.damageTypeModifiers.Remove(_fireImmunity); Reset(); } public override void OnSwitchedAwayFromThisGun() { base.OnSwitchedAwayFromThisGun(); Reset(); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((BraveBehaviour)((GunBehaviour)this).PlayerOwner).healthHaver.damageTypeModifiers.Remove(_fireImmunity); } base.OnDestroy(); } public override void OnPlayerPickup(PlayerController player) { //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_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_0025: Expected O, but got Unknown if (_fireImmunity == null) { _fireImmunity = new DamageTypeModifier { damageType = (CoreDamageTypes)4, damageMultiplier = 0f }; } base.OnPlayerPickup(player); } internal GameActor SmartFindTarget(float damage) { //IL_0015: 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_0086: 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) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { return null; } ReadOnlyCollection allNearbyEnemies = ((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition.GetAllNearbyEnemies(); _EnemyWeights.Clear(); for (int i = 0; i < allNearbyEnemies.Count; i++) { AIActor val = allNearbyEnemies[i]; if (!_EffectiveHealth.TryGetValue(val, out var value)) { _EffectiveHealth[val] = (value = ((BraveBehaviour)val).healthHaver.currentHealth); } if (value > 0f - damage) { List enemyWeights = _EnemyWeights; float num = i; Vector2 val2 = ((GameActor)val).CenterPosition - ((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition; enemyWeights.Add(new Vector2(num, 1f / ((Vector2)(ref val2)).sqrMagnitude)); } else { _EnemyWeights.Add(new Vector2((float)i, 0.0001f)); } } if (_EnemyWeights.Count == 0) { return null; } AIActor val3 = allNearbyEnemies[_EnemyWeights.WeightedRandom()]; _EffectiveHealth[val3] = (float)_EffectiveHealth[val3] - damage; return (GameActor)(object)val3; } private void Reset() { if (_nextIndex != 0) { _nextIndex = 0; _curBatch++; _EffectiveHealth.Clear(); } } public int GetNextIndex() { return _nextIndex++; } public int GetBatch() { return _curBatch; } } public class StarmageddonProjectile : MonoBehaviour { private enum State { NEUTRAL, ORBITING, RISING, HANGING, FALLING } private const float ROT_PER_SEC = 2f; private const float REV_PER_SEC = 0.44f; private const float _SPREAD = 2.5f; private PlayerController _owner; private Projectile _projectile; private int _index; private int _batch; private bool _naturalSpawn; private float _spawnTime; private bool _mastered; private State _state; private void Start() { _projectile = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); _spawnTime = BraveTime.ScaledTimeSinceStartup; _projectile.OnDestruction += OnProjectileDestruction; if (Object.op_Implicit((Object)(object)_owner)) { ((MonoBehaviour)this).StartCoroutine(ShootForTheStars()); } } private void OnProjectileDestruction(Projectile p) { if (_mastered) { ((Component)p).gameObject.Play("starmageddon_meteor_impact_sound"); return; } ((Component)p).gameObject.Play("starmageddon_bullet_impact_sound_1"); ((Component)p).gameObject.Play("starmageddon_bullet_impact_sound_2"); } private void Update() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_projectile)) { ((BraveBehaviour)_projectile).transform.localRotation = (-720f * (BraveTime.ScaledTimeSinceStartup - _spawnTime)).EulerZ(); } } private IEnumerator ShootForTheStars() { GameObjectExtensions.SetLayerRecursively(((Component)_projectile).gameObject, LayerMask.NameToLayer("Unoccluded")); Starmageddon sm = ((Component)((GameActor)_owner).CurrentGun).GetComponent(); if (sm != null) { _index = sm.GetNextIndex(); _batch = sm.GetBatch(); _naturalSpawn = true; _mastered = sm.Mastered; } else { sm = null; } if (_mastered) { ((BraveBehaviour)_projectile).sprite.SetGlowiness(1f, Color.red); } else { ((BraveBehaviour)_projectile).sprite.SetGlowiness(70f, Color.yellow); } ((BraveBehaviour)_projectile).specRigidbody.CollideWithTileMap = false; ((BraveBehaviour)_projectile).specRigidbody.CollideWithOthers = false; ((BraveBehaviour)_projectile).specRigidbody.Reinitialize(); yield return (object)new WaitForSeconds(0.125f); _state = State.ORBITING; _projectile.SetSpeed(0.01f); float radius = _projectile.DistanceToOwner() * Random.Range(0.92f, 1.08f); float angle = _projectile.AngleFromOwner(); Position position; if (_naturalSpawn) { float elapsed = 0f; while (_state == State.ORBITING) { if (!Object.op_Implicit((Object)(object)_owner)) { _projectile.DieInAir(false, true, true, false); yield break; } if (!Object.op_Implicit((Object)(object)sm) || sm.GetBatch() != _batch) { _state = State.RISING; break; } position = ((BraveBehaviour)_projectile).specRigidbody.Position; Vector2 pixelVector = ((Position)(ref position)).GetPixelVector2(); Vector2 val = ((GameActor)_owner).CenterPosition + (angle + 158.4f * elapsed).Clamp360().ToVector(radius); ((BraveBehaviour)_projectile).specRigidbody.Position = new Position(val); Vector2 velocity = val - pixelVector; ((BraveBehaviour)_projectile).specRigidbody.Velocity = velocity; ((BraveBehaviour)_projectile).specRigidbody.UpdateColliderPositions(); yield return null; elapsed += BraveTime.DeltaTime; } } _state = State.RISING; yield return (object)new WaitForSeconds(0.25f * Random.value); ((BraveBehaviour)_projectile).sprite.HeightOffGround = 10f; ((BraveBehaviour)_projectile).sprite.UpdateZDepth(); ((BraveBehaviour)_projectile).sprite.renderLayer = 3; DepthLookupManager.ProcessRenderer(((BraveBehaviour)((BraveBehaviour)_projectile).sprite).renderer, (GungeonSortingLayer)2); _projectile.SetSpeed(200f); _projectile.SendInDirection(Vector2.up, true, true); _projectile.baseData.range = float.MaxValue; CwaffTrailController tc = ((BraveBehaviour)(object)_projectile).AddTrail(_mastered ? Starmageddon._MeteorTrailPrefab : Starmageddon._StarmageddonTrailPrefab); ((Component)tc).gameObject.SetGlowiness(10f); yield return null; GameObjectExtensions.SetLayerRecursively(((Component)tc).gameObject, LayerMask.NameToLayer("Unoccluded")); ((Component)tc).gameObject.transform.position = Vector2Extensions.ToVector3ZisY(Vector3Extensions.XY(((Component)tc).gameObject.transform.position), 100f); DepthLookupManager.ProcessRenderer(((BraveBehaviour)((BraveBehaviour)tc).sprite).renderer, (GungeonSortingLayer)2); ((Component)_projectile).gameObject.Play(_mastered ? "starmageddon_meteor_launch_sound" : "starmageddon_bullet_launch_sound"); yield return (object)new WaitForSeconds(0.25f); ((Component)_projectile).gameObject.Play(_mastered ? "starmageddon_meteor_fall_sound" : "starmageddon_bullet_fall_sound"); yield return (object)new WaitForSeconds(0.25f / (Object.op_Implicit((Object)(object)_owner) ? _owner.ProjSpeedMult() : 1f)); _state = State.FALLING; GameActor target = (Object.op_Implicit((Object)(object)sm) ? sm.SmartFindTarget(_projectile.baseData.damage) : FindTarget()); Vector2 val2 = (Object.op_Implicit((Object)(object)target) ? target.CenterPosition : _owner.RandomPosInCurrentRoom()) + Lazy.RandomVector(2.5f * Random.value * (Object.op_Implicit((Object)(object)_owner) ? _owner.AccuracyMult() : 1f)); float num = 150f.AddRandomSpread(10f); float self = 270f.AddRandomSpread(24f); float fallTime = 0.35f.AddRandomSpread(0.25f); Vector2 val3 = val2 - self.ToVector(fallTime * num); ((BraveBehaviour)_projectile).specRigidbody.Position = new Position(val3); ((BraveBehaviour)_projectile).specRigidbody.UpdateColliderPositions(); _projectile.SetSpeed(num); _projectile.SendInDirection(self.ToVector(), true, true); for (float elapsed = 0f; elapsed < fallTime - BraveTime.DeltaTime; elapsed += BraveTime.DeltaTime) { if (Object.op_Implicit((Object)(object)target)) { Vector2 centerPosition = target.CenterPosition; position = ((BraveBehaviour)_projectile).specRigidbody.Position; Vector2 val4 = centerPosition - ((Position)(ref position)).GetPixelVector2(); _projectile.SetSpeed(((Vector2)(ref val4)).magnitude / (fallTime - elapsed)); _projectile.SendInDirection(val4, true, true); } yield return null; } ((BraveBehaviour)_projectile).specRigidbody.CollideWithOthers = true; ((BraveBehaviour)_projectile).specRigidbody.Reinitialize(); yield return null; _projectile.DieInAir(false, true, true, false); } private GameActor FindTarget() { //IL_0018: 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_0072: Unknown result type (might be due to invalid IL or missing references) List list = new List(); List list2 = new List(); int num = 0; foreach (AIActor allNearbyEnemy in ((GameActor)GameManager.Instance.BestActivePlayer).CenterPosition.GetAllNearbyEnemies()) { list.Add(allNearbyEnemy); float num2 = num++; Vector2 val = ((GameActor)allNearbyEnemy).CenterPosition - ((GameActor)_owner).CenterPosition; list2.Add(new Vector2(num2, 1f / ((Vector2)(ref val)).sqrMagnitude)); } if (list.Count != 0) { return (GameActor)(object)list[list2.WeightedRandom()]; } return null; } } public class Uppskeruvel : CwaffGun { public static string ItemName = "Uppskeruvel"; public static string ShortDescription = "Aimless Souls"; public static string LongDescription = "Enemies killed with this gun drop soul fragments proportional to their max health. Collecting these fragments spawns Aimless Souls that will attack enemies shot by this gun. New souls are spawned after collecting 10, 30, 60, 100, 150, etc. fragments."; public static string Lore = "The Gungeon has claimed its share of lives from Gungeoneers and Gundead alike. With a few notable exceptions, their souls wander the Gungeon aimlessly, yearning to bear arms once more. The Uppskeruvel calls out to these Aimless Souls and gives them purpose, transforming them into the projectiles they were always meant to be.\n\n\"By the sweat of your brow you will fire your weapon until your last projectile falls to the ground from whence you were both taken; for gunpowder you are and to gunpowder you will return.\" ~ Gunesis 3:19"; internal const int _MAX_SOULS = 40; internal const int _MAX_DROPS = 500; internal const float _DAMAGE_PER_SOUL = 8f; internal const float _SOUL_LAUNCH_SPEED = 7f; internal const float _SOULS_PER_HEALTH = 0.1f; internal const float _SPAWN_DELAY = 0.1f; internal static GameObject _LostSoulPrefab = null; internal static GameObject _CombatSoulPrefab = null; internal static GameObject _SoulCollectVFX = null; internal static GameObject _SoulExplodePrefab = null; internal static CwaffTrailController _SoulTrailPrefab = null; private static int[] _LevelThresholds = new int[40]; public int souls; private int _level; private bool _spawningSouls; private List _extantSouls = new List(); private List _usedIndices = new List(); private UppskeruvelCombatSoul[] _soulTracker = Enumerable.Repeat(null, 40).ToArray(); public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 24; int? reloadFps = 30; Gun gun2 = gun.SetAttributes((ItemQuality)4, (GunClass)40, 1.25f, 400, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, "uppskeruvel_fire_sound", null, null, -1, -1, -1, null, modulesAreTiers: false, "muzzle_uppskeruvel", 60, 1f, (Anchor)4, -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("uppskeruvel_reload_sound", 4, 22).Attach((Action)null, allowDuplicates: false); int? clipSize = 12; float? cooldown = 0.18f; float? damage = 4f; gun2.InitProjectile(GunData.New(null, null, clipSize, cooldown, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, "uppskeruvel_projectile", 12, (Anchor)3, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, null, null, null, null, null, null, null, null, null, null, "soul_impact_sound")).Attach().CopyAllImpactVFX(Items.SkullSpitter); _SoulTrailPrefab = VFX.CreateSpriteTrailObject("uppskeruvel_soul_trail", 60, null, -1f, 1f / 15f, 2f); _LostSoulPrefab = VFX.Create("poe_soul", 8f, loops: true, -1, 1f, (Anchor)1, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _LostSoulPrefab.AddComponent(); _CombatSoulPrefab = VFX.Create("large_poe_soul", 8f, loops: true, -1, 2f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _CombatSoulPrefab.AddComponent(); _SoulExplodePrefab = VFX.Create("soul_explode", 32f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); _SoulCollectVFX = VFX.Create("soul_collect", 16f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); for (int i = 0; i < 40; i++) { _LevelThresholds[i] = 5 * (i * i + i); } } public override void OnPlayerPickup(PlayerController player) { GameManager.Instance.OnNewLevelFullyLoaded += OnNewFloor; player.OnAnyEnemyReceivedDamage = (Action)Delegate.Combine(player.OnAnyEnemyReceivedDamage, new Action(OnAnyEnemyReceivedDamage)); ((MonoBehaviour)player).StartCoroutine(SpawnSoulsOnceWeCanMove()); base.OnPlayerPickup(player); } public override void OnDroppedByPlayer(PlayerController player) { GameManager.Instance.OnNewLevelFullyLoaded -= OnNewFloor; player.OnAnyEnemyReceivedDamage = (Action)Delegate.Remove(player.OnAnyEnemyReceivedDamage, new Action(OnAnyEnemyReceivedDamage)); base.OnDroppedByPlayer(player); ((MonoBehaviour)this).StopAllCoroutines(); _spawningSouls = false; DestroyExtantCombatSouls(); } public override void OnDestroy() { GameManager.Instance.OnNewLevelFullyLoaded -= OnNewFloor; if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; playerOwner.OnAnyEnemyReceivedDamage = (Action)Delegate.Remove(playerOwner.OnAnyEnemyReceivedDamage, new Action(OnAnyEnemyReceivedDamage)); } ((MonoBehaviour)this).StopAllCoroutines(); DestroyExtantCombatSouls(); base.OnDestroy(); } private void OnAnyEnemyReceivedDamage(float damage, bool fatal, HealthHaver enemy) { PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner == null || !base.Mastered || !Object.op_Implicit((Object)(object)enemy)) { return; } AIActor aiActor = ((BraveBehaviour)enemy).aiActor; if (aiActor == null) { return; } Uppskeruvel gun = playerOwner.GetGun(); if (gun != null) { if (fatal) { DropLostSouls(aiActor, playerOwner.HasSynergy(Synergy.SOUL_SEARCHING)); } else { gun.LaunchAvailableSouls(aiActor); } } } public void AcquireSoul(int n = 1) { souls += n; RecalculateLevel(); for (int i = _extantSouls.Count; i <= _level; i++) { SpawnCombatSoul(); } } private void RecalculateLevel() { while (souls >= _LevelThresholds[_level + 1]) { _level++; } } private void OnNewFloor() { if (Object.op_Implicit((Object)(object)this)) { DestroyExtantCombatSouls(); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((MonoBehaviour)((GunBehaviour)this).PlayerOwner).StartCoroutine(SpawnSoulsOnceWeCanMove()); } } } private IEnumerator SpawnSoulsOnceWeCanMove() { if (_spawningSouls) { yield break; } _spawningSouls = true; while (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) && !((GunBehaviour)this).PlayerOwner.AcceptingNonMotionInput) { yield return null; } if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { RecalculateLevel(); int i = _extantSouls.Count; while (i <= _level) { SpawnCombatSoul(); yield return (object)new WaitForSeconds(0.1f); int num = i + 1; i = num; } _spawningSouls = false; } } private void DestroyExtantCombatSouls() { foreach (int usedIndex in _usedIndices) { _soulTracker[usedIndex] = null; } _usedIndices.Clear(); foreach (UppskeruvelCombatSoul extantSoul in _extantSouls) { if (Object.op_Implicit((Object)(object)extantSoul)) { extantSoul.Despawn(); } } _extantSouls.Clear(); } public int GetNextAvailableIndex(UppskeruvelCombatSoul soul) { for (int i = 0; i < 40; i++) { if (!_usedIndices.Contains(i)) { _usedIndices.Add(i); _soulTracker[i] = soul; return i; } } ETGModConsole.Log((object)" GetNextIndex() FAILED, THIS SHOULD NEVER HAPPEN", false); return -1; } public void LaunchAvailableSouls(AIActor enemy) { int num = Mathf.Min(Mathf.CeilToInt(((BraveBehaviour)enemy).healthHaver.currentHealth / 8f), _usedIndices.Count); if (num == 0) { return; } int num2 = _usedIndices.Max(); int num3 = 0; for (int i = 0; i <= num2; i++) { UppskeruvelCombatSoul uppskeruvelCombatSoul = _soulTracker[i]; if (uppskeruvelCombatSoul != null && uppskeruvelCombatSoul.CanLaunch() && uppskeruvelCombatSoul.index.HasValue) { LaunchCombatSoul(uppskeruvelCombatSoul, enemy, ++num3); if (num3 == num) { break; } } } } private void LaunchCombatSoul(UppskeruvelCombatSoul soul, AIActor enemy, int order) { int value = soul.index.Value; _soulTracker[value] = null; _usedIndices.Remove(value); soul.Launch(enemy, order); } private UppskeruvelCombatSoul SpawnCombatSoul() { //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) UppskeruvelCombatSoul component = _CombatSoulPrefab.Instantiate(Vector2.op_Implicit(((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition)).GetComponent(); _extantSouls.Add(component); component.Setup(((GunBehaviour)this).PlayerOwner, this); return component; } public static void DropLostSouls(AIActor enemy, bool hasSoulSearchingSynergy = 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_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_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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_008a: 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_00c4: Unknown result type (might be due to invalid IL or missing references) Vector2 centerPosition = ((GameActor)enemy).CenterPosition; int num = Mathf.Min(500, Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).healthHaver) ? Mathf.CeilToInt(0.1f * ((BraveBehaviour)enemy).healthHaver.GetMaxHealth()) : 0); if (hasSoulSearchingSynergy) { num *= 2; } bool flag = num >= 50; while (num > 0) { float num2 = Lazy.RandomAngle(); Vector2 val = centerPosition + BraveMathCollege.DegreesToVector(num2, 1f); Vector2 velocity = num2.ToVector(7f * Random.Range(0.8f, 1.2f)); UppskeruvelLostSoul component = _LostSoulPrefab.Instantiate(Vector2.op_Implicit(val)).GetComponent(); if (flag && num >= 10) { num -= 10; component.Setup(velocity, 10, 2f); } else { num--; component.Setup(velocity, 1, 1f); } } } public override void MidGameSerialize(List data, int i) { ((GunBehaviour)this).MidGameSerialize(data, i); data.Add(souls); } public override void MidGameDeserialize(List data, ref int i) { ((GunBehaviour)this).MidGameDeserialize(data, ref i); souls = (int)data[i++]; RecalculateLevel(); } } public class UppskeruvelAmmoDisplay : CustomAmmoDisplay { private Gun _gun; private Uppskeruvel _uppies; private PlayerController _owner; private void Start() { _gun = ((Component)this).GetComponent(); _uppies = ((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; } uic.GunAmmoCountLabel.Text = $"[sprite \"soul_sprite_ui_icon\"][color #6666dd]x{_uppies.souls}[/color]\n{CustomAmmoDisplayExtensions.VanillaAmmoDisplay(_owner)}"; return true; } } public class UppskeruvelProjectile : MonoBehaviour { private Projectile _projectile; private PlayerController _owner; private Uppskeruvel _gun; private void Start() { _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) || !Object.op_Implicit((Object)(object)((GameActor)_owner).CurrentGun)) { return; } Uppskeruvel component = ((Component)((GameActor)_owner).CurrentGun).GetComponent(); if (component != null) { _gun = component; if (!_owner.HasSynergy(Synergy.MASTERY_UPPSKERUVEL)) { Projectile projectile = _projectile; projectile.OnWillKillEnemy = (Action)Delegate.Combine(projectile.OnWillKillEnemy, new Action(OnWillKillEnemy)); Projectile projectile2 = _projectile; projectile2.OnHitEnemy = (Action)Delegate.Combine(projectile2.OnHitEnemy, new Action(OnHitEnemy)); } } } private void OnHitEnemy(Projectile bullet, SpeculativeRigidbody enemy, bool killed) { if (!(!Object.op_Implicit((Object)(object)enemy) || !Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).aiActor) || killed)) { _gun.LaunchAvailableSouls(((BraveBehaviour)enemy).aiActor); } } private void OnWillKillEnemy(Projectile bullet, SpeculativeRigidbody enemy) { if (Object.op_Implicit((Object)(object)enemy) && Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).aiActor) && ((BraveBehaviour)enemy).aiActor.IsHostile()) { Uppskeruvel.DropLostSouls(((BraveBehaviour)enemy).aiActor, _owner.HasSynergy(Synergy.SOUL_SEARCHING)); } } } public class UppskeruvelLostSoul : MonoBehaviour { internal const float _BOB_SPEED = 4f; internal const float _BOB_HEIGHT = 0.2f; private const float _ATTRACT_RADIUS_SQR = 25f; private const float _PICKUP_RADIUS_SQR = 2f; private const float _HOME_ACCEL = 44f; private const float _FRICTION = 0.96f; private const float _MAX_LIFE = 10f; private const float _VFX_GAP = 0.05f; internal static int _UppskeruvelId = -1; private bool _setup; private PlayerController _owner; private float _homeSpeed; private tk2dSprite _sprite; private float _lifetime; private Vector2 _velocity = Vector2.zero; private Vector3 _basePos = Vector2.op_Implicit(Vector2.zero); private int _soulValue = 1; private float _vfxTimer; public void Setup(Vector2 velocity, int soulValue, float scale) { //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_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_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) _sprite = ((Component)this).GetComponent(); _velocity = velocity; _basePos = ((Component)this).transform.position; _setup = true; _soulValue = soulValue; ((tk2dBaseSprite)_sprite).scale = scale * Vector3.one; } private void Update() { //IL_0044: 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_0059: 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_0066: 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_008d: 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_0093: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00b9: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00f8: 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_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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_0329: 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_0368: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) if (!_setup) { return; } float deltaTime = BraveTime.DeltaTime; if (GameManager.Instance.PrimaryPlayer.AcceptingAnyInput) { _lifetime += deltaTime; } Vector2 val2; if (Object.op_Implicit((Object)(object)_owner)) { Vector2 val = ((GameActor)_owner).CenterPosition - Vector3Extensions.XY(((Component)this).transform.position); Vector2 normalized = ((Vector2)(ref val)).normalized; _homeSpeed += 44f * deltaTime; float homeSpeed = _homeSpeed; val2 = ((Vector2)(ref _velocity)).normalized + normalized; _velocity = homeSpeed * Lazy.SmoothestLerp(((Vector2)(ref val2)).normalized, normalized, 10f); _basePos += Vector2Extensions.ToVector3ZUp(_velocity * deltaTime, 0f); ((Component)this).transform.position = _basePos.HoverAt(0.2f, 4f); if ((_vfxTimer += deltaTime) >= 0.05f) { _vfxTimer -= 0.05f; CwaffVFX.Spawn(Outbreak._OutbreakSmokeVFX, ((Component)this).transform.position, Lazy.RandomEulerZ(), Lazy.RandomVector(0.1f), 0.25f, 0.5f); } if (!(((Vector2)(ref val)).sqrMagnitude > 2f)) { _owner.FindGun()?.AcquireSoul(_soulValue); ((Component)this).gameObject.PlayUnique("pickup_poe_soul_sound"); float num = 90f * Random.value; for (int i = 0; i < 4; i++) { CwaffVFX.Spawn(Uppskeruvel._SoulCollectVFX, ((Component)this).transform.position, Lazy.RandomEulerZ(), (num + 90f * (float)i).ToVector(4f), 0.5f, 0.75f); } Object.Destroy((Object)(object)((Component)this).gameObject); } return; } if (((Vector2)(ref _velocity)).sqrMagnitude > 1f) { _velocity *= Mathf.Pow(0.96f, 60f * deltaTime); _basePos += Vector2Extensions.ToVector3ZUp(_velocity * deltaTime, 0f); } else { _velocity = ((Vector2)(ref _velocity)).normalized; } ((Component)this).transform.position = _basePos.HoverAt(0.2f, 4f); if (_lifetime > 10f) { CwaffVFX.SpawnBurst(Outbreak._OutbreakSmokeVFX, 4, Vector2.op_Implicit(((Component)this).transform.position), 0f, Vector2.zero, 0f, 0.5f, CwaffVFX.Vel.Radial, CwaffVFX.Rot.Random, 0.3f, 0.6f); Object.Destroy((Object)(object)((Component)this).gameObject); return; } if (_UppskeruvelId < 0) { _UppskeruvelId = Lazy.PickupId(); } PlayerController[] allPlayers = GameManager.Instance.AllPlayers; foreach (PlayerController val3 in allPlayers) { if (Object.op_Implicit((Object)(object)val3) && ((Behaviour)val3).isActiveAndEnabled && !val3.IsGhost) { val2 = Vector3Extensions.XY(((Component)this).transform.position) - ((GameActor)val3).CenterPosition; if (!(((Vector2)(ref val2)).sqrMagnitude > 25f) && val3.HasGun(_UppskeruvelId)) { _owner = val3; } } } } } public class UppskeruvelCombatSoul : MonoBehaviour { private enum State { SPAWNING, FOLLOWING, PRELAUNCH, SEEKING, VANISH, COOLDOWN, DESPAWNING } public int? index; private const float _SPAWN_TIME = 0.5f; private const float _VANISH_TIME = 0.25f; private const float _LAUNCH_GAP = 0.1f; private const float _COOLDOWN = 3f; private const float _ACCEL_SEC = 0.5f; private const float _HALF_TIME = 0.1f; private const float _SPACING = 0.6f; private bool _setup; private PlayerController _owner; private AIActor _enemy; private Uppskeruvel _gun; private tk2dSprite _sprite; private float _lifetime; private Vector2 _velocity = Vector2.zero; private Vector3 _basePos = Vector2.op_Implicit(Vector2.zero); private Vector3 _targetPos = Vector2.op_Implicit(Vector2.zero); private float _jiggle; private float _timer; private State _state; private CwaffTrailController _trail; public void Setup(PlayerController owner, Uppskeruvel gun) { //IL_0021: 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) _owner = owner; _gun = gun; _sprite = ((Component)this).GetComponent(); _basePos = ((Component)this).transform.position; _timer = 0.5f; _jiggle = Random.Range(-30f, 30f); ((Component)(object)_sprite).SetAlphaImmediate(0f); _trail = ((BraveBehaviour)(object)_sprite).AddTrail(Uppskeruvel._SoulTrailPrefab); ((Component)this).gameObject.Play("soul_spawn_sound"); GameObjectExtensions.SetLayerRecursively(((Component)this).gameObject, LayerMask.NameToLayer("Unoccluded")); _setup = true; } public void Reassign(PlayerController newOwner) { _owner = newOwner; } public void Despawn() { if (_state != State.DESPAWNING) { _timer = 0.25f; _state = State.DESPAWNING; } } private void OnDestroy() { _trail.SafeDestroy(); } private Vector2 BehindPlayer() { //IL_0038: 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) int valueOrDefault = index.GetValueOrDefault(); if (!index.HasValue) { valueOrDefault = _gun.GetNextAvailableIndex(this); index = valueOrDefault; } return ((GameActor)_owner).CenterPosition + (_owner.m_currentGunAngle + 180f + _jiggle).Clamp360().ToVector(1f + 0.6f * (float)index.Value); } private void GlideTowardsTarget() { //IL_0001: 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_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_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) //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_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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) Vector3 val = _targetPos - _basePos; if (((Vector3)(ref val)).sqrMagnitude < 0.00390625f) { _basePos = _targetPos; } else { _basePos = Vector2.op_Implicit(Lazy.SmoothestLerp(Vector2.op_Implicit(_basePos), Vector2.op_Implicit(_targetPos), 10f)); } } private void HomeTowardsTarget() { //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_0013: 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_001e: 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) //IL_003b: 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_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) float deltaTime = BraveTime.DeltaTime; _velocity = Vector3Extensions.XY(_basePos).LerpDirectAndNaturalVelocity(Vector2.op_Implicit(_targetPos), _velocity, 0.5f * deltaTime, 1f); _basePos += Vector2Extensions.ToVector3ZUp(144f * deltaTime * _velocity, 0f); } public bool CanLaunch() { return _state == State.FOLLOWING; } public void Launch(AIActor enemy, int order) { index = null; _enemy = enemy; _state = State.PRELAUNCH; _timer = 0.1f * (float)order; ((Component)this).gameObject.Play("soul_launch_sound"); } private void Update() { //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_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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: 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_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_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: 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) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: 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_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) if (!_setup || BraveTime.DeltaTime == 0f) { return; } _lifetime += BraveTime.DeltaTime; _timer -= BraveTime.DeltaTime; switch (_state) { case State.SPAWNING: ((Component)(object)_sprite).SetAlpha(1f - _timer / 0.5f); _targetPos = Vector2.op_Implicit(BehindPlayer()); if (_timer <= 0f) { _state = State.FOLLOWING; } GlideTowardsTarget(); break; case State.FOLLOWING: _targetPos = Vector2.op_Implicit(BehindPlayer()); GlideTowardsTarget(); break; case State.PRELAUNCH: if (!Object.op_Implicit((Object)(object)_enemy) || !Object.op_Implicit((Object)(object)((BraveBehaviour)_enemy).healthHaver) || !((BraveBehaviour)_enemy).healthHaver.IsAlive) { _state = State.FOLLOWING; break; } if (_timer <= 0f) { _state = State.SEEKING; break; } _targetPos = Vector2.op_Implicit(BehindPlayer()); GlideTowardsTarget(); break; case State.SEEKING: { if (!Object.op_Implicit((Object)(object)_enemy) || !Object.op_Implicit((Object)(object)((BraveBehaviour)_enemy).healthHaver) || !((BraveBehaviour)_enemy).healthHaver.IsAlive) { _state = State.FOLLOWING; break; } _targetPos = Vector2.op_Implicit(((GameActor)_enemy).CenterPosition); HomeTowardsTarget(); Vector3 val = _basePos - _targetPos; if (((Vector3)(ref val)).sqrMagnitude < 2f) { ((BraveBehaviour)_enemy).healthHaver.ApplyDamage(8f, _velocity, "Uppskeruvel Soul", (CoreDamageTypes)0, (DamageCategory)2, false, (PixelCollider)null, false); if (((BraveBehaviour)_enemy).healthHaver.IsDead) { Uppskeruvel.DropLostSouls(_enemy); } SpawnManager.SpawnVFX(Uppskeruvel._SoulExplodePrefab, Vector2.op_Implicit(Vector3Extensions.XY(_targetPos) + Lazy.RandomVector(0.4f)), Quaternion.identity); ((Component)this).gameObject.PlayUnique("soul_impact_sound"); _trail.Toggle(enable: false); _timer = 0.25f; _state = State.VANISH; } break; } case State.VANISH: ((Component)(object)_sprite).SetAlpha(_timer / 0.25f); if (_timer <= 0f) { _timer = 3f; _state = State.COOLDOWN; } break; case State.COOLDOWN: if (_timer <= 0f) { _targetPos = Vector2.op_Implicit(BehindPlayer()); _jiggle = Random.Range(-60f, 60f); _basePos = _targetPos; _trail.Toggle(); _timer = 0.5f; _state = State.SPAWNING; ((Component)this).gameObject.Play("soul_spawn_sound"); ((BraveBehaviour)_sprite).renderer.enabled = true; } else { ((BraveBehaviour)_sprite).renderer.enabled = false; } break; case State.DESPAWNING: ((Component)(object)_sprite).SetAlpha(_timer / 0.25f); if (_timer <= 0f) { Object.Destroy((Object)(object)((Component)this).gameObject); } break; } ((Component)this).transform.position = _basePos.HoverAt(0.2f, 4f); } } public class Alyx : CwaffGun { public static string ItemName = "Alyx"; public static string ShortDescription = "Welcome to the New Age"; public static string LongDescription = "Fires shots that poison and ignite enemies. Current and max ammo decay exponentially, leaving radioactive waste behind in the process. Gun decays completely at 10 max ammo."; public static string Lore = "A little known fact of nuclear chemistry is that sufficiently large quantities of Uranium -- under specific circumstances not fully understood at present -- can decay directly into guns. These guns have extremely limited lifespans before decaying completely into radioactive goo, but their sheer utility in battle make them a prized treasure for experienced gungeoneers who are willing to absorb a few gamma rays in the name of DPS"; internal const float _AMMO_HALF_LIFE_SECS = 90f; internal const float _GUN_HALF_LIFE_SECS = 300f; internal const float _MIN_CALC_RATE = 0.1f; internal const int _BASE_MAX_AMMO = 1000; internal const int _MIN_AMMO_TO_PERSIST = 10; internal static readonly float _AMMO_DECAY_LAMBDA = Mathf.Log(2f) / 90f; internal static readonly float _GUN_DECAY_LAMBDA = Mathf.Log(2f) / 300f; private static DeadlyDeadlyGoopManager _PoisonGooper = null; private DamageTypeModifier _poisonImmunity; public float timeAtLastRecalc = -1f; public static void Init() { //IL_0049: 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) Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 20; int? reloadFps = 20; Color? muzzleLightColor = Color.green; Color? muzzleEmissionColor = new Color(0.5f, 0.5f, 0.5f); Gun gun2 = gun.SetAttributes((ItemQuality)4, (GunClass)10, 0.5f, 1000, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, null, "alyx_reload_sound", null, -1, -1, -1, null, modulesAreTiers: false, "muzzle_alyx", 30, 0.5f, (Anchor)4, 12f, muzzleEmissionColor, 10f, muzzleLit: false, 50f, 0.25f, muzzleLightColor, 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, -1f, canAttackWhileRolling: false, isStarterGun: false, 1f, preventDuctTape: false, 1f).AddToShop((ShopType)0); int? clipSize = 10; float? damage = 15f; float? speed = 20f; bool? uniqueSounds = true; gun2.InitProjectile(GunData.New(null, null, clipSize, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: true, damage, speed, null, null, null, 1f, 1f, 0f, 0f, null, null, null, null, null, "alyx_projectile", 16, (Anchor)4, 0.5625f, anchorsChangeColliders: true, fixesScales: true, null, null, 1f, null, null, 1, null, null, useDummyChargeModule: false, invisibleProjectile: false, "alyx_shoot_sound", null, uniqueSounds)); } private void Start() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0046: Expected O, but got Unknown ((Component)((BraveBehaviour)((GunBehaviour)this).gun).sprite).gameObject.SetGlowiness(50f); RecalculateAmmo(); if (_poisonImmunity == null) { _poisonImmunity = new DamageTypeModifier { damageType = (CoreDamageTypes)16, damageMultiplier = 0f }; } } public override void Update() { base.Update(); ((BraveBehaviour)((BraveBehaviour)((GunBehaviour)this).gun).sprite).renderer.material.SetFloat(CwaffVFX._EmissivePowerId, 50f + 100f * Mathf.Abs(Mathf.Sin(BraveTime.ScaledTimeSinceStartup))); if (!Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { RecalculateAmmo(); } else if (base.Mastered) { ((BraveBehaviour)((GunBehaviour)this).PlayerOwner).healthHaver.damageTypeModifiers.AddUnique(_poisonImmunity); } } public override void OwnedUpdatePlayer(PlayerController player, GunInventory inventory) { ((GunBehaviour)this).OwnedUpdatePlayer(player, inventory); if (Object.op_Implicit((Object)(object)((GunBehaviour)this).gun)) { RecalculateAmmo(); } } public override void OnPlayerPickup(PlayerController player) { base.OnPlayerPickup(player); RecalculateAmmo(); } public override void OnSwitchedToThisGun() { base.OnSwitchedToThisGun(); RecalculateAmmo(); } public override void OnDroppedByPlayer(PlayerController player) { base.OnDroppedByPlayer(player); ((BraveBehaviour)player).healthHaver.damageTypeModifiers.Remove(_poisonImmunity); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((BraveBehaviour)((GunBehaviour)this).PlayerOwner).healthHaver.damageTypeModifiers.Remove(_poisonImmunity); } base.OnDestroy(); } internal static int ComputeExponentialDecay(float startAmount, float lambda, float timeElapsed) { return (startAmount * Mathf.Exp((0f - lambda) * timeElapsed)).RoundWeighted(); } private void RecalculateAmmo() { //IL_0117: 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_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_0192: 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) if (timeAtLastRecalc < 0f) { timeAtLastRecalc = BraveTime.ScaledTimeSinceStartup; } float num = BraveTime.ScaledTimeSinceStartup - timeAtLastRecalc; if (num <= 0.1f) { return; } timeAtLastRecalc = BraveTime.ScaledTimeSinceStartup; float num2 = (base.Mastered ? 0.25f : 1f); int num3 = ComputeExponentialDecay(((GunBehaviour)this).gun.CurrentAmmo, num2 * _AMMO_DECAY_LAMBDA, num); int num4 = ComputeExponentialDecay(((GunBehaviour)this).gun.GetBaseMaxAmmo(), num2 * _GUN_DECAY_LAMBDA, num); if (num3 < ((GunBehaviour)this).gun.CurrentAmmo || num4 < ((GunBehaviour)this).gun.GetBaseMaxAmmo()) { if (!Object.op_Implicit((Object)(object)_PoisonGooper)) { _PoisonGooper = DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(EasyGoopDefinitions.PoisonDef); } if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { _PoisonGooper.AddGoopCircle(Vector3Extensions.XY(((GunBehaviour)this).PlayerOwner.SpriteBottomCenter) - ((GunBehaviour)this).PlayerOwner.m_currentGunAngle.ToVector(), 0.75f, -1, false, -1); } else { _PoisonGooper.AddGoopCircle(((BraveBehaviour)((GunBehaviour)this).gun).sprite.WorldCenter, 1f, -1, false, -1); } if (num3 < ((GunBehaviour)this).gun.CurrentAmmo) { ((GunBehaviour)this).gun.CurrentAmmo = num3; } if (num4 < ((GunBehaviour)this).gun.GetBaseMaxAmmo()) { ((GunBehaviour)this).gun.SetBaseMaxAmmo(num4); } } if (num4 <= 10) { if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner)) { ((GunBehaviour)this).PlayerOwner.inventory.DestroyGun(((GunBehaviour)this).gun); return; } Lazy.DoSmokeAt(Vector2.op_Implicit(((BraveBehaviour)((GunBehaviour)this).gun).sprite.WorldCenter)); Object.Destroy((Object)(object)((Component)((GunBehaviour)this).gun).gameObject); } } public override void MidGameSerialize(List data, int i) { ((GunBehaviour)this).MidGameSerialize(data, i); data.Add(((GunBehaviour)this).gun.GetBaseMaxAmmo()); } public override void MidGameDeserialize(List data, ref int i) { ((GunBehaviour)this).MidGameDeserialize(data, ref i); ((GunBehaviour)this).gun.SetBaseMaxAmmo((int)data[i++]); } } public class Telefragger : CwaffGun { private class TelefraggerAmmoDisplay : CustomAmmoDisplay { private Telefragger _tele; private PlayerController _owner; private void Start() { _tele = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor currentOwner = ((Component)this).GetComponent().CurrentOwner; owner = (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null); } public override bool DoCustomAmmoDisplay(GameUIAmmoController uic) { if (!Object.op_Implicit((Object)(object)_owner) || !Object.op_Implicit((Object)(object)_tele) || !_tele.Mastered || !_tele._teleportReady) { return false; } uic.GunAmmoCountLabel.Text = "[color #bb44dd]Teleport Ready[/color]\n" + CustomAmmoDisplayExtensions.VanillaAmmoDisplay(_owner); return true; } } public static string ItemName = "Telefragger"; public static string ShortDescription = "Voip"; public static string LongDescription = "Fires a beam that teleports the player into an enemy on kill. Teleporting creates a mini blank effect at the destination and briefly grants invulernability and pit immunity. Will not teleport the player off screen in co-op."; public static string Lore = "Many years ago, a Gungeoneer named Jackson Doomquake gained notoriety for dropping firearms on the Gungeon's teleporters as bait for unsuspecting Bullet Kin. While teleporting into Bullet Kin all day proved to be an effective and ammo-efficient method of execution, it also provoked the ire of Bello, who allegedly lost several customers due to the clamor caused by his shop's teleporter constantly activating. The teleporter system was subsequently patched to prevent usage while any Gundead are around, but while Doomquake's exploits are no longer replicable, the Telefragger ensures the spirit of his antics live on."; private const float _MERCY_TIME = 1.5f; private const float _FLICKER_PORTION = 0.5f; private const float _FLICKER_FREQ = 0.1f; private const float _GLOW = 50f; private static VFXPool _TeleportVFX = null; private static GameObject _FloorVFX = null; [SerializeField] internal bool _teleportReady = true; private tk2dSprite m_extantFloor; private bool m_frameWasPartialPit; private bool m_wasAboutToFallLastFrame; private int m_lastFrameAboutToFall; private float _invulnTime; private bool _teleporting; public static void Init() { Gun gun = Lazy.SetupGun(ItemName, ShortDescription, LongDescription, Lore); int? shootFps = 30; int? reloadFps = 4; gun.SetAttributes((ItemQuality)2, (GunClass)20, 0.9f, 600, Items.Banana, defaultAudio: false, infiniteAmmo: false, canGainAmmo: true, canReloadNoMatterAmmo: false, null, null, shootFps, reloadFps, null, null, null, null, null, -1, -1, 12, 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)3).SetFireAudio("telefragger_amp_up_sound", 0, 3, 6, 9).Attach((Action)null, allowDuplicates: false) .InitProjectile(GunData.New(null, Items.DemonHead.Projectile(), -1, 0.18f, 0f, (ShootStyle)2, (ProjectileSequenceStyle)0, 0f, 5, null, customClip: true, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4, 1f, anchorsChangeColliders: true, fixesScales: true, null, null, 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, null, null, null, null, "telefragger_beam", 17, -1, -1, -1, -1, 14, beamLoopCharge: false, 2f, -1, 0.4f)) .Attach(); _TeleportVFX = Items.MagicLamp.AsGun().DefaultModule.projectiles[0].hitEffects.overrideMidairDeathVFX.CreatePoolFromVFXGameObject(); _FloorVFX = ((Component)ItemHelper.Get(Items.RatBoots)).gameObject.GetComponent().FloorVFX; } private void Start() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) ((BraveBehaviour)((GunBehaviour)this).gun).sprite.SetGlowiness(10f, (Color?)new Color(0f, 0.625f, 0.664f, 1f), (Color?)null, (bool?)null, (float?)null); ((BraveBehaviour)((BraveBehaviour)((GunBehaviour)this).gun).sprite).renderer.material.SetFloat(CwaffVFX._EmissiveColorPowerId, 10f); } private bool SynchronizeSpriteWithBeam() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) if (((GunBehaviour)this).gun.m_moduleData == null || !((GunBehaviour)this).gun.m_moduleData.TryGetValue(((GunBehaviour)this).gun.DefaultModule, out var value)) { return false; } if (((GunBehaviour)this).gun.m_activeBeams != null && ((GunBehaviour)this).gun.m_activeBeams.Contains(value)) { BeamController beam = value.beam; BasicBeamController val = (BasicBeamController)(object)((beam is BasicBeamController) ? beam : null); if (val != null) { float num = 0f; if ((int)val.State == 2) { num = 1f; Lazy.PlaySoundUntilDeathOrTimeout("telefragger_fire_loop_sound", ((Component)this).gameObject, 0.1f); } else if ((int)val.State == 0) { num = val.m_chargeTimer / ((BeamController)val).chargeDelay; } Material material = ((BraveBehaviour)((BraveBehaviour)((GunBehaviour)this).gun).sprite).renderer.material; material.shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTintableTiltedCutoutEmissive"); material.SetFloat(CwaffVFX._EmissivePowerId, 50f * num); return true; } } return false; } public override void Update() { //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) base.Update(); if (!SynchronizeSpriteWithBeam()) { ((BraveBehaviour)((BraveBehaviour)((GunBehaviour)this).gun).sprite).renderer.material.shader = ShaderCache.Acquire("Brave/PlayerShader"); } if (Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) && Object.op_Implicit((Object)(object)m_extantFloor)) { ((BraveBehaviour)m_extantFloor).renderer.sharedMaterial.SetVector("_PlayerPos", Vector2Extensions.ToVector4(((GameActor)((GunBehaviour)this).PlayerOwner).CenterPosition)); } if (Time.timeScale <= 0f) { m_lastFrameAboutToFall = Time.frameCount; return; } if (!m_wasAboutToFallLastFrame && Object.op_Implicit((Object)(object)m_extantFloor)) { SpawnManager.Despawn(((Component)m_extantFloor).gameObject); m_extantFloor = null; } m_wasAboutToFallLastFrame = false; if (_invulnTime > 0f) { _invulnTime -= BraveTime.DeltaTime; if (_invulnTime <= 0f) { DisablePitSafety(((GunBehaviour)this).PlayerOwner); } } } private void LateUpdate() { if (Object.op_Implicit((Object)(object)m_extantFloor)) { ((tk2dBaseSprite)m_extantFloor).UpdateZDepth(); } } internal void TeleportPlayerToPosition(PlayerController player, Vector2 target) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 //IL_0053: 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_005d: 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_0062: 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_0045: Unknown result type (might be due to invalid IL or missing references) if (_teleporting) { return; } if ((int)GameManager.Instance.CurrentGameType == 1) { PlayerController otherPlayer = GameManager.Instance.GetOtherPlayer(player); if (Object.op_Implicit((Object)(object)otherPlayer) && !otherPlayer.IsGhost && !GameManager.Instance.MainCameraController.PointIsVisible(target)) { PlayerUtility.DoEasyBlank(player, target, (EasyBlankType)1); return; } } Vector2 start = Vector2.op_Implicit(((BraveBehaviour)player).transform.position); ((MonoBehaviour)player).StartCoroutine(DoPlayerTeleport(player, start, target, 0.125f)); } public override void OnReloadPressed(PlayerController player, Gun gun, bool manualReload) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Invalid comparison between Unknown and I4 //IL_0056: Unknown result type (might be due to invalid IL or missing references) base.OnReloadPressed(player, gun, manualReload); if (!player.IsDodgeRolling && player.AcceptingNonMotionInput && gun.IsFiring && _teleportReady && base.Mastered) { BeamController extantBeam = GetExtantBeam(); BasicBeamController val = (BasicBeamController)(object)((extantBeam is BasicBeamController) ? extantBeam : null); if (val != null && (int)val.State == 2) { _teleportReady = false; TeleportPlayerToPosition(player, val.Endpoint()); } } } private IEnumerator DoPlayerTeleport(PlayerController player, Vector2 start, Vector2 end, float duration) { //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_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) _teleporting = true; GameManager.Instance.MainCameraController.SetManualControl(true, true); Vector2 startCamPos = GameManager.Instance.MainCameraController.GetIdealCameraPosition(); Vector2 deltaPos = end - startCamPos; ((BraveBehaviour)player).transform.position = Vector2.op_Implicit(start); ((BraveBehaviour)player).specRigidbody.Reinitialize(); ((BraveBehaviour)((BraveBehaviour)player).sprite).renderer.enabled = false; ((Behaviour)((BraveBehaviour)player).specRigidbody).enabled = false; ((Component)player).gameObject.Play("Play_OBJ_teleport_depart_01"); _TeleportVFX.SpawnAtPosition(Vector2Extensions.ToVector3ZisY(start, -1f), 0f, (Transform)null, (Vector2?)null, (Vector2?)null, (float?)(-0.05f), false, (SpawnMethod)null, (tk2dBaseSprite)null, false); PlayerUtility.DoEasyBlank(player, end, (EasyBlankType)1); for (float timer = 0f; timer < duration; timer += BraveTime.DeltaTime) { float num = timer / duration; GameManager.Instance.MainCameraController.OverridePosition = Vector2.op_Implicit(startCamPos + num * num * deltaPos); yield return null; } yield return null; ((Component)player).gameObject.Play("Play_OBJ_teleport_depart_01"); _TeleportVFX.SpawnAtPosition(Vector2Extensions.ToVector3ZisY(end, -1f), 0f, (Transform)null, (Vector2?)null, (Vector2?)null, (float?)(-0.05f), false, (SpawnMethod)null, (tk2dBaseSprite)null, false); EnablePitSafety(player); GameManager.Instance.MainCameraController.SetManualControl(false, true); ((BraveBehaviour)player).transform.position = Vector2.op_Implicit(end); ((BraveBehaviour)((BraveBehaviour)player).sprite).renderer.enabled = true; ((Behaviour)((BraveBehaviour)player).specRigidbody).enabled = true; ((BraveBehaviour)player).specRigidbody.Reinitialize(); ((BraveBehaviour)player).specRigidbody.CorrectForWalls(andRigidBodies: true); _teleporting = false; } private void EnablePitSafety(PlayerController player) { if (!Object.op_Implicit((Object)(object)player)) { return; } ((GameActor)player).OnAboutToFall = (Func)Delegate.Combine(((GameActor)player).OnAboutToFall, new Func(HandleAboutToFall)); _invulnTime = 1.5f; Material[] array = player.SetOverrideShader(ShaderCache.Acquire("Brave/Internal/RainbowChestShader")); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)null) { array[i].SetFloat("_AllColorsToggle", 1f); } } ((BraveBehaviour)player).healthHaver.IsVulnerable = false; ((PickupObject)((GunBehaviour)this).gun).CanBeDropped = false; ((PickupObject)((GunBehaviour)this).gun).CanBeSold = false; player.inventory.GunLocked.SetOverride(ItemName, true, (float?)null); } private void DisablePitSafety(PlayerController player) { if (Object.op_Implicit((Object)(object)player)) { ((GameActor)player).OnAboutToFall = (Func)Delegate.Remove(((GameActor)player).OnAboutToFall, new Func(HandleAboutToFall)); _invulnTime = 0f; player.ClearOverrideShader(); ((BraveBehaviour)player).healthHaver.IsVulnerable = true; if (Object.op_Implicit((Object)(object)m_extantFloor)) { SpawnManager.Despawn(((Component)m_extantFloor).gameObject); m_extantFloor = null; } ((PickupObject)((GunBehaviour)this).gun).CanBeDropped = true; ((PickupObject)((GunBehaviour)this).gun).CanBeSold = true; player.inventory.GunLocked.RemoveOverride(ItemName); } } private bool HandleAboutToFall(bool partialPit) { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)((GunBehaviour)this).PlayerOwner) || ((GameActor)((GunBehaviour)this).PlayerOwner).IsFlying) { return false; } m_frameWasPartialPit = partialPit; m_wasAboutToFallLastFrame = true; if (Time.frameCount <= m_lastFrameAboutToFall) { m_lastFrameAboutToFall = Time.frameCount - 1; } m_lastFrameAboutToFall = Time.frameCount; if (_invulnTime <= 0f) { DisablePitSafety(((GunBehaviour)this).PlayerOwner); return true; } if (!Object.op_Implicit((Object)(object)m_extantFloor)) { GameObject obj = SpawnManager.SpawnVFX(_FloorVFX, false); obj.transform.parent = ((BraveBehaviour)((GunBehaviour)this).PlayerOwner).transform; tk2dSprite component = obj.GetComponent(); ((tk2dBaseSprite)component).PlaceAtPositionByAnchor(((GunBehaviour)this).PlayerOwner.SpriteBottomCenter, (Anchor)4); ((tk2dBaseSprite)component).IsPerpendicular = false; ((tk2dBaseSprite)component).HeightOffGround = -2.25f; ((tk2dBaseSprite)component).UpdateZDepth(); m_extantFloor = component; } if (_invulnTime < 0.5f) { ((BraveBehaviour)m_extantFloor).renderer.enabled = Mathf.PingPong(0.5f - _invulnTime, 0.2f) < 0.1f; } else { ((BraveBehaviour)m_extantFloor).renderer.enabled = true; } return false; } } public class TelefragJuice : MonoBehaviour { private Projectile _projectile; private void Start() { _projectile = ((Component)this).GetComponent(); Projectile projectile = _projectile; projectile.OnHitEnemy = (Action)Delegate.Combine(projectile.OnHitEnemy, new Action(OnHitEnemy)); } private void OnHitEnemy(Projectile proj, SpeculativeRigidbody other, bool willKill) { //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_009b: Unknown result type (might be due to invalid IL or missing references) if (!willKill) { return; } GameActor owner = _projectile.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val == null) { return; } AIActor component = ((Component)other).gameObject.GetComponent(); if (component == null) { return; } HealthHaver healthHaver = ((BraveBehaviour)component).healthHaver; if (healthHaver != null && !healthHaver.IsBoss && !healthHaver.IsSubboss) { Telefragger telefragger = null; Gun currentGun = ((GameActor)val).CurrentGun; if (currentGun != null) { telefragger = ((Component)currentGun).gameObject.GetComponent(); } if (Object.op_Implicit((Object)(object)telefragger)) { telefragger._teleportReady = true; } Vector2 centerPosition = ((GameActor)component).CenterPosition; ((BraveBehaviour)val).specRigidbody.RegisterTemporaryCollisionException(other, 2f, (float?)null); if (Object.op_Implicit((Object)(object)telefragger)) { telefragger.TeleportPlayerToPosition(val, centerPosition); } } } } public class CwaffDungeons { [HarmonyPatch(typeof(GameManager), "LoadCustomLevel")] private class ReregisterOurCustomLevelIfNecessaryPatch { private static void Prefix(GameManager __instance, string custom) { if (Flows.TryGetValue(custom, out var value) && value.gameLevelDefinition != null && !GameManager.Instance.customFloors.Contains(value.gameLevelDefinition)) { GameManager.Instance.customFloors.Add(value.gameLevelDefinition); } } } [HarmonyPatch(typeof(DungeonDatabase), "GetOrLoadByName")] private class GetOrLoadCustomDungeonPatch { private static bool Prefix(string name, ref Dungeon __result) { if (!Flows.TryGetValue(name, out var value)) { return true; } if (value.gameLevelDefinition != null && !GameManager.Instance.customFloors.Contains(value.gameLevelDefinition)) { GameManager.Instance.customFloors.Add(value.gameLevelDefinition); } Dungeon val = null; if (name.ToLower() == value.internalName) { try { val = value.dungeonGenerator(GetOrLoadByName_Orig(value.dungeonPrefabTemplate ?? "Base_Gungeon")); } catch (Exception) { } } if (!Object.op_Implicit((Object)(object)val)) { return true; } __result = val; return false; } } [HarmonyPatch(typeof(FlowDatabase), "GetOrLoadByName")] private class LoadCustomFlowPatch { private static bool Prefix(string name, ref DungeonFlow __result) { if (_KnownFlows == null || _KnownFlows.Count <= 0) { return true; } string text = name.ToLower(); if (text.Contains("/")) { text = text.Substring(text.LastIndexOf("/") + 1); } foreach (DungeonFlow knownFlow in _KnownFlows) { if (!string.IsNullOrEmpty(((Object)knownFlow).name) && text == ((Object)knownFlow).name.ToLower()) { __result = knownFlow; return false; } } return true; } } internal static List _KnownFlows; public string internalName; public string floorName; public string floorMusic; public int loopPoint = -1; public int rewindAmount = -1; public string dungeonPrefabTemplate; public GameLevelDefinition gameLevelDefinition; public Func dungeonGenerator; public static Dictionary Flows = new Dictionary(); internal static string _LastCustomMusic = null; internal static uint _LastCustomMusicId = 0u; public static void InitDungeonFlows(AssetBundle sharedAssets2, bool refreshFlows = false) { _KnownFlows = new List { SansDungeonFlow.Init() }; } public static CwaffDungeons Register(string internalName, string floorName, Func dungeonGenerator, string dungeonPrefabTemplate = null, GameLevelDefinition gameLevelDefinition = null, string floorMusic = null, int loopPoint = -1, int rewindAmount = -1) { if (Flows.ContainsKey(internalName)) { return Flows[internalName]; } foreach (GameLevelDefinition customFloor in GameManager.Instance.customFloors) { if (customFloor.dungeonSceneName == internalName) { gameLevelDefinition = customFloor; } } GameManager.Instance.customFloors.Add(gameLevelDefinition); ResourceManager.LoadAssetBundle("brave_resources_001").LoadAsset("_GameManager").GetComponent() .customFloors.Add(gameLevelDefinition); Flows[internalName] = new CwaffDungeons { internalName = internalName, floorName = floorName, floorMusic = floorMusic, loopPoint = loopPoint, rewindAmount = rewindAmount, dungeonPrefabTemplate = dungeonPrefabTemplate, gameLevelDefinition = gameLevelDefinition, dungeonGenerator = dungeonGenerator }; return Flows[internalName]; } public static Dungeon GetOrLoadByName_Orig(string name) { return ResourceManager.LoadAssetBundle("dungeons/" + name.ToLower()).LoadAsset(name).GetComponent(); } internal static void PlayCustomFloorMusicDelayed(float delay = 0f) { ((MonoBehaviour)GameManager.Instance.DungeonMusicController).StartCoroutine(PlayCustomFloorMusicDelayedCR(delay)); static IEnumerator PlayCustomFloorMusicDelayedCR(float num = 0f) { yield return (object)new WaitForSeconds(num); PlayCustomFloorMusic(); } } private static bool IsMusicPlaying(uint id) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 int num = default(int); return (int)AkSoundEngine.GetSourcePlayPosition(id, ref num) == 1; } internal static void PlayCustomFloorMusic() { Dungeon dungeon = GameManager.Instance.Dungeon; foreach (CwaffDungeons value in Flows.Values) { if (!(dungeon.DungeonFloorName != value.floorName)) { if (!string.IsNullOrEmpty(value.floorMusic) && (value.floorMusic != _LastCustomMusic || !IsMusicPlaying(_LastCustomMusicId))) { _LastCustomMusicId = GameManager.Instance.DungeonMusicController.LoopMusic(value.floorMusic, value.loopPoint, value.rewindAmount); } _LastCustomMusic = value.floorMusic; return; } } _LastCustomMusic = null; } } public static class OneOffDebugDungeonFlow { private static DungeonFlow _CurrentCustomDebugFlow = null; private static readonly string DEBUG_FLOW_NAME = "cwaff_debug_flow"; public static void TestSingleRoom(PrototypeDungeonRoom theRoom) { //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_002a: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown _CurrentCustomDebugFlow = CreateFlowWithSingleTestRoom(theRoom); ((Object)_CurrentCustomDebugFlow).name = DEBUG_FLOW_NAME; GameLevelDefinition gameLevelDefinition = new GameLevelDefinition { dungeonSceneName = DEBUG_FLOW_NAME, dungeonPrefabPath = DEBUG_FLOW_NAME, flowEntries = new List(), predefinedSeeds = new List() }; CwaffDungeons.Register(DEBUG_FLOW_NAME, DEBUG_FLOW_NAME, OneOffDungeonGenerator, null, gameLevelDefinition); GameManager.Instance.LoadCustomLevel(DEBUG_FLOW_NAME); } private static DungeonFlowNode Sanitize(this DungeonFlowNode node) { DungeonFlowNode val = node; if (val.subchainIdentifiers == null) { val.subchainIdentifiers = new List(); } val = node; if (val.chainRules == null) { val.chainRules = new List(); } return node; } private static Dungeon OneOffDungeonGenerator(Dungeon dungeon) { //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_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_0037: Expected O, but got Unknown dungeon.PatternSettings = new SemioticDungeonGenSettings { flows = new List { _CurrentCustomDebugFlow }, mandatoryExtraRooms = new List(), optionalExtraRooms = new List() }; return dungeon; } private static DungeonFlow CreateFlowWithSingleTestRoom(PrototypeDungeonRoom theRoom) { //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_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_0022: Expected O, but got Unknown //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_0035: Expected O, but got Unknown //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_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_0053: Expected O, but got Unknown DungeonFlow obj = ScriptableObject.CreateInstance(); DungeonFlowNode val = Sanitize(new DungeonFlowNode(obj) { roomCategory = (RoomCategory)7, overrideExactRoom = CwaffDungeonPrefabs.elevator_entrance }); DungeonFlowNode val2 = Sanitize(new DungeonFlowNode(obj) { overrideExactRoom = theRoom }); DungeonFlowNode val3 = Sanitize(new DungeonFlowNode(obj) { roomCategory = (RoomCategory)8, overrideExactRoom = CwaffDungeonPrefabs.exit_room_basic }); obj.fallbackRoomTable = null; obj.subtypeRestrictions = new List(); obj.flowInjectionData = new List(); obj.sharedInjectionData = new List(); obj.FirstNode = val; obj.Initialize(); obj.AddNodeToFlow(val, (DungeonFlowNode)null); obj.AddNodeToFlow(val2, val); obj.AddNodeToFlow(val3, val2); return obj; } } public class SansDungeon { public const string INTERNAL_NAME = "cg_sansfloor"; public const string FLOOR_NAME = "Odd Corridor"; public const string FLOOR_SUB = "Unknown Location"; public const string PREFAB_TEMPLATE = "Base_ResourcefulRat"; public static GameLevelDefinition FloorNameDefinition; public static GameObject GameManagerObject; public static tk2dSpriteCollectionData goheckyourself; public static void Init() { //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_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_0026: 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_003c: 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_0052: 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_006f: Expected O, but got Unknown FloorNameDefinition = new GameLevelDefinition { dungeonSceneName = "cg_sansfloor", dungeonPrefabPath = "cg_sansfloor", priceMultiplier = 1.5f, secretDoorHealthMultiplier = 1f, enemyHealthMultiplier = 2f, damageCap = 300f, bossDpsCap = 78f, flowEntries = new List(0), predefinedSeeds = new List(0) }; CwaffDungeons.Register("cg_sansfloor", "Odd Corridor", SansGeon, "Base_ResourcefulRat", FloorNameDefinition, "sans", 48800, 48800); } public static Dungeon SansGeon(Dungeon dungeon) { //IL_013d: 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_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0185: 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_0194: 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_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Expected O, but got Unknown //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: 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_0218: 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_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0237: 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_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0256: 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_0269: Expected O, but got Unknown //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Expected O, but got Unknown //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_032c: 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_034e: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Expected O, but got Unknown //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Expected O, but got Unknown //IL_0442: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Expected O, but got Unknown //IL_05cc: Unknown result type (might be due to invalid IL or missing references) //IL_05d1: Unknown result type (might be due to invalid IL or missing references) Dungeon orLoadByName_Orig = CwaffDungeons.GetOrLoadByName_Orig("Base_Mines"); Dungeon orLoadByName_Orig2 = CwaffDungeons.GetOrLoadByName_Orig("Base_Catacombs"); Dungeon orLoadByName_Orig3 = CwaffDungeons.GetOrLoadByName_Orig("Base_ResourcefulRat"); DungeonMaterial val = Object.Instantiate(orLoadByName_Orig3.roomMaterialDefinitions[0]); val.supportsPits = true; val.doPitAO = false; val.useLighting = true; val.lightPrefabs.elements[0].rawGameObject = orLoadByName_Orig.roomMaterialDefinitions[0].lightPrefabs.elements[0].rawGameObject; val.roomFloorBorderGrid = orLoadByName_Orig.roomMaterialDefinitions[0].roomFloorBorderGrid; val.pitLayoutGrid = orLoadByName_Orig.roomMaterialDefinitions[0].pitLayoutGrid; val.pitBorderFlatGrid = orLoadByName_Orig.roomMaterialDefinitions[0].pitBorderFlatGrid; DungeonTileStampData val2 = ScriptableObject.CreateInstance(); ((Object)val2).name = "ENV_FloorName_STAMP_DATA"; val2.tileStampWeight = 0f; val2.spriteStampWeight = 0f; val2.objectStampWeight = 1f; val2.stamps = (TileStampData[])(object)new TileStampData[0]; val2.spriteStamps = (SpriteStampData[])(object)new SpriteStampData[0]; val2.objectStamps = orLoadByName_Orig3.stampData.objectStamps; val2.SymmetricFrameChance = 0.25f; val2.SymmetricCompleteChance = 0.6f; ((Object)((Component)dungeon).gameObject).name = "cg_sansfloor"; dungeon.contentSource = (ContentSource)4; dungeon.DungeonSeed = 0; dungeon.DungeonFloorName = "Odd Corridor"; dungeon.DungeonShortName = "Odd Corridor"; dungeon.DungeonFloorLevelTextOverride = "Unknown Location"; dungeon.LevelOverrideType = (LevelOverrideState)0; dungeon.debugSettings = new DebugDungeonSettings { RAPID_DEBUG_DUNGEON_ITERATION_SEEKER = false, RAPID_DEBUG_DUNGEON_ITERATION = false, RAPID_DEBUG_DUNGEON_COUNT = 50, GENERATION_VIEWER_MODE = false, FULL_MINIMAP_VISIBILITY = false, COOP_TEST = false, DISABLE_ENEMIES = false, DISABLE_LOOPS = false, DISABLE_SECRET_ROOM_COVERS = false, DISABLE_OUTLINES = false, WALLS_ARE_PITS = false }; dungeon.ForceRegenerationOfCharacters = false; dungeon.ActuallyGenerateTilemap = true; if (goheckyourself == null) { goheckyourself = orLoadByName_Orig3.tileIndices.dungeonCollection; } dungeon.tileIndices = new TileIndices { tilesetId = (ValidTilesets)32768, dungeonCollection = orLoadByName_Orig3.tileIndices.dungeonCollection, dungeonCollectionSupportsDiagonalWalls = false, aoTileIndices = orLoadByName_Orig3.tileIndices.aoTileIndices, placeBorders = true, placePits = false, chestHighWallIndices = new List { new TileIndexVariant { index = 41, likelihood = 0.5f, overrideLayerIndex = 0, overrideIndex = 0 } }, decalIndexGrid = null, patternIndexGrid = orLoadByName_Orig3.tileIndices.patternIndexGrid, globalSecondBorderTiles = new List(0), edgeDecorationTiles = null }; ((Object)dungeon.tileIndices.dungeonCollection).name = "ENV_FloorName_Collection"; dungeon.roomMaterialDefinitions = (DungeonMaterial[])(object)new DungeonMaterial[7] { val, val, val, val, val, val, val }; dungeon.dungeonWingDefinitions = (DungeonWingDefinition[])(object)new DungeonWingDefinition[0]; dungeon.pathGridDefinitions = new List { orLoadByName_Orig.pathGridDefinitions[0] }; dungeon.dungeonDustups = new DustUpVFX { runDustup = orLoadByName_Orig.dungeonDustups.runDustup, waterDustup = orLoadByName_Orig.dungeonDustups.waterDustup, additionalWaterDustup = orLoadByName_Orig.dungeonDustups.additionalWaterDustup, rollNorthDustup = orLoadByName_Orig.dungeonDustups.rollNorthDustup, rollNorthEastDustup = orLoadByName_Orig.dungeonDustups.rollNorthEastDustup, rollEastDustup = orLoadByName_Orig.dungeonDustups.rollEastDustup, rollSouthEastDustup = orLoadByName_Orig.dungeonDustups.rollSouthEastDustup, rollSouthDustup = orLoadByName_Orig.dungeonDustups.rollSouthDustup, rollSouthWestDustup = orLoadByName_Orig.dungeonDustups.rollSouthWestDustup, rollWestDustup = orLoadByName_Orig.dungeonDustups.rollWestDustup, rollNorthWestDustup = orLoadByName_Orig.dungeonDustups.rollNorthWestDustup, rollLandDustup = orLoadByName_Orig.dungeonDustups.rollLandDustup }; dungeon.PatternSettings = new SemioticDungeonGenSettings { flows = new List { SansDungeonFlow.Init() }, mandatoryExtraRooms = new List(0), optionalExtraRooms = new List(0), MAX_GENERATION_ATTEMPTS = 250, DEBUG_RENDER_CANVASES_SEPARATELY = false }; dungeon.damageTypeEffectMatrix = orLoadByName_Orig.damageTypeEffectMatrix; dungeon.stampData = val2; dungeon.UsesCustomFloorIdea = false; dungeon.FloorIdea = new RobotDaveIdea { ValidEasyEnemyPlaceables = (DungeonPlaceable[])(object)new DungeonPlaceable[0], ValidHardEnemyPlaceables = (DungeonPlaceable[])(object)new DungeonPlaceable[0], UseWallSawblades = false, UseRollingLogsVertical = true, UseRollingLogsHorizontal = true, UseFloorPitTraps = false, UseFloorFlameTraps = true, UseFloorSpikeTraps = true, UseFloorConveyorBelts = true, UseCaveIns = true, UseAlarmMushrooms = false, UseChandeliers = true, UseMineCarts = false, CanIncludePits = false }; dungeon.PlaceDoors = true; dungeon.doorObjects = orLoadByName_Orig2.doorObjects; dungeon.oneWayDoorObjects = orLoadByName_Orig.oneWayDoorObjects; dungeon.oneWayDoorPressurePlate = orLoadByName_Orig.oneWayDoorPressurePlate; dungeon.phantomBlockerDoorObjects = orLoadByName_Orig.phantomBlockerDoorObjects; dungeon.UsesWallWarpWingDoors = false; dungeon.baseChestContents = orLoadByName_Orig2.baseChestContents; dungeon.SecretRoomSimpleTriggersFacewall = new List { orLoadByName_Orig2.SecretRoomSimpleTriggersFacewall[0] }; dungeon.SecretRoomSimpleTriggersSidewall = new List { orLoadByName_Orig2.SecretRoomSimpleTriggersSidewall[0] }; dungeon.SecretRoomComplexTriggers = new List(0); dungeon.SecretRoomDoorSparkVFX = orLoadByName_Orig2.SecretRoomDoorSparkVFX; dungeon.SecretRoomHorizontalPoofVFX = orLoadByName_Orig2.SecretRoomHorizontalPoofVFX; dungeon.SecretRoomVerticalPoofVFX = orLoadByName_Orig2.SecretRoomVerticalPoofVFX; dungeon.sharedSettingsPrefab = orLoadByName_Orig2.sharedSettingsPrefab; dungeon.NormalRatGUID = string.Empty; dungeon.BossMasteryTokenItemId = orLoadByName_Orig2.BossMasteryTokenItemId; dungeon.UsesOverrideTertiaryBossSets = false; dungeon.OverrideTertiaryRewardSets = new List(0); dungeon.defaultPlayerPrefab = orLoadByName_Orig.defaultPlayerPrefab; dungeon.StripPlayerOnArrival = false; dungeon.SuppressEmergencyCrates = false; dungeon.SetTutorialFlag = false; dungeon.PlayerIsLight = true; dungeon.PlayerLightColor = orLoadByName_Orig2.PlayerLightColor; dungeon.PlayerLightIntensity = 4f; dungeon.PlayerLightRadius = 4f; dungeon.PrefabsToAutoSpawn = (GameObject[])(object)new GameObject[0]; dungeon.musicEventName = "fakedummymusiceventthatdoesntexist"; orLoadByName_Orig2 = null; orLoadByName_Orig3 = null; orLoadByName_Orig = null; return dungeon; } } public class SansDungeonFlow { public static DungeonFlow Init() { //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_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_001a: 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_0021: 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_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_003e: 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_004c: 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_005e: 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_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_007f: 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_0088: 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_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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00ce: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_00fe: 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_0120: Expected O, but got Unknown //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_012d: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0171: 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_018b: 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) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: 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) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: 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_01fa: 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_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Expected O, but got Unknown //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: 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_0242: 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_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: 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_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0292: 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_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: 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_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: 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_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_030d: 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_0324: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Expected O, but got Unknown DungeonFlow val = ScriptableObject.CreateInstance(); DungeonFlowNode val2 = new DungeonFlowNode(val) { isSubchainStandin = false, nodeType = (ControlNodeType)0, roomCategory = (RoomCategory)0, percentChance = 1f, priority = (NodePriority)0, overrideExactRoom = CwaffDungeonPrefabs.elevator_entrance, overrideRoomTable = null, capSubchain = false, subchainIdentifier = string.Empty, limitedCopiesOfSubchain = false, maxCopiesOfSubchain = 1, subchainIdentifiers = new List(0), receivesCaps = false, isWarpWingEntrance = false, handlesOwnWarping = false, forcedDoorType = (ForcedDoorType)0, loopForcedDoorType = (ForcedDoorType)0, nodeExpands = false, initialChainPrototype = "n", chainRules = new List(0), minChainLength = 3, maxChainLength = 8, minChildrenToBuild = 1, maxChildrenToBuild = 1, canBuildDuplicateChildren = false, parentNodeGuid = string.Empty, childNodeGuids = new List(0), loopTargetNodeGuid = string.Empty, loopTargetIsOneWay = false, guidAsString = Guid.NewGuid().ToString(), flow = val }; DungeonFlowNode val3 = new DungeonFlowNode(val) { isSubchainStandin = false, nodeType = (ControlNodeType)0, roomCategory = (RoomCategory)0, percentChance = 1f, priority = (NodePriority)0, overrideExactRoom = SansBoss.SansBossRoom, overrideRoomTable = null, capSubchain = false, subchainIdentifier = string.Empty, limitedCopiesOfSubchain = false, maxCopiesOfSubchain = 1, subchainIdentifiers = new List(0), receivesCaps = false, isWarpWingEntrance = false, handlesOwnWarping = false, forcedDoorType = (ForcedDoorType)0, loopForcedDoorType = (ForcedDoorType)0, nodeExpands = false, initialChainPrototype = "n", chainRules = new List(0), minChainLength = 3, maxChainLength = 8, minChildrenToBuild = 1, maxChildrenToBuild = 1, canBuildDuplicateChildren = false, parentNodeGuid = string.Empty, childNodeGuids = new List(0), loopTargetNodeGuid = string.Empty, loopTargetIsOneWay = false, guidAsString = Guid.NewGuid().ToString() }; DungeonFlowNode val4 = new DungeonFlowNode(val) { isSubchainStandin = false, nodeType = (ControlNodeType)0, roomCategory = (RoomCategory)8, percentChance = 1f, priority = (NodePriority)0, overrideExactRoom = CwaffDungeonPrefabs.exit_room_basic, overrideRoomTable = null, capSubchain = false, subchainIdentifier = string.Empty, limitedCopiesOfSubchain = false, maxCopiesOfSubchain = 1, subchainIdentifiers = new List(0), receivesCaps = false, isWarpWingEntrance = false, handlesOwnWarping = false, forcedDoorType = (ForcedDoorType)0, loopForcedDoorType = (ForcedDoorType)0, nodeExpands = false, initialChainPrototype = "n", chainRules = new List(0), minChainLength = 3, maxChainLength = 8, minChildrenToBuild = 1, maxChildrenToBuild = 1, canBuildDuplicateChildren = false, parentNodeGuid = string.Empty, childNodeGuids = new List(0), loopTargetNodeGuid = string.Empty, loopTargetIsOneWay = false, guidAsString = Guid.NewGuid().ToString(), flow = val }; ((Object)val).name = "cg_sansfloor_flow"; val.fallbackRoomTable = CwaffDungeonPrefabs.SewersRoomTable; val.subtypeRestrictions = new List(0); val.flowInjectionData = new List(0); val.sharedInjectionData = new List(0); val.Initialize(); val.AddNodeToFlow(val2, (DungeonFlowNode)null); val.AddNodeToFlow(val3, val2); val.AddNodeToFlow(val4, val3); val.FirstNode = val2; return val; } } public class CwaffDungeonPrefabs { public static PrototypeDungeonRoom elevator_entrance; public static PrototypeDungeonRoom exit_room_basic; public static GenericRoomTable SewersRoomTable; public static void InitCustomPrefabs(AssetBundle sharedAssets, AssetBundle sharedAssets2, AssetBundle braveResources, AssetBundle enemiesBase) { Dungeon orLoadByName = DungeonDatabase.GetOrLoadByName("Base_Sewer"); elevator_entrance = sharedAssets2.LoadAsset("elevator entrance"); exit_room_basic = sharedAssets2.LoadAsset("exit_room_basic"); SewersRoomTable = orLoadByName.PatternSettings.flows[0].fallbackRoomTable; } } public class ArmisticeDungeon { public const string INTERNAL_NAME = "cg_armisticefloor"; public const string FLOOR_NAME = "Abbey of the True Gun?"; public const string FLOOR_SHORT_NAME = "Abbey?"; public const string FLOOR_SUB = "A Timeless Place"; public const string PREFAB_TEMPLATE = "Base_Cathedral"; public static GameLevelDefinition FloorNameDefinition; public static GameObject GameManagerObject; public static tk2dSpriteCollectionData goheckyourself; public static void Init() { //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_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_0026: 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_003c: 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_0052: 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_006f: Expected O, but got Unknown FloorNameDefinition = new GameLevelDefinition { dungeonSceneName = "cg_armisticefloor", dungeonPrefabPath = "cg_armisticefloor", priceMultiplier = 1.5f, secretDoorHealthMultiplier = 1f, enemyHealthMultiplier = 2f, damageCap = 300f, bossDpsCap = 78f, flowEntries = new List(0), predefinedSeeds = new List(0) }; CwaffDungeons.Register("cg_armisticefloor", "Abbey of the True Gun?", ArmisticeGeon, "Base_Cathedral", FloorNameDefinition, "clocktowers", 210239, 182080); } public static Dungeon ArmisticeGeon(Dungeon dungeon) { //IL_013d: 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_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0185: 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_0194: 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_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Expected O, but got Unknown //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //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) //IL_020d: 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_0225: 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) //IL_0233: 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_0247: 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_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Expected O, but got Unknown //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Expected O, but got Unknown //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Expected O, but got Unknown //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Expected O, but got Unknown //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Expected O, but got Unknown //IL_05c8: Unknown result type (might be due to invalid IL or missing references) //IL_05cd: Unknown result type (might be due to invalid IL or missing references) Dungeon orLoadByName_Orig = CwaffDungeons.GetOrLoadByName_Orig("Base_Mines"); Dungeon orLoadByName_Orig2 = CwaffDungeons.GetOrLoadByName_Orig("Base_Catacombs"); Dungeon orLoadByName_Orig3 = CwaffDungeons.GetOrLoadByName_Orig("Base_Cathedral"); DungeonMaterial val = Object.Instantiate(orLoadByName_Orig3.roomMaterialDefinitions[0]); val.supportsPits = true; val.doPitAO = false; val.useLighting = true; val.lightPrefabs.elements[0].rawGameObject = orLoadByName_Orig.roomMaterialDefinitions[0].lightPrefabs.elements[0].rawGameObject; val.roomFloorBorderGrid = orLoadByName_Orig.roomMaterialDefinitions[0].roomFloorBorderGrid; val.pitLayoutGrid = orLoadByName_Orig.roomMaterialDefinitions[0].pitLayoutGrid; val.pitBorderFlatGrid = orLoadByName_Orig.roomMaterialDefinitions[0].pitBorderFlatGrid; DungeonTileStampData val2 = ScriptableObject.CreateInstance(); ((Object)val2).name = "ENV_FloorName_STAMP_DATA"; val2.tileStampWeight = 0f; val2.spriteStampWeight = 0f; val2.objectStampWeight = 1f; val2.stamps = (TileStampData[])(object)new TileStampData[0]; val2.spriteStamps = (SpriteStampData[])(object)new SpriteStampData[0]; val2.objectStamps = orLoadByName_Orig3.stampData.objectStamps; val2.SymmetricFrameChance = 0.25f; val2.SymmetricCompleteChance = 0.6f; ((Object)((Component)dungeon).gameObject).name = "cg_armisticefloor"; dungeon.contentSource = (ContentSource)4; dungeon.DungeonSeed = 0; dungeon.DungeonFloorName = "Abbey of the True Gun?"; dungeon.DungeonShortName = "Abbey?"; dungeon.DungeonFloorLevelTextOverride = "A Timeless Place"; dungeon.LevelOverrideType = (LevelOverrideState)0; dungeon.debugSettings = new DebugDungeonSettings { RAPID_DEBUG_DUNGEON_ITERATION_SEEKER = false, RAPID_DEBUG_DUNGEON_ITERATION = false, RAPID_DEBUG_DUNGEON_COUNT = 50, GENERATION_VIEWER_MODE = false, FULL_MINIMAP_VISIBILITY = false, COOP_TEST = false, DISABLE_ENEMIES = false, DISABLE_LOOPS = false, DISABLE_SECRET_ROOM_COVERS = false, DISABLE_OUTLINES = false, WALLS_ARE_PITS = false }; dungeon.ForceRegenerationOfCharacters = false; dungeon.ActuallyGenerateTilemap = true; if (goheckyourself == null) { goheckyourself = orLoadByName_Orig3.tileIndices.dungeonCollection; } dungeon.tileIndices = new TileIndices { tilesetId = (ValidTilesets)8, dungeonCollection = orLoadByName_Orig3.tileIndices.dungeonCollection, dungeonCollectionSupportsDiagonalWalls = false, aoTileIndices = orLoadByName_Orig3.tileIndices.aoTileIndices, placeBorders = true, placePits = false, chestHighWallIndices = new List { new TileIndexVariant { index = 41, likelihood = 0.5f, overrideLayerIndex = 0, overrideIndex = 0 } }, decalIndexGrid = null, patternIndexGrid = orLoadByName_Orig3.tileIndices.patternIndexGrid, globalSecondBorderTiles = new List(0), edgeDecorationTiles = null }; ((Object)dungeon.tileIndices.dungeonCollection).name = "ENV_FloorName_Collection"; dungeon.roomMaterialDefinitions = (DungeonMaterial[])(object)new DungeonMaterial[7] { val, val, val, val, val, val, val }; dungeon.dungeonWingDefinitions = (DungeonWingDefinition[])(object)new DungeonWingDefinition[0]; dungeon.pathGridDefinitions = new List { orLoadByName_Orig.pathGridDefinitions[0] }; dungeon.dungeonDustups = new DustUpVFX { runDustup = orLoadByName_Orig.dungeonDustups.runDustup, waterDustup = orLoadByName_Orig.dungeonDustups.waterDustup, additionalWaterDustup = orLoadByName_Orig.dungeonDustups.additionalWaterDustup, rollNorthDustup = orLoadByName_Orig.dungeonDustups.rollNorthDustup, rollNorthEastDustup = orLoadByName_Orig.dungeonDustups.rollNorthEastDustup, rollEastDustup = orLoadByName_Orig.dungeonDustups.rollEastDustup, rollSouthEastDustup = orLoadByName_Orig.dungeonDustups.rollSouthEastDustup, rollSouthDustup = orLoadByName_Orig.dungeonDustups.rollSouthDustup, rollSouthWestDustup = orLoadByName_Orig.dungeonDustups.rollSouthWestDustup, rollWestDustup = orLoadByName_Orig.dungeonDustups.rollWestDustup, rollNorthWestDustup = orLoadByName_Orig.dungeonDustups.rollNorthWestDustup, rollLandDustup = orLoadByName_Orig.dungeonDustups.rollLandDustup }; dungeon.PatternSettings = new SemioticDungeonGenSettings { flows = new List { ArmisticeDungeonFlow.Init() }, mandatoryExtraRooms = new List(0), optionalExtraRooms = new List(0), MAX_GENERATION_ATTEMPTS = 250, DEBUG_RENDER_CANVASES_SEPARATELY = false }; dungeon.damageTypeEffectMatrix = orLoadByName_Orig.damageTypeEffectMatrix; dungeon.stampData = val2; dungeon.UsesCustomFloorIdea = false; dungeon.FloorIdea = new RobotDaveIdea { ValidEasyEnemyPlaceables = (DungeonPlaceable[])(object)new DungeonPlaceable[0], ValidHardEnemyPlaceables = (DungeonPlaceable[])(object)new DungeonPlaceable[0], UseWallSawblades = false, UseRollingLogsVertical = true, UseRollingLogsHorizontal = true, UseFloorPitTraps = false, UseFloorFlameTraps = true, UseFloorSpikeTraps = true, UseFloorConveyorBelts = true, UseCaveIns = true, UseAlarmMushrooms = false, UseChandeliers = true, UseMineCarts = false, CanIncludePits = false }; dungeon.PlaceDoors = true; dungeon.doorObjects = orLoadByName_Orig2.doorObjects; dungeon.oneWayDoorObjects = orLoadByName_Orig.oneWayDoorObjects; dungeon.oneWayDoorPressurePlate = orLoadByName_Orig.oneWayDoorPressurePlate; dungeon.phantomBlockerDoorObjects = orLoadByName_Orig.phantomBlockerDoorObjects; dungeon.UsesWallWarpWingDoors = false; dungeon.baseChestContents = orLoadByName_Orig2.baseChestContents; dungeon.SecretRoomSimpleTriggersFacewall = new List { orLoadByName_Orig2.SecretRoomSimpleTriggersFacewall[0] }; dungeon.SecretRoomSimpleTriggersSidewall = new List { orLoadByName_Orig2.SecretRoomSimpleTriggersSidewall[0] }; dungeon.SecretRoomComplexTriggers = new List(0); dungeon.SecretRoomDoorSparkVFX = orLoadByName_Orig2.SecretRoomDoorSparkVFX; dungeon.SecretRoomHorizontalPoofVFX = orLoadByName_Orig2.SecretRoomHorizontalPoofVFX; dungeon.SecretRoomVerticalPoofVFX = orLoadByName_Orig2.SecretRoomVerticalPoofVFX; dungeon.sharedSettingsPrefab = orLoadByName_Orig2.sharedSettingsPrefab; dungeon.NormalRatGUID = string.Empty; dungeon.BossMasteryTokenItemId = orLoadByName_Orig2.BossMasteryTokenItemId; dungeon.UsesOverrideTertiaryBossSets = false; dungeon.OverrideTertiaryRewardSets = new List(0); dungeon.defaultPlayerPrefab = orLoadByName_Orig.defaultPlayerPrefab; dungeon.StripPlayerOnArrival = false; dungeon.SuppressEmergencyCrates = false; dungeon.SetTutorialFlag = false; dungeon.PlayerIsLight = true; dungeon.PlayerLightColor = orLoadByName_Orig2.PlayerLightColor; dungeon.PlayerLightIntensity = 4f; dungeon.PlayerLightRadius = 4f; dungeon.PrefabsToAutoSpawn = (GameObject[])(object)new GameObject[0]; dungeon.musicEventName = "fakedummymusiceventthatdoesntexist"; orLoadByName_Orig2 = null; orLoadByName_Orig = null; orLoadByName_Orig3 = null; return dungeon; } } public class ArmisticeDungeonFlow { public static DungeonFlow Init() { //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_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_001a: 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_0021: 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_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_003e: 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_004c: 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_005e: 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_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_007f: 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_0088: 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_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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00ce: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_00fe: 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_0120: Expected O, but got Unknown //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_012d: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0171: 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_018b: 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) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: 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) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: 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_01fa: 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_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Expected O, but got Unknown //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: 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_0242: 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_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: 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_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0292: 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_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: 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_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: 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_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_030d: 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_0324: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Expected O, but got Unknown DungeonFlow val = ScriptableObject.CreateInstance(); DungeonFlowNode val2 = new DungeonFlowNode(val) { isSubchainStandin = false, nodeType = (ControlNodeType)0, roomCategory = (RoomCategory)0, percentChance = 1f, priority = (NodePriority)0, overrideExactRoom = CwaffDungeonPrefabs.elevator_entrance, overrideRoomTable = null, capSubchain = false, subchainIdentifier = string.Empty, limitedCopiesOfSubchain = false, maxCopiesOfSubchain = 1, subchainIdentifiers = new List(0), receivesCaps = false, isWarpWingEntrance = false, handlesOwnWarping = false, forcedDoorType = (ForcedDoorType)0, loopForcedDoorType = (ForcedDoorType)0, nodeExpands = false, initialChainPrototype = "n", chainRules = new List(0), minChainLength = 3, maxChainLength = 8, minChildrenToBuild = 1, maxChildrenToBuild = 1, canBuildDuplicateChildren = false, parentNodeGuid = string.Empty, childNodeGuids = new List(0), loopTargetNodeGuid = string.Empty, loopTargetIsOneWay = false, guidAsString = Guid.NewGuid().ToString(), flow = val }; DungeonFlowNode val3 = new DungeonFlowNode(val) { isSubchainStandin = false, nodeType = (ControlNodeType)0, roomCategory = (RoomCategory)0, percentChance = 1f, priority = (NodePriority)0, overrideExactRoom = ArmisticeBoss.ArmisticeBossRoom, overrideRoomTable = null, capSubchain = false, subchainIdentifier = string.Empty, limitedCopiesOfSubchain = false, maxCopiesOfSubchain = 1, subchainIdentifiers = new List(0), receivesCaps = false, isWarpWingEntrance = false, handlesOwnWarping = false, forcedDoorType = (ForcedDoorType)0, loopForcedDoorType = (ForcedDoorType)0, nodeExpands = false, initialChainPrototype = "n", chainRules = new List(0), minChainLength = 3, maxChainLength = 8, minChildrenToBuild = 1, maxChildrenToBuild = 1, canBuildDuplicateChildren = false, parentNodeGuid = string.Empty, childNodeGuids = new List(0), loopTargetNodeGuid = string.Empty, loopTargetIsOneWay = false, guidAsString = Guid.NewGuid().ToString() }; DungeonFlowNode val4 = new DungeonFlowNode(val) { isSubchainStandin = false, nodeType = (ControlNodeType)0, roomCategory = (RoomCategory)8, percentChance = 1f, priority = (NodePriority)0, overrideExactRoom = CwaffDungeonPrefabs.exit_room_basic, overrideRoomTable = null, capSubchain = false, subchainIdentifier = string.Empty, limitedCopiesOfSubchain = false, maxCopiesOfSubchain = 1, subchainIdentifiers = new List(0), receivesCaps = false, isWarpWingEntrance = false, handlesOwnWarping = false, forcedDoorType = (ForcedDoorType)0, loopForcedDoorType = (ForcedDoorType)0, nodeExpands = false, initialChainPrototype = "n", chainRules = new List(0), minChainLength = 3, maxChainLength = 8, minChildrenToBuild = 1, maxChildrenToBuild = 1, canBuildDuplicateChildren = false, parentNodeGuid = string.Empty, childNodeGuids = new List(0), loopTargetNodeGuid = string.Empty, loopTargetIsOneWay = false, guidAsString = Guid.NewGuid().ToString(), flow = val }; ((Object)val).name = "cg_armisticefloor_flow"; val.fallbackRoomTable = CwaffDungeonPrefabs.SewersRoomTable; val.subtypeRestrictions = new List(0); val.flowInjectionData = new List(0); val.sharedInjectionData = new List(0); val.Initialize(); val.AddNodeToFlow(val2, (DungeonFlowNode)null); val.AddNodeToFlow(val3, val2); val.AddNodeToFlow(val4, val3); val.FirstNode = val2; return val; } } public static class Enemies { public static readonly HashSet BulletKinVariants = new HashSet { "01972dee89fc4404a5c408d50007dad5", "db35531e66ce41cbb81d507a34366dfe", "88b6b6a93d4b4234a67844ef4728382c", "70216cae6c1346309d86d4a0b4603045", "df7fb62405dc4697b7721862c7b6b3cd", "3cadf10c489b461f9fb8814abc1a09c1", "8bb5578fba374e8aae8e10b754e61d62", "e5cffcfabfae489da61062ea20539887", "1a78cfb776f54641b832e92c44021cf2", "d4a9836f8ab14f3fadd0f597438b1f1f", "5f3abc2d561b4b9c9e72b879c6f10c7e", "844657ad68894a4facb1b8e1aef1abf9", "906d71ccc1934c02a6f4ff2e9c07c9ec", "9eba44a0ea6c4ea386ff02286dd0e6bd", "05cb719e0178478685dc610f8b3e8bfc", "5861e5a077244905a8c25c2b7b4d6ebb", "6f818f482a5c47fd8f38cce101f6566c", "39e6f47a16ab4c86bec4b12984aece4c", "128db2f0781141bcb505d8f00f9e4d47", "b54d89f9e802455cbb2b8a96a31e8259", "2752019b770f473193b08b4005dc781f", "7f665bd7151347e298e4d366f8818284", "b1770e0f1c744d9d887cc16122882b4f", "1bd8e49f93614e76b140077ff2e33f2b", "044a9f39712f456597b9762893fbc19c", "37340393f97f41b2822bc02d14654172", "ddf12a4881eb43cfba04f36dd6377abb", "86dfc13486ee4f559189de53cfb84107" }; public const string BulletKin = "01972dee89fc4404a5c408d50007dad5"; public const string AK47BulletKin = "db35531e66ce41cbb81d507a34366dfe"; public const string BandanaBulletKin = "88b6b6a93d4b4234a67844ef4728382c"; public const string VeteranBulletKin = "70216cae6c1346309d86d4a0b4603045"; public const string TreadnaughtsBulletKin = "df7fb62405dc4697b7721862c7b6b3cd"; public const string Minelet = "3cadf10c489b461f9fb8814abc1a09c1"; public const string Cardinal = "8bb5578fba374e8aae8e10b754e61d62"; public const string Shroomer = "e5cffcfabfae489da61062ea20539887"; public const string AshenBulletKin = "1a78cfb776f54641b832e92c44021cf2"; public const string MutantBulletKin = "d4a9836f8ab14f3fadd0f597438b1f1f"; public const string FallenBulletKin = "5f3abc2d561b4b9c9e72b879c6f10c7e"; public const string HoodedBullet = "844657ad68894a4facb1b8e1aef1abf9"; public const string OfficeBulletKin = "906d71ccc1934c02a6f4ff2e9c07c9ec"; public const string OfficeBulletteKin = "9eba44a0ea6c4ea386ff02286dd0e6bd"; public const string Brollet = "05cb719e0178478685dc610f8b3e8bfc"; public const string WesternBulletKin = "5861e5a077244905a8c25c2b7b4d6ebb"; public const string PirateBulletKin = "6f818f482a5c47fd8f38cce101f6566c"; public const string ArmoredBulletKin = "39e6f47a16ab4c86bec4b12984aece4c"; public const string KeyBulletKin = "699cd24270af4cd183d671090d8323a1"; public const string ChanceBulletKin = "a446c626b56d4166915a4e29869737fd"; public const string Hollowpoint = "4db03291a12144d69fe940d5a01de376"; public const string Spectre = "56f5a0f2c1fc4bc78875aea617ee31ac"; public const string Skullet = "336190e29e8a4f75ab7486595b700d4a"; public const string Skullmet = "95ec774b5a75467a9ab05fa230c0c143"; public const string Gummy = "5288e86d20184fa69c91ceb642d31474"; public const string Spent = "249db525a9464e5282d02162c88e0357"; public const string GummySpent = "e21ac9492110493baef6df02a2682a0d"; public const string RedShotgunKin = "128db2f0781141bcb505d8f00f9e4d47"; public const string BlueShotgunKin = "b54d89f9e802455cbb2b8a96a31e8259"; public const string VeteranShotgunKin = "2752019b770f473193b08b4005dc781f"; public const string MutantShotgunKin = "7f665bd7151347e298e4d366f8818284"; public const string Executioner = "b1770e0f1c744d9d887cc16122882b4f"; public const string AshenShotgunKin = "1bd8e49f93614e76b140077ff2e33f2b"; public const string Shotgrub = "044a9f39712f456597b9762893fbc19c"; public const string Creech = "37340393f97f41b2822bc02d14654172"; public const string WesternShotgunKin = "ddf12a4881eb43cfba04f36dd6377abb"; public const string PirateShotgunKin = "86dfc13486ee4f559189de53cfb84107"; public const string Blobulon = "0239c0680f9f467dbe5c4aab7dd1eca6"; public const string Blobuloid = "042edb1dfb614dc385d5ad1b010f2ee3"; public const string Blobulin = "42be66373a3d4d89b91a35c9ff8adfec"; public const string Poisbulon = "e61cab252cfb435db9172adc96ded75f"; public const string Poisbuloid = "fe3fe59d867347839824d5d9ae87f244"; public const string Poisbulin = "b8103805af174924b578c98e95313074"; public const string Blizzbulon = "022d7c822bc146b58fe3b0287568aaa2"; public const string Leadbulon = "ccf6d241dad64d989cbcaca2a8477f01"; public const string Bloodbulon = "062b9b64371e46e195de17b6f10e47c8"; public const string Poopulon = "116d09c26e624bca8cca09fc69c714b3"; public const string Cubulon = "864ea5a6a9324efc95a0dd2407f42810"; public const string Cubulead = "0b547ac6b6fc4d68876a241a88f5ca6a"; public const string Chancebulon = "1bc2a07ef87741be90c37096910843ab"; public const string Skusket = "af84951206324e349e1f13f9b7b60c1a"; public const string BlackSkusket = "1cec0cdf383e42b19920787798353e46"; public const string SkusketHead = "c2f902b7cbe745efb3db4399927eab34"; public const string Shelleton = "21dd14e5ca2a4a388adab5b11b69a1e1"; public const string Revolvenant = "d5a7b95774cd41f080e517bea07bf495"; public const string Gunreaper = "88f037c3f93b4362a040a87b30770407"; public const string Bullat = "2feb50a6a40f4f50982e89fd276f6f15"; public const string Shotgat = "2d4f8b5404614e7d8b235006acde427a"; public const string Grenat = "b4666cb6ef4f4b038ba8924fd8adf38f"; public const string Spirat = "7ec3e8146f634c559a7d58b19191cd43"; public const string KingBullat = "1a4872dafdb34fd29fe8ac90bd2cea67"; public const string Gargoyle = "981d358ffc69419bac918ca1bdf0c7f7"; public const string ApprenticeGunjurer = "206405acad4d4c33aac6717d184dc8d4"; public const string Gunjurer = "c4fba8def15e47b297865b18e36cbef8"; public const string HighGunjurer = "9b2cf2949a894599917d4d391a0b7394"; public const string LoreGunjurer = "56fb939a434140308b8f257f0f447829"; public const string Bookllet = "c0ff3744760c4a2eb0bb52ac162056e6"; public const string BlueBookllet = "6f22935656c54ccfb89fca30ad663a64"; public const string GreenBookllet = "a400523e535f41ac80a43ff6b06dc0bf"; public const string Necronomicon = "216fd3dfb9da439d9bd7ba53e1c76462"; public const string TabletBookllett = "78e0951b097b46d89356f004dda27c42"; public const string MountainCube = "f155fd2759764f4a9217db29dd21b7eb"; public const string LeadCube = "33b212b856b74ff09252bf4f2e8b8c57"; public const string FleshCube = "3f2026dc3712490289c4658a2ba4a24b"; public const string BrownChestMimic = "2ebf8ef6728648089babb507dec4edb7"; public const string BlueChestMimic = "d8d651e3484f471ba8a2daa4bf535ce6"; public const string GreenChestMimic = "abfb454340294a0992f4173d6e5898a8"; public const string RedChestMimic = "d8fd592b184b4ac9a3be217bc70912a2"; public const string BlackChestMimic = "6450d20137994881aff0ddd13e3d40c8"; public const string RatChestMimic = "ac9d345575444c9a8d11b799e8719be0"; public const string PedestalMimic = "796a7ed4ad804984859088fc91672c7f"; public const string WallMimic = "479556d05c7c44f3b6abb3b2067fc778"; public const string GunNut = "ec8ea75b557d4e7b8ceeaacdf6f8238c"; public const string ChainGunner = "463d16121f884984abe759de38418e48"; public const string SpectralGunNut = "383175a55879441d90933b5c4e60cf6f"; public const string Det = "ac986dabc5a24adab11d48a4bccf4cb1"; public const string XDet = "48d74b9c65f44b888a94f9e093554977"; public const string DiagonalXDet = "c5a0fd2774b64287bf11127ca59dd8b4"; public const string VerticalDet = "b67ffe82c66742d1985e5888fd8e6a03"; public const string DiagonalDet = "d9632631a18849539333a92332895ebd"; public const string HorizontalDet = "1898f6fe1ee0408e886aaf05c23cc216"; public const string VerticalXDet = "abd816b0bcbf4035b95837ca931169df"; public const string HorizontalXDet = "07d06d2b23cc48fe9f95454c839cb361"; public const string Gunsinger = "cf2b7021eac44e3f95af07db9a7c442c"; public const string AgedGunsinger = "c50a862d19fc4d30baeba54795e8cb93"; public const string Ammomancer = "b1540990a4f1480bbcb3bea70d67f60d"; public const string Jammomancer = "8b4a938cdbc64e64822e841e482ba3d2"; public const string Jamerlengo = "ba657723b2904aa79f9e51bce7d23872"; public const string GunCultist = "57255ed50ee24794b7aac1ac3cfb8a95"; public const string Gat = "9b4fb8a2a60a457f90dcf285d34143ac"; public const string GreyCylinder = "d4f4405e0ff34ab483966fd177f2ece3"; public const string RedCylinder = "534f1159e7cf4f6aa00aeea92459065e"; public const string BulletMech = "2b6854c0849b4b8fb98eb15519d7db1c"; public const string GrenadeKin = "4d37ce3d666b4ddda8039929225b7ede"; public const string DynamiteKin = "c0260c286c8d4538a697c5bf24976ccf"; public const string Bombshee = "19b420dec96d4e9ea4aebc3398c0ba7a"; public const string M80Kin = "5f15093e6f684f4fb09d3e7e697216b4"; public const string RubberKin = "6b7ef9e5d05b4f96b04f05ef4a0d1b18"; public const string Tazie = "98fdf153a4dd4d51bf0bafe43f3c77ff"; public const string SniperShell = "31a3ea0c54a745e182e22ea54844a82d"; public const string Professional = "c5b11bfc065d417b9c4d03a5e385fe2c"; public const string MuzzleWisp = "ffdc8680bdaa487f8f31995539f74265"; public const string MuzzleFlare = "d8a445ea4d944cc1b55a40f22821ae69"; public const string Wizbang = "43426a2e39584871b287ac31df04b544"; public const string Coaler = "9d50684ce2c044e880878e86dbada919"; public const string Fungun = "f905765488874846b7ff257ff81d6d0c"; public const string BulletShark = "72d2f44431da43b8a3bae7d8a114a46d"; public const string ArrowHead = "05891b158cd542b1a5f3df30fb67a7ff"; public const string PotFairy = "c182a5cb704d460d9d099a47af49c913"; public const string Musketball = "226fd90be3a64958a5b13cb0a4f43e97"; public const string WesternCactus = "3b0bd258b4c9432db3339665cc61c356"; public const string CandleKin = "37de0df92697431baa47894a075ba7e9"; public const string Gigi = "ed37fa13e0fa4fcf8239643957c51293"; public const string MisfireBeast = "45192ff6d6cb43ed8f1a874ab6bef316"; public const string PhaserSpider = "98ca70157c364750a60f5e0084f9d3e2"; public const string Gunzookie = "6e972cd3b11e4b429b888b488e308551"; public const string Gunzockie = "8a9e9bedac014a829a48735da6daf3da"; public const string Chameleon = "80ab6cd15bfc46668a8844b2975c6c26"; public const string BirdParrot = "4b21a913e8c54056bc05cafecf9da880"; public const string WesternSnake = "e861e59012954ab2b9b6977da85cb83c"; public const string Kalibullet = "ff4f54ce606e4604bf8d467c1279be3e"; public const string Kbullet = "f020570a42164e2699dcf57cac8a495c"; public const string BlueFishBulletKin = "06f5623a351c4f28bc8c6cda56004b80"; public const string GreenFishBulletKin = "143be8c9bbb84e3fb3ab98bcd4cf5e5b"; public const string Tarnisher = "475c20c1fd474dfbad54954e7cba29c1"; public const string Agonizer = "3f6d6b0c4a7c4690807435c7b37c35a5"; public const string LeadMaiden = "cd4a4b7f612a4ba9a720b9f97c52f38c"; public const string GripMaster = "22fc2c2c45fb47cf9fb5f7b043a70122"; public const string ShamblingRound = "98ea2fe181ab4323ab6e9981955a9bca"; public const string GreatBulletShark = "b70cbd875fea498aa7fd14b970248920"; public const string Killithid = "3e98ccecf7334ff2800188c417e67c15"; public const string Spogre = "eed5addcc15148179f300cc0d9ee7f94"; public const string FridgeMaiden = "9215d1a221904c7386b481a171e52859"; public const string TitanBulletKin = "c4cf0620f71c4678bb8d77929fd4feff"; public const string TitanBulletKinBoss = "1f290ea06a4c416cabc52d6b3cf47266"; public const string TitanessBulletKinBoss = "df4e9fedb8764b5a876517431ca67b86"; public const string Beadie = "7b0b1b6d9ce7405b86b75ce648025dd6"; public const string Tombstoner = "cf27dd464a504a428d87a8b2560ad40a"; public const string AmmocondaBall = "f38686671d524feda75261e469f30e0b"; public const string SummonedTreadnaughtsBulletKin = "47bdfec22e8e4568a619130a267eab5b"; public const string MineFlayersBell = "78a8ee40dff2477e9c2134f6990ef297"; public const string MineFlayersClaymore = "566ecca5f3b04945ac6ce1f26dedbf4f"; public const string CandleGuy = "eeb33c3a5a8e4eaaaaf39a743e8767bc"; public const string BulletKingsToadie = "b5e699a0abb94666bda567ab23bd91c4"; public const string BulletKingsToadieRevenge = "d4dd2b2bbda64cc9bcec534b4e920518"; public const string OldKingsToadie = "02a14dec58ab45fb8aacde7aacd25b01"; public const string Fusebot = "4538456236f64ea79f483784370bc62f"; public const string Mouser = "be0683affb0e41bbb699cb7125fdded6"; public const string DragunsKnife = "78eca975263d4482a4bfa4c07b32e252"; public const string DragunKnifeAdvanced = "2e6223e42e574775b56c6349921f42cb"; public const string MarinesPastImp = "a9cc6a4e9b3d46ea871e70a03c9f77d4"; public const string ConvictsPastSoldier = "556e9f2a10f9411cb9dbfd61e0e0f1e1"; public const string RobotsPastTerminator = "12a054b8a6e549dcac58a82b89e319e5"; public const string Blockner = "bb73eeeb9e584fbeaf35877ec176de28"; public const string BlocknerRematch = "edc61b105ddd4ce18302b82efdc47178"; public const string Fuselier = "39de9bd6a863451a97906d949c103538"; public const string ShadowAgunim = "db97e486ef02425280129e1e27c33118"; public const string GatlingGull = "ec6b674e0acd4553b47ee94493d66422"; public const string BulletKing = "ffca09398635467da3b1f4a54bcfda80"; public const string Blobulord = "1b5810fafbec445d89921a4efb4e42b7"; public const string Beholster = "4b992de5b4274168a8878ef9bf7ea36b"; public const string Gorgun = "c367f00240a64d5d9f3c26484dc35833"; public const string Ammoconda = "da797878d215453abba824ff902e21b4"; public const string OldKing = "5729c8b5ffa7415bb3d01205663a33ef"; public const string Treadnaught = "fa76c8cfdf1c4a88b55173666b4bc7fb"; public const string MineFlayer = "8b0dd96e2fe74ec7bebc1bc689c0008a"; public const string Cannonbalrog = "5e0af7f7d9de4755a68d2fd3bbc15df4"; public const string DoorLord = "9189f46c47564ed588b9108965f975c9"; public const string HelicopterAgunim = "41ee1c8538e8474a82a74c4aff99c712"; public const string Dragun = "465da2bb086a4a88a803f79fe3a27677"; public const string DragunAdvanced = "05b8afe0b6cc4fffa9dc6036fa24c8ec"; public const string Lich = "cd88c3ce60c442e9aa5b3904d31652bc"; public const string Megalich = "68a238ed6a82467ea85474c595c49c6e"; public const string Infinilich = "7c5d5f09911e49b78ae644d2b50ff3bf"; public const string Chicken = "76bc43539fc24648bff4568c75c686d1"; public const string PoopulonsCorn = "0ff278534abb4fbaaa65d3f638003648"; public const string Snake = "1386da0f42fb4bcabc5be8feb16a7c38"; public const string TinyBlobulord = "d1c9781fdac54d9e8498ed89210a0238"; public const string RobotsPastCritter1 = "95ea1a31fc9e4415a5f271b9aedf9b15"; public const string RobotsPastCritter2 = "42432592685e47c9941e339879379d3a"; public const string RobotsPastCritter3 = "4254a93fc3c84c0dbe0a8f0dddf48a5a"; public const string Rat = "6ad1cafc268f4214a101dca7af61bc91"; public const string RatCandle = "14ea47ff46b54bb4a98f91ffcffb656d"; public const string DragunEggSlimeguy = "8b43a5c59b854eb780f9ab669ec26b7a"; public const string PortableTurret = "998807b57e454f00a63d67883fcf90d6"; public const string FriendlyGatlingGull = "538669d3b2cd4edca2e3699812bcf2b6"; public const string Cop = "705e9081261446039e1ed9ff16905d04"; public const string Cucco = "7bd9c670f35b4b8d84280f52a5cc47f6"; public const string SuperSpaceTurtleDummy = "cc9c41aa8c194e17b44ac45f993dd212"; public const string CopAndroid = "640238ba85dd4e94b3d6f68888e6ecb8"; } public enum Items { MagicLamp = 0, Winchester = 1, Thompson = 2, Screecher = 3, StickyCrossbow = 4, Awp = 5, Zorgun = 6, Barrel = 7, Bow = 8, DuelingPistol = 9, MegaDouser = 10, Crossbow = 12, Thunderclap = 13, BeeHive = 14, Ak47 = 15, YariLauncher = 16, HeckBlaster = 17, Blooper = 18, GrenadeLauncher = 19, Moonscraper = 20, Bsg = 21, ShadesRevolver = 22, DungeonEagle = 23, DartGun = 24, M1 = 25, NailGun = 26, LightGun = 27, Mailbox = 28, Vertebraek47 = 29, M1911 = 30, Klobbe = 31, VoidMarshal = 32, TearJerker = 33, SmileysRevolver = 35, Megahand = 36, SeriousCannon = 37, Magnum = 38, Rpg = 39, FreezeRay = 40, Heroine = 41, TrankGun = 42, MachinePistol = 43, SkullSpitter = 45, Jolter = 47, SniperRifle = 49, Saa = 50, RegularShotgun = 51, CrescentCrossbow = 52, AuGun = 53, LaserRifle = 54, VoidShotgun = 55, _38Special = 56, AlienSidearm = 57, VoidCoreAssaultRifle = 58, HegemonyRifle = 59, DemonHead = 60, BundleOfWands = 61, Colt1851 = 62, Medkit = 63, PotionOfLeadSkin = 64, KnifeShield = 65, ProximityMine = 66, Key = 67, Casing = 68, BulletTime = 69, Unknown2 = 70, Decoy = 71, BubbleShield = 72, HalfHeart = 73, _50Casing = 74, EyeJewel = 76, SupplyDrop = 77, Ammo = 78, Makarov = 79, BudgetRevolver = 80, Deck4rd = 81, ElephantGun = 82, UnfinishedGun = 83, VulcanCannon = 84, Heart = 85, MarineSidearm = 86, GammaRay = 87, RobotsRightHand = 88, RogueSpecial = 89, EyeOfTheBeholster = 90, H4mmer = 91, Stinger = 92, OldGoldie = 93, Mac10 = 94, Akey47 = 95, M16 = 96, Polaris = 97, Patriot = 98, RustySidearm = 99, UnicornHorn = 100, Scope = 102, Ration = 104, FortunesFavor = 105, Jetpack = 106, RaidenCoil = 107, Bomb = 108, IceBomb = 109, MagicSweet = 110, HeavyBullets = 111, CartographersRing = 112, RocketPoweredBullets = 113, BionicLeg = 114, Ballot = 115, AmmoSynthesizer = 116, Eyepatch = 118, Metronome = 119, Armor = 120, Disintegrator = 121, Blunderbuss = 122, PulseCannon = 123, Cactus = 124, FlameHand = 125, Shotbow = 126, Junk = 127, RubeAdyneMk2 = 128, Com4nd0 = 129, Glacier = 130, UtilityBelt = 131, RingOfMiserlyProtection = 132, Backpack = 133, AmmoBelt = 134, CogOfBattle = 135, C4 = 136, Map = 137, Honeycomb = 138, MasterOfUnlocking = 140, RubeAdynePrototype = 142, ShotgunFullOfHate = 143, WitchPistol = 145, Dragunfire = 146, PlaceableKey = 147, Lies = 148, FaceMelter = 149, TShirtCannon = 150, TheMembrane = 151, TheKiln = 152, ShockRifle = 153, Trashcannon = 154, Singularity = 155, LaserLotus = 156, BigIron = 157, AmuletOfThePitLord = 158, GundromedaStrain = 159, GunknightHelmet = 160, GunknightGreaves = 161, GunknightGauntlet = 162, GunknightArmor = 163, HeartSynthesizer = 164, OiledCylinder = 165, ShelletonKey = 166, BloodyEye = 167, DoubleVision = 168, BlackHoleGun = 169, IceCube = 170, GhostBullets = 172, PileOfSouls = 173, PotionOfGunFriendship = 174, Tangler = 175, GungeonAnt = 176, AlienEngine = 177, Crestfaller = 178, ProtonBackpack = 179, Grasschopper = 180, WinchesterRifle = 181, GreyMauser = 182, SerManuelsRevolver = 183, TheJudge = 184, MachineFist = 186, DisarmingPersonality = 187, RollingEye = 190, RingOfFireResistance = 191, BugBoots = 193, FossilizedGun = 196, PeaShooter = 197, GunslingersAshes = 198, LuxinCannon = 199, CharmedBow = 200, PortableTurret = 201, SawedOff = 202, Cigarettes = 203, IrradiatedLead = 204, PoisonVial = 205, CharmHorn = 206, PlaguePistol = 207, Plunger = 208, SenseOfDirection = 209, Gunbow = 210, BallisticBoots = 212, LichyTriggerFinger = 213, CoinCrown = 214, Box = 216, OldKnightsShield = 219, TutorialAk47 = 221, OldKnightsHelm = 222, Cold45 = 223, Blank = 224, IceBreaker = 225, Wristbow = 227, Particulator = 228, HegemonyCarbine = 229, Helix = 230, GildedHydra = 231, SpaceFriend = 232, IbombCompanionApp = 234, AgedBell = 237, DuctTape = 239, Crutch = 240, Scattershot = 241, NapalmStrike = 242, InfuriatingNote1 = 243, InfuriatingNote2 = 244, InfuriatingNote3 = 245, InfuriatingNote4 = 246, InfuriatingNote5 = 247, InfuriatingNote6 = 248, Owl = 249, GrapplingHook = 250, PrizePistol = 251, AirStrike = 252, GungeonPepper = 253, RingOfChestFriendship = 254, AncientHerosBandana = 255, HeavyBoots = 256, Broccoli = 258, Antibody = 259, PinkGuonStone = 260, WhiteGuonStone = 262, OrangeGuonStone = 263, ClearGuonStone = 264, OldKnightsFlask = 267, RedGuonStone = 269, BlueGuonStone = 270, RiddleOfLead = 271, IronCoin = 272, LaserSight = 273, DarkMarker = 274, FlareGun = 275, Spice = 276, FatBullets = 277, FrostBullets = 278, SuperHotWatch = 279, DrumClip = 280, GungeonBlueprint = 281, HomingBullets = 284, BloodBrooch = 285, _1Bullets = 286, BackupGun = 287, BouncyBullets = 288, SevenLeafClover = 289, Sunglasses = 290, Meatbun = 291, MolotovLauncher = 292, MimicToothNecklace = 293, RingOfMimicFriendship = 294, HotLead = 295, MetashopBreachItemOld = 296, HegemonyCredit = 297, ShockRounds = 298, SuperSpaceTurtlesGun = 299, Dog = 300, SuperSpaceTurtle = 301, BulletThatCanKillThePast = 303, ExplosiveRounds = 304, OldCrest = 305, EscapeRope = 306, WaxWings = 307, ClusterMine = 308, CloranthyRing = 309, FairyWings = 310, Clone = 311, BlastHelmet = 312, MonsterBlood = 313, Nanomachines = 314, Gunboots = 315, GnawedKey = 316, R2g2 = 318, Ticket = 320, GoldAmmolet = 321, LodestoneAmmolet = 322, AngryBullets = 323, ChaosAmmolet = 325, Number2 = 326, Corsair = 327, ChargeShot = 328, ZillaShotgun = 329, TheEmperor = 330, ScienceCannon = 331, LilBomber = 332, Mutation = 333, WindUpGun = 334, Silencer = 335, Pitchfork = 336, CompositeGun = 337, Gunther = 338, Mahoguny = 339, LowerCaseR = 340, Buzzkill = 341, UraniumAmmolet = 342, CopperAmmolet = 343, FrostAmmolet = 344, Fightsabre = 345, Huntsman = 346, Shotgrub = 347, PrimePrimer = 348, PlanarLead = 349, ObsidianShellCasing = 350, ArcaneGunpowder = 351, ShadowBullets = 352, EnragingPhoto = 353, MilitaryTraining = 354, ChromesteelAssaultRifle = 355, TrustyLockpicks = 356, CatClaw = 357, Railgun = 358, CompressedAirTank = 359, Snakemaker = 360, BulletBore = 362, TrickGun = 363, HeartOfIce = 364, MassShotgun = 365, Molotov = 366, HuntersJournal = 367, ElTigre = 368, BaitLauncher = 369, PrototypeRailgun = 370, RcRocket = 372, AlphaBullets = 373, OmegaBullets = 374, EasyReloadBullets = 375, BrickBreaker = 376, Excaliber = 377, Derringer = 378, ShotgunFullOfLove = 379, BetrayersShield = 380, TripleCrossbow = 381, Sling = 382, FlashRay = 383, Phoenix = 384, Hexagun = 385, FrostGiant = 387, CobaltHammer = 390, CellKey = 392, Anvillain = 393, MineCutter = 394, StaffOfFirepower = 395, TableTechSight = 396, TableTechMoney = 397, TableTechRocket = 398, TableTechRage = 399, TableTechBlanks = 400, Gungine = 401, Snowballer = 402, MeltedRock = 403, Siren = 404, Rattler = 406, SixthChamber = 407, BustedTelevision = 409, BatteryBullets = 410, CoolantLeak = 411, FriendshipCookie = 412, HerosSword = 413, LiveAmmo = 414, ReplacementArm = 415, Balloon = 416, Blasphemy = 417, TrorcBreachItem = 418, HeartHolster = 421, HeartLunchbox = 422, HeartLocket = 423, HeartBottle = 424, HeartPurse = 425, ShotgaCola = 426, ShotgunCoffee = 427, GooptonBreachItem = 429, LiquidValkyrie = 431, JarOfBees = 432, StuffedStar = 433, BulletIdol = 434, Mustache = 435, BloodiedScarf = 436, MuscleRelaxant = 437, ExplosiveDecoy = 438, BracketKey = 439, RubyBracelet = 440, EmeraldBracelet = 441, Badge = 442, BigBoy = 443, Trident = 444, TheScrambler = 445, ShieldOfTheMaiden = 447, Boomerang = 448, TeleporterPrototype = 449, ArmorSynthesizer = 450, Pig = 451, Sponge = 452, GasMask = 453, HazmatSuit = 454, RingOfTriggers = 456, ArmorOfThorns = 457, RingOfEtherealForm = 458, ChaffGrenade = 460, BlankCompanionsRing = 461, SmokeBomb = 462, RingOfTheResourcefulRat = 463, Shellegun = 464, TableTechStun = 465, GreenGuonStone = 466, MasterRound5 = 467, MasterRound3 = 468, MasterRound1 = 469, MasterRound4 = 470, MasterRound2 = 471, GummyGun = 472, HiddenCompartment = 473, AbyssalTentacle = 474, QuadLaser = 475, MicrotransactionGun = 476, Origuni = 477, Banana = 478, SuperMeatGun = 479, MakeshiftCannon = 480, Camera = 481, Gunzheng = 482, Tetrominator = 483, Devolver = 484, Orange = 485, TreadnaughtCannon = 486, BookOfChestAnatomy = 487, RingOfChestVampirism = 488, GunSoul = 489, BrickOfCash = 490, Wingman = 491, Wolf = 492, BriefcaseOfCash = 493, GalacticMedalOfValor = 494, Unity = 495, MetashopBreachItemGun = 497, ElderBlank = 499, HipHolster = 500, MetashopBreachItemItem = 501, HmAbsolutionRockets = 502, Bullet = 503, HyperLightBlaster = 504, MagnumWickedSister = 505, ReallySpecialLute = 506, Starpew = 507, DuelingLaser = 508, Jk47 = 510, _3rdPartyController = 511, Shell = 512, Poxcannon = 513, DirectionalPad = 514, MourningStar = 515, TripleGun = 516, TripleGunForm2 = 517, TripleGunForm3 = 518, CombinedRifle = 519, BalloonGun = 520, ChanceBullets = 521, StoutBullets = 523, Bloody9mm = 524, LamentConfigurum = 525, SpringheelBoots = 526, CharmingRounds = 527, ZombieBullets = 528, BattleStandard = 529, RemoteBullets = 530, FlakBullets = 531, GildedBullets = 532, MagicBullets = 533, RealCoolBow = 535, Relodestone = 536, VorpalGun = 537, SilverBullets = 538, BoxingGlove = 539, GlassCannon = 540, Casey = 541, StrafeGun = 542, ThePredator = 543, Ac15Unarmored = 544, Ac15 = 545, Windgunner = 546, KnightsGun = 550, CrownOfGuns = 551, Bottle = 558, TheFatLine = 562, TheExotic = 563, FullMetalJacket = 564, GlassGuonStone = 565, RadGun = 566, RollBomb = 567, HelixBullets = 568, ChaosBullets = 569, YellowChamber = 570, CursedBullets = 571, ChickenFlute = 572, ChestTeleporter = 573, WoodenBlasphemy = 574, DougBreachItem = 575, RobotsLeftHand = 576, TurboGun = 577, Sprun = 578, BlankBullets = 579, Junkan = 580, VoidCoreCannon = 593, MoonlightTiara = 594, LifeOrb = 595, Teapot = 596, MrAccretionJr = 597, StoneDome = 598, BubbleBlaster = 599, PartialAmmo = 600, BigShotgun = 601, Gunner = 602, LameyGun = 603, Slinger = 604, LootBag = 605, ClownMask = 607, MutationNeoTechYo = 608, RubeAdyneRubensteinsMonster = 609, WoodBeam = 610, Ak47IslandForme = 611, HeroineWaveBeam = 612, HeroineIceBeam = 613, HeroinePlasmaBeam = 614, HeroineHyberBeam = 615, CaseyCarefulIteration = 616, MegahandQuickBoomerang = 617, MegahandTimeStopper = 618, MegahandMetalBlade = 619, MegahandLeafShield = 620, MegahandAtomicFire = 621, MegahandBubbleLead = 622, MegahandAirShooter = 623, MegahandCrashBomber = 624, Drill = 625, Elimentaler = 626, PlatinumBullets = 627, Bumbullets = 630, HoleyGrail = 631, Turkey = 632, TableTechShotgun = 633, CrisisStone = 634, Snowballets = 636, WeirdEgg = 637, DevolverRounds = 638, VorpalBullets = 640, GoldJunk = 641, Daruma = 643, PortableTableDevice = 644, TurtleProblem = 645, ChamberGun = 647, TanglerFullCircle = 648, UppercaseR = 649, PaydayWinchester = 650, RogueSpecialAlt = 651, BudgetRevolverAlt = 652, GunPiece = 654, HungryBullets = 655, KrullerGlaive = 656, ChamberGunOubliette = 657, ChamberGunForge = 658, ChamberGunHollow = 659, ChamberGunProper = 660, OrbitalBullets = 661, PartiallyEatenCheese = 662, ResourcefulSack = 663, BabyGoodMimic = 664, MachoBrace = 665, TableTechHeat = 666, RatBoots = 667, EnemyElimentaler = 668, HighDragunfire = 670, GammaRayBetaRay = 671, ElephantGunTheElephantInTheRoom = 672, MachinePistolPistolMachine = 673, PeaShooterPeaCannon = 674, DuelingPistolDualingPistol = 675, LaserRifleLaserLightShow = 676, DragunfireKalibreath = 677, BlunderbussBlunderbrace = 678, SnowballerSnowballShotgun = 679, ExcaliberArmoredCorps = 680, _38SpecialDetectiveMode = 681, PlaguePistolPandemicPistol = 682, ThunderclapAlistairsLadder = 683, M1M1MultiTool = 684, ThompsonFutureGangster = 685, CorsairBlackFlag = 686, CrestfallerFiveOclockSomewhere = 687, BananaFruitsAndVegetables = 688, AbyssalTentacleKalibersGrip = 689, KlobbeKlobberingTime = 690, MolotovLauncherSpecialReserve = 691, NailGunNailedIt = 692, GunbowShowAcrossTheBow = 693, BigIronIronSlug = 694, HyperLightBlasterHardLight = 695, AlienSidearmChiefMaster = 696, ShockRifleBatteryPowered = 697, FlameHandMaximizeSpell = 698, HegemonyRifleHegemonySpecialForces = 699, CactusCactusFlower = 700, LuxinCannonNoxinCannon = 701, FaceMelterAlternativeRock = 702, BeeHiveApiary = 703, TrashcannonRecyclingBin = 704, FlashRaySaviorOfTheUniverse = 705, FlareGunFiringWithFlair = 706, VulcanCannonNotQuiteAsMini = 707, HelixDoubleDoubleHelix = 708, BarrelLikeShootingFish = 709, FreezeRayIceCap = 710, LightGunPeripheralVision = 711, RaidenCoilRaiden = 712, MoonscraperDoubleMoon7 = 713, LaserLotusLotusBloom = 714, H4mmerHammerAndNail = 715, AwpArcticWarfare = 716, BulletBoreCerebralBros = 717, PolarisSquareBrace = 718, LilBomberKingBomber = 719, ProtonBackpackElectronPack = 720, JolterHeavyJolt = 721, PitchforkPitchPerfect = 722, Com4nd0CommammoBelt = 723, HegemonyCarbineRubyCarbine = 724, TearJerkerUnknown = 725, Akey47AkeyBreaky = 726, RatKey = 727, GunderfuryLv50 = 728, GunderfuryLv60 = 729, GunderfuryLv40 = 730, GunderfuryLv30 = 731, GunderfuryLv10 = 732, GunderfuryLv20 = 733, MimicGun = 734, Serpent = 735, PhoenixPhoenixUp = 736, BetrayersShieldBetrayersLies = 737, LowerCaseRUnknown = 738, GungeonAntGreatQueenAnt = 739, BuzzkillNotSoSawedOff = 740, TearJerkerWrathOfTheBlam = 741, AlienEngineContrail = 742, RadGunKungFuHippieRappinSurfer = 743, OriguniParchmental = 744, IceBreakerGunderlord = 745, TurtineGun = 747, SunlightJavelin = 748, ShotbowSecondAccident = 749, DungeonEagleDontHootTheMessenger = 750, BigGun = 751, WestBroNomesRevolver = 752, WestBroTucosRevolver = 753, WestBroAngelsRevolver = 754, Evolver = 755, EvolverSponge = 756, EvolverFlatworm = 757, EvolverSnail = 758, EvolverFrog = 759, EvolverDragon = 760, HighKaliber = 761, FinishedGun = 762, ChamberGunHell = 763, ChamberGunAbbey = 806, ChamberGunMines = 807, ChamberGunRatLair = 808, MarineSidearmAlt = 809, RustySidearmAlt = 810, DartGunAlt = 811, RobotsRightHandAlt = 812, BlasphemyAlt = 813, MagazineRack = 814, LichsEyeBullets = 815, TrankGunINeedScissors = 816, CatBulletKingThrone = 817, BabyGoodShelleton = 818, GlassCannonSteelSkin = 819, ShadowClone = 820, Scouter = 821, KatanaBullets = 822, ChamberGunRNG = 823 } public static class ItemHelper { public static PickupObject Get(Items i) { return PickupObjectDatabase.GetById((int)i); } } public class ExtendedColours { public static Color carrionRed = new Color(0.6901961f, 0.015686275f, 0.015686275f); public static Color pink = new Color(0.9490196f, 0.45490196f, 0.88235295f); public static Color paleYellow = new Color(0.9490196f, 14f / 15f, 0.5803922f); public static Color lime = new Color(37f / 85f, 84f / 85f, 1f / 85f); public static Color brown = new Color(0.47843137f, 0.2784314f, 0.0627451f); public static Color orange = new Color(0.9411765f, 32f / 51f, 0.08627451f); public static Color vibrantOrange = new Color(1f, 48f / 85f, 0.16078432f); public static Color purple = new Color(57f / 85f, 0.08627451f, 0.9411765f); public static Color skyblue = new Color(26f / 51f, 46f / 51f, 8.843137f); public static Color honeyYellow = new Color(1f, 0.7058824f, 6f / 85f); public static Color maroon = new Color(0.4117647f, 0.02745098f, 3f / 85f); public static Color veryDarkRed = new Color(0.2784314f, 0.015686275f, 1f / 85f); public static Color plaguePurple = new Color(0.9490196f, 0.6313726f, 1f); public static Color darkBrown = new Color(0.2901961f, 0.08627451f, 1f / 51f); } public static class Explosions { public static ExplosionData DefaultSmall = GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultSmallExplosionData; public static ExplosionData DefaultLarge = GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultExplosionData; public static ExplosionData AirStrike = ((Component)ItemHelper.Get(Items.AirStrike)).GetComponent().barrageExplosionData; public static ExplosionData ExplosiveRounds = ((Component)ItemHelper.Get(Items.ExplosiveRounds)).GetComponent().ExplosionData; public static ExplosionData FlareGun = ((Component)ItemHelper.Get(Items.FlareGun)).GetComponent().Barrage.barrageExplosionData; public static ExplosionData MeltedRock = ((Component)ItemHelper.Get(Items.MeltedRock)).GetComponent().CorpseExplosionData; public static ExplosionData EmergencyCrate = ResourceManager.LoadAssetBundle("brave_resources_001").LoadAsset("EmergencyCrate").GetComponent() .ExplosionData; } public static class EasyGoopDefinitions { public static GoopDefinition FireDef; public static GoopDefinition OilDef; public static GoopDefinition PoisonDef; public static GoopDefinition BlobulonGoopDef; public static GoopDefinition WebGoop; public static GoopDefinition WaterGoop; public static GoopDefinition CharmGoopDef; public static GoopDefinition GreenFireDef; public static GoopDefinition CheeseDef; public static GoopDefinition SeltzerGoop; public static GoopDefinition SuperSeltzerGoop; public static GoopDefinition CoffeeGoop; public static GoopDefinition SuperCoffeeGoop; public static GoopDefinition HolyGoop; public static GoopDefinition GreenOilGoop; public static GoopDefinition ToothpasteGoop; public static List ColorGoops = new List(); public static List ColorGoopColors = new List { ExtendedColours.pink, Color.red, ExtendedColours.orange, Color.yellow, Color.green, Color.blue, ExtendedColours.purple, Color.cyan }; private static string[] baseGoopAssets = new string[6] { "assets/data/goops/napalmgoopthatworks.asset", "assets/data/goops/oil goop.asset", "assets/data/goops/poison goop.asset", "assets/data/goops/blobulongoop.asset", "assets/data/goops/phasewebgoop.asset", "assets/data/goops/water goop.asset" }; public static void DefineDefaultGoops() { //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_0162: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_04ce: Unknown result type (might be due to invalid IL or missing references) AssetBundle val = ResourceManager.LoadAssetBundle("shared_auto_001"); List list = new List(); string[] array = baseGoopAssets; foreach (string text in array) { GoopDefinition val2; try { Object obj = val.LoadAsset(text); val2 = ((GameObject)((obj is GameObject) ? obj : null)).GetComponent(); } catch { Object obj3 = val.LoadAsset(text); val2 = (GoopDefinition)(object)((obj3 is GoopDefinition) ? obj3 : null); } ((Object)val2).name = text.Replace("assets/data/goops/", "").Replace(".asset", ""); list.Add(val2); } val = null; FireDef = list[0]; OilDef = list[1]; PoisonDef = list[2]; BlobulonGoopDef = list[3]; WebGoop = list[4]; WaterGoop = list[5]; CharmGoopDef = ((Component)ItemHelper.Get(Items.FairyWings)).GetComponent().RollGoop; GreenFireDef = ((Component)Items.FlameHandMaximizeSpell.AsGun().DefaultModule.projectiles[0]).GetComponent().goopDefinition; CheeseDef = ((Component)Items.ChamberGunRatLair.AsGun().DefaultModule.projectiles[0]).GetComponent().goopDefinition; for (int j = 0; j < ColorGoopColors.Count; j++) { GoopDefinition val3 = Object.Instantiate(WaterGoop); val3.CanBeElectrified = false; val3.baseColor32 = Color32.op_Implicit(ColorGoopColors[j]); ColorGoops.Add(val3); } SeltzerGoop = Object.Instantiate(WaterGoop); SeltzerGoop.CanBeElectrified = true; SeltzerGoop.usesAmbientGoopFX = true; SeltzerGoop.ambientGoopFXChance = 0.003f; SeltzerGoop.ambientGoopFX = VFX.CreatePool("seltzer_sparkles", 10f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); SuperSeltzerGoop = Object.Instantiate(SeltzerGoop); SuperSeltzerGoop.CanBeElectrified = false; SuperSeltzerGoop.AppliesSpeedModifierContinuously = true; SuperSeltzerGoop.SpeedModifierEffect = (GameActorSpeedEffect)(object)new GameActorHiccupEffect { AffectsPlayers = false, AffectsEnemies = true, effectIdentifier = "hiccup goop", stackMode = (EffectStackingMode)0, duration = 3f, maxStackedDuration = 3f, SpeedMultiplier = 1f, CooldownMultiplier = 1f }; CoffeeGoop = Object.Instantiate(WaterGoop); CoffeeGoop.baseColor32 = Color32.op_Implicit(MacchiAuto._OverdoseTint); CoffeeGoop.CanBeElectrified = false; CoffeeGoop.usesAmbientGoopFX = true; CoffeeGoop.ambientGoopFXChance = 0.0015f; CoffeeGoop.ambientGoopFX = VFX.CreatePool("coffee_bubbles", 20f, loops: false, -1, 0.5f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); CoffeeGoop.AppliesSpeedModifierContinuously = true; CoffeeGoop.SpeedModifierEffect = (GameActorSpeedEffect)(object)new GameActorCaffeineGoopEffect { AffectsPlayers = true, AffectsEnemies = false, effectIdentifier = "coffee goop", stackMode = (EffectStackingMode)0, duration = 0.05f, maxStackedDuration = 0.05f, SpeedMultiplier = 2f, CooldownMultiplier = 1f, OnlyAffectPlayerWhenGrounded = true }; SuperCoffeeGoop = Object.Instantiate(CoffeeGoop); SuperCoffeeGoop.SpeedModifierEffect = (GameActorSpeedEffect)(object)new GameActorCaffeineGoopEffect { AffectsPlayers = true, AffectsEnemies = false, effectIdentifier = "super coffee goop", stackMode = (EffectStackingMode)0, duration = 0.05f, maxStackedDuration = 0.05f, SpeedMultiplier = 4f, CooldownMultiplier = 1f, OnlyAffectPlayerWhenGrounded = true }; HolyGoop = Object.Instantiate(CharmGoopDef); HolyGoop.CanBeElectrified = true; HolyGoop.usesAmbientGoopFX = true; HolyGoop.ambientGoopFXChance = 0.004f; HolyGoop.ambientGoopFX = SeltzerGoop.ambientGoopFX; HolyGoop.AppliesSpeedModifierContinuously = true; HolyGoop.eternal = true; HolyGoop.AppliesCharm = false; HolyGoop.lifespan = 20f; HolyGoop.SpeedModifierEffect = (GameActorSpeedEffect)(object)new GameActorHolyGoopEffect { AffectsPlayers = true, AffectsEnemies = false, effectIdentifier = "coffee goop", stackMode = (EffectStackingMode)0, duration = 0.25f, maxStackedDuration = 0.25f, SpeedMultiplier = 1f, CooldownMultiplier = 1f, OnlyAffectPlayerWhenGrounded = false }; GreenOilGoop = Object.Instantiate(OilDef); GreenOilGoop.UsesGreenFire = true; ToothpasteGoop = Object.Instantiate(SeltzerGoop); ToothpasteGoop.lifespan = 10f; ToothpasteGoop.CanBeElectrified = false; ToothpasteGoop.ambientGoopFXChance = 0.01f; ToothpasteGoop.ambientGoopFX = VFX.CreatePool("toothpaste_bubbles", 24f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } } public class KnockbackUnleasher : MonoBehaviour { public float knockbackCap = 10000f; } public class FakeProjectileComponent : MonoBehaviour { private void Start() { //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_002f: Unknown result type (might be due to invalid IL or missing references) Projectile component = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)((BraveBehaviour)component).sprite)) { ((BraveBehaviour)((BraveBehaviour)component).sprite).renderer.enabled = false; } component.damageTypes = (CoreDamageTypes)(component.damageTypes & -65); component.collidesWithEnemies = false; component.collidesWithProjectiles = false; } } public class ProjectileExpiration : MonoBehaviour { public float expirationTimer = 1f; private void Start() { if (expirationTimer > 0f) { ((MonoBehaviour)this).StartCoroutine(Expire(expirationTimer)); } else { Die(); } } private IEnumerator Expire(float expirationTimer) { yield return (object)new WaitForSeconds(expirationTimer); Die(); } private void Die() { //IL_0012: 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_001a: Unknown result type (might be due to invalid IL or missing references) Projectile component = ((Component)this).gameObject.GetComponent(); if (component != null) { component.damageTypes = (CoreDamageTypes)(component.damageTypes & -65); component.CurseSparks = false; component.DieInAir(true, false, false, true); } } } public class Expiration : MonoBehaviour { public void ExpireIn(float seconds, float fadeFor = 0f, float startAlpha = 1f, bool shrink = false) { ((MonoBehaviour)this).StartCoroutine(Expire(seconds, fadeFor, startAlpha, shrink)); IEnumerator Expire(float num3, float num2 = 0f, float num = 1f, bool flag = false) { if (num < 1f) { ((Component)this).gameObject.SetAlphaImmediate(num); } float startXScale = ((Component)this).gameObject.transform.localScale.x; float startYScale = ((Component)this).gameObject.transform.localScale.y; if (num2 == 0f) { yield return (object)new WaitForSeconds(num3); Object.Destroy((Object)(object)((Component)this).gameObject); } else { float lifeLeft = num3; while (lifeLeft > 0f) { lifeLeft -= BraveTime.DeltaTime; float num4 = Mathf.Min(1f, lifeLeft / num2); if (num4 < 1f) { ((Component)this).gameObject.SetAlpha(num * num4); } if (flag) { ((Component)this).gameObject.transform.localScale = new Vector3(num4 * startXScale, num4 * startYScale, 1f); } yield return null; } Object.Destroy((Object)(object)((Component)this).gameObject); } } } } public class FakeItem : CwaffPassive { private static Dictionary _Prefabs = new Dictionary(); private static Dictionary _PrefabsById = new Dictionary(); public static void Create() where T : FakeItem { T val = Lazy.SetupFakeItem(); _Prefabs[typeof(T)] = val; _PrefabsById[((PickupObject)val).PickupObjectId] = val; } public static FakeItem Get() where T : FakeItem { return _Prefabs[typeof(T)]; } public static FakeItem Get(int id) { return _PrefabsById[id]; } } public class BulletLifeTimer : MonoBehaviour { public float secondsTillDeath; public bool eraseInsteadOfDie; private float timer; private Projectile m_projectile; public BulletLifeTimer() { secondsTillDeath = 1f; eraseInsteadOfDie = false; } private void Start() { timer = secondsTillDeath; m_projectile = ((Component)this).GetComponent(); } private void FixedUpdate() { if (!((Object)(object)m_projectile != (Object)null)) { return; } if (timer > 0f) { timer -= BraveTime.DeltaTime; } if (timer <= 0f) { if (eraseInsteadOfDie) { Object.Destroy((Object)(object)((Component)m_projectile).gameObject); } else { m_projectile.DieInAir(false, true, true, false); } } } } public class ArcTowardsTargetBehavior : MonoBehaviour { private Projectile _projectile; private PlayerController _owner; private float _lifetime; private Vector2 _targetPos = Vector2.zero; private float _targetAngle; private float _actualTimeToReachTarget; private float _arcSpeed; private bool _hasBeenSetup; private float _arcAngle; private float _maxSecsToReachTarget = 3f; private float _minSpeed = 5f; public void Setup(float arcAngle, float maxSecsToReachTarget, float minSpeed) { //IL_002f: 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_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_0076: Unknown result type (might be due to invalid IL or missing references) _projectile = ((Component)this).GetComponent(); GameActor owner = _projectile.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null) { _owner = val; _targetAngle = Vector2Extensions.ToAngle(_projectile.Direction); _targetPos = ((GameActor)_owner).CenterPosition.ToNearestWallOrEnemyOrObject(_targetAngle); _arcAngle = arcAngle; _maxSecsToReachTarget = maxSecsToReachTarget; _minSpeed = minSpeed; SetNewTarget(_targetPos); _hasBeenSetup = true; } } public void SetNewTarget(Vector2 target) { //IL_000c: 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_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_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_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_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_0039: 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_0046: 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) _lifetime = 0f; _targetPos = target; Position position = ((BraveBehaviour)_projectile).specRigidbody.Position; Vector2 pixelVector = ((Position)(ref position)).GetPixelVector2(); Vector2 val = _targetPos - pixelVector; _targetAngle = Vector2Extensions.ToAngle(val); float num = Vector2.Distance(pixelVector, _targetPos); _projectile.SetSpeed(Mathf.Max(num / _maxSecsToReachTarget, _minSpeed)); _actualTimeToReachTarget = num / _projectile.baseData.speed; _arcSpeed = 2f * _arcAngle / _actualTimeToReachTarget; _projectile.SendInDirection(BraveMathCollege.DegreesToVector(_targetAngle - _arcAngle, 1f), true, true); } private void Update() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) if (!_hasBeenSetup) { return; } _lifetime += BraveTime.DeltaTime; if (!(_lifetime / _actualTimeToReachTarget > 1f)) { float num = Vector2Extensions.ToAngle(_projectile.Direction); float num2 = num + _arcSpeed * BraveTime.DeltaTime; if (_projectile.OverrideMotionModule != null) { _projectile.OverrideMotionModule.AdjustRightVector(Mathf.DeltaAngle(num, num2)); } else { _projectile.SendInDirection(BraveMathCollege.DegreesToVector(num2, 1f), true, true); } } } } public class ProjectileSlashingBehaviour : MonoBehaviour { private float timer; public float timeBetweenSlashes; public bool doSpinAttack; public bool SlashDamageUsesBaseProjectileDamage; public bool DestroyBaseAfterFirstSlash; public SlashData slashParameters; private Projectile m_projectile; private PlayerController owner; public ProjectileSlashingBehaviour() { DestroyBaseAfterFirstSlash = false; timeBetweenSlashes = 1f; SlashDamageUsesBaseProjectileDamage = true; } private void Start() { m_projectile = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)m_projectile.Owner) && m_projectile.Owner is PlayerController) { ref PlayerController reference = ref owner; GameActor obj = m_projectile.Owner; reference = (PlayerController)(object)((obj is PlayerController) ? obj : null); } } private void Update() { if (!Object.op_Implicit((Object)(object)m_projectile)) { return; } if (timer > 0f) { timer -= BraveTime.DeltaTime; } if (timer <= 0f) { ((MonoBehaviour)m_projectile).StartCoroutine(DoSlash(0f, 0f)); if (doSpinAttack) { ((MonoBehaviour)m_projectile).StartCoroutine(DoSlash(90f, 0.15f)); ((MonoBehaviour)m_projectile).StartCoroutine(DoSlash(180f, 0.3f)); ((MonoBehaviour)m_projectile).StartCoroutine(DoSlash(-90f, 0.45f)); } timer = timeBetweenSlashes; } } private IEnumerator DoSlash(float angle, float delay) { yield return (object)new WaitForSeconds(delay); if (slashParameters == null) { slashParameters = new SlashData(); ETGModConsole.Log((object)"Made a new slashparam", false); } Projectile projectile = m_projectile; new List().AddRange(ProjectileUtility.GetFullListOfStatusEffects(projectile, true)); SlashData slashData = SlashData.CloneSlashData(slashParameters); if (SlashDamageUsesBaseProjectileDamage) { slashData.damage = m_projectile.baseData.damage; slashData.bossDamageMult = m_projectile.BossDamageMultiplier; slashData.jammedDamageMult = m_projectile.BlackPhantomDamageMultiplier; slashData.enemyKnockbackForce = m_projectile.baseData.force; } slashData.OnHitTarget = (Action)Delegate.Combine(slashData.OnHitTarget, new Action(SlashHitTarget)); SlashDoer.DoSwordSlash(((BraveBehaviour)m_projectile).specRigidbody.UnitCenter, Vector2Extensions.ToAngle(m_projectile.Direction) + angle, (GameActor)(object)owner, slashData); if (DestroyBaseAfterFirstSlash) { ((MonoBehaviour)this).StartCoroutine(Suicide()); } } private IEnumerator Suicide() { yield return null; Object.Destroy((Object)(object)((Component)m_projectile).gameObject); } public virtual void SlashHitTarget(GameActor target, bool fatal) { } } public static class AnimatedBullet { private static HashSet _KnownClips = new HashSet(); public static tk2dSpriteAnimationClip Create(string name, int fps = 2, Anchor anchor = (Anchor)4, float scale = 1f, bool anchorsChangeColliders = true, bool fixesScales = true, IntVector2? overrideColliderPixelSizes = null, IntVector2? overrideColliderOffsets = null, bool firstFrameIsReference = false) { //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_003e: 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) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_00a0: 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_009b: 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_00d1: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown //IL_0131: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_0169: 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_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) List list = ResMap.Get(name).Base(); if (_KnownClips.Contains(list[0])) { return null; } tk2dSpriteAnimationClip val = new tk2dSpriteAnimationClip { name = list[0] + "_clip", fps = fps, wrapMode = (WrapMode)0, frames = (tk2dSpriteAnimationFrame[])(object)new tk2dSpriteAnimationFrame[list.Count] }; tk2dSpriteCollectionData projectileCollection = Databases.Items.ProjectileCollection; tk2dSpriteDefinition val2 = (firstFrameIsReference ? projectileCollection.inst.spriteDefinitions[projectileCollection.inst.GetSpriteIdByName(list[0])] : null); Vector2 val3 = Vector2.op_Implicit((Vector3)(((??)val2?.position0) ?? default(Vector3))); for (int i = 0; i < list.Count; i++) { int spriteIdByName = projectileCollection.inst.GetSpriteIdByName(list[i]); val.frames[i] = new tk2dSpriteAnimationFrame { spriteCollection = projectileCollection, spriteId = spriteIdByName }; tk2dSpriteDefinition val4 = projectileCollection.inst.spriteDefinitions[spriteIdByName]; if (scale != 1f) { val4.ScaleBy(scale); } object array; if (i <= 0 || val2 == null) { array = new Vector3[2]; object obj = array; Vector3 val5; IntVector2 value; if (!overrideColliderOffsets.HasValue) { val5 = val4.position0; } else { value = overrideColliderOffsets.Value; val5 = 0.0625f * ((IntVector2)(ref value)).ToVector3(); } ((Vector3[])obj)[0] = val5; object obj2 = array; Vector3 val6; if (!overrideColliderPixelSizes.HasValue) { val6 = val4.boundsDataExtents; } else { value = overrideColliderPixelSizes.Value; val6 = 0.0625f * ((IntVector2)(ref value)).ToVector3(); } ((Vector3[])obj2)[1] = 0.5f * val6; } else { array = val2.colliderVertices; } val4.colliderVertices = (Vector3[])array; if (val4 == val2 || val2 == null) { val4.BetterConstructOffsetsFromAnchor(anchor, fixesScales ? new Vector2?(Vector2.op_Implicit(val4.position3)) : ((Vector2?)null), fixesScales, anchorsChangeColliders); } else { val4.ShiftBy(Vector2.op_Implicit(val3)); } if (val4 == val2) { val3 = Vector3Extensions.XY(val2.position0) - val3; } } _KnownClips.Add(list[0]); return val; } public static tk2dSpriteAnimationClip Create(ref tk2dSpriteAnimationClip refClip, string name, int fps = 2, Anchor anchor = (Anchor)4, float scale = 1f, bool anchorsChangeColliders = true, bool fixesScales = true, IntVector2? overrideColliderPixelSizes = null, IntVector2? overrideColliderOffsets = null) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return refClip = Create(name, fps, anchor, scale, anchorsChangeColliders, fixesScales, overrideColliderPixelSizes, overrideColliderOffsets); } public static void SetAnimation(this Projectile proj, tk2dSpriteAnimationClip clip, int frame = 0, bool makeDefault = false) { tk2dSpriteAnimator spriteAnimator = ((BraveBehaviour)((BraveBehaviour)proj).sprite).spriteAnimator; spriteAnimator.currentClip = clip; spriteAnimator.PlayFromFrame(frame); if (makeDefault) { spriteAnimator.DefaultClipId = spriteAnimator.Library.clips.Length - 1; } } public static void AddClip(this tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, bool overwriteExisting = false) { if ((Object)(object)animator.Library == (Object)null) { animator.Library = GameObjectExtensions.GetOrAddComponent(((Component)animator).gameObject); animator.Library.clips = (tk2dSpriteAnimationClip[])(object)new tk2dSpriteAnimationClip[0]; ((Behaviour)animator.Library).enabled = true; } if (overwriteExisting || animator.Library.clips == null) { animator.Library.clips = (tk2dSpriteAnimationClip[])(object)new tk2dSpriteAnimationClip[1] { clip }; } else { int num = animator.Library.clips.Length; Array.Resize(ref animator.Library.clips, num + 1); animator.Library.clips[num] = clip; } } public static void AddAnimation(this Projectile proj, tk2dSpriteAnimationClip clip, bool overwriteExisting = false) { if (!Object.op_Implicit((Object)(object)((BraveBehaviour)((BraveBehaviour)proj).sprite).spriteAnimator)) { ((BraveBehaviour)((BraveBehaviour)proj).sprite).spriteAnimator = GameObjectExtensions.GetOrAddComponent(((Component)((BraveBehaviour)proj).sprite).gameObject); } tk2dSpriteAnimator spriteAnimator = ((BraveBehaviour)((BraveBehaviour)proj).sprite).spriteAnimator; spriteAnimator.AddClip(clip, overwriteExisting); spriteAnimator.playAutomatically = true; spriteAnimator.deferNextStartClip = false; } public static void AddDefaultAnimation(this Projectile proj, tk2dSpriteAnimationClip clip, int frame = 0, bool overwriteExisting = false) { proj.AddAnimation(clip, overwriteExisting); proj.SetAnimation(clip, frame, makeDefault: true); } public static void AddDefaultAnimation(this Projectile proj, GunData b, int frame = 0) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(b.sprite)) { proj.AddDefaultAnimation(Create(b.sprite, b.fps, b.anchor, b.scale, b.anchorsChangeColliders, b.fixesScales, b.overrideColliderPixelSizes, b.overrideColliderOffsets), frame, overwriteExisting: true); } } } public class EasyTrailBullet : BraveBehaviour, IPPPComponent { private const float _DEFAULT_TRAIL_DEPTH = 20f; private static readonly LinkedList _TrailPool = new LinkedList(); private static readonly LinkedList _UsedTrails = new LinkedList(); private static readonly LinkedList _ExtantTrails = new LinkedList(); private static int _TrailsCreated = 0; private Projectile proj; private GameObject tro; private Transform trt; private CustomTrailRenderer tr; private Material mat; private LinkedListNode node; public Vector3 TrailPos; public Color BaseColor; public Color StartColor; public Color EndColor; public float LifeTime; public float StartWidth; public float EndWidth; private static GameObject Rent(GameObject parent) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown if (_TrailPool.Count == 0) { if (_TrailsCreated == 0) { CwaffEvents.OnFloorEnded = (Action)Delegate.Combine(CwaffEvents.OnFloorEnded, new Action(OnFloorEnded)); } GameObject val = ETGMod.AddChild(parent, "trail object", new Type[1] { typeof(CustomTrailRenderer) }); CustomTrailRenderer component = val.GetComponent(); component.minVertexDistance = 0.1f; component.material = new Material(ShaderCache.Acquire("Brave/PlayerShader")); component.material.mainTexture = null; component.colors = (Color[])(object)new Color[2]; component.widths = new float[2]; _TrailPool.AddLast(val); _TrailsCreated++; } LinkedListNode last = _TrailPool.Last; _TrailPool.RemoveLast(); GameObject value = last.Value; last.Value = null; _UsedTrails.AddLast(last); value.SetActive(true); CustomTrailRenderer component2 = value.GetComponent(); ((Behaviour)component2).enabled = true; component2.Clear(); component2.Reenable(); return value; } private static void OnFloorEnded() { int count = _ExtantTrails.Count; for (int i = 0; i < count; i++) { _ExtantTrails.Last.Value.Cleanup(); } } private static void Return(GameObject trail) { trail.GetComponent().Clear(); trail.transform.parent = null; Object.DontDestroyOnLoad((Object)(object)trail); trail.SetActive(false); LinkedListNode last = _UsedTrails.Last; _UsedTrails.RemoveLast(); last.Value = trail; _TrailPool.AddLast(last); } private EasyTrailBullet() { //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_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_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) TrailPos = new Vector3(0f, 0f, 20f); BaseColor = Color.red; StartColor = Color.red; EndColor = Color.white; LifeTime = 1f; StartWidth = 1f; EndWidth = 0f; } private void Start() { //IL_0054: 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_0080: 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_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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) proj = ((BraveBehaviour)this).projectile; tro = Rent(((Component)proj).gameObject); trt = tro.transform; trt.parent = ((Component)proj).gameObject.transform; trt.rotation = Quaternion.identity; trt.position = ((BraveBehaviour)proj).transform.position; trt.localPosition = TrailPos; tr = tro.GetComponent(); mat = tr.material; mat.SetColor(CwaffVFX._ColorId, BaseColor); tr.colors[0] = StartColor; tr.colors[1] = EndColor; tr.widths[0] = StartWidth; tr.widths[1] = EndWidth; tr.lifeTime = LifeTime; node = _ExtantTrails.AddLast(this); } private void LateUpdate() { //IL_0014: 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_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_003d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)tro)) { trt.rotation = Quaternion.identity; Vector3 position = trt.position; trt.position = Vector3Extensions.WithZ(position, position.y + 20f); } } public void UpdateTrail() { //IL_001a: 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_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) if (Object.op_Implicit((Object)(object)tro)) { mat.SetColor(CwaffVFX._ColorId, BaseColor); tr.colors[0] = StartColor; tr.colors[1] = EndColor; tr.widths[0] = StartWidth; tr.widths[1] = EndWidth; tr.lifeTime = LifeTime; } } private void Cleanup() { if (Object.op_Implicit((Object)(object)tro)) { Return(tro); tro = null; } if (node != null) { _ExtantTrails.Remove(node); node = null; } } public override void OnDestroy() { Cleanup(); ((BraveBehaviour)this).OnDestroy(); } public void PPPInit(PlayerProjectilePoolInfo pppi) { } public void PPPReset(GameObject prefab) { Cleanup(); } public void PPPRespawn() { Start(); } } public static class SlashDoer { public enum ProjInteractMode { IGNORE, DESTROY, REFLECT, REFLECTANDPOSTPROCESS } public static void DoSwordSlash(Vector2 position, float angle, GameActor owner, SlashData slashParameters, Transform parentTransform = null) { //IL_0084: 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_0017: Unknown result type (might be due to invalid IL or missing references) if (slashParameters.doVFX && slashParameters.VFX != null) { slashParameters.VFX.SpawnAtPosition(Vector2.op_Implicit(position), angle, parentTransform, (Vector2?)null, (Vector2?)null, (float?)(-0.05f), false, (SpawnMethod)null, (tk2dBaseSprite)null, false); } if (!string.IsNullOrEmpty(slashParameters.soundEvent) && (Object)(object)owner != (Object)null && (Object)(object)((Component)owner).gameObject != (Object)null) { ((Component)owner).gameObject.Play(slashParameters.soundEvent); } ((MonoBehaviour)GameManager.Instance).StartCoroutine(HandleSlash(position, angle, owner, slashParameters)); } private static IEnumerator HandleSlash(Vector2 position, float angle, GameActor owner, SlashData slashParameters) { //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) int slashId = Time.frameCount; List alreadyHit = new List(); if (slashParameters.playerKnockbackForce != 0f && (Object)(object)owner != (Object)null) { ((BraveBehaviour)owner).knockbackDoer.ApplyKnockback(BraveMathCollege.DegreesToVector(angle, 1f), slashParameters.playerKnockbackForce, 0.25f, false); } float ela = 0f; while (ela < 0.2f) { ela += BraveTime.DeltaTime; HandleHeroSwordSlash(alreadyHit, position, angle, slashId, owner, slashParameters); yield return null; } } private static bool SlasherIsPlayerOrFriendly(GameActor slasher) { if (slasher is PlayerController) { return true; } if (slasher is AIActor) { if (Object.op_Implicit((Object)(object)((Component)slasher).GetComponent())) { return true; } if (!((BraveBehaviour)slasher).aiActor.CanTargetPlayers && ((BraveBehaviour)slasher).aiActor.CanTargetEnemies) { return true; } } return false; } private static bool ProjectileIsValid(Projectile proj, GameActor slashOwner) { if (Object.op_Implicit((Object)(object)proj)) { if ((Object)(object)slashOwner == (Object)null) { return false; } if (SlasherIsPlayerOrFriendly(slashOwner)) { if ((Object.op_Implicit((Object)(object)proj.Owner) && !(proj.Owner is PlayerController)) || proj.ForcePlayerBlankable) { return true; } } else if (slashOwner is AIActor) { if (Object.op_Implicit((Object)(object)proj.Owner) && proj.Owner is PlayerController) { return true; } } else if (Object.op_Implicit((Object)(object)proj.Owner)) { return true; } } return false; } private static bool ObjectWasHitBySlash(Vector2 ObjectPosition, Vector2 SlashPosition, float slashAngle, float SlashRange, float SlashDimensions) { //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_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) if (Vector2.Distance(ObjectPosition, SlashPosition) < SlashRange) { float num = BraveMathCollege.Atan2Degrees(ObjectPosition - SlashPosition); float num2 = Math.Min(SlashDimensions, 0f - SlashDimensions); float num3 = Math.Max(SlashDimensions, 0f - SlashDimensions); bool result = false; float num4 = slashAngle + num3; float num5 = slashAngle + num2; if (MathsAndLogicHelper.IsBetweenRange(num, num5, num4)) { result = true; } if (num4 > 180f) { float num6 = num4 - 180f; if (MathsAndLogicHelper.IsBetweenRange(num, -180f, -180f + num6)) { result = true; } } if (num5 < -180f) { float num7 = num5 + 180f; if (MathsAndLogicHelper.IsBetweenRange(num, 180f + num7, 180f)) { result = true; } } return result; } return false; } private static void HandleHeroSwordSlash(List alreadyHit, Vector2 arcOrigin, float slashAngle, int slashId, GameActor owner, SlashData slashParameters) { //IL_0104: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) float slashDegrees = slashParameters.slashDegrees; float slashRange = slashParameters.slashRange; ReadOnlyCollection allProjectiles = StaticReferenceManager.AllProjectiles; for (int num = allProjectiles.Count - 1; num >= 0; num--) { Projectile val = allProjectiles[num]; if (ProjectileIsValid(val, owner) && ObjectWasHitBySlash(val.SafeCenter, arcOrigin, slashAngle, slashRange, slashDegrees)) { if (slashParameters.OnHitBullet != null) { slashParameters.OnHitBullet(val); } if (slashParameters.projInteractMode != ProjInteractMode.IGNORE || val.collidesWithProjectiles) { if (slashParameters.projInteractMode == ProjInteractMode.DESTROY || slashParameters.projInteractMode == ProjInteractMode.IGNORE) { val.DieInAir(false, true, true, true); } else if ((slashParameters.projInteractMode == ProjInteractMode.REFLECT || slashParameters.projInteractMode == ProjInteractMode.REFLECTANDPOSTPROCESS) && (Object)(object)val.Owner != (Object)null && val.LastReflectedSlashId != slashId) { ProjectileUtility.ReflectBullet(val, true, owner, 5f, slashParameters.projInteractMode == ProjInteractMode.REFLECTANDPOSTPROCESS, 1f, 5f, 0f, (string)null); val.LastReflectedSlashId = slashId; } } } } DealDamageToEnemiesInArc(owner, arcOrigin, slashAngle, slashRange, slashParameters, alreadyHit); if (!slashParameters.damagesBreakables) { return; } List allMinorBreakables = StaticReferenceManager.AllMinorBreakables; for (int num2 = allMinorBreakables.Count - 1; num2 >= 0; num2--) { MinorBreakable val2 = allMinorBreakables[num2]; if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)((BraveBehaviour)val2).specRigidbody) && !val2.IsBroken && Object.op_Implicit((Object)(object)((BraveBehaviour)val2).sprite) && ObjectWasHitBySlash(((BraveBehaviour)val2).sprite.WorldCenter, arcOrigin, slashAngle, slashRange, slashDegrees)) { if (slashParameters.OnHitMinorBreakable != null) { slashParameters.OnHitMinorBreakable(val2); } val2.Break(); } } List allMajorBreakables = StaticReferenceManager.AllMajorBreakables; for (int num3 = allMajorBreakables.Count - 1; num3 >= 0; num3--) { MajorBreakable val3 = allMajorBreakables[num3]; if (Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)((BraveBehaviour)val3).specRigidbody) && !alreadyHit.Contains(((BraveBehaviour)val3).specRigidbody) && !val3.IsSecretDoor && !val3.IsDestroyed && ObjectWasHitBySlash(((BraveBehaviour)val3).specRigidbody.UnitCenter, arcOrigin, slashAngle, slashRange, slashDegrees)) { float num4 = slashParameters.damage; if (Object.op_Implicit((Object)(object)((BraveBehaviour)val3).healthHaver)) { num4 *= 0.2f; } if (slashParameters.OnHitMajorBreakable != null) { slashParameters.OnHitMajorBreakable(val3); } val3.ApplyDamage(num4, ((BraveBehaviour)val3).specRigidbody.UnitCenter - arcOrigin, false, false, false); alreadyHit.Add(((BraveBehaviour)val3).specRigidbody); } } } private static void DealDamageToEnemiesInArc(GameActor owner, Vector2 arcOrigin, float arcAngle, float arcRadius, SlashData slashParameters, List alreadyHit = null) { //IL_000b: 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_0085: 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_0098: 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_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0250: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0277: 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_027a: 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_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0282: 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_010f: 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_02c9: Unknown result type (might be due to invalid IL or missing references) if (SlasherIsPlayerOrFriendly(owner)) { RaycastResult val2 = default(RaycastResult); foreach (AIActor allNearbyEnemy in arcOrigin.GetAllNearbyEnemies()) { if (allNearbyEnemy.IsNormalEnemy && Object.op_Implicit((Object)(object)((BraveBehaviour)allNearbyEnemy).specRigidbody) && (alreadyHit == null || !alreadyHit.Contains(((BraveBehaviour)allNearbyEnemy).specRigidbody))) { for (int i = 0; i < ((BraveBehaviour)allNearbyEnemy).healthHaver.NumBodyRigidbodies; i++) { SpeculativeRigidbody bodyRigidbody = ((BraveBehaviour)allNearbyEnemy).healthHaver.GetBodyRigidbody(i); PixelCollider hitboxPixelCollider = bodyRigidbody.HitboxPixelCollider; if (hitboxPixelCollider != null) { Vector2 val = BraveMathCollege.ClosestPointOnRectangle(arcOrigin, hitboxPixelCollider.UnitBottomLeft, hitboxPixelCollider.UnitDimensions); if (ObjectWasHitBySlash(val, arcOrigin, arcAngle, arcRadius, 90f)) { bool flag = true; int num = CollisionMask.LayerToMask((CollisionLayer)6, (CollisionLayer)8, (CollisionLayer)12); if (PhysicsEngine.Instance.Raycast(arcOrigin, val - arcOrigin, Vector2.Distance(val, arcOrigin), ref val2, true, true, num, (CollisionLayer?)null, false, (Func)null, (SpeculativeRigidbody)null) && (Object)(object)val2.SpeculativeRigidbody != (Object)(object)bodyRigidbody) { flag = false; } RaycastResult.Pool.Free(ref val2); if (flag) { float num2 = DealSwordDamageToEnemy(owner, (GameActor)(object)allNearbyEnemy, arcOrigin, val, arcAngle, slashParameters); if (alreadyHit != null) { if (alreadyHit.Count == 0) { StickyFrictionManager.Instance.RegisterSwordDamageStickyFriction(num2); } alreadyHit.Add(((BraveBehaviour)allNearbyEnemy).specRigidbody); } break; } } } } } } return; } List list = new List(); if (Object.op_Implicit((Object)(object)GameManager.Instance.PrimaryPlayer)) { list.Add(GameManager.Instance.PrimaryPlayer); } if (Object.op_Implicit((Object)(object)GameManager.Instance.SecondaryPlayer)) { list.Add(GameManager.Instance.SecondaryPlayer); } RaycastResult val5 = default(RaycastResult); for (int j = 0; j < list.Count; j++) { PlayerController val3 = list[j]; if (!Object.op_Implicit((Object)(object)val3) || !Object.op_Implicit((Object)(object)((BraveBehaviour)val3).specRigidbody) || !Object.op_Implicit((Object)(object)((BraveBehaviour)val3).healthHaver) || val3.IsGhost || (alreadyHit != null && alreadyHit.Contains(((BraveBehaviour)val3).specRigidbody))) { continue; } SpeculativeRigidbody specRigidbody = ((BraveBehaviour)val3).specRigidbody; PixelCollider hitboxPixelCollider2 = specRigidbody.HitboxPixelCollider; if (hitboxPixelCollider2 == null) { continue; } Vector2 val4 = BraveMathCollege.ClosestPointOnRectangle(arcOrigin, hitboxPixelCollider2.UnitBottomLeft, hitboxPixelCollider2.UnitDimensions); if (!ObjectWasHitBySlash(val4, arcOrigin, arcAngle, arcRadius, 90f)) { continue; } bool flag2 = true; int num3 = CollisionMask.LayerToMask((CollisionLayer)6, (CollisionLayer)8, (CollisionLayer)12); if (PhysicsEngine.Instance.Raycast(arcOrigin, val4 - arcOrigin, Vector2.Distance(val4, arcOrigin), ref val5, true, true, num3, (CollisionLayer?)null, false, (Func)null, (SpeculativeRigidbody)null) && (Object)(object)val5.SpeculativeRigidbody != (Object)(object)specRigidbody) { flag2 = false; } RaycastResult.Pool.Free(ref val5); if (!flag2) { continue; } float num4 = DealSwordDamageToEnemy(owner, (GameActor)(object)val3, arcOrigin, val4, arcAngle, slashParameters); if (alreadyHit != null) { if (alreadyHit.Count == 0) { StickyFrictionManager.Instance.RegisterSwordDamageStickyFriction(num4); } alreadyHit.Add(((BraveBehaviour)val3).specRigidbody); } break; } } private static float DealSwordDamageToEnemy(GameActor owner, GameActor targetEnemy, Vector2 arcOrigin, Vector2 contact, float angle, SlashData slashParameters) { //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_005c: 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_00e1: 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_00ee: 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_0098: 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_00a4: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)((BraveBehaviour)targetEnemy).healthHaver)) { float num = slashParameters.damage; if (Object.op_Implicit((Object)(object)((BraveBehaviour)targetEnemy).healthHaver) && ((BraveBehaviour)targetEnemy).healthHaver.IsBoss) { num *= slashParameters.bossDamageMult; } if (targetEnemy is AIActor && ((AIActor)((targetEnemy is AIActor) ? targetEnemy : null)).IsBlackPhantom) { num *= slashParameters.jammedDamageMult; } DamageCategory val = (DamageCategory)0; if (owner is AIActor && ((AIActor)((owner is AIActor) ? owner : null)).IsBlackPhantom) { val = (DamageCategory)4; } bool isAlive = ((BraveBehaviour)targetEnemy).healthHaver.IsAlive; if (slashParameters.doHitVFX && slashParameters.hitVFX != null) { slashParameters.hitVFX.SpawnAtPosition(new Vector3(contact.x, contact.y), 0f, ((BraveBehaviour)targetEnemy).transform, (Vector2?)null, (Vector2?)null, (float?)null, false, (SpawnMethod)null, (tk2dBaseSprite)null, false); } ((BraveBehaviour)targetEnemy).healthHaver.ApplyDamage(num, contact - arcOrigin, owner.ActorName, (CoreDamageTypes)0, val, false, (PixelCollider)null, false); bool arg = false; if (isAlive && ((BraveBehaviour)targetEnemy).healthHaver.IsDead) { arg = true; } if (slashParameters.OnHitTarget != null) { slashParameters.OnHitTarget(targetEnemy, arg); } } if (Object.op_Implicit((Object)(object)((BraveBehaviour)targetEnemy).knockbackDoer)) { ((BraveBehaviour)targetEnemy).knockbackDoer.ApplyKnockback(contact - arcOrigin, slashParameters.enemyKnockbackForce, false); } if (slashParameters.statusEffects != null && slashParameters.statusEffects.Count > 0) { foreach (GameActorEffect statusEffect in slashParameters.statusEffects) { targetEnemy.ApplyEffect(statusEffect, 1f, (Projectile)null); } } return slashParameters.damage; } } public class SlashData { public bool doVFX = true; public VFXPool VFX = Items.Blasphemy.AsGun().muzzleFlashEffects; public bool doHitVFX = true; public VFXPool hitVFX = Items.Blasphemy.AsGun().DefaultModule.projectiles[0].hitEffects.enemy; public SlashDoer.ProjInteractMode projInteractMode; public float playerKnockbackForce = 5f; public float enemyKnockbackForce = 10f; public List statusEffects = new List(); public float jammedDamageMult = 1f; public float bossDamageMult = 1f; public bool doOnSlash = true; public bool doPostProcessSlash = true; public float slashRange = 2.5f; public float slashDegrees = 90f; public float damage = 5f; public bool damagesBreakables = true; public string soundEvent = "Play_WPN_blasphemy_shot_01"; public Action OnHitTarget; public Action OnHitBullet; public Action OnHitMinorBreakable; public Action OnHitMajorBreakable; public static SlashData CloneSlashData(SlashData original) { return new SlashData { doVFX = original.doVFX, VFX = original.VFX, doHitVFX = original.doHitVFX, hitVFX = original.hitVFX, projInteractMode = original.projInteractMode, playerKnockbackForce = original.playerKnockbackForce, enemyKnockbackForce = original.enemyKnockbackForce, statusEffects = original.statusEffects, jammedDamageMult = original.jammedDamageMult, bossDamageMult = original.bossDamageMult, doOnSlash = original.doOnSlash, doPostProcessSlash = original.doPostProcessSlash, slashRange = original.slashRange, slashDegrees = original.slashDegrees, damage = original.damage, damagesBreakables = original.damagesBreakables, soundEvent = original.soundEvent, OnHitTarget = original.OnHitTarget, OnHitBullet = original.OnHitBullet, OnHitMinorBreakable = original.OnHitMinorBreakable, OnHitMajorBreakable = original.OnHitMajorBreakable }; } } public class EmissiveTrail : MonoBehaviour { private List TransformList = new List { "trailObject" }; public float EmissivePower; public float EmissiveColorPower; public bool debugLogging; public EmissiveTrail() { EmissivePower = 75f; EmissiveColorPower = 1.55f; debugLogging = false; } public void Start() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown Shader shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTiltedCutoutEmissive"); foreach (Transform item in ((Component)this).transform) { Transform val = item; tk2dBaseSprite component = ((Component)val).GetComponent(); if ((Object)(object)component != (Object)null) { if (debugLogging) { Debug.Log((object)("Checks were passed for transform; " + ((Object)val).name)); } component.usesOverrideMaterial = true; ((BraveBehaviour)component).renderer.material.shader = shader; ((BraveBehaviour)component).renderer.material.EnableKeyword("BRIGHTNESS_CLAMP_ON"); ((BraveBehaviour)component).renderer.material.SetFloat(CwaffVFX._EmissivePowerId, EmissivePower); ((BraveBehaviour)component).renderer.material.SetFloat(CwaffVFX._EmissiveColorPowerId, EmissiveColorPower); } else if (debugLogging) { Debug.Log((object)"Sprite was null"); } } } } public class OwnerConnectLightningModifier : MonoBehaviour { public GameObject linkPrefab; public float baseDamage = 1f; public float disownTimer = -1f; public float fadeTimer = -1f; public float hitCooldown = 0.1f; public bool disowned; public Color color = ExtendedColours.paleYellow; public SpeculativeRigidbody targetBody; public bool shrinkFade; public float emissivePower = 100f; public GameActor owner; private tk2dTiledSprite extantLink; private Projectile proj; private bool makeGlowy; private bool destroyWithProjectile; private HashSet m_damagedEnemies = new HashSet(); private float shrinkLength = 1f; public Vector2 originPos; public Vector2 targetPos; private void OnDestroy() { if (Object.op_Implicit((Object)(object)extantLink)) { Object.Destroy((Object)(object)((Component)extantLink).gameObject); } } private void Start() { proj = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)proj)) { owner = proj.Owner; destroyWithProjectile = true; } } public void MakeGlowy() { makeGlowy = true; } private void Update() { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) if (destroyWithProjectile && !Object.op_Implicit((Object)(object)proj)) { DestroyExtantLink(); return; } if (!Object.op_Implicit((Object)(object)extantLink)) { extantLink = Object.Instantiate(linkPrefab).GetComponent(); if (makeGlowy) { Shader shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTiltedCutoutEmissive"); ((tk2dBaseSprite)extantLink).usesOverrideMaterial = true; Material material = ((BraveBehaviour)extantLink).renderer.material; material.shader = shader; material.DisableKeyword("BRIGHTNESS_CLAMP_ON"); material.EnableKeyword("BRIGHTNESS_CLAMP_OFF"); material.SetFloat(CwaffVFX._EmissivePowerId, emissivePower); material.SetFloat(CwaffVFX._EmissiveColorPowerId, 1.55f); material.SetColor(CwaffVFX._EmissiveColorId, color); ((tk2dBaseSprite)extantLink).color = color; } if (disownTimer <= 0f && fadeTimer > 0f) { ((MonoBehaviour)this).StartCoroutine(shrinkFade ? ShrinkOut() : FadeOut()); } } if (disownTimer > 0f) { disownTimer -= BraveTime.DeltaTime; if (disownTimer <= 0f) { owner = null; disowned = true; if (fadeTimer > 0f) { ((MonoBehaviour)this).StartCoroutine(shrinkFade ? ShrinkOut() : FadeOut()); } else { DestroyExtantLink(); } } } UpdateLink(); } private void DestroyExtantLink() { if (Object.op_Implicit((Object)(object)extantLink)) { Object.Destroy((Object)(object)((Component)extantLink).gameObject); extantLink = null; if (Object.op_Implicit((Object)(object)proj)) { Object.Destroy((Object)(object)this); } else { Object.Destroy((Object)(object)((Component)this).gameObject); } } } private IEnumerator FadeOut() { float halftimer = fadeTimer / 2f; float timer = halftimer; bool halfway = false; while (timer > 0f) { timer -= BraveTime.DeltaTime; if (timer < 0f && !halfway) { halfway = true; ((BraveBehaviour)extantLink).renderer.material.shader = ShaderCache.Acquire("Brave/LitBlendUber"); ((BraveBehaviour)extantLink).renderer.material.SetFloat("_VertexColor", 1f); timer = halftimer; } if (halfway) { ((tk2dBaseSprite)extantLink).color = Vector3Extensions.WithAlpha(((tk2dBaseSprite)extantLink).color, timer / halftimer); } else { ((BraveBehaviour)extantLink).renderer.material.SetFloat(CwaffVFX._EmissivePowerId, emissivePower * (timer / halftimer)); ((BraveBehaviour)extantLink).renderer.material.SetFloat(CwaffVFX._EmissiveColorPowerId, 1.55f * (timer / halftimer)); } yield return null; } DestroyExtantLink(); } private IEnumerator ShrinkOut() { for (float timer = fadeTimer; timer > 0f; timer -= BraveTime.DeltaTime) { shrinkLength = timer / fadeTimer; yield return null; } DestroyExtantLink(); } private void UpdateLink() { //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_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_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_009a: 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_00a7: 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_00e4: 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_011b: 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_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) if (Object.op_Implicit((Object)(object)proj)) { originPos = ((BraveBehaviour)proj).specRigidbody.UnitCenter; } if (Object.op_Implicit((Object)(object)targetBody)) { targetPos = targetBody.HitboxPixelCollider.UnitCenter; } else if (!disowned && Object.op_Implicit((Object)(object)owner)) { targetPos = ((BraveBehaviour)owner).specRigidbody.HitboxPixelCollider.UnitCenter; } ((BraveBehaviour)extantLink).transform.position = Vector2.op_Implicit(originPos); Vector2 val = targetPos - originPos; float num = BraveMathCollege.Atan2Degrees(((Vector2)(ref val)).normalized); int num2 = Mathf.RoundToInt(shrinkLength * ((Vector2)(ref val)).magnitude * 16f); extantLink.dimensions = new Vector2((float)num2, extantLink.dimensions.y); ((BraveBehaviour)extantLink).transform.rotation = Quaternion.Euler(0f, 0f, num); ((tk2dBaseSprite)extantLink).UpdateZDepth(); ApplyLinearDamage(originPos, targetPos); } private void ApplyLinearDamage(Vector2 p1, Vector2 p2) { //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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017e: 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_00ba: 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_00c4: 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_0217: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) Vector2 val = p2 - p1; Vector2 normalized = ((Vector2)(ref val)).normalized; GameActor obj = owner; PlayerController val2 = (PlayerController)(object)((obj is PlayerController) ? obj : null); if (val2 != null) { float num = baseDamage * val2.DamageMult(); float statValue = val2.stats.GetStatValue((StatType)22); Vector2 val4 = default(Vector2); for (int i = 0; i < StaticReferenceManager.AllEnemies.Count; i++) { AIActor val3 = StaticReferenceManager.AllEnemies[i]; if (!m_damagedEnemies.Contains(val3) && Object.op_Implicit((Object)(object)val3) && val3.HasBeenEngaged && val3.IsNormalEnemy && Object.op_Implicit((Object)(object)((BraveBehaviour)val3).specRigidbody) && Object.op_Implicit((Object)(object)((BraveBehaviour)val3).healthHaver)) { PixelCollider hitboxPixelCollider = ((BraveBehaviour)val3).specRigidbody.HitboxPixelCollider; if (hitboxPixelCollider != null && BraveUtility.LineIntersectsAABB(p1, p2, hitboxPixelCollider.UnitBottomLeft, hitboxPixelCollider.UnitDimensions, ref val4)) { ((BraveBehaviour)val3).healthHaver.ApplyDamage(num * (((BraveBehaviour)val3).healthHaver.IsBoss ? statValue : 1f), normalized, "Chain Lightning", (CoreDamageTypes)64, (DamageCategory)0, false, (PixelCollider)null, false); ((MonoBehaviour)GameManager.Instance).StartCoroutine(HandleDamageCooldown(val3)); } } } } else { if (!(owner is AIActor)) { return; } PlayerController[] allPlayers = GameManager.Instance.AllPlayers; Vector2 val6 = default(Vector2); foreach (PlayerController val5 in allPlayers) { if (!Object.op_Implicit((Object)(object)val5)) { continue; } PixelCollider hitboxPixelCollider2 = ((BraveBehaviour)val5).specRigidbody.HitboxPixelCollider; if (BraveUtility.LineIntersectsAABB(p1, p2, hitboxPixelCollider2.UnitBottomLeft, hitboxPixelCollider2.UnitDimensions, ref val6) && Object.op_Implicit((Object)(object)((BraveBehaviour)val5).healthHaver) && ((BraveBehaviour)val5).healthHaver.IsVulnerable && !val5.IsEthereal && !val5.IsGhost) { string text = "Electricity"; if (Object.op_Implicit((Object)(object)((BraveBehaviour)owner).encounterTrackable)) { text = ((BraveBehaviour)owner).encounterTrackable.GetModifiedDisplayName(); } if (Object.op_Implicit((Object)(object)proj) && proj.IsBlackBullet) { ((BraveBehaviour)val5).healthHaver.ApplyDamage(1f, normalized, text, (CoreDamageTypes)64, (DamageCategory)4, false, (PixelCollider)null, false); } else { ((BraveBehaviour)val5).healthHaver.ApplyDamage(0.5f, normalized, text, (CoreDamageTypes)64, (DamageCategory)0, false, (PixelCollider)null, false); } } } } } private IEnumerator HandleDamageCooldown(AIActor damagedTarget) { m_damagedEnemies.Add(damagedTarget); yield return (object)new WaitForSeconds(hitCooldown); m_damagedEnemies.Remove(damagedTarget); } } public static class Raycast { private static bool ExcludeAllButWallsAndEnemiesFromRaycasting(SpeculativeRigidbody s) { if ((Object)(object)((Component)s).GetComponent() != (Object)null) { return true; } if ((Object)(object)((Component)s).GetComponent() != (Object)null) { return true; } if ((Object)(object)((Component)s).GetComponent() != (Object)null) { return true; } if ((Object)(object)((Component)s).GetComponent() != (Object)null) { return true; } if ((Object)(object)((Component)s).GetComponent() != (Object)null) { return true; } return false; } private static bool ExcludeAllButWallsFromRaycasting(SpeculativeRigidbody s) { if (s.PrimaryPixelCollider.IsTileCollider) { return false; } return true; } public static Vector2 ToNearestWallOrEnemyOrObject(this Vector2 pos, float angle, float minDistance = 1f) { //IL_0005: 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_0018: 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_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_0070: 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_007d: Unknown result type (might be due to invalid IL or missing references) PhysicsEngine instance = PhysicsEngine.Instance; Vector2 val = pos + BraveMathCollege.DegreesToVector(angle, minDistance); Vector2 val2 = BraveMathCollege.DegreesToVector(angle, 1f); Func func = ExcludeAllButWallsAndEnemiesFromRaycasting; RaycastResult val3 = default(RaycastResult); Vector2 result = ((!instance.Raycast(val, val2, 200f, ref val3, true, true, int.MaxValue, (CollisionLayer?)null, false, func, (SpeculativeRigidbody)null)) ? (pos + BraveMathCollege.DegreesToVector(angle, minDistance)) : ((CastResult)val3).Contact); RaycastResult.Pool.Free(ref val3); return result; } public static Vector2 ToNearestWallOrObject(this Vector2 pos, float angle, float minDistance = 1f) { //IL_0005: 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_0018: 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_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_0070: 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_007d: Unknown result type (might be due to invalid IL or missing references) PhysicsEngine instance = PhysicsEngine.Instance; Vector2 val = pos + BraveMathCollege.DegreesToVector(angle, minDistance); Vector2 val2 = BraveMathCollege.DegreesToVector(angle, 1f); Func func = ExcludeAllButWallsFromRaycasting; RaycastResult val3 = default(RaycastResult); Vector2 result = ((!instance.Raycast(val, val2, 200f, ref val3, true, true, int.MaxValue, (CollisionLayer?)null, false, func, (SpeculativeRigidbody)null)) ? (pos + BraveMathCollege.DegreesToVector(angle, minDistance)) : ((CastResult)val3).Contact); RaycastResult.Pool.Free(ref val3); return result; } public static Vector2 ToNearestWall(this Vector2 pos, out Vector2 normal, float angle, float minDistance = 1f) { //IL_0005: 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_0018: 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_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_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_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) //IL_004c: 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) RaycastResult val = default(RaycastResult); Vector2 result; if (PhysicsEngine.Instance.Raycast(pos + BraveMathCollege.DegreesToVector(angle, minDistance), BraveMathCollege.DegreesToVector(angle, 1f), 200f, ref val, true, false, int.MaxValue, (CollisionLayer?)null, false, (Func)null, (SpeculativeRigidbody)null)) { result = ((CastResult)val).Contact; normal = ((CastResult)val).Normal; } else { result = pos + BraveMathCollege.DegreesToVector(angle, minDistance); normal = Vector2.zero; } RaycastResult.Pool.Free(ref val); return result; } public static Vector2 ToNearestWall(this Vector2 pos, float angle, float minDistance = 1f) { //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) Vector2 normal; return pos.ToNearestWall(out normal, angle, minDistance); } } public static class AfterImageHelpers { private const float _LIFETIME = 0.5f; public static Color afterImageGray = new Color(0.1254902f, 0.1254902f, 0.1254902f); public static Color afterImageWhite = new Color(1f, 1f, 1f); public static Color afterImageBlue = new Color(32f / 51f, 32f / 51f, 1f); public static Color afterImageYellow = new Color(1f, 1f, 0.47058824f); public static void PlayerAfterImage(this PlayerController player) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) tk2dSpriteAnimator spriteAnimator = ((BraveBehaviour)player).spriteAnimator; if (spriteAnimator != null) { tk2dSpriteAnimationClip currentClip = spriteAnimator.CurrentClip; if (currentClip != null && currentClip.frames != null && currentClip.frames.Length != 0) { tk2dSpriteAnimationFrame val = currentClip.frames[spriteAnimator.CurrentFrame % currentClip.frames.Length]; tk2dSprite val2 = Lazy.SpriteObject(val.spriteCollection, val.spriteId); ((tk2dBaseSprite)val2).FlipX = ((BraveBehaviour)player).sprite.FlipX; ((tk2dBaseSprite)val2).PlaceAtPositionByAnchor(((BraveBehaviour)((BraveBehaviour)player).sprite).transform.position, (Anchor)(((tk2dBaseSprite)val2).FlipX ? 2 : 0)); ((MonoBehaviour)val2).StartCoroutine(Fade((tk2dBaseSprite)(object)val2, 0.5f)); } } } public static void SpriteAfterImage(this tk2dBaseSprite sprite) { ((MonoBehaviour)sprite).StartCoroutine(Fade(sprite.DuplicateInWorld(), 0.5f)); } private static IEnumerator Fade(tk2dBaseSprite sprite, float fadeTime, float flickerRate = 0.05f) { ((BraveBehaviour)sprite).renderer.material.shader = ShaderCache.Acquire("Brave/LitBlendUber"); ((BraveBehaviour)sprite).renderer.material.SetFloat("_VertexColor", 1f); bool flickerOn = true; float flickerTimer = 0f; float timer = 0f; while (timer < fadeTime) { timer += BraveTime.DeltaTime; flickerTimer += BraveTime.DeltaTime; if (flickerTimer > flickerRate) { flickerTimer = 0f; flickerOn = !flickerOn; } sprite.color = Vector3Extensions.WithAlpha(afterImageYellow, flickerOn ? 1f : 0.35f); yield return null; } Object.Destroy((Object)(object)((Component)sprite).gameObject); } } public static class CustomNoteDoer { private static NoteDoer _Prefab; public static void Init() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) tk2dSprite obj = Lazy.SpriteObject(VFX.Collection, VFX.Collection.GetSpriteIdByName("note_icon")).RegisterPrefab(deactivate: true, markFake: true, dontUnload: true); ((tk2dBaseSprite)obj).PlaceAtPositionByAnchor(((Component)obj).gameObject.transform.position, (Anchor)1); _Prefab = ((Component)(object)obj).AddComponent(); } public static NoteDoer CreateNote(Vector2 position, string formattedNoteText, NoteBackgroundType background = (NoteBackgroundType)3, bool destroyOnRead = true, bool poofIn = true, tk2dSprite customSprite = null) { //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_0015: 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_0069: 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_008b: Unknown result type (might be due to invalid IL or missing references) NoteDoer component = Object.Instantiate(((Component)_Prefab).gameObject, Vector2Extensions.ToVector3ZisY(position, -1f), Quaternion.identity).GetComponent(); if ((Object)(object)customSprite != (Object)null) { ((BraveBehaviour)component).sprite.SetSprite(((tk2dBaseSprite)customSprite).Collection, ((tk2dBaseSprite)customSprite).spriteId); } component.alreadyLocalized = true; component.textboxSpawnPoint = ((BraveBehaviour)((BraveBehaviour)component).sprite).transform; component.stringKey = formattedNoteText; component.noteBackgroundType = background; component.DestroyedOnFinish = destroyOnRead; Vector3Extensions.GetAbsoluteRoom(position).RegisterInteractable((IPlayerInteractable)(object)component); if (poofIn) { LootEngine.DoDefaultItemPoof(((BraveBehaviour)component).sprite.WorldCenter, false, false); } return component; } } public class RotateIntoPositionBehavior : MonoBehaviour { public Vector2 m_fulcrum; public float m_radius; public float m_start_angle; public float m_end_angle; public float m_rotate_time; private float timer; private float angle_delta; private bool has_been_init; public void Setup() { timer = 0f; angle_delta = m_end_angle - m_start_angle; has_been_init = true; Relocate(); } private void Update() { if (has_been_init && !(timer > m_rotate_time)) { timer += BraveTime.DeltaTime; if (timer > m_rotate_time) { timer = m_rotate_time; } Relocate(); } } private void Relocate() { //IL_002c: 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_0042: 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_005a: 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_009a: Unknown result type (might be due to invalid IL or missing references) float num = timer / m_rotate_time; float num2 = m_start_angle + (float)Math.Tanh(num * (float)Math.PI) * angle_delta; Vector2 val = m_fulcrum + BraveMathCollege.DegreesToVector(num2, m_radius); ((Component)this).gameObject.transform.position = Vector2Extensions.ToVector3ZUp(val, ((Component)this).gameObject.transform.position.z); ((Component)this).gameObject.transform.rotation = Quaternion.Euler(0f, 0f, num2 + (float)((num2 > 180f) ? 180 : (-180))); } } public class Nametag : MonoBehaviour { private Text _nametag; private GameActor _actor; private GameObject _canvasGo; private GameObject _textGo; private static Font _Font; public void Setup(TextAnchor anchor = (TextAnchor)1) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_00d3: 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_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_0132: Unknown result type (might be due to invalid IL or missing references) if (_Font == null) { Object builtinResource = Resources.GetBuiltinResource(typeof(Font), "Arial.ttf"); _Font = (Font)(object)((builtinResource is Font) ? builtinResource : null); } _actor = ((Component)this).GetComponent(); _canvasGo = new GameObject(); ((Object)_canvasGo).name = "Canvas"; _canvasGo.AddComponent().renderMode = (RenderMode)1; _canvasGo.AddComponent(); _textGo = new GameObject(); _textGo.transform.parent = _canvasGo.transform; _nametag = _textGo.AddComponent(); _nametag.font = _Font; _nametag.text = ""; _nametag.fontSize = 32; _nametag.alignment = anchor; ((Graphic)_nametag).color = Color.green; ((Shadow)((Component)_nametag).gameObject.AddComponent()).effectColor = Color.black; RectTransform component = ((Component)_nametag).GetComponent(); ((Transform)component).localPosition = new Vector3(0f, 0f, 0f); component.sizeDelta = new Vector2(500f, 300f); ((BraveBehaviour)_actor).healthHaver.OnPreDeath += HandleEnemyDied; UpdateWhileParentAlive(); } public void SetName(string name) { _nametag.text = name; } internal bool UpdateWhileParentAlive() { //IL_0032: 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_005b: 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_007c: 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) if (!Object.op_Implicit((Object)(object)_actor) || !Object.op_Implicit((Object)(object)((BraveBehaviour)_actor).healthHaver) || ((BraveBehaviour)_actor).healthHaver.IsDead) { HandleEnemyDied(Vector2.zero); return false; } Vector3 position = Camera.main.WorldToScreenPoint(Vector2.op_Implicit(Object.op_Implicit((Object)(object)((BraveBehaviour)_actor).sprite) ? ((BraveBehaviour)_actor).sprite.WorldTopCenter : _actor.CenterPosition)); ((Component)_nametag).transform.position = position; return true; } private void HandleEnemyDied(Vector2 _) { Object.Destroy((Object)(object)_canvasGo); Object.Destroy((Object)(object)_textGo); Object.Destroy((Object)(object)this); } private void OnDestroy() { if (Object.op_Implicit((Object)(object)_canvasGo)) { Object.Destroy((Object)(object)_canvasGo); } if (Object.op_Implicit((Object)(object)_textGo)) { Object.Destroy((Object)(object)_textGo); } } public void SetEnabled(bool v) { _textGo.SetActive(v); } } public class FancyGrenadeProjectile : Projectile { public float startingHeight = 1f; public float startingVelocity; public float gravity = 10f; public float minBounceAngle; public float maxBounceAngle; public Action OnBounce; private float m_currentHeight; private Vector3 m_current3DVelocity; public override void Start() { //IL_0014: 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_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) ((Projectile)this).Start(); m_currentHeight = startingHeight; m_current3DVelocity = Vector2Extensions.ToVector3ZUp(base.m_currentDirection * base.m_currentSpeed, startingVelocity); } public override void Move() { //IL_00e9: 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_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_0103: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_00a4: 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_00ba: Unknown result type (might be due to invalid IL or missing references) m_current3DVelocity.x = base.m_currentDirection.x; m_current3DVelocity.y = base.m_currentDirection.y; m_current3DVelocity.z += ((Projectile)this).LocalDeltaTime * (0f - gravity); float num = m_currentHeight + m_current3DVelocity.z * ((Projectile)this).LocalDeltaTime; bool num2 = num < 0f; if (num2) { if (maxBounceAngle > 0f) { m_current3DVelocity = Vector2Extensions.ToVector3ZUp((Vector2Extensions.ToAngle(base.m_currentDirection) + BraveUtility.RandomSign() * Random.Range(minBounceAngle, maxBounceAngle)).ToVector(), 0f - m_current3DVelocity.z); } else { m_current3DVelocity.z = 0f - m_current3DVelocity.z; } num *= -1f; } m_currentHeight = num; base.m_currentDirection = Vector3Extensions.XY(m_current3DVelocity); Vector2 val = Vector3Extensions.XY(m_current3DVelocity); Vector2 val2 = ((Vector2)(ref val)).normalized * base.m_currentSpeed; ((BraveBehaviour)this).specRigidbody.Velocity = new Vector2(val2.x, val2.y + m_current3DVelocity.z); ((Projectile)this).LastVelocity = Vector3Extensions.XY(m_current3DVelocity); if (num2) { OnBounce(); } } public override void DoModifyVelocity() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_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_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) //IL_003b: 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_0053: 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_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) if (base.ModifyVelocity != null) { Vector2 val = Vector3Extensions.XY(m_current3DVelocity); Vector2 val2 = ((Vector2)(ref val)).normalized * base.m_currentSpeed; val2 = base.ModifyVelocity(val2); ((BraveBehaviour)this).specRigidbody.Velocity = new Vector2(val2.x, val2.y + m_current3DVelocity.z); if (((Vector2)(ref val2)).sqrMagnitude > 0f) { base.m_currentDirection = ((Vector2)(ref val2)).normalized; } } } public void Redirect(Vector2 direction) { //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) base.m_currentDirection = direction; } } public class SkipNonProjectileCollisionsBehavior : MonoBehaviour { private void Start() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown SpeculativeRigidbody component = ((Component)this).GetComponent(); if (component != null) { component.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)component.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreRigidbodyCollision)); component.OnPreTileCollision = (OnPreTileCollisionDelegate)Delegate.Combine((Delegate?)(object)component.OnPreTileCollision, (Delegate?)new OnPreTileCollisionDelegate(OnPreTileCollision)); } } private void OnDestroy() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown SpeculativeRigidbody component = ((Component)this).GetComponent(); if (component != null) { component.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Remove((Delegate?)(object)component.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(OnPreRigidbodyCollision)); component.OnPreTileCollision = (OnPreTileCollisionDelegate)Delegate.Remove((Delegate?)(object)component.OnPreTileCollision, (Delegate?)new OnPreTileCollisionDelegate(OnPreTileCollision)); } } private void OnPreRigidbodyCollision(SpeculativeRigidbody me, PixelCollider myPixelCollider, SpeculativeRigidbody other, PixelCollider otherPixelCollider) { if (!Object.op_Implicit((Object)(object)((BraveBehaviour)other).projectile)) { PhysicsEngine.SkipCollision = true; } } private void OnPreTileCollision(SpeculativeRigidbody me, PixelCollider myPixelCollider, Tile other, PixelCollider otherPixelCollider) { PhysicsEngine.SkipCollision = true; } } public static class MovingDistortionWave { public static void DoMovingDistortionWave(this Transform parent, float distortionIntensity, float distortionRadius, float maxRadius, float duration) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviour)new GameObject("temp_explosion_processor", new Type[1] { typeof(Exploder) }).GetComponent()).StartCoroutine(DoMovingDistortionWaveLocal(parent, distortionIntensity, distortionRadius, maxRadius, duration)); } private static Vector4 GetCenterPointInScreenUV(Vector2 centerPoint, float dIntensity, float dRadius) { //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_0026: 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) Vector3 val = GameManager.Instance.MainCameraController.Camera.WorldToViewportPoint(Vector2Extensions.ToVector3ZUp(centerPoint, 0f)); return new Vector4(val.x, val.y, dRadius, dIntensity); } private static IEnumerator DoMovingDistortionWaveLocal(Transform parent, float distortionIntensity, float distortionRadius, float maxRadius, float duration) { Material distMaterial = new Material(ShaderCache.Acquire("Brave/Internal/DistortionWave")); Vector2 center = (((Object)(object)parent != (Object)null) ? Vector2.op_Implicit(parent.position) : Vector2.zero); Vector4 centerPointInScreenUV = GetCenterPointInScreenUV(center, distortionIntensity, distortionRadius); distMaterial.SetVector("_WaveCenter", centerPointInScreenUV); Pixelator.Instance.RegisterAdditionalRenderPass(distMaterial); float elapsed = 0f; while (elapsed < duration && (!BraveUtility.isLoadingLevel || !GameManager.Instance.IsLoadingLevel)) { elapsed += BraveTime.DeltaTime; float num = elapsed / duration; num = BraveMathCollege.LinearToSmoothStepInterpolate(0f, 1f, num); if ((Object)(object)parent != (Object)null) { center = Vector2.op_Implicit(parent.position); } centerPointInScreenUV = GetCenterPointInScreenUV(center, distortionIntensity, distortionRadius); centerPointInScreenUV.w = Mathf.Lerp(centerPointInScreenUV.w, 0f, num); distMaterial.SetVector("_WaveCenter", centerPointInScreenUV); float num2 = Mathf.Lerp(0f, maxRadius, num); distMaterial.SetFloat("_DistortProgress", num2 / maxRadius * (maxRadius / 33.75f)); yield return null; } Pixelator.Instance.DeregisterAdditionalRenderPass(distMaterial); Object.Destroy((Object)(object)distMaterial); } } public class DissipatingSpriteFragment : MonoBehaviour { private Vector2 _start = Vector2.zero; private Vector2 _target = Vector2.zero; private float _time; private float _lifetime; private float _delay; private bool _autoDestroy; private bool _setup; private tk2dSprite _sprite; public void Setup(Vector2 start, Vector2 target, float time, float delay = 0f, bool autoDestroy = false) { //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_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) _start = start; _target = target; _time = time; _sprite = ((Component)this).GetComponent(); _delay = delay; _autoDestroy = autoDestroy; _setup = true; } private void Update() { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00bf: 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_00c7: 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_0083: Unknown result type (might be due to invalid IL or missing references) if (!_setup) { return; } _lifetime += BraveTime.DeltaTime; if (_delay > 0f) { if (_lifetime < _delay) { return; } _lifetime -= _delay; _delay = 0f; } if (_lifetime >= _time) { if (_autoDestroy) { ((Component)this).gameObject.SafeDestroy(); } else { ((tk2dBaseSprite)(object)_sprite).PlaceAtRotatedPositionByAnchor(Vector2.op_Implicit(_target), (Anchor)4); } } else { float num = 1f - _lifetime / _time; float num2 = 1f - num * num; Vector2 val = Vector2.Lerp(_start, _target, num2); ((tk2dBaseSprite)(object)_sprite).PlaceAtRotatedPositionByAnchor(Vector2.op_Implicit(val), (Anchor)4); } } } public class FlippedCarryPixelOffset : MonoBehaviour { [HarmonyPatch(typeof(Gun), "HandleSpriteFlip")] private class GunSpriteFlipFixerPatch { private static void Prefix(bool flipped, ref bool __state) { __state = flipped; } private static void Postfix(Gun __instance, bool flipped, bool __state) { //IL_0032: 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) bool flag = __state; FlippedCarryPixelOffset component = ((Component)__instance).GetComponent(); if (component != null) { GameActor currentOwner = __instance.CurrentOwner; PlayerController val = (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null); if (val != null && (flag != component._cachedFlipped || component._firstSpriteCheck)) { __instance.carryPixelOffset = component.GetOffset(val.characterIdentity, flag); component._cachedFlipped = flag; component._firstSpriteCheck = false; } } } } private bool _cachedFlipped; private bool _firstSpriteCheck = true; public IntVector2 defaultCarryOffset; public IntVector2 defaultFlippedCarryOffset; public IntVector2[] carryOffsets = (IntVector2[])(object)new IntVector2[11]; public IntVector2[] flippedCarryOffsets = (IntVector2[])(object)new IntVector2[11]; public static void AddTo(Gun gun, IntVector2 offset, IntVector2 flippedOffset, IntVector2? offsetPilot = null, IntVector2? flippedOffsetPilot = null, IntVector2? offsetConvict = null, IntVector2? flippedOffsetConvict = null, IntVector2? offsetRobot = null, IntVector2? flippedOffsetRobot = null, IntVector2? offsetNinja = null, IntVector2? flippedOffsetNinja = null, IntVector2? offsetCosmonaut = null, IntVector2? flippedOffsetCosmonaut = null, IntVector2? offsetSoldier = null, IntVector2? flippedOffsetSoldier = null, IntVector2? offsetGuide = null, IntVector2? flippedOffsetGuide = null, IntVector2? offsetCoopCultist = null, IntVector2? flippedOffsetCoopCultist = null, IntVector2? offsetBullet = null, IntVector2? flippedOffsetBullet = null, IntVector2? offsetEevee = null, IntVector2? flippedOffsetEevee = null, IntVector2? offsetGunslinger = null, IntVector2? flippedOffsetGunslinger = null) { //IL_000c: 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_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_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_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_003c: 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_004b: 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_005e: 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_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_0086: 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_009a: 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_00a0: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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) //IL_00ec: 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_00f2: 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_0101: 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_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) //IL_011a: 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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013c: 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_0142: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: 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_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) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: 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_01cf: Unknown result type (might be due to invalid IL or missing references) FlippedCarryPixelOffset flippedCarryPixelOffset = ((Component)gun).gameObject.AddComponent(); flippedCarryPixelOffset.defaultCarryOffset = offset; flippedCarryPixelOffset.defaultFlippedCarryOffset = flippedOffset; flippedCarryPixelOffset.carryOffsets[0] = offsetPilot ?? offset; flippedCarryPixelOffset.carryOffsets[1] = offsetConvict ?? offset; flippedCarryPixelOffset.carryOffsets[2] = offsetRobot ?? offset; flippedCarryPixelOffset.carryOffsets[3] = offsetNinja ?? offset; flippedCarryPixelOffset.carryOffsets[4] = offsetCosmonaut ?? offset; flippedCarryPixelOffset.carryOffsets[5] = offsetSoldier ?? offset; flippedCarryPixelOffset.carryOffsets[6] = offsetGuide ?? offset; flippedCarryPixelOffset.carryOffsets[7] = offsetCoopCultist ?? offset; flippedCarryPixelOffset.carryOffsets[8] = offsetBullet ?? offset; flippedCarryPixelOffset.carryOffsets[9] = offsetEevee ?? offset; flippedCarryPixelOffset.carryOffsets[10] = offsetGunslinger ?? offset; flippedCarryPixelOffset.flippedCarryOffsets[0] = flippedOffsetPilot ?? flippedOffset; flippedCarryPixelOffset.flippedCarryOffsets[1] = flippedOffsetConvict ?? flippedOffset; flippedCarryPixelOffset.flippedCarryOffsets[2] = flippedOffsetRobot ?? flippedOffset; flippedCarryPixelOffset.flippedCarryOffsets[3] = flippedOffsetNinja ?? flippedOffset; flippedCarryPixelOffset.flippedCarryOffsets[4] = flippedOffsetCosmonaut ?? flippedOffset; flippedCarryPixelOffset.flippedCarryOffsets[5] = flippedOffsetSoldier ?? flippedOffset; flippedCarryPixelOffset.flippedCarryOffsets[6] = flippedOffsetGuide ?? flippedOffset; flippedCarryPixelOffset.flippedCarryOffsets[7] = flippedOffsetCoopCultist ?? flippedOffset; flippedCarryPixelOffset.flippedCarryOffsets[8] = flippedOffsetBullet ?? flippedOffset; flippedCarryPixelOffset.flippedCarryOffsets[9] = flippedOffsetEevee ?? flippedOffset; flippedCarryPixelOffset.flippedCarryOffsets[10] = flippedOffsetGunslinger ?? flippedOffset; } private IntVector2 GetOffset(PlayableCharacters identity, bool flipped) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Expected I4, but got Unknown //IL_002f: 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_001e: 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) int num = (int)identity; if (num <= 10) { if (!flipped) { return carryOffsets[num]; } return flippedCarryOffsets[num]; } if (!flipped) { return defaultCarryOffset; } return defaultFlippedCarryOffset; } } public class ManualMotionModule : ProjectileAndBeamMotionModule { public override void Move(Projectile source, Transform projectileTransform, tk2dBaseSprite projectileSprite, SpeculativeRigidbody specRigidbody, ref float m_timeElapsed, ref Vector2 m_currentDirection, bool Inverted, bool shouldRotate) { } public override void UpdateDataOnBounce(float angleDiff) { } public override Vector2 GetBoneOffset(BeamBone bone, BeamController sourceBeam, bool inverted) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return Vector2.zero; } } public static class Replicant { private static GameActorCharmEffect _CharmEffect = new GameActorCharmEffect { AffectsPlayers = false, AffectsEnemies = true, effectIdentifier = "replicant", resistanceType = (EffectResistanceType)0, stackMode = (EffectStackingMode)0, duration = 36000f }; public static AIActor Create(string guid, Vector2 position, Action shaderFunc, bool hasCollision) { //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_003a: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Invalid comparison between Unknown and I4 AIActor val = AIActor.Spawn(EnemyDatabase.GetOrLoadByGuid(guid), Vector2Extensions.ToIntVector2(position, (VectorConversions)0), Vector3Extensions.GetAbsoluteRoom(position), true, (AwakenAnimationType)2, true); if (!Object.op_Implicit((Object)(object)val)) { return null; } val.PreventBlackPhantom = true; val.SpawnInInstantly(); ((BraveBehaviour)val).sprite.PlaceAtPositionByAnchor(Vector2.op_Implicit(position), (Anchor)4); ((BraveBehaviour)val).specRigidbody.Initialize(); ((BraveBehaviour)val).specRigidbody.CollideWithTileMap = false; if (hasCollision) { PlayerController primaryPlayer = GameManager.Instance.PrimaryPlayer; if (primaryPlayer != null && Object.op_Implicit((Object)(object)((BraveBehaviour)primaryPlayer).specRigidbody)) { ((BraveBehaviour)val).specRigidbody.RegisterSpecificCollisionException(((BraveBehaviour)primaryPlayer).specRigidbody); } if ((int)GameManager.Instance.CurrentGameType == 1) { PlayerController secondaryPlayer = GameManager.Instance.SecondaryPlayer; if (secondaryPlayer != null && Object.op_Implicit((Object)(object)((BraveBehaviour)secondaryPlayer).specRigidbody)) { ((BraveBehaviour)val).specRigidbody.RegisterSpecificCollisionException(((BraveBehaviour)secondaryPlayer).specRigidbody); } } } else { ((BraveBehaviour)val).specRigidbody.CollideWithOthers = false; ((BraveBehaviour)val).specRigidbody.AddCollisionLayerIgnoreOverride(CollisionMask.LayerToMask((CollisionLayer)4)); } val.HitByEnemyBullets = false; val.IgnoreForRoomClear = true; val.IsHarmlessEnemy = true; ((GameActor)val).ApplyEffect((GameActorEffect)(object)_CharmEffect, 1f, (Projectile)null); SpawnEnemyOnDeath component = ((Component)val).GetComponent(); if (component != null) { component.chanceToSpawn = 0f; } HealthHaver healthHaver = ((BraveBehaviour)val).healthHaver; if (healthHaver != null) { healthHaver.PreventAllDamage = true; } KnockbackDoer knockbackDoer = ((BraveBehaviour)val).knockbackDoer; if (knockbackDoer != null) { knockbackDoer.SetImmobile(true, "replicant"); } val.ApplyShader(shaderFunc, includeHands: true, includeGun: true); return val; } } public struct IntVector3 { public int x; public int y; public int z; public static readonly IntVector3 zero = default(IntVector3); public static readonly IntVector3 one = new IntVector3(1, 1, 1); public IntVector3(int x = 0, int y = 0, int z = 0) { this.x = x; this.y = y; this.z = z; } } internal static class CompatibilityPatches { private const BindingFlags ANY_FLAGS = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; internal static void Init(Harmony harmony) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { if (assembly.GetName().Name == "JuneLib") { harmony.HandleJuneLibCompatibilityPatches(assembly); } } } private static void HandleJuneLibCompatibilityPatches(this Harmony harmony, Assembly assembly) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown Type type = assembly.GetType("JunePlayerEvents"); if ((object)type != null) { MethodInfo method = type.GetMethod("OverrideShootSingleProjectile", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if ((object)method != null) { Type typeFromHandle = typeof(ShootSingleProjectilePatch); harmony.Patch((MethodBase)method, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeFromHandle.GetMethod("ReduceSpreadWhenIdleIL", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))); harmony.Patch((MethodBase)method, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeFromHandle.GetMethod("AimBotZeroSpreadIL", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))); harmony.Patch((MethodBase)method, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeFromHandle.GetMethod("DynamicAccuracyIL", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))); harmony.Patch((MethodBase)method, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeFromHandle.GetMethod("CheckFreebieIL", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))); } } } } public class CwaffEnemyReticle : CwaffReticle { } public class CwaffProjectileReticle : CwaffReticle { } public class CwaffReticle : MonoBehaviour { public enum Visibility { DEFAULT, CONTROLLER, CHARGING, WITHTARGET, ALWAYS } public GameObject reticleVFX; public float reticleAlpha = 1f; public float fadeInTime; public float fadeOutTime; public bool smoothLerp; public bool aimFromPlayerCenter; public bool background; public float maxDistance = -1f; public float controllerScale = 1f; public float rotateSpeed; public Visibility visibility; public Func targetObjFunc; public Func targetPosFunc; private GameObject _extantVfx; private CwaffGun _gun; private PlayerController _player; private Vector2 _currentPos = Vector2.zero; private GameObject _targetObject; private Vector2 _targetPos = Vector2.zero; private Vector2 _clampedTargetPos = Vector2.zero; private bool _visible; private float _fadeProgress; private void Start() { _gun = ((Component)this).gameObject.GetComponent(); _player = ((GunBehaviour)_gun).PlayerOwner; } private void LateUpdate() { if (Object.op_Implicit((Object)(object)_gun) && Object.op_Implicit((Object)(object)((GunBehaviour)_gun).PlayerOwner)) { _player = ((GunBehaviour)_gun).PlayerOwner; HandleVisibility(); HandleTargeting(); HandlePositioning(); } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)_extantVfx)) { Object.Destroy((Object)(object)_extantVfx); } } public void HideImmediately() { //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) _visible = false; if (Object.op_Implicit((Object)(object)_extantVfx)) { _extantVfx.SetAlphaImmediate(0f); if (Object.op_Implicit((Object)(object)_gun) && Object.op_Implicit((Object)(object)((GunBehaviour)_gun).PlayerOwner)) { _extantVfx.transform.position = Vector2.op_Implicit(((GameActor)((GunBehaviour)_gun).PlayerOwner).CenterPosition); } } } public Vector2 GetTargetPos() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _targetPos; } public bool IsVisible() { return _visible; } private void HandleVisibility() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) if (!Object.op_Implicit((Object)(object)_extantVfx)) { _extantVfx = Object.Instantiate(reticleVFX, ((Component)((GunBehaviour)_gun).gun.barrelOffset).transform.position, Quaternion.identity); if (background) { GameObjectExtensions.SetLayerRecursively(_extantVfx, LayerMask.NameToLayer("BG_Critical")); } _extantVfx.SetAlphaImmediate(0f); } if (!_player.AcceptingNonMotionInput) { _visible = false; } else { Vector2 vector; switch (visibility) { case Visibility.DEFAULT: { int visible2; if (!_player.IsKeyboardAndMouse()) { vector = ((TwoAxisInputControl)_player.m_activeActions.Aim).Vector; visible2 = ((((Vector2)(ref vector)).sqrMagnitude > 0.02f) ? 1 : 0); } else { visible2 = 1; } _visible = (byte)visible2 != 0; break; } case Visibility.CONTROLLER: { int visible; if (!_player.IsKeyboardAndMouse()) { vector = ((TwoAxisInputControl)_player.m_activeActions.Aim).Vector; visible = ((((Vector2)(ref vector)).sqrMagnitude > 0.02f) ? 1 : 0); } else { visible = 0; } _visible = (byte)visible != 0; break; } case Visibility.CHARGING: _visible = ((GunBehaviour)_gun).gun.IsCharging || ((GunBehaviour)_gun).gun.IsFiring; break; case Visibility.WITHTARGET: _visible = (Object)(object)_targetObject != (Object)null; break; case Visibility.ALWAYS: _visible = true; break; } } if (_visible) { if (fadeInTime > 0f && _fadeProgress < 1f) { _fadeProgress = Mathf.Min(_fadeProgress + BraveTime.DeltaTime / fadeInTime, 1f); } else { _fadeProgress = 1f; } } else if (fadeOutTime > 0f && _fadeProgress > 0f) { _fadeProgress = Mathf.Max(_fadeProgress - BraveTime.DeltaTime / fadeOutTime, 0f); } else { _fadeProgress = 0f; } _extantVfx.SetAlpha(reticleAlpha * _fadeProgress); } private void HandleTargeting() { //IL_003f: 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_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: 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_0122: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_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_00c9: 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_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: 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) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_extantVfx) || !_player.AcceptingNonMotionInput) { return; } if (rotateSpeed > 0f) { _extantVfx.transform.localRotation = (rotateSpeed * BraveTime.ScaledTimeSinceStartup).EulerZ(); } if (targetObjFunc != null) { _targetObject = targetObjFunc(this); if (Object.op_Implicit((Object)(object)_targetObject)) { GameActor component = _targetObject.GetComponent(); if (component != null) { _targetPos = component.CenterPosition; } else { Projectile component2 = _targetObject.GetComponent(); if (component2 != null) { _targetPos = component2.SafeCenter; } else { _targetPos = Vector2.op_Implicit(_targetObject.transform.position); } } } else if (targetPosFunc != null) { _targetPos = targetPosFunc(this); } } else if (targetPosFunc != null) { _targetPos = targetPosFunc(this); } else if (!_player.IsKeyboardAndMouse()) { _targetPos = ((GameActor)_player).CenterPosition + controllerScale * ((TwoAxisInputControl)_player.m_activeActions.Aim).Vector; } else { _targetPos = Vector3Extensions.XY(_player.unadjustedAimPoint); } if (maxDistance > 0f) { Vector2 val = (aimFromPlayerCenter ? ((GameActor)_player).CenterPosition : Vector2.op_Implicit(((Component)((GunBehaviour)_gun).gun.barrelOffset).transform.position)); Vector2 val2 = _targetPos - val; if (((Vector2)(ref val2)).sqrMagnitude > maxDistance * maxDistance) { _targetPos = val + maxDistance * ((Vector2)(ref val2)).normalized; } } } private void HandlePositioning() { //IL_0038: 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_0048: 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_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_004d: 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) if (!_visible && _fadeProgress <= 0f) { _targetPos = ((GameActor)_player).CenterPosition; } _currentPos = (smoothLerp ? Lazy.SmoothestLerp(_currentPos, _targetPos, 16f) : _targetPos); _extantVfx.transform.position = Vector2.op_Implicit(_currentPos); } } public enum ModdedShopType { TimeTrader, Talbert, Rusty, Boomhildr, Ironside, Doug, Handy } public static class ModdedShopItemAdder { internal static Dictionary _ModdedShopNameMap = new Dictionary(); internal static Dictionary> _ModdedShopItems = new Dictionary>(); private static bool _ModdedShopsInitialized = false; private static bool _OurShopsInitialized = false; public static void Init() { CwaffEvents.OnAllModsLoaded = (Action)Delegate.Combine(CwaffEvents.OnAllModsLoaded, new Action(AddOurItemsToModdedShops)); CwaffEvents.OnAllModsLoaded = (Action)Delegate.Combine(CwaffEvents.OnAllModsLoaded, new Action(AddModdedItemsToOurShops)); ModdedShopType[] array = (ModdedShopType[])Enum.GetValues(typeof(ModdedShopType)); foreach (ModdedShopType key in array) { _ModdedShopItems[key] = new List(); } _ModdedShopNameMap["psog:timedshop"] = ModdedShopType.TimeTrader; _ModdedShopNameMap["psog:tabletechshop"] = ModdedShopType.Talbert; _ModdedShopNameMap["nn:Rusty"] = ModdedShopType.Rusty; _ModdedShopNameMap["nn:Boomhildr"] = ModdedShopType.Boomhildr; _ModdedShopNameMap["nn:Ironside"] = ModdedShopType.Ironside; _ModdedShopNameMap["nn:Doug"] = ModdedShopType.Doug; _ModdedShopNameMap["ski:Arms_Dealer"] = ModdedShopType.Handy; } public static Gun AddToShop(this Gun gun, ShopType type) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ItemBuilder.AddToSubShop((PickupObject)(object)gun, type, 1f); return gun; } public static Gun AddToShop(this Gun gun, ModdedShopType type) { _ModdedShopItems[type].Add(((PickupObject)gun).PickupObjectId); return gun; } public static void AddToShop(this PickupObject po, ModdedShopType type) { _ModdedShopItems[type].Add(po.PickupObjectId); } private static void AddItemToPool(this GenericLootTable lootTable, int poID, float weight = 1f) { //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_001e: 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_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_0049: Expected O, but got Unknown PickupObject byId = PickupObjectDatabase.GetById(poID); lootTable.defaultItemDrops.Add(new WeightedGameObject { pickupId = byId.PickupObjectId, weight = weight, rawGameObject = ((Component)byId).gameObject, forceDuplicatesPossible = false, additionalPrerequisites = (DungeonPrerequisite[])(object)new DungeonPrerequisite[0] }); } private static void AddModdedItemsToOurShops() { if (_OurShopsInitialized) { return; } _OurShopsInitialized = true; ShopLog("adding modded items to our shops: "); foreach (GameObject key in FancyShopBuilder.DelayedModdedLootAdditions.Keys) { ShopLog(" looking in shop " + ((Object)key).name); GenericLootTable shopItems = key.GetComponent().shopItems; foreach (string item in FancyShopBuilder.DelayedModdedLootAdditions[key]) { PickupObject moddedItem = Lazy.GetModdedItem(item); if (Object.op_Implicit((Object)(object)moddedItem)) { ShopLog(" adding modded item " + moddedItem.EncounterNameOrDisplayName + " to shop"); shopItems.AddItemToPool(moddedItem.PickupObjectId); } } } } private static void AddOurItemsToModdedShops() { if (_ModdedShopsInitialized) { return; } _ModdedShopsInitialized = true; ShopLog("adding our items to modded shops: "); Stopwatch stopwatch = Stopwatch.StartNew(); Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { Type type = assembly.GetType("NpcApi.ShopAPI"); if ((object)type == null) { type = assembly.GetType("NpcApi.ItsDaFuckinShopApi"); } Type type2 = assembly.GetType("NpcApi.CustomShopController"); if ((object)type != null && (object)type2 != null) { ShopLog(" found assembly: " + assembly.GetName().Name); FieldInfo field = type.GetField("builtShops", BindingFlags.Static | BindingFlags.Public); if ((object)field == null || (object)field.FieldType != typeof(Dictionary)) { ETGModConsole.Log((object)" failed to retrieve built shops", false); } else if (!(field.GetValue(null) is Dictionary builtShops)) { ETGModConsole.Log((object)" failed to convert shop dictionary", false); } else { AddOurItemsToModdedShops(builtShops); } } } AddOurItemsToModdedShops(ShopAPI.builtShops); stopwatch.Stop(); } private static void AddOurItemsToModdedShops(Dictionary builtShops) { foreach (KeyValuePair builtShop in builtShops) { BaseShopController component = builtShop.Value.GetComponent(); if (component == null) { continue; } GenericLootTable shopItems = component.shopItems; if (shopItems == null) { continue; } ShopLog(" found shop " + builtShop.Key); if (!_ModdedShopNameMap.TryGetValue(builtShop.Key, out var value)) { continue; } foreach (int item in _ModdedShopItems[value]) { ShopLog($" adding {item} == {PickupObjectDatabase.GetById(item).EncounterNameOrDisplayName} with weight 1"); shopItems.AddItemToPool(item); } } } private static void ShopLog(object text) { } } public class FancyShopData { public const int DEFAULT_SHOP_FLOORS = 127; public GameObject shop; public TalkDoerLite owner; public PrototypeDungeonRoom room; public GenericLootTable loot; } public static class FancyShopBuilder { public delegate bool SpawnCondition(SpawnConditions conds); private class AddShotAnimation : MonoBehaviour { private void Start() { FsmStateAction[] actions = ((Component)this).GetComponent().FsmStates[8].Actions; foreach (FsmStateAction obj in actions) { DialogueBox val = (DialogueBox)(object)((obj is DialogueBox) ? obj : null); if (val != null) { val.SuppressDefaultAnims = FsmBool.op_Implicit(false); val.OverrideTalkAnim = FsmString.op_Implicit("shot"); } } } } public static Dictionary FancyShopRooms = new Dictionary(); public static Dictionary> DelayedModdedLootAdditions = new Dictionary>(); private static int _RigidBodyHeight = 20; private static IntVector2 _RigidBodyOffset = new IntVector2(0, -8); private static List _DefaultLine = new List { "Buy somethin', will ya!" }; public static FancyShopData MakeFancyShop(string npcName, List shopItems, string roomPath, List moddedItems = null, float spawnChanceEachRun = 1f, Vector2? carpetOffset = null, int? idleFps = null, int? talkFps = null, bool loopTalk = true, CwaffPrerequisites spawnPrerequisite = CwaffPrerequisites.NONE, SpawnCondition prequisiteValidator = null, string voice = null, List genericDialog = null, List stopperDialog = null, List purchaseDialog = null, List stolenDialog = null, List noSaleDialog = null, List introDialog = null, List attackedDialog = null, bool allowDupes = false, bool allowExcluded = false, float mainPoolChance = 0f, Vector3? talkPointOffset = null, Vector3? npcPosition = null, List itemPositions = null, bool exactlyOncePerRun = true, int allowedTilesets = 127, float costModifier = 1f, bool canBeRobbed = true, bool flipTowardsPlayer = true, Func customCanBuy = null, Func removeCurrency = null, Func customPrice = null, Func onPurchase = null, Func onSteal = null) { //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0344: 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_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0364: 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_036e: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) if (moddedItems == null) { moddedItems = new List(); } string text = npcName.ToUpper(); ("#" + text + "_GENERIC_TALK").SetupDBStrings(genericDialog ?? _DefaultLine); ("#" + text + "_STOPPER_TALK").SetupDBStrings(stopperDialog ?? _DefaultLine); ("#" + text + "_PURCHASE_TALK").SetupDBStrings(purchaseDialog ?? _DefaultLine); ("#" + text + "_NOSALE_TALK").SetupDBStrings(noSaleDialog ?? _DefaultLine); ("#" + text + "_INTRO_TALK").SetupDBStrings(introDialog ?? _DefaultLine); ("#" + text + "_ATTACKED_TALK").SetupDBStrings(attackedDialog ?? _DefaultLine); ("#" + text + "_STOLEN_TALK").SetupDBStrings(stolenDialog ?? _DefaultLine); List list = new List { (DungeonPrerequisite)(object)new CwaffPrerequisite { prerequisite = spawnPrerequisite.SetupPrerequisite(prequisiteValidator) } }; string text2 = ResMap.Get(npcName + "_currency", quietFailure: true)?[0]; if (!string.IsNullOrEmpty(text2)) { text2 += ".png"; } tk2dSpriteDefinition spriteDefinition = VFX.Collection.GetSpriteDefinition(ResMap.Get(npcName + "_idle")[0]); GenericLootTable val = shopItems.ToLootTable(); GameObject val2 = BetterSetUpShop(npcName, "cg", ResMap.Get(npcName + "_idle"), idleFps ?? 2, ResMap.Get(npcName + "_talk"), talkFps ?? 5, loopTalk: loopTalk, lootTable: val, currency: (ShopCurrencyType)((removeCurrency != null) ? 4 : 0), runBasedMultilineGenericStringKey: "#" + text + "_GENERIC_TALK", runBasedMultilineStopperStringKey: "#" + text + "_STOPPER_TALK", purchaseItemStringKey: "#" + text + "_PURCHASE_TALK", purchaseItemFailedStringKey: "#" + text + "_NOSALE_TALK", introStringKey: "#" + text + "_INTRO_TALK", attackedStringKey: "#" + text + "_ATTACKED_TALK", stolenFromStringKey: "#" + text + "_STOLEN_TALK", talkPointOffset: (Vector3)(((??)talkPointOffset) ?? ShopAPI.defaultTalkPointOffset), npcPosition: (Vector3)(((??)npcPosition) ?? ShopAPI.defaultNpcPosition), voiceBox: (VoiceBoxes)4, itemPositions: (itemPositions != null) ? itemPositions.ToArray() : ShopAPI.defaultItemPositions, costModifier: costModifier, giveStatsOnPurchase: false, statsToGiveOnPurchase: (StatModifier[])null, CustomCanBuy: customCanBuy, CustomRemoveCurrency: removeCurrency, CustomPrice: customPrice, OnPurchase: onPurchase, OnSteal: onSteal, currencyIconPath: text2, currencyName: "", canBeRobbed: canBeRobbed, hasCarpet: ResMap.Get(npcName + "_carpet", quietFailure: true)?[0] != null, carpetSpritePath: ResMap.Get(npcName + "_carpet", quietFailure: true)?[0], CarpetOffset: carpetOffset, hasMinimapIcon: ResMap.Get(npcName + "_icon", quietFailure: true)?[0] != null, minimapIconSpritePath: ResMap.Get(npcName + "_icon", quietFailure: true)?[0], addToMainNpcPool: mainPoolChance > 0f, percentChanceForMainPool: mainPoolChance, prerequisites: list.ToArray(), fortunesFavorRadius: 2f, poolType: (ShopItemPoolType)(allowExcluded ? 2 : (allowDupes ? 1 : 0)), RainbowModeImmunity: false, hitboxSize: (IntVector2?)new IntVector2(Mathf.RoundToInt(16f * spriteDefinition.boundsDataExtents.x), _RigidBodyHeight), hitboxOffset: (IntVector2?)(Vector2Extensions.ToIntVector2(16f * Vector3Extensions.XY(spriteDefinition.position0), (VectorConversions)2) + _RigidBodyOffset)); val2.AddComponent().Setup(spawnPrerequisite); TalkDoerLite componentInChildren = val2.GetComponentInChildren(); if (flipTowardsPlayer) { ((Component)componentInChildren).gameObject.AddComponent(); } if (!string.IsNullOrEmpty(voice)) { componentInChildren.audioCharacterSpeechTag = voice; } PrototypeDungeonRoom room = BuildNewRoomFromResourceWithoutRegistering(roomPath).room; InjectRoomIntoUniquePool(room, npcName + "'s Shop Room", new List { (FlowModifierPlacementType)1 }, 0f, list, npcName + "'s Shop Room", 1f, spawnChanceEachRun, val2, -0.75f, -0.75f, exactlyOncePerRun, allowedTilesets); DelayedModdedLootAdditions[val2] = moddedItems; FancyShopRooms[npcName] = room; return new FancyShopData { shop = val2, room = room, owner = componentInChildren, loot = val }; } public static GameObject BetterSetUpShop(string name, string prefix, List idleSpritePaths, int idleFps, List talkSpritePaths, int talkFps, GenericLootTable lootTable, ShopCurrencyType currency, string runBasedMultilineGenericStringKey, string runBasedMultilineStopperStringKey, string purchaseItemStringKey, string purchaseItemFailedStringKey, string introStringKey, string attackedStringKey, string stolenFromStringKey, Vector3 talkPointOffset, Vector3 npcPosition, VoiceBoxes voiceBox = (VoiceBoxes)4, Vector3[] itemPositions = null, float costModifier = 1f, bool giveStatsOnPurchase = false, StatModifier[] statsToGiveOnPurchase = null, Func CustomCanBuy = null, Func CustomRemoveCurrency = null, Func CustomPrice = null, Func OnPurchase = null, Func OnSteal = null, string currencyIconPath = "", string currencyName = "", bool canBeRobbed = true, bool hasCarpet = false, string carpetSpritePath = "", Vector2? CarpetOffset = null, bool hasMinimapIcon = false, string minimapIconSpritePath = "", bool addToMainNpcPool = false, float percentChanceForMainPool = 0.1f, DungeonPrerequisite[] prerequisites = null, float fortunesFavorRadius = 2f, ShopItemPoolType poolType = (ShopItemPoolType)0, bool RainbowModeImmunity = false, IntVector2? hitboxSize = null, IntVector2? hitboxOffset = null, bool loopTalk = true) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_003c: 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_005d: Expected O, but got Unknown //IL_00a9: 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_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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_017e: 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) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: 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_0283: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Expected O, but got Unknown //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Expected O, but got Unknown //IL_02d3: 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_0518: Unknown result type (might be due to invalid IL or missing references) //IL_0526: Expected O, but got Unknown //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_056a: 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_0594: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Invalid comparison between Unknown and I4 //IL_05ff: Unknown result type (might be due to invalid IL or missing references) //IL_060f: Unknown result type (might be due to invalid IL or missing references) //IL_062e: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Unknown result type (might be due to invalid IL or missing references) //IL_0759: Unknown result type (might be due to invalid IL or missing references) //IL_078d: Unknown result type (might be due to invalid IL or missing references) //IL_07ac: Unknown result type (might be due to invalid IL or missing references) //IL_07ba: Expected O, but got Unknown //IL_07df: Unknown result type (might be due to invalid IL or missing references) //IL_07e4: Unknown result type (might be due to invalid IL or missing references) //IL_0700: Unknown result type (might be due to invalid IL or missing references) //IL_070e: Expected O, but got Unknown //IL_0865: Unknown result type (might be due to invalid IL or missing references) //IL_086a: Unknown result type (might be due to invalid IL or missing references) //IL_0872: Unknown result type (might be due to invalid IL or missing references) //IL_087d: Unknown result type (might be due to invalid IL or missing references) //IL_0882: Unknown result type (might be due to invalid IL or missing references) //IL_0887: Unknown result type (might be due to invalid IL or missing references) //IL_0894: Unknown result type (might be due to invalid IL or missing references) //IL_089f: Unknown result type (might be due to invalid IL or missing references) //IL_08a6: Unknown result type (might be due to invalid IL or missing references) //IL_08ad: Unknown result type (might be due to invalid IL or missing references) //IL_08b4: Unknown result type (might be due to invalid IL or missing references) //IL_08bc: Unknown result type (might be due to invalid IL or missing references) //IL_08cd: Expected O, but got Unknown //IL_0807: Unknown result type (might be due to invalid IL or missing references) //IL_0813: Unknown result type (might be due to invalid IL or missing references) //IL_0822: Unknown result type (might be due to invalid IL or missing references) //IL_07ef: Unknown result type (might be due to invalid IL or missing references) //IL_07f4: Unknown result type (might be due to invalid IL or missing references) //IL_07f6: Unknown result type (might be due to invalid IL or missing references) try { if (prerequisites == null) { prerequisites = (DungeonPrerequisite[])(object)new DungeonPrerequisite[0]; } AssetBundle val = ResourceManager.LoadAssetBundle("shared_auto_001"); AssetBundle val2 = ResourceManager.LoadAssetBundle("shared_auto_002"); GameObject val3 = Extensions.RegisterPrefab(new GameObject("SpeechPoint"), deactivate: true, markFake: true, dontUnload: true, activate: true); val3.transform.position = talkPointOffset; GameObject val4 = Extensions.RegisterPrefab(new GameObject(prefix + ":" + name)); ((tk2dBaseSprite)val4.AddComponent()).SetSprite(VFX.Collection, VFX.Collection.GetSpriteIdByName(idleSpritePaths[0])); val4.layer = 22; tk2dSpriteCollectionData collection = ((tk2dBaseSprite)val4.GetComponent()).Collection; val3.transform.parent = val4.transform; List list = AtlasHelper.AddSpritesToCollection(idleSpritePaths, collection).AsRange(); List list2 = AtlasHelper.AddSpritesToCollection(talkSpritePaths, collection).AsRange(); tk2dSpriteAnimator val5 = val4.AddComponent(); SpriteBuilder.AddAnimation(val5, collection, list, "idle", (WrapMode)0, (float)idleFps); SpriteBuilder.AddAnimation(val5, collection, list2, "talk", (WrapMode)((!loopTalk) ? 2 : 0), (float)talkFps); IntVector2 valueOrDefault = hitboxSize.GetValueOrDefault(); if (!hitboxSize.HasValue) { valueOrDefault = new IntVector2(20, 18); hitboxSize = valueOrDefault; } if (!hitboxOffset.HasValue) { new IntVector2(5, 0); } ShopAPI.GenerateOrAddToRigidBody(val4, (CollisionLayer)5, (PixelColliderGeneration)0, true, true, true, false, false, false, false, true, hitboxSize, hitboxOffset).AddCollisionLayerOverride(CollisionMask.LayerToMask((CollisionLayer)8)); TalkDoerLite obj = val4.AddComponent(); ((DungeonPlaceableBehaviour)obj).placeableWidth = 4; ((DungeonPlaceableBehaviour)obj).placeableHeight = 3; ((DungeonPlaceableBehaviour)obj).difficulty = (PlaceableDifficulty)0; ((DungeonPlaceableBehaviour)obj).isPassable = true; obj.usesOverrideInteractionRegion = false; obj.overrideRegionOffset = Vector2.zero; obj.overrideRegionDimensions = Vector2.zero; obj.overrideInteractionRadius = -1f; obj.PreventInteraction = false; obj.AllowPlayerToPassEventually = true; obj.speakPoint = val3.transform; obj.SpeaksGleepGlorpenese = false; obj.audioCharacterSpeechTag = ShopAPI.ReturnVoiceBox(voiceBox); obj.playerApproachRadius = 5f; obj.conversationBreakRadius = 5f; obj.echo1 = null; obj.echo2 = null; obj.PreventCoopInteraction = false; obj.IsPaletteSwapped = false; obj.PaletteTexture = null; obj.OutlineDepth = 0.5f; obj.OutlineLuminanceCutoff = 0.05f; obj.MovementSpeed = 3f; obj.PathableTiles = (CellTypes)2; UltraFortunesFavor obj2 = val4.AddComponent(); obj2.goopRadius = fortunesFavorRadius; obj2.beamRadius = fortunesFavorRadius; obj2.bulletRadius = fortunesFavorRadius; obj2.bulletSpeedModifier = 0.8f; obj2.vfxOffset = 0.625f; obj2.sparkOctantVFX = val.LoadAsset("FortuneFavor_VFX_Spark"); AIAnimator val6 = ShopAPI.GenerateBlankAIAnimator(val4); ((BraveBehaviour)val6).spriteAnimator = val5; DirectionalAnimation val7 = new DirectionalAnimation(); val7.Type = (DirectionType)1; val7.Prefix = "idle"; val7.AnimNames = new string[1] { "" }; val7.Flipped = (FlipType[])(object)new FlipType[1]; val6.IdleAnimation = val7; val7 = new DirectionalAnimation(); val7.Type = (DirectionType)1; val7.Prefix = "talk"; val7.AnimNames = new string[1] { "" }; val7.Flipped = (FlipType[])(object)new FlipType[1]; val6.TalkAnimation = val7; GameObject gameObject = ((Component)ResourceManager.LoadAssetBundle("shared_auto_001").LoadAsset("Merchant_Key").transform.Find("NPC_Key")).gameObject; PlayMakerFSM val8 = val4.AddComponent(); JsonUtility.FromJsonOverwrite(JsonUtility.ToJson((object)gameObject.GetComponent()), (object)val8); FieldInfo? field = typeof(ActionData).GetField("fsmStringParams", BindingFlags.Instance | BindingFlags.NonPublic); (field.GetValue(val8.FsmStates[1].ActionData) as List)[0].Value = runBasedMultilineGenericStringKey; (field.GetValue(val8.FsmStates[1].ActionData) as List)[1].Value = runBasedMultilineStopperStringKey; (field.GetValue(val8.FsmStates[4].ActionData) as List)[0].Value = purchaseItemStringKey; (field.GetValue(val8.FsmStates[5].ActionData) as List)[0].Value = purchaseItemFailedStringKey; (field.GetValue(val8.FsmStates[7].ActionData) as List)[0].Value = introStringKey; (field.GetValue(val8.FsmStates[8].ActionData) as List)[0].Value = attackedStringKey; (field.GetValue(val8.FsmStates[9].ActionData) as List)[0].Value = stolenFromStringKey; (field.GetValue(val8.FsmStates[9].ActionData) as List)[1].Value = stolenFromStringKey; (field.GetValue(val8.FsmStates[10].ActionData) as List)[0].Value = "#SHOP_GENERIC_NO_SALE_LABEL"; (field.GetValue(val8.FsmStates[12].ActionData) as List)[0].Value = "#COOP_REBUKE"; ((Object)val4).name = prefix + ":" + name; List list3 = new List(); for (int i = 0; i < itemPositions.Length; i++) { GameObject val9 = Extensions.RegisterPrefab(new GameObject("ItemPoint" + i), deactivate: true, markFake: true, dontUnload: true, activate: true); val9.transform.position = itemPositions[i]; list3.Add(val9.transform); } CustomShopController val10 = new GameObject(prefix + ":" + name + "_Shop").AddComponent(); val10.AllowedToSpawnOnRainbowMode = RainbowModeImmunity; ((Component)val10).gameObject.RegisterPrefab(); val10.currencyType = currency; val10.ActionAndFuncSetUp(CustomCanBuy, CustomRemoveCurrency, CustomPrice, OnPurchase, OnSteal); if ((int)currency == 4) { if (!string.IsNullOrEmpty(currencyIconPath)) { val10.customPriceSprite = ShopAPI.AddCustomCurrencyType(currencyIconPath, prefix + ":" + currencyName, Assembly.GetCallingAssembly()); } else { val10.customPriceSprite = currencyName; } } val10.canBeRobbed = canBeRobbed; ((DungeonPlaceableBehaviour)val10).placeableHeight = 5; ((DungeonPlaceableBehaviour)val10).placeableWidth = 5; ((DungeonPlaceableBehaviour)val10).difficulty = (PlaceableDifficulty)0; ((DungeonPlaceableBehaviour)val10).isPassable = true; ((BaseShopController)val10).baseShopType = (AdditionalShopType)5; ((BaseShopController)val10).FoyerMetaShopForcedTiers = false; ((BaseShopController)val10).IsBeetleMerchant = false; ((BaseShopController)val10).ExampleBlueprintPrefab = null; val10.poolType = poolType; ((BaseShopController)val10).shopItems = lootTable; ((BaseShopController)val10).spawnPositions = list3.ToArray(); Transform[] spawnPositions = ((BaseShopController)val10).spawnPositions; for (int j = 0; j < spawnPositions.Length; j++) { spawnPositions[j].parent = ((Component)val10).gameObject.transform; } ((BaseShopController)val10).shopItemsGroup2 = null; ((BaseShopController)val10).spawnPositionsGroup2 = null; ((BaseShopController)val10).spawnGroupTwoItem1Chance = 0.5f; ((BaseShopController)val10).spawnGroupTwoItem2Chance = 0.5f; ((BaseShopController)val10).spawnGroupTwoItem3Chance = 0.5f; ((BaseShopController)val10).shopkeepFSM = val4.GetComponent(); ((BaseShopController)val10).shopItemShadowPrefab = val.LoadAsset("Merchant_Key").GetComponent().shopItemShadowPrefab; val10.prerequisites = prerequisites; ((BaseShopController)val10).cat = null; if (hasMinimapIcon) { if (!string.IsNullOrEmpty(minimapIconSpritePath)) { ((BaseShopController)val10).OptionalMinimapIcon = Extensions.RegisterPrefab(new GameObject("minimap_icon_sprite"), deactivate: false); ((tk2dBaseSprite)((BaseShopController)val10).OptionalMinimapIcon.AddComponent()).SetSprite(VFX.Collection, VFX.Collection.GetSpriteIdByName(minimapIconSpritePath)); } else { ref GameObject optionalMinimapIcon = ref ((BaseShopController)val10).OptionalMinimapIcon; Object obj3 = ResourceCache.Acquire("Global Prefabs/Minimap_NPC_Icon"); optionalMinimapIcon = (GameObject)(object)((obj3 is GameObject) ? obj3 : null); } } ((BaseShopController)val10).ShopCostModifier = costModifier; ((BaseShopController)val10).FlagToSetOnEncounter = (GungeonFlags)0; val10.giveStatsOnPurchase = giveStatsOnPurchase; val10.statsToGive = statsToGiveOnPurchase; val4.transform.parent = ((Component)val10).gameObject.transform; val4.transform.position = npcPosition; if (hasCarpet) { GameObject obj4 = Extensions.RegisterPrefab(new GameObject(prefix + ":" + name + "_Carpet"), deactivate: true, markFake: true, dontUnload: true, activate: true); tk2dSprite obj5 = obj4.AddComponent(); ((tk2dBaseSprite)obj5).SetSprite(VFX.Collection, VFX.Collection.GetSpriteIdByName(carpetSpritePath)); ((tk2dBaseSprite)obj5).SortingOrder = 2; Vector2 valueOrDefault2 = CarpetOffset.GetValueOrDefault(); if (!CarpetOffset.HasValue) { valueOrDefault2 = Vector2.zero; CarpetOffset = valueOrDefault2; } obj4.transform.position = new Vector3(CarpetOffset.Value.x, CarpetOffset.Value.y, 1.7f); obj4.transform.parent = ((Component)val10).gameObject.transform; obj4.layer = 20; } val4.SetActive(true); if (addToMainNpcPool) { val2.LoadAsset("shopannex_contents_01").variantTiers.Add(new DungeonPlaceableVariant { percentChance = percentChanceForMainPool, unitOffset = new Vector2(-0.5f, -1.25f), nonDatabasePlaceable = ((Component)val10).gameObject, enemyPlaceableGuid = "", pickupObjectPlaceableId = -1, forceBlackPhantom = false, addDebrisObject = false, prerequisites = prerequisites, materialRequirements = (DungeonPlaceableRoomMaterialRequirement[])(object)new DungeonPlaceableRoomMaterialRequirement[0] }); } ShopAPI.builtShops.Add(prefix + ":" + name, ((Component)val10).gameObject); return ((Component)val10).gameObject; } catch (Exception ex) { ETGModConsole.Log((object)ex.ToString(), false); return null; } } public static RoomData BuildNewRoomFromResourceWithoutRegistering(string roomPath) { //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_001b: 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) RoomData val = RoomFactory.ExtractRoomDataFromResource(roomPath, Assembly.GetCallingAssembly()); val.name = Path.GetFileName(roomPath); val.room = RoomFactory.Build(val); RoomFactory.PostProcessCells(val); return val; } public static CwaffPrerequisites SetupPrerequisite(this CwaffPrerequisites prereq, SpawnCondition validator) { if (prereq != CwaffPrerequisites.NONE) { CwaffPrerequisite.AddPrequisiteValidator(prereq, validator); } else if (validator != null) { ETGModConsole.Log((object)"ATTEMPTED TO SET UP VALIDATOR FOR PREREQUISITE == NONE", false); } return prereq; } public static GenericLootTable CreateLootTable(List includedLootTables = null, DungeonPrerequisite[] prerequisites = null) { //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_001b: Expected O, but got Unknown GenericLootTable obj = ScriptableObject.CreateInstance(); obj.defaultItemDrops = new WeightedGameObjectCollection { elements = new List() }; obj.tablePrerequisites = (DungeonPrerequisite[])(((object)prerequisites) ?? ((object)new DungeonPrerequisite[0])); obj.includedLootTables = includedLootTables ?? new List(); return obj; } public static void ForceSpawnForDebugPurposes(this PrototypeDungeonRoom room) { SharedInjectionData val = ScriptableObject.CreateInstance(); val.UseInvalidWeightAsNoInjection = true; val.PreventInjectionOfFailedPrerequisites = false; val.IsNPCCell = false; val.IgnoreUnmetPrerequisiteEntries = false; val.OnlyOne = false; val.ChanceToSpawnOne = 1f; val.AttachedInjectionData = new List(); val.InjectionData = new List { GenerateNewProcData(room, (ValidTilesets)2) }; ((Object)val).name = $"Debug Force Spawn Room {Guid.NewGuid()}"; SharedInjectionData val2; SharedInjectionData obj = (val2 = LoadHelper.LoadAssetFromAnywhere("Base Shared Injection Data")); if (val2.AttachedInjectionData == null) { val2.AttachedInjectionData = new List(); } obj.AttachedInjectionData.Add(val); } public unsafe static ProceduralFlowModifierData GenerateNewProcData(PrototypeDungeonRoom RequiredRoom, ValidTilesets Tileset) { //IL_004d: 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_006f: 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_007b: Expected O, but got Unknown string annotation = ((Object)RequiredRoom).name.ToString() + ((object)(*(ValidTilesets*)(&Tileset))/*cast due to .constrained prefix*/).ToString(); if (((Object)RequiredRoom).name.ToString() == null) { annotation = "EmergencyAnnotationName"; } Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(-2.25f, -1.25f); Vector2 item = default(Vector2); ((Vector2)(ref item))..ctor((float)(RequiredRoom.Width / 2) + val.x, (float)(RequiredRoom.Height / 2) + val.y); RequiredRoom.placedObjectPositions.Add(item); ProceduralFlowModifierData val2 = new ProceduralFlowModifierData(); val2.annotation = annotation; val2.DEBUG_FORCE_SPAWN = false; val2.OncePerRun = false; val2.placementRules = new List { (FlowModifierPlacementType)1 }; val2.roomTable = null; val2.exactRoom = RequiredRoom; val2.IsWarpWing = false; val2.RequiresMasteryToken = false; val2.chanceToLock = 0f; val2.selectionWeight = 2f; val2.chanceToSpawn = 1f; val2.RequiredValidPlaceable = null; val2.prerequisites = (DungeonPrerequisite[])(object)new DungeonPrerequisite[1] { new CwaffPrerequisite { prerequisite = CwaffPrerequisites.TEST_PREREQUISITE.SetupPrerequisite(null) } }; val2.CanBeForcedSecret = false; val2.RandomNodeChildMinDistanceFromEntrance = 0; val2.exactSecondaryRoom = null; val2.framedCombatNodes = 0; return val2; } public static void InjectRoomIntoUniquePool(PrototypeDungeonRoom protoroom, string injectionAnnotation, List placementRules, float chanceToLock, List prerequisites, string injectorName, float selectionWeight = 1f, float chanceToSpawnEachRun = 1f, GameObject addSingularPlaceable = null, float XFromCenter = 0f, float YFromCenter = 0f, bool oncePerRun = false, int allowedTilesets = 127) { //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_011a: 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_0128: 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_0136: 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_0145: 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_0157: 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_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Expected O, but got Unknown //IL_0023: 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_0045: 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_008f: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: 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_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: 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_01fc: 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_021a: Expected O, but got Unknown //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Expected O, but got Unknown //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Expected O, but got Unknown //IL_029c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)addSingularPlaceable != (Object)null) { Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(XFromCenter, YFromCenter); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor((float)(protoroom.Width / 2) + val.x, (float)(protoroom.Height / 2) + val.y); protoroom.placedObjectPositions.Add(val2); DungeonPrerequisite[] array = (DungeonPrerequisite[])(object)new DungeonPrerequisite[0]; DungeonPlaceable val3 = ScriptableObject.CreateInstance(); val3.width = 2; val3.height = 2; val3.respectsEncounterableDifferentiator = true; val3.variantTiers = new List { new DungeonPlaceableVariant { percentChance = 1f, nonDatabasePlaceable = addSingularPlaceable, prerequisites = array, materialRequirements = (DungeonPlaceableRoomMaterialRequirement[])(object)new DungeonPlaceableRoomMaterialRequirement[0] } }; protoroom.placedObjects.Add(new PrototypePlacedObjectData { contentsBasePosition = val2, fieldData = new List(), instancePrerequisites = array, linkedTriggerAreaIDs = new List(), placeableContents = val3 }); } ProceduralFlowModifierData item = new ProceduralFlowModifierData { annotation = injectionAnnotation, DEBUG_FORCE_SPAWN = false, OncePerRun = oncePerRun, placementRules = new List(placementRules), roomTable = null, exactRoom = protoroom, IsWarpWing = false, RequiresMasteryToken = false, chanceToLock = chanceToLock, selectionWeight = selectionWeight, chanceToSpawn = 1f, RequiredValidPlaceable = null, prerequisites = prerequisites.ToArray(), CanBeForcedSecret = true, RandomNodeChildMinDistanceFromEntrance = 0, exactSecondaryRoom = null, framedCombatNodes = 0 }; int num = 0; ValidTilesets[] array2 = Enum.GetValues(typeof(ValidTilesets)) as ValidTilesets[]; foreach (ValidTilesets val4 in array2) { if ((ValidTilesets)(val4 & allowedTilesets) == val4) { num++; } } SharedInjectionData injectionData = new SharedInjectionData { name = injectorName, UseInvalidWeightAsNoInjection = true, PreventInjectionOfFailedPrerequisites = false, IsNPCCell = false, IgnoreUnmetPrerequisiteEntries = false, OnlyOne = oncePerRun, ChanceToSpawnOne = 1f, AttachedInjectionData = new List(), InjectionData = new List { item } }; List entries = GameManager.Instance.GlobalInjectionData.entries; MetaInjectionDataEntry val5 = new MetaInjectionDataEntry(); val5.injectionData = injectionData; val5.MinToAppearPerRun = (oncePerRun ? 1 : num); val5.MaxToAppearPerRun = (oncePerRun ? 1 : num); val5.OverallChanceToTrigger = chanceToSpawnEachRun; val5.UsesUnlockedChanceToTrigger = false; val5.UnlockedChancesToTrigger = (MetaInjectionUnlockedChanceEntry[])(object)new MetaInjectionUnlockedChanceEntry[0]; val5.UsesWeightedNumberToAppearPerRun = false; val5.WeightedNumberToAppear = new WeightedIntCollection(); val5.AllowBonusSecret = false; val5.IsPartOfExcludedCastleSet = false; val5.validTilesets = (ValidTilesets)allowedTilesets; entries.Add(val5); } public static void AddParentedAnimationToShopFixed(this FancyShopData shop, List yourPaths, float YourAnimFPS, string AnimationName) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) GameObject shop2 = shop.shop; tk2dSpriteCollectionData collection = ((tk2dBaseSprite)shop2.GetComponentInChildren()).Collection; tk2dSpriteAnimator componentInChildren = shop2.GetComponentInChildren(); AIAnimator componentInChildren2 = shop2.GetComponentInChildren(); if (yourPaths != null) { List idsList = AtlasHelper.AddSpritesToCollection(yourPaths, collection).AsRange(); CreateDirectionalAnimation(componentInChildren, collection, componentInChildren2, idsList, AnimationName, YourAnimFPS); } } private static void CreateDirectionalAnimation(tk2dSpriteAnimator spriteAnimator, tk2dSpriteCollectionData collection, AIAnimator aianimator, List IdsList, string animationName, float FPS) { //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_0034: 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_003a: 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_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_0066: Expected O, but got Unknown //IL_006b: Expected O, but got Unknown SpriteBuilder.AddAnimation(spriteAnimator, collection, IdsList, animationName, (WrapMode)2, FPS); if (aianimator.OtherAnimations == null) { aianimator.OtherAnimations = new List(); } aianimator.OtherAnimations.Add(new NamedDirectionalAnimation { name = animationName, anim = new DirectionalAnimation { Type = (DirectionType)1, Prefix = animationName, AnimNames = new string[1], Flipped = (FlipType[])(object)new FlipType[1] } }); } public static void SetShotAnimation(this FancyShopData shop, List paths, float fps) { shop.AddParentedAnimationToShopFixed(paths, fps, "shot"); ((Component)shop.owner).gameObject.AddComponent(); } } public class ForceOutOfStockOnFailedSteal : MonoBehaviour { private CustomShopController _shop; private bool _didOutOfStock; private void Start() { _shop = ((Component)this).GetComponent(); } private void Update() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown if (_didOutOfStock || !((BaseShopController)_shop).m_wasCaughtStealing) { return; } foreach (Transform item in ((Component)this).transform) { Transform val = item; if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)((Component)val).gameObject)) { continue; } CustomShopItemController[] componentsInChildren = ((Component)val).gameObject.GetComponentsInChildren(); if (componentsInChildren != null && componentsInChildren.Length != 0) { CustomShopItemController val2 = componentsInChildren[0]; if (val2 != null && Object.op_Implicit((Object)(object)val2.item) && !((ShopItemController)val2).pickedUp) { val2.ForceOutOfStock(); } } } _didOutOfStock = true; } } public static class IncredibleItems { private class PaperChestInitializer : MonoBehaviour { private void Start() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) Chest component = ((Component)this).gameObject.GetComponent(); ((Behaviour)((BraveBehaviour)component).specRigidbody).enabled = true; ((BraveBehaviour)component).specRigidbody.Reinitialize(); component.m_isMimic = false; component.IsLocked = false; component.m_isGlitchChest = false; component.contents = null; component.forceContentIds = new List(1) { _IncredibleItemIDs.ChooseRandom() }; RoomHandler absoluteRoom = Vector3Extensions.GetAbsoluteRoom(((BraveBehaviour)component).transform.position); if (absoluteRoom != null) { component.RegisterChestOnMinimap(absoluteRoom); } } } [HarmonyPatch] private static class IncredibleChestPlacerPatches { private const float _INCREDIBLE_CHEST_CHANCE = 0.01f; [HarmonyPatch(typeof(FloorChestPlacer), "ConfigureOnPlacement")] [HarmonyPrefix] private static void FloorChestPlacerConfigureOnPlacementPatch(FloorChestPlacer __instance, RoomHandler room) { if (!(GameManager.Instance.RewardManager.CurrentRewardData.DetermineCurrentMagnificence(true) < 4f) && !(Random.value > 0.01f)) { __instance.UseOverrideChest = true; __instance.OverrideChestPrefab = _PaperChestPrefab; __instance.CenterChestInRegion = true; __instance.xPixelOffset = -8; __instance.yPixelOffset = -8; } } } internal static Chest _PaperChestPrefab = null; internal static readonly List _IncredibleItemIDs = new List(); public static void Init() { _PaperChestPrefab = ((Component)GameManager.Instance.RewardManager.GetTargetChestPrefab((ItemQuality)4)).gameObject.ClonePrefab().GetComponent(); _PaperChestPrefab.ShadowSprite = null; Transform val = ((Component)_PaperChestPrefab).gameObject.transform.Find("Shadow"); if (val != null) { Object.Destroy((Object)(object)((Component)val).gameObject); } Transform val2 = ((Component)_PaperChestPrefab).gameObject.transform.Find("SpawnTransform"); if (val2 != null) { Object.Destroy((Object)(object)((Component)val2).gameObject); } _PaperChestPrefab.spawnTransform = null; _PaperChestPrefab.spawnAnimName = "chest_paper_idle"; _PaperChestPrefab.openAnimName = ((BraveBehaviour)_PaperChestPrefab).sprite.SetUpAnimation("chest_paper_open", 30f, (WrapMode)2).name; _PaperChestPrefab.breakAnimName = _PaperChestPrefab.openAnimName; tk2dSpriteAnimator spriteAnimator = ((BraveBehaviour)_PaperChestPrefab).spriteAnimator; spriteAnimator.SetAudio("chest_paper_open", "paper_crinkle_sound", 4, 15, 18, 24); spriteAnimator.SetAudio("chest_paper_open", "paper_fall_sound", 30); spriteAnimator.defaultClipId = spriteAnimator.GetClipIdByName(((BraveBehaviour)_PaperChestPrefab).sprite.SetUpAnimation("chest_paper_idle", 1f, (WrapMode)2).name); ((BraveBehaviour)_PaperChestPrefab).sprite.SetSprite(spriteAnimator.library.clips[spriteAnimator.defaultClipId].frames[0].spriteId); _PaperChestPrefab.IsLocked = false; ((Component)_PaperChestPrefab).GetComponent().HitPoints = 1f; ((Component)_PaperChestPrefab).gameObject.AutoRigidBody((CollisionLayer)6, canBePushed: false, 0.25f); ((Component)_PaperChestPrefab).gameObject.AddComponent(); GunCarryingCase.Init(); WWIRations.Init(); Headstone.Init(); AssassinBullets.Init(); } private static T SetupIncredibleItem(this T item) where T : PickupObject { //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) ((PickupObject)item).quality = CwaffItemQuality.F; ((PickupObject)item).ShouldBeExcludedFromShops = true; ((PickupObject)item).CanBeSold = false; ((PickupObject)item).IgnoredByRat = true; ((PickupObject)item).UsesCustomCost = true; ((PickupObject)item).CustomCost = 0; _IncredibleItemIDs.Add(((PickupObject)item).PickupObjectId); return item; } public static PassiveItem SetupPassive(string ItemName, string ShortDescription, string LongDescription) where T : PassiveItem { return Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, string.Empty, hideFromAmmonomicon: true).SetupIncredibleItem(); } public static PlayerItem SetupActive(string ItemName, string ShortDescription, string LongDescription) where T : PlayerItem { return Lazy.SetupActive(ItemName, ShortDescription, LongDescription, string.Empty, hideFromAmmonomicon: true).SetupIncredibleItem(); } public static Chest SpawnPaperChest() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) bool flag = default(bool); return Chest.Spawn(_PaperChestPrefab, GameManager.Instance.PrimaryPlayer.CurrentRoom.GetCenteredVisibleClearSpot(2, 2, ref flag, false)); } } public class GunCarryingCase : CwaffPassive { public static string ItemName = "Gun Carrying Case"; public static string ShortDescription = "Portable and Convenient"; public static string LongDescription = "Increases gun carrying capacity by 1."; public static void Init() { IncredibleItems.SetupPassive(ItemName, ShortDescription, LongDescription).passiveStatModifiers = (StatModifier[])(object)new StatModifier[1] { ((StatType)7).Add(1f) }; } } public class WWIRations : CwaffActive { public static string ItemName = "WWI Rations"; public static string ShortDescription = "20 Year Shelf Life"; public static string LongDescription = "Restores 3 hearts if consumed before January 1st, 1939."; public static void Init() { IncredibleItems.SetupActive(ItemName, ShortDescription, LongDescription); } public override void DoEffect(PlayerController user) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) ((BraveBehaviour)user).healthHaver.ApplyHealing((DateTime.Now.Year < 1939) ? 3f : 0f); AkSoundEngine.PostEvent("Play_OBJ_med_kit_01", ((Component)this).gameObject); ? val = user; PlayerItem obj = Items.Ration.AsActive(); ((GameActor)val).PlayEffectOnActor(((RationItem)((obj is RationItem) ? obj : null)).healVFX, Vector3.zero, true, false, false); } } public class Headstone : CwaffPassive { public static string ItemName = "Headstone"; public static string ShortDescription = "Proper Burial"; public static string LongDescription = "Reduces curse to 0 while dead."; private HealthHaver lastOwner; private StatModifier _curseMod; public static void Init() { IncredibleItems.SetupPassive(ItemName, ShortDescription, LongDescription); } public override void Pickup(PlayerController player) { base.Pickup(player); HealthHaver healthHaver = ((BraveBehaviour)player).healthHaver; if (healthHaver != null) { lastOwner = healthHaver; healthHaver.OnDeath -= OnDeath; healthHaver.OnDeath += OnDeath; } } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { HealthHaver healthHaver = ((BraveBehaviour)player).healthHaver; if (healthHaver != null) { healthHaver.OnDeath -= OnDeath; } } } private void OnDeath(Vector2 vector) { if (Object.op_Implicit((Object)(object)lastOwner) && lastOwner.isPlayerCharacter) { _curseMod = ((StatType)14).Add(0f - lastOwner.m_player.stats.GetStatValue((StatType)14)); lastOwner.m_player.ownerlessStatModifiers.Add(_curseMod); lastOwner.m_player.stats.RecalculateStats(lastOwner.m_player, false, false); } } public override void Update() { ((PassiveItem)this).Update(); if (_curseMod != null && Object.op_Implicit((Object)(object)lastOwner) && !lastOwner.IsDead) { lastOwner.m_player.ownerlessStatModifiers.Remove(_curseMod); lastOwner.m_player.stats.RecalculateStats(lastOwner.m_player, false, false); _curseMod = null; lastOwner = null; } } } public class AssassinBullets : CwaffPassive { public static string ItemName = "Assassin Bullets"; public static string ShortDescription = "Silent But Deadly"; public static string LongDescription = "On dealing fatal damage to an enemy, instantly kill that enemy, unless it is already dead."; public static void Init() { IncredibleItems.SetupPassive(ItemName, ShortDescription, LongDescription); } public override void Pickup(PlayerController player) { base.Pickup(player); player.OnAnyEnemyReceivedDamage = (Action)Delegate.Remove(player.OnAnyEnemyReceivedDamage, new Action(OnAnyEnemyReceivedDamage)); player.OnAnyEnemyReceivedDamage = (Action)Delegate.Combine(player.OnAnyEnemyReceivedDamage, new Action(OnAnyEnemyReceivedDamage)); } public override void DisableEffect(PlayerController player) { ((PassiveItem)this).DisableEffect(player); if (Object.op_Implicit((Object)(object)player)) { player.OnAnyEnemyReceivedDamage = (Action)Delegate.Remove(player.OnAnyEnemyReceivedDamage, new Action(OnAnyEnemyReceivedDamage)); } } private static void OnAnyEnemyReceivedDamage(float damage, bool fatal, HealthHaver enemy) { if (fatal) { enemy.currentHealth = 0f; enemy.currentArmor = 0f; } } } public static class CwaffOverrides { private class CwaffOverrideCache { public OverridableBool immuneToExplosions = new OverridableBool(false); private static PlayerController _P1; private static PlayerController _P2; private static CwaffOverrideCache _P1Data; private static CwaffOverrideCache _P2Data; internal static CwaffOverrideCache Overrides(PlayerController player) { if (player.PlayerIDX == 0) { if ((Object)(object)player != (Object)(object)_P1) { _P1Data = new CwaffOverrideCache(); _P1 = player; } return _P1Data; } if ((Object)(object)player != (Object)(object)_P2) { _P2Data = new CwaffOverrideCache(); _P2 = player; } return _P2Data; } } public static bool IsImmuneToExplosions(this PlayerController player) { return CwaffOverrideCache.Overrides(player).immuneToExplosions.Value; } public static void SetImmuneToExplosions(this PlayerController player, bool value, string reason) { CwaffOverrideCache.Overrides(player).immuneToExplosions.SetOverride(reason, value, (float?)null); } } public struct SimpleAnimationData { public string animName { get; set; } public int animFPS { get; set; } public List animPaths { get; set; } public SimpleAnimationData(string name, int fps, List paths) { animName = name; animFPS = fps; animPaths = paths; } } public class FancyNPC : BraveBehaviour, IPlayerInteractable { private static GameObject _FortunesFavorVFX; public Transform talkPoint; public Vector3 talkPointAdjustment; public bool autoFlipSprite; public bool noOutlines; public bool lockCamera; public string defaultAudioEvent; public List defaultAudioEvents = new List(); public string audioTag = string.Empty; public string defaultTalkAnimation; public string defaultPauseAnimation; public float voiceRate = 0.25f; public bool alwaysReturnToIdle = true; public GameObject mapIcon; protected bool canInteract; protected bool m_canUse = true; protected PlayerController m_interactor; protected Vector3 talkPointOffset; private bool didSetup; private bool existingNpc; protected const float MIN_TEXTBOX_TIME = 0.2f; protected const float MIN_ANIMATION_TIME = 0.5f; private int LastResponse { get; set; } protected int PromptResult() { return LastResponse; } public static GameObject Setup(string name, List animNames, Vector3? talkPointAdjust = null) where T : FancyNPC { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Expected O, but got Unknown //IL_0212: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_FortunesFavorVFX == (Object)null) { try { _FortunesFavorVFX = ResourceManager.LoadAssetBundle("shared_auto_001").LoadAsset("FortuneFavor_VFX_Spark"); } catch (Exception ex) { ETGModConsole.Log((object)ex.ToString(), false); } } GameObject val = SpriteBuilder.SpriteFromResource(ResMap.Get(animNames[0])[0], new GameObject("cg:" + name), (Assembly)null); FakePrefab.MarkAsFakePrefab(val); Object.DontDestroyOnLoad((Object)(object)val); val.SetActive(false); val.layer = 22; ((Object)val).name = "cg:" + name; tk2dSpriteAnimator val2 = val.AddComponent(); tk2dSpriteCollectionData collection = ((tk2dBaseSprite)val.GetComponent()).Collection; string text = name + "_"; foreach (string animName in animNames) { string text2 = ETGMod.RemovePrefix(animName, text); List list = AtlasHelper.AddSpritesToCollection(ResMap.Get(animName), collection).AsRange(); foreach (int item in list) { collection.spriteDefinitions[item].BetterConstructOffsetsFromAnchor((Anchor)1); } SpriteBuilder.AddAnimation(val2, collection, list, text2, (WrapMode)0, 5f); } AIAnimator obj = ShopAPI.GenerateBlankAIAnimator(val); ((BraveBehaviour)obj).spriteAnimator = val2; obj.OtherAnimations = Lazy.EasyNamedDirectionalAnimations(animNames.ToArray()); val.AutoRigidBody((CollisionLayer)3, canBePushed: false, 0.5f); FancyNPC fancyNPC = val.AddComponent(); fancyNPC.talkPointAdjustment = (talkPointAdjust.HasValue ? talkPointAdjust.Value : Vector3.zero); string text3 = ResMap.Get(name + "_icon", quietFailure: true)?[0]; if (text3 != null) { fancyNPC.mapIcon = Extensions.RegisterPrefab(new GameObject(name + "_minimap_icon_sprite"), deactivate: false); ((tk2dBaseSprite)fancyNPC.mapIcon.AddComponent()).SetSprite(collection, AtlasHelper.AddSpritesToCollection(new List(1) { text3 }, collection).x); } UltraFortunesFavor obj2 = val.AddComponent(); obj2.goopRadius = 2f; obj2.beamRadius = 2f; obj2.bulletRadius = 2f; obj2.bulletSpeedModifier = 0.8f; obj2.vfxOffset = 0.625f; obj2.sparkOctantVFX = _FortunesFavorVFX; return val; } public void SetAnimationFPS(string animationName, float fps) { ((BraveBehaviour)this).spriteAnimator.GetClipByName(animationName).fps = fps; } protected virtual void Start() { Setup(); } public void Setup() { //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_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_008c: 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_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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ec: Unknown result type (might be due to invalid IL or missing references) if (didSetup) { return; } Vector3 position = ((BraveBehaviour)this).transform.position; didSetup = true; canInteract = true; m_canUse = true; SpriteOutlineManager.AddOutlineToSprite(((BraveBehaviour)this).sprite, Color.black); RoomHandler absoluteRoom = Vector3Extensions.GetAbsoluteRoom(position); absoluteRoom.RegisterInteractable((IPlayerInteractable)(object)this); if (Object.op_Implicit((Object)(object)mapIcon)) { Minimap.Instance.RegisterRoomIcon(absoluteRoom, mapIcon, false); } TalkDoerLite component = ((Component)this).gameObject.GetComponent(); if (component != null) { existingNpc = true; talkPoint = component.speakPoint; return; } talkPoint = new GameObject().transform; talkPoint.position = position; Vector3 position2 = ((BraveBehaviour)this).sprite.GetCurrentSpriteDef().position3; talkPointOffset = new Vector3(0f, position2.y, 0f) + talkPointAdjustment; if (!noOutlines) { SpriteOutlineManager.AddOutlineToSprite(((BraveBehaviour)this).sprite, Color.black); } ((BraveBehaviour)this).aiAnimator.PlayUntilCancelled("idle", false, (string)null, -1f, false); } protected bool CanBeginConversation() { if ((Object)(object)m_interactor != (Object)null) { return false; } if (!canInteract) { return false; } return true; } protected void BeginConversation(PlayerController interactor) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) m_interactor = interactor; if (noOutlines) { SpriteOutlineManager.RemoveOutlineFromSprite(((BraveBehaviour)this).sprite, false); } else { SpriteOutlineManager.AddOutlineToSprite(((BraveBehaviour)this).sprite, Color.black); } m_interactor.SetInputOverride("npcConversation"); Pixelator.Instance.LerpToLetterbox(0.35f, 0.25f); Pixelator.Instance.DoFinalNonFadedLayer = true; GameUIRoot.Instance.ToggleLowerPanels(false, false, "conversation"); GameUIRoot.Instance.HideCoreUI("conversation"); Minimap.Instance.TemporarilyPreventMinimap = true; if (lockCamera) { LockCamera(); } } protected void EndConversation() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) SpriteOutlineManager.AddOutlineToSprite(((BraveBehaviour)this).sprite, Color.white); m_interactor.ClearInputOverride("npcConversation"); Pixelator.Instance.LerpToLetterbox(0.5f, 0.25f); Pixelator.Instance.DoFinalNonFadedLayer = false; GameUIRoot.Instance.ToggleLowerPanels(true, false, "conversation"); GameUIRoot.Instance.ShowCoreUI("conversation"); Minimap.Instance.TemporarilyPreventMinimap = false; m_interactor = null; if (lockCamera) { UnlockCamera(); } } private void LockCamera() { //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_0015: 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_0038: 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_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_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_0063: 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_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_0075: 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_0081: 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: 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_0098: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00bc: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) Vector2 val = Vector3Extensions.XY(((Component)talkPoint).transform.position); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0.3f, 0.3f); CameraController mainCameraController = GameManager.Instance.MainCameraController; Vector2 val3 = CameraController.CameraToWorld(val2.x, val2.y); Vector2 val4 = CameraController.CameraToWorld(1f - val2.x, 1f - val2.y); Vector2 val5 = val4 - val3; mainCameraController.SetManualControl(true, true); Rect val6 = new Rect(val3.x, val3.y, val5.x, val5.y); if (((Rect)(ref val6)).Contains(val)) { mainCameraController.OverridePosition = ((BraveBehaviour)mainCameraController).transform.position; return; } Vector2 val7 = BraveMathCollege.ClosestPointOnRectangle(val, val3, val4 - val3); mainCameraController.OverridePosition = ((BraveBehaviour)mainCameraController).transform.position + Vector2.op_Implicit(val - val7); } private void UnlockCamera() { GameManager.Instance.MainCameraController.SetManualControl(false, true); } public void Interact(PlayerController interactor) { if (CanBeginConversation()) { ((MonoBehaviour)this).StartCoroutine(HandleConversation(interactor)); } } protected PlayerController Interactor() { return m_interactor; } protected void Reset() { SetAnimation("idle"); } protected void ShowText(string convoLine, float autoContinueTimer = -1f) { //IL_0051: 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_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_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) if (TextBoxManager.HasTextBox(talkPoint)) { TextBoxManager.ClearTextBox(talkPoint); } if (!existingNpc) { talkPoint.position = Vector2.op_Implicit(((BraveBehaviour)this).sprite.WorldTopCenter + Vector3Extensions.XY(talkPointAdjustment)); } TextBoxManager.ShowTextBox(talkPoint.position, talkPoint, autoContinueTimer, convoLine, audioTag, false, (BoxSlideOrientation)0, true, false); } private IEnumerator HandleConversation(PlayerController interactor) { if (!m_canUse) { if ((Object)(object)m_interactor == (Object)null) { ShowText("I have nothing to say right now.", 2f); } yield break; } BeginConversation(interactor); yield return null; IEnumerator script = NPCTalkingScript(); while (script.MoveNext()) { yield return script.Current; } if (!existingNpc && alwaysReturnToIdle) { ((BraveBehaviour)this).aiAnimator.PlayUntilCancelled("idler", false, (string)null, -1f, false); } EndConversation(); } public void SetAnimation(string animation) { ((BraveBehaviour)this).aiAnimator.PlayUntilCancelled(animation, false, (string)null, -1f, false); } public Coroutine Converse(string dialogueLine, string talkAnimation = null, string pauseAnimation = null, string audioEvent = null) { return ((MonoBehaviour)this).StartCoroutine(Dialogue(new List(1) { dialogueLine }, talkAnimation, pauseAnimation, audioEvent)); } public IEnumerator Dialogue(List dialogue, string talkAnimation = null, string pauseAnimation = null, string audioEvent = null) { if (string.IsNullOrEmpty(audioEvent)) { audioEvent = defaultAudioEvent; } int ci = 0; while (ci < dialogue.Count) { TextBoxManager.ClearTextBox(talkPoint); if (talkAnimation != null) { ((BraveBehaviour)this).aiAnimator.PlayUntilCancelled(talkAnimation, false, (string)null, -1f, false); } else if (defaultTalkAnimation != null) { ((BraveBehaviour)this).aiAnimator.PlayUntilCancelled(defaultTalkAnimation, false, (string)null, -1f, false); } ShowText(dialogue[ci]); float timer = 0f; bool playingTalkingAnimation = true; string lastFrameAudioEvent = string.Empty; while (!((OneAxisInputControl)BraveInput.GetInstanceForPlayer(m_interactor.PlayerIDX).ActiveActions.GetActionFromType((GungeonActionType)10)).WasPressed || timer < 0.2f) { timer += BraveTime.DeltaTime; bool flag = TextBoxManager.TextBoxCanBeAdvanced(talkPoint); string text = audioEvent; if (string.IsNullOrEmpty(text) && defaultAudioEvents.Count > 0) { text = defaultAudioEvents.ChooseRandom(); } if (flag && !string.IsNullOrEmpty(text) && ((Component)this).gameObject.PlayUnique(text, voiceRate)) { if (!string.IsNullOrEmpty(lastFrameAudioEvent) && lastFrameAudioEvent != text) { ((Component)this).gameObject.Stop(lastFrameAudioEvent); } lastFrameAudioEvent = text; } if (!flag && !string.IsNullOrEmpty(lastFrameAudioEvent)) { ((Component)this).gameObject.Stop(lastFrameAudioEvent); } if (playingTalkingAnimation && timer >= 0.5f && !flag) { playingTalkingAnimation = false; if (pauseAnimation != null) { ((BraveBehaviour)this).aiAnimator.PlayUntilCancelled(pauseAnimation, false, (string)null, -1f, false); } else if (defaultPauseAnimation != null) { ((BraveBehaviour)this).aiAnimator.PlayUntilCancelled(defaultPauseAnimation, false, (string)null, -1f, false); } } yield return null; } if (pauseAnimation != null) { ((BraveBehaviour)this).aiAnimator.PlayUntilCancelled(pauseAnimation, false, (string)null, -1f, false); } else if (defaultPauseAnimation != null) { ((BraveBehaviour)this).aiAnimator.PlayUntilCancelled(defaultPauseAnimation, false, (string)null, -1f, false); } int num = ci + 1; ci = num; } TextBoxManager.ClearTextBox(talkPoint); } public Coroutine Prompt(string optionA, string optionB = null) { return ((MonoBehaviour)this).StartCoroutine(Prompt_CR(optionA, optionB)); IEnumerator Prompt_CR(string text, string text2) { int lastResponse = -1; GameUIRoot.Instance.DisplayPlayerConversationOptions(m_interactor, (TalkModule)null, text, text2); while (!GameUIRoot.Instance.GetPlayerConversationResponse(ref lastResponse)) { yield return null; } LastResponse = lastResponse; } } protected virtual void Update() { //IL_0014: 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_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) if (autoFlipSprite) { ((BraveBehaviour)this).transform.localScale = Vector3Extensions.WithX(((BraveBehaviour)this).transform.localScale, (float)((!(((GameActor)GameManager.Instance.PrimaryPlayer).CenterPosition.x < ((BraveBehaviour)this).transform.position.x)) ? 1 : (-1))); } } protected virtual IEnumerator NPCTalkingScript() { List dialogue = new List { "Hey guys!", "Got custom NPCs working o:", "Neat huh?" }; IEnumerator script = Dialogue(dialogue, "talker", "idler"); while (script.MoveNext()) { yield return script.Current; } string text = "Very neat! :D"; string text2 = "Not impressed. :/ (pay " + 99 + "[sprite \"hbux_text_icon\"] to disagree)"; GameUIRoot.Instance.DisplayPlayerConversationOptions(m_interactor, (TalkModule)null, text, text2); int selectedResponse = -1; while (!GameUIRoot.Instance.GetPlayerConversationResponse(ref selectedResponse)) { yield return null; } yield return Prompt("Very neat! :D", "Not impressed. :/ (pay " + 99 + "[sprite \"hbux_text_icon\"] to disagree)"); ShowText((selectedResponse == 0) ? "Yay!" : "Aw ):", 2f); } public void OnEnteredRange(PlayerController interactor) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) SpriteOutlineManager.AddOutlineToSprite(((BraveBehaviour)this).sprite, Color.white, 1f, 0f, (OutlineType)0); ((BraveBehaviour)this).sprite.UpdateZDepth(); } public void OnExitRange(PlayerController interactor) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (noOutlines) { SpriteOutlineManager.RemoveOutlineFromSprite(((BraveBehaviour)this).sprite, false); } else { SpriteOutlineManager.AddOutlineToSprite(((BraveBehaviour)this).sprite, Color.black, 1f, 0f, (OutlineType)0); } } public string GetAnimationState(PlayerController interactor, out bool shouldBeFlipped) { shouldBeFlipped = false; return string.Empty; } public float GetDistanceToPoint(Vector2 point) { //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_0026: 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_0035: 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_0038: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((BraveBehaviour)this).sprite == (Object)null) { return 100f; } Vector3 val = Vector2.op_Implicit(BraveMathCollege.ClosestPointOnRectangle(point, ((BraveBehaviour)this).specRigidbody.UnitBottomLeft, ((BraveBehaviour)this).specRigidbody.UnitDimensions)); return Vector2.Distance(point, Vector2.op_Implicit(val)) / 1.5f; } public virtual float GetOverrideMaxDistance() { return -1f; } } public class FlipsToFacePlayer : MonoBehaviour { private AIAnimator _animator; private Transform _speechPoint; private float _flipOffset; private float _centerX; private float _baseX; private Vector3 _baseSpeechPos; private bool _cachedFlipped; private void Start() { //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) //IL_0020: 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_005b: 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) _animator = ((Component)this).GetComponent(); Bounds untrimmedBounds = ((BraveBehaviour)_animator).sprite.GetUntrimmedBounds(); _flipOffset = ((Bounds)(ref untrimmedBounds)).size.x; _centerX = ((BraveBehaviour)_animator).sprite.WorldBottomCenter.x; _baseX = ((BraveBehaviour)((BraveBehaviour)_animator).sprite).transform.localPosition.x; _speechPoint = ((Component)this).transform.Find("SpeechPoint"); _baseSpeechPos = _speechPoint.position; _cachedFlipped = false; } private void Update() { FlipSpriteIfNecessary(); } private void FlipSpriteIfNecessary() { //IL_0015: 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_0088: 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) ((BraveBehaviour)_animator).sprite.FlipX = GameManager.Instance.BestActivePlayer.SpriteBottomCenter.x < _centerX; if (((BraveBehaviour)_animator).sprite.FlipX != _cachedFlipped) { _cachedFlipped = ((BraveBehaviour)_animator).sprite.FlipX; ((Component)this).transform.localPosition = Vector3Extensions.WithX(((Component)this).transform.localPosition, _baseX + (_cachedFlipped ? _flipOffset : 0f)); _speechPoint.position = _baseSpeechPos; } } } public interface ICwaffItem { void OnFirstPickup(PlayerController player); } public abstract class CwaffPassive : PassiveItem, ICwaffItem { public override void Pickup(PlayerController player) { if (!base.m_pickedUpThisRun) { OnFirstPickup(player); } ((PassiveItem)this).Pickup(player); } public virtual void OnFirstPickup(PlayerController player) { } } public abstract class CwaffActive : PlayerItem, ICwaffItem { public override void Pickup(PlayerController player) { if (!base.m_pickedUpThisRun) { OnFirstPickup(player); } ((PlayerItem)this).Pickup(player); } public virtual void OnFirstPickup(PlayerController player) { } } public abstract class CwaffGun : GunBehaviour, ICwaffItem, IGunInheritable { [HarmonyPatch(/*Could not decode attribute arguments.*/)] private class DynamicSpinupPatch { [HarmonyILManipulator] private static void DynamicSpinupIL(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_0041: 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) ILCursor val = new ILCursor(il); Type declaringType = original.DeclaringType; if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchAdd(instr) })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldfld, declaringType.GetEnumeratorField("$this")); val.CallPrivate(typeof(DynamicSpinupPatch), "ModifyRateOfFire"); } } private static float ModifyRateOfFire(float oldFireRate, Gun gun) { return oldFireRate * (((Component)gun).GetComponent()?.GetDynamicFireRate() ?? 1f); } } [HarmonyPatch] private class GameUIAmmoControllerUpdateUIGunPatch { [HarmonyPatch(typeof(GameUIAmmoController), "UpdateUIGun")] [HarmonyILManipulator] private static void GameUIAmmoControllerUpdateUIGunIL(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.MatchLdfld(instr, "IsHeroSword") })) { val.Emit(OpCodes.Ldloc_0); val.CallPrivate(typeof(CwaffGun), "CheckHideAmmo"); } } } [HarmonyPatch(typeof(GameUIAmmoController), "UpdateAmmoUIForModule")] private class UpdateAmmoUIForModulePatch { [HarmonyILManipulator] private static void UpdateAmmoUIForModuleIL(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) //IL_008e: 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.MatchLdcI4(instr, 125) })) { val.Emit(OpCodes.Ldarg, 8); val.CallPrivate(typeof(UpdateAmmoUIForModulePatch), "CheckGun"); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchCallvirt(instr, "get_IsReloading") })) { val.Emit(OpCodes.Ldarg, 8); val.CallPrivate(typeof(CwaffGun), "CheckHideAmmo"); } } } private static int CheckGun(int oldCount, Gun gun) { if (Object.op_Implicit((Object)(object)gun) && Object.op_Implicit((Object)(object)((Component)gun).gameObject.GetComponent())) { return 500; } return oldCount; } } [HarmonyPatch(typeof(Gun), "ThrowGun")] private class ThrowGunCountsAsDroppedGunPatch { private static void Prefix(Gun __instance) { CwaffGun component = ((Component)__instance).GetComponent(); if (component != null) { PlayerController playerOwner = ((GunBehaviour)component).PlayerOwner; if (playerOwner != null) { ((GunBehaviour)component).OnDroppedByPlayer(playerOwner); } } } } [HarmonyPatch(typeof(PlayerController), "HandlePlayerInput")] private class SecondaryReloadPatch { [HarmonyILManipulator] private static void SecondaryReloadIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func[2] { (Instruction instr) => ILPatternMatchingExt.MatchLdfld(instr, "ReloadAction"), (Instruction instr) => ILPatternMatchingExt.MatchCallvirt(instr, "get_WasPressed") })) { val.Emit(OpCodes.Ldarg_0); val.CallPrivate(typeof(SecondaryReloadPatch), "CheckSecondaryReload"); } } private static bool CheckSecondaryReload(bool oldValue, PlayerController player) { if (!oldValue) { return player.SecondaryReloadPressed(); } return true; } } [HarmonyPatch(typeof(PlayerController), "HandleStartDodgeRoll")] private class PlayerControllerHandleStartDodgeRollPatch { private static bool Prefix(PlayerController __instance, Vector2 direction, ref bool __result) { Gun currentGun = ((GameActor)__instance).CurrentGun; if (currentGun == null) { return true; } CwaffGun component = ((Component)currentGun).GetComponent(); if (component == null) { return true; } if ((currentGun.IsCharging && component.preventRollingWhenCharging) || (currentGun.IsReloading && component.percentSpeedWhileReloading == 0f)) { __result = false; return false; } return true; } } [HarmonyPatch(typeof(PlayerController), "HandlePlayerInput")] private class PlayerControllerAdjustInputVectorInHandlePlayerInputPatch { [HarmonyILManipulator] private static void HandlePlayerInputIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_007e: 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) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)1, new Func[3] { (Instruction instr) => ILPatternMatchingExt.MatchLdarg(instr, 0), (Instruction instr) => ILPatternMatchingExt.MatchLdloc(instr, 0), (Instruction instr) => ILPatternMatchingExt.MatchCall(instr, "HandleStartDodgeRoll") })) { val.Emit(OpCodes.Ldarg, 0); val.Emit(OpCodes.Ldloca, 0); val.CallPrivate(typeof(PlayerControllerAdjustInputVectorInHandlePlayerInputPatch), "AdjustMovementSpeed"); } } private static void AdjustMovementSpeed(PlayerController p, ref Vector2 vec) { //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) //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_005c: 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_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_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_007c: Unknown result type (might be due to invalid IL or missing references) Gun currentGun = ((GameActor)p).CurrentGun; if (currentGun == null) { return; } CwaffGun component = ((Component)currentGun).GetComponent(); if (component != null) { if (currentGun.IsCharging || component._spinupRemaining != component.spinupTime) { vec = component.percentSpeedWhileCharging * vec; } if (currentGun.IsReloading) { vec = component.percentSpeedWhileReloading * vec; } else if (currentGun.IsFiring) { vec = component.percentSpeedWhileFiring * vec; } else { vec = component.percentSpeedWhileHolding * vec; } } } } [HarmonyPatch(typeof(Gun), "PrepGunForThrow")] private class GunPrepGunForThrowPatch { private static bool Prefix(Gun __instance) { CwaffGun component = ((Component)__instance).gameObject.GetComponent(); if (component != null && !component.OnAttemptedGunThrow()) { return false; } return !Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent()); } } [HarmonyPatch(typeof(GameUIRoot), "InformNeedsReload")] private class GameUIRootInformNeedsReloadPatch { private static bool Prefix(GameUIRoot __instance, PlayerController attachPlayer, Vector3 offset, float customDuration, string customKey) { if (Object.op_Implicit((Object)(object)attachPlayer)) { Gun currentGun = ((GameActor)attachPlayer).CurrentGun; if (currentGun != null) { CwaffGun component = ((Component)currentGun).gameObject.GetComponent(); if (component != null) { return !component.suppressReloadLabel; } } } return true; } } [HarmonyPatch(typeof(DuctTapeItem), "CombineVolleys")] private class DuctTapeItemCombineVolleysPatch { [HarmonyILManipulator] private static void DuctTapeItemCombineVolleysIL(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_00d0: 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_0103: 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) ILCursor val = new ILCursor(il); ILLabel loopEnd = null; for (int i = 0; i < 2; i++) { if (!val.TryGotoNext((MoveType)2, new Func[2] { (Instruction instr) => ILPatternMatchingExt.MatchLdfld(instr, "runtimeGuid"), (Instruction instr) => ILPatternMatchingExt.MatchBrfalse(instr, ref loopEnd) })) { return; } } val.Index = 0; if (val.TryGotoNext((MoveType)0, new Func[2] { (Instruction instr) => ILPatternMatchingExt.MatchCallvirt(instr, "get_RawSourceVolley"), (Instruction instr) => ILPatternMatchingExt.MatchLdfld(instr, "projectiles") })) { val.Emit(OpCodes.Ldloc_1); val.CallPrivate(typeof(DuctTapeItemCombineVolleysPatch), "ShouldDuctTapeModule"); val.Emit(OpCodes.Brfalse, (object)loopEnd); val.Emit(OpCodes.Ldarg_1); val.Index = 0; while (val.TryGotoNext((MoveType)2, new Func[2] { (Instruction instr) => ILPatternMatchingExt.MatchLdfld(instr, "gunSwitchGroup"), (Instruction instr) => ILPatternMatchingExt.MatchCall(instr, "IsNullOrEmpty") })) { val.Emit(OpCodes.Ldarg_1); val.CallPrivate(typeof(DuctTapeItemCombineVolleysPatch), "CheckNullOrEmptySwitchGroup"); } } } private static bool ShouldDuctTapeModule(Gun gun, int i) { if (!Object.op_Implicit((Object)(object)gun.Volley) || !gun.Volley.ModulesAreTiers || gun.CurrentStrengthTier == i) { return true; } if (!Object.op_Implicit((Object)(object)((Component)gun).gameObject.GetComponent())) { return true; } return false; } private static bool CheckNullOrEmptySwitchGroup(bool wasNullOrEmpty, Gun mergeGun) { if (mergeGun.gunSwitchGroup == "Banana" && Object.op_Implicit((Object)(object)((Component)mergeGun).GetComponent())) { return true; } return wasNullOrEmpty; } } [HarmonyPatch] private static class DuctTapeBannedGunsPatch { [HarmonyPatch(typeof(DuctTapeItem), "IsGunValid")] [HarmonyPostfix] private static void DuctTapeItemIsGunValidPatch(DuctTapeItem __instance, Gun g, Gun excluded, ref bool __result) { if (__result) { CwaffGun component = ((Component)g).gameObject.GetComponent(); if (component != null && component.preventDuctTape) { __result = false; } } } } [HarmonyPatch] private class GunHandleInitialGunShootPatch { [HarmonyPatch(typeof(Gun), "HandleInitialGunShoot", new Type[] { typeof(ProjectileModule), typeof(ProjectileData), typeof(GameObject) })] [HarmonyPatch(typeof(Gun), "HandleInitialGunShoot", new Type[] { typeof(ProjectileVolleyData), typeof(ProjectileData), typeof(GameObject) })] [HarmonyILManipulator] private static void GunHandleInitialGunShootIL(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.MatchLdfld(instr, "onCooldown") })) { val.Emit(OpCodes.Ldarg_0); val.CallPrivate(typeof(GunHandleInitialGunShootPatch), "HandleAutomaticGunWindup"); } } private static bool HandleAutomaticGunWindup(bool wasOnCooldown, Gun gun) { if (wasOnCooldown) { return true; } GameActor currentOwner = gun.CurrentOwner; PlayerController val = (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null); if (val == null) { return false; } CwaffGun component = ((Component)gun).gameObject.GetComponent(); if (component == null) { return false; } if (component.spinupTime <= 0f) { return false; } BraveInput instanceForPlayer = BraveInput.GetInstanceForPlayer(val.PlayerIDX); if (instanceForPlayer.GetButtonDown((GungeonActionType)8)) { instanceForPlayer.ConsumeButtonDown((GungeonActionType)8); } int frameCount = Time.frameCount; if (frameCount > component._lastSpinupFrame) { component._spinupRemaining = Mathf.Max(component._spinupRemaining - BraveTime.DeltaTime, 0f); component._lastSpinupFrame = frameCount; } if (!string.IsNullOrEmpty(component.spinupSound)) { ((MonoBehaviour)(object)component).LoopSoundIf(component._spinupRemaining > 0f, component.spinupSound); } return component._spinupRemaining > 0f; } } [HarmonyPatch] private class PlayerControllerHandleGunFiringInternalPatch { [HarmonyPatch(typeof(PlayerController), "HandleGunFiringInternal")] [HarmonyPrefix] private static void HandleGunFiringInternalPrefix(PlayerController __instance, Gun targetGun, BraveInput currentBraveInput, bool isSecondary) { if (Object.op_Implicit((Object)(object)targetGun)) { CwaffGun component = ((Component)targetGun).gameObject.GetComponent(); if (component != null && currentBraveInput.GetButtonUp((GungeonActionType)8)) { currentBraveInput.ConsumeButtonUp((GungeonActionType)8); component._spinupRemaining = component.spinupTime; } } } [HarmonyPatch(typeof(PlayerController), "HandleGunFiringInternal")] [HarmonyILManipulator] private static void PlayerControllerHandleGunFiringInternalIL(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.MatchCallvirt(instr, "GetButtonDown") })) { val.Emit(OpCodes.Ldarg_1); val.CallPrivate(typeof(PlayerControllerHandleGunFiringInternalPatch), "HandleAutomaticGunWindup"); } } private static bool HandleAutomaticGunWindup(bool wasFiring, Gun gun) { if (Object.op_Implicit((Object)(object)gun)) { CwaffGun component = ((Component)gun).gameObject.GetComponent(); if (component != null && !(component.spinupTime <= 0f)) { GameActor currentOwner = gun.CurrentOwner; PlayerController val = (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null); if (val == null) { return wasFiring; } BraveInput instanceForPlayer = BraveInput.GetInstanceForPlayer(val.PlayerIDX); if (instanceForPlayer.GetButtonDown((GungeonActionType)8)) { instanceForPlayer.ConsumeButtonDown((GungeonActionType)8); } int num; if (!wasFiring) { num = (instanceForPlayer.GetButton((GungeonActionType)8) ? 1 : 0); if (num == 0) { component._spinupRemaining = component.spinupTime; } } else { num = 1; } return (byte)num != 0; } } return wasFiring; } } [HarmonyPatch] private class GunShootAnimationPatch { [HarmonyPatch(typeof(Gun), "HandleShootAnimation")] [HarmonyILManipulator] private static void GunShootAnimationIL(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) //IL_0094: 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.MatchLdcI4(instr, 1) })) { val.Emit(OpCodes.Ldarg_0); val.CallPrivate(typeof(GunShootAnimationPatch), "CheckShouldRestartShootAnimation"); val.Index = 0; if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdloc(instr, 0) })) { val.Emit(OpCodes.Ldarg_0); val.CallPrivate(typeof(GunShootAnimationPatch), "HandleCustomShootAnimation"); } } } [HarmonyPatch(typeof(Gun), "HandleSpecificInitialGunShoot")] [HarmonyILManipulator] private static void GunHandleSpecificInitialGunShootIL(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.MatchLdfld(instr, "shootAnimation") })) { val.Emit(OpCodes.Ldarg_0); val.CallPrivate(typeof(GunShootAnimationPatch), "HandleCustomShootAnimation"); } } private static bool CheckShouldRestartShootAnimation(bool shouldRestart, Gun gun) { CwaffGun component = ((Component)gun).gameObject.GetComponent(); if (component != null) { return !component.continuousFireAnimation; } return shouldRestart; } private static string HandleCustomShootAnimation(string overrideAnimation, Gun gun) { ((Component)gun).gameObject.GetComponent()?.OverrideShootAnimation(ref overrideAnimation); return overrideAnimation; } [HarmonyPatch(typeof(Gun), "Reload")] [HarmonyPrefix] private static bool GunReloadPatch(Gun __instance) { PlayerController val = GunTools.GunPlayerOwner(__instance); if (val == null) { return true; } if (val.m_activeActions == null || !((OneAxisInputControl)val.m_activeActions.ReloadAction).WasPressed) { return true; } return ((Component)__instance).gameObject.GetComponent()?.OnManualReloadAttempted(val) ?? true; } } [HarmonyPatch] private static class SmoothReloadAnimationPatch { [HarmonyPatch(typeof(Gun), "HandleReload")] [HarmonyPostfix] private static void UpdateReloadSpeed(Gun __instance) { CwaffGun component = ((Component)__instance).gameObject.GetComponent(); if (component != null && component.useSmoothReload) { tk2dSpriteAnimationClip clipByName = ((BraveBehaviour)__instance).spriteAnimator.GetClipByName(__instance.reloadAnimation); if (clipByName != null) { clipByName.fps = (float)clipByName.frames.Length / Mathf.Max(0.1f, __instance.AdjustedReloadTime - component.smoothReloadOffset); } } } } [HarmonyPatch(typeof(Gun), "Reload")] private static class GunReloadPostfixToAppeaseTheHarmonyOverlords { public static void Postfix() { } } [HarmonyPatch] private static class PrecludeVolleyModificationPatch { [HarmonyPatch(typeof(PlayerStats), "RebuildGunVolleys")] [HarmonyILManipulator] private static void PlayerStatsRebuildGunVolleysPatchIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00e0: 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) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)1, new Func[4] { (Instruction instr) => ILPatternMatchingExt.MatchLdloc(instr, 0), (Instruction instr) => ILPatternMatchingExt.MatchLdcI4(instr, 1), (Instruction instr) => ILPatternMatchingExt.MatchAdd(instr), (Instruction instr) => ILPatternMatchingExt.MatchStloc(instr, 0) })) { ILLabel val2 = val.MarkLabel(); val.Index = 0; if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchStloc(instr, 1) })) { val.Emit(OpCodes.Ldloc_S, (byte)1); val.CallPrivate(typeof(PrecludeVolleyModificationPatch), "ShouldPrecludeVolleyModification"); val.Emit(OpCodes.Brtrue, (object)val2); } } } private static bool ShouldPrecludeVolleyModification(Gun gun) { if (Object.op_Implicit((Object)(object)gun)) { CwaffGun component = ((Component)gun).gameObject.GetComponent(); if (component != null) { return component.preventVolleyModifications; } } return false; } } private const string _DEFAULT_BARREL_OFFSET = "__default"; private static Dictionary>> _BarrelOffsetCache = new Dictionary>>(); private bool _hasReloaded = true; private bool _usesDynamicBarrelPosition; private Dictionary> _barrelOffsets; private Vector3 _defaultBarrelOffset = Vector3.zero; private ModuleShootData _cachedShootData; private int _cachedMasteryTokenId = -2; private tk2dSprite _masterySprite; private int _lastSpinupFrame; protected float _spinupRemaining; public bool hideAmmo; public bool suppressReloadLabel; public float percentSpeedWhileFiring = 1f; public float percentSpeedWhileCharging = 1f; public float percentSpeedWhileReloading = 1f; public float percentSpeedWhileHolding = 1f; public bool preventRollingWhenCharging; public bool preventDuctTape; public float spinupTime; public string spinupSound; public bool continuousFireAnimation; public bool useSmoothReload; public float smoothReloadOffset; public bool canAttackWhileRolling; public bool preventVolleyModifications; public bool Mastered { get; private set; } public static void SetUpDynamicBarrelOffsets(Gun gun) { Dictionary> d = (_BarrelOffsetCache[gun.GetUnmodifiedDisplayName()] = new Dictionary>()); SetUpDefaultDynamicBarrelOffset(d, gun); SetUpDynamicBarrelOffsetsForAnimation(d, gun, gun.chargeAnimation); SetUpDynamicBarrelOffsetsForAnimation(d, gun, gun.reloadAnimation); SetUpDynamicBarrelOffsetsForAnimation(d, gun, gun.shootAnimation); SetUpDynamicBarrelOffsetsForAnimation(d, gun, gun.shootAnimation); } private static void SetUpDefaultDynamicBarrelOffset(Dictionary> d, Gun gun) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) d["__default"] = new List { gun.barrelOffset.localPosition }; } internal static void SetUpDynamicBarrelOffsetsForExtraAnimation(Gun gun, string anim) { SetUpDynamicBarrelOffsetsForAnimation(_BarrelOffsetCache[gun.GetUnmodifiedDisplayName()], gun, anim); } private static void SetUpDynamicBarrelOffsetsForAnimation(Dictionary> d, Gun gun, string anim) { if (!string.IsNullOrEmpty(anim)) { d[anim] = gun.GetBarrelOffsetsForAnimation(anim); } } private void Start() { //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 (_BarrelOffsetCache.TryGetValue(base.gun.GetUnmodifiedDisplayName(), out var value)) { _usesDynamicBarrelPosition = true; _barrelOffsets = value; _defaultBarrelOffset = value["__default"][0]; } } internal bool CanBeMastered() { if (_cachedMasteryTokenId < -1) { _cachedMasteryTokenId = base.gun.MasteryTokenId(); } return _cachedMasteryTokenId >= 0; } internal void DoMasteryChecks(PlayerController player) { bool mastered = Mastered; if (_cachedMasteryTokenId < -1) { _cachedMasteryTokenId = base.gun.MasteryTokenId(); } bool flag = (Mastered = Object.op_Implicit((Object)(object)player) && player.HasPassive(_cachedMasteryTokenId)); bool flag3 = flag; if (mastered != flag3) { OnMasteryStatusChanged(); if (flag3) { SetUpMasteryShaders(); } } } private void SetUpMasteryShaders() { //IL_0058: 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_00de: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_masterySprite)) { Transform val = ((Component)base.gun).gameObject.transform.Find("mastery renderer"); if (val != null) { _masterySprite = ((Component)val).gameObject.GetComponent(); } else { _masterySprite = new GameObject("mastery renderer", new Type[1] { typeof(tk2dSprite) }).GetComponent(); } ((BraveBehaviour)base.gun).sprite.AttachRenderer((tk2dBaseSprite)(object)_masterySprite); ((tk2dBaseSprite)_masterySprite).SetSprite(((BraveBehaviour)base.gun).sprite.collection, ((BraveBehaviour)base.gun).sprite.spriteId); ((tk2dBaseSprite)_masterySprite).usesOverrideMaterial = true; Transform transform = ((BraveBehaviour)((BraveBehaviour)base.gun).sprite).transform; Transform transform2 = ((BraveBehaviour)_masterySprite).transform; transform2.position = transform.position; transform2.rotation = transform.rotation; transform2.parent = transform; AddMasteryShaders(((BraveBehaviour)_masterySprite).renderer.material); UpdateMasteryShaders(); } } private static void AddMasteryShaders(Material mat) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) mat.shader = CwaffShaders.ElectricShader; mat.SetColor("_ZapColor", new Color(1f, 0.3f, 0f, 1f)); mat.SetFloat("_Fade", 0f); mat.SetFloat("_NoiseOffset", 0.75f); mat.SetTexture("_ShaderTex", (Texture)(object)CwaffShaders.NoiseTexture); mat.SetFloat("_Strength", 2f); mat.SetFloat("_Size", 8f); mat.SetFloat(CwaffVFX._EmissivePowerId, 2f); } private void UpdateMasteryShaders() { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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) if (Object.op_Implicit((Object)(object)_masterySprite)) { if (!((BraveBehaviour)((BraveBehaviour)base.gun).sprite).renderer.enabled) { ((BraveBehaviour)_masterySprite).renderer.enabled = false; return; } ((BraveBehaviour)_masterySprite).renderer.enabled = true; ((tk2dBaseSprite)_masterySprite).SetSprite(((BraveBehaviour)base.gun).sprite.collection, ((BraveBehaviour)base.gun).sprite.spriteId); Transform transform = ((BraveBehaviour)((BraveBehaviour)base.gun).sprite).transform; Transform transform2 = ((BraveBehaviour)_masterySprite).transform; transform2.position = transform.position; transform2.rotation = transform.rotation; transform2.localScale = transform.localScale; ((tk2dBaseSprite)_masterySprite).FlipY = ((BraveBehaviour)base.gun).sprite.FlipY; } } public override void OnDestroy() { PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null) { playerOwner.GunChanged -= OnGunsChanged; playerOwner.OnTriedToInitiateAttack -= OnTriedToInitiateAttack; } ((GunBehaviour)this).OnDestroy(); if (Object.op_Implicit((Object)(object)_masterySprite)) { ((BraveBehaviour)_masterySprite).transform.parent = null; if (Object.op_Implicit((Object)(object)base.gun) && Object.op_Implicit((Object)(object)((BraveBehaviour)base.gun).sprite)) { ((BraveBehaviour)base.gun).sprite.DetachRenderer((tk2dBaseSprite)(object)_masterySprite); } Object.Destroy((Object)(object)((Component)_masterySprite).gameObject); } } public virtual void OnMasteryStatusChanged() { } public virtual bool OnAttemptedGunThrow() { return true; } public virtual void OverrideShootAnimation(ref string overrideAnimation) { } public override void OnPlayerPickup(PlayerController player) { if (!((GunBehaviour)this).EverPickedUp) { OnFirstPickup(player); } ((GunBehaviour)this).OnPlayerPickup(player); player.GunChanged -= OnGunsChanged; player.GunChanged += OnGunsChanged; DoMasteryChecks(player); } public virtual void OnFirstPickup(PlayerController player) { if (((PickupObject)base.gun).associatedItemChanceMods != null) { LootModData[] associatedItemChanceMods = ((PickupObject)base.gun).associatedItemChanceMods; foreach (LootModData item in associatedItemChanceMods) { player.lootModData.Add(item); } } } public void OnGunsChanged(Gun previous, Gun current, bool newGun) { if ((Object)(object)previous != (Object)(object)base.gun && (Object)(object)current == (Object)(object)base.gun) { OnSwitchedToThisGun(); } if ((Object)(object)previous == (Object)(object)base.gun && (Object)(object)current != (Object)(object)base.gun) { OnSwitchedAwayFromThisGun(); } DoMasteryChecks(((GunBehaviour)this).PlayerOwner); } public virtual void OnTriedToInitiateAttack(PlayerController player) { } public virtual void OnSwitchedToThisGun() { base.gun.PreventNormalFireAudio = true; tk2dSpriteAnimationClip clipByName = ((BraveBehaviour)base.gun).spriteAnimator.GetClipByName(base.gun.shootAnimation); if (clipByName != null) { base.gun.OverrideNormalFireAudioEvent = clipByName.frames[0].eventAudio; } PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null) { playerOwner.OnTriedToInitiateAttack -= OnTriedToInitiateAttack; playerOwner.OnTriedToInitiateAttack += OnTriedToInitiateAttack; } } public virtual void OnSwitchedAwayFromThisGun() { CwaffReticle[] components = ((Component)this).gameObject.GetComponents(); for (int i = 0; i < components.Length; i++) { components[i].HideImmediately(); } PlayerController playerOwner = ((GunBehaviour)this).PlayerOwner; if (playerOwner != null) { playerOwner.OnTriedToInitiateAttack -= OnTriedToInitiateAttack; } } public override void OnDroppedByPlayer(PlayerController player) { ((GunBehaviour)this).OnDroppedByPlayer(player); CwaffReticle[] components = ((Component)this).gameObject.GetComponents(); for (int i = 0; i < components.Length; i++) { components[i].HideImmediately(); } player.GunChanged -= OnGunsChanged; player.OnTriedToInitiateAttack -= OnTriedToInitiateAttack; } public override void Update() { ((GunBehaviour)this).Update(); if (Object.op_Implicit((Object)(object)base.gun) && !base.gun.IsReloading) { _hasReloaded = true; } if (_usesDynamicBarrelPosition) { AdjustBarrelPosition(); } UpdateMasteryShaders(); } private void AdjustBarrelPosition() { //IL_0067: 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_0099: 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_00b4: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)base.gun)) { return; } tk2dSpriteAnimator spriteAnimator = ((BraveBehaviour)base.gun).spriteAnimator; if (spriteAnimator == null) { return; } tk2dSpriteAnimationClip currentClip = spriteAnimator.currentClip; if (currentClip != null) { if (_barrelOffsets.TryGetValue(currentClip.name, out var value)) { base.gun.barrelOffset.localPosition = value[spriteAnimator.CurrentFrame]; } else { base.gun.barrelOffset.localPosition = _defaultBarrelOffset; } if (((BraveBehaviour)base.gun).sprite.FlipY) { base.gun.barrelOffset.localPosition = Vector3Extensions.WithY(base.gun.barrelOffset.localPosition, 0f - base.gun.barrelOffset.localPosition.y); } } } public override void OnReloadPressed(PlayerController player, Gun gun, bool manual) { if (_hasReloaded && gun.IsReloading) { OnActualReload(player, gun, manual); _hasReloaded = false; } if (player.AcceptingNonMotionInput && !gun.IsReloading && manual && gun.ClipShotsRemaining >= Mathf.Min(gun.ClipCapacity, gun.CurrentAmmo)) { OnFullClipReload(player, gun); } } public virtual void OnActualReload(PlayerController player, Gun gun, bool manual) { } public virtual void OnFullClipReload(PlayerController player, Gun gun) { } public virtual bool OnManualReloadAttempted(PlayerController player) { return true; } public virtual float GetDynamicFireRate() { return 1f; } protected bool IsSpinningUp() { if (_spinupRemaining < spinupTime) { return _spinupRemaining > 0f; } return false; } protected bool IsSpunUp() { return _spinupRemaining <= 0f; } public virtual float GetDynamicAccuracy() { return 1f; } internal static float ModifyAccuracy(float oldSpread, Gun gun) { return oldSpread * (((Component)gun).GetComponent()?.GetDynamicAccuracy() ?? 1f); } protected void ClearCachedShootData() { _cachedShootData = null; } protected BeamController GetExtantBeam() { if (_cachedShootData == null) { if (!Object.op_Implicit((Object)(object)base.gun) || !base.gun.IsFiring || base.gun.m_moduleData == null || base.gun.DefaultModule == null) { return null; } if (!base.gun.m_moduleData.TryGetValue(base.gun.DefaultModule, out var value)) { return null; } _cachedShootData = value; } return _cachedShootData.beam; } private static bool CheckHideAmmo(bool oldValue, Gun gun) { if (oldValue) { return true; } return ((Component)gun).gameObject.GetComponent()?.hideAmmo ?? false; } [HarmonyPatch(typeof(Gun), "OnDisable")] [HarmonyPostfix] private static void GunOnDisablePatch(Gun __instance) { CwaffGun component = ((Component)__instance).gameObject.GetComponent(); if (component != null && Object.op_Implicit((Object)(object)component._masterySprite) && ((BraveBehaviour)component._masterySprite).renderer.enabled) { ((BraveBehaviour)component._masterySprite).renderer.enabled = false; } } } public abstract class CwaffBlankModificationItem : BlankModificationItem, ICwaffItem { public virtual void OnFirstPickup(PlayerController player) { } } public abstract class CwaffDodgeRollItem : CustomDodgeRollItem, ICwaffItem { public virtual void OnFirstPickup(PlayerController player) { } } public abstract class CwaffDodgeRollActiveItem : CustomDodgeRollActiveItem, ICwaffItem { public virtual void OnFirstPickup(PlayerController player) { } } public abstract class CwaffCompanion : CompanionItem, ICwaffItem { public override void Pickup(PlayerController player) { if (!((PassiveItem)this).m_pickedUpThisRun) { OnFirstPickup(player); } ((CompanionItem)this).Pickup(player); } public virtual void OnFirstPickup(PlayerController player) { } } public interface ICustomBlankDoer { [HarmonyPatch(typeof(SilencerInstance), "ProcessBlankModificationItemAdditionalEffects")] private static class AmmoAmmoletProcessBlankModificationPatch { private static void Postfix(SilencerInstance __instance, BlankModificationItem bmi, Vector2 centerPoint, PlayerController user) { if (bmi is ICustomBlankDoer customBlankDoer) { __instance.UsesCustomProjectileCallback = true; __instance.OnCustomBlankedProjectile = (Action)Delegate.Combine(__instance.OnCustomBlankedProjectile, new Action(customBlankDoer.OnCustomBlankedProjectile)); } } } void OnCustomBlankedProjectile(Projectile p); } public class Unthrowable : MonoBehaviour { } public class Geometry : MonoBehaviour { public enum Shape { NONE, FILLEDCIRCLE, CIRCLE, RING, DASHEDLINE, LINE, RECTANGLE } private const int _CIRCLE_SEGMENTS = 100; private const int _MAX_LINE_SEGMENTS = 100; private const int _MAX_LINE_VERTICES = 200; private const float _MIN_SEG_LEN = 0.2f; private static readonly Vector2 _WayOffscreen = new Vector2(100000f, 100000f); private static readonly int _OverrideColorId = Shader.PropertyToID("_OverrideColor"); private bool _didSetup; private GameObject _meshObject; private Mesh _mesh; private Vector3[] _vertices; private MeshRenderer _meshRenderer; public Shape shape { get; private set; } public Color color { get; private set; } public Vector2 pos { get; private set; } public float radius { get; private set; } = 1f; public float radiusInner { get; private set; } = 0.5f; public float angle { get; private set; } public float arc { get; private set; } = 360f; public static Geometry Create(Shape shape) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (shape == Shape.NONE) { Debug.LogError((object)"must set shape of Geometry on creation"); return null; } Geometry geometry = new GameObject().AddComponent(); geometry.shape = shape; geometry.CreateMesh(); return geometry; } public Geometry UseGUILayer() { GameObjectExtensions.SetLayerRecursively(((Component)this).gameObject, LayerMask.NameToLayer("GUI")); return this; } public Geometry Place(Color? color = null, Vector2? pos = null, Vector2? pos2 = null, float? radius = null, float? angle = null, float? arc = null, float? radiusInner = null, bool useScreenSpace = false) { //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_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_003b: 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_0067: 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_0081: 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_00bb: 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_0176: 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_018b: 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_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) if (useScreenSpace) { CameraController mainCameraController = GameManager.Instance.MainCameraController; if (pos.HasValue) { Vector2 valueOrDefault = pos.GetValueOrDefault(); pos = new Vector2(Mathf.Lerp(mainCameraController.m_cachedMinPos.x, mainCameraController.m_cachedMaxPos.x, valueOrDefault.x), Mathf.Lerp(mainCameraController.m_cachedMinPos.y, mainCameraController.m_cachedMaxPos.y, valueOrDefault.y)); } if (pos2.HasValue) { Vector2 valueOrDefault2 = pos2.GetValueOrDefault(); pos2 = new Vector2(Mathf.Lerp(mainCameraController.m_cachedMinPos.x, mainCameraController.m_cachedMaxPos.x, valueOrDefault2.x), Mathf.Lerp(mainCameraController.m_cachedMinPos.y, mainCameraController.m_cachedMaxPos.y, valueOrDefault2.y)); } if (radius.HasValue) { float valueOrDefault3 = radius.GetValueOrDefault(); radius = Mathf.Clamp01(valueOrDefault3) * (mainCameraController.m_cachedMaxPos.x - mainCameraController.m_cachedMinPos.x); } if (radiusInner.HasValue) { float valueOrDefault4 = radiusInner.GetValueOrDefault(); radiusInner = Mathf.Clamp01(valueOrDefault4) * (mainCameraController.m_cachedMaxPos.x - mainCameraController.m_cachedMinPos.x); } } this.color = (Color)(((??)color) ?? this.color); this.pos = (Vector2)(((??)pos) ?? this.pos); if (pos2.HasValue) { Vector2 val = pos2.Value - this.pos; this.radius = ((Vector2)(ref val)).magnitude; this.angle = Vector2Extensions.ToAngle(val); this.arc = arc ?? this.arc; } else { this.radius = radius ?? this.radius; this.angle = angle ?? this.angle; this.arc = arc ?? this.arc; this.radiusInner = radiusInner ?? this.radiusInner; } if (color.HasValue) { ((Renderer)_meshRenderer).material.SetColor(_OverrideColorId, this.color); } if (!_didSetup || pos.HasValue || pos2.HasValue || radius.HasValue || radiusInner.HasValue) { RebuildMeshes(); } _didSetup = true; ((Renderer)_meshRenderer).enabled = true; return this; } public Geometry Disable() { if (Object.op_Implicit((Object)(object)_meshRenderer)) { ((Renderer)_meshRenderer).enabled = false; } return this; } private void Awake() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown _mesh = new Mesh(); _meshObject = new GameObject("debug_circle", new Type[2] { typeof(MeshFilter), typeof(MeshRenderer) }); GameObjectExtensions.SetLayerRecursively(_meshObject, LayerMask.NameToLayer("Unoccluded")); _meshObject.GetComponent().mesh = _mesh; _meshRenderer = _meshObject.GetComponent(); } private void CreateMesh() { //IL_032d: Unknown result type (might be due to invalid IL or missing references) switch (shape) { case Shape.FILLEDCIRCLE: { _vertices = (Vector3[])(object)new Vector3[102]; int[] array4 = new int[300]; for (int k = 0; k < 100; k++) { array4[k * 3] = 0; array4[k * 3 + 1] = k + 1; array4[k * 3 + 2] = k + 2; } _mesh.vertices = _vertices; _mesh.uv = (Vector2[])(object)new Vector2[_vertices.Length]; _mesh.triangles = array4; break; } case Shape.RING: { _vertices = (Vector3[])(object)new Vector3[202]; int[] array3 = new int[600]; int num = 0; for (int j = 0; j < 200; j += 2) { array3[num++] = j; array3[num++] = j + 1; array3[num++] = j + 2; array3[num++] = j + 1; array3[num++] = j + 2; array3[num++] = j + 3; } _mesh.vertices = _vertices; _mesh.uv = (Vector2[])(object)new Vector2[_vertices.Length]; _mesh.triangles = array3; break; } case Shape.CIRCLE: { _vertices = (Vector3[])(object)new Vector3[101]; int[] array5 = new int[200]; for (int l = 0; l < 100; l++) { array5[l * 2] = l; array5[l * 2 + 1] = l + 1; } _mesh.vertices = _vertices; _mesh.uv = (Vector2[])(object)new Vector2[_vertices.Length]; _mesh.SetIndices(array5, (MeshTopology)3, 0); break; } case Shape.DASHEDLINE: { _vertices = (Vector3[])(object)new Vector3[200]; int[] array2 = new int[200]; for (int i = 0; i < 200; i++) { array2[i] = i; } _mesh.vertices = _vertices; _mesh.uv = (Vector2[])(object)new Vector2[_vertices.Length]; _mesh.SetIndices(array2, (MeshTopology)3, 0); break; } case Shape.LINE: { _vertices = (Vector3[])(object)new Vector3[2]; int[] array = new int[2] { 0, 1 }; _mesh.vertices = _vertices; _mesh.uv = (Vector2[])(object)new Vector2[_vertices.Length]; _mesh.SetIndices(array, (MeshTopology)3, 0); break; } case Shape.RECTANGLE: _vertices = (Vector3[])(object)new Vector3[4]; _mesh.vertices = _vertices; _mesh.uv = (Vector2[])(object)new Vector2[_vertices.Length]; _mesh.SetIndices(new int[6] { 0, 1, 2, 1, 2, 3 }, (MeshTopology)0, 0); break; } Material val = (((Renderer)_meshRenderer).material = (Material)/*isinst with value type is only supported in some contexts*/); val.shader = ShaderCache.Acquire("tk2d/BlendVertexColorAlphaTintableTilted"); val.SetColor(_OverrideColorId, color); } private void RebuildMeshes() { //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_000b: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0279: 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_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0297: 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_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: 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_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: 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_008a: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: 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_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_00f8: 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_010e: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_0200: 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_020a: 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) Vector3 val = Vector2.op_Implicit(pos); switch (shape) { case Shape.FILLEDCIRCLE: { _vertices[0] = val; float num7 = (angle - 0.5f * arc).Clamp360(); float num8 = arc / 100f; for (int l = 0; l <= 100; l++) { _vertices[l + 1] = val + (num7 + (float)l * num8).ToVector3(radius); } break; } case Shape.RING: { float num5 = (angle - 0.5f * arc).Clamp360(); float num6 = arc / 100f; for (int k = 0; k <= 100; k++) { float self = num5 + (float)k * num6; _vertices[2 * k] = val + self.ToVector3(radius); _vertices[2 * k + 1] = val + self.ToVector3(radiusInner); } break; } case Shape.CIRCLE: { float num9 = (angle - 0.5f * arc).Clamp360(); float num10 = arc / 100f; for (int m = 0; m <= 100; m++) { _vertices[m] = val + (num9 + (float)m * num10).ToVector3(radius); } break; } case Shape.DASHEDLINE: { float num = Mathf.Max(0.2f, radius / 199f); float num2 = radius / num; int num3 = Mathf.FloorToInt(num2); if (num3 % 2 != 1) { num3--; } float num4 = 0.5f * (num2 - (float)num3); for (int i = 0; i <= num3; i++) { _vertices[i] = val + angle.ToVector3((num4 + (float)i) * num); } for (int j = num3 + 1; j < 200; j++) { _vertices[j] = Vector2.op_Implicit(_WayOffscreen); } break; } case Shape.LINE: _vertices[0] = val; _vertices[1] = val + angle.ToVector3(radius); break; case Shape.RECTANGLE: _vertices[0] = val; _vertices[3] = val + angle.ToVector3(radius); _vertices[1] = new Vector3(_vertices[3].x, val.y); _vertices[2] = new Vector3(val.x, _vertices[3].y); break; } _mesh.vertices = _vertices; _mesh.RecalculateBounds(); if (shape == Shape.FILLEDCIRCLE) { _mesh.RecalculateNormals(); } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)_meshObject)) { Object.Destroy((Object)(object)_meshObject); } } } public static class GeometryHelpers { public static Geometry Create(this Geometry.Shape shape) { return Geometry.Create(shape); } } public enum CwaffPrerequisites { NONE, INSURANCE_PREREQUISITE, COMPANION_SHOP_PREREQUISITE, BARTER_SHOP_PREREQUISITE, NOT_COOP_MODE_PREREQUISITE, HAVE_DOMINO, NO_DOMINO, TEST_PREREQUISITE } public class SpawnConditions { public FancyShopBuilder.SpawnCondition validator; public int spawnsThisRun; public float randomNumberForThisRun; } public class CwaffPrerequisite : CustomDungeonPrerequisite { public class Tracker : MonoBehaviour { public CwaffPrerequisites prereq; public void Setup(CwaffPrerequisites prereq) { this.prereq = prereq; } private void Start() { SpawnConditions[(int)prereq].spawnsThisRun++; } } internal static List SpawnConditions = new List(Enumerable.Repeat(null, Enum.GetNames(typeof(CwaffPrerequisites)).Length).ToList()); public CwaffPrerequisites prerequisite; public static void Init() { CwaffEvents.OnCleanStart = (Action)Delegate.Combine(CwaffEvents.OnCleanStart, new Action(ResetPerRunPrerequisites)); } public static void ResetPerRunPrerequisites() { foreach (SpawnConditions spawnCondition in SpawnConditions) { if (spawnCondition != null) { spawnCondition.spawnsThisRun = 0; spawnCondition.randomNumberForThisRun = Random.value; } } } public static void AddPrequisiteValidator(CwaffPrerequisites prereq, FancyShopBuilder.SpawnCondition validator) { if (SpawnConditions[(int)prereq] != null) { ETGModConsole.Log((object)" Tried to re-initialize a prerequisite!", false); return; } SpawnConditions[(int)prereq] = new SpawnConditions { validator = validator, spawnsThisRun = 0, randomNumberForThisRun = Random.value }; } public override bool CheckConditionsFulfilled() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 if (prerequisite == CwaffPrerequisites.NOT_COOP_MODE_PREREQUISITE && GameManager.HasInstance && (int)GameManager.Instance.CurrentGameType == 1) { return false; } SpawnConditions spawnConditions = SpawnConditions[(int)prerequisite]; if (prerequisite == CwaffPrerequisites.NONE || spawnConditions == null) { return true; } if (spawnConditions.validator == null) { return true; } return spawnConditions.validator(spawnConditions); } public static bool OnFirstFloor(SpawnConditions conds) { return GameManager.Instance.GetLastLoadedLevelDefinition().dungeonSceneName == "tt_castle"; } public static bool NotOnFirstFloor(SpawnConditions conds) { return GameManager.Instance.GetLastLoadedLevelDefinition().dungeonSceneName != "tt_castle"; } public static bool OnSecondFloor(SpawnConditions conds) { return GameManager.Instance.GetLastLoadedLevelDefinition().dungeonSceneName == "tt5"; } public static bool OnThirdFloor(SpawnConditions conds) { return GameManager.Instance.GetLastLoadedLevelDefinition().dungeonSceneName == "tt_mines"; } public static bool HaveDomino(SpawnConditions conds) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 if ((int)GameManager.Instance.CurrentGameType != 1) { return GameManagerUtility.AnyPlayerHasPickupID(GameManager.Instance, Lazy.PickupId()); } return false; } public static bool NoHaveDomino(SpawnConditions conds) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 if ((int)GameManager.Instance.CurrentGameType != 1) { return !GameManagerUtility.AnyPlayerHasPickupID(GameManager.Instance, Lazy.PickupId()); } return false; } } public class CwaffRaidenBeamController : BeamController { public enum TargetType { Screen = 10, Room = 20 } private static class BeamSorter { internal static Vector2 barrelPosition; internal static int Compare(AIActor a, AIActor b) { //IL_0000: 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) //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_0021: 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_002b: Unknown result type (might be due to invalid IL or missing references) Vector2 val = barrelPosition - ((GameActor)a).CenterPosition; float sqrMagnitude = ((Vector2)(ref val)).sqrMagnitude; val = barrelPosition - ((GameActor)b).CenterPosition; return sqrMagnitude.CompareTo(((Vector2)(ref val)).sqrMagnitude); } } public string beamAnimation; public bool usesStartAnimation; public string startAnimation; public tk2dBaseSprite ImpactRenderer; public string EnemyImpactAnimation; public string BossImpactAnimation; public string OtherImpactAnimation; public TargetType targetType = TargetType.Screen; public int maxTargets = -1; public bool SelectRandomTarget; private List s_enemiesInRoom = new List(); private tk2dTiledSprite m_sprite; private bool m_isCurrentlyFiring = true; private bool m_audioPlaying; private List m_targets = new List(); private SpeculativeRigidbody m_hitRigidbody; private bool m_isDirty; private float _growthTime; private bool _lockedOn; private int _firstWrapBoneIndex; private Vector2 lastImpactPosition; private CwaffBoneManager _boneManager; private Vector3 mainBezierPoint1; private Vector3 mainBezierPoint2; private Vector3 mainBezierPoint3; private Vector3 mainBezierPoint4; private const float _EXTEND_TIME = 1.25f; private const int c_segmentCount = 20; private const int c_bonePixelLength = 4; private const float c_boneUnitLength = 0.25f; private const float c_trailHeightOffset = 0.5f; private static readonly int _BEAM_MASK = (CollisionLayerMatrix.GetMask((CollisionLayer)4) | CollisionMask.LayerToMask((CollisionLayer)13)) & ~CollisionMask.LayerToMask((CollisionLayer)1, (CollisionLayer)0); private const float _BEZIER_TIGHTNESS = 5f; private const float _RAYCAST_DIST = 30f; private const int _EXTRA_WRAPS = 5; private const float _WRAP_TIGHTNESS = 2f; private const float _WRAP_ANGLE = 36f; private const float _WRAP_SPREAD = 63f; private const float _SNAP_DISTANCE = 2f; private const float _VINE_LERP = 15f; private List _vineAngles = new List(); private List _vineLengths = new List(); private List _vineAngleDevs = new List(); private List _vineLengthDevs = new List(); private const int _BEZIER_CURVE_SEGMENTS = 20; public override bool ShouldUseAmmo => true; public void Start() { //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_00b3: Unknown result type (might be due to invalid IL or missing references) ((BraveBehaviour)this).transform.parent = SpawnManager.Instance.VFX; float num = 1f; GameActor owner = ((BraveBehaviour)this).projectile.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null) { num = val.BulletScaleModifier; } tk2dSpriteAnimationClip clipByName = ((BraveBehaviour)this).spriteAnimator.GetClipByName(beamAnimation); tk2dSpriteAnimationClip val2 = null; if (usesStartAnimation) { val2 = ((BraveBehaviour)this).spriteAnimator.GetClipByName(startAnimation); } m_sprite = GameObjectExtensions.GetOrAddComponent(((Component)this).gameObject); _boneManager = ((Component)this).gameObject.AddComponent(); _boneManager.Setup(clipByName, val2, num); if (Object.op_Implicit((Object)(object)ImpactRenderer)) { ((BraveBehaviour)ImpactRenderer).transform.localScale = new Vector3(num, num, 1f); } lastImpactPosition = ((BeamController)this).Origin; } public void Update() { //IL_0086: 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_02e6: 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_0251: Unknown result type (might be due to invalid IL or missing references) _boneManager.UpdateTimers(); for (int num = m_targets.Count - 1; num >= 0; num--) { AIActor val = m_targets[num]; if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)((BraveBehaviour)val).healthHaver) || ((BraveBehaviour)val).healthHaver.IsDead || ((GameActor)val).IsGone) { m_targets.RemoveAt(num); _growthTime = 0f; _lockedOn = false; } } m_hitRigidbody = null; HandleBeamFrame(((BeamController)this).Origin, ((BeamController)this).Direction, m_isCurrentlyFiring); if (m_targets == null || m_targets.Count == 0) { if (GameManager.AUDIO_ENABLED && m_audioPlaying) { m_audioPlaying = false; AkSoundEngine.PostEvent("Stop_WPN_loop_01", ((Component)this).gameObject); } } else if (GameManager.AUDIO_ENABLED && !m_audioPlaying) { m_audioPlaying = true; AkSoundEngine.PostEvent("Play_WPN_shot_01", ((Component)this).gameObject); } float num2 = ((BraveBehaviour)this).projectile.baseData.damage + ((BeamController)this).DamageModifier; GameActor owner = ((BraveBehaviour)this).projectile.Owner; PlayerController val2 = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (Object.op_Implicit((Object)(object)val2)) { num2 *= val2.stats.GetStatValue((StatType)1); num2 *= val2.stats.GetStatValue((StatType)5); } if (((BeamController)this).ChanceBasedShadowBullet) { num2 *= 2f; } string text = OtherImpactAnimation; if (_lockedOn && m_targets != null && m_targets.Count > 0) { foreach (AIActor target in m_targets) { if (!Object.op_Implicit((Object)(object)target)) { continue; } HealthHaver healthHaver = ((BraveBehaviour)target).healthHaver; if (healthHaver != null) { text = ((string.IsNullOrEmpty(BossImpactAnimation) || !healthHaver.IsBoss) ? EnemyImpactAnimation : BossImpactAnimation); if (healthHaver.IsBoss && Object.op_Implicit((Object)(object)((BraveBehaviour)this).projectile)) { num2 *= ((BraveBehaviour)this).projectile.BossDamageMultiplier; } if (Object.op_Implicit((Object)(object)((BraveBehaviour)this).projectile) && ((BraveBehaviour)this).projectile.BlackPhantomDamageMultiplier != 1f && target.IsBlackPhantom) { num2 *= ((BraveBehaviour)this).projectile.BlackPhantomDamageMultiplier; } float num3 = num2 * BraveTime.DeltaTime; healthHaver.ApplyDamage(num3, Vector2.zero, ((BeamController)this).Owner.ActorName, (CoreDamageTypes)0, (DamageCategory)0, false, (PixelCollider)null, false); if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)((GameActor)val2).CurrentGun)) { ((Component)((GameActor)val2).CurrentGun).gameObject.GetComponent()?.UpdateDamageDealt(num3); } } } } if (Object.op_Implicit((Object)(object)m_hitRigidbody)) { if (Object.op_Implicit((Object)(object)((BraveBehaviour)m_hitRigidbody).minorBreakable)) { ((BraveBehaviour)m_hitRigidbody).minorBreakable.Break(((BeamController)this).Direction); } if (Object.op_Implicit((Object)(object)((BraveBehaviour)m_hitRigidbody).majorBreakable)) { ((BraveBehaviour)m_hitRigidbody).majorBreakable.ApplyDamage(num2 * BraveTime.DeltaTime, ((BeamController)this).Direction, false, false, false); } } if (Object.op_Implicit((Object)(object)ImpactRenderer) && Object.op_Implicit((Object)(object)((BraveBehaviour)ImpactRenderer).spriteAnimator) && !string.IsNullOrEmpty(text)) { ((BraveBehaviour)ImpactRenderer).spriteAnimator.Play(text); } } public void LateUpdate() { //IL_001f: 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_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_0049: 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_0058: 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_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) if (m_isDirty) { ((tk2dBaseSprite)m_sprite).HeightOffGround = 0.5f; Vector3 position = ((BraveBehaviour)this).transform.position; _boneManager.ManualLateUpdate(); if (Object.op_Implicit((Object)(object)ImpactRenderer)) { Vector3 val = Vector3Extensions.WithZ(((BraveBehaviour)this).transform.position - position, 0f); Transform transform = ((BraveBehaviour)ImpactRenderer).transform; transform.position -= val; } m_isDirty = false; } } public void HandleBeamFrame(Vector2 barrelPosition, Vector2 direction, bool isCurrentlyFiring) { //IL_00d3: 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_0106: 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_0673: Unknown result type (might be due to invalid IL or missing references) //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_067f: Unknown result type (might be due to invalid IL or missing references) //IL_0684: Unknown result type (might be due to invalid IL or missing references) //IL_068e: Unknown result type (might be due to invalid IL or missing references) //IL_0693: Unknown result type (might be due to invalid IL or missing references) //IL_0695: Unknown result type (might be due to invalid IL or missing references) //IL_0696: Unknown result type (might be due to invalid IL or missing references) //IL_069b: Unknown result type (might be due to invalid IL or missing references) //IL_06a2: Unknown result type (might be due to invalid IL or missing references) //IL_06a3: Unknown result type (might be due to invalid IL or missing references) //IL_06c9: Unknown result type (might be due to invalid IL or missing references) //IL_06cd: Unknown result type (might be due to invalid IL or missing references) //IL_06d7: Unknown result type (might be due to invalid IL or missing references) //IL_06e1: Unknown result type (might be due to invalid IL or missing references) //IL_06e6: Unknown result type (might be due to invalid IL or missing references) //IL_06eb: 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_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_0242: 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_0249: 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_026a: 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_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0276: 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_027a: 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_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0718: Unknown result type (might be due to invalid IL or missing references) //IL_0720: Unknown result type (might be due to invalid IL or missing references) //IL_0725: Unknown result type (might be due to invalid IL or missing references) //IL_0727: Unknown result type (might be due to invalid IL or missing references) //IL_072c: Unknown result type (might be due to invalid IL or missing references) //IL_0731: Unknown result type (might be due to invalid IL or missing references) //IL_06f1: Unknown result type (might be due to invalid IL or missing references) //IL_06f6: Unknown result type (might be due to invalid IL or missing references) //IL_06fb: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: 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_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_0750: Unknown result type (might be due to invalid IL or missing references) //IL_0755: Unknown result type (might be due to invalid IL or missing references) //IL_0757: Unknown result type (might be due to invalid IL or missing references) //IL_0761: Unknown result type (might be due to invalid IL or missing references) //IL_0746: Unknown result type (might be due to invalid IL or missing references) //IL_0748: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_0766: Unknown result type (might be due to invalid IL or missing references) //IL_076c: Unknown result type (might be due to invalid IL or missing references) //IL_0771: Unknown result type (might be due to invalid IL or missing references) //IL_0776: Unknown result type (might be due to invalid IL or missing references) //IL_0779: Unknown result type (might be due to invalid IL or missing references) //IL_077b: Unknown result type (might be due to invalid IL or missing references) //IL_0780: Unknown result type (might be due to invalid IL or missing references) //IL_0782: Unknown result type (might be due to invalid IL or missing references) //IL_0784: Unknown result type (might be due to invalid IL or missing references) //IL_0789: Unknown result type (might be due to invalid IL or missing references) //IL_078e: Unknown result type (might be due to invalid IL or missing references) //IL_0790: Unknown result type (might be due to invalid IL or missing references) //IL_0792: Unknown result type (might be due to invalid IL or missing references) //IL_0797: Unknown result type (might be due to invalid IL or missing references) //IL_079c: Unknown result type (might be due to invalid IL or missing references) //IL_079e: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_087d: Unknown result type (might be due to invalid IL or missing references) //IL_0882: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_04eb: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_04ff: Unknown result type (might be due to invalid IL or missing references) //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_0524: Unknown result type (might be due to invalid IL or missing references) //IL_0526: Unknown result type (might be due to invalid IL or missing references) //IL_052b: Unknown result type (might be due to invalid IL or missing references) //IL_0530: Unknown result type (might be due to invalid IL or missing references) //IL_0535: Unknown result type (might be due to invalid IL or missing references) //IL_0537: Unknown result type (might be due to invalid IL or missing references) //IL_0838: Unknown result type (might be due to invalid IL or missing references) //IL_083d: Unknown result type (might be due to invalid IL or missing references) //IL_081c: Unknown result type (might be due to invalid IL or missing references) //IL_0821: 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_057f: Unknown result type (might be due to invalid IL or missing references) //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_0586: Unknown result type (might be due to invalid IL or missing references) //IL_0588: 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_058f: Unknown result type (might be due to invalid IL or missing references) //IL_05a0: Unknown result type (might be due to invalid IL or missing references) //IL_05a5: Unknown result type (might be due to invalid IL or missing references) //IL_05a7: Unknown result type (might be due to invalid IL or missing references) //IL_05ac: 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_05cc: Unknown result type (might be due to invalid IL or missing references) //IL_05d1: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_05d7: 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_05de: Unknown result type (might be due to invalid IL or missing references) //IL_05e0: Unknown result type (might be due to invalid IL or missing references) //IL_05e5: Unknown result type (might be due to invalid IL or missing references) //IL_05e8: Unknown result type (might be due to invalid IL or missing references) //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_05ef: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: Unknown result type (might be due to invalid IL or missing references) //IL_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_05ff: Unknown result type (might be due to invalid IL or missing references) //IL_0842: Unknown result type (might be due to invalid IL or missing references) if (((BeamController)this).Owner is PlayerController) { ((BeamController)this).HandleChanceTick(); } if (targetType == TargetType.Screen) { m_targets.Clear(); List allEnemies = StaticReferenceManager.AllEnemies; for (int i = 0; i < allEnemies.Count; i++) { AIActor val = allEnemies[i]; if (val.IsNormalEnemy && ((BraveBehaviour)val).renderer.isVisible && ((BraveBehaviour)val).healthHaver.IsAlive && !((GameActor)val).IsGone) { m_targets.Add(val); } if (maxTargets > 0 && m_targets.Count >= maxTargets) { break; } } } else if (maxTargets <= 0 || m_targets.Count < maxTargets) { GameManager.Instance.Dungeon.data.GetAbsoluteRoomFromPosition(Vector2Extensions.ToIntVector2(barrelPosition, (VectorConversions)0)).GetActiveEnemies((ActiveEnemyType)0, ref s_enemiesInRoom); if (SelectRandomTarget) { s_enemiesInRoom = BraveUtility.Shuffle(s_enemiesInRoom); } else { BeamSorter.barrelPosition = barrelPosition; s_enemiesInRoom.Sort(BeamSorter.Compare); } for (int j = 0; j < s_enemiesInRoom.Count; j++) { AIActor val2 = s_enemiesInRoom[j]; if (!m_targets.Contains(val2)) { if (val2.IsNormalEnemy && ((BraveBehaviour)val2).renderer.isVisible && ((BraveBehaviour)val2).healthHaver.IsAlive && !((GameActor)val2).IsGone) { m_targets.Add(val2); } if (maxTargets > 0 && m_targets.Count >= maxTargets) { break; } } } } _boneManager.ReturnAllBones(); _growthTime = 1f - Mathf.Min(_growthTime + BraveTime.DeltaTime, 1.25f) / 1.25f; _growthTime = 1f - _growthTime * _growthTime; Vector3? val3 = null; Vector2 val9; if (m_targets.Count > 0) { Vector3 val4 = Vector2.op_Implicit(((Vector2)(ref direction)).normalized * 5f); Vector3 val5 = Vector2.op_Implicit(barrelPosition); Vector3 val6 = val5 + val4; Vector3 val7 = Vector2.op_Implicit(((BraveBehaviour)m_targets[0]).specRigidbody.HitboxPixelCollider.UnitCenter); Vector3 val8 = val7 - val4; val9 = lastImpactPosition - Vector3Extensions.XY(val7); if (((Vector2)(ref val9)).sqrMagnitude > 2f) { _lockedOn = false; lastImpactPosition = Lazy.SmoothestLerp(lastImpactPosition, Vector2.op_Implicit(val7), 15f); DrawMainBezierCurve(Vector2.op_Implicit(val5), Vector2.op_Implicit(val6), lastImpactPosition - Vector3Extensions.XY(val4), lastImpactPosition); } else { while (_vineAngles.Count < 5) { _vineAngles.Add(Random.Range(10f, 90f)); _vineAngleDevs.Add(Random.Range(5f, 15f)); _vineLengths.Add(Random.Range(1.5f, 3f)); _vineLengthDevs.Add(Random.Range(1f, 3f)); } _lockedOn = true; lastImpactPosition = Vector2.op_Implicit(val7); DrawMainBezierCurve(Vector2.op_Implicit(val5), Vector2.op_Implicit(val6), Vector2.op_Implicit(val8), Vector2.op_Implicit(val7)); for (int k = 0; k < m_targets.Count; k++) { val4 = ((Vector3)(ref val4)).normalized * 2f; _firstWrapBoneIndex = _boneManager.BoneCount(); float scaledTimeSinceStartup = BraveTime.ScaledTimeSinceStartup; for (int l = 0; l < 5; l++) { float num = _growthTime * Mathf.Sin(_vineAngleDevs[l] * scaledTimeSinceStartup); val4 = _growthTime * Mathf.Abs(Mathf.Sin(_vineLengthDevs[l] * scaledTimeSinceStartup)) * _vineLengths[l] * ((Vector3)(ref val4)).normalized; val6 = val7 + val4; Vector3 val10 = Quaternion.Euler(0f, 0f, _vineAngles[l] / 2f) * val4; Vector3 val11 = val7 + val10; val4 = Quaternion.Euler(0f, 0f, _vineAngles[l]) * val4; val8 = val7 + val4; val4 = -val4; DrawBezierCurve(Vector2.op_Implicit(val7), Vector2.op_Implicit(val7 + Quaternion.Euler(0f, 0f, -63f * num) * val10), Vector2.op_Implicit(val6), Vector2.op_Implicit(val11)); DrawBezierCurve(Vector2.op_Implicit(val11), Vector2.op_Implicit(val8), Vector2.op_Implicit(val7 + Quaternion.Euler(0f, 0f, 63f * num) * val10), Vector2.op_Implicit(val7)); } if (k < m_targets.Count - 1) { val5 = Vector2.op_Implicit(((BraveBehaviour)m_targets[k]).specRigidbody.HitboxPixelCollider.UnitCenter); val6 = val5 + val4; val4 = Quaternion.Euler(0f, 0f, 90f) * val4; val7 = Vector2.op_Implicit(((BraveBehaviour)m_targets[k + 1]).specRigidbody.HitboxPixelCollider.UnitCenter); val8 = val7 + val4; val4 = -val4; DrawBezierCurve(Vector2.op_Implicit(val5), Vector2.op_Implicit(val6), Vector2.op_Implicit(val8), Vector2.op_Implicit(val7)); } } } if (Object.op_Implicit((Object)(object)ImpactRenderer)) { ((BraveBehaviour)ImpactRenderer).renderer.enabled = false; } } else { _lockedOn = false; Vector3 val12 = Quaternion.Euler(0f, 0f, Mathf.PingPong(Time.realtimeSinceStartup * 15f, 60f) - 30f) * Vector2.op_Implicit(((Vector2)(ref direction)).normalized) * 5f; Vector3 val13 = Vector2.op_Implicit(barrelPosition); RaycastResult val14 = default(RaycastResult); bool num2 = PhysicsEngine.Instance.RaycastWithIgnores(barrelPosition, direction, 30f, ref val14, true, true, _BEAM_MASK, (CollisionLayer?)null, false, (Func)null, (ICollection)((BeamController)this).GetIgnoreRigidbodies()); Vector3 val15 = val13 + Vector2Extensions.ToVector3ZUp(((Vector2)(ref direction)).normalized * 30f, 0f); if (num2) { val15 = Vector2.op_Implicit(((CastResult)val14).Contact); m_hitRigidbody = val14.SpeculativeRigidbody; } RaycastResult.Pool.Free(ref val14); val3 = val15; val9 = lastImpactPosition - Vector3Extensions.XY(val15); float sqrMagnitude = ((Vector2)(ref val9)).sqrMagnitude; lastImpactPosition = ((sqrMagnitude > 2f) ? Lazy.SmoothestLerp(lastImpactPosition, Vector2.op_Implicit(val15), 15f) : Vector2.op_Implicit(val15)); val15 = Vector2.op_Implicit(lastImpactPosition); DrawMainBezierCurve(Vector2.op_Implicit(val13), Vector2.op_Implicit(val13 + val12), Vector2.op_Implicit(val15 - val12), Vector2.op_Implicit(val15)); if (Object.op_Implicit((Object)(object)ImpactRenderer)) { ((BraveBehaviour)ImpactRenderer).renderer.enabled = false; } } _boneManager.RecomputeNormals(); m_isDirty = true; if (Object.op_Implicit((Object)(object)ImpactRenderer)) { ((BraveBehaviour)ImpactRenderer).renderer.enabled = true; if (m_targets.Count == 0) { ((BraveBehaviour)ImpactRenderer).transform.position = Vector2.op_Implicit((!val3.HasValue) ? Vector3Extensions.XY(((PlayerController)/*isinst with value type is only supported in some contexts*/).unadjustedAimPoint) : Vector3Extensions.XY(val3.Value)); ImpactRenderer.IsPerpendicular = false; } else { ((BraveBehaviour)ImpactRenderer).transform.position = Vector2.op_Implicit(((GameActor)m_targets[m_targets.Count - 1]).CenterPosition); ImpactRenderer.IsPerpendicular = true; } ImpactRenderer.HeightOffGround = 6f; ImpactRenderer.UpdateZDepth(); } } public override void LateUpdatePosition(Vector3 origin) { } public override void CeaseAttack() { ((BeamController)this).DestroyBeam(); } public override void DestroyBeam() { Object.Destroy((Object)(object)((Component)this).gameObject); } public override void AdjustPlayerBeamTint(Color targetTintColor, int priority, float lerpTime = 0f) { } private void DrawBezierCurve(Vector2 p0, Vector2 p1, Vector2 p2, Vector2 p3) { //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_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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_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_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_0034: 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_003a: 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_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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_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_006b: 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_0085: 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_00a0: 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) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector2.op_Implicit(BraveMathCollege.CalculateBezierPoint(0f, p0, p1, p2, p3)); float num = 0f; for (int i = 1; i <= 20; i++) { Vector2 val2 = BraveMathCollege.CalculateBezierPoint((float)i / 20f, p0, p1, p2, p3); num += Vector2.Distance(Vector2.op_Implicit(val), val2); val = Vector2.op_Implicit(val2); } float num2 = 4f * num; val = Vector2.op_Implicit(BraveMathCollege.CalculateBezierPoint(0f, p0, p1, p2, p3)); if (!_boneManager.HasBones()) { _boneManager.RentBone(Vector2.op_Implicit(val)); } for (int j = 1; (float)j <= num2; j++) { _boneManager.RentBone(BraveMathCollege.CalculateBezierPoint((float)j / num2, p0, p1, p2, p3)); } } private void DrawMainBezierCurve(Vector2 p0, Vector2 p1, Vector2 p2, Vector2 p3) { //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_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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_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_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_001e: 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_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_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) DrawBezierCurve(p0, p1, p2, p3); mainBezierPoint1 = Vector2.op_Implicit(p0); mainBezierPoint2 = Vector2.op_Implicit(p1); mainBezierPoint3 = Vector2.op_Implicit(p2); mainBezierPoint4 = Vector2.op_Implicit(p3); } public Vector2 GetPointOnMainBezier(float t) { //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_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_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) //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_002d: Unknown result type (might be due to invalid IL or missing references) return BraveMathCollege.CalculateBezierPoint(t, Vector2.op_Implicit(mainBezierPoint1), Vector2.op_Implicit(mainBezierPoint2), Vector2.op_Implicit(mainBezierPoint3), Vector2.op_Implicit(mainBezierPoint4)); } } [HarmonyPatch] public abstract class CwaffCompanionController : CompanionController { [SerializeField] private Vector2 _petOffsetRight = Vector2.zero; [SerializeField] private Vector2 _petOffsetLeft = Vector2.zero; internal void SetPettingOffsetsInternal(Vector2 right, Vector2? left = null) { //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_000a: 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_0010: Unknown result type (might be due to invalid IL or missing references) _petOffsetRight = right; _petOffsetLeft = left ?? right; } [HarmonyPatch(typeof(CompanionController), "DoPet")] [HarmonyPostfix] private static void PettingFixerPatch(CompanionController __instance, PlayerController player) { //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_001f: 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) if (__instance is CwaffCompanionController cwaffCompanionController) { if (((BraveBehaviour)__instance).aiAnimator.FacingDirection < 90f) { ((CompanionController)cwaffCompanionController).m_petOffset = cwaffCompanionController._petOffsetRight; } else { ((CompanionController)cwaffCompanionController).m_petOffset = cwaffCompanionController._petOffsetLeft; } } } } public abstract class CwaffCompanionMovementBehaviorBase : MovementBehaviorBase { public float pathInterval = 0.25f; public bool retargetOnPathingFailure; public bool preventWarpingWhenOnscreen; protected GameActor _targetActor; protected float m_repathTimer; protected float m_stateTimer; protected CompanionController m_companionController; protected Vector2 _targetPos; protected bool _allowPathing = true; protected bool _isCompanion; private int m_sequentialPathFails; public override void Start() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown ((MovementBehaviorBase)this).Start(); m_companionController = ((BehaviorBase)this).m_gameObject.GetComponent(); _isCompanion = (Object)(object)m_companionController != (Object)null; ((GameActor)((BehaviorBase)this).m_aiActor).MovementModifiers += new MovementModifier(TickMovement); } public override void Destroy() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiActor)) { ((GameActor)((BehaviorBase)this).m_aiActor).MovementModifiers -= new MovementModifier(TickMovement); } ((BehaviorBase)this).Destroy(); } protected virtual void TickMovement(ref Vector2 voluntaryVel, ref Vector2 involuntaryVel) { } protected virtual void UpdateStateAndTargetPosition() { } protected virtual bool IsTargetValid() { return false; } protected virtual bool ReachedTarget() { return false; } protected virtual void OnReachedTarget() { } protected virtual void DetermineNewTarget() { } protected virtual bool PreventWarping() { return false; } protected virtual void OnPreWarp() { } protected virtual void OnWarp() { } protected void RepathToTarget() { //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_0015: 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_0026: 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_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_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) //IL_0039: 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_0081: 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_0097: 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_00c7: 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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0195: 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_01b8: Unknown result type (might be due to invalid IL or missing references) Vector2 val = Vector3Extensions.XY(((BraveBehaviour)((BehaviorBase)this).m_aiActor).transform.position); Vector2 worldCenter = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).sprite.WorldCenter; Vector2 val2 = _targetPos + (val - worldCenter); if (m_repathTimer > 0f) { return; } m_repathTimer = pathInterval; if (Object.op_Implicit((Object)(object)m_companionController) && m_companionController.IsBeingPet) { Vector2 val3 = ((BraveBehaviour)m_companionController.m_pettingDoer).specRigidbody.UnitCenter + m_companionController.m_petOffset; if (Vector2.Distance(val3, ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.UnitCenter) < 0.08f) { ((BehaviorBase)this).m_aiActor.ClearPath(); } else { ((BehaviorBase)this).m_aiActor.PathfindToPosition(val3, (Vector2?)val3, true, (CellValidator)null, (ExtraWeightingFunction)null, (CellTypes?)null, false); } } else { ((BehaviorBase)this).m_aiActor.PathfindToPosition(val2, (Vector2?)null, true, (CellValidator)null, (ExtraWeightingFunction)null, (CellTypes?)null, false); } if (((BehaviorBase)this).m_aiActor.Path == null) { m_sequentialPathFails = 0; } else if (((BehaviorBase)this).m_aiActor.Path.InaccurateLength > 50f) { ((BehaviorBase)this).m_aiActor.ClearPath(); m_sequentialPathFails = 0; Warp(val2); if (retargetOnPathingFailure) { DetermineNewTarget(); } } else if (!((BehaviorBase)this).m_aiActor.Path.WillReachFinalGoal && ++m_sequentialPathFails > 3) { CellData val4 = GameManager.Instance.Dungeon.data[Vector2Extensions.ToIntVector2(val2, (VectorConversions)0)]; if (val4 != null && val4.IsPassable) { m_sequentialPathFails = 0; Warp(val2); if (retargetOnPathingFailure) { DetermineNewTarget(); } } } else { m_sequentialPathFails = 0; } } protected void Warp(Vector2 pos) { //IL_000c: 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) OnPreWarp(); ((BehaviorBase)this).m_aiActor.CompanionWarp(Vector2.op_Implicit(pos)); OnWarp(); } protected bool NearTargetPos(float radius, bool checkInBounds = true) { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (checkInBounds && !((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition.InBounds()) { return false; } Vector2 val = _targetPos - ((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition; return ((Vector2)(ref val)).sqrMagnitude <= radius * radius; } protected bool NearTargetActor(float radius, bool checkInBounds = true) { //IL_002b: 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_0040: 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) if (!Object.op_Implicit((Object)(object)_targetActor) || (checkInBounds && !((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition.InBounds())) { return false; } Vector2 val = _targetActor.CenterPosition - ((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition; return ((Vector2)(ref val)).sqrMagnitude <= radius * radius; } protected bool CanSeeTargetPos() { //IL_0006: 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) return ((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition.HasLineOfSight(_targetPos); } protected bool CanSeeTargetActor() { //IL_0013: 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) if (Object.op_Implicit((Object)(object)_targetActor)) { return ((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition.HasLineOfSight(_targetActor.CenterPosition); } return false; } protected bool NearPit() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return ((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition.NearPit(); } protected bool InCombat() { if (Object.op_Implicit((Object)(object)m_companionController)) { PlayerController owner = m_companionController.m_owner; if (owner != null) { return owner.IsInCombat; } } return false; } protected Vector2 DeltaToTarget() { //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_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_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) //IL_0033: Unknown result type (might be due to invalid IL or missing references) Vector2 val = Vector3Extensions.XY(((BraveBehaviour)((BehaviorBase)this).m_aiActor).transform.position); return _targetPos - ((BraveBehaviour)((BehaviorBase)this).m_aiActor).sprite.GetRelativePositionFromAnchor((Anchor)4) - val; } protected bool StateExpired() { return m_stateTimer <= 0f; } private bool CheckOffscreenForWarpingPurposes() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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) if (!Object.op_Implicit((Object)(object)m_companionController)) { return false; } if (!preventWarpingWhenOnscreen) { return m_companionController.InDifferentRoomThanOwner(); } Vector2 centerPosition = ((GameActor)((BehaviorBase)this).m_aiActor).CenterPosition; if (GameManager.Instance.MainCameraController.PointIsVisible(centerPosition, 0.4f)) { return false; } RoomHandler currentRoom = m_companionController.m_owner.CurrentRoom; if (currentRoom != null) { return currentRoom != Vector3Extensions.GetAbsoluteRoom(centerPosition); } return true; } public sealed override void Upkeep() { ((MovementBehaviorBase)this).Upkeep(); ((BehaviorBase)this).DecrementTimer(ref m_repathTimer, false); ((BehaviorBase)this).DecrementTimer(ref m_stateTimer, false); } public sealed override BehaviorResult Update() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) if (GameManager.HasInstance && !GameManager.Instance.IsLoadingLevel) { if ((int)GameManager.Instance.CurrentLevelOverrideState == 4) { ((BehaviorBase)this).m_aiActor.ClearPath(); return (BehaviorResult)2; } if (!IsTargetValid()) { DetermineNewTarget(); } UpdateStateAndTargetPosition(); if (CheckOffscreenForWarpingPurposes() && !PreventWarping()) { Warp(((GameActor)m_companionController.m_owner).CenterPosition); if (retargetOnPathingFailure) { DetermineNewTarget(); } } else if (ReachedTarget()) { OnReachedTarget(); } else if (_allowPathing) { RepathToTarget(); } return (BehaviorResult)1; } return (BehaviorResult)2; } } public static class CwaffCompanionAndEnemyBuilder { public static GameObject FortunesFavorVFX; public static Friend InitCompanion(this PassiveItem item, string friendName = null, int baseFps = 4, List extraAnims = null, bool autoRigidBody = true) where Friend : CwaffCompanionController { //IL_007d: 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_00e7: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_010c: Unknown result type (might be due to invalid IL or missing references) if (!(item is CwaffCompanion cwaffCompanion)) { Lazy.RuntimeWarn("Trying to create a companion for an item that is not a CwaffCompanion"); return null; } string text = ETGMod.ToID(friendName ?? ((PickupObject)item).itemName); if (ResMap.Get(text + "_idle") == null) { Lazy.RuntimeWarn("All companions must have an idle_001 animation, but no \"" + text + "_idle_001\" sprite found"); return null; } Friend val = CompanionBuilder.BuildPrefab(text, "cg:" + text + "_companion", text + "_idle_001", IntVector2.Zero, IntVector2.One).AddComponent(); AIActor component = ((Component)val).gameObject.GetComponent(); component.SetupAnimations(baseFps, extraAnims); if (autoRigidBody) { ((Component)component).gameObject.AutoRigidBody((CollisionLayer)3); ((GameActor)component).ActorShadowOffset = Vector2.op_Implicit(Vector2.zero); } else { ((GameActor)component).ActorShadowOffset = new Vector3(((BraveBehaviour)component).sprite.GetRelativePositionFromAnchor((Anchor)0).x, 0f, 0f); } ((CompanionController)val).companionID = (CompanionIdentifier)0; ((CompanionItem)cwaffCompanion).CompanionGuid = component.EnemyGuid; return val; } public static AIActor InitEnemy(this string enemyName, int health, string shortDesc = null, string longDesc = null, int baseFps = 4, List extraAnims = null, bool autoRigidBody = true, bool doCorpse = true, IntVector2? bodyDims = null, bool useUntrimmedBounds = false) { //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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_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_00c9: Unknown result type (might be due to invalid IL or missing references) string text = ETGMod.ToID(enemyName); if (ResMap.Get(text + "_idle") == null) { Lazy.RuntimeWarn("All enemies must have an idle_001 animation, but no \"" + text + "_idle_001\" sprite found"); return null; } AIActor component = EnemyBuilder.BuildPrefab(text, "cg:" + text + "_enemy", text + "_idle_001", IntVector2.Zero, IntVector2.One, false).GetComponent(); HealthHaver component2 = ((Component)component).gameObject.GetComponent(); component2.SetHealthMaximum((float)health, (float?)null, false); component2.FullHeal(); component.SetupAnimations(baseFps, extraAnims); if (autoRigidBody) { ((Component)component).gameObject.AutoRigidBody(new List(2) { (CollisionLayer)3, (CollisionLayer)2 }, canBePushed: false, 1f, keepExistingColliders: false, bodyDims, useUntrimmedBounds); ((GameActor)component).ActorShadowOffset = Vector2.op_Implicit(Vector2.zero); } else { ((GameActor)component).ActorShadowOffset = new Vector3(((BraveBehaviour)component).sprite.GetRelativePositionFromAnchor((Anchor)0).x, 0f, 0f); } if (doCorpse) { component.CorpseObject = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5").CorpseObject; } if ((Object)(object)FortunesFavorVFX == (Object)null) { FortunesFavorVFX = ResourceManager.LoadAssetBundle("shared_auto_001").LoadAsset("FortuneFavor_VFX_Spark"); } if (!string.IsNullOrEmpty(shortDesc) && !string.IsNullOrEmpty(longDesc)) { component.SetupAmmonomiconEntry(shortDesc, longDesc, enemyName); } Game.Enemies.Add("cg:" + text, component); return component; } private static void SetupAnimations(this AIActor actor, int baseFps, List extraAnims = null) { //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_0120: Expected O, but got Unknown //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: 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_01cb: Expected O, but got Unknown string name = ((Object)((Component)actor).gameObject).name; CompanionController component = ((Component)actor).gameObject.GetComponent(); tk2dSpriteCollectionData collection = VFX.Collection; AIAnimator component2 = ((Component)actor).gameObject.GetComponent(); tk2dSpriteAnimator component3 = ((Component)actor).gameObject.GetComponent(); component3.library = ((Component)actor).gameObject.AddComponent(); component2.OtherAnimations = new List(); List clips = new List(); component2.IdleAnimation = collection.AutoAnimation(ref clips, name + "_idle", baseFps); component2.MoveAnimation = collection.AutoAnimation(ref clips, name + "_move", baseFps); component2.FlightAnimation = collection.AutoAnimation(ref clips, name + "_flight", baseFps); component2.HitAnimation = collection.AutoAnimation(ref clips, name + "_hit", baseFps); component2.TalkAnimation = collection.AutoAnimation(ref clips, name + "_talk", baseFps); DirectionalAnimation val = collection.AutoAnimation(ref clips, name + "_pet", baseFps); if (val != null) { component2.OtherAnimations.Add(new NamedDirectionalAnimation { name = "pet", anim = val }); if (Object.op_Implicit((Object)(object)component)) { component.CanBePet = true; } } DirectionalAnimation val2 = collection.AutoAnimation(ref clips, name + "_fidget", baseFps); if (val2 != null) { component2.IdleFidgetAnimations = new List(1) { val2 }; } foreach (string item in extraAnims.EmptyIfNull()) { bool loop = item != "pitfall" && item != "death"; component2.OtherAnimations.Add(new NamedDirectionalAnimation { name = item, anim = collection.AutoAnimation(ref clips, name + "_" + item, baseFps, loop) }); } component3.library.clips = clips.ToArray(); } private static void SetupAmmonomiconEntry(this AIActor enemy, string shortDesc, string longDesc, string EnemyName) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_00bf: 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) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: 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) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020f: 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_0223: Expected O, but got Unknown //IL_0239: 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_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Expected O, but got Unknown string text = ETGMod.ToID(EnemyName); if ((Object)(object)((Component)enemy).GetComponent() != (Object)null) { Object.Destroy((Object)(object)((Component)enemy).GetComponent()); } ((BraveBehaviour)enemy).encounterTrackable = ((Component)enemy).gameObject.AddComponent(); ((BraveBehaviour)enemy).encounterTrackable.journalData = new JournalEntry(); ((BraveBehaviour)enemy).encounterTrackable.EncounterGuid = enemy.EnemyGuid; ((BraveBehaviour)enemy).encounterTrackable.prerequisites = (DungeonPrerequisite[])(object)new DungeonPrerequisite[0]; ((BraveBehaviour)enemy).encounterTrackable.journalData.SuppressKnownState = false; ((BraveBehaviour)enemy).encounterTrackable.journalData.IsEnemy = true; ((BraveBehaviour)enemy).encounterTrackable.journalData.SuppressInAmmonomicon = false; string text2 = "cg_" + text + "_icon"; AtlasHelper.AddSpritesToCollection(new List(1) { text2 }, AmmonomiconController.ForceInstance.EncounterIconCollection); ((BraveBehaviour)enemy).encounterTrackable.journalData.AmmonomiconSprite = text2; ((BraveBehaviour)enemy).encounterTrackable.journalData.enemyPortraitSprite = ResourceExtractor.GetTextureFromResource("CwaffingTheGungy/Resources/" + text + "_portrait.png", (Assembly)null); ((BraveBehaviour)enemy).encounterTrackable.ProxyEncounterGuid = string.Empty; Databases.Strings.Enemies.Set("#" + EnemyName.ToUpper(), EnemyName); Databases.Strings.Enemies.Set("#" + shortDesc.ToUpper(), shortDesc); Databases.Strings.Enemies.Set("#" + longDesc.ToUpper(), longDesc); ((BraveBehaviour)enemy).encounterTrackable.journalData.PrimaryDisplayName = "#" + EnemyName.ToUpper(); ((BraveBehaviour)enemy).encounterTrackable.journalData.NotificationPanelDescription = "#" + shortDesc.ToUpper(); ((BraveBehaviour)enemy).encounterTrackable.journalData.AmmonomiconFullEntry = "#" + longDesc.ToUpper(); ((BraveBehaviour)enemy).encounterTrackable.journalData.SuppressKnownState = false; EnemyDatabaseEntry item = new EnemyDatabaseEntry { myGuid = enemy.EnemyGuid, placeableWidth = 2, placeableHeight = 2, isNormalEnemy = true, path = enemy.EnemyGuid, isInBossTab = false, encounterGuid = enemy.EnemyGuid }; ((AssetBundleDatabase)(object)EnemyDatabase.Instance).Entries.Add(item); EncounterDatabaseEntry item2 = new EncounterDatabaseEntry(((BraveBehaviour)enemy).encounterTrackable) { path = enemy.EnemyGuid, myGuid = enemy.EnemyGuid }; ((AssetBundleDatabase)(object)EncounterDatabase.Instance).Entries.Add(item2); } public static DirectionalAnimation AutoAnimation(this tk2dSpriteCollectionData coll, ref List clips, string name, int fps, bool loop = true) { //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_0007: 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_009d: 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_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_00b0: 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_00c4: Expected O, but got Unknown DirectionType val = Lazy.AutoDetectDirectionFromSpriteName(name); if ((int)val == 0) { return null; } SingleAnimation[] array = DirectionalAnimation.m_combined[val]; int num = array.Length; string[] array2 = new string[num]; for (int i = 0; i < num; i++) { string text = (string.IsNullOrEmpty(array[i].suffix) ? name : (name + "_" + array[i].suffix)); tk2dSpriteAnimationClip val2 = coll.AddAnimation(text, null, fps, (!loop) ? (-1) : 0); if (val2 == null) { Lazy.RuntimeWarn(" FAILED TO ADD CLIP " + text); return null; } array2[i] = text; clips.Add(val2); } return new DirectionalAnimation { Type = val, Prefix = name, AnimNames = array2, Flipped = (FlipType[])(object)new FlipType[num] }; } public static T MakeIntangible(this T friend) where T : CwaffCompanionController { ((CompanionController)friend).CanCrossPits = true; ((BraveBehaviour)((BraveBehaviour)friend).aiActor).healthHaver.PreventAllDamage = true; ((BraveBehaviour)friend).aiActor.CollisionDamage = 0f; ((BraveBehaviour)((BraveBehaviour)friend).aiActor).specRigidbody.CollideWithOthers = false; ((BraveBehaviour)((BraveBehaviour)friend).aiActor).specRigidbody.CollideWithTileMap = false; ((GameActor)((BraveBehaviour)friend).aiActor).HasShadow = false; return friend; } public static T SetPettingOffsets(this T self, Vector2 right, Vector2? left = null) where T : CwaffCompanionController { //IL_0006: Unknown result type (might be due to invalid IL or missing references) self.SetPettingOffsetsInternal(right, left); return self; } } public class HeckedShrine : MonoBehaviour, IPlayerInteractable { private const Anchor SHRINE_ANCHOR = (Anchor)1; private static HeckedShrine _RetrashShrine = null; private static HeckedShrine _RetrashAltShrine = null; private static HeckedShrine _LordfortressShrine = null; public tk2dBaseSprite sprite; public SpeculativeRigidbody body; public string text = ""; public bool fancy; public Vector2 positionInRoom = Vector2.zero; private static string _RetrashText = "A monument to Retrash, Challenger to Kaliber. The inscription reads:\n\nSkill Beyond This World\nEven Seven Hundred Guns\n{wj}COULD NOT SAVE THE LICH{w}"; private static string _RetrashAltText = "{wj}SEVEN THOUSAND GUNS{w}\n{wj}KALIBER CAN'T PROTECT YOU{w}\n{wj}GIVE UP WHILE YOU CAN{w}"; private static string _LordfortressText = "A monument to Lordfortress, first to defeat the Dragun while persevering the trials of the Hecked."; public static void Init() { //IL_0014: 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_005c: Unknown result type (might be due to invalid IL or missing references) _RetrashShrine = SetupShrine("retrash_statue", _RetrashText, new Vector2(4f, 3f), fancy: true); _RetrashAltShrine = SetupShrine("retrash_alt_statue", _RetrashAltText, new Vector2(4f, 3f), fancy: true); _LordfortressShrine = SetupShrine("lordfortress_statue", _LordfortressText, new Vector2(6f, 3f), fancy: false); CwaffEvents.OnKeepFullyLoaded = (Action)Delegate.Combine(CwaffEvents.OnKeepFullyLoaded, new Action(SpawnInShrines)); } internal static HeckedShrine SetupShrine(string spritePath, string flavorText, Vector2 positionInRoom, bool fancy) { //IL_007a: 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) GameObject val = VFX.Create(spritePath, 2f, loops: true, -1, 1f, (Anchor)1, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); HeckedShrine heckedShrine = val.AddComponent(); heckedShrine.body = null; heckedShrine.sprite = val.GetComponent(); heckedShrine.text = flavorText; heckedShrine.positionInRoom = positionInRoom; heckedShrine.fancy = fancy; return heckedShrine; } private static void SpawnInShrines() { if (HeckedMode._HeckedModeStatus != HeckedMode.Hecked.Disabled) { ((MonoBehaviour)GameManager.Instance).StartCoroutine(SpawnInShrines_CR()); } static IEnumerator SpawnInShrines_CR() { while (GameManager.Instance.IsLoadingLevel) { yield return null; } Vector3 heroShrinePos = Vector3.zero; bool flag = false; _ = GameManager.Instance.BestActivePlayer; foreach (AdvancedShrineController allAdvancedShrineController in StaticReferenceManager.AllAdvancedShrineControllers) { if (allAdvancedShrineController.IsLegendaryHeroShrine) { flag = true; heroShrinePos = ((BraveBehaviour)allAdvancedShrineController).transform.position + Vector2Extensions.ToVector3ZisY(new Vector2(((BraveBehaviour)allAdvancedShrineController).sprite.GetCurrentSpriteDef().position3.x / 2f, -3f), 0f); } } if (flag) { if (HeckedMode._HeckedModeStatus != HeckedMode.Hecked.Retrashed) { SpawnIn(_RetrashShrine, heroShrinePos); SpawnIn(_LordfortressShrine, heroShrinePos); } else { SpawnIn(_RetrashAltShrine, heroShrinePos); } } } } private static void SpawnIn(HeckedShrine shrinePrefab, Vector3 heroShrinePos) { //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_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_003f: 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) HeckedShrine component = ((Component)shrinePrefab).gameObject.Instantiate(heroShrinePos + Vector2Extensions.ToVector3ZisY(shrinePrefab.positionInRoom, 0f)).GetComponent(); Vector3Extensions.GetAbsoluteRoom(heroShrinePos).RegisterInteractable(((Component)component).GetComponent()); if (component.fancy) { if (HeckedMode._HeckedModeStatus == HeckedMode.Hecked.Retrashed) { Material orAddShader = ((Component)component.sprite).gameObject.GetOrAddShader(Shader.Find("Brave/LitCutoutUberPhantom")); orAddShader.SetFloat("_PhantomGradientScale", 0.75f); orAddShader.SetFloat("_PhantomContrastPower", 1.3f); } else { component.sprite.SetGlowiness(100f); } } component.body = ((Component)component).gameObject.AutoRigidBody((CollisionLayer)6); component.sprite.FlipX = shrinePrefab.positionInRoom.x < 0f; component.sprite.HeightOffGround = -2f; component.sprite.UpdateZDepth(); SpriteOutlineManager.AddOutlineToSprite(component.sprite, Color.black, 1f, 0.005f, (OutlineType)0); } private void Update() { //IL_0075: 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_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_0094: 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) if (fancy) { if (HeckedMode._HeckedModeStatus != HeckedMode.Hecked.Retrashed) { sprite.SetGlowiness(50f + 50f * Mathf.Abs(Mathf.Sin(0.75f * BraveTime.ScaledTimeSinceStartup))); } else if (Random.value < 0.25f) { GlobalSparksDoer.DoRandomParticleBurst(1, Vector2.op_Implicit(sprite.WorldBottomLeft), Vector2.op_Implicit(sprite.WorldTopRight), Vector2Extensions.ToVector3ZUp(Lazy.RandomVector(), 0f), 0.5f, 0f, (float?)null, (float?)0.5f, (Color?)null, (SparksType)1); } } } public void Interact(PlayerController interactor) { interactor.CurrentRoom.DeregisterInteractable((IPlayerInteractable)(object)this); ((MonoBehaviour)this).StartCoroutine(InteractWithShrine(interactor)); } private IEnumerator InteractWithShrine(PlayerController interactor) { Transform talkPoint = ((Component)this).transform; TextBoxManager.ShowStoneTablet(Vector2.op_Implicit(sprite.WorldTopCenter), talkPoint, -1f, text, true, false); interactor.SetInputOverride("shrineConversation"); yield return null; GameUIRoot.Instance.DisplayPlayerConversationOptions(interactor, (TalkModule)null, "Cool. O:", string.Empty); int num = default(int); while (!GameUIRoot.Instance.GetPlayerConversationResponse(ref num)) { yield return null; } interactor.ClearInputOverride("shrineConversation"); TextBoxManager.ClearTextBox(talkPoint); Vector3Extensions.GetAbsoluteRoom(((Component)this).transform.position).RegisterInteractable(((Component)this).GetComponent()); } public void OnEnteredRange(PlayerController interactor) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)this)) { SpriteOutlineManager.RemoveOutlineFromSprite(sprite, false); SpriteOutlineManager.AddOutlineToSprite(sprite, Color.white, 1f, 0.005f, (OutlineType)0); } } public void OnExitRange(PlayerController interactor) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)this)) { SpriteOutlineManager.RemoveOutlineFromSprite(sprite, false); SpriteOutlineManager.AddOutlineToSprite(sprite, Color.black, 1f, 0.005f, (OutlineType)0); } } public float GetDistanceToPoint(Vector2 point) { //IL_0022: 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_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) //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_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) if (!Object.op_Implicit((Object)(object)this)) { return 1000f; } if ((Object)(object)sprite == (Object)null) { return 100f; } Vector3 val = Vector2.op_Implicit(BraveMathCollege.ClosestPointOnRectangle(point, body.UnitBottomLeft, body.UnitDimensions)); return Vector2.Distance(point, Vector2.op_Implicit(val)) / 1.5f; } public float GetOverrideMaxDistance() { return -1f; } public string GetAnimationState(PlayerController interactor, out bool shouldBeFlipped) { shouldBeFlipped = false; return string.Empty; } } [HarmonyPatch] public class CwaffRunData : FakeItem { public string btcktfEnemyGuid = string.Empty; public bool noPastRegrets; public bool scrambledBulletHell; public string nameOfPreviousFloor; public List[] glassGunIds = new List[2] { new List(), new List() }; public List[] pristineGunIds = new List[2] { new List(), new List() }; private bool _deserialized; private static CwaffRunData _Instance; public static CwaffRunData Instance => _Instance; public static void Init() { CwaffEvents.OnCleanStart = (Action)Delegate.Combine(CwaffEvents.OnCleanStart, new Action(OnCleanStart)); CwaffEvents.OnFirstFloorOfRunFullyLoaded = (Action)Delegate.Combine(CwaffEvents.OnFirstFloorOfRunFullyLoaded, new Action(ResetForNewRun)); FakeItem.Create(); } private static void OnCleanStart() { _Instance = null; } private static void ResetForNewRun() { PlayerController primaryPlayer = GameManager.Instance.PrimaryPlayer; if (Object.op_Implicit((Object)(object)primaryPlayer)) { CwaffRunData passive = primaryPlayer.GetPassive(); if (passive != null) { _ = passive._deserialized; } else { _Instance = primaryPlayer.AcquireFakeItem(); } } } public override void MidGameSerialize(List data) { ((PickupObject)this).MidGameSerialize(data); data.Add(noPastRegrets); data.Add(scrambledBulletHell); data.Add(btcktfEnemyGuid); for (int i = 0; i < 1; i++) { data.Add(glassGunIds[i].Count); for (int j = 0; j < glassGunIds[i].Count; j++) { data.Add(glassGunIds[i][j]); } data.Add(pristineGunIds[i].Count); for (int k = 0; k < pristineGunIds[i].Count; k++) { data.Add(pristineGunIds[i][k]); } } } public override void MidGameDeserialize(List data) { _Instance = this; ((PassiveItem)this).MidGameDeserialize(data); int num = 0; noPastRegrets = (bool)data[num++]; scrambledBulletHell = (bool)data[num++]; btcktfEnemyGuid = (string)data[num++]; for (int i = 0; i < 1; i++) { _ = GameManager.Instance.AllPlayers[i]; int num2 = (int)data[num++]; glassGunIds[i] = new List(); for (int j = 0; j < num2; j++) { glassGunIds[i].Add((int)data[num++]); } int num3 = (int)data[num++]; pristineGunIds[i] = new List(); for (int k = 0; k < num3; k++) { pristineGunIds[i].Add((int)data[num++]); } } _Instance = this; _deserialized = true; } private void FinalizeDeserialization(PlayerController p1, PlayerController p2) { for (int i = 0; i < 1; i++) { PlayerController val = ((i == 0) ? p1 : p2); if (Object.op_Implicit((Object)(object)val)) { if (glassGunIds[i].Count > 0) { GlassAmmoBox.RestoreMidGameData(val); } if (pristineGunIds[i].Count > 0) { DisplayPedestal.RestoreMidGameData(val); } } } } [HarmonyPatch(typeof(MidGameSaveData), "LoadDataFromMidGameSave")] [HarmonyPostfix] private static void MidGameSaveDataLoadDataFromMidGameSavePatch(MidGameSaveData __instance, PlayerController p1, PlayerController p2) { MidGameSaveData.IsInitializingPlayerData = true; Instance.FinalizeDeserialization(p1, p2); MidGameSaveData.IsInitializingPlayerData = false; } } [HarmonyPatch] public static class CameraOverrideController { private static GameObject _CameraOwner; private static Action _OnRelinquishedCameraControl; public static bool HasControlOverCamera(this GameObject obj) { return (Object)(object)obj == (Object)(object)_CameraOwner; } public static bool RequestCameraControl(this GameObject obj, bool lerp = true, Action relinquishAction = null) { if ((Object)(object)_CameraOwner != (Object)null || GameManager.Instance.MainCameraController.ManualControl) { return false; } GameManager.Instance.MainCameraController.SetManualControl(true, lerp); _CameraOwner = obj; _OnRelinquishedCameraControl = null; if (relinquishAction != null) { _OnRelinquishedCameraControl = (Action)Delegate.Combine(_OnRelinquishedCameraControl, relinquishAction); } return true; } public static bool RelinquishCameraControl(this GameObject obj, bool lerp = true) { if ((Object)(object)obj != (Object)(object)_CameraOwner) { return false; } if (_OnRelinquishedCameraControl != null) { _OnRelinquishedCameraControl(); } _OnRelinquishedCameraControl = null; _CameraOwner = null; GameManager.Instance.MainCameraController.SetManualControl(false, lerp); return true; } [HarmonyPatch(typeof(CameraController), "SetManualControl")] [HarmonyPrefix] private static void CameraControllerSetManualControlPatch(CameraController __instance, bool manualControl, bool shouldLerp) { if (manualControl && Object.op_Implicit((Object)(object)_CameraOwner)) { _CameraOwner.RelinquishCameraControl(); } } } public static class CwaffTweaks { [HarmonyPatch(typeof(Chest), "ConfigureOnPlacement")] private class ChestConfigureLiesOnPlacementPatch { private const float _SPECIAL_LIES_CHANCE = 0.25f; private static void Postfix(Chest __instance) { if (__instance.overrideJunkId == 148 && !(Random.value > 0.25f)) { if (PlayerStats.GetTotalCurse() == 0) { __instance.overrideJunkId = JammedLies._PickupId; } else { __instance.overrideJunkId = TheCake._PickupId; } } } } public class TheCake : CwaffPassive { public static string ItemName = "The Cake"; public static string ShortDescription = "Black Mesa Forest"; public static string LongDescription = "A tasty looking cake. For some reason, you want it gone and out of your sight."; public static string Lore = ""; internal static int _PickupId; public static void Init() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore, hideFromAmmonomicon: true); ((PickupObject)obj).quality = (ItemQuality)(-50); ((PickupObject)obj).ShouldBeExcludedFromShops = true; _PickupId = ((PickupObject)obj).PickupObjectId; } } public class JammedLies : CwaffPassive { [HarmonyPatch(/*Could not decode attribute arguments.*/)] private class SellJammedLiesPatch { [HarmonyILManipulator] private static void SellJammedLiesIL(ILContext il, MethodBase original) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_00a4: 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) ILCursor val = new ILCursor(il); Type ot = original.DeclaringType; string sellPriceFieldName = ot.GetEnumeratorFieldName("sellPrice"); if (val.TryGotoNext((MoveType)2, new Func[2] { (Instruction instr) => ILPatternMatchingExt.MatchLdcI4(instr, 3), (Instruction instr) => ILPatternMatchingExt.MatchStfld(instr, ot, sellPriceFieldName) }) && val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdfld(instr, ot, sellPriceFieldName) })) { ot.GetField(sellPriceFieldName, BindingFlags.Instance | BindingFlags.NonPublic); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldfld, ot.GetField("targetItem", BindingFlags.Instance | BindingFlags.NonPublic)); val.CallPrivate(typeof(SellJammedLiesPatch), "AdjustPrice"); } } private static int AdjustPrice(int oldPrice, PickupObject p) { if (p is JammedLies) { return 666; } return oldPrice; } } public static string ItemName = "Jammed Lies"; public static string ShortDescription = "There Won't Be a Next Time"; public static string LongDescription = "You get the feeling you should probably dispose of this at your earliest convenience."; public static string Lore = ""; internal static int _PickupId; public static void Init() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) PassiveItem val = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore, hideFromAmmonomicon: true); ((PickupObject)val).quality = (ItemQuality)(-50); ((PickupObject)val).ShouldBeExcludedFromShops = true; val.passiveStatModifiers = (StatModifier[])(object)new StatModifier[1] { ((StatType)14).Add(5f) }; _PickupId = ((PickupObject)val).PickupObjectId; } } public class DirtBlock : CwaffPassive { [HarmonyPatch] private class GunPickupPatch { [HarmonyPatch(typeof(Gun), "Pickup")] private static void Postfix(Gun __instance, PlayerController player) { if (Random.value < 0.0003f) { player.AcquireSilently(Lazy.PickupId()); } } } public static string ItemName = "Dirt Block"; public static string ShortDescription = "Grass Included!"; public static string LongDescription = "A cubic meter of dirt with grass on top. You're not quite sure where you got it."; public static string Lore = ""; private const float _CHANCE_TO_DIRT = 0.0003f; public static void Init() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) PassiveItem obj = Lazy.SetupPassive(ItemName, ShortDescription, LongDescription, Lore, hideFromAmmonomicon: true); ((PickupObject)obj).quality = (ItemQuality)(-50); ((PickupObject)obj).ShouldBeExcludedFromShops = true; ((PickupObject)obj).CanBeSold = false; obj.passiveStatModifiers = (StatModifier[])(object)new StatModifier[1] { ((StatType)4).Add(float.Epsilon) }; } } [HarmonyPatch] private static class FoyerPreloaderAwakePatcher { [HarmonyPatch(typeof(FoyerPreloader), "Awake")] [HarmonyPostfix] private static void FoyerPreloaderAwakePatch(FoyerPreloader __instance) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (Random.value <= 0.001f) { ReplaceLoadingScreenAnimation(__instance, "hdgwombus", new Vector2(32f, 32f)); } } private static void ReplaceLoadingScreenAnimation(FoyerPreloader loader, string anim, Vector2 size) { //IL_004e: 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_00c2: Unknown result type (might be due to invalid IL or missing references) dfSprite throbber = loader.Throbber; loader.Throbber = Object.Instantiate(((Component)loader.Throbber).gameObject).GetComponent(); ((Component)loader.Throbber).gameObject.transform.parent = ((Component)throbber).gameObject.transform.parent; ((dfControl)loader.Throbber).Position = ((dfControl)throbber).Position; ((dfControl)throbber).IsVisible = false; List list = ResMap.Get(anim).Base(); loader.Throbber.SpriteName = list[0]; ((dfControl)loader.Throbber).Size = size; loader.Throbber.Atlas = CwaffCharacter.UIAtlas; dfAnimationClip obj = (((Component)loader.Throbber).gameObject.GetComponent().clip = new GameObject("temp_loading_anim_clip", new Type[1] { typeof(dfAnimationClip) }).GetComponent()); obj.atlas = CwaffCharacter.UIAtlas; obj.sprites = list; } } public static void Init() { ((Component)Items.Wolf.AsPassive()).gameObject.GetComponent().MakePettable(ResMap.Get("wolf_pet"), ResMap.Get("wolf_pet_left")); JammedLies.Init(); TheCake.Init(); DirtBlock.Init(); } private static DirectionalAnimation GetDogPettingAnimation() { return ((BraveBehaviour)EnemyDatabase.GetOrLoadByGuid(((Component)ItemHelper.Get(Items.Dog)).GetComponent().CompanionGuid)).aiAnimator.OtherAnimations.Find((NamedDirectionalAnimation n) => n.name == "pet").anim; } public static void MakePettable(this CompanionItem ci, List pettingAnimation = null, List pettingAnimationLeft = null) { //IL_0032: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) CompanionController orAddComponent = GameObjectExtensions.GetOrAddComponent(((Component)EnemyDatabase.GetOrLoadByGuid(ci.CompanionGuid)).gameObject); orAddComponent.CanBePet = true; if (pettingAnimation != null) { tk2dSpriteCollectionData collection = ((BraveBehaviour)orAddComponent).sprite.Collection; List list = AtlasHelper.AddSpritesToCollection(pettingAnimation, collection, copyMaterialSettings: true).AsRange(); SpriteBuilder.AddAnimation(((BraveBehaviour)((BraveBehaviour)orAddComponent).sprite).spriteAnimator, collection, list, "pet_right", (WrapMode)0, 15f).fps = 8f; List list2 = AtlasHelper.AddSpritesToCollection(pettingAnimationLeft, collection, copyMaterialSettings: true).AsRange(); SpriteBuilder.AddAnimation(((BraveBehaviour)((BraveBehaviour)orAddComponent).sprite).spriteAnimator, collection, list2, "pet_left", (WrapMode)0, 15f).fps = 8f; NamedDirectionalAnimation val = new NamedDirectionalAnimation(); val.name = "pet"; DirectionalAnimation val2 = new DirectionalAnimation(); val2.Prefix = "pet"; val2.Type = (DirectionType)2; val2.Flipped = (FlipType[])(object)new FlipType[2]; val2.AnimNames = new string[2] { "pet_right", "pet_left" }; val.anim = val2; NamedDirectionalAnimation item = val; AIAnimator aiAnimator = ((BraveBehaviour)((BraveBehaviour)orAddComponent).sprite).aiAnimator; if (aiAnimator.OtherAnimations == null) { aiAnimator.OtherAnimations = new List(); } ((BraveBehaviour)((BraveBehaviour)orAddComponent).sprite).aiAnimator.OtherAnimations.Add(item); } } } public static class EasyLabel { private static int _LastCamFrameCount; private static Matrix4x4 _ConversionMatrix; public static dfLabel Create(bool unicode = true, bool outline = false, TextAlignment align = (TextAlignment)1) { //IL_0068: 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_007d: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Invalid comparison between Unknown and I4 //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) dfLabel component = Object.Instantiate(((Component)GameUIRoot.Instance.p_needsReloadLabel).gameObject, ((BraveBehaviour)GameUIRoot.Instance).transform).GetComponent(); if (unicode) { ? val = component; Object obj = ResourceCache.Acquire("Alternate Fonts/JackeyFont12_DF"); ((dfLabel)val).Font = (dfFontBase)(object)((GameObject)((obj is GameObject) ? obj : null)).GetComponent(); ? val2 = component; dfFontBase font = component.Font; ((dfLabel)val2).Atlas = ((dfFont)((font is dfFont) ? font : null)).Atlas; component.TextScale = 2f; } ((Component)component).transform.localScale = Vector3.one / GameUIRoot.GameUIScalar; component.TextAlignment = align; if ((int)align == 0) { ((dfControl)component).Pivot = (dfPivotPoint)6; } else if ((int)align == 2) { ((dfControl)component).Pivot = (dfPivotPoint)8; } else { ((dfControl)component).Pivot = (dfPivotPoint)7; } component.VerticalAlignment = (dfVerticalAlignment)1; ((dfControl)component).Opacity = 1f; component.Text = string.Empty; ((Component)component).gameObject.SetActive(true); ((dfControl)component).IsVisible = true; component.ProcessMarkup = true; ((dfControl)component).Color = Color32.op_Implicit(Color.white); component.WordWrap = true; if (outline) { component.Outline = true; component.OutlineSize = 4; component.OutlineColor = Color32.op_Implicit(Color.black); } ((Component)component).gameObject.AddComponent(); return component; } public static void Place(this dfLabel label, Vector2 pos, float rot = 0f, bool useScreenSpace = 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) //IL_004d: 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_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_006d: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_013d: 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_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0172: 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_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: 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_00fe: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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_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_012d: Unknown result type (might be due to invalid IL or missing references) rot = BraveMathCollege.ClampAngle180(rot); Vector2 val = pos; float num = Pixelator.Instance.ScaleTileScale / Pixelator.Instance.CurrentTileScale; float num2 = ((dfControl)label).PixelsToUnits() / num; if (Mathf.Abs(rot) > 90f) { float num3 = num / 64f; rot = BraveMathCollege.ClampAngle180(rot + 180f); val += BraveMathCollege.DegreesToVector(rot - 90f, ((dfControl)label).Size.y * num3); } CameraController mainCameraController = GameManager.Instance.MainCameraController; if (useScreenSpace) { ((Vector2)(ref val))..ctor(Mathf.Lerp(mainCameraController.m_cachedMinPos.x, mainCameraController.m_cachedMaxPos.x, val.x), Mathf.Lerp(mainCameraController.m_cachedMinPos.y, mainCameraController.m_cachedMaxPos.y, val.y)); } int frameCount = Time.frameCount; if (_LastCamFrameCount != frameCount) { _LastCamFrameCount = frameCount; Camera camera = mainCameraController.Camera; Camera renderCamera = GameUIRoot.Instance.m_manager.RenderCamera; Matrix4x4 val2 = camera.projectionMatrix * camera.worldToCameraMatrix; Matrix4x4 val3 = renderCamera.projectionMatrix * renderCamera.worldToCameraMatrix; _ConversionMatrix = ((Matrix4x4)(ref val3)).inverse * val2; } Vector4 val4 = _ConversionMatrix * new Vector4(val.x, val.y, 0f, 1f); ((Component)label).transform.position = dfVectorExtensions.QuantizeFloor(new Vector3(val4.x, val4.y, 0f), num2); ((Component)label).transform.localRotation = Quaternion.Euler(0f, 0f, rot); ((dfControl)label).IsVisible = true; LabelExt component = ((Component)label).gameObject.GetComponent(); component.lastPos = pos; component.lastRot = rot; } public static void Disable(this dfLabel label) { ((dfControl)label).IsVisible = false; } } public class LabelExt : MonoBehaviour { public Vector2 lastPos; public float lastRot; } public class CwaffRopeMesh : MonoBehaviour { private const float UPDATE_RATE = 1f / 60f; private const float SEGLENGTH = 0.25f; private static readonly FieldInfo _PointsBackingArray = typeof(List).GetField("_items", BindingFlags.Instance | BindingFlags.NonPublic); public tk2dSpriteAnimationClip animation; public Vector2 startPos; public Vector2 endPos; public bool locked; public bool animateWhileLocked; public tk2dTiledSprite sprite; private List _ropePrevPoints; private List _ropePoints; private Vector2[] _ropePrevPointsBacking; private Vector2[] _ropePointsBacking; private float _segLength; private float _updateTimer; private RopeSim.StretchPolicy _stretchPolicy; private float _softMaxRopeLength; private int _numSegments; private float _lockThreshold; private CwaffBoneManager _boneManager; private int _cachedCapacity = -1; public static CwaffRopeMesh Create(tk2dSpriteAnimationClip animation, Vector2 startPos, Vector2 endPos, int numSegments, string name = null, RopeSim.StretchPolicy stretchPolicy = RopeSim.StretchPolicy.STRETCH) { //IL_001e: 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_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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_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_00c0: 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_00d5: 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_00d9: 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) CwaffRopeMesh component = new GameObject(name ?? "new CwaffRopeMesh", new Type[1] { typeof(CwaffRopeMesh) }).GetComponent(); component.animation = animation; component.startPos = startPos; component.endPos = endPos; component._boneManager = ((Component)component).gameObject.AddComponent(); component._boneManager.Setup(animation); component.sprite = ((Component)component).GetComponent(); component._segLength = 0.25f; component._ropePrevPoints = new List(); component._ropePoints = new List(); component._stretchPolicy = stretchPolicy; component._numSegments = numSegments; Vector2 val = 1f / (float)numSegments * (endPos - startPos); for (int i = 0; i <= numSegments; i++) { component._ropePrevPoints.Add(startPos + (float)i * val); component._ropePoints.Add(startPos + (float)i * val); } component._softMaxRopeLength = 0.25f * (float)numSegments; component.locked = false; component.animateWhileLocked = false; component._lockThreshold = 0f; component._updateTimer = 0f; return component; } public void LockWhenStationary(float threshold = 0.01f, bool keepAnimating = false) { _lockThreshold = threshold * threshold; animateWhileLocked = keepAnimating; } public void ResetToPosition(Vector2 pos) { //IL_001e: 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_0026: Unknown result type (might be due to invalid IL or missing references) for (int num = _ropePoints.Count - 1; num >= 0; num--) { List ropePoints = _ropePoints; int index = num; Vector2 value = (_ropePrevPoints[num] = pos); ropePoints[index] = value; } _boneManager.ReplaceBones(_ropePoints); _boneManager.RecomputeNormals(); } private void Update() { if (!locked) { _boneManager.UpdateTimers(); _updateTimer += BraveTime.DeltaTime; if (!(_updateTimer < 1f / 60f)) { _updateTimer -= 1f / 60f; UpdateRope(); } } } private void LateUpdate() { if (!locked) { _boneManager.ManualLateUpdate(); } else if (animateWhileLocked) { _boneManager.UpdateAnimations(); } } private void UpdateRope() { //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_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_0037: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: 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_0058: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: 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_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_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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_0149: 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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: 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_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_0168: Unknown result type (might be due to invalid IL or missing references) Vector2 val = startPos; Vector2 val2 = endPos; Vector2 val5; switch (_stretchPolicy) { case RopeSim.StretchPolicy.CLAMP: { Vector2 val6 = val2 - val; float magnitude = ((Vector2)(ref val6)).magnitude; if (magnitude - _softMaxRopeLength > 0f) { val2 = val + val6 / magnitude * _softMaxRopeLength; } break; } case RopeSim.StretchPolicy.GROWTEMPORARY: case RopeSim.StretchPolicy.GROWPERMANENT: { Vector2 val3 = val2 - val; float num = ((Vector2)(ref val3)).magnitude - _softMaxRopeLength; int num2 = Mathf.Max(0, Mathf.CeilToInt(num / _segLength)); int num3 = _ropePoints.Count - (_numSegments + 1); if (num3 > num2 && _stretchPolicy != RopeSim.StretchPolicy.GROWPERMANENT) { int num4 = num3 - num2; _ropePoints.RemoveRange(_ropePoints.Count - num4, num4); _ropePrevPoints.RemoveRange(_ropePrevPoints.Count - num4, num4); } else { if (num3 >= num2) { break; } int num5 = num2 - num3; while (--num5 >= 0) { Vector2 item = endPos; if (num5 > 0) { Vector2 val4 = _ropePoints[_ropePoints.Count - 1]; float segLength = _segLength; val5 = endPos - val4; item = val4 + segLength * ((Vector2)(ref val5)).normalized; } _ropePoints.Add(item); _ropePrevPoints.Add(item); } } break; } } if (_cachedCapacity != _ropePoints.Capacity) { _ropePrevPointsBacking = (Vector2[])_PointsBackingArray.GetValue(_ropePrevPoints); _ropePointsBacking = (Vector2[])_PointsBackingArray.GetValue(_ropePoints); _cachedCapacity = _ropePoints.Capacity; } RopeSim.SimulateRope(val, val2, _ropePointsBacking, _ropePrevPointsBacking, _ropePoints.Count, _segLength); _boneManager.ReplaceBones(_ropePoints); _boneManager.RecomputeNormals(); if (_lockThreshold <= 0f) { return; } for (int num6 = _ropePoints.Count - 1; num6 >= 0; num6--) { val5 = _ropePoints[num6] - _ropePrevPoints[num6]; if (((Vector2)(ref val5)).sqrMagnitude > _lockThreshold) { return; } } locked = true; } } public static class RopeSim { public enum StretchPolicy { STRETCH, CLAMP, GROWTEMPORARY, GROWPERMANENT } private const int DEFAULT_VERLET_ITERATIONS = 25; private const float DEFAULT_DAMPING = 0.98f; private const float DEFAULT_GRAVITY_X = 0f; private const float DEFAULT_GRAVITY_Y = -1.5f; public unsafe static void SimulateRope(Vector2 start, Vector2 end, Vector2[] pointsArray, Vector2[] prevPointsArray, int numPoints, float segLength = 100f, float deltaTime = 1f / 60f, int verletIters = 25, float damping = 0.98f, float gravX = 0f, float gravY = -1.5f) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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) int num = numPoints - 1; int num2 = num - 1; float num3 = segLength * segLength; float num4 = segLength + 0.01f; float num5 = num4 * num4; float num6 = deltaTime * deltaTime; float num7 = num6 * gravX; float num8 = num6 * gravY; fixed (Vector2* ptr = pointsArray) { fixed (Vector2* ptr2 = prevPointsArray) { ((Vector2)ptr).x = (((Vector2)ptr2).x = start.x); ((Vector2)ptr).y = (((Vector2)ptr2).y = start.y); Vector2* ptr3 = (Vector2*)((byte*)ptr + (nint)num * (nint)Unsafe.SizeOf()); Vector2* ptr4 = (Vector2*)((byte*)ptr2 + (nint)num * (nint)Unsafe.SizeOf()); ((Vector2)ptr3).x = (((Vector2)ptr4).x = end.x); ((Vector2)ptr3).y = (((Vector2)ptr4).y = end.y); for (int i = 1; i < num; i++) { ptr3 = (Vector2*)((byte*)ptr + (nint)i * (nint)Unsafe.SizeOf()); ptr4 = (Vector2*)((byte*)ptr2 + (nint)i * (nint)Unsafe.SizeOf()); float num9 = (((Vector2)ptr3).x - ((Vector2)ptr4).x) * damping; float num10 = (((Vector2)ptr3).y - ((Vector2)ptr4).y) * damping; Unsafe.Write(ptr4, *ptr3); ((Vector2)ptr3).x += num9 + num7; ((Vector2)ptr3).y += num10 + num8; } for (int j = 0; j != verletIters; j++) { bool flag = true; ptr4 = ptr; ptr3 = (Vector2*)((byte*)ptr + Unsafe.SizeOf()); float num11 = ((Vector2)ptr3).x - ((Vector2)ptr4).x; float num12 = ((Vector2)ptr3).y - ((Vector2)ptr4).y; float num13 = num11 * num11 + num12 * num12; if (num13 > num3) { float num14 = 1f - segLength / Mathf.Sqrt(num13); ((Vector2)ptr3).x -= num14 * num11; ((Vector2)ptr3).y -= num14 * num12; } for (int k = 1; k != num2; k++) { ptr4 = ptr3; ptr3 = (Vector2*)((byte*)ptr3 + Unsafe.SizeOf()); num11 = ((Vector2)ptr3).x - ((Vector2)ptr4).x; num12 = ((Vector2)ptr3).y - ((Vector2)ptr4).y; num13 = num11 * num11 + num12 * num12; if (num13 > num3) { if (num13 > num5) { flag = false; } float num14 = 0.5f * (1f - segLength / Mathf.Sqrt(num13)); float num15 = num14 * num11; float num16 = num14 * num12; ((Vector2)ptr4).x += num15; ((Vector2)ptr4).y += num16; ((Vector2)ptr3).x -= num15; ((Vector2)ptr3).y -= num16; } } ptr4 = ptr3; ptr3 = (Vector2*)((byte*)ptr3 + Unsafe.SizeOf()); num11 = ((Vector2)ptr3).x - ((Vector2)ptr4).x; num12 = ((Vector2)ptr3).y - ((Vector2)ptr4).y; num13 = num11 * num11 + num12 * num12; if (num13 > num3) { float num14 = 1f - segLength / Mathf.Sqrt(num13); ((Vector2)ptr4).x += num14 * num11; ((Vector2)ptr4).y += num14 * num12; } if (flag) { return; } } } } } } public static class CwaffSynergies { [HarmonyPatch(typeof(PlayerStats), "RecalculateSynergies")] private class RecalculateMasteriesPatch { [HarmonyILManipulator] private static void RecalculateMasteriesIL(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) //IL_0046: 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_007b: 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.MatchCallvirt(instr, "RebuildSynergies") })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg_1); val.CallPrivate(typeof(RecalculateMasteriesPatch), "CheckForNewMasteries"); ILLabel val2 = val.DefineLabel(); val.Emit(OpCodes.Brfalse, (object)val2); val.Emit(OpCodes.Ret); val.MarkLabel(val2); } } private static bool CheckForNewMasteries(PlayerStats stats, PlayerController owner) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 //IL_00c9: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < owner.ActiveExtraSynergies.Count; i++) { int num = owner.ActiveExtraSynergies[i]; if (!GameManager.Instance.SynergyManager.synergies[num].SuppressVFX && (int)GameManager.Instance.SynergyManager.synergies[num].ActivationStatus != 2 && !stats.PreviouslyActiveSynergies.Contains(num)) { AdvancedSynergyEntry val = GameManager.Instance.SynergyManager.synergies[num]; if (val.MandatoryItemIDs != null && val.MandatoryItemIDs.Count != 0 && _MasteryIds.Contains(val.MandatoryItemIDs[0])) { ((Component)owner).gameObject.Play("the_sound_of_mastering_a_weapon"); ((GameActor)owner).PlayEffectOnActor(_MasteryVFX, new Vector3(0f, 0.5f, 0f), true, false, false); GameStatsManager.Instance.HandleEncounteredSynergy(num); stats.PreviouslyActiveSynergies.Clear(); stats.PreviouslyActiveSynergies.AddRange(owner.ActiveExtraSynergies); return true; } } } return false; } } private static int _NUM_SYNERGIES = Enum.GetNames(typeof(Synergy)).Length; public static List _Synergies = Enumerable.Repeat((CustomSynergyType)0, _NUM_SYNERGIES).ToList(); public static List _SynergyNames = Enumerable.Repeat(null, _NUM_SYNERGIES).ToList(); public static List _SynergyEnums = new List(Enum.GetNames(typeof(Synergy))); public static List _SynergyIds = Enumerable.Repeat(0, _NUM_SYNERGIES).ToList(); public static HashSet _MasteryIds = new HashSet(); public static Dictionary _MasteryGuns = new Dictionary(); internal static GameObject _MasteryVFX = null; public static void InitEnums() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < _SynergyNames.Count; i++) { _Synergies[i] = _SynergyEnums[i].ExtendEnum("cg"); } } public static void Init() { //IL_12da: Unknown result type (might be due to invalid IL or missing references) NewSynergy(CwaffingTheGungy.Synergy.HYPE_YOURSELF_UP, "Hype Yourself Up", new string[2] { IName(DriftersHeadgear.ItemName), "hyper_light_blaster" }); NewSynergy(CwaffingTheGungy.Synergy.ELECTRIC_SLIDE, "Electric Slide", new string[2] { IName(Alligator.ItemName), IName(ComfySlippers.ItemName) }); NewSynergy(CwaffingTheGungy.Synergy.DEUS_EX_MACHINA, "Deus Ex Machina", new string[2] { IName(ChekhovsGun.ItemName), IName(PlotArmor.ItemName) }); NewSynergy(CwaffingTheGungy.Synergy.SOLAR_FLAIR, "Solar Flair", new string[2] { IName(Suncaster.ItemName), "sunlight_javelin" }); NewSynergy(CwaffingTheGungy.Synergy.PROJECTING_MUCH, "Projecting, Much?", new string[2] { IName(FourDBullets.ItemName), IName(AstralProjector.ItemName) }); NewSynergy(CwaffingTheGungy.Synergy.LOTUS_LAND_STORY, "Lotus Land Story", new string[2] { IName(AimuHakurei.ItemName), "laser_lotus" }); NewSynergy(CwaffingTheGungy.Synergy.BLANK_STARE, "Blank Stare", new string[2] { IName(GorgunEye.ItemName), IName(BlankChecks.ItemName) }); NewSynergy(CwaffingTheGungy.Synergy.DUBBLE_BUBBLE, "Dubble Bubble", new string[2] { IName(BubbleWand.ItemName), "bubble_blaster" }); NewSynergy(CwaffingTheGungy.Synergy.SOUL_SEARCHING, "Soul Searching", new string[2] { IName(Uppskeruvel.ItemName), "gun_soul" }); NewSynergy(CwaffingTheGungy.Synergy.CLEANUP_CREW, "Cleanup Crew", new string[2] { IName(VacuumCleaner.ItemName), IName(CustodiansBadge.ItemName) }); NewSynergy(CwaffingTheGungy.Synergy.SCAVENGEST, "Scavengest", new string[2] { IName(VacuumCleaner.ItemName), IName(ScavengingArms.ItemName) }); NewSynergy(CwaffingTheGungy.Synergy.DEATH_AND_TAXES, "Death and Taxes", new string[2] { IName(CreditCard.ItemName), IName(BlankChecks.ItemName) }); NewSynergy(CwaffingTheGungy.Synergy.DEAD_MAN_STANDING, "Dead Man Standing", new string[2] { IName(DeadRinger.ItemName), "decoy" }); NewSynergy(CwaffingTheGungy.Synergy.DEAD_MAN_EXPANDING, "Dead Man Expanding", new string[2] { IName(DeadRinger.ItemName), "explosive_decoy" }); NewSynergy(CwaffingTheGungy.Synergy.AIM_BOTS, "Aim Bots", new string[2] { IName(BionicFinger.ItemName), "nanomachines" }); NewSynergy(CwaffingTheGungy.Synergy.WICKED_CHILD, "Wicked Child", new string[2] { IName(PistolWhip.ItemName), IName(HolyWaterGun.ItemName) }); NewSynergy(CwaffingTheGungy.Synergy.I_NEED_A_HERO, "I Need a Hero", new string[2] { IName(SubMachineGun.ItemName), "heroine" }); NewSynergy(CwaffingTheGungy.Synergy.KEYGEN, "Keygen", new string[2] { IName(Femtobyte.ItemName), "master_of_unlocking" }); NewSynergy(CwaffingTheGungy.Synergy.COMMON_TIME, "Common Time", new string[2] { IName(Maestro.ItemName), "metronome" }).MultFireRate(1.5f); NewSynergy(CwaffingTheGungy.Synergy.TALON_TROT, "Talon Trot", new string[2] { IName(Breegull.ItemName), "backpack" }).MultMoveSpeed(1.25f); NewSynergy(CwaffingTheGungy.Synergy.BLASTECH_A1, "BlasTech A-1", new string[2] { IName(BlasTechF4.ItemName), "laser_sight" }); NewSynergy(CwaffingTheGungy.Synergy.PIT_BOSS, "Pit Boss", new string[2] { IName(Blackjack.ItemName), "amulet_of_the_pit_lord" }); NewSynergy(CwaffingTheGungy.Synergy.PARTICLE_ACCELERATOR_ACCELERATOR, "Particle Accelerator Accelerator", new string[2] { IName(KALI.ItemName), "singularity" }).MultChargeRate(4f); NewSynergy(CwaffingTheGungy.Synergy.MR_ALLIGATOX, "Mr. Alligatox", new string[2] { IName(Alligator.ItemName), "stuffed_star" }); NewSynergy(CwaffingTheGungy.Synergy.ADRENALINE_RUSH, "Adrenaline Rush", new string[2] { IName(AdrenalineShot.ItemName), "shotgun_coffee" }); NewSynergy(CwaffingTheGungy.Synergy.BANK_SHOTS, "Bank Shots", new string[2] { IName(English.ItemName), "loot_bag" }); NewSynergy(CwaffingTheGungy.Synergy.BIONIC_COMMANDO, "Bionic Commando", new string[2] { IName(BionicFinger.ItemName), "grappling_hook" }); NewSynergy(CwaffingTheGungy.Synergy.BLANK_EXPRESSION, "Blank Expression", new string[2] { IName(BlankChecks.ItemName), "disarming_personality" }); NewSynergy(CwaffingTheGungy.Synergy.LOOKUP_TABLE, "Lookup Table", new string[2] { IName(Femtobyte.ItemName), "portable_table_device" }); NewSynergy(CwaffingTheGungy.Synergy.TROLLEY_PROBLEM, "Trolley Problem", new string[2] { IName(DerailGun.ItemName), "turtle_problem" }); NewSynergy(CwaffingTheGungy.Synergy.DRAW_FIRE, "Draw Fire", new string[2] { IName(Ticonderogun.ItemName), "hot_lead" }); NewSynergy(CwaffingTheGungy.Synergy.PIERCING_GAZE, "Piercing Gaze", new string[2] { IName(GorgunEye.ItemName), "ghost_bullets" }); NewSynergy(CwaffingTheGungy.Synergy.CHEATO_PAGE, "Cheato Page", new string[2] { IName(Breegull.ItemName), "book_of_chest_anatomy" }); NewSynergy(CwaffingTheGungy.Synergy.PHOTOSYNTHESIS, "Photosynthesis", new string[2] { IName(Gunflower.ItemName), "camera" }); NewSynergy(CwaffingTheGungy.Synergy.TANK_ENGINE, "Tank Engine", new string[2] { IName(DerailGun.ItemName), "alien_engine" }); NewSynergy(CwaffingTheGungy.Synergy.DEMOLITION_MAN, "Demolition, Man!", new string[2] { IName(VolcanicAmmolet.ItemName), IName(Scotsman.ItemName) }); NewSynergy(CwaffingTheGungy.Synergy.SAIYAN_PRIDE, "Saiyan Pride", new string[2] { IName(WarriorsGi.ItemName), IName(KiBlast.ItemName) }); NewSynergy(CwaffingTheGungy.Synergy.LAWN_CARE, "Lawn Care", new string[2] { IName(Flakseed.ItemName), "starpew" }); NewSynergy(CwaffingTheGungy.Synergy.THE_ABYSS_STARES_BACK, "The Abyss Stares Back", new string[2] { IName(RingOfDefenestration.ItemName), "amulet_of_the_pit_lord" }); NewSynergy(CwaffingTheGungy.Synergy.FURNITURE_POLISH, "Furniture Polish", new string[2] { IName(BulletproofTablecloth.ItemName), "potion_of_lead_skin" }); NewSynergy(CwaffingTheGungy.Synergy.LEAD_PAINT, "Lead Paint", new string[2] { IName(PaintballCannon.ItemName), "potion_of_lead_skin" }); NewSynergy(CwaffingTheGungy.Synergy.COZY_CAMPER, "Cozy Camper", new string[2] { IName(CampingSupplies.ItemName), IName(ComfySlippers.ItemName) }); NewSynergy(CwaffingTheGungy.Synergy.TREASURE_HUNTER, "Treasure Hunter", new string[2] { IName(Itemfinder.ItemName), "sense_of_direction" }); NewSynergy(CwaffingTheGungy.Synergy.SOLID_FOOTING, "Solid Footing", new string[2] { IName(Jugglernaut.ItemName), "heavy_boots" }); NewSynergy(CwaffingTheGungy.Synergy.YOU_MAY_USE_A_CALCULATOR, "You May Use a Calculator", new string[2] { IName(Sextant.ItemName), IName(Calculator.ItemName) }); NewSynergy(CwaffingTheGungy.Synergy.STRAGGLER, "Straggler", new string[2] { IName(Wayfarer.ItemName), "gas_mask" }); NewSynergy(CwaffingTheGungy.Synergy.TRAILBLAZER, "Trailblazer", new string[2] { IName(Wayfarer.ItemName), "ring_of_fire_resistance" }); NewSynergy(CwaffingTheGungy.Synergy.STAY_HUNGRY, "Stay Hungry", new string[2] { IName(Hallaeribut.ItemName), "hungry_bullets" }); NewSynergy(CwaffingTheGungy.Synergy.SEGALS_LAW, "Segal's Law", new string[2] { IName(DeadRinger.ItemName), "super_hot_watch" }); NewSynergy(CwaffingTheGungy.Synergy.SPAWNPROOFING, "Spawnproofing", new string[2] { IName(AmethystShard.ItemName), IName(StackOfTorches.ItemName) }); NewSynergy(CwaffingTheGungy.Synergy.CAFFEINE_ADDICTION, "Caffeine Addiction", new string[2] { IName(MacchiAuto.ItemName), IName(Cuppajoe.ItemName) }); NewSynergy(CwaffingTheGungy.Synergy.KALIBERS_FAVOR, "Kaliber's Favor", new string[2] { IName(KalibersJustice.ItemName), "seven_leaf_clover" }); NewSynergy(CwaffingTheGungy.Synergy.GAMER_REFLEXES, "Gamer Reflexes", new string[2] { IName(TryhardSnacks.ItemName), "3rd_party_controller" }); NewSynergy(CwaffingTheGungy.Synergy.AHEAD_OF_SCHEDULE, "Ahead of Schedule", new string[2] { IName(DerailGun.ItemName), "sense_of_direction" }).MultReload(0.65f); NewSynergy(CwaffingTheGungy.Synergy.WRONG_KIND_OF_COMPASS, "Wrong Kind of Compass", new string[2] { IName(Sextant.ItemName), "sense_of_direction" }).MultReload(0.3f); NewSynergy(CwaffingTheGungy.Synergy.JOB_SECURITY, "Job Security", new string[2] { IName(CustodiansBadge.ItemName), IName(RatPoison.ItemName) }); NewSynergy(CwaffingTheGungy.Synergy.FULL_CIRCULATION, "Full Circulation", new string[2] { IName(VacuumCleaner.ItemName), IName(Leafblower.ItemName) }); NewSynergy(CwaffingTheGungy.Synergy.GLUED_BACK_TOGETHER_IN_HELL, "Glued Back Together in Hell", new string[2] { IName(DemolitionContract.ItemName), IName(Scotsman.ItemName) }); NewSynergy(CwaffingTheGungy.Synergy.COMBUST_LITERALLY_EVERYTHING, "Combust Literally Everything", new string[2] { IName(ScaldingJelly.ItemName), "molotov_launcher" }); NewSynergy(CwaffingTheGungy.Synergy.SUNKEN_EYE, "Sunken Eye", new string[2] { IName(GorgunEye.ItemName), IName(BottledAbyss.ItemName) }); NewSynergy(CwaffingTheGungy.Synergy.BULLETPROOF_GLASS, "Bulletproof Glass", new string[2] { IName(GlassAmmoBox.ItemName), "glass_cannon" }); NewSynergy(CwaffingTheGungy.Synergy.CHEST_BATTLE_ADVANCED, "Chest Battle Advanced", new string[2] { IName(Grandmaster.ItemName), "book_of_chest_anatomy" }); NewSynergy(CwaffingTheGungy.Synergy.TOXIC_LANGUAGE, "Toxic Language", new string[2] { IName(Ticonderogun.ItemName), "irradiated_lead" }); NewSynergy(CwaffingTheGungy.Synergy.PURPLE_PROSE, "Purple Prose", new string[2] { IName(Ticonderogun.ItemName), "charming_rounds" }); NewSynergy(CwaffingTheGungy.Synergy.PERFECTLY_BALANCED, "Perfectly Balanced", new string[2] { IName(Gyroscope.ItemName), IName(KalibersJustice.ItemName) }); NewSynergy(CwaffingTheGungy.Synergy.CHAIN_SMOKER, "Chain Smoker", new string[2] { IName(ChainDriver.ItemName), "cigarettes" }); NewSynergy(CwaffingTheGungy.Synergy.BAZOOKA_LAYLEE, "Bazooka Laylee", new string[2] { IName(Breegull.ItemName), "com4nd0" }); NewSynergy(CwaffingTheGungy.Synergy.GUN_SOHAN, "Gun Sohan", new string[2] { IName(WeightedRobes.ItemName), IName(WarriorsGi.ItemName) }); NewSynergy(CwaffingTheGungy.Synergy.CABLE_MANAGEMENT, "Cable Management", new string[2] { IName(Alligator.ItemName), IName(Nightlighter.ItemName) }); NewSynergy(CwaffingTheGungy.Synergy.BOARD_AND_CARD_GAME_NIGHT, "Board and Card Game Night", new string[2] { IName(Grandmaster.ItemName), IName(Blackjack.ItemName) }); NewSynergy(CwaffingTheGungy.Synergy.ILL_TAKE_A_POTATO_CHIP, "I'll Take a Potato Chip", new string[2] { IName(DeathNote.ItemName), IName(TryhardSnacks.ItemName) }); NewSynergy(CwaffingTheGungy.Synergy.BEDTIME_ROUTINE, "Bedtime Routine", new string[2] { IName(Toothpaste.ItemName), IName(ComfySlippers.ItemName) }); NewMastery(CwaffingTheGungy.Synergy.MASTERY_GRANDMASTER, Grandmaster.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_CHEKHOVS_GUN, ChekhovsGun.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_PINCUSHION, Pincushion.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_PLATINUM_STAR, PlatinumStar.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_NATASCHA, Natascha.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_HAND_CANNON, HandCannon.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_SCHRODINGERS_GAT, SchrodingersGat.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_HATCHLING_GUN, HatchlingGun.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_CRAPSHOOTER, Crapshooter.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_HOLY_WATER_GUN, HolyWaterGun.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_VACUUM_CLEANER, VacuumCleaner.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_PAINTBALL_CANNON, PaintballCannon.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_GUNBRELLA, Gunbrella.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_ALYX, Alyx.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_PISTOL_WHIP, PistolWhip.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_FEMTOBYTE, Femtobyte.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_UPPSKERUVEL, Uppskeruvel.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_BLACKJACK, Blackjack.ItemName).MultSpread(0.5f).MultClipSize(2f).MultFireRate(2f); NewMastery(CwaffingTheGungy.Synergy.MASTERY_ENGLISH, English.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_IRON_MAID, IronMaid.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_ALLIGATOR, Alligator.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_QUARTER_POUNDER, QuarterPounder.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_TICONDEROGUN, Ticonderogun.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_KINGS_LAW, KingsLaw.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_BUBBLEBEAM, Bubblebeam.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_DEADLINE, Deadline.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_STARMAGEDDON, Starmageddon.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_SUBTRACTOR_BEAM, SubtractorBeam.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_KALI, KALI.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_SCOTSMAN, Scotsman.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_CARPET_BOMBER, CarpetBomber.ItemName).MultChargeRate(4f).MultProjSpeed(2f); NewMastery(CwaffingTheGungy.Synergy.MASTERY_SOUL_KALIBER, SoulKaliber.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_LIGHTWING, Lightwing.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_MAGUNET, Magunet.ItemName).MultSpread(0.5f).MultProjSpeed(2f); NewMastery(CwaffingTheGungy.Synergy.MASTERY_DERAIL_GUN, DerailGun.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_ALIEN_NAILGUN, AlienNailgun.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_VLADIMIR, Vladimir.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_MAESTRO, Maestro.ItemName).MultFireRate(2f); NewMastery(CwaffingTheGungy.Synergy.MASTERY_KI_BLAST, KiBlast.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_HALLAERIBUT, Hallaeribut.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_GUNFLOWER, Gunflower.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_OMNIDIRECTIONAL_LASER, OmnidirectionalLaser.ItemName).MultDamage(1.5f); NewMastery(CwaffingTheGungy.Synergy.MASTERY_BLAMETHROWER, Blamethrower.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_ZAG, Zag.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_OUTBREAK, Outbreak.ItemName).MultProjSpeed(2f); NewMastery(CwaffingTheGungy.Synergy.MASTERY_TELEFRAGGER, Telefragger.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_TRANQUILIZER, Tranquilizer.ItemName).MultReload(0.5f); NewMastery(CwaffingTheGungy.Synergy.MASTERY_AIMU_HAKUREI, AimuHakurei.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_RACKET_LAUNCHER, RacketLauncher.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_JUGGLERNAUT, Jugglernaut.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_BLASTECH_F4, BlasTechF4.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_YGGDRASHELL, Yggdrashell.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_WIDOWMAKER, Widowmaker.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_ODDJOB, Oddjob.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_SUNDERBUSS, Sunderbuss.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_WAVEFRONT, Wavefront.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_BREEGULL, Breegull.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_OVERFLOW, Overflow.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_MISSILETOE, Missiletoe.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_MACCHI_AUTO, MacchiAuto.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_CHROMA, Chroma.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_FLAKSEED, Flakseed.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_RC_LAUNCHER, RCLauncher.ItemName).MultDamage(1.25f); NewMastery(CwaffingTheGungy.Synergy.MASTERY_B_B_GUN, BBGun.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_NYCTERIAN, Nycterian.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_SELTZER_PELTER, SeltzerPelter.ItemName).MultReload(0.65f); NewMastery(CwaffingTheGungy.Synergy.MASTERY_SUNCASTER, Suncaster.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_BOUNCER, Bouncer.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_SUB_MACHINE_GUN, SubMachineGun.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_STEREOSCOPE, Stereoscope.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_GROUNDHOG, Groundhog.ItemName).MultChargeRate(2f); NewMastery(CwaffingTheGungy.Synergy.MASTERY_GLOCKARINA, Glockarina.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_MACHEENING, Macheening.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_PLASMARBLE, Plasmarble.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_XELSIOR, Xelsior.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_EMPATH, Empath.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_SEXTANT, Sextant.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_LEAFBLOWER, Leafblower.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_WAYFARER, Wayfarer.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_FORKBOMB, Forkbomb.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_ZEALOT, Zealot.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_TOOTHPASTE, Toothpaste.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_GRADIUS, Gradius.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_HEARTBREAKER, Heartbreaker.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_CLEANSWEEP, Cleansweep.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_RETINA, Retina.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_ENTROPYNNIUM, Entropynnium.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_FLUX_FIST, FluxFist.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_CHAIN_DRIVER, ChainDriver.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_RLTSRTSGTSBTSLB, RLTSRTSGTSBTSLB.ItemName).MultReload(0.66f).MultAmmo(3f); NewMastery(CwaffingTheGungy.Synergy.MASTERY_PHOTON_CANNON, PhotonCannon.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_FUEL_ROD_GUN, FuelRodGun.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_NIGHTLIGHTER, Nightlighter.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_GADULO, Gadulo.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_DEATH_NOTE, DeathNote.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_MTARA, Mtara.ItemName); NewMastery(CwaffingTheGungy.Synergy.MASTERY_AKELUS, Akelus.ItemName); SanityCheckAllSynergiesHaveBeenInitialized(); Color? emissiveColour = Color.red; _MasteryVFX = VFX.Create("mastery_character_vfx", 16f, loops: false, -1, 1f, (Anchor)1, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1, 100f, emissiveColour); } private static void SanityCheckAllSynergiesHaveBeenInitialized() { for (int i = 0; i < _SynergyNames.Count; i++) { if (_SynergyNames[i] == null) { ETGModConsole.Log((object)("WARNING: haven't initialized custom synergy " + _SynergyEnums[i] + ""), false); } } } private static AdvancedSynergyEntry NewSynergy(Synergy synergy, string name, string[] mandatory, string[] optional = null, bool ignoreLichEyeBullets = false, int masteryId = -1) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) AdvancedSynergyEntry result = RegisterSynergy(_Synergies[(int)synergy], name, mandatory.ToList(), optional?.ToList(), ignoreLichEyeBullets, masteryId); _SynergyNames[(int)synergy] = name; _SynergyIds[(int)synergy] = GameManager.Instance.SynergyManager.synergies.Length - 1; return result; } public static AdvancedSynergyEntry RegisterSynergy(CustomSynergyType synergy, string name, List mandatoryConsoleIDs, List optionalConsoleIDs = null, bool ignoreLichEyeBullets = false, int masteryId = -1) { //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0185: 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_0193: 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_01a1: 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_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Expected O, but got Unknown List list = new List(); List list2 = new List(); List list3 = new List(); List list4 = new List(); foreach (string mandatoryConsoleID in mandatoryConsoleIDs) { PickupObject val = Game.Items[mandatoryConsoleID]; if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Component)val).GetComponent())) { list2.Add(val.PickupObjectId); } else if (Object.op_Implicit((Object)(object)val) && (Object.op_Implicit((Object)(object)((Component)val).GetComponent()) || Object.op_Implicit((Object)(object)((Component)val).GetComponent()))) { list.Add(val.PickupObjectId); } } if (masteryId >= 0) { list.Add(masteryId); } if (optionalConsoleIDs != null) { foreach (string optionalConsoleID in optionalConsoleIDs) { PickupObject val2 = Game.Items[optionalConsoleID]; if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)((Component)val2).GetComponent())) { list4.Add(val2.PickupObjectId); } else if (Object.op_Implicit((Object)(object)val2) && (Object.op_Implicit((Object)(object)((Component)val2).GetComponent()) || Object.op_Implicit((Object)(object)((Component)val2).GetComponent()))) { list3.Add(val2.PickupObjectId); } } } string text = "#" + ETGMod.ToID(name).ToUpperInvariant(); Databases.Strings.Synergy.Set(text, name); AdvancedSynergyEntry val3 = new AdvancedSynergyEntry { NameKey = text, MandatoryItemIDs = list, MandatoryGunIDs = list2, OptionalItemIDs = list3, OptionalGunIDs = list4, bonusSynergies = new List { synergy }, statModifiers = new List(), IgnoreLichEyeBullets = ignoreLichEyeBullets }; int num = GameManager.Instance.SynergyManager.synergies.Length; Array.Resize(ref GameManager.Instance.SynergyManager.synergies, num + 1); GameManager.Instance.SynergyManager.synergies[num] = val3; return val3; } private static AdvancedSynergyEntry NewMastery(Synergy synergy, string gunName) where T : MasteryDummyItem { PickupObject moddedItem = Lazy.GetModdedItem(IName(gunName)); Gun val = (Gun)(object)((moddedItem is Gun) ? moddedItem : null); if (val == null) { return null; } FakeItem.Create(); int pickupObjectId = ((PickupObject)FakeItem.Get()).PickupObjectId; AdvancedSynergyEntry result = NewSynergy(synergy, ((PickupObject)val).EncounterNameOrDisplayName + " Mastery", new string[1] { IName(val.gunName) }, null, ignoreLichEyeBullets: true, pickupObjectId); _MasteryIds.Add(pickupObjectId); _MasteryGuns[((PickupObject)val).PickupObjectId] = pickupObjectId; return result; } public static int MasteryTokenId(this Gun gun) { if (!_MasteryGuns.TryGetValue(((PickupObject)gun).PickupObjectId, out var value)) { return -1; } return value; } public static void AcquireMastery(this PlayerController player, Gun gun) { if (Object.op_Implicit((Object)(object)gun)) { int num = gun.MasteryTokenId(); if (num >= 0) { player.AcquireFakeItem(num); ((Component)gun).gameObject.GetComponent()?.DoMasteryChecks(player); ((Component)player).gameObject.Play("mastery_ritual_complete_sound"); return; } } Object.op_Implicit((Object)(object)gun); } private static string IName(string itemName) { return "cg:" + itemName.InternalName(); } public static CustomSynergyType Synergy(this Synergy synergy) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return _Synergies[(int)synergy]; } public static string SynergyName(this Synergy synergy) { return _SynergyNames[(int)synergy]; } public static bool HasSynergy(this PlayerController player, Synergy synergy) { return player.ActiveExtraSynergies.Contains(_SynergyIds[(int)synergy]); } public static bool Active(this Synergy synergy) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Invalid comparison between Unknown and I4 PlayerController primaryPlayer = GameManager.Instance.PrimaryPlayer; if (primaryPlayer == null) { return false; } if (primaryPlayer.ActiveExtraSynergies.Contains(_SynergyIds[(int)synergy])) { return true; } if ((int)GameManager.Instance.CurrentGameType != 1) { return false; } PlayerController secondaryPlayer = GameManager.Instance.SecondaryPlayer; if (secondaryPlayer == null) { return false; } if (secondaryPlayer.ActiveExtraSynergies.Contains(_SynergyIds[(int)synergy])) { return true; } return false; } public static StatModifier Mult(this StatType s, float a) { //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_0006: 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_000c: 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_001b: Expected O, but got Unknown return new StatModifier { statToBoost = s, modifyType = (ModifyMethod)1, amount = a }; } public static StatModifier Add(this StatType s, float a) { //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_0006: 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_000c: 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_001b: Expected O, but got Unknown return new StatModifier { statToBoost = s, modifyType = (ModifyMethod)0, amount = a }; } public static AdvancedSynergyEntry MultFireRate(this AdvancedSynergyEntry e, float a) { e.statModifiers.Add(((StatType)1).Mult(a)); return e; } public static AdvancedSynergyEntry MultMoveSpeed(this AdvancedSynergyEntry e, float a) { e.statModifiers.Add(((StatType)0).Mult(a)); return e; } public static AdvancedSynergyEntry MultSpread(this AdvancedSynergyEntry e, float a) { e.statModifiers.Add(((StatType)2).Mult(a)); return e; } public static AdvancedSynergyEntry MultClipSize(this AdvancedSynergyEntry e, float a) { e.statModifiers.Add(((StatType)16).Mult(a)); return e; } public static AdvancedSynergyEntry MultChargeRate(this AdvancedSynergyEntry e, float a) { e.statModifiers.Add(((StatType)25).Mult(a)); return e; } public static AdvancedSynergyEntry MultProjSpeed(this AdvancedSynergyEntry e, float a) { e.statModifiers.Add(((StatType)6).Mult(a)); return e; } public static AdvancedSynergyEntry MultDamage(this AdvancedSynergyEntry e, float a) { e.statModifiers.Add(((StatType)5).Mult(a)); return e; } public static AdvancedSynergyEntry MultReload(this AdvancedSynergyEntry e, float a) { e.statModifiers.Add(((StatType)10).Mult(a)); return e; } public static AdvancedSynergyEntry MultAmmo(this AdvancedSynergyEntry e, float a) { e.statModifiers.Add(((StatType)9).Mult(a)); return e; } } public class MasteryDummyItem : FakeItem { } internal class MasteryOfGrandmaster : MasteryDummyItem { } internal class MasteryOfChekhovsGun : MasteryDummyItem { } internal class MasteryOfPincushion : MasteryDummyItem { } internal class MasteryOfPlatinumStar : MasteryDummyItem { } internal class MasteryOfNatascha : MasteryDummyItem { } internal class MasteryOfHandCannon : MasteryDummyItem { } internal class MasteryOfSchrodingersGat : MasteryDummyItem { } internal class MasteryOfHatchlingGun : MasteryDummyItem { } internal class MasteryOfCrapshooter : MasteryDummyItem { } internal class MasteryOfHolyWaterGun : MasteryDummyItem { } internal class MasteryOfVacuumCleaner : MasteryDummyItem { } internal class MasteryOfPaintballCannon : MasteryDummyItem { } internal class MasteryOfGunbrella : MasteryDummyItem { } internal class MasteryOfAlyx : MasteryDummyItem { } internal class MasteryOfPistolWhip : MasteryDummyItem { } internal class MasteryOfFemtobyte : MasteryDummyItem { } internal class MasteryOfUppskeruvel : MasteryDummyItem { } internal class MasteryOfBlackjack : MasteryDummyItem { } internal class MasteryOfEnglish : MasteryDummyItem { } internal class MasteryOfIronMaid : MasteryDummyItem { } internal class MasteryOfAlligator : MasteryDummyItem { } internal class MasteryOfQuarterPounder : MasteryDummyItem { } internal class MasteryOfTiconderogun : MasteryDummyItem { } internal class MasteryOfKingsLaw : MasteryDummyItem { } internal class MasteryOfBubblebeam : MasteryDummyItem { } internal class MasteryOfDeadline : MasteryDummyItem { } internal class MasteryOfStarmageddon : MasteryDummyItem { } internal class MasteryOfSubtractorBeam : MasteryDummyItem { } internal class MasteryOfKALI : MasteryDummyItem { } internal class MasteryOfScotsman : MasteryDummyItem { } internal class MasteryOfCarpetBomber : MasteryDummyItem { } internal class MasteryOfSoulKaliber : MasteryDummyItem { } internal class MasteryOfLightwing : MasteryDummyItem { } internal class MasteryOfMagunet : MasteryDummyItem { } internal class MasteryOfDerailGun : MasteryDummyItem { } internal class MasteryOfAlienNailgun : MasteryDummyItem { } internal class MasteryOfVladimir : MasteryDummyItem { } internal class MasteryOfMaestro : MasteryDummyItem { } internal class MasteryOfKiBlast : MasteryDummyItem { } internal class MasteryOfHallaeribut : MasteryDummyItem { } internal class MasteryOfGunflower : MasteryDummyItem { } internal class MasteryOfOmnidirectionalLaser : MasteryDummyItem { } internal class MasteryOfBlamethrower : MasteryDummyItem { } internal class MasteryOfZag : MasteryDummyItem { } internal class MasteryOfOutbreak : MasteryDummyItem { } internal class MasteryOfTelefragger : MasteryDummyItem { } internal class MasteryOfTranquilizer : MasteryDummyItem { } internal class MasteryOfAimuHakurei : MasteryDummyItem { } internal class MasteryOfRacketLauncher : MasteryDummyItem { } internal class MasteryOfJugglernaut : MasteryDummyItem { } internal class MasteryOfBlasTechF4 : MasteryDummyItem { } internal class MasteryOfYggdrashell : MasteryDummyItem { } internal class MasteryOfWidowmaker : MasteryDummyItem { } internal class MasteryOfOddjob : MasteryDummyItem { } internal class MasteryOfSunderbuss : MasteryDummyItem { } internal class MasteryOfWavefront : MasteryDummyItem { } internal class MasteryOfBreegull : MasteryDummyItem { } internal class MasteryOfOverflow : MasteryDummyItem { } internal class MasteryOfMissiletoe : MasteryDummyItem { } internal class MasteryOfMacchiAuto : MasteryDummyItem { } internal class MasteryOfChroma : MasteryDummyItem { } internal class MasteryOfFlakseed : MasteryDummyItem { } internal class MasteryOfRCLauncher : MasteryDummyItem { } internal class MasteryOfBBGun : MasteryDummyItem { } internal class MasteryOfNycterian : MasteryDummyItem { } internal class MasteryOfSeltzerPelter : MasteryDummyItem { } internal class MasteryOfSuncaster : MasteryDummyItem { } internal class MasteryOfBouncer : MasteryDummyItem { } internal class MasteryOfSubMachineGun : MasteryDummyItem { } internal class MasteryOfStereoscope : MasteryDummyItem { } internal class MasteryOfGroundhog : MasteryDummyItem { } internal class MasteryOfGlockarina : MasteryDummyItem { } internal class MasteryOfMacheening : MasteryDummyItem { } internal class MasteryOfPlasmarble : MasteryDummyItem { } internal class MasteryOfXelsior : MasteryDummyItem { } internal class MasteryOfEmpath : MasteryDummyItem { } internal class MasteryOfSextant : MasteryDummyItem { } internal class MasteryOfLeafblower : MasteryDummyItem { } internal class MasteryOfWayfarer : MasteryDummyItem { } internal class MasteryOfForkbomb : MasteryDummyItem { } internal class MasteryOfZealot : MasteryDummyItem { } internal class MasteryOfToothpaste : MasteryDummyItem { } internal class MasteryOfGradius : MasteryDummyItem { } internal class MasteryOfHeartbreaker : MasteryDummyItem { } internal class MasteryOfCleansweep : MasteryDummyItem { } internal class MasteryOfRetina : MasteryDummyItem { } internal class MasteryOfEntropynnium : MasteryDummyItem { } internal class MasteryOfFluxFist : MasteryDummyItem { } internal class MasteryOfChainDriver : MasteryDummyItem { } internal class MasteryOfRLTSRTSGTSBTSLB : MasteryDummyItem { } internal class MasteryOfPhotonCannon : MasteryDummyItem { } internal class MasteryOfFuelRodGun : MasteryDummyItem { } internal class MasteryOfNightlighter : MasteryDummyItem { } internal class MasteryOfGadulo : MasteryDummyItem { } internal class MasteryOfDeathNote : MasteryDummyItem { } internal class MasteryOfMtara : MasteryDummyItem { } internal class MasteryOfAkelus : MasteryDummyItem { } public enum Synergy { HYPE_YOURSELF_UP, ELECTRIC_SLIDE, DEUS_EX_MACHINA, SOLAR_FLAIR, PROJECTING_MUCH, LOTUS_LAND_STORY, BLANK_STARE, DUBBLE_BUBBLE, SOUL_SEARCHING, CLEANUP_CREW, SCAVENGEST, DEATH_AND_TAXES, DEAD_MAN_STANDING, DEAD_MAN_EXPANDING, AIM_BOTS, WICKED_CHILD, I_NEED_A_HERO, KEYGEN, COMMON_TIME, TALON_TROT, BLASTECH_A1, PIT_BOSS, PARTICLE_ACCELERATOR_ACCELERATOR, MR_ALLIGATOX, ADRENALINE_RUSH, BANK_SHOTS, BIONIC_COMMANDO, BLANK_EXPRESSION, LOOKUP_TABLE, TROLLEY_PROBLEM, DRAW_FIRE, PIERCING_GAZE, CHEATO_PAGE, PHOTOSYNTHESIS, TANK_ENGINE, DEMOLITION_MAN, SAIYAN_PRIDE, LAWN_CARE, THE_ABYSS_STARES_BACK, FURNITURE_POLISH, LEAD_PAINT, COZY_CAMPER, TREASURE_HUNTER, SOLID_FOOTING, YOU_MAY_USE_A_CALCULATOR, STRAGGLER, TRAILBLAZER, STAY_HUNGRY, SEGALS_LAW, SPAWNPROOFING, CAFFEINE_ADDICTION, KALIBERS_FAVOR, GAMER_REFLEXES, AHEAD_OF_SCHEDULE, WRONG_KIND_OF_COMPASS, JOB_SECURITY, FULL_CIRCULATION, GLUED_BACK_TOGETHER_IN_HELL, COMBUST_LITERALLY_EVERYTHING, SUNKEN_EYE, BULLETPROOF_GLASS, CHEST_BATTLE_ADVANCED, TOXIC_LANGUAGE, PURPLE_PROSE, PERFECTLY_BALANCED, CHAIN_SMOKER, BAZOOKA_LAYLEE, GUN_SOHAN, CABLE_MANAGEMENT, BOARD_AND_CARD_GAME_NIGHT, ILL_TAKE_A_POTATO_CHIP, BEDTIME_ROUTINE, MASTERY_GRANDMASTER, MASTERY_CHEKHOVS_GUN, MASTERY_PINCUSHION, MASTERY_PLATINUM_STAR, MASTERY_NATASCHA, MASTERY_HAND_CANNON, MASTERY_SCHRODINGERS_GAT, MASTERY_HATCHLING_GUN, MASTERY_CRAPSHOOTER, MASTERY_HOLY_WATER_GUN, MASTERY_VACUUM_CLEANER, MASTERY_PAINTBALL_CANNON, MASTERY_GUNBRELLA, MASTERY_ALYX, MASTERY_PISTOL_WHIP, MASTERY_FEMTOBYTE, MASTERY_UPPSKERUVEL, MASTERY_BLACKJACK, MASTERY_ENGLISH, MASTERY_IRON_MAID, MASTERY_ALLIGATOR, MASTERY_QUARTER_POUNDER, MASTERY_TICONDEROGUN, MASTERY_KINGS_LAW, MASTERY_BUBBLEBEAM, MASTERY_DEADLINE, MASTERY_STARMAGEDDON, MASTERY_SUBTRACTOR_BEAM, MASTERY_KALI, MASTERY_SCOTSMAN, MASTERY_CARPET_BOMBER, MASTERY_SOUL_KALIBER, MASTERY_LIGHTWING, MASTERY_MAGUNET, MASTERY_DERAIL_GUN, MASTERY_ALIEN_NAILGUN, MASTERY_VLADIMIR, MASTERY_MAESTRO, MASTERY_KI_BLAST, MASTERY_HALLAERIBUT, MASTERY_GUNFLOWER, MASTERY_OMNIDIRECTIONAL_LASER, MASTERY_BLAMETHROWER, MASTERY_ZAG, MASTERY_OUTBREAK, MASTERY_TELEFRAGGER, MASTERY_TRANQUILIZER, MASTERY_AIMU_HAKUREI, MASTERY_RACKET_LAUNCHER, MASTERY_JUGGLERNAUT, MASTERY_BLASTECH_F4, MASTERY_YGGDRASHELL, MASTERY_WIDOWMAKER, MASTERY_ODDJOB, MASTERY_SUNDERBUSS, MASTERY_WAVEFRONT, MASTERY_BREEGULL, MASTERY_OVERFLOW, MASTERY_MISSILETOE, MASTERY_MACCHI_AUTO, MASTERY_CHROMA, MASTERY_FLAKSEED, MASTERY_RC_LAUNCHER, MASTERY_B_B_GUN, MASTERY_NYCTERIAN, MASTERY_SELTZER_PELTER, MASTERY_SUNCASTER, MASTERY_BOUNCER, MASTERY_SUB_MACHINE_GUN, MASTERY_STEREOSCOPE, MASTERY_GROUNDHOG, MASTERY_GLOCKARINA, MASTERY_MACHEENING, MASTERY_PLASMARBLE, MASTERY_XELSIOR, MASTERY_EMPATH, MASTERY_SEXTANT, MASTERY_LEAFBLOWER, MASTERY_WAYFARER, MASTERY_FORKBOMB, MASTERY_ZEALOT, MASTERY_TOOTHPASTE, MASTERY_GRADIUS, MASTERY_HEARTBREAKER, MASTERY_CLEANSWEEP, MASTERY_RETINA, MASTERY_ENTROPYNNIUM, MASTERY_FLUX_FIST, MASTERY_CHAIN_DRIVER, MASTERY_RLTSRTSGTSBTSLB, MASTERY_PHOTON_CANNON, MASTERY_FUEL_ROD_GUN, MASTERY_NIGHTLIGHTER, MASTERY_GADULO, MASTERY_DEATH_NOTE, MASTERY_MTARA, MASTERY_AKELUS } public static class CwaffEvents { [HarmonyPatch(typeof(FinalIntroSequenceManager), "Start")] private class FinalIntroSequenceManagerStartPatch { private static void Prefix() { if (!_AllModsLoaded) { _AllModsLoaded = true; if (OnAllModsLoaded != null) { OnAllModsLoaded(); } if (OnCleanStart != null) { OnCleanStart(); } GameManager.Instance.GlobalInjectionData.PreprocessRun(false); } } } [HarmonyPatch] private class LoadNextLevelPatch { [HarmonyPatch(typeof(GameManager), "LoadNextLevel")] [HarmonyPatch(typeof(GameManager), "LoadCustomLevel")] [HarmonyPatch(typeof(GameManager), "LoadCustomFlowForDebug")] [HarmonyPrefix] private static void Prefix(GameManager __instance) { if (BeforeRunStart != null && (__instance.nextLevelIndex == 1 || (GameManager.SKIP_FOYER && __instance.nextLevelIndex == 0)) && GameStatsManager.Instance.GetSessionStatValue((TrackedStats)23) < 0.1f) { BeforeRunStart(); } if (OnFloorEnded != null) { OnFloorEnded(); } } } [HarmonyPatch(typeof(GameManager), "ClearActiveGameData")] private class ClearActiveGameDataPatch { private static void Postfix(bool destroyGameManager, bool endSession) { if (OnCleanStart != null) { OnCleanStart(); } } } [HarmonyPatch(typeof(Dungeon), "FloorReached")] private class FloorReachedPatch { private static void Postfix() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) GameManager instance = GameManager.Instance; GameStatsManager instance2 = GameStatsManager.Instance; if ((Object)(object)instance == (Object)null || instance2 == null || !instance2.IsInSession) { return; } _OnFirstFloor = GameManager.Instance.GetLastLoadedLevelDefinition().dungeonSceneName == "tt_castle"; _RunJustStarted = instance2.GetSessionStatValue((TrackedStats)23) < 0.1f; if (_RunJustStarted) { if (OnRunStartFromAnyFloor != null) { OnRunStartFromAnyFloor(instance.PrimaryPlayer, instance.SecondaryPlayer, instance.CurrentGameMode); } if (_OnFirstFloor && OnRunStartFromFirstFloor != null) { OnRunStartFromFirstFloor(instance.PrimaryPlayer, instance.SecondaryPlayer, instance.CurrentGameMode); } } instance.OnNewLevelFullyLoaded += OnNewFloorFullyLoadedTempHook; } } [HarmonyPatch(typeof(AIBulletBank), "BulletSpawnedHandler")] private class GetRealProjectileOwnerPatch { public static void Postfix(AIBulletBank __instance, Bullet bullet) { AIActor aiActor = ((BraveBehaviour)__instance).aiActor; if (aiActor == null || bullet == null || (Object)(object)bullet.Parent == (Object)null) { return; } Projectile component = bullet.Parent.GetComponent(); if (component != null) { component.Owner = (GameActor)(object)aiActor; if (OnBankBulletOwnerAssigned != null) { OnBankBulletOwnerAssigned(component); } } } } [HarmonyPatch(typeof(PlayerController), "LateUpdate")] private class PlayerUpdatePatch { private static RoomHandler[] _LastRoom = (RoomHandler[])(object)new RoomHandler[2]; private static void Prefix(PlayerController __instance) { int playerIDX = __instance.PlayerIDX; if (__instance.CurrentRoom != _LastRoom[playerIDX]) { if (OnChangedRooms != null) { OnChangedRooms(__instance, _LastRoom[playerIDX], __instance.CurrentRoom); } _LastRoom[playerIDX] = __instance.CurrentRoom; } } } [HarmonyPatch(typeof(AIActor), "ForceDeath")] private class OnCorpseCreatedPatch { [HarmonyILManipulator] private static void OnCorpseCreatedIL(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_00a9: 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) ILCursor val = new ILCursor(il); ILLabel endOfCorpseBranch = null; if (val.TryGotoNext((MoveType)2, new Func[4] { (Instruction instr) => ILPatternMatchingExt.MatchLdloc(instr, 17), (Instruction instr) => ILPatternMatchingExt.MatchLdnull(instr), (Instruction instr) => ILPatternMatchingExt.MatchCall(instr, "op_Inequality"), (Instruction instr) => ILPatternMatchingExt.MatchBrfalse(instr, ref endOfCorpseBranch) })) { val.GotoLabel(endOfCorpseBranch, (MoveType)0, true); val.Emit(OpCodes.Ldloc_S, (byte)17); val.Emit(OpCodes.Ldarg_0); val.CallPrivate(typeof(OnCorpseCreatedPatch), "OnCorpseCreatedFunc"); } } private static void OnCorpseCreatedFunc(DebrisObject debris, AIActor original) { if (OnCorpseCreated != null) { OnCorpseCreated(debris, original); } } } [HarmonyPatch(typeof(DebrisObject), "Start")] private class DebrisObjectStartPatch { private static void Postfix(DebrisObject __instance) { if (__instance.IsPickupObject) { PickupObject componentInChildren = ((Component)__instance).gameObject.GetComponentInChildren(); if (componentInChildren != null) { _DebrisPickups.Add(componentInChildren); } } } } [HarmonyPatch(typeof(DebrisObject), "OnDestroy")] private class DebrisObjectOnDestroyPatch { private static void Prefix(DebrisObject __instance) { if (__instance.IsPickupObject) { PickupObject componentInChildren = ((Component)__instance).gameObject.GetComponentInChildren(); if (componentInChildren != null) { _DebrisPickups.Remove(componentInChildren); } } } } [HarmonyPatch(typeof(PlayerStats), "RecalculateStatsInternal")] private class PlayerStatsRecalculateStatsInternalPatch { private static bool _CurrentlyRecalculatingStats; private static void Postfix(PlayerStats __instance, PlayerController owner) { if (!_CurrentlyRecalculatingStats) { _CurrentlyRecalculatingStats = true; if (OnStatsRecalculated != null) { OnStatsRecalculated(owner); } _CurrentlyRecalculatingStats = false; } } } [HarmonyPatch] private static class ExtraInteractPatch { [HarmonyPatch(typeof(PlayerController), "HandlePlayerInput")] private static void Postfix(PlayerController __instance) { if (OnEmptyInteract != null && __instance.m_lastInteractionTarget == null && __instance.m_activeActions != null && ((OneAxisInputControl)__instance.m_activeActions.InteractAction).WasPressed && !__instance.IsPetting && !__instance.IsDodgeRolling && !__instance.m_handlingQueuedAnimation) { OnEmptyInteract(__instance); } } } [HarmonyPatch] private static class PlayerControllerApplyRollDamagePatch { [HarmonyPatch(typeof(PlayerController), "ApplyRollDamage")] private static void Prefix(PlayerController __instance, AIActor actor) { if (!__instance.m_rollDamagedEnemies.Contains(actor) && OnWillApplyRollDamage != null) { OnWillApplyRollDamage(__instance, actor); } } } [HarmonyPatch] private static class PickUpMinorInteractiblePatch { [HarmonyPatch(typeof(AmmoPickup), "Pickup")] [HarmonyPatch(typeof(HealthPickup), "Pickup")] [HarmonyPatch(typeof(KeyBulletPickup), "Pickup")] [HarmonyPatch(typeof(SilencerItem), "Pickup")] [HarmonyPrefix] private static void PickUpMinorInteractiblePrefix(PickupObject __instance, PlayerController player) { if (OnWillPickUpMinorInteractible == null || player.IsGhost) { return; } SilencerItem val = (SilencerItem)(object)((__instance is SilencerItem) ? __instance : null); if (val == null || !((PlayerItem)val).m_pickedUp) { AmmoPickup val2 = (AmmoPickup)(object)((__instance is AmmoPickup) ? __instance : null); if (val2 == null || !val2.m_pickedUp) { OnWillPickUpMinorInteractible(player, __instance); } } } [HarmonyPatch(typeof(PassiveItem), "Pickup")] [HarmonyPrefix] private static void PickUpAnyPassiveItemPrefix(PassiveItem __instance, PlayerController player) { if (OnWillPickUpAnyPassive != null && !player.IsGhost) { OnWillPickUpAnyPassive(player, (PickupObject)(object)__instance); } } } [HarmonyPatch] private static class PickUpCurrencyPatch { [HarmonyPatch(typeof(CurrencyPickup), "Pickup")] [HarmonyPrefix] private static void CurrencyPickupPickupPatch(CurrencyPickup __instance, PlayerController player) { if (OnWillPickUpCurrency != null) { OnWillPickUpCurrency(player, __instance); } } } public static Action OnAllModsLoaded; public static Action BeforeRunStart; public static Action OnCleanStart; public static Action OnRunStartFromFirstFloor; public static Action OnRunStartFromAnyFloor; public static Action OnNewFloorFullyLoaded; public static Action OnFloorEnded; public static Action OnKeepFullyLoaded; public static Action OnFirstFloorOfRunFullyLoaded; public static Action OnKeepFullyLoadedForNewRun; public static Action OnBankBulletOwnerAssigned; public static Action OnChangedRooms; public static Action OnCorpseCreated; public static Action OnStatsRecalculated; public static Action OnEmptyInteract; public static Action OnWillApplyRollDamage; public static Action OnWillPickUpMinorInteractible; public static Action OnWillPickUpAnyPassive; public static Action OnWillPickUpCurrency; internal static bool _OnFirstFloor = false; internal static bool _RunJustStarted = false; internal static bool _AllModsLoaded = false; internal static List _DebrisPickups = new List(); private static void OnNewFloorFullyLoadedTempHook() { GameManager.Instance.OnNewLevelFullyLoaded -= OnNewFloorFullyLoadedTempHook; if (OnNewFloorFullyLoaded != null) { OnNewFloorFullyLoaded(); } if (_OnFirstFloor && OnKeepFullyLoaded != null) { OnKeepFullyLoaded(); } if (_RunJustStarted && OnFirstFloorOfRunFullyLoaded != null) { OnFirstFloorOfRunFullyLoaded(); } if (_OnFirstFloor && _RunJustStarted && OnKeepFullyLoadedForNewRun != null) { OnKeepFullyLoadedForNewRun(); } } } internal static class AtlasHelper { private class TempHarmonyPrefix { private Harmony _harmony; public MethodInfo original; public MethodInfo patch; public TempHarmonyPrefix(Harmony harmony, MethodInfo original, MethodInfo patch) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown _harmony = harmony; this.original = original; this.patch = patch; harmony.Patch((MethodBase)original, new HarmonyMethod(patch), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } public void Unpatch() { _harmony.Unpatch((MethodBase)original, patch); } } private class SpriteFromResourcePatch { private static tk2dSpriteCollectionData itemCollection; public static bool Prefix(string spriteName, GameObject obj, Assembly assembly, ref GameObject __result) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown if ((Object)(object)obj == (Object)null) { obj = new GameObject(); } tk2dSprite val = obj.AddComponent(); if (itemCollection == null) { itemCollection = ((BraveBehaviour)PickupObjectDatabase.GetById(155)).sprite.Collection; } int num = SpriteBuilder.AddSpriteToCollection(NamedSpriteInPackedTexture(spriteName), itemCollection); ((tk2dBaseSprite)val).SetSprite(itemCollection, num); ((tk2dBaseSprite)val).SortingOrder = 0; ((tk2dBaseSprite)val).IsPerpendicular = true; obj.GetComponent().sprite = (tk2dBaseSprite)(object)val; __result = obj; return false; } } private class AddSpriteToCollectionPatch { public static bool Prefix(string resourcePath, tk2dSpriteCollectionData collection, Assembly assembly, ref int __result) { __result = SpriteBuilder.AddSpriteToCollection(NamedSpriteInPackedTexture(resourcePath), collection); return false; } } private static readonly Vector2 _TexelSize = new Vector2(0.0625f, 0.0625f); private static readonly List _TemporaryPatches = new List(); private static readonly HashSet _CreatedAmmoTypes = new HashSet(); internal static Dictionary _PackedTextures = new Dictionary(); public static void AddUISpriteBatch(List defs) { foreach (tk2dSpriteDefinition def in defs) { ToolsCharApi.AddUISprite(def, (string)null); } } [Obsolete("This method is obsolete and exists for future API reference only.", false)] private static List AddMultipleItemsToAtlas(this dfAtlas atlas, List defs) { //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_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_00df: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Expected O, but got Unknown //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: 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) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Expected O, but got Unknown //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) List list = new List(); int num = 0; int num2 = 0; foreach (tk2dSpriteDefinition def in defs) { num += (int)(16f * def.untrimmedBoundsDataExtents.x); num2 = Mathf.Max(num2, (int)(16f * def.untrimmedBoundsDataExtents.y)); } Rect val = ToolsCharApi.FindFirstValidEmptySpace(atlas, new IntVector2(num, num2)); int num3 = 0; Vector2 val5 = default(Vector2); for (int i = 0; i < defs.Count; i++) { tk2dSpriteDefinition val2 = defs[i]; string name = val2.name; if (atlas[name] != (ItemInfo)null) { list.Add(atlas[name]); continue; } Texture mainTexture = val2.material.mainTexture; Texture2D val3 = (Texture2D)(object)((mainTexture is Texture2D) ? mainTexture : null); IntVector2 val4 = Vector2Extensions.ToIntVector2(16f * Vector3Extensions.XY(val2.position0), (VectorConversions)2); ((Vector2)(ref val5))..ctor((float)((Texture)val3).width * val2.uvs[0].x, (float)((Texture)val3).height * val2.uvs[0].y); Vector2 val6 = Vector2.op_Implicit(16f * val2.untrimmedBoundsDataExtents); Vector2 val7 = new Vector2((float)((Texture)val3).width * val2.uvs[3].x, (float)((Texture)val3).height * val2.uvs[3].y) - val5; ItemInfo val8 = new ItemInfo { border = new RectOffset(), deleted = false, name = name, region = new Rect(((Rect)(ref val)).x + (float)num3 / (float)((Texture)atlas.Texture).width, ((Rect)(ref val)).y, val6.x / (float)((Texture)atlas.Texture).width, val6.y / (float)((Texture)atlas.Texture).height), rotated = false, sizeInPixels = val6, texture = (Texture2D)/*isinst with value type is only supported in some contexts*/, textureGUID = name }; num3 += (int)val6.x; int num4 = val4.x + Mathf.RoundToInt(((Rect)(ref val8.region)).x * (float)((Texture)atlas.Texture).width); int num5 = val4.y + Mathf.RoundToInt(((Rect)(ref val8.region)).y * (float)((Texture)atlas.Texture).height); atlas.Texture.SetPixels(num4, num5, (int)val7.x, (int)val7.y, val8.texture.GetPixels((int)val5.x, (int)val5.y, (int)val7.x, (int)val7.y)); atlas.AddItem(val8); } atlas.Texture.Apply(); return list; } public static tk2dSpriteDefinition SpriteDefFromSegment(this Texture2D texture, string spriteName, int x, int y, int w, int h, int ox, int oy, int ow, int oh) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //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_0076: 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_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_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_00ae: 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_00b7: Expected O, but got Unknown //IL_00c1: 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_00ce: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_0131: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_0150: 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_015e: 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_0167: 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_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0181: 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) //IL_018f: 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_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: 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_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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) Material val = new Material(ShaderCache.Acquire(PlayerController.DefaultShaderName)); val.mainTexture = (Texture)(object)texture; float num = (float)x / (float)((Texture)texture).width; float num2 = (float)(x + w) / (float)((Texture)texture).width; float num3 = 1f - (float)(y + h) / (float)((Texture)texture).height; float num4 = 1f - (float)y / (float)((Texture)texture).height; Vector3 val2 = 0.0625f * new Vector3((float)ox, (float)(oh - h - oy), 0f); Vector3 val3 = 0.0625f * new Vector3((float)w, (float)h, 0f); Vector3 val4 = 0.0625f * new Vector3((float)ow, (float)oh, 0f); tk2dSpriteDefinition val5 = new tk2dSpriteDefinition(); val5.name = spriteName; val5.texelSize = _TexelSize; val5.flipped = (FlipMode)0; val5.physicsEngine = (PhysicsEngine)0; val5.colliderType = (ColliderType)1; val5.collisionLayer = (CollisionLayer)6; val5.material = val; val5.materialInst = val; val5.position0 = val2; val5.position1 = val2 + new Vector3(val3.x, 0f, 0f); val5.position2 = val2 + new Vector3(0f, val3.y, 0f); val5.position3 = val2 + val3; val5.boundsDataExtents = val3; val5.boundsDataCenter = val2 + 0.5f * val3; val5.untrimmedBoundsDataExtents = val4; val5.untrimmedBoundsDataCenter = 0.5f * val4; val5.uvs = (Vector2[])(object)new Vector2[4] { new Vector2(num, num3), new Vector2(num2, num3), new Vector2(num, num4), new Vector2(num2, num4) }; return val5; } public static tk2dSpriteDefinition NamedSpriteInPackedTexture(string s) { if (!_PackedTextures.TryGetValue(s.Split(new char[1] { '/' }).Last(), out var value)) { return null; } return value; } public static void LoadPackedTextureResource(Texture2D atlas, Dictionary attachPoints, string metaDataResourcePath) { //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: 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_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) Assembly callingAssembly = Assembly.GetCallingAssembly(); List list = new List(); List list2 = new List(); List list3 = new List(); List list4 = new List(); List list5 = new List(); List list6 = new List(); List list7 = new List(); List list8 = new List(); List list9 = new List(); using (Stream stream = callingAssembly.GetManifestResourceStream(metaDataResourcePath)) { using StreamReader streamReader = new StreamReader(stream); string text = null; while ((text = streamReader.ReadLine()) != null) { string[] array = text.Split(new char[1] { '\t' }); if (array.Length < 9) { continue; } string[] array2 = array[0].Split(new char[1] { '/' }); string text2 = array2[0]; string text3 = array2[^1].Split(new char[1] { '.' })[0]; tk2dSpriteDefinition val = (_PackedTextures[text3] = atlas.SpriteDefFromSegment(text3, int.Parse(array[1]), int.Parse(array[2]), int.Parse(array[3]), int.Parse(array[4]), int.Parse(array[5]), int.Parse(array[6]), int.Parse(array[7]), int.Parse(array[8]))); tk2dSpriteDefinition item = val; switch (text2) { case "ProjectileCollection": list.Add(item); break; case "Ammonomicon Encounter Icon Collection": list2.Add(item); break; case "ItemSprites": list3.Add(item); list2.Add(item); break; case "UISprites": list5.Add(item); break; case "Characters": list6.Add(item); break; case "Punchout": list7.Add(item); break; case "WeaponCollection": { list4.Add(item); if (attachPoints.TryGetValue(text3, out var value)) { list9.Add(value); } else { list9.Add(null); } break; } default: list8.Add(item); break; } } } tk2dSpriteCollectionData spriteCollection = ((Component)((Component)ResourceManager.LoadAssetBundle("enemies_base_001").LoadAsset("MetalGearRat").GetComponent()).GetComponent().PunchoutMinigamePrefab.GetComponent().Player).gameObject.GetComponent().Library.clips[0].frames[0].spriteCollection; AddSpritesToCollection(list, Databases.Items.ProjectileCollection); AddSpritesToCollection(list2, AmmonomiconController.ForceInstance.EncounterIconCollection); AddSpritesToCollection(list3, Databases.Items.ItemCollection); AddSpritesToCollection(list4, Databases.Items.WeaponCollection, list9); AddSpritesToCollection(list6, CwaffCharacter.Collection); AddSpritesToCollection(list7, spriteCollection); AddSpritesToCollection(list8, VFX.Collection); AddSpritesToCollection(list5, ((GameObject)ResourceCache.Acquire("ControllerButtonSprite")).GetComponent().Collection); AddUISpriteBatch(list5); } private static IntVector2 AddSpritesToCollection(List newDefs, tk2dSpriteCollectionData collection, List attachPoints = null, bool copyMaterialSettings = false) { //IL_00a3: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown if (collection.spriteNameLookupDict == null) { collection.InitDictionary(); } Material val = null; if (copyMaterialSettings && collection.spriteDefinitions.Length != 0) { val = collection.spriteDefinitions[0].material; _ = val.shader; } int num = collection.spriteDefinitions.Length; int count = newDefs.Count; Array.Resize(ref collection.spriteDefinitions, num + count); for (int i = 0; i < count; i++) { tk2dSpriteDefinition val2 = newDefs[i]; if (Object.op_Implicit((Object)(object)val)) { val2.CopyMaterialProps(val); } int num2 = num + i; collection.spriteDefinitions[num2] = val2; collection.spriteNameLookupDict[val2.name] = num2; } if (attachPoints == null) { return new IntVector2(num, newDefs.Count); } for (int j = 0; j < attachPoints.Count; j++) { AttachPoint[] array = attachPoints[j]; if (array != null) { int item = num + j; collection.SpriteIDsWithAttachPoints.Add(item); collection.SpriteDefinedAttachPoints.Add(new AttachPointData(array)); if ((Object)(object)collection.inst != (Object)(object)collection) { collection.inst.SpriteIDsWithAttachPoints.Add(item); collection.inst.SpriteDefinedAttachPoints.Add(new AttachPointData(array)); } } } return new IntVector2(num, count); } public static IntVector2 AddSpritesToCollection(List paths, tk2dSpriteCollectionData collection, bool copyMaterialSettings = false) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) int count = paths.Count; List list = new List(count); for (int i = 0; i < count; i++) { list.Add(_PackedTextures[paths[i]]); } return AddSpritesToCollection(list, collection, null, copyMaterialSettings); } public static Dictionary ReadAttachPointsFromTSV(Assembly asmb, string tsvPath) { //IL_0059: 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_0069: 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_0092: Expected O, but got Unknown Dictionary dictionary = new Dictionary(); using Stream stream = asmb.GetManifestResourceStream(tsvPath); using StreamReader streamReader = new StreamReader(stream); string text = null; while ((text = streamReader.ReadLine()) != null) { string[] array = text.Split(new char[1] { '\t' }); AttachPoint[] array2 = (dictionary[array[0]] = (AttachPoint[])(object)new AttachPoint[(array.Length - 1) / 3]); AttachPoint[] array4 = array2; int num = 0; for (int i = 1; i < array.Length; i += 3) { array4[num] = new AttachPoint { name = array[i], position = new Vector3(float.Parse(array[i + 1]), float.Parse(array[i + 2]), 0f) }; num++; } } return dictionary; } public static string GetOrAddCustomAmmoType(string name, string ammoTypeSpritePath, string ammoBackgroundSpritePath) { //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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0047: 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_005b: Expected O, but got Unknown //IL_007a: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown if (_CreatedAmmoTypes.Contains(name)) { return name; } GameUIAmmoType val = new GameUIAmmoType { ammoBarBG = Extensions.RegisterPrefab(new GameObject("sprite bg")).SetupDfSpriteFromDef(_PackedTextures[ammoBackgroundSpritePath], ShaderCache.Acquire("Daikon Forge/Default UI Shader")), ammoBarFG = Extensions.RegisterPrefab(new GameObject("sprite fg")).SetupDfSpriteFromDef(_PackedTextures[ammoTypeSpritePath], ShaderCache.Acquire("Daikon Forge/Default UI Shader")), ammoType = (AmmoType)14, customAmmoType = name }; CustomClipAmmoTypeToolbox.addedAmmoTypes.Add(val); foreach (GameUIAmmoController ammoController in GameUIRoot.Instance.ammoControllers) { CustomClipAmmoTypeToolbox.Add(ref ammoController.ammoTypes, val); } _CreatedAmmoTypes.Add(name); return name; } public static dfTiledSprite SetupDfSpriteFromDef(this GameObject obj, tk2dSpriteDefinition def, Shader shader) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //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) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0044: 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_0056: 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_006a: 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_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_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_009d: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00bf: Expected O, but got Unknown dfAtlas val = obj.AddComponent(); val.Material = new Material(shader); val.Material.mainTexture = def.material.mainTexture; val.Items.Clear(); ItemInfo val2 = new ItemInfo { border = new RectOffset(), deleted = false, name = "main_sprite", region = new Rect(def.uvs[0], def.uvs[3] - def.uvs[0]), rotated = false, sizeInPixels = 16f * Vector3Extensions.XY(def.untrimmedBoundsDataExtents), texture = null, textureGUID = "main_sprite" }; val.AddItem(val2); dfTiledSprite obj2 = obj.AddComponent(); ((dfSprite)obj2).Atlas = val; ((dfSprite)obj2).SpriteName = "main_sprite"; return obj2; } internal static void InitSetupPatches(Harmony harmony) { _TemporaryPatches.Add(new TempHarmonyPrefix(harmony, typeof(SpriteBuilder).GetMethod("SpriteFromResource", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic), typeof(SpriteFromResourcePatch).GetMethod("Prefix", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))); _TemporaryPatches.Add(new TempHarmonyPrefix(harmony, typeof(SpriteBuilder).GetMethod("AddSpriteToCollection", new Type[3] { typeof(string), typeof(tk2dSpriteCollectionData), typeof(Assembly) }), typeof(AddSpriteToCollectionPatch).GetMethod("Prefix", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))); Assembly assembly = typeof(GunBehaviour).Assembly; _TemporaryPatches.Add(new TempHarmonyPrefix(harmony, assembly.GetType("HarmonyPatches").GetMethod("AddMissingReplacements", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, CallingConventions.Any, new Type[1] { typeof(tk2dSpriteCollectionData) }, null), typeof(AtlasHelper).GetMethod("False", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))); } private static bool False() { return false; } internal static void RemoveSetupPatches(Harmony harmony) { for (int num = _TemporaryPatches.Count - 1; num >= 0; num--) { _TemporaryPatches[num].Unpatch(); } _TemporaryPatches.Clear(); } } public class CwaffBezierMesh : MonoBehaviour { public tk2dSpriteAnimationClip animation; public Vector2 startPos; public Vector2 endPos; private tk2dTiledSprite m_sprite; private CwaffBoneManager _boneManager; private Vector3 mainBezierPoint1; private Vector3 mainBezierPoint2; private Vector3 mainBezierPoint3; private Vector3 mainBezierPoint4; private const int _BEZIER_CURVE_SEGMENTS = 20; private const int c_bonePixelLength = 4; private const float c_boneUnitLength = 0.25f; private const float c_trailHeightOffset = 0.5f; private static readonly Quaternion _Rot90 = Quaternion.Euler(0f, 0f, 90f); public static CwaffBezierMesh Create(tk2dSpriteAnimationClip animation, Vector2 startPos, Vector2 endPos, string name = null) { //IL_001d: 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_0041: 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) CwaffBezierMesh component = new GameObject(name ?? "new CwaffBezierMesh", new Type[1] { typeof(CwaffBezierMesh) }).GetComponent(); component.m_sprite = GameObjectExtensions.GetOrAddComponent(((Component)component).gameObject); component.animation = animation; component.startPos = startPos; component.endPos = endPos; return component; } private void Start() { _boneManager = ((Component)this).gameObject.AddComponent(); _boneManager.Setup(animation); } private void Update() { //IL_0018: 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) //IL_0028: 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_0038: 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) _boneManager.UpdateTimers(); _boneManager.ReturnAllBones(); DrawMainBezierCurve(startPos, startPos + Vector2.down, endPos + Vector2.up, endPos); _boneManager.RecomputeNormals(); } private void LateUpdate() { ((tk2dBaseSprite)m_sprite).HeightOffGround = 0.5f; _boneManager.ManualLateUpdate(); } private void DrawBezierCurve(Vector2 p0, Vector2 p1, Vector2 p2, Vector2 p3) { //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_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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_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_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_0034: 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_003a: 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_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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_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_006b: 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_0085: 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_00a0: 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) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector2.op_Implicit(BraveMathCollege.CalculateBezierPoint(0f, p0, p1, p2, p3)); float num = 0f; for (int i = 1; i <= 20; i++) { Vector2 val2 = BraveMathCollege.CalculateBezierPoint((float)i / 20f, p0, p1, p2, p3); num += Vector2.Distance(Vector2.op_Implicit(val), val2); val = Vector2.op_Implicit(val2); } float num2 = 4f * num; val = Vector2.op_Implicit(BraveMathCollege.CalculateBezierPoint(0f, p0, p1, p2, p3)); if (!_boneManager.HasBones()) { _boneManager.RentBone(Vector2.op_Implicit(val)); } for (int j = 1; (float)j <= num2; j++) { _boneManager.RentBone(BraveMathCollege.CalculateBezierPoint((float)j / num2, p0, p1, p2, p3)); } } private void DrawMainBezierCurve(Vector2 p0, Vector2 p1, Vector2 p2, Vector2 p3) { //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_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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_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_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_001e: 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_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_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) DrawBezierCurve(p0, p1, p2, p3); mainBezierPoint1 = Vector2.op_Implicit(p0); mainBezierPoint2 = Vector2.op_Implicit(p1); mainBezierPoint3 = Vector2.op_Implicit(p2); mainBezierPoint4 = Vector2.op_Implicit(p3); } public Vector2 GetPointOnMainBezier(float t) { //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_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_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) //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_002d: Unknown result type (might be due to invalid IL or missing references) return BraveMathCollege.CalculateBezierPoint(t, Vector2.op_Implicit(mainBezierPoint1), Vector2.op_Implicit(mainBezierPoint2), Vector2.op_Implicit(mainBezierPoint3), Vector2.op_Implicit(mainBezierPoint4)); } } [HarmonyPatch(typeof(GameUIHeartController), "UpdateHealth")] public static class ArmorUIOffsetFix { [HarmonyILManipulator] private static void ArmorUIOffsetFixIL(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); while (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchCallvirt(instr, "GetMotionGroupParent") }) && val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdfld(instr, "CurrentTileScale") })) { val.CallPrivate(typeof(ArmorUIOffsetFix), "Zero"); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdfld(instr, "CurrentTileScale") })) { break; } val.CallPrivate(typeof(ArmorUIOffsetFix), "Zero"); } } private static float Zero(float originalValue) { return 0f; } } [HarmonyPatch(typeof(Gun), "ContinueAttack")] public static class ModulesAreTiersBurstFirePatch { [HarmonyILManipulator] private static void ModulesAreTiersBurstFirePatchIL(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) //IL_0046: 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) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdfld(instr, "burstShotCount") })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc_S, (byte)4); val.Emit(OpCodes.Ldloc_3); val.CallPrivate(typeof(ModulesAreTiersBurstFirePatch), "IsCurrentBurstModule"); } } private static int IsCurrentBurstModule(int unadjustBurstShotCount, Gun gun, ProjectileModule mod, int i) { if (!gun.Volley.ModulesAreTiers) { return unadjustBurstShotCount; } if (gun.m_currentStrengthTier == ((mod.CloneSourceIndex < 0) ? i : mod.CloneSourceIndex)) { return unadjustBurstShotCount; } return 0; } } public static class BadItemOffsetsFromChestHotfix { [HarmonyPatch(/*Could not decode attribute arguments.*/)] private class BadItemOffsetsFromChestPatch { [HarmonyILManipulator] private static void BadItemOffsetsFromChestIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_004d: 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) ILCursor val = new ILCursor(il); for (int i = 0; i < 2; i++) { if (!val.TryGotoNext((MoveType)((i != 1) ? 2 : 0), new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchStloc(instr, 7) })) { return; } } val.Emit(OpCodes.Ldloc_S, (byte)3); val.Emit(OpCodes.Ldloc_S, (byte)8); val.CallPrivate(typeof(BadItemOffsetsFromChestPatch), "DetermineActualOffset"); } private static Vector3 DetermineActualOffset(Vector3 original, PickupObject p, tk2dSprite s) { //IL_002e: 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_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) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)((Component)p).gameObject.GetComponent())) { return Vector2.op_Implicit(-dfVectorExtensions.Quantize(((tk2dBaseSprite)s).GetRelativePositionFromAnchor((Anchor)1), 0.0625f)); } return original; } } } [HarmonyPatch] public static class SetupSynergySpritePatch { [HarmonyPatch(typeof(UINotificationController), "SetupSprite")] [HarmonyPatch(typeof(UINotificationController), "SetupSynergySprite")] private static void Prefix(UINotificationController __instance, ref tk2dSpriteCollectionData collection, ref int spriteId) { if ((Object)(object)collection == (Object)null || collection.spriteDefinitions == null || collection.spriteDefinitions.Length <= spriteId) { return; } string name = collection.spriteDefinitions[spriteId].name; if (!string.IsNullOrEmpty(name) && name.EndsWith("_idle_001")) { string text = "cg_" + name.Replace("_idle_001", "_ammonomicon"); tk2dSpriteCollectionData encounterIconCollection = AmmonomiconController.ForceInstance.EncounterIconCollection; int spriteIdByName = encounterIconCollection.GetSpriteIdByName(text, -1); if (spriteIdByName != -1) { collection = encounterIconCollection; spriteId = spriteIdByName; } } } } public static class DragunFightHotfix { [HarmonyPatch(typeof(BossTriggerZone), "OnTriggerCollision")] private class BossTriggerZoneNullDereferencePatch { [HarmonyILManipulator] private static void BossTriggerZoneNullDereferenceFixIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //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_0020: 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) ILCursor val = new ILCursor(il); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg_1); val.Emit(OpCodes.Ldarg_2); val.Emit(OpCodes.Ldarg_3); val.CallPrivate(typeof(DragunFightHotfix), "BossTriggerZoneSanityCheck"); if (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchCallvirt(instr, "get_IsBoss") })) { val.CallPrivate(typeof(DragunFightHotfix), "HealthHaverSanityCheck"); } } } internal static bool _SanityCheckFailed; private static void BossTriggerZoneSanityCheck(BossTriggerZone zone, SpeculativeRigidbody otherRigidbody, SpeculativeRigidbody myRigidbody, CollisionData collisionData) { if (!((Object)(object)zone != (Object)null) || ((CastResult)collisionData).OtherPixelCollider == null || StaticReferenceManager.AllHealthHavers == null) { Debug.Log((object)$"BossTriggerZone is valid? {(Object)(object)zone != (Object)null}"); Debug.Log((object)$"collisionData.OtherPixelCollider is valid? {((CastResult)collisionData).OtherPixelCollider != null}"); Debug.Log((object)$"StaticReferenceManager.AllHealthHavers is valid? {StaticReferenceManager.AllHealthHavers != null}"); } } private static HealthHaver HealthHaverSanityCheck(HealthHaver hh) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 if (!Object.op_Implicit((Object)(object)hh)) { Debug.Log((object)" healthhaver is invalid at boss trigger zone, tell pretzel"); return hh; } if (!Object.op_Implicit((Object)(object)hh) || !Object.op_Implicit((Object)(object)((BraveBehaviour)hh).aiActor)) { return hh; } if (hh.IsBoss) { GenericIntroDoer component = ((Component)hh).GetComponent(); if (component != null) { if ((int)component.triggerType != 20) { return hh; } Debug.Log((object)(" healthhaver " + ((Object)((BraveBehaviour)hh).aiActor).name + " / " + ((GameActor)((BraveBehaviour)hh).aiActor).ActorName + " / " + ((GameActor)((BraveBehaviour)hh).aiActor).OverrideDisplayName)); Debug.Log((object)" is boss with GenericIntroDoer and BossTriggerZone type"); if (((Component)component).GetComponent() == null) { GameObjectExtensions.GetOrAddComponent(((Component)component).gameObject); Debug.LogError((object)" DOES NOT HAVE ObjectVisibilityManager, TELL PRETZEL"); if (!_SanityCheckFailed) { Lazy.CustomNotification("DRAGUN FIGHT BROKEN BY", ((Object)((BraveBehaviour)hh).aiActor).name + "/" + ((GameActor)((BraveBehaviour)hh).aiActor).ActorName + "/" + ((GameActor)((BraveBehaviour)hh).aiActor).OverrideDisplayName); _SanityCheckFailed = true; } } return hh; } } return hh; } } public static class CwaffHats { internal static Hat _PizzaHat; private static int _NumHats; public static void Init() { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_015b: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_0217: 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_0275: 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_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_0302: 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_0360: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Unknown result type (might be due to invalid IL or missing references) //IL_0563: 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_05c0: Unknown result type (might be due to invalid IL or missing references) //IL_05ee: Unknown result type (might be due to invalid IL or missing references) //IL_061c: Unknown result type (might be due to invalid IL or missing references) //IL_064b: Unknown result type (might be due to invalid IL or missing references) //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_06a9: Unknown result type (might be due to invalid IL or missing references) //IL_06d8: Unknown result type (might be due to invalid IL or missing references) //IL_0707: Unknown result type (might be due to invalid IL or missing references) //IL_0736: Unknown result type (might be due to invalid IL or missing references) //IL_0764: Unknown result type (might be due to invalid IL or missing references) //IL_0793: Unknown result type (might be due to invalid IL or missing references) //IL_07c2: Unknown result type (might be due to invalid IL or missing references) //IL_07f5: Unknown result type (might be due to invalid IL or missing references) //IL_0824: Unknown result type (might be due to invalid IL or missing references) //IL_0853: Unknown result type (might be due to invalid IL or missing references) //IL_0882: Unknown result type (might be due to invalid IL or missing references) //IL_08b1: Unknown result type (might be due to invalid IL or missing references) //IL_08e0: Unknown result type (might be due to invalid IL or missing references) //IL_090f: Unknown result type (might be due to invalid IL or missing references) //IL_093e: Unknown result type (might be due to invalid IL or missing references) //IL_096d: Unknown result type (might be due to invalid IL or missing references) //IL_099c: Unknown result type (might be due to invalid IL or missing references) //IL_09cb: Unknown result type (might be due to invalid IL or missing references) //IL_09fa: Unknown result type (might be due to invalid IL or missing references) //IL_0a29: Unknown result type (might be due to invalid IL or missing references) //IL_0a58: Unknown result type (might be due to invalid IL or missing references) //IL_0a87: Unknown result type (might be due to invalid IL or missing references) //IL_0ab6: Unknown result type (might be due to invalid IL or missing references) //IL_0ae5: Unknown result type (might be due to invalid IL or missing references) //IL_0b14: Unknown result type (might be due to invalid IL or missing references) //IL_0b40: Unknown result type (might be due to invalid IL or missing references) //IL_0b6c: Unknown result type (might be due to invalid IL or missing references) //IL_0b97: Unknown result type (might be due to invalid IL or missing references) //IL_0bc5: Unknown result type (might be due to invalid IL or missing references) //IL_0bf4: Unknown result type (might be due to invalid IL or missing references) //IL_0c23: Unknown result type (might be due to invalid IL or missing references) //IL_0c52: Unknown result type (might be due to invalid IL or missing references) //IL_0c81: Unknown result type (might be due to invalid IL or missing references) //IL_0cb4: Unknown result type (might be due to invalid IL or missing references) //IL_0ce7: Unknown result type (might be due to invalid IL or missing references) //IL_0d15: Unknown result type (might be due to invalid IL or missing references) //IL_0d45: Unknown result type (might be due to invalid IL or missing references) //IL_0d73: Unknown result type (might be due to invalid IL or missing references) //IL_0da1: Unknown result type (might be due to invalid IL or missing references) //IL_0dd0: Unknown result type (might be due to invalid IL or missing references) //IL_0e00: Unknown result type (might be due to invalid IL or missing references) //IL_0e2e: Unknown result type (might be due to invalid IL or missing references) //IL_0e5d: Unknown result type (might be due to invalid IL or missing references) //IL_0e8b: Unknown result type (might be due to invalid IL or missing references) //IL_0eba: Unknown result type (might be due to invalid IL or missing references) //IL_0ee9: Unknown result type (might be due to invalid IL or missing references) //IL_0f19: Unknown result type (might be due to invalid IL or missing references) //IL_0f48: Unknown result type (might be due to invalid IL or missing references) //IL_0f76: Unknown result type (might be due to invalid IL or missing references) //IL_0fa4: Unknown result type (might be due to invalid IL or missing references) //IL_0fd2: Unknown result type (might be due to invalid IL or missing references) //IL_1005: Unknown result type (might be due to invalid IL or missing references) //IL_1034: Unknown result type (might be due to invalid IL or missing references) //IL_1060: Unknown result type (might be due to invalid IL or missing references) //IL_108c: Unknown result type (might be due to invalid IL or missing references) //IL_10bb: Unknown result type (might be due to invalid IL or missing references) //IL_10ea: Unknown result type (might be due to invalid IL or missing references) if (C.DEBUG_BUILD) { EasyHat("debug_hat", null, onEyes: false, 1, locked: false, null, excluded: true); EasyHat("debug_glasses", null, onEyes: true, 1, locked: false, null, excluded: true); EasyHat("arrow_hat", null, onEyes: false, 8, locked: true, null, excluded: true); _NumHats -= 3; } EasyHat("toad_hat", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("bunny_hood", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("jester_hat", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("saiyan_hat", (IntVector2?)new IntVector2(0, -4), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("wizard_hat", (IntVector2?)new IntVector2(-1, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("cat_ears", (IntVector2?)new IntVector2(0, -4), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("shades", (IntVector2?)new IntVector2(0, -2), onEyes: true, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("samus_hat", (IntVector2?)new IntVector2(0, -8), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("goggles", (IntVector2?)new IntVector2(0, -3), onEyes: true, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("santa_hat", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("crown", (IntVector2?)new IntVector2(0, -2), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("mitre", (IntVector2?)new IntVector2(0, -2), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("tiara", (IntVector2?)new IntVector2(0, -2), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("top_hat", (IntVector2?)new IntVector2(0, -2), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("beret", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("bowler", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("halo", (IntVector2?)new IntVector2(0, 2), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("kasa", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("pirate_hat", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("red_mage_hat", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("traffic_cone", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("cowl", (IntVector2?)new IntVector2(0, -9), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("fishbowl", (IntVector2?)new IntVector2(0, -8), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("bycocket", (IntVector2?)new IntVector2(-1, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("fedora", (IntVector2?)new IntVector2(-1, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("tattered_hat", (IntVector2?)new IntVector2(0, -1), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("zucchetto", (IntVector2?)new IntVector2(0, -2), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("admiral_hat", (IntVector2?)new IntVector2(0, -2), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("apple", (IntVector2?)new IntVector2(0, -1), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("blank_cap", (IntVector2?)new IntVector2(0, -1), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("bullet_kin_hat", (IntVector2?)new IntVector2(0, -1), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("german_general_hat", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("kokiri_cap", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("master_chief_helmet", (IntVector2?)new IntVector2(0, -9), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("mustache", (IntVector2?)new IntVector2(1, -6), onEyes: true, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("number_2_headband", (IntVector2?)new IntVector2(0, -4), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("pompom_hat", (IntVector2?)new IntVector2(-1, -4), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("spike_crown", (IntVector2?)new IntVector2(1, -1), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("stovepipe", (IntVector2?)new IntVector2(0, -5), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("u_s_a_general_hat", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, "U.S.A. General Hat", excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("witch_hat", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("aviator_helmet", (IntVector2?)new IntVector2(0, -7), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("basque_beret", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("beastmaster_hat", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("black_cat", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("ribbon", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("bullat_hat", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("camo_helmet", (IntVector2?)new IntVector2(0, -5), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("captain_falcon_helmet", (IntVector2?)new IntVector2(0, -6), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("grenade_cap", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("gunzookie_helmet", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("megaman_helment", (IntVector2?)new IntVector2(0, -8), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("party_glasses", (IntVector2?)new IntVector2(0, -3), onEyes: true, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("bandana", (IntVector2?)new IntVector2(0, -6), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("winchester_hat", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("zero_helmet", (IntVector2?)new IntVector2(0, -8), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("wizbang_hat", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("police_hat", (IntVector2?)new IntVector2(0, -6), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)true, (HatDepthType?)null); EasyHat("sheriff_hat", (IntVector2?)new IntVector2(0, -6), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)true, (HatDepthType?)null); EasyHat("traffic_officer_hat", (IntVector2?)new IntVector2(0, -6), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)true, (HatDepthType?)null); EasyHat("nitra_hat", (IntVector2?)new IntVector2(0, -1), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("rad_hat", (IntVector2?)new IntVector2(1, -1), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("blobulon_hat", (IntVector2?)new IntVector2(0, -2), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("cardboard_box", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("squire_helmet", (IntVector2?)new IntVector2(0, -5), onEyes: true, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("jackolantern", (IntVector2?)new IntVector2(0, -2), onEyes: false, 1, locked: false, "Jack O'Lantern", excluded: false, (bool?)null, (HatDepthType?)null); _PizzaHat = EasyHat("pizza_hat", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("bicorne", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("chicken", (IntVector2?)new IntVector2(0, -1), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("coonskin", (IntVector2?)new IntVector2(-3, -5), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("daisy", (IntVector2?)new IntVector2(0, -1), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("discovered", (IntVector2?)new IntVector2(0, 1), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("doug_hat", (IntVector2?)new IntVector2(0, -2), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("dunce_cap", (IntVector2?)new IntVector2(-5, -4), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("fez", (IntVector2?)new IntVector2(0, -1), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("fish", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("gameboy", (IntVector2?)new IntVector2(0, -1), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("nurse_hat", (IntVector2?)new IntVector2(0, -2), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("propeller_cap", (IntVector2?)new IntVector2(0, -2), onEyes: false, 10, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("saucepan", (IntVector2?)new IntVector2(-4, -1), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("shellmet", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("siren", (IntVector2?)new IntVector2(0, -1), onEyes: false, 6, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("sorceress_hat", (IntVector2?)new IntVector2(0, -1), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("tv_antennae", (IntVector2?)new IntVector2(0, 0), onEyes: false, 1, locked: false, "TV Antennae", excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("viking_helmet", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("the_infamous", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)true, (HatDepthType?)null); EasyHat("bumbler", (IntVector2?)new IntVector2(0, -3), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)true, (HatDepthType?)null); EasyHat("cowboy_hat", (IntVector2?)new IntVector2(0, -4), onEyes: false, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("comedy_bowtie", (IntVector2?)new IntVector2(0, -9), onEyes: true, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); EasyHat("dress_bowtie", (IntVector2?)new IntVector2(0, -9), onEyes: true, 1, locked: false, (string)null, excluded: false, (bool?)null, (HatDepthType?)null); } internal static Hat EasyHat(string name, IntVector2? offset = null, bool onEyes = false, int fps = 1, bool locked = false, string displayName = null, bool excluded = false, bool? autoFlip = null, HatDepthType? depth = null) { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) _NumHats++; return HatUtility.SetupHat(displayName ?? ETGMod.ToTitleCaseInvariant(name.Replace("_", " ")), Lazy.Combine(ResMap.Get(name + "_south", quietFailure: true), ResMap.Get(name + "_north", quietFailure: true), ResMap.Get(name + "_east", quietFailure: true), ResMap.Get(name + "_west", quietFailure: true), ResMap.Get(name + "_northeast", quietFailure: true), ResMap.Get(name + "_northwest", quietFailure: true)), offset, fps, (HatAttachLevel)(onEyes ? 1 : 0), (HatDepthType)(((int?)depth) ?? (onEyes ? 2 : 0)), (HatRollReaction)0, (string)null, (string)null, 1f, 1f, autoFlip, excluded, (List)null, (List)null, (string)null, false); } } public static class CwaffDialog { public class PerformAction : FsmStateAction { public Action action; public override void OnEnter() { if (action != null) { action(); } ((FsmStateAction)this).Finish(); } } public static void AddNewDialogState(this TalkDoerLite talker, string stateName, List dialogue, bool replaceExisting = false, string yesPrompt = null, string yesState = null, string noPrompt = null, string noState = null, Action customAction = null) { //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_007c: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00c2: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown //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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_0141: Expected O, but got Unknown //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Expected O, but got Unknown //IL_0180: 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_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Expected O, but got Unknown //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Expected O, but got Unknown //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Expected O, but got Unknown PlayMakerFSM playmakerFsm = ((BraveBehaviour)talker).playmakerFsm; if (playmakerFsm == null) { return; } FsmState[] states = playmakerFsm.fsm.states; for (int i = 0; i < states.Length; i++) { if (states[i].name == stateName && !replaceExisting) { return; } } bool flag = !string.IsNullOrEmpty(yesPrompt) && !string.IsNullOrEmpty(yesState) && !string.IsNullOrEmpty(noPrompt) && !string.IsNullOrEmpty(noState); FsmState val = new FsmState(playmakerFsm.fsm) { name = stateName, description = "runtime dialogue state", isSequence = true, actions = (FsmStateAction[])(object)new FsmStateAction[0] }; if (flag) { val.transitions = (FsmTransition[])(object)new FsmTransition[2] { new FsmTransition { fsmEvent = new FsmEvent(stateName + "_answer_yes"), toState = yesState }, new FsmTransition { fsmEvent = new FsmEvent(stateName + "_answer_no"), toState = noState } }; } List list = (val.actionData.fsmStringParams = new List()); foreach (string item in dialogue) { list.Add(new FsmString { value = item, useVariable = true, name = item }); } if (customAction != null) { Append(ref val.actions, (FsmStateAction)(object)new PerformAction { action = customAction }); } DialogueBox val2 = new DialogueBox(); val2.sequence = (DialogueSequence)0; val2.dialogue = list.ToArray(); val2.responses = (FsmString[])(object)new FsmString[0]; val2.skipWalkAwayEvent = FsmBool.op_Implicit(false); val2.PlayBoxOnInteractingPlayer = FsmBool.op_Implicit(false); val2.IsThoughtBubble = FsmBool.op_Implicit(false); val2.SuppressDefaultAnims = FsmBool.op_Implicit(false); val2.forceCloseTime = FsmFloat.op_Implicit(0f); val2.zombieTime = FsmFloat.op_Implicit(0f); val2.OverrideTalkAnim = FsmString.op_Implicit(string.Empty); val2.events = (FsmEvent[])(object)((!flag) ? new FsmEvent[0] : new FsmEvent[2] { val.transitions[0].fsmEvent, val.transitions[1].fsmEvent }); DialogueBox val3 = val2; Append(ref val.actions, (FsmStateAction)(object)val3); if (flag) { val3.responses = (FsmString[])(object)new FsmString[2] { FsmString.op_Implicit(yesPrompt.AutoCoreKey()), FsmString.op_Implicit(noPrompt.AutoCoreKey()) }; } else { Append(ref val.actions, (FsmStateAction)new EndConversation { killZombieTextBoxes = FsmBool.op_Implicit(true), doNotLerpCamera = FsmBool.op_Implicit(false), suppressReinteractDelay = FsmBool.op_Implicit(false), suppressFurtherInteraction = FsmBool.op_Implicit(false) }); Append(ref val.actions, (FsmStateAction)new RestartWhenFinished()); } FsmStateAction[] actions = val.actions; for (int i = 0; i < actions.Length; i++) { actions[i].Init(val); } Append(ref playmakerFsm.fsm.events, new FsmEvent(stateName + "_event")); Append(ref playmakerFsm.fsm.states, val); } private static string AutoCoreKey(this string s) { string text = "#" + s + "_prompt"; if (!Databases.Strings.Core.ContainsKey(text)) { Databases.Strings.Core.Set(text, s); } return text; } public static void StartDialog(this TalkDoerLite talker, string stateName) { //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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown PlayMakerFSM playmakerFsm = ((BraveBehaviour)talker).playmakerFsm; if (playmakerFsm == null) { return; } FsmState activeState = playmakerFsm.fsm.activeState; if (activeState == null) { return; } FsmState state = playmakerFsm.fsm.GetState(stateName); if (state == null) { return; } string text = stateName + "_event"; bool flag = false; FsmTransition[] transitions = activeState.transitions; for (int i = 0; i < transitions.Length; i++) { if (!(transitions[i].fsmEvent.name != text)) { flag = true; break; } } if (!flag) { Append(ref playmakerFsm.fsm.activeState.transitions, new FsmTransition { fsmEvent = playmakerFsm.fsm.GetEvent(text), toState = stateName }); } if (!(state.actions[0] is BeginConversation)) { BeginConversation val = new BeginConversation { conversationType = (ConversationType)0 }; Prepend(ref state.actions, (FsmStateAction)(object)val); ((FsmStateAction)val).Init(state); } ((BraveBehaviour)talker).SendPlaymakerEvent(text); } private static void Append(ref T[] arr, T val) { int num = arr.Length; Array.Resize(ref arr, num + 1); arr[num] = val; } private static void Prepend(ref T[] arr, T val) { int num = arr.Length; Array.Resize(ref arr, num + 1); for (int num2 = num; num2 > 0; num2--) { arr[num2] = arr[num2 - 1]; } arr[0] = val; } } public class CwaffTrailController : BraveBehaviour { private class CwaffTrailBone { public Vector2 pos; public float posX; public Vector2 normal; public bool IsAnimating; public float AnimationTimer; public bool Hide; private static int _BonesCreated = 0; private static readonly LinkedList _BonePool = new LinkedList(); internal static LinkedListNode Rent(Vector2 pos, float posX) { //IL_0037: 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_004a: Unknown result type (might be due to invalid IL or missing references) if (_BonePool.Count == 0) { _BonePool.AddLast(new CwaffTrailBone()); } LinkedListNode? last = _BonePool.Last; _BonePool.RemoveLast(); CwaffTrailBone value = last.Value; value.pos = pos; value.posX = posX; value.normal = default(Vector2); value.IsAnimating = false; value.AnimationTimer = 0f; value.Hide = false; return last; } internal static void Return(LinkedListNode bone) { _BonePool.AddLast(bone); } private CwaffTrailBone() { _BonesCreated++; } } public bool usesStartAnimation; public string startAnimation; public bool usesAnimation; public string animation; [TogglesProperty("cascadeTimer", "Cascade Timer")] public bool usesCascadeTimer; [HideInInspector] public float cascadeTimer; [TogglesProperty("softMaxLength", "Soft Max Length")] public bool usesSoftMaxLength; [HideInInspector] public float softMaxLength; [TogglesProperty("globalTimer", "Global Timer")] public bool usesGlobalTimer; [HideInInspector] public float globalTimer; public bool destroyOnEmpty = true; public bool awaitAllTimers; public Vector2 boneSpawnOffset; public bool useBody = true; public bool UsesDispersalParticles; [ShowInInspectorIf("UsesDispersalParticles", false)] public float DispersalDensity = 3f; [ShowInInspectorIf("UsesDispersalParticles", false)] public float DispersalMinCoherency = 0.2f; [ShowInInspectorIf("UsesDispersalParticles", false)] public float DispersalMaxCoherency = 1f; [ShowInInspectorIf("UsesDispersalParticles", false)] public GameObject DispersalParticleSystemPrefab; public bool converted; private SpeculativeRigidbody body; private tk2dBaseSprite parent_sprite; private tk2dTiledSprite trail_sprite; private tk2dSpriteAnimationClip m_startAnimationClip; private tk2dSpriteAnimationClip m_animationClip; private float m_projectileScale = 1f; private int m_spriteSubtileWidth; private readonly LinkedList m_bones = new LinkedList(); private ParticleSystem m_dispersalParticles; private Vector2 m_minBonePosition; private Vector2 m_maxBonePosition; private bool m_isDirty; private float m_globalTimer; private float m_maxPosX; private bool trailActive = true; private bool disconnected; private bool setup; private const int c_bonePixelLength = 4; private const float c_boneUnitLength = 0.25f; private const float c_trailHeightOffset = -0.5f; private Vector2 TruePosition { get { //IL_0013: 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_001b: 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_0045: 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) if (Object.op_Implicit((Object)(object)body)) { Position position = body.Position; return ((Position)(ref position)).UnitPosition; } if (Object.op_Implicit((Object)(object)parent_sprite)) { return parent_sprite.WorldCenter; } return Vector2.op_Implicit(((BraveBehaviour)this).transform.position); } } public static void Spawn(CwaffTrailController prefab, Vector2 start, Vector2 end) { //IL_0006: 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_000c: 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_0013: 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_0048: Unknown result type (might be due to invalid IL or missing references) CwaffTrailController component = Object.Instantiate(((Component)prefab).gameObject, Vector2.op_Implicit(start), (end - start).EulerZ()).GetComponent(); ((BraveBehaviour)component).transform.localScale = new Vector3(1f, 1f, 1f); component.Setup(); component.HandleExtension(end); component.disconnected = true; component.destroyOnEmpty = true; } public static CwaffTrailController Convert(TrailController tc) { //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) CwaffTrailController cwaffTrailController = ((Component)tc).gameObject.ClonePrefab().AddComponent(); Object.Destroy((Object)(object)((Component)cwaffTrailController).gameObject.GetComponent()); cwaffTrailController.usesStartAnimation = tc.usesStartAnimation; cwaffTrailController.startAnimation = tc.startAnimation; cwaffTrailController.usesAnimation = tc.usesAnimation; cwaffTrailController.animation = tc.animation; cwaffTrailController.usesCascadeTimer = tc.usesCascadeTimer; cwaffTrailController.cascadeTimer = tc.cascadeTimer; cwaffTrailController.usesSoftMaxLength = tc.usesSoftMaxLength; cwaffTrailController.softMaxLength = tc.softMaxLength; cwaffTrailController.usesGlobalTimer = tc.usesGlobalTimer; cwaffTrailController.globalTimer = tc.globalTimer; cwaffTrailController.destroyOnEmpty = tc.destroyOnEmpty; cwaffTrailController.boneSpawnOffset = tc.boneSpawnOffset; cwaffTrailController.UsesDispersalParticles = tc.UsesDispersalParticles; cwaffTrailController.DispersalDensity = tc.DispersalDensity; cwaffTrailController.DispersalMinCoherency = tc.DispersalMinCoherency; cwaffTrailController.DispersalMaxCoherency = tc.DispersalMaxCoherency; cwaffTrailController.DispersalParticleSystemPrefab = tc.DispersalParticleSystemPrefab; cwaffTrailController.converted = true; return cwaffTrailController; } public void Start() { Setup(); } private void Setup() { //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown //IL_0179: 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_0184: 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_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: 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_0070: Unknown result type (might be due to invalid IL or missing references) if (setup) { return; } Transform parent = ((BraveBehaviour)this).transform.parent; if (parent != null) { if (useBody) { body = ((Component)parent).gameObject.GetComponent(); if (Object.op_Implicit((Object)(object)body)) { body.Initialize(); } } parent_sprite = ((Component)parent).gameObject.GetComponent(); ((BraveBehaviour)this).transform.position = Vector3.zero; ((BraveBehaviour)this).transform.rotation = Quaternion.identity; } if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)((BraveBehaviour)body).projectile)) { GameActor owner = ((BraveBehaviour)body).projectile.Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null) { m_projectileScale = val.BulletScaleModifier; } ((BraveBehaviour)body).projectile.OverrideTrailPoint = null; ((BraveBehaviour)body).projectile.OnDestruction += OnProjectileDestruction; } GameObjectExtensions.SetLayerRecursively(((Component)this).gameObject, LayerMask.NameToLayer("FG_Critical")); trail_sprite = ((Component)this).GetComponent(); trail_sprite.OverrideGetTiledSpriteGeomDesc = new OverrideGetTiledSpriteGeomDescDelegate(GetTiledSpriteGeomDesc); trail_sprite.OverrideSetTiledSpriteGeom = new OverrideSetTiledSpriteGeomDelegate(SetTiledSpriteGeom); tk2dSpriteDefinition currentSpriteDef = ((tk2dBaseSprite)trail_sprite).GetCurrentSpriteDef(); m_spriteSubtileWidth = Mathf.RoundToInt(currentSpriteDef.untrimmedBoundsDataExtents.x / currentSpriteDef.texelSize.x) / 4; m_bones.AddLast(CwaffTrailBone.Rent(TruePosition + boneSpawnOffset, 0f)); m_bones.AddLast(CwaffTrailBone.Rent(TruePosition + boneSpawnOffset, 0f)); if (usesStartAnimation) { m_startAnimationClip = ((BraveBehaviour)this).spriteAnimator.GetClipByName(startAnimation); } if (usesAnimation) { m_animationClip = ((BraveBehaviour)this).spriteAnimator.GetClipByName(animation); } if ((usesStartAnimation || usesAnimation) && usesCascadeTimer) { m_bones.First.Value.IsAnimating = true; } if (UsesDispersalParticles) { m_dispersalParticles = GlobalDispersalParticleManager.GetSystemForPrefab(DispersalParticleSystemPrefab); } if (Object.op_Implicit((Object)(object)body)) { SpeculativeRigidbody obj = body; obj.OnCollision = (Action)Delegate.Combine(obj.OnCollision, new Action(UpdateOnCollision)); SpeculativeRigidbody obj2 = body; obj2.OnPostRigidbodyMovement = (Action)Delegate.Combine(obj2.OnPostRigidbodyMovement, new Action(PostRigidbodyMovement)); } setup = true; } private void OnProjectileDestruction(Projectile obj) { DisconnectFromSpecRigidbody(); } public void Toggle(bool enable = true) { trailActive = enable; } public void Update() { int num = Mathf.RoundToInt(((tk2dBaseSprite)trail_sprite).GetCurrentSpriteDef().untrimmedBoundsDataExtents.x / ((tk2dBaseSprite)trail_sprite).GetCurrentSpriteDef().texelSize.x) / 4; m_globalTimer += BraveTime.DeltaTime; if (usesAnimation) { LinkedListNode linkedListNode = m_bones.First; float num2 = 0f; while (linkedListNode != null) { bool flag = false; if (linkedListNode.Value.IsAnimating) { tk2dSpriteAnimationClip val = ((!usesStartAnimation || linkedListNode != m_bones.First) ? m_animationClip : m_startAnimationClip); linkedListNode.Value.AnimationTimer += BraveTime.DeltaTime; num2 = linkedListNode.Value.AnimationTimer; int num3 = Mathf.FloorToInt((linkedListNode.Value.AnimationTimer - BraveTime.DeltaTime) * val.fps); if (Mathf.FloorToInt(linkedListNode.Value.AnimationTimer * val.fps) != num3) { m_isDirty = true; } if (linkedListNode.Value.AnimationTimer > (float)val.frames.Length / val.fps) { if (usesStartAnimation && linkedListNode == m_bones.First) { usesStartAnimation = false; } for (int i = 0; i < num; i++) { if (linkedListNode == null) { break; } LinkedListNode linkedListNode2 = linkedListNode; linkedListNode = linkedListNode.Next; m_bones.Remove(linkedListNode2); CwaffTrailBone.Return(linkedListNode2); } flag = true; m_isDirty = true; } } if (linkedListNode != null && !linkedListNode.Value.IsAnimating) { bool flag2 = usesGlobalTimer || usesCascadeTimer || usesSoftMaxLength; bool flag3 = false; if (usesGlobalTimer) { flag2 &= m_globalTimer > globalTimer; flag3 |= m_globalTimer > globalTimer; } if (usesCascadeTimer) { flag2 &= linkedListNode == m_bones.First || num2 >= cascadeTimer; flag3 |= linkedListNode == m_bones.First || num2 >= cascadeTimer; } if (usesSoftMaxLength) { flag2 &= m_maxPosX - linkedListNode.Value.posX > softMaxLength; flag3 |= m_maxPosX - linkedListNode.Value.posX > softMaxLength; } if (awaitAllTimers ? flag2 : flag3) { linkedListNode.Value.IsAnimating = true; num2 = 0f; DoDispersalParticles(linkedListNode, num); m_isDirty = true; } } if (flag || linkedListNode == null) { continue; } for (int j = 0; j < num; j++) { if (linkedListNode == null) { break; } linkedListNode = linkedListNode.Next; } } } if (destroyOnEmpty && m_bones.Count == 0) { Object.Destroy((Object)(object)((Component)this).gameObject); } } public void LateUpdate() { //IL_0006: 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) ((BraveBehaviour)this).transform.rotation = Quaternion.identity; if (!Object.op_Implicit((Object)(object)body) && !disconnected) { HandleExtension(TruePosition); } UpdateIfDirty(); } public override void OnDestroy() { if (Object.op_Implicit((Object)(object)body)) { SpeculativeRigidbody obj = body; obj.OnCollision = (Action)Delegate.Remove(obj.OnCollision, new Action(UpdateOnCollision)); SpeculativeRigidbody obj2 = body; obj2.OnPostRigidbodyMovement = (Action)Delegate.Remove(obj2.OnPostRigidbodyMovement, new Action(PostRigidbodyMovement)); if (Object.op_Implicit((Object)(object)((BraveBehaviour)body).projectile)) { ((BraveBehaviour)body).projectile.OnDestruction -= OnProjectileDestruction; } } while (m_bones.Count > 0) { LinkedListNode? last = m_bones.Last; m_bones.RemoveLast(); CwaffTrailBone.Return(last); } ((BraveBehaviour)this).OnDestroy(); } public void DisconnectFromSpecRigidbody() { if (Object.op_Implicit((Object)(object)body)) { SpeculativeRigidbody obj = body; obj.OnCollision = (Action)Delegate.Remove(obj.OnCollision, new Action(UpdateOnCollision)); SpeculativeRigidbody obj2 = body; obj2.OnPostRigidbodyMovement = (Action)Delegate.Remove(obj2.OnPostRigidbodyMovement, new Action(PostRigidbodyMovement)); body = null; ((BraveBehaviour)this).transform.parent = null; destroyOnEmpty = true; disconnected = true; } } private void UpdateOnCollision(CollisionData obj) { //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_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_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) //IL_0025: 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_0091: Unknown result type (might be due to invalid IL or missing references) Position position = body.Position; Vector2 toPosition = ((Position)(ref position)).UnitPosition + PhysicsEngine.PixelToUnit(obj.NewPixelsToMove); HandleExtension(toPosition); m_bones.Last.Value.Hide = true; m_bones.AddLast(CwaffTrailBone.Rent(m_bones.Last.Value.pos, m_bones.Last.Value.posX)); m_bones.AddLast(CwaffTrailBone.Rent(m_bones.Last.Value.pos, m_bones.Last.Value.posX)); } private void PostRigidbodyMovement(SpeculativeRigidbody rigidbody, Vector2 unitDelta, IntVector2 pixelDelta) { //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_000f: Unknown result type (might be due to invalid IL or missing references) Position position = body.Position; HandleExtension(((Position)(ref position)).UnitPosition); UpdateIfDirty(); } private void UpdateIfDirty() { //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_003e: 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_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_00bc: 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_0048: 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_005a: 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_006c: 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 (!m_isDirty) { return; } float num = float.MaxValue; float num2 = float.MinValue; float num3 = float.MaxValue; float num4 = float.MinValue; for (LinkedListNode linkedListNode = m_bones.First; linkedListNode != null; linkedListNode = linkedListNode.Next) { Vector2 pos = linkedListNode.Value.pos; if (pos.x < num) { num = pos.x; } if (pos.x > num2) { num2 = pos.x; } if (pos.y < num3) { num3 = pos.y; } if (pos.y > num4) { num4 = pos.y; } } m_minBonePosition = new Vector2(num, num3); m_maxBonePosition = new Vector2(num2, num4); ((BraveBehaviour)this).transform.position = new Vector3(num, num3, num3 - 0.5f); ((tk2dBaseSprite)trail_sprite).ForceBuild(); ((tk2dBaseSprite)trail_sprite).UpdateZDepth(); m_isDirty = false; } private void HandleExtension(Vector2 toPosition) { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_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_004c: 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_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) if (trailActive) { if (!destroyOnEmpty && m_bones.Count == 0) { m_bones.AddLast(CwaffTrailBone.Rent(TruePosition + boneSpawnOffset, m_maxPosX)); m_bones.AddLast(CwaffTrailBone.Rent(TruePosition + boneSpawnOffset, m_maxPosX)); } if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)((BraveBehaviour)body).projectile) && ((BraveBehaviour)body).projectile.OverrideTrailPoint.HasValue) { toPosition = ((BraveBehaviour)body).projectile.OverrideTrailPoint.Value; } ExtendBonesTo(toPosition + boneSpawnOffset); m_isDirty = true; } } private void ExtendBonesTo(Vector2 newPos) { //IL_0051: 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_007d: 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_00a1: 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) //IL_00bc: 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_0100: 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_01d1: 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_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_022f: 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_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0283: 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_028d: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: 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_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_0334: 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_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_034f: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) if (m_bones == null || m_bones.Last == null || m_bones.Last.Value == null || m_bones.Last.Previous == null || m_bones.Last.Previous.Value == null) { return; } Vector2 val = newPos - m_bones.Last.Value.pos; Vector2 val2 = m_bones.Last.Value.pos - m_bones.Last.Previous.Value.pos; float magnitude = ((Vector2)(ref val2)).magnitude; LinkedListNode previous = m_bones.Last.Previous; float num = Vector3.Distance(Vector2.op_Implicit(newPos), Vector2.op_Implicit(m_bones.Last.Previous.Value.pos)); if (num < 0.25f) { m_bones.Last.Value.pos = newPos; m_bones.Last.Value.posX = m_bones.Last.Previous.Value.posX + num; } else { if (Mathf.Approximately(magnitude, 0f)) { m_bones.Last.Value.pos = m_bones.Last.Previous.Value.pos + ((Vector2)(ref val)).normalized * 0.25f; m_bones.Last.Value.posX = m_bones.Last.Previous.Value.posX + 0.25f; } else { float num2 = 0.25f; float num3 = BraveMathCollege.ClampAnglePi(Mathf.Atan2(val.y, val.x) - Mathf.Atan2(0f - val2.y, 0f - val2.x)); float num4 = Mathf.Abs(num3); float num5 = Mathf.Asin(magnitude / num2 * Mathf.Sin(num4)); float num6 = (float)Math.PI - num5 - num4; Vector2 val3 = val2.Rotate(Mathf.Sign(num3) * (0f - num6) * 57.29578f); m_bones.Last.Value.pos = m_bones.Last.Previous.Value.pos + ((Vector2)(ref val3)).normalized * 0.25f; m_bones.Last.Value.posX = m_bones.Last.Previous.Value.posX + 0.25f; } Vector2 val4 = m_bones.Last.Value.pos; Vector2 val5 = newPos - val4; float num7 = ((Vector2)(ref val5)).magnitude; ((Vector2)(ref val5)).Normalize(); while (num7 > 0f) { if (num7 < 0.25f) { m_bones.AddLast(CwaffTrailBone.Rent(newPos, m_bones.Last.Value.posX + num7)); break; } val4 += val5 * 0.25f; m_bones.AddLast(CwaffTrailBone.Rent(val4, m_bones.Last.Value.posX + 0.25f)); num7 -= 0.25f; if (usesGlobalTimer && m_globalTimer > globalTimer) { m_bones.Last.Value.AnimationTimer = m_globalTimer - globalTimer; } } } m_maxPosX = m_bones.Last.Value.posX; LinkedListNode linkedListNode = previous; while (linkedListNode != null && linkedListNode.Next != null) { CwaffTrailBone value = linkedListNode.Value; Vector3 val6 = Quaternion.Euler(0f, 0f, 90f) * Vector2.op_Implicit(linkedListNode.Next.Value.pos - linkedListNode.Value.pos); value.normal = Vector2.op_Implicit(((Vector3)(ref val6)).normalized); linkedListNode = linkedListNode.Next; } m_bones.Last.Value.normal = m_bones.Last.Previous.Value.normal; m_isDirty = true; } private void DoDispersalParticles(LinkedListNode boneNode, int subtilesPerTile) { //IL_002c: 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_0046: 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_0083: 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_0089: 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_008f: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00e3: 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_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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_013f: 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_0155: Unknown result type (might be due to invalid IL or missing references) //IL_018b: 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) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019c: 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) if (!UsesDispersalParticles || boneNode.Value == null || boneNode.Next == null || boneNode.Next.Value == null) { return; } Vector3 val = Vector2Extensions.ToVector3ZUp(boneNode.Value.pos, boneNode.Value.pos.y); LinkedListNode linkedListNode = boneNode; for (int i = 0; i < subtilesPerTile; i++) { if (linkedListNode.Next == null) { break; } linkedListNode = linkedListNode.Next; } Vector3 val2 = Vector2Extensions.ToVector3ZUp(linkedListNode.Value.pos, linkedListNode.Value.pos.y); int num = Mathf.Max(Mathf.CeilToInt(Vector2.Distance(Vector3Extensions.XY(val), Vector3Extensions.XY(val2)) * DispersalDensity), 1); for (int j = 0; j < num; j++) { float num2 = (float)j / (float)num; Vector3 val3 = Vector3.Lerp(val, val2, num2); val3 += Vector3.back; float num3 = Mathf.PerlinNoise(val3.x / 3f, val3.y / 3f); Vector3 val4 = Vector3.Lerp(Quaternion.Euler(0f, 0f, num3 * 360f) * Vector3.right, Random.insideUnitSphere, Random.Range(DispersalMinCoherency, DispersalMaxCoherency)); EmitParams val5 = default(EmitParams); ((EmitParams)(ref val5)).position = val3; ((EmitParams)(ref val5)).velocity = val4 * m_dispersalParticles.startSpeed; ((EmitParams)(ref val5)).startSize = m_dispersalParticles.startSize; ((EmitParams)(ref val5)).startLifetime = m_dispersalParticles.startLifetime; ((EmitParams)(ref val5)).startColor = Color32.op_Implicit(m_dispersalParticles.startColor); EmitParams val6 = val5; m_dispersalParticles.Emit(val6, 1); } } public void GetTiledSpriteGeomDesc(out int numVertices, out int numIndices, tk2dSpriteDefinition spriteDef, Vector2 dimensions) { int num = Mathf.Max(m_bones.Count - 1, 0); numVertices = num * 4; numIndices = num * 6; } public void SetTiledSpriteGeom(Vector3[] pos, Vector2[] uv, int offset, out Vector3 boundsCenter, out Vector3 boundsExtents, tk2dSpriteDefinition spriteDef, Vector3 scale, Vector2 dimensions, Anchor anchor, float colliderOffsetZ, float colliderExtentZ) { //IL_0043: 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_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_0062: 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_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_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_023a: 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_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: 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_022e: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: 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_024b: 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_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_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026e: 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_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0329: 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_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_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Invalid comparison between Unknown and I4 //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Invalid comparison between Unknown and I4 //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_04d9: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_04ef: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.RoundToInt(spriteDef.untrimmedBoundsDataExtents.x / spriteDef.texelSize.x) / 4; int num2 = Mathf.Max(m_bones.Count - 1, 0); int num3 = Mathf.CeilToInt((float)num2 / (float)num); boundsCenter = Vector2.op_Implicit((m_minBonePosition + m_maxBonePosition) / 2f); boundsExtents = Vector2.op_Implicit((m_maxBonePosition - m_minBonePosition) / 2f); LinkedListNode linkedListNode = m_bones.First; int num4 = offset; tk2dSpriteDefinition[] spriteDefinitions = ((tk2dBaseSprite)trail_sprite).Collection.spriteDefinitions; float num5 = 1f / (float)m_spriteSubtileWidth; for (int i = 0; i < num3; i++) { int num6 = num - 1; if (i == num3 - 1 && num2 % num != 0) { num6 = num2 % num - 1; } tk2dSpriteDefinition val = spriteDef; CwaffTrailBone cwaffTrailBone = linkedListNode.Value; if (usesStartAnimation && i == 0) { int num7 = Mathf.Clamp(Mathf.FloorToInt(cwaffTrailBone.AnimationTimer * m_startAnimationClip.fps), 0, m_startAnimationClip.frames.Length - 1); val = spriteDefinitions[m_startAnimationClip.frames[num7].spriteId]; } else if (usesAnimation && cwaffTrailBone.IsAnimating) { int num8 = Mathf.Min((int)(cwaffTrailBone.AnimationTimer * m_animationClip.fps), m_animationClip.frames.Length - 1); val = spriteDefinitions[m_animationClip.frames[num8].spriteId]; } float num9 = 0f; float num10 = val.position0.y * m_projectileScale; float num11 = val.position3.y * m_projectileScale; for (int j = 0; j <= num6; j++) { CwaffTrailBone value = linkedListNode.Next.Value; float num12 = 1f; if (i == num3 - 1 && j == num6) { num12 = Vector2.Distance(value.pos, cwaffTrailBone.pos); } pos[num4] = ((j > 0) ? pos[num4 - 3] : Vector2.op_Implicit(cwaffTrailBone.pos + cwaffTrailBone.normal * num10 - m_minBonePosition)); pos[num4 + 1] = Vector2.op_Implicit(value.pos + value.normal * num10 - m_minBonePosition); pos[num4 + 2] = ((j > 0) ? pos[num4 - 1] : Vector2.op_Implicit(cwaffTrailBone.pos + cwaffTrailBone.normal * num11 - m_minBonePosition)); pos[num4 + 3] = Vector2.op_Implicit(value.pos + value.normal * num11 - m_minBonePosition); Vector2 val2 = Vector2.Lerp(val.uvs[0], val.uvs[1], num9); Vector2 val3 = Vector2.Lerp(val.uvs[2], val.uvs[3], num9 + num12 / (float)num); if (cwaffTrailBone.Hide) { uv[num4] = Vector2.zero; uv[num4 + 1] = Vector2.zero; uv[num4 + 2] = Vector2.zero; uv[num4 + 3] = Vector2.zero; } else if (!converted || (int)val.flipped == 0) { uv[num4] = new Vector2(val2.x, val2.y); uv[num4 + 1] = new Vector2(val3.x, val2.y); uv[num4 + 2] = new Vector2(val2.x, val3.y); uv[num4 + 3] = new Vector2(val3.x, val3.y); } else if ((int)val.flipped == 1) { uv[num4] = new Vector2(val2.x, val2.y); uv[num4 + 1] = new Vector2(val2.x, val3.y); uv[num4 + 2] = new Vector2(val3.x, val2.y); uv[num4 + 3] = new Vector2(val3.x, val3.y); } else if ((int)val.flipped == 2) { uv[num4] = new Vector2(val2.x, val2.y); uv[num4 + 1] = new Vector2(val3.x, val2.y); uv[num4 + 2] = new Vector2(val2.x, val3.y); uv[num4 + 3] = new Vector2(val3.x, val3.y); } num4 += 4; num9 += num5; linkedListNode = linkedListNode.Next; cwaffTrailBone = value; } } } } [HarmonyPatch] internal static class StatPatches { [HarmonyPatch(typeof(GameManager), "DoGameOver")] [HarmonyPrefix] private static void GameManagerDoGameOverPatch(GameManager __instance, string gameOverSource) { if (gameOverSource == "Sans Gundertale") { CustomTrackedStats.DIED_TO_SKEL.Increment(); } if (gameOverSource == "Armistice") { CustomTrackedStats.DIED_TO_ARMI.Increment(); } } } [HarmonyPatch(typeof(MinorBreakable), "OnPreCollision")] internal static class MinorBreakablePrecollisionPatches { [HarmonyILManipulator] private static void VeryFragileIL(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_0062: 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) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchStloc(instr, 0) })) { ILLabel val2 = val.DefineLabel(); val.Emit(OpCodes.Ldloc_0); val.CallPrivate(typeof(VeryFragileProjectile), "IsVeryFragile"); val.Emit(OpCodes.Brfalse, (object)val2); val.Emit(OpCodes.Ret); val.MarkLabel(val2); } } [HarmonyILManipulator] private static void PlayerCollidesWithMinorBreakableIL(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) //IL_0047: 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, "Break") })) { val.Emit(OpCodes.Ldarg, 1); val.Emit(OpCodes.Ldarg, 3); val.CallPrivate(typeof(ScavengingArms), "HandleCollisionWithMinorBreakable"); } } } [HarmonyPatch(typeof(Projectile), "HandleDamage")] internal static class ProjectileHandleDamagePatches { [HarmonyILManipulator] private static void HandleDamageIL(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) //IL_0046: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchStloc(instr, 4) })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg_1); val.CallPrivate(typeof(DamageAdjuster), "AdjustDamageStatic"); } } [HarmonyILManipulator] private static void ArmorPiercingIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_000f: 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_003c: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); VariableDefinition val2 = il.DeclareLocal(); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg_1); val.CallPrivate(typeof(ArmorPiercingRounds), "PossiblyDisableArmor"); val.Emit(OpCodes.Stloc, val2); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchCallvirt(instr, "get_ReflectProjectiles") })) { return; } val.Emit(OpCodes.Ldloc, val2); val.CallPrivate(typeof(ProjectileHandleDamagePatches), "AndNot"); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchCallvirt(instr, "QueryInvulnerabilityFrame") })) { val.Emit(OpCodes.Ldloc, val2); val.CallPrivate(typeof(ProjectileHandleDamagePatches), "AndNot"); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchStloc(instr, 9) }) && val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdcI4(instr, 0) })) { val.Emit(OpCodes.Ldloc, val2); val.CallPrivate(typeof(ProjectileHandleDamagePatches), "ShouldIgnoreInvulnerabilityFrames"); } } } private static bool AndNot(bool trueVal, bool falseVal) { if (trueVal) { return !falseVal; } return false; } private static bool ShouldIgnoreInvulnerabilityFrames(bool _, bool ignore) { return ignore; } } [HarmonyPatch(typeof(Projectile), "OnRigidbodyCollision")] internal static class ProjectileOnRigidbodyCollisionPatches { [HarmonyILManipulator] private static void ImpactSoundIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_006c: 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) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchCall(instr, "HandleKnockback") }) && val.TryGotoNext((MoveType)0, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdloc(instr, 5) })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc_S, (byte)5); val.CallPrivate(typeof(CwaffProjectile), "PlayCollisionSounds"); } } } [HarmonyPatch(typeof(Projectile), "OnTileCollision")] internal static class ProjectileOnTileCollisionPatches { private static void Prefix(Projectile __instance) { CwaffProjectile.PlayCollisionSounds(__instance, hitEnemy: false); } } [HarmonyPatch(typeof(Gun), "ShootSingleProjectile")] internal static class ShootSingleProjectilePatch { [HarmonyILManipulator] internal static void ReduceSpreadWhenIdleIL(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_005c: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func[2] { (Instruction instr) => ILPatternMatchingExt.MatchLdcI4(instr, 2), (Instruction instr) => ILPatternMatchingExt.MatchCallvirt(instr, "GetStatValue") })) { val.Emit(OpCodes.Ldloc_0); val.CallPrivate(typeof(MMAiming), "ModifySpreadIfIdle"); } } [HarmonyILManipulator] internal static void AimBotZeroSpreadIL(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_005c: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func[2] { (Instruction instr) => ILPatternMatchingExt.MatchLdcI4(instr, 2), (Instruction instr) => ILPatternMatchingExt.MatchCallvirt(instr, "GetStatValue") })) { val.Emit(OpCodes.Ldloc_0); val.CallPrivate(typeof(BionicFinger), "ModifySpreadIfSemiautomatic"); } } [HarmonyILManipulator] internal static void DynamicAccuracyIL(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_005c: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func[2] { (Instruction instr) => ILPatternMatchingExt.MatchLdcI4(instr, 2), (Instruction instr) => ILPatternMatchingExt.MatchCallvirt(instr, "GetStatValue") })) { val.Emit(OpCodes.Ldarg_0); val.CallPrivate(typeof(CwaffGun), "ModifyAccuracy"); } } [HarmonyILManipulator] internal static void CheckFreebieIL(ILContext il, MethodBase original) { //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) //IL_002a: 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) ILCursor val = new ILCursor(il); int projectileVarId = -1; while (val.TryGotoNext((MoveType)2, new Func[2] { (Instruction instr) => ILPatternMatchingExt.MatchLdloc(instr, ref projectileVarId), (Instruction instr) => ILPatternMatchingExt.MatchCallOrCallvirt(instr, "ApplyCustomAmmunitionsToProjectile") })) { val.Emit(OpCodes.Ldloc_S, (byte)projectileVarId); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg_1); val.CallPrivate(typeof(CwaffProjectile), "DetermineIfFiredForFree"); } } [HarmonyPrefix] private static void GunShootSingleProjectilePrefix(Gun __instance, ProjectileModule mod, ProjectileData overrideProjectileData = null, GameObject overrideBulletObject = null) { WeirdProjectile._CurrentProjectileGun.Push(__instance); WeirdProjectile._CurrentProjectileMod.Push(mod); } [HarmonyPostfix] private static void GunShootSingleProjectilePostfix(Gun __instance, ProjectileModule mod, ProjectileData overrideProjectileData = null, GameObject overrideBulletObject = null) { WeirdProjectile._CurrentProjectileMod.Pop(); WeirdProjectile._CurrentProjectileGun.Pop(); } } [HarmonyPatch(typeof(PlayerItem), "DidDamage")] internal static class PlayerItemDidDamagePatch { public static void Prefix(PlayerItem __instance, PlayerController Owner, ref float damageDone) { if (Object.op_Implicit((Object)(object)Owner) && Owner.HasSynergy(Synergy.MR_ALLIGATOX)) { damageDone *= 2f; } } } [HarmonyPatch(typeof(PlayerItem), "ApplyCooldown")] internal static class PlayerItemApplyCooldownPatch { private static void Postfix(PlayerItem __instance, PlayerController user) { if (__instance is GrapplingHookItem && user.HasSynergy(Synergy.BIONIC_COMMANDO)) { __instance.ClearCooldowns(); } } } [HarmonyPatch(typeof(AIActor), "Start")] internal static class ReplaceEnemyGunsPatch { private static Items _BlasTechID = (Items)(-1); private static void Prefix(AIActor __instance) { if (!DoBlastechReplacement(__instance)) { DoBubbleWandReplacement(__instance); } } private static bool DoBlastechReplacement(AIActor enemy) { if (!Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).aiShooter)) { return false; } if (!Synergy.MASTERY_BLASTECH_F4.Active()) { return false; } if (_BlasTechID < Items.MagicLamp) { _BlasTechID = (Items)Lazy.PickupId(); } enemy.ReplaceGun(_BlasTechID); return true; } private static bool DoBubbleWandReplacement(AIActor enemy) { if (!Lazy.AnyoneHas()) { return false; } if (Object.op_Implicit((Object)(object)((BraveBehaviour)enemy).aiShooter)) { HealthHaver healthHaver = ((BraveBehaviour)enemy).healthHaver; if (healthHaver != null && !healthHaver.IsBoss && !healthHaver.IsSubboss) { if (!Lazy.CoinFlip() && (!Lazy.CoinFlip() || !Synergy.DUBBLE_BUBBLE.Active())) { return false; } enemy.ReplaceGun(Items.BubbleBlaster); AIShooter aiShooter = ((BraveBehaviour)enemy).aiShooter; aiShooter.PostProcessProjectile = (Action)Delegate.Combine(aiShooter.PostProcessProjectile, new Action(BubbleWand.PostProcessProjectile)); return true; } } return false; } } [HarmonyPatch] internal static class HeartUIPatch { private static int _AdrenalineShotId = -1; private static int _LichguardId = -1; private static int _SunderbussId = -1; private static int _MacheeningId = -1; [HarmonyPatch(typeof(GameUIHeartController), "ProcessHeartSpriteModifications")] private static void Postfix(GameUIHeartController __instance, PlayerController associatedPlayer) { if (_AdrenalineShotId == -1) { _AdrenalineShotId = Lazy.PickupId(); _LichguardId = Lazy.PickupId(); _SunderbussId = Lazy.PickupId(); _MacheeningId = Lazy.PickupId(); } if (associatedPlayer.GetPassive(_AdrenalineShotId) is AdrenalineShot { _adrenalineActive: not false }) { __instance.m_currentFullHeartName = "adrenaline_heart_full_ui"; __instance.m_currentHalfHeartName = "adrenaline_heart_half_ui"; __instance.m_currentEmptyHeartName = "adrenaline_heart_empty_ui"; return; } Gun currentGun = ((GameActor)associatedPlayer).CurrentGun; if (currentGun != null && (((PickupObject)currentGun).PickupObjectId == _SunderbussId || ((PickupObject)currentGun).PickupObjectId == _MacheeningId) && !associatedPlayer.HasPassive(_LichguardId)) { __instance.m_currentFullHeartName = "lichguard_heart_full_ui"; __instance.m_currentHalfHeartName = "lichguard_heart_half_ui"; } } } [HarmonyPatch(typeof(EncounterTrackable), "GetModifiedDisplayName")] internal static class DisplayMasteryInGunNamePatch { private const string JAMMED_STRING = "[color #bb3333]J[/color][color #aa3333]a[/color][color #993333]m[/color][color #883333]m[/color][color #773333]e[/color][color #663333]d[/color]"; private const string PRISTINE_STRING = "[color #bbbbdd]M[/color][color #aabbdd]i[/color][color #99bbdd]n[/color][color #88bbdd]t[/color][color #77bbdd] [/color][color #66bbdd]C[/color][color #55bbdd]o[/color][color #44bbdd]n[/color][color #33bbdd]d[/color][color #22bbdd]i[/color][color #11bbdd]t[/color][color #00bbdd]i[/color][color #00aadd]o[/color][color #0099dd]n[/color]"; private const string GLASS_STRING = "[color #ddddff]G[/color][color #9999dd]l[/color][color #ddddff]a[/color][color #9999dd]s[/color][color #ddddff]s[/color]"; private const string MASTERED_STRING = "[color #dd6666]Mastered[/color]"; private const string NORMAL_STRING = "[color #888888]Normal[/color]"; private static readonly int[] _CachedGunId = new int[2] { 2147483647, 2147483647 }; private static readonly string[] _CachedGunString = new string[2]; private static StringBuilder _SB = new StringBuilder("", 1000); private static void Postfix(EncounterTrackable __instance, ref string __result) { Gun component = ((Component)__instance).gameObject.GetComponent(); if (component == null) { return; } GameActor owner = component.m_owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val == null) { return; } int playerIDX = val.PlayerIDX; if (((PickupObject)component).PickupObjectId == _CachedGunId[playerIDX]) { __result = _CachedGunString[playerIDX]; return; } _SB.Length = 0; if (PassiveItem.IsFlagSetForCharacter(val, typeof(DisplayPedestal)) && Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent())) { if (_SB.Length > 0) { _SB.Append(" "); } _SB.Append("[color #bbbbdd]M[/color][color #aabbdd]i[/color][color #99bbdd]n[/color][color #88bbdd]t[/color][color #77bbdd] [/color][color #66bbdd]C[/color][color #55bbdd]o[/color][color #44bbdd]n[/color][color #33bbdd]d[/color][color #22bbdd]i[/color][color #11bbdd]t[/color][color #00bbdd]i[/color][color #00aadd]o[/color][color #0099dd]n[/color]"); } if (Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent())) { if (_SB.Length > 0) { _SB.Append(" "); } _SB.Append("[color #bb3333]J[/color][color #aa3333]a[/color][color #993333]m[/color][color #883333]m[/color][color #773333]e[/color][color #663333]d[/color]"); } if (Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent())) { if (_SB.Length > 0) { _SB.Append(" "); } _SB.Append("[color #ddddff]G[/color][color #9999dd]l[/color][color #ddddff]a[/color][color #9999dd]s[/color][color #ddddff]s[/color]"); } CwaffGun component2 = ((Component)__instance).gameObject.GetComponent(); if (component2 != null && component2.CanBeMastered()) { if (_SB.Length > 0) { _SB.Append(" "); } _SB.Append(component2.Mastered ? "[color #dd6666]Mastered[/color]" : "[color #888888]Normal[/color]"); } if (_SB.Length > 0) { _SB.Append("\n"); _SB.Append(__result); __result = (_CachedGunString[playerIDX] = _SB.ToString()); } else { _CachedGunString[playerIDX] = __result; } _CachedGunId[playerIDX] = ((PickupObject)component).PickupObjectId; } } [HarmonyPatch] internal static class AttackWhileRollingPatch { [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyILManipulator] private static void AttackWhileRollingIL(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_IsDodgeRolling") })) { val.Emit(OpCodes.Ldarg_0); val.CallPrivate(typeof(AttackWhileRollingPatch), "CanAttackWhileDodgeRolling"); } } private static bool CanAttackWhileDodgeRolling(bool isDodgeRolling, PlayerController player) { if (!isDodgeRolling) { return false; } if (PassiveItem.IsFlagSetForCharacter(player, typeof(CombatLeotard))) { return false; } Gun currentGun = ((GameActor)player).CurrentGun; if (currentGun != null) { CwaffGun component = ((Component)currentGun).gameObject.GetComponent(); if (component != null && component.canAttackWhileRolling) { return false; } } return true; } [HarmonyPatch(typeof(PlayerController), "ToggleGunRenderers")] [HarmonyPatch(typeof(PlayerController), "ToggleHandRenderers")] [HarmonyPrefix] private static bool KeepRenderersOnWhileDodgeRollingPatch(PlayerController __instance, bool value, string reason) { if (value || reason != "dodgeroll") { return true; } if (PassiveItem.IsFlagSetForCharacter(__instance, typeof(CombatLeotard))) { return false; } Gun currentGun = ((GameActor)__instance).CurrentGun; if (currentGun != null) { CwaffGun component = ((Component)currentGun).gameObject.GetComponent(); if (component != null && component.canAttackWhileRolling) { return false; } } return true; } } [HarmonyPatch] internal static class AllowMoreThan30KnockbackPatch { [HarmonyPatch(typeof(KnockbackDoer), "Update")] [HarmonyILManipulator] private static void KnockbackDoerUpdatePatchIL(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) //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.MatchLdcR4(instr, 30f) })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc_S, (byte)10); val.CallPrivate(typeof(AllowMoreThan30KnockbackPatch), "AllowMoreThan30Knockback"); } } private static float AllowMoreThan30Knockback(float oldKnockbackCap, KnockbackDoer self, float magnitude) { if (magnitude < oldKnockbackCap) { return oldKnockbackCap; } return ((Component)self).gameObject.GetComponent()?.knockbackCap ?? oldKnockbackCap; } } [HarmonyPatch(typeof(BasicBeamController), "FrameUpdate")] internal static class BeamApplyArbitraryStatusEffectPatch { [HarmonyILManipulator] private static void BeamApplyArbitraryStatusEffectIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_005c: 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) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)0, new Func[2] { (Instruction instr) => ILPatternMatchingExt.MatchCall(instr, "get_projectile"), (Instruction instr) => ILPatternMatchingExt.MatchLdfld(instr, "AppliesSpeedModifier") })) { val.Emit(OpCodes.Ldloc_S, (byte)30); val.CallPrivate(typeof(BeamApplyArbitraryStatusEffectPatch), "ApplyExtraBeamStatusEffects"); val.Emit(OpCodes.Ldarg_0); } } private static void ApplyExtraBeamStatusEffects(BeamController beam, GameActor gameActor) { foreach (GameActorEffect item in ((BraveBehaviour)beam).projectile.statusEffectsToApply) { if (Random.value < BraveMathCollege.SliceProbability(beam.statusEffectChance, BraveTime.DeltaTime)) { gameActor.ApplyEffect(item, 1f, ((BraveBehaviour)beam).projectile); } } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal static class HandleExplosionPatch { [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_0048: 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_00aa: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: 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) ILCursor val = new ILCursor(il); VariableDefinition val2 = il.DeclareLocal(); 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(HandleExplosionPatch), "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_S, (byte)13); val.CallPrivate(typeof(HandleExplosionPatch), "CheckImmuneToExplosions"); val.CallPrivate(typeof(HandleExplosionPatch), "Or"); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdfld(instr, "preventPlayerForce") })) { val.Emit(OpCodes.Ldloc_S, (byte)13); val.CallPrivate(typeof(HandleExplosionPatch), "CheckImmuneToExplosions"); val.CallPrivate(typeof(HandleExplosionPatch), "Or"); val.Emit(OpCodes.Ldloc, val2); val.CallPrivate(typeof(HandleExplosionPatch), "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 PlayerHasStuntHelmet(PlayerController player) { if (Object.op_Implicit((Object)(object)player)) { return player.HasPassive(); } return false; } private static bool CheckImmuneToExplosions(PlayerController player) { if (Object.op_Implicit((Object)(object)player)) { return player.IsImmuneToExplosions(); } return false; } 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; } } public static class HeckedMode { public enum Hecked { Disabled, Classic, Light, Remixed, Molotov, Grenade, Retrashed } [HarmonyPatch(typeof(ShootGunBehavior), "ContinuousUpdate")] private class DisablePrefireStateDuringHeckedModePatch { [HarmonyILManipulator] private static void DisablePrefireStateDuringHeckedModeIL(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.MatchCallvirt(instr, "get_IsPreFireComplete") })) { val.CallPrivate(typeof(HeckedMode), "HeckedModeShouldSkipPrefireStateCheck"); } } } [HarmonyPatch(typeof(ShootGunBehavior), "Start")] private class DisablePrefireAnimationDuringHeckedModePatch { [HarmonyILManipulator] private static void DisablePrefireAnimationDuringHeckedModeIL(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, "enemyPreFireAnimation") })) { val.Remove(); val.CallPrivate(typeof(HeckedMode), "HeckedModeShouldSkipPrefireAnimationCheck"); } } } [HarmonyPatch(typeof(AIShooter), "Shoot")] private class AIShooterShootClearBeamPatch { private static void Prefix(AIShooter __instance) { Gun currentGun = __instance.CurrentGun; if (currentGun != null && currentGun.m_activeBeams != null) { currentGun.ClearBeams(); } } } [HarmonyPatch(typeof(AIShooter), "OnPreDeath")] private class AIShooterDeathClearBeamPatch { private static void Prefix(AIShooter __instance) { Gun currentGun = __instance.CurrentGun; if (currentGun != null && currentGun.m_activeBeams != null) { currentGun.ClearBeams(); } } } [HarmonyPatch(typeof(Gun), "DropGun")] private class GunDropGunClearBeamPatch { private static void Prefix(Gun __instance) { if (__instance.m_activeBeams != null) { __instance.ClearBeams(); } } } [HarmonyPatch(typeof(Gun), "OnDisable")] private class GunDisableClearBeamPatch { private static void Prefix(Gun __instance) { if (__instance.m_activeBeams != null) { __instance.ClearBeams(); } } } [HarmonyPatch(typeof(Gun), "OnDestroy")] private class GunDestroyClearBeamPatch { private static void Prefix(Gun __instance) { if (__instance.m_activeBeams != null) { __instance.ClearBeams(); } } } [HarmonyPatch(typeof(AIActor), "Awake")] private class HeckedEnemyAwakePatch { private static void Prefix(AIActor __instance) { if (_HeckedModeStatus != Hecked.Disabled && !__instance.IsABoss()) { Items item = ((_HeckedModeStatus == Hecked.Retrashed) ? ((Items)HeckedModeGunWhiteList[Random.Range(0, _FirstWeakGun)]) : ((_HeckedModeStatus == Hecked.Light) ? ((Items)HeckedModeGunWhiteList[Random.Range(_FirstWeakGun, HeckedModeGunWhiteList.Count)]) : ((_HeckedModeStatus == Hecked.Remixed) ? ((Items)HeckedModeGunWhiteList[Random.Range(_FirstFairGun, HeckedModeGunWhiteList.Count)]) : ((_HeckedModeStatus == Hecked.Grenade) ? Items.GrenadeLauncher : ((_HeckedModeStatus != Hecked.Molotov) ? ((Items)HeckedModeGunWhiteList[Random.Range(_FirstNonBeam, HeckedModeGunWhiteList.Count)]) : Items.MolotovLauncher))))); __instance.HeckedShootGunBehavior(item.AsGun()); } } } [HarmonyPatch(typeof(Gun), "OnDestroy")] private class GunOnDestroyPatch { private static void Prefix(Gun __instance) { if (GameManager.AUDIO_ENABLED) { AkSoundEngine.PostEvent("Stop_WPN_gun_loop_01", ((Component)__instance).gameObject); } } } [HarmonyPatch(typeof(AIShooter), "Initialize")] private class HeckedRemoveBadComponentsPatch { private static void Postfix(AIShooter __instance) { if (!Object.op_Implicit((Object)(object)__instance)) { return; } Gun currentGun = __instance.CurrentGun; if (currentGun != null) { ((Component)currentGun).GetComponent().SafeDestroy(); ((Component)currentGun).GetComponent().SafeDestroy(); ((Component)currentGun).GetComponent().SafeDestroy(); ((Component)currentGun).GetComponent().SafeDestroy(); ((Component)currentGun).GetComponent().SafeDestroy(); StealthOnReloadPressed component = ((Component)currentGun).GetComponent(); if (component != null) { currentGun.OnAutoReload = (Action)Delegate.Remove(currentGun.OnAutoReload, new Action(component.HandleReloadPressedSimple)); currentGun.OnReloadPressed = (Action)Delegate.Remove(currentGun.OnReloadPressed, new Action(component.HandleReloadPressed)); component.SafeDestroy(); } currentGun.RequiresFundsToShoot = false; currentGun.IsTrickGun = false; } } } [HarmonyPatch(typeof(Chest), "RoomEntered")] private class HeckedFusedChestPatch { [HarmonyILManipulator] private static void FusedChestHookIL(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[2] { (Instruction instr) => ILPatternMatchingExt.MatchCall(instr, "get_value"), (Instruction instr) => ILPatternMatchingExt.MatchLdloc(instr, 0) })) { val.CallPrivate(typeof(HeckedMode), "AdjustHeckedFuseTimers"); } } } [HarmonyPatch(typeof(TargetPlayerBehavior), "Update")] private class HeckedNoStealthPatch { [HarmonyILManipulator] private static void NoStealthForYouIL(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.MatchCallvirt(instr, "get_IsStealthed") })) { val.CallPrivate(typeof(HeckedMode), "IsReallyStealthed"); } } } [HarmonyPatch(typeof(GameManager), "GetActivePlayerClosestToPoint")] private class HeckedIgnoreStealthPatch { private static void Prefix(Vector2 point, ref bool allowStealth) { allowStealth |= _HeckedModeStatus == Hecked.Retrashed; } } [HarmonyPatch(typeof(AIActor), "CheckForBlackPhantomness")] private class ForceJammedBossesPatch { [HarmonyILManipulator] private static void ForceJammedBossesIL(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.MatchLdfld(instr, "ForceBlackPhantom") })) { val.Emit(OpCodes.Ldarg_0); val.CallPrivate(typeof(HeckedMode), "ForceJammedBosses"); } } } [HarmonyPatch(typeof(Gun), "ClearCooldowns")] [HarmonyPatch(typeof(Gun), "ClearReloadData")] private class FixModuleDataPatch { private static void Prefix(Gun __instance) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown if ((Object)(object)__instance.Volley != (Object)null) { foreach (ProjectileModule projectile in __instance.Volley.projectiles) { if (!__instance.m_moduleData.TryGetValue(projectile, out var _)) { __instance.m_moduleData[projectile] = new ModuleShootData(); } } return; } if (!__instance.m_moduleData.TryGetValue(__instance.singleModule, out var _)) { __instance.m_moduleData[__instance.singleModule] = new ModuleShootData(); } } } [HarmonyPatch(typeof(SharedDungeonSettings), "RandomShouldSpawnPotFairy")] private class SharedDungeonSettingsRandomShouldSpawnPotFairyPatch { [HarmonyILManipulator] private static void SharedDungeonSettingsRandomShouldSpawnPotFairyIL(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, "PotFairyChance") })) { val.CallPrivate(typeof(SharedDungeonSettingsRandomShouldSpawnPotFairyPatch), "AlwaysAPotFairy"); } } private static float AlwaysAPotFairy(float origVal) { if (_HeckedModeStatus != Hecked.Retrashed) { return origVal; } return 1f; } } [HarmonyPatch(typeof(PlayerController), "BraveOnLevelWasLoaded")] private class PlayerControllerBraveOnLevelWasLoadedPatch { [HarmonyILManipulator] private static void PlayerControllerBraveOnLevelWasLoadedIL(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, "NumBlanksPerFloor") })) { val.CallPrivate(typeof(PlayerControllerBraveOnLevelWasLoadedPatch), "NoFreeBlanks"); } if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdfld(instr, "NumBlanksPerFloorCoop") })) { val.CallPrivate(typeof(PlayerControllerBraveOnLevelWasLoadedPatch), "NoFreeBlanks"); } } private static int NoFreeBlanks(int origVal) { if (_HeckedModeStatus != Hecked.Retrashed) { return origVal; } return 0; } } [HarmonyPatch(typeof(AIShooter), "OnPreDeath")] private class AIShooterOnPreDeathPatch { private static void Postfix(AIShooter __instance) { if (_HeckedModeStatus != Hecked.Remixed) { return; } Gun currentGun = __instance.CurrentGun; if (currentGun != null) { if (GameManager.AUDIO_ENABLED) { AkSoundEngine.PostEvent("Stop_WPN_gun_loop_01", ((Component)currentGun).gameObject); } currentGun.ToggleRenderers(true); Gun componentInChildren = ((Component)currentGun.DropGun(0.5f)).gameObject.GetComponentInChildren(); if (componentInChildren != null) { componentInChildren.CurrentAmmo = Mathf.CeilToInt(0.05f * (float)componentInChildren.GetBaseMaxAmmo()); componentInChildren.ToggleRenderers(true); } } } } [HarmonyPatch(typeof(ShootGunBehavior), "FindPredictedTargetPosition")] private static class ShootGunBehaviorFindPredictedTargetPositionPatch { private static bool Prefix(ShootGunBehavior __instance) { if (((BehaviorBase)__instance).m_aiShooter.GetBulletEntry(__instance.OverrideBulletName) == null) { return false; } if (!Object.op_Implicit((Object)(object)((BraveBehaviour)((BehaviorBase)__instance).m_aiActor).specRigidbody)) { return false; } return true; } } internal static Hecked _HeckedModeStatus = Hecked.Disabled; public static readonly List HeckedModeGunWhiteList = new List { 20, 179, 331, 208, 87, 370, 90, 542, 540, 508, 444, 406, 394, 383, 153, 54, 27, 49, 17, 358, 597, 594, 562, 512, 503, 482, 479, 478, 445, 401, 376, 369, 328, 199, 182, 151, 146, 143, 142, 52, 37, 129, 128, 84, 576, 19, 16, 32, 748, 329, 626, 601, 593, 577, 566, 550, 543, 537, 517, 504, 476, 472, 464, 384, 382, 380, 379, 377, 372, 360, 359, 347, 346, 341, 338, 336, 335, 330, 327, 345, 229, 227, 225, 223, 207, 186, 184, 178, 175, 157, 156, 154, 152, 150, 145, 130, 96, 95, 94, 93, 88, 83, 80, 61, 50, 47, 43, 42, 38, 35, 31, 30, 25, 23, 8, 6, 5, 3, 404, 387, 385, 207, 154, 91, 26, 18, 14, 2, 604, 15, 82, 125, 124, 334, 477, 402, 480, 656, 761, 602, 598, 596, 563, 516, 513, 484, 393, 378, 365, 332, 275, 231, 230, 228, 202, 197, 183, 181, 180, 99, 89, 86, 81, 79, 62, 56, 55, 53, 51, 33, 24, 22, 13, 9, 7, 0, 520, 483, 123, 39, 59, 97, 1, 4, 98, 92, 126, 339, 506, 149, 45, 507, 539, 475, 541, 198, 599, 481, 362, 357, 292, 474, 368 }; public static readonly int _FirstWeakGun = HeckedModeGunWhiteList.IndexOf(480); public static readonly int _FirstNonBeam = HeckedModeGunWhiteList.IndexOf(370); public static readonly int _FirstFairGun = HeckedModeGunWhiteList.IndexOf(329); internal const string _CONFIG_KEY = "Hecked Mode"; private static AIActor _BulletKin = null; public static void Init() { CwaffEvents.BeforeRunStart = (Action)Delegate.Combine(CwaffEvents.BeforeRunStart, new Action(SetupHeckedMode)); CwaffEvents.OnKeepFullyLoaded = (Action)Delegate.Combine(CwaffEvents.OnKeepFullyLoaded, new Action(OnFirstHeckedFloorLoaded)); } private static void SetupHeckedMode() { _HeckedModeStatus = CwaffConfig._Gunfig.Value("Hecked Mode") switch { "Disabled" => Hecked.Disabled, "Hecked" => Hecked.Classic, "Light" => Hecked.Light, "Remixed" => Hecked.Remixed, "Molotov" => Hecked.Molotov, "Grenade" => Hecked.Grenade, "Retrashed" => Hecked.Retrashed, _ => Hecked.Disabled, }; } private static void OnFirstHeckedFloorLoaded() { if (_HeckedModeStatus == Hecked.Retrashed) { GameManager.Instance.PrimaryPlayer.ownerlessStatModifiers.Add(((StatType)13).Mult(10f)); GameManager.Instance.PrimaryPlayer.stats.RecalculateStats(GameManager.Instance.PrimaryPlayer, false, false); } } private static bool HeckedModeShouldSkipPrefireAnimationCheck(string s) { if (_HeckedModeStatus == Hecked.Disabled) { return string.IsNullOrEmpty(s); } return true; } private static bool HeckedModeShouldSkipPrefireStateCheck(bool wouldSkipAnyway) { return _HeckedModeStatus != Hecked.Disabled || wouldSkipAnyway; } private static float AdjustHeckedFuseTimers(float original) { if (_HeckedModeStatus != Hecked.Retrashed) { return original; } return 1f; } private static bool IsReallyStealthed(bool stealthed) { if (stealthed) { return _HeckedModeStatus != Hecked.Retrashed; } return false; } private static bool ForceJammedBosses(bool original, AIActor actor) { if (!original) { if (_HeckedModeStatus == Hecked.Retrashed && Object.op_Implicit((Object)(object)actor) && Object.op_Implicit((Object)(object)((BraveBehaviour)actor).healthHaver)) { if (!((BraveBehaviour)actor).healthHaver.IsBoss) { return ((BraveBehaviour)actor).healthHaver.IsSubboss; } return true; } return false; } return true; } private static void CopyAIBulletBank(this AIBulletBank me, AIBulletBank other) { me.Bullets = other.Bullets; me.useDefaultBulletIfMissing = other.useDefaultBulletIfMissing; me.transforms = other.transforms; me.OnProjectileCreated = other.OnProjectileCreated; me.OnProjectileCreatedWithSource = other.OnProjectileCreatedWithSource; me.FixedPlayerPosition = other.FixedPlayerPosition; } private static void CopyAIShooter(this AIShooter me, AIShooter other) { //IL_0092: 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_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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown //IL_011c: Unknown result type (might be due to invalid IL or missing references) me.volley = other.volley; me.equippedGunId = other.equippedGunId; me.shouldUseGunReload = other.shouldUseGunReload; me.volleyShellCasing = other.volleyShellCasing; me.volleyShootVfx = other.volleyShootVfx; me.usesOctantShootVFX = other.usesOctantShootVFX; me.bulletName = other.bulletName; me.customShootCooldownPeriod = other.customShootCooldownPeriod; me.doesScreenShake = other.doesScreenShake; me.rampBullets = other.rampBullets; me.rampStartHeight = other.rampStartHeight; me.rampTime = other.rampTime; me.overallGunAttachOffset = other.overallGunAttachOffset; me.flippedGunAttachOffset = other.flippedGunAttachOffset; me.handObject = other.handObject; me.AllowTwoHands = other.AllowTwoHands; me.ForceGunOnTop = other.ForceGunOnTop; me.IsReallyBigBoy = other.IsReallyBigBoy; me.BackupAimInMoveDirection = other.BackupAimInMoveDirection; me.PostProcessProjectile = other.PostProcessProjectile; me.volleyShootPosition = null; me.volleyShellTransform = null; me.bulletScriptAttachPoint = null; GameObject val = new GameObject("attachyboi"); val.transform.position = ((BraveBehaviour)me).transform.position; val.transform.parent = ((BraveBehaviour)me).transform; me.gunAttachPoint = val.transform; } private static ShootGunBehavior CopyShootGunBehavior(this ShootGunBehavior other) { //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_0011: 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_0029: 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_0041: 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: 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_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) //IL_0089: 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_00a1: 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_00b9: 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_00d1: 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) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_013d: 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_0155: 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_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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0185: 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_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: 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_01cd: 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_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0239: 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_0252: Expected O, but got Unknown return new ShootGunBehavior { Cooldown = ((BasicAttackBehavior)other).Cooldown, CooldownVariance = ((BasicAttackBehavior)other).CooldownVariance, AttackCooldown = ((BasicAttackBehavior)other).AttackCooldown, GlobalCooldown = ((BasicAttackBehavior)other).GlobalCooldown, InitialCooldown = ((BasicAttackBehavior)other).InitialCooldown, InitialCooldownVariance = ((BasicAttackBehavior)other).InitialCooldownVariance, GroupName = ((BasicAttackBehavior)other).GroupName, GroupCooldown = ((BasicAttackBehavior)other).GroupCooldown, MinRange = ((BasicAttackBehavior)other).MinRange, Range = ((BasicAttackBehavior)other).Range, MinWallDistance = ((BasicAttackBehavior)other).MinWallDistance, MaxEnemiesInRoom = ((BasicAttackBehavior)other).MaxEnemiesInRoom, MinHealthThreshold = ((BasicAttackBehavior)other).MinHealthThreshold, MaxHealthThreshold = ((BasicAttackBehavior)other).MaxHealthThreshold, HealthThresholds = ((BasicAttackBehavior)other).HealthThresholds, AccumulateHealthThresholds = ((BasicAttackBehavior)other).AccumulateHealthThresholds, targetAreaStyle = ((BasicAttackBehavior)other).targetAreaStyle, IsBlackPhantom = ((BasicAttackBehavior)other).IsBlackPhantom, resetCooldownOnDamage = ((BasicAttackBehavior)other).resetCooldownOnDamage, RequiresLineOfSight = ((BasicAttackBehavior)other).RequiresLineOfSight, MaxUsages = ((BasicAttackBehavior)other).MaxUsages, m_cooldownTimer = ((BasicAttackBehavior)other).m_cooldownTimer, m_resetCooldownOnDamageCooldown = ((BasicAttackBehavior)other).m_resetCooldownOnDamageCooldown, m_healthThresholdCredits = ((BasicAttackBehavior)other).m_healthThresholdCredits, m_lowestRecordedHealthPercentage = ((BasicAttackBehavior)other).m_lowestRecordedHealthPercentage, m_numTimesUsed = ((BasicAttackBehavior)other).m_numTimesUsed, GroupCooldownVariance = other.GroupCooldownVariance, LineOfSight = other.LineOfSight, WeaponType = other.WeaponType, OverrideBulletName = other.OverrideBulletName, BulletScript = other.BulletScript, FixTargetDuringAttack = other.FixTargetDuringAttack, StopDuringAttack = other.StopDuringAttack, LeadAmount = other.LeadAmount, LeadChance = other.LeadChance, RespectReload = other.RespectReload, MagazineCapacity = other.MagazineCapacity, ReloadSpeed = other.ReloadSpeed, EmptiesClip = other.EmptiesClip, SuppressReloadAnim = other.SuppressReloadAnim, TimeBetweenShots = other.TimeBetweenShots, PreventTargetSwitching = other.PreventTargetSwitching, OverrideAnimation = other.OverrideAnimation, OverrideDirectionalAnimation = other.OverrideDirectionalAnimation, HideGun = other.HideGun, UseLaserSight = other.UseLaserSight, UseGreenLaser = other.UseGreenLaser, PreFireLaserTime = other.PreFireLaserTime, AimAtFacingDirectionWhenSafe = other.AimAtFacingDirectionWhenSafe }; } private static void ShowAllBehaviors(this AIActor enemy) { if (!C.DEBUG_BUILD) { return; } ETGModConsole.Log((object)("showing behaviors for " + ((GameActor)enemy).ActorName), false); BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)enemy).behaviorSpeculator; if (behaviorSpeculator == null) { ETGModConsole.Log((object)" no behaviorspeculator", false); return; } foreach (TargetBehaviorBase item in behaviorSpeculator.TargetBehaviors.EmptyIfNull()) { ETGModConsole.Log((object)(" target: " + ((object)item).GetType().Name), false); } foreach (MovementBehaviorBase item2 in behaviorSpeculator.MovementBehaviors.EmptyIfNull()) { ETGModConsole.Log((object)(" movement: " + ((object)item2).GetType().Name), false); } foreach (AttackBehaviorBase item3 in behaviorSpeculator.AttackBehaviors.EmptyIfNull()) { ETGModConsole.Log((object)(" attack: " + ((object)item3).GetType().Name), false); } foreach (BehaviorBase item4 in behaviorSpeculator.OtherBehaviors.EmptyIfNull()) { ETGModConsole.Log((object)(" other: " + ((object)item4).GetType().Name), false); } foreach (OverrideBehaviorBase item5 in behaviorSpeculator.OverrideBehaviors.EmptyIfNull()) { ETGModConsole.Log((object)(" override: " + ((object)item5).GetType().Name), false); } } public static AIShooter EnableGunShooting(this AIActor enemy, Gun replacementGun) { //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown if (_BulletKin == null) { _BulletKin = EnemyDatabase.GetOrLoadByGuid("01972dee89fc4404a5c408d50007dad5"); } if (!Object.op_Implicit((Object)(object)((Component)enemy).gameObject.GetComponent())) { ((Component)enemy).gameObject.AddComponent().CopyAIBulletBank(((BraveBehaviour)_BulletKin).bulletBank); } AIShooter val = ((Component)enemy).gameObject.AddComponent(); val.CopyAIShooter(((BraveBehaviour)_BulletKin).aiShooter); ((BraveBehaviour)val).RegenerateCache(); val.equippedGunId = ((PickupObject)replacementGun).PickupObjectId; val.customShootCooldownPeriod = 0f; val.bulletName = null; BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)val).behaviorSpeculator; if (behaviorSpeculator.TargetBehaviors == null) { behaviorSpeculator.TargetBehaviors = new List(); } if (((BraveBehaviour)val).behaviorSpeculator.TargetBehaviors.Count == 0) { ((BraveBehaviour)val).RegenerateCache(); if (Object.op_Implicit((Object)(object)((Component)enemy).GetComponent())) { TargetPlayerBehavior val2 = new TargetPlayerBehavior(); ((BraveBehaviour)val).behaviorSpeculator.TargetBehaviors.Add((TargetBehaviorBase)(object)val2); ((BehaviorBase)val2).Init(((Component)enemy).gameObject, enemy, val); ((BehaviorBase)val2).Start(); ((BraveBehaviour)val).behaviorSpeculator.m_behaviors.Add((BehaviorBase)(object)val2); } else { TargetEnemiesBehavior val3 = new TargetEnemiesBehavior(); ((BraveBehaviour)val).behaviorSpeculator.TargetBehaviors.Add((TargetBehaviorBase)(object)val3); ((BehaviorBase)val3).Init(((Component)enemy).gameObject, enemy, val); ((BehaviorBase)val3).Start(); ((BraveBehaviour)val).behaviorSpeculator.m_behaviors.Add((BehaviorBase)(object)val3); } ((BraveBehaviour)val).RegenerateCache(); } behaviorSpeculator = ((BraveBehaviour)val).behaviorSpeculator; if (behaviorSpeculator.AttackBehaviors == null) { behaviorSpeculator.AttackBehaviors = new List(); } foreach (AttackBehaviorBase attackBehavior in ((BraveBehaviour)((BraveBehaviour)_BulletKin).aiShooter).behaviorSpeculator.AttackBehaviors) { ShootGunBehavior val4 = (ShootGunBehavior)(object)((attackBehavior is ShootGunBehavior) ? attackBehavior : null); if (val4 != null) { ShootGunBehavior val5 = val4.CopyShootGunBehavior(); ((BasicAttackBehavior)val5).m_behaviorSpeculator = ((BraveBehaviour)val).behaviorSpeculator; ((BraveBehaviour)val).behaviorSpeculator.AttackBehaviors.Add((AttackBehaviorBase)(object)val5); ((BehaviorBase)val5).Init(((Component)enemy).gameObject, enemy, val); ((BehaviorBase)val5).Start(); ((BraveBehaviour)val).behaviorSpeculator.m_behaviors.Add((BehaviorBase)(object)val5); ((BraveBehaviour)val).RegenerateCache(); break; } } ((BraveBehaviour)val).RegenerateCache(); ((BraveBehaviour)((BraveBehaviour)val).behaviorSpeculator).aiActor = enemy; foreach (MovementBehaviorBase movementBehavior in ((BraveBehaviour)val).behaviorSpeculator.MovementBehaviors) { ((BehaviorBase)movementBehavior).m_aiActor = enemy; } ((BraveBehaviour)val).RegenerateCache(); return val; } public static void ArmToTheTeeth(this AIShooter shooter, Gun replacementGun) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_00bd: Unknown result type (might be due to invalid IL or missing references) ProjectileModule defaultModule = replacementGun.DefaultModule; Projectile val = (((int)defaultModule.shootStyle == 3 && defaultModule.chargeProjectiles != null && defaultModule.chargeProjectiles.Count > 0) ? defaultModule.FirstValidChargeProjectile() : defaultModule.projectiles[0]) ?? ((replacementGun.singleModule != null) ? replacementGun.singleModule.projectiles.SafeFirst() : null) ?? throw new Exception("failed to get Hecked Mode projectile for gun " + ((PickupObject)replacementGun).EncounterNameOrDisplayName); shooter.equippedGunId = ((PickupObject)replacementGun).PickupObjectId; shooter.customShootCooldownPeriod = 0f; shooter.bulletName = null; foreach (AttackBehaviorBase attackBehavior in ((BraveBehaviour)shooter).behaviorSpeculator.AttackBehaviors) { ShootGunBehavior val2 = (ShootGunBehavior)(object)((attackBehavior is ShootGunBehavior) ? attackBehavior : null); if (val2 != null) { val2.WeaponType = (WeaponType)0; val2.OverrideBulletName = null; val2.m_preFireTime = 0f; ((BasicAttackBehavior)val2).Cooldown = 0f; val2.GroupCooldownVariance = 0f; val2.RespectReload = true; val2.EmptiesClip = true; val2.LeadAmount = 0f; val2.LeadChance = 0f; val2.TimeBetweenShots = replacementGun.DefaultModule.cooldownTime; val2.MagazineCapacity = replacementGun.ClipCapacity; val2.ReloadSpeed = replacementGun.reloadTime; ((BasicAttackBehavior)val2).Range = val.baseData.range; ((BasicAttackBehavior)val2).RequiresLineOfSight = true; val2.AimAtFacingDirectionWhenSafe = true; val2.StopDuringAttack = true; } } } public static void HeckedShootGunBehavior(this AIActor enemy, Gun replacementGun) { AIShooter val = ((BraveBehaviour)enemy).aiShooter; if (val == null) { if (_HeckedModeStatus == Hecked.Classic || _HeckedModeStatus == Hecked.Light || (_HeckedModeStatus != Hecked.Remixed && Object.op_Implicit((Object)(object)((Component)enemy).GetComponent()))) { return; } val = enemy.EnableGunShooting(replacementGun); } val.ArmToTheTeeth(replacementGun); } public static void ReplaceGun(this AIActor enemy, Items replacementGunId) { //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_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0195: 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_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_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: 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) if (!Object.op_Implicit((Object)(object)enemy)) { return; } AIShooter aiShooter = ((BraveBehaviour)enemy).aiShooter; if (aiShooter == null) { return; } Gun currentGun = aiShooter.CurrentGun; tk2dBaseSprite val = (Object.op_Implicit((Object)(object)currentGun) ? currentGun.GetSprite() : null); for (int num = ((BraveBehaviour)aiShooter).transform.childCount - 1; num >= 0; num--) { Transform child = ((BraveBehaviour)aiShooter).transform.GetChild(num); PlayerHandController component = ((Component)child).gameObject.GetComponent(); if (component != null) { if (Object.op_Implicit((Object)(object)((BraveBehaviour)aiShooter).healthHaver) && ((BraveBehaviour)aiShooter).healthHaver.bodySprites != null) { tk2dSprite component2 = ((Component)component).GetComponent(); ((BraveBehaviour)aiShooter).healthHaver.bodySprites.Remove((tk2dBaseSprite)(object)component2); } if (aiShooter.m_attachedHands != null) { aiShooter.m_attachedHands.Remove(component); } if (Object.op_Implicit((Object)(object)val)) { val.DetachRenderer(((BraveBehaviour)component).sprite); } child.parent = null; Object.Destroy((Object)(object)((Component)child).gameObject); } else if (((Object)child).name == "GunAttachPoint") { for (int num2 = ((Component)child).gameObject.transform.childCount - 1; num2 >= 0; num2--) { Transform child2 = ((Component)child).gameObject.transform.GetChild(num2); child2.parent = null; Object.Destroy((Object)(object)((Component)child2).gameObject); } } } if (Object.op_Implicit((Object)(object)val)) { if (Object.op_Implicit((Object)(object)((BraveBehaviour)aiShooter).sprite)) { ((BraveBehaviour)aiShooter).sprite.DetachRenderer(val); } SpriteOutlineManager.RemoveOutlineFromSprite(val, false); } aiShooter.equippedGunId = (int)replacementGunId; aiShooter.m_hasCachedGun = false; aiShooter.bulletName = null; if (aiShooter.attachPointCachedPosition != default(Vector3)) { Vector3 localPosition = aiShooter.attachPointCachedPosition - Vector2.op_Implicit(PhysicsEngine.PixelToUnit(aiShooter.overallGunAttachOffset)); aiShooter.gunAttachPoint.localPosition = localPosition; } foreach (AttackBehaviorBase attackBehavior in ((BraveBehaviour)aiShooter).behaviorSpeculator.AttackBehaviors) { ShootGunBehavior val2 = (ShootGunBehavior)(object)((attackBehavior is ShootGunBehavior) ? attackBehavior : null); if (val2 != null) { val2.WeaponType = (WeaponType)0; val2.OverrideBulletName = null; val2.LeadChance = 0f; val2.LeadAmount = 0f; } } aiShooter.Initialize(); if (Object.op_Implicit((Object)(object)aiShooter.CurrentGun) && Object.op_Implicit((Object)(object)((Component)aiShooter.CurrentGun).gameObject.GetComponent())) { aiShooter.CurrentGun.PreventNormalFireAudio = true; } } } public static class EnumExtenders { public static T ExtendEnum(this string s, string guid = "cg") where T : Enum { return ETGModCompatibility.ExtendEnum(guid.ToUpper(), s); } } public static class CwaffGunClass { public static readonly GunClass UTILITY = "UTILITY".ExtendEnum("cg"); } public static class CwaffShootBehaviorState { public static readonly State Relocating = "Relocating".ExtendEnum("cg"); } public static class CwaffItemQuality { public static readonly ItemQuality F = "F".ExtendEnum("Tier"); } public sealed class GunData { private static readonly GunData _Instance; public const int MATCH_ANIM = -2; public Gun gun; public Projectile baseProjectile; public int? clipSize; public float? cooldown; public float? angleVariance; public ShootStyle shootStyle; public ProjectileSequenceStyle sequenceStyle; public float chargeTime; public int ammoCost; public AmmoType? ammoType; public bool customClip; public float? damage; public float? speed; public float? force; public float? range; public float? recoil; public float poison; public float fire; public float freeze; public float slow; public bool? collidesWithEnemies; public bool? ignoreDamageCaps; public bool? collidesWithProjectiles; public bool? surviveRigidbodyCollisions; public bool? collidesWithTilemap; public string sprite; public int fps; public Anchor anchor; public float scale; public bool anchorsChangeColliders; public bool fixesScales; public IntVector2? overrideColliderPixelSizes; public IntVector2? overrideColliderOffsets; public float bossDamageMult; public string destroySound; public bool? shouldRotate; public int barrageSize; public bool? shouldFlipHorizontally; public bool? shouldFlipVertically; public bool useDummyChargeModule; public bool invisibleProjectile; public float angleFromAim; public bool ignoredForReloadPurposes; public bool mirror; public string spawnSound; public bool? stopSoundOnDeath; public bool? uniqueSounds; public GameObject shrapnelVFX; public int? shrapnelCount; public float? shrapnelMinVelocity; public float? shrapnelMaxVelocity; public float? shrapnelLifetime; public bool? preventOrbiting; public string hitSound; public string hitEnemySound; public string hitWallSound; public bool? becomeDebris; public bool? electric; public float? burstCooldown; public bool? preventSparks; public bool? pierceBreakables; public bool? collidesOnlyWithPlayerProjectiles; public bool? pierceInternalWalls; public bool? doBeamSetup; public string beamSprite; public int beamFps; public int beamStartFps; public int beamEndFps; public int beamChargeFps; public int beamMuzzleFps; public int beamImpactFps; public bool beamLoopCharge; public float beamEmission; public int beamReflections; public float beamChargeDelay; public float beamStatusDelay; public GoopDefinition beamGoop; public bool? beamInterpolate; public int beamPiercing; public bool? beamPiercesCover; public bool? beamContinueToWall; public bool? beamIsRigid; public float beamKnockback; public BeamTileType? beamTiling; public BeamEndType? beamEndType; public bool? beamSeparation; public bool beamStartIsMuzzle; public bool hideAmmo; public float spinupTime; public string spinupSound; public float glowAmount; public Color? glowColor; public float? glowColorPower; public int beamDissipateFps; public float? spinRate; public float? lightStrength; public float? lightRange; public Color? lightColor; public string chargeSound; public bool? damagesWalls; public Color? beamEmissionColor; public float beamEmissionColorPower; public float beamImpactEmission; public float stunChance; public float stunDuration; public float beamEmissionSensitivity; public bool useBetterEmissiveShader; public float glowSensitivity; public bool greenFire; public static GunData Default => New(null, null, null, null, null, (ShootStyle)1, (ProjectileSequenceStyle)0, 0f, 1, null, customClip: false, null, null, null, null, null, 0f, 0f, 0f, 0f, null, null, null, null, null, null, 2, (Anchor)4); static GunData() { _Instance = new GunData(); } private GunData() { } public static GunData New(Gun gun = null, Projectile baseProjectile = null, int? clipSize = null, float? cooldown = null, float? angleVariance = null, ShootStyle shootStyle = (ShootStyle)1, ProjectileSequenceStyle sequenceStyle = (ProjectileSequenceStyle)0, float chargeTime = 0f, int ammoCost = 1, AmmoType? ammoType = null, bool customClip = false, float? damage = null, float? speed = null, float? force = null, float? range = null, float? recoil = null, float poison = 0f, float fire = 0f, float freeze = 0f, float slow = 0f, bool? collidesWithEnemies = null, bool? ignoreDamageCaps = null, bool? collidesWithProjectiles = null, bool? surviveRigidbodyCollisions = null, bool? collidesWithTilemap = null, string sprite = null, int fps = 2, Anchor anchor = (Anchor)4, float scale = 1f, bool anchorsChangeColliders = true, bool fixesScales = true, IntVector2? overrideColliderPixelSizes = null, IntVector2? overrideColliderOffsets = null, float bossDamageMult = 1f, string destroySound = null, bool? shouldRotate = null, int barrageSize = 1, bool? shouldFlipHorizontally = null, bool? shouldFlipVertically = null, bool useDummyChargeModule = false, bool invisibleProjectile = false, string spawnSound = null, bool? stopSoundOnDeath = null, bool? uniqueSounds = null, GameObject shrapnelVFX = null, int? shrapnelCount = null, float? shrapnelMinVelocity = null, float? shrapnelMaxVelocity = null, float? shrapnelLifetime = null, bool? preventOrbiting = null, string hitSound = null, string hitEnemySound = null, string hitWallSound = null, bool? becomeDebris = null, float angleFromAim = 0f, bool ignoredForReloadPurposes = false, bool mirror = false, bool? electric = null, float? burstCooldown = null, bool? preventSparks = null, bool? pierceBreakables = null, bool? collidesOnlyWithPlayerProjectiles = null, bool? pierceInternalWalls = null, bool? doBeamSetup = null, string beamSprite = null, int beamFps = -1, int beamStartFps = -1, int beamEndFps = -1, int beamChargeFps = -1, int beamMuzzleFps = -1, int beamImpactFps = -1, bool beamLoopCharge = true, float beamEmission = -1f, int beamReflections = -1, float beamChargeDelay = -1f, float beamStatusDelay = -1f, GoopDefinition beamGoop = null, bool? beamInterpolate = null, int beamPiercing = -1, bool? beamPiercesCover = null, bool? beamContinueToWall = null, bool? beamIsRigid = null, float beamKnockback = -1f, BeamTileType? beamTiling = null, BeamEndType? beamEndType = null, bool? beamSeparation = null, bool beamStartIsMuzzle = false, bool hideAmmo = false, float spinupTime = 0f, string spinupSound = null, float glowAmount = 0f, Color? glowColor = null, float? glowColorPower = null, int beamDissipateFps = -1, float? spinRate = null, float? lightStrength = null, float? lightRange = null, Color? lightColor = null, string chargeSound = null, bool? damagesWalls = null, Color? beamEmissionColor = null, float beamEmissionColorPower = 1.55f, float beamImpactEmission = -1f, float stunChance = 0f, float stunDuration = -1f, float beamEmissionSensitivity = -1f, bool useBetterEmissiveShader = false, float glowSensitivity = 0.5f, bool greenFire = false) { //IL_003d: 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_0049: 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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) _Instance.gun = gun; _Instance.baseProjectile = baseProjectile; _Instance.clipSize = clipSize; _Instance.cooldown = cooldown; _Instance.angleVariance = angleVariance; _Instance.shootStyle = shootStyle; _Instance.sequenceStyle = sequenceStyle; _Instance.chargeTime = chargeTime; _Instance.ammoCost = ammoCost; _Instance.ammoType = ammoType; _Instance.customClip = customClip; _Instance.damage = damage; _Instance.speed = speed; _Instance.force = force; _Instance.range = range; _Instance.recoil = recoil; _Instance.poison = poison; _Instance.fire = fire; _Instance.freeze = freeze; _Instance.slow = slow; _Instance.collidesWithEnemies = collidesWithEnemies; _Instance.ignoreDamageCaps = ignoreDamageCaps; _Instance.collidesWithProjectiles = collidesWithProjectiles; _Instance.surviveRigidbodyCollisions = surviveRigidbodyCollisions; _Instance.collidesWithTilemap = collidesWithTilemap; _Instance.sprite = sprite; _Instance.fps = fps; _Instance.anchor = anchor; _Instance.scale = scale; _Instance.anchorsChangeColliders = anchorsChangeColliders; _Instance.fixesScales = fixesScales; _Instance.overrideColliderPixelSizes = overrideColliderPixelSizes; _Instance.overrideColliderOffsets = overrideColliderOffsets; _Instance.bossDamageMult = bossDamageMult; _Instance.destroySound = destroySound; _Instance.shouldRotate = shouldRotate; _Instance.barrageSize = barrageSize; _Instance.shouldFlipHorizontally = shouldFlipHorizontally; _Instance.shouldFlipVertically = shouldFlipVertically; _Instance.useDummyChargeModule = useDummyChargeModule; _Instance.invisibleProjectile = invisibleProjectile; _Instance.spawnSound = spawnSound; _Instance.stopSoundOnDeath = stopSoundOnDeath; _Instance.uniqueSounds = uniqueSounds; _Instance.shrapnelVFX = shrapnelVFX; _Instance.shrapnelCount = shrapnelCount; _Instance.shrapnelMinVelocity = shrapnelMinVelocity; _Instance.shrapnelMaxVelocity = shrapnelMaxVelocity; _Instance.shrapnelLifetime = shrapnelLifetime; _Instance.preventOrbiting = preventOrbiting; _Instance.hitSound = hitSound; _Instance.hitEnemySound = hitEnemySound; _Instance.hitWallSound = hitWallSound; _Instance.becomeDebris = becomeDebris; _Instance.angleFromAim = angleFromAim; _Instance.mirror = mirror; _Instance.electric = electric; _Instance.burstCooldown = burstCooldown; _Instance.preventSparks = preventSparks; _Instance.pierceBreakables = pierceBreakables; _Instance.collidesWithProjectiles = collidesWithProjectiles; _Instance.collidesOnlyWithPlayerProjectiles = collidesOnlyWithPlayerProjectiles; _Instance.pierceInternalWalls = pierceInternalWalls; _Instance.doBeamSetup = doBeamSetup; _Instance.beamSprite = beamSprite; _Instance.beamFps = beamFps; _Instance.beamStartFps = beamStartFps; _Instance.beamEndFps = beamEndFps; _Instance.beamChargeFps = beamChargeFps; _Instance.beamMuzzleFps = beamMuzzleFps; _Instance.beamImpactFps = beamImpactFps; _Instance.beamLoopCharge = beamLoopCharge; _Instance.beamEmission = beamEmission; _Instance.beamReflections = beamReflections; _Instance.beamChargeDelay = beamChargeDelay; _Instance.beamStatusDelay = beamStatusDelay; _Instance.beamGoop = beamGoop; _Instance.beamInterpolate = beamInterpolate; _Instance.beamPiercing = beamPiercing; _Instance.beamPiercesCover = beamPiercesCover; _Instance.beamContinueToWall = beamContinueToWall; _Instance.beamIsRigid = beamIsRigid; _Instance.beamKnockback = beamKnockback; _Instance.beamTiling = beamTiling; _Instance.beamEndType = beamEndType; _Instance.beamSeparation = beamSeparation; _Instance.beamStartIsMuzzle = beamStartIsMuzzle; _Instance.hideAmmo = hideAmmo; _Instance.spinupTime = spinupTime; _Instance.spinupSound = spinupSound; _Instance.glowAmount = glowAmount; _Instance.glowColor = glowColor; _Instance.glowColorPower = glowColorPower; _Instance.beamDissipateFps = beamDissipateFps; _Instance.spinRate = spinRate; _Instance.lightStrength = lightStrength; _Instance.lightRange = lightRange; _Instance.lightColor = lightColor; _Instance.chargeSound = chargeSound; _Instance.damagesWalls = damagesWalls; _Instance.beamEmissionColor = beamEmissionColor; _Instance.beamEmissionColorPower = beamEmissionColorPower; _Instance.beamImpactEmission = beamImpactEmission; _Instance.stunChance = stunChance; _Instance.stunDuration = stunDuration; _Instance.beamEmissionSensitivity = beamEmissionSensitivity; _Instance.useBetterEmissiveShader = useBetterEmissiveShader; _Instance.glowSensitivity = glowSensitivity; _Instance.greenFire = greenFire; return _Instance; } } public static class GunBuilder { public class ReloadAnimationSuppressor : MonoBehaviour { } [HarmonyPatch(typeof(Gun), "FinishReload")] private class ReloadAnimationSuppressorPatch { private static void Prefix(Gun __instance, bool activeReload, ref bool silent, bool isImmediate) { if (Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { silent = true; } } } private static ProjectileModule _DummyChargeModule; public static ProjectileType InitSpecialProjectile(this Gun gun, GunData b = null) where ProjectileType : Projectile { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown if (b == null) { b = GunData.Default; } b.gun = gun; ProjectileModule val = gun.SetupDefaultModule(b); ProjectileType val2 = gun.InitFirstProjectileOfType(b); if ((int)b.shootStyle == 3) { val.chargeProjectiles = new List(); if (b.chargeTime >= 0f) { val.chargeProjectiles.Add(new ChargeProjectile { Projectile = (Projectile)(object)val2, ChargeTime = b.chargeTime }); } } for (int i = 1; i < b.barrageSize; i++) { gun.RawSourceVolley.projectiles.Add(ProjectileModule.CreateClone(val, false, i)); } if (b.useDummyChargeModule) { gun.AddDummyChargeModule(); } return val2; } public static Projectile InitProjectile(this Gun gun, GunData b = null) { return gun.InitSpecialProjectile(b); } public static ProjectileModule InitSpecialSingleProjectileModule(this ProjectileModule mod, GunData b = null) where ProjectileType : Projectile { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Invalid comparison between Unknown and I4 //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) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown if (b == null || (Object)(object)b.baseProjectile == (Object)null) { Lazy.RuntimeWarn("Tried to run InitModule() with a valid base projectile, backing out."); return mod; } mod.SetAttributes(b); Projectile val = b.baseProjectile.Clone(b); ProjectileType val2 = (ProjectileType)(object)((val is ProjectileType) ? val : null); if (val2 == null) { val2 = val.ConvertToSpecialtyType(); } mod.projectiles = new List { (Projectile)(object)val2 }; ((BraveBehaviour)((BraveBehaviour)(object)val2).sprite).renderer.enabled = !b.invisibleProjectile; if ((int)b.shootStyle == 3) { mod.chargeProjectiles = new List(); if (b.chargeTime >= 0f) { mod.chargeProjectiles.Add(new ChargeProjectile { Projectile = (Projectile)(object)val2, ChargeTime = b.chargeTime }); } } return mod; } public static ProjectileModule InitSingleProjectileModule(this ProjectileModule mod, GunData b = null) { return mod.InitSpecialSingleProjectileModule(b); } public static ProjectileType CloneSpecial(this ProjectileType projectile, GunData b = null) where ProjectileType : Projectile { //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: 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_0631: 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_089e: Unknown result type (might be due to invalid IL or missing references) //IL_08a4: Invalid comparison between Unknown and I4 if (b == null) { b = GunData.Default; } ProjectileType val = projectile.ClonePrefab(deactivate: true, markFake: true, dontUnload: true); if (!Object.op_Implicit((Object)(object)((BraveBehaviour)(object)val).sprite)) { ((BraveBehaviour)(object)val).sprite = ((Component)(object)val).gameObject.GetComponentInChildren(); } ((Projectile)(object)val).AddDefaultAnimation(b); ((Projectile)val).baseData.damage = b.damage ?? ((Projectile)val).baseData.damage; ((Projectile)val).baseData.speed = b.speed ?? ((Projectile)val).baseData.speed; ((Projectile)val).baseData.force = b.force ?? ((Projectile)val).baseData.force; ((Projectile)val).baseData.range = b.range ?? ((Projectile)val).baseData.range; ((Projectile)val).shouldRotate = b.shouldRotate ?? ((Projectile)val).shouldRotate; ((Projectile)val).shouldFlipHorizontally = b.shouldFlipHorizontally ?? ((Projectile)val).shouldFlipHorizontally; ((Projectile)val).shouldFlipVertically = b.shouldFlipVertically ?? ((Projectile)val).shouldFlipVertically; ((Projectile)val).collidesWithEnemies = b.collidesWithEnemies ?? ((Projectile)val).collidesWithEnemies; ((Projectile)val).ignoreDamageCaps = b.ignoreDamageCaps ?? ((Projectile)val).ignoreDamageCaps; ((Projectile)val).BulletScriptSettings.surviveRigidbodyCollisions = b.surviveRigidbodyCollisions ?? ((Projectile)val).BulletScriptSettings.surviveRigidbodyCollisions; ((Projectile)val).pierceMinorBreakables = b.pierceBreakables ?? ((Projectile)val).pierceMinorBreakables; ((Projectile)val).collidesWithProjectiles = b.collidesWithProjectiles ?? ((Projectile)val).collidesWithProjectiles; ((Projectile)val).collidesOnlyWithPlayerProjectiles = b.collidesOnlyWithPlayerProjectiles ?? ((Projectile)val).collidesOnlyWithPlayerProjectiles; ((Projectile)val).PenetratesInternalWalls = b.pierceInternalWalls ?? ((Projectile)val).PenetratesInternalWalls; ((Projectile)val).damagesWalls = b.damagesWalls ?? ((Projectile)val).damagesWalls; if (Object.op_Implicit((Object)(object)((BraveBehaviour)(object)val).specRigidbody)) { ((BraveBehaviour)(object)val).specRigidbody.CollideWithTileMap = b.collidesWithTilemap ?? ((BraveBehaviour)(object)val).specRigidbody.CollideWithTileMap; } if (b.recoil.HasValue) { ((Projectile)val).AppliesKnockbackToPlayer = b.recoil.Value != 0f; ((Projectile)val).PlayerKnockbackForce = b.recoil.Value; } if (b.electric.HasValue) { if (b.electric.Value) { object obj = val; ((Projectile)obj).damageTypes = (CoreDamageTypes)(((Projectile)obj).damageTypes | 0x40); } else { object obj2 = val; ((Projectile)obj2).damageTypes = (CoreDamageTypes)(((Projectile)obj2).damageTypes & -65); } } CwaffProjectile orAddComponent = ((Component)(object)val).GetOrAddComponent(); orAddComponent.chargeSound = b.chargeSound ?? orAddComponent.chargeSound; orAddComponent.spawnSound = b.spawnSound ?? orAddComponent.spawnSound; orAddComponent.stopSoundOnDeath = b.stopSoundOnDeath ?? orAddComponent.stopSoundOnDeath; orAddComponent.uniqueSounds = b.uniqueSounds ?? orAddComponent.uniqueSounds; orAddComponent.shrapnelVFX = b.shrapnelVFX ?? orAddComponent.shrapnelVFX; orAddComponent.shrapnelCount = b.shrapnelCount ?? orAddComponent.shrapnelCount; orAddComponent.shrapnelMinVelocity = b.shrapnelMinVelocity ?? orAddComponent.shrapnelMinVelocity; orAddComponent.shrapnelMaxVelocity = b.shrapnelMaxVelocity ?? orAddComponent.shrapnelMaxVelocity; orAddComponent.shrapnelLifetime = b.shrapnelLifetime ?? orAddComponent.shrapnelLifetime; orAddComponent.preventOrbiting = b.preventOrbiting ?? orAddComponent.preventOrbiting; orAddComponent.becomeDebris = b.becomeDebris ?? orAddComponent.becomeDebris; orAddComponent.preventSparks = b.preventSparks ?? orAddComponent.preventSparks; orAddComponent.spinRate = b.spinRate ?? orAddComponent.spinRate; orAddComponent.lightStrength = b.lightStrength ?? orAddComponent.lightStrength; orAddComponent.lightRange = b.lightRange ?? orAddComponent.lightRange; orAddComponent.lightColor = (Color)(((??)b.lightColor) ?? orAddComponent.lightColor); ((Projectile)val).BossDamageMultiplier = b.bossDamageMult; ((Projectile)val).onDestroyEventName = b.destroySound; ((Projectile)val).enemyImpactEventName = b.hitEnemySound ?? b.hitSound; ((Projectile)val).objectImpactEventName = b.hitWallSound ?? b.hitSound; ((Projectile)val).PoisonApplyChance = b.poison; ((Projectile)val).AppliesPoison = b.poison > 0f; if (((Projectile)val).AppliesPoison) { ((Projectile)val).healthEffect = ((Component)ItemHelper.Get(Items.IrradiatedLead)).GetComponent().HealthModifierEffect; } ((Projectile)val).FireApplyChance = b.fire; ((Projectile)val).AppliesFire = b.fire > 0f; if (((Projectile)val).AppliesFire) { if (b.greenFire) { ((Projectile)val).fireEffect = ((Component)Items.MolotovLauncher.Projectile()).gameObject.GetComponent().ChangedDefinition.fireEffect; } else { ((Projectile)val).fireEffect = ((Component)ItemHelper.Get(Items.HotLead)).GetComponent().FireModifierEffect; } } ((Projectile)val).FreezeApplyChance = b.freeze; ((Projectile)val).AppliesFreeze = b.freeze > 0f; if (((Projectile)val).AppliesFreeze) { ((Projectile)val).freezeEffect = ((Component)ItemHelper.Get(Items.FrostBullets)).GetComponent().FreezeModifierEffect; } ((Projectile)val).SpeedApplyChance = b.slow; ((Projectile)val).AppliesSpeedModifier = b.slow > 0f; if (((Projectile)val).AppliesSpeedModifier) { ((Projectile)val).speedEffect = Items.TripleCrossbow.AsGun().DefaultModule.projectiles[0].speedEffect; } if (b.stunDuration > 0f && b.stunChance <= 0f) { b.stunChance = 1f; } ((Projectile)val).StunApplyChance = b.stunChance; ((Projectile)val).AppliesStun = b.stunChance > 0f; ((Projectile)val).AppliedStunDuration = b.stunDuration; if (b.doBeamSetup ?? ((int)b.shootStyle == 2)) { ((Projectile)(object)val).InternalSetupBeam(b); } ((BraveBehaviour)((BraveBehaviour)(object)val).sprite).renderer.enabled = !b.invisibleProjectile; if (b.glowAmount > 0f) { if (b.useBetterEmissiveShader) { ((BraveBehaviour)(object)val).sprite.MakeGlowyBetter(b.glowAmount, b.glowColor, b.glowColorPower, b.glowSensitivity); } else { tk2dBaseSprite sprite = ((BraveBehaviour)(object)val).sprite; float glowAmount = b.glowAmount; Color? glowColor = b.glowColor; float? glowColorPower = b.glowColorPower; sprite.SetGlowiness(glowAmount, glowColor, null, null, glowColorPower); } } return val; } private static void InternalSetupBeam(this Projectile p, GunData b) { //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: 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_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_0606: Unknown result type (might be due to invalid IL or missing references) //IL_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_060b: Unknown result type (might be due to invalid IL or missing references) //IL_062c: Unknown result type (might be due to invalid IL or missing references) //IL_0623: Unknown result type (might be due to invalid IL or missing references) //IL_0631: Unknown result type (might be due to invalid IL or missing references) BasicBeamController val = p.SetupBeamSprites(b.beamSprite, b.beamFps, b.beamImpactFps, b.beamEndFps, b.beamStartFps, b.beamChargeFps, muzzleFps: b.beamMuzzleFps, loopCharge: b.beamLoopCharge, dissipateFps: b.beamDissipateFps); if (b.beamChargeDelay >= 0f) { ((BeamController)val).usesChargeDelay = b.beamChargeDelay > 0f; ((BeamController)val).chargeDelay = b.beamChargeDelay; } if (b.beamEmission > 0f) { if (b.beamEmissionSensitivity >= 0f) { ((BraveBehaviour)val).sprite.MakeGlowyBetter(b.beamEmission, b.beamEmissionColor, b.beamEmissionColorPower, b.beamEmissionSensitivity); } else { ((BraveBehaviour)val).sprite.usesOverrideMaterial = true; ((BraveBehaviour)((BraveBehaviour)val).sprite).renderer.material.shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTintableTiltedCutoutEmissive"); ((BraveBehaviour)((BraveBehaviour)val).sprite).renderer.material.SetFloat(CwaffVFX._EmissivePowerId, b.beamEmission); } if (val.UsesChargeSprite || val.UsesMuzzleSprite) { Transform val2 = ((BraveBehaviour)val).transform.Find("beam muzzle flare"); if (val2 == null) { GameObject val3 = new GameObject("beam muzzle flare"); val2 = val3.transform; val2.parent = ((BraveBehaviour)val).transform; val2.localPosition = new Vector3(0f, 0f, 0.05f); tk2dTiledSprite component = ((Component)val).gameObject.GetComponent(); tk2dSprite val4 = val3.AddComponent(); ((tk2dBaseSprite)val4).SetSprite(((tk2dBaseSprite)component).Collection, ((tk2dBaseSprite)component).spriteId); tk2dSpriteAnimator obj = val3.AddComponent(); obj.SetSprite(((tk2dBaseSprite)component).Collection, ((tk2dBaseSprite)component).spriteId); obj.Library = ((Component)val).gameObject.GetComponent().Library; ((tk2dBaseSprite)component).AttachRenderer((tk2dBaseSprite)(object)val4); ((tk2dBaseSprite)val4).HeightOffGround = 0.05f; ((tk2dBaseSprite)val4).IsPerpendicular = false; ((tk2dBaseSprite)val4).usesOverrideMaterial = true; } tk2dSprite component2 = ((Component)val2).GetComponent(); if (b.beamEmissionSensitivity >= 0f) { ((tk2dBaseSprite)(object)component2).MakeGlowyBetter(b.beamEmission, b.beamEmissionColor, b.beamEmissionColorPower, b.beamEmissionSensitivity); } else { ((tk2dBaseSprite)component2).usesOverrideMaterial = true; ((BraveBehaviour)component2).renderer.material.shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTintableTiltedCutoutEmissive"); ((BraveBehaviour)component2).renderer.material.SetFloat(CwaffVFX._EmissivePowerId, b.beamEmission); if (b.beamEmissionColor.HasValue) { ((BraveBehaviour)component2).renderer.material.SetColor(CwaffVFX._EmissiveColorId, b.beamEmissionColor.Value); ((BraveBehaviour)component2).renderer.material.SetFloat(CwaffVFX._EmissiveColorPowerId, b.beamEmissionColorPower); } } } if (val.UsesImpactSprite) { Transform val5 = ((BraveBehaviour)val).transform.Find("beam impact vfx"); if (val5 == null) { GameObject val6 = new GameObject("beam impact vfx"); val5 = val6.transform; val5.parent = ((BraveBehaviour)val).transform; val5.localPosition = new Vector3(0f, 0f, 0.05f); tk2dSprite val7 = val6.AddComponent(); tk2dTiledSprite component3 = ((Component)val).gameObject.GetComponent(); ((tk2dBaseSprite)val7).SetSprite(((tk2dBaseSprite)component3).Collection, ((tk2dBaseSprite)component3).spriteId); tk2dSpriteAnimator obj2 = val6.AddComponent(); obj2.SetSprite(((tk2dBaseSprite)component3).Collection, ((tk2dBaseSprite)component3).spriteId); obj2.Library = ((Component)val).gameObject.GetComponent().Library; ((tk2dBaseSprite)component3).AttachRenderer((tk2dBaseSprite)(object)val7); ((tk2dBaseSprite)val7).HeightOffGround = 0.05f; ((tk2dBaseSprite)val7).IsPerpendicular = true; ((tk2dBaseSprite)val7).usesOverrideMaterial = true; } tk2dSprite component4 = ((Component)val5).GetComponent(); if (b.beamEmissionSensitivity >= 0f) { ((tk2dBaseSprite)(object)component4).MakeGlowyBetter((b.beamImpactEmission >= 0f) ? b.beamImpactEmission : b.beamEmission, b.beamEmissionColor, b.beamEmissionColorPower, b.beamEmissionSensitivity); } else { ((tk2dBaseSprite)component4).usesOverrideMaterial = true; ((BraveBehaviour)component4).renderer.material.shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTintableTiltedCutoutEmissive"); ((BraveBehaviour)component4).renderer.material.SetFloat(CwaffVFX._EmissivePowerId, (b.beamImpactEmission >= 0f) ? b.beamImpactEmission : b.beamEmission); if (b.beamEmissionColor.HasValue) { ((BraveBehaviour)component4).renderer.material.SetColor(CwaffVFX._EmissiveColorId, b.beamEmissionColor.Value); ((BraveBehaviour)component4).renderer.material.SetFloat(CwaffVFX._EmissiveColorPowerId, b.beamEmissionColorPower); } } } } if ((float)b.beamReflections >= 0f) { val.reflections = b.beamReflections; } if (b.beamStatusDelay >= 0f) { val.TimeToStatus = b.beamStatusDelay; } if ((float)b.beamPiercing >= 0f) { val.penetration = b.beamPiercing; } if (b.beamKnockback >= 0f) { ((BeamController)val).knockbackStrength = b.beamKnockback; } bool? beamIsRigid = b.beamIsRigid; if (beamIsRigid.HasValue) { bool valueOrDefault = beamIsRigid == true; val.boneType = (BeamBoneType)((!valueOrDefault) ? 2 : 0); } if ((Object)(object)b.beamGoop != (Object)null) { ((Component)(object)val).GetOrAddComponent().goopDefinition = b.beamGoop; } val.interpolateStretchedBones = b.beamInterpolate ?? val.interpolateStretchedBones; val.ContinueBeamArtToWall = b.beamContinueToWall ?? val.ContinueBeamArtToWall; val.PenetratesCover = b.beamPiercesCover ?? val.PenetratesCover; val.collisionSeparation = b.beamSeparation ?? val.collisionSeparation; val.TileType = (BeamTileType)(((??)b.beamTiling) ?? val.TileType); val.endType = (BeamEndType)(((??)b.beamEndType) ?? val.endType); if (b.beamStartIsMuzzle) { val.muzzleAnimation = val.beamStartAnimation; val.beamStartAnimation = null; } } public static Projectile Clone(this Projectile projectile, GunData b = null) { return projectile.CloneSpecial(b); } public static ProjectileType ConvertToSpecialtyType(this Projectile baseProj) where ProjectileType : Projectile { //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_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) ProjectileType val = ((Component)baseProj).gameObject.AddComponent(); ((Projectile)val).BulletScriptSettings = baseProj.BulletScriptSettings; ((Projectile)val).damageTypes = baseProj.damageTypes; ((Projectile)val).allowSelfShooting = baseProj.allowSelfShooting; ((Projectile)val).collidesWithPlayer = baseProj.collidesWithPlayer; ((Projectile)val).collidesWithProjectiles = baseProj.collidesWithProjectiles; ((Projectile)val).collidesOnlyWithPlayerProjectiles = baseProj.collidesOnlyWithPlayerProjectiles; ((Projectile)val).projectileHitHealth = baseProj.projectileHitHealth; ((Projectile)val).collidesWithEnemies = baseProj.collidesWithEnemies; ((Projectile)val).shouldRotate = baseProj.shouldRotate; ((Projectile)val).shouldFlipVertically = baseProj.shouldFlipVertically; ((Projectile)val).shouldFlipHorizontally = baseProj.shouldFlipHorizontally; ((Projectile)val).ignoreDamageCaps = baseProj.ignoreDamageCaps; ((Projectile)val).baseData = baseProj.baseData; ((Projectile)val).AppliesPoison = baseProj.AppliesPoison; ((Projectile)val).PoisonApplyChance = baseProj.PoisonApplyChance; ((Projectile)val).healthEffect = baseProj.healthEffect; ((Projectile)val).AppliesSpeedModifier = baseProj.AppliesSpeedModifier; ((Projectile)val).SpeedApplyChance = baseProj.SpeedApplyChance; ((Projectile)val).speedEffect = baseProj.speedEffect; ((Projectile)val).AppliesCharm = baseProj.AppliesCharm; ((Projectile)val).CharmApplyChance = baseProj.CharmApplyChance; ((Projectile)val).charmEffect = baseProj.charmEffect; ((Projectile)val).AppliesFreeze = baseProj.AppliesFreeze; ((Projectile)val).FreezeApplyChance = baseProj.FreezeApplyChance; ((Projectile)val).freezeEffect = baseProj.freezeEffect; ((Projectile)val).AppliesFire = baseProj.AppliesFire; ((Projectile)val).FireApplyChance = baseProj.FireApplyChance; ((Projectile)val).fireEffect = baseProj.fireEffect; ((Projectile)val).AppliesStun = baseProj.AppliesStun; ((Projectile)val).StunApplyChance = baseProj.StunApplyChance; ((Projectile)val).AppliedStunDuration = baseProj.AppliedStunDuration; ((Projectile)val).AppliesBleed = baseProj.AppliesBleed; ((Projectile)val).bleedEffect = baseProj.bleedEffect; ((Projectile)val).AppliesCheese = baseProj.AppliesCheese; ((Projectile)val).CheeseApplyChance = baseProj.CheeseApplyChance; ((Projectile)val).cheeseEffect = baseProj.cheeseEffect; ((Projectile)val).BleedApplyChance = baseProj.BleedApplyChance; ((Projectile)val).CanTransmogrify = baseProj.CanTransmogrify; ((Projectile)val).ChanceToTransmogrify = baseProj.ChanceToTransmogrify; ((Projectile)val).TransmogrifyTargetGuids = baseProj.TransmogrifyTargetGuids; ((Projectile)val).hitEffects = baseProj.hitEffects; ((Projectile)val).CenterTilemapHitEffectsByProjectileVelocity = baseProj.CenterTilemapHitEffectsByProjectileVelocity; ((Projectile)val).wallDecals = baseProj.wallDecals; ((Projectile)val).damagesWalls = baseProj.damagesWalls; ((Projectile)val).persistTime = baseProj.persistTime; ((Projectile)val).angularVelocity = baseProj.angularVelocity; ((Projectile)val).angularVelocityVariance = baseProj.angularVelocityVariance; ((Projectile)val).spawnEnemyGuidOnDeath = baseProj.spawnEnemyGuidOnDeath; ((Projectile)val).HasFixedKnockbackDirection = baseProj.HasFixedKnockbackDirection; ((Projectile)val).FixedKnockbackDirection = baseProj.FixedKnockbackDirection; ((Projectile)val).pierceMinorBreakables = baseProj.pierceMinorBreakables; ((Projectile)val).objectImpactEventName = baseProj.objectImpactEventName; ((Projectile)val).enemyImpactEventName = baseProj.enemyImpactEventName; ((Projectile)val).onDestroyEventName = baseProj.onDestroyEventName; ((Projectile)val).additionalStartEventName = baseProj.additionalStartEventName; ((Projectile)val).IsRadialBurstLimited = baseProj.IsRadialBurstLimited; ((Projectile)val).MaxRadialBurstLimit = baseProj.MaxRadialBurstLimit; ((Projectile)val).AdditionalBurstLimits = baseProj.AdditionalBurstLimits; ((Projectile)val).AppliesKnockbackToPlayer = baseProj.AppliesKnockbackToPlayer; ((Projectile)val).PlayerKnockbackForce = baseProj.PlayerKnockbackForce; ((Projectile)val).HasDefaultTint = baseProj.HasDefaultTint; ((Projectile)val).DefaultTintColor = baseProj.DefaultTintColor; ((Projectile)val).PenetratesInternalWalls = baseProj.PenetratesInternalWalls; ((Projectile)val).neverMaskThis = baseProj.neverMaskThis; ((Projectile)val).isFakeBullet = baseProj.isFakeBullet; ((Projectile)val).CanBecomeBlackBullet = baseProj.CanBecomeBlackBullet; ((Projectile)val).TrailRenderer = baseProj.TrailRenderer; ((Projectile)val).CustomTrailRenderer = baseProj.CustomTrailRenderer; ((Projectile)val).ParticleTrail = baseProj.ParticleTrail; ((Projectile)val).DelayedDamageToExploders = baseProj.DelayedDamageToExploders; ((Projectile)val).AdditionalScaleMultiplier = baseProj.AdditionalScaleMultiplier; Object.DestroyImmediate((Object)(object)baseProj); return val; } public static ProjectileType InitFirstProjectileOfType(this Gun gun, GunData b) where ProjectileType : Projectile { Projectile val = (b.baseProjectile ?? gun.DefaultModule.projectiles[0]).Clone(b); ProjectileType val2 = (ProjectileType)(object)((val is ProjectileType) ? val : null); if (val2 == null) { val2 = val.ConvertToSpecialtyType(); } gun.DefaultModule.projectiles[0] = (Projectile)(object)val2; ((BraveBehaviour)(object)val2).transform.parent = gun.barrelOffset; return val2; } public static Projectile InitFirstProjectile(this Gun gun, GunData b = null) { return gun.InitFirstProjectileOfType(b); } public static Projectile CloneProjectile(this Gun gun, GunData b = null) { return gun.DefaultModule.projectiles[0].Clone(b); } public static Projectile CloneProjectile(this Items gunItem, GunData b = null) { return gunItem.AsGun().DefaultModule.projectiles[0].Clone(b); } public static Projectile Projectile(this Items gunItem) { return gunItem.AsGun().DefaultModule.projectiles[0]; } public static ProjectileModule SetAttributes(this ProjectileModule mod, GunData b = null) { //IL_0083: 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: 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_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) if (b == null) { b = GunData.Default; } CwaffGun component = ((Component)b.gun).gameObject.GetComponent(); if (b.clipSize.HasValue) { mod.numberOfShotsInClip = b.clipSize.Value; } if (b.cooldown.HasValue) { mod.cooldownTime = b.cooldown.Value; } if (b.burstCooldown.HasValue) { mod.burstCooldownTime = b.burstCooldown.Value; } mod.ammoCost = b.ammoCost; mod.shootStyle = b.shootStyle; mod.sequenceStyle = b.sequenceStyle; mod.angleFromAim = b.angleFromAim; mod.ignoredForReloadPurposes = b.ignoredForReloadPurposes; mod.mirror = b.mirror; if (b.angleVariance.HasValue) { mod.angleVariance = b.angleVariance.Value; } if (b.hideAmmo) { component.hideAmmo = true; } else if (b.customClip) { mod.SetupCustomAmmoClip(b); } else if (b.ammoType.HasValue) { mod.ammoType = b.ammoType.Value; } component.spinupTime = b.spinupTime; component.spinupSound = b.spinupSound; return mod; } private static ProjectileModule SetupDefaultModule(this Gun gun, GunData b = null) { if (b == null) { b = GunData.Default; } b.gun = gun; return gun.DefaultModule.SetAttributes(b); } public static Gun Attach(this Gun gun, Action predicate = null, bool allowDuplicates = false) where T : MonoBehaviour { T obj = (allowDuplicates ? ((Component)gun).gameObject.AddComponent() : GameObjectExtensions.GetOrAddComponent(((Component)gun).gameObject)); predicate?.Invoke(obj); return gun; } public static Projectile Attach(this Projectile projectile, Action predicate = null, bool allowDuplicates = false) where T : MonoBehaviour { T obj = (allowDuplicates ? ((Component)projectile).gameObject.AddComponent() : GameObjectExtensions.GetOrAddComponent(((Component)projectile).gameObject)); predicate?.Invoke(obj); return projectile; } public static T Assign(this T projectile, out T projectileRef) where T : Projectile { return projectileRef = projectile; } public static T AssignGun(this T gun, out T gunRef) where T : Gun { return gunRef = gun; } public static Projectile AddAnimations(this Projectile proj, params tk2dSpriteAnimationClip[] animations) { foreach (tk2dSpriteAnimationClip clip in animations) { proj.AddAnimation(clip); } return proj; } public static void AddDummyChargeModule(this Gun gun) { //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_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_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_0026: 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_0041: Expected O, but got Unknown //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_0050: 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_0065: Expected O, but got Unknown if (_DummyChargeModule == null) { _DummyChargeModule = new ProjectileModule { shootStyle = (ShootStyle)3, ammoCost = 0, chargeProjectiles = new List { new ChargeProjectile { Projectile = Lazy.NoProjectile(), ChargeTime = float.MaxValue } }, numberOfShotsInClip = 1, ammoType = (AmmoType)14, customAmmoType = "white" }; } gun.Volley.projectiles.Add(ProjectileModule.CreateClone(_DummyChargeModule, false, gun.Volley.projectiles.Count)); } public static ProjectileModule DuplicateDefaultModule(this Gun gun, bool cloneProjectiles = true, bool add = true) { ProjectileModule val = ProjectileModule.CreateClone(gun.DefaultModule, false, -1); if (add) { gun.Volley.projectiles.Add(val); } if (!cloneProjectiles) { return val; } if (val.projectiles != null) { for (int i = 0; i < val.projectiles.Count; i++) { val.projectiles[i] = val.projectiles[i].Clone(); } } return val; } public static Projectile SetupChargeProjectiles(this Projectile p, ProjectileModule mod, int num, Func setupFunc) { mod.chargeProjectiles.Clear(); for (int i = 0; i < num; i++) { mod.chargeProjectiles.Add(setupFunc(i, p)); } return p; } public static void SuppressReloadAnimations(this Gun gun) { gun.reloadAnimation = gun.idleAnimation; ((Component)gun).gameObject.AddComponent(); } public static Projectile StickToEnemies(this Projectile proj, float glowAmount = -1f, VFXPool deathVFX = null, Action setupFunc = null) where T : HealthModificationBuff { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) tk2dBaseSprite sprite = ((BraveBehaviour)proj).sprite; tk2dSpriteAnimator spriteAnimator = ((BraveBehaviour)sprite).spriteAnimator; tk2dSpriteAnimationFrame val = spriteAnimator.Library.clips[spriteAnimator.DefaultClipId].frames[0]; tk2dBaseSprite val2 = (tk2dBaseSprite)(object)Lazy.SpriteObject(val.spriteCollection, val.spriteId).RegisterPrefab(deactivate: true, markFake: true, dontUnload: true); ((BraveBehaviour)val2).renderer.material.shader = ((BraveBehaviour)sprite).renderer.material.shader; ((BraveBehaviour)val2).renderer.material.CopyPropertiesFromMaterial(((BraveBehaviour)sprite).renderer.material); if (glowAmount >= 0f) { val2.SetGlowiness(glowAmount); } BuffVFXAnimator val3 = ((Component)val2).gameObject.AddComponent(); val3.animationStyle = (BuffAnimationStyle)2; val3.persistsOnDeath = true; if (deathVFX != null) { val3.UsesVFXToSpawnOnDeath = true; val3.VFXToSpawnOnDeath = deathVFX; } T val4 = ((Component)proj).gameObject.AddComponent(); ((HealthModificationBuff)val4).vfx = ((Component)val2).gameObject; setupFunc?.Invoke(val4); return proj; } public static Projectile StickToEnemies(this Projectile proj, float glowAmount = -1f, VFXPool deathVFX = null) { return proj.StickToEnemies(glowAmount, deathVFX, (Action)null); } } [RequireComponent(typeof(MeshFilter))] [RequireComponent(typeof(MeshRenderer))] public class tk2dMeshSprite : tk2dBaseSprite { private static int m_shaderEmissivePowerID = -1; private static int m_shaderEmissiveColorPowerID = -1; private static int m_shaderEmissiveColorID = -1; private static int m_shaderThresholdID = -1; private static readonly Vector4 _TangentVec = new Vector4(1f, 0f, 0f, 1f); private static readonly Dictionary _TangentCache = new Dictionary(); private static readonly Dictionary _NormalCache = new Dictionary(); private static readonly Dictionary _TriangleCache = new Dictionary(); private static readonly Dictionary _PointCache = new Dictionary(); private Mesh mesh; private Vector3[] meshVertices; private Vector3[] meshNormals; private Vector4[] meshTangents; private Color32[] meshColors; private Vector2[] meshUVs; private int[] meshTriangles; private MeshFilter m_filter; private int meshX = 2; private int meshY = 2; private int numVertices = 4; private bool setup; private bool isPointMesh; public Texture2D optionalPalette; public bool ApplyEmissivePropertyBlock; private static Vector4[] TangentsForMeshOfSize(int x, int y) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) int key = (x << 16) + y; if (_TangentCache.TryGetValue(key, out var value)) { return value; } return _TangentCache[key] = Enumerable.Repeat(_TangentVec, x * y).ToArray(); } private static Vector3[] NormalsForMeshOfSize(int x, int y) { //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) int key = (x << 16) + y; if (_NormalCache.TryGetValue(key, out var value)) { return value; } Vector3[] array = (Vector3[])(object)new Vector3[x * y]; int num = 0; for (int i = 1; i <= y; i++) { float num2 = ((i == 1) ? (-1f) : ((i == y) ? 1f : 0f)); for (int j = 1; j <= x; j++) { float num3 = ((j == 1) ? (-1f) : ((j == x) ? 1f : 0f)); array[num++] = new Vector3(num3, num2, -1f); } } return _NormalCache[key] = array; } private static int[] TrianglesForMeshOfSize(int x, int y) { int key = (x << 16) + y; if (_TriangleCache.TryGetValue(key, out var value)) { return value; } int num = x - 1; int num2 = y - 1; int[] array = new int[num * num2 * 6]; int num3 = 0; for (int i = 0; i < num2; i++) { int num4 = i * x; int num5 = num4 + x; for (int j = 0; j < num; j++) { array[num3] = num4 + j; array[num3 + 1] = num5 + j + 1; array[num3 + 2] = num4 + j + 1; array[num3 + 3] = num5 + j; array[num3 + 4] = array[num3 + 1]; array[num3 + 5] = array[num3]; num3 += 6; } } return _TriangleCache[key] = array; } private static int[] PointsForMeshOfSize(int x, int y) { int key = (x << 16) + y; if (_PointCache.TryGetValue(key, out var value)) { return value; } int num = x * y; int[] array = new int[num]; for (int i = 0; i < num; i++) { array[i] = i; } return _PointCache[key] = array; } public void ResizeMesh(int xSize = -1, int ySize = -1, bool usePointMesh = false, bool build = true) { if (xSize < 2) { xSize = 2; } if (ySize < 2) { ySize = xSize; } meshX = xSize; meshY = ySize; isPointMesh = usePointMesh; numVertices = xSize * ySize; meshTangents = TangentsForMeshOfSize(meshX, meshY); meshNormals = NormalsForMeshOfSize(meshX, meshY); if (usePointMesh) { meshTriangles = PointsForMeshOfSize(meshX, meshY); } else { meshTriangles = TrianglesForMeshOfSize(meshX, meshY); } meshVertices = (Vector3[])(object)new Vector3[numVertices]; meshColors = (Color32[])(object)new Color32[numVertices]; meshUVs = (Vector2[])(object)new Vector2[numVertices]; setup = true; if (build) { ((tk2dBaseSprite)this).ForceBuild(); } } private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown ((tk2dBaseSprite)this).Awake(); mesh = new Mesh(); mesh.MarkDynamic(); ((Object)mesh).hideFlags = (HideFlags)52; m_filter = ((Component)this).GetComponent(); m_filter.mesh = mesh; if (!setup) { ResizeMesh(); } if (Object.op_Implicit((Object)(object)((tk2dBaseSprite)this).Collection)) { if (base._spriteId < 0 || base._spriteId >= ((tk2dBaseSprite)this).Collection.Count) { base._spriteId = 0; } ((tk2dBaseSprite)this).Build(); } } public override void OnDestroy() { ((tk2dBaseSprite)this).OnDestroy(); if (Object.op_Implicit((Object)(object)mesh)) { Object.Destroy((Object)(object)mesh); } if (Object.op_Implicit((Object)(object)base.meshColliderMesh)) { Object.Destroy((Object)(object)base.meshColliderMesh); } } protected void SetColorsMesh(Color32[] dest) { //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_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) //IL_004d: 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_002e: 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_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) Color color = base._color; if (base.collectionInst.premultipliedAlpha) { color.r *= color.a; color.g *= color.a; color.b *= color.a; } Color32 val = Color32.op_Implicit(color); for (int i = 0; i < numVertices; i++) { dest[i] = val; } } public override void Build() { BuildInternal(updateColors: true); ((tk2dBaseSprite)this).UpdateMaterial(); ((tk2dBaseSprite)this).CreateCollider(); } public override void UpdateGeometry() { UpdateGeometryImpl(); } public override void UpdateColors() { UpdateColorsImpl(); } public override void UpdateVertices() { UpdateVerticesImpl(); } private static void ComputeUVs(Vector2[] uvs, tk2dSpriteDefinition def, int meshX, int meshY) { //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_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_00db: 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_0074: 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_00f8: 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_011c: 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_0091: 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_00b5: 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) bool num = def.uvs[0].x == def.uvs[1].x; Vector2 val = def.uvs[0]; _ = ref def.uvs[1]; _ = ref def.uvs[2]; Vector2 val2 = def.uvs[3]; float num2 = (float)meshX - 1f; float num3 = (float)meshY - 1f; int num4 = 0; if (!num) { for (int i = 0; i < meshY; i++) { float num5 = Mathf.Lerp(val.y, val2.y, (float)i / num3); for (int j = 0; j < meshX; j++) { float num6 = Mathf.Lerp(val.x, val2.x, (float)j / num2); uvs[num4++] = new Vector2(num6, num5); } } return; } for (int k = 0; k < meshY; k++) { float num7 = Mathf.Lerp(val.x, val2.x, (float)k / num3); for (int l = 0; l < meshX; l++) { float num8 = Mathf.Lerp(val.y, val2.y, (float)l / num2); uvs[num4++] = new Vector2(num7, num8); } } } private void SetPositionsMesh(Vector3[] positions, tk2dSpriteDefinition def) { //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_0026: 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_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_003f: 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_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_0061: 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_0082: 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_00a5: 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_00d1: 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_010f: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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) if ((Object)(object)base.m_transform == (Object)null) { base.m_transform = ((BraveBehaviour)this).transform; } Vector3 val = Vector3.Scale(def.position0, base._scale); Vector3.Scale(def.position1, base._scale); Vector3.Scale(def.position2, base._scale); Vector3 val2 = Vector3.Scale(def.position3, base._scale); float num = meshX; float num2 = meshY; float z = val2.z; int num3 = 0; for (int i = 0; i < meshY; i++) { float num4 = Mathf.Lerp(val.y, val2.y, ((float)i + 0.5f) / num2); for (int j = 0; j < meshX; j++) { float num5 = Mathf.Lerp(val.x, val2.x, ((float)j + 0.5f) / num); positions[num3++] = new Vector3(num5, num4, z); } } if (((tk2dBaseSprite)this).ShouldDoTilt) { for (int k = 0; k < numVertices; k++) { float y = (base.m_transform.rotation * Vector3.Scale(positions[k], base.m_transform.lossyScale)).y; positions[k].z += (((tk2dBaseSprite)this).IsPerpendicular ? (0f - y) : y); } } } private void BuildInternal(bool updateColors) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0105: 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) if (!setup) { ResizeMesh(); } if ((Object)(object)mesh == (Object)null) { mesh = new Mesh(); mesh.MarkDynamic(); ((Object)mesh).hideFlags = (HideFlags)52; ((Component)this).GetComponent().mesh = mesh; } tk2dSpriteDefinition def = base.collectionInst.spriteDefinitions[((tk2dBaseSprite)this).spriteId]; SetPositionsMesh(meshVertices, def); ComputeUVs(meshUVs, def, meshX, meshY); mesh.vertices = meshVertices; mesh.normals = meshNormals; mesh.tangents = meshTangents; if (isPointMesh) { mesh.SetIndices(meshTriangles, (MeshTopology)5, 0); } else { mesh.triangles = meshTriangles; } mesh.uv = meshUVs; mesh.bounds = tk2dBaseSprite.AdjustedMeshBounds(((tk2dBaseSprite)this).GetBounds(), base.renderLayer); if (updateColors) { UpdateColorsImpl(); } } protected void UpdateColorsImpl() { if ((Object)(object)mesh != (Object)null && meshColors != null && meshColors.Length != 0) { SetColorsMesh(meshColors); mesh.colors32 = meshColors; } } protected void UpdateVerticesImpl() { if (Object.op_Implicit((Object)(object)base.collectionInst) && base.collectionInst.spriteDefinitions != null) { BuildInternal(updateColors: false); } } protected void UpdateGeometryImpl() { BuildInternal(updateColors: true); } protected void CopyPropertyBlock(Material source, Material dest) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) if (dest.HasProperty(m_shaderEmissivePowerID) && source.HasProperty(m_shaderEmissivePowerID)) { dest.SetFloat(m_shaderEmissivePowerID, source.GetFloat(m_shaderEmissivePowerID)); } if (dest.HasProperty(m_shaderEmissiveColorPowerID) && source.HasProperty(m_shaderEmissiveColorPowerID)) { dest.SetFloat(m_shaderEmissiveColorPowerID, source.GetFloat(m_shaderEmissiveColorPowerID)); } if (dest.HasProperty(m_shaderEmissiveColorID) && source.HasProperty(m_shaderEmissiveColorID)) { dest.SetColor(m_shaderEmissiveColorID, source.GetColor(m_shaderEmissiveColorID)); } if (dest.HasProperty(m_shaderThresholdID) && source.HasProperty(m_shaderThresholdID)) { dest.SetFloat(m_shaderThresholdID, source.GetFloat(m_shaderThresholdID)); } } public override void UpdateMaterial() { //IL_0053: 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_0074: Invalid comparison between Unknown and I4 //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Invalid comparison between Unknown and I4 if (!Object.op_Implicit((Object)(object)((BraveBehaviour)this).renderer)) { return; } if (m_shaderEmissiveColorID == -1) { m_shaderEmissivePowerID = Shader.PropertyToID("_EmissivePower"); m_shaderEmissiveColorPowerID = Shader.PropertyToID("_EmissiveColorPower"); m_shaderEmissiveColorID = Shader.PropertyToID("_EmissiveColor"); m_shaderThresholdID = Shader.PropertyToID("_EmissiveThresholdSensitivity"); } if ((int)base.OverrideMaterialMode != 0 && (Object)(object)((BraveBehaviour)this).renderer.sharedMaterial != (Object)null) { if ((int)base.OverrideMaterialMode == 1) { Material materialInst = base.collectionInst.spriteDefinitions[((tk2dBaseSprite)this).spriteId].materialInst; Material sharedMaterial = ((BraveBehaviour)this).renderer.sharedMaterial; if ((Object)(object)sharedMaterial != (Object)(object)materialInst) { sharedMaterial.mainTexture = materialInst.mainTexture; if (ApplyEmissivePropertyBlock) { CopyPropertyBlock(materialInst, sharedMaterial); } } return; } if ((int)base.OverrideMaterialMode == 2) { return; } } if ((Object)(object)((BraveBehaviour)this).renderer.sharedMaterial != (Object)(object)base.collectionInst.spriteDefinitions[((tk2dBaseSprite)this).spriteId].materialInst) { ((BraveBehaviour)this).renderer.material = base.collectionInst.spriteDefinitions[((tk2dBaseSprite)this).spriteId].materialInst; } } public override int GetCurrentVertexCount() { if (meshVertices == null) { return 0; } return meshVertices.Length; } public override void ForceBuild() { if (Object.op_Implicit((Object)(object)this)) { ((tk2dBaseSprite)this).ForceBuild(); ((Component)this).GetComponent().mesh = mesh; } } public override void ReshapeBounds(Vector3 dMin, Vector3 dMax) { //IL_0008: 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_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) //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_002d: 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_0035: 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_0040: 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_0098: 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_00cf: 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_00ed: 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_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_00f5: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_0127: 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) tk2dSpriteDefinition currentSprite = ((tk2dBaseSprite)this).CurrentSprite; Vector3 val = Vector3.Scale(currentSprite.untrimmedBoundsDataCenter - 0.5f * currentSprite.untrimmedBoundsDataExtents, base._scale); Vector3 val2 = Vector3.Scale(currentSprite.untrimmedBoundsDataExtents, base._scale) + dMax - dMin; val2.x /= currentSprite.untrimmedBoundsDataExtents.x; val2.y /= currentSprite.untrimmedBoundsDataExtents.y; Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor((!Mathf.Approximately(base._scale.x, 0f)) ? (val.x * val2.x / base._scale.x) : 0f, (!Mathf.Approximately(base._scale.y, 0f)) ? (val.y * val2.y / base._scale.y) : 0f); Vector3 val4 = val + dMin - val3; val4.z = 0f; ((BraveBehaviour)this).transform.position = ((BraveBehaviour)this).transform.TransformPoint(val4); ((tk2dBaseSprite)this).scale = new Vector3(val2.x, val2.y, base._scale.z); } } public class MiniInteractable : BraveBehaviour, IPlayerInteractable { public delegate IEnumerator InteractionScript(MiniInteractable i, PlayerController p); public InteractionScript interactionScript = DefaultInteractionScript; public bool interacting; public bool doVFX; public bool doHover; public bool autoInteract; public Direction itemFacing = (Direction)4; private VFXPool effect; private float _vfxTimer; private float _hoverTimer; public void Initialize(tk2dSpriteCollectionData collection, int spriteId) { InitializeInternal(collection, spriteId); ((BraveBehaviour)this).sprite.depthUsesTrimmedBounds = true; ((BraveBehaviour)this).sprite.HeightOffGround = -1.25f; ((BraveBehaviour)this).sprite.UpdateZDepth(); } private void InitializeInternal(tk2dSpriteCollectionData collection, int spriteId) { //IL_006c: 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_0097: 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_0121: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Expected O, but got Unknown //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Expected O, but got Unknown //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Expected O, but got Unknown effect = Items.MagicLamp.AsGun().DefaultModule.projectiles[0].hitEffects.tileMapVertical; ((Component)this).gameObject.AddComponent(); ((BraveBehaviour)this).sprite.SetSprite(collection, spriteId); ((BraveBehaviour)this).sprite.IsPerpendicular = true; ((BraveBehaviour)this).sprite.HeightOffGround = 1f; ((BraveBehaviour)this).sprite.PlaceAtPositionByAnchor(((BraveBehaviour)this).transform.parent.position, (Anchor)4); ((BraveBehaviour)((BraveBehaviour)this).sprite).transform.position = dfVectorExtensions.Quantize(((BraveBehaviour)((BraveBehaviour)this).sprite).transform.position, 0.0625f); DepthLookupManager.ProcessRenderer(((BraveBehaviour)((BraveBehaviour)this).sprite).renderer); tk2dSprite componentInParent = ((Component)((BraveBehaviour)this).transform.parent).gameObject.GetComponentInParent(); if (Object.op_Implicit((Object)(object)componentInParent)) { ((tk2dBaseSprite)componentInParent).AttachRenderer(((BraveBehaviour)this).sprite); } ((BraveBehaviour)this).sprite.ignoresTiltworldDepth = true; SpriteOutlineManager.AddOutlineToSprite(((BraveBehaviour)this).sprite, Color.black); ((BraveBehaviour)this).sprite.UpdateZDepth(); SpeculativeRigidbody orAddComponent = GameObjectExtensions.GetOrAddComponent(((Component)this).gameObject); orAddComponent.CollideWithOthers = false; orAddComponent.CollideWithTileMap = false; Vector2 val = ((BraveBehaviour)this).sprite.WorldCenter - Vector3Extensions.XY(((BraveBehaviour)this).transform.position); orAddComponent.PixelColliders = new List { new PixelCollider { ColliderGenerationMode = (PixelColliderGeneration)3, CollisionLayer = (CollisionLayer)6, ManualDiameter = 14, ManualOffsetX = PhysicsEngine.UnitToPixel(val.x) - 7, ManualOffsetY = PhysicsEngine.UnitToPixel(val.y) - 7 } }; orAddComponent.Initialize(); orAddComponent.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)orAddComponent.OnPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(ItemOnPreRigidbodyCollision)); ((BraveBehaviour)this).RegenerateCache(); } private void ItemOnPreRigidbodyCollision(SpeculativeRigidbody myRigidbody, PixelCollider myPixelCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherPixelCollider) { PhysicsEngine.SkipCollision = true; } private void Update() { if (doVFX) { UpdateVFX(); } if (doHover) { UpdateHover(); } } private void UpdateVFX() { //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) //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_0058: 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) _vfxTimer += BraveTime.DeltaTime; if (!(_vfxTimer < 0.4f)) { _vfxTimer = 0f; for (int i = 0; i < 10; i++) { Vector2 val = ((BraveBehaviour)this).sprite.WorldCenter + BraveMathCollege.DegreesToVector((float)i * 36f, 1.3f); effect.SpawnAtPosition(Vector2Extensions.ToVector3ZisY(val, 1f), 0f, (Transform)null, (Vector2?)null, (Vector2?)null, (float?)(-0.05f), false, (SpawnMethod)null, (tk2dBaseSprite)null, false); } } } private void UpdateHover() { //IL_001d: 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) _hoverTimer += BraveTime.DeltaTime; ((BraveBehaviour)((BraveBehaviour)this).sprite).transform.localPosition = Vector3Extensions.WithY(Vector3.zero, (float)Mathf.CeilToInt(2f * Mathf.Sin(4f * _hoverTimer)) / 16f); } public override void OnDestroy() { RoomHandler.unassignedInteractableObjects.Remove((IPlayerInteractable)(object)this); ((BraveBehaviour)this).OnDestroy(); } public void OnEnteredRange(PlayerController interactor) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)this)) { SpriteOutlineManager.RemoveOutlineFromSprite(((BraveBehaviour)this).sprite, false); SpriteOutlineManager.AddOutlineToSprite(((BraveBehaviour)this).sprite, Color.white, 0.01f, 0.005f, (OutlineType)0); if (autoInteract) { Interact(interactor); } } } public void OnExitRange(PlayerController interactor) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)this)) { SpriteOutlineManager.RemoveOutlineFromSprite(((BraveBehaviour)this).sprite, false); SpriteOutlineManager.AddOutlineToSprite(((BraveBehaviour)this).sprite, Color.black, 0.01f, 0.005f, (OutlineType)0); } } public float GetDistanceToPoint(Vector2 point) { //IL_0022: 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_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) //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_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) if (!Object.op_Implicit((Object)(object)this)) { return 1000f; } if ((Object)(object)((BraveBehaviour)this).sprite == (Object)null) { return 100f; } Vector3 val = Vector2.op_Implicit(BraveMathCollege.ClosestPointOnRectangle(point, ((BraveBehaviour)this).specRigidbody.UnitBottomLeft, ((BraveBehaviour)this).specRigidbody.UnitDimensions)); return Vector2.Distance(point, Vector2.op_Implicit(val)) / 1.5f; } public float GetOverrideMaxDistance() { return -1f; } public void Interact(PlayerController player) { if (!interacting) { interacting = true; ((MonoBehaviour)player).StartCoroutine(interactionScript(this, player)); } } public static IEnumerator DefaultInteractionScript(MiniInteractable i, PlayerController p) { ETGModConsole.Log((object)"interacted! now override this and actually do something o:", false); i.interacting = false; yield break; } public string GetAnimationState(PlayerController interactor, out bool shouldBeFlipped) { shouldBeFlipped = false; return string.Empty; } public static MiniInteractable CreateInteractableAtPosition(tk2dBaseSprite sprite, Vector2 position, InteractionScript iscript = null) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) return CreateInteractableAtPosition(sprite.collection, sprite.spriteId, position, iscript); } public static MiniInteractable CreateInteractableAtPosition(tk2dSpriteCollectionData collection, int spriteId, Vector2 position, InteractionScript iscript = null) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0011: 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_0026: 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_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_004c: 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) GameObject val = new GameObject("Mini interactible position test"); val.transform.position = Vector2Extensions.ToVector3ZisY(position, 0f); GameObject val2 = new GameObject("Mini interactible test"); val2.transform.parent = val.transform; val2.transform.localPosition = Vector3.zero; val2.transform.position = Vector3.zero; MiniInteractable miniInteractable = val2.AddComponent(); if (!RoomHandler.unassignedInteractableObjects.Contains((IPlayerInteractable)(object)miniInteractable)) { RoomHandler.unassignedInteractableObjects.Add((IPlayerInteractable)(object)miniInteractable); } miniInteractable.interactionScript = iscript ?? new InteractionScript(DefaultInteractionScript); miniInteractable.Initialize(collection, spriteId); return miniInteractable; } } [HarmonyPatch] public class CwaffProjectile : MonoBehaviour, IPPPComponent { public string spawnSound; public string chargeSound; public bool stopSoundOnDeath; public bool uniqueSounds; public GameObject shrapnelVFX; public int shrapnelCount = 10; public float shrapnelMinVelocity = 4f; public float shrapnelMaxVelocity = 8f; public float shrapnelLifetime = 0.3f; public bool preventOrbiting; public bool firedForFree = true; public bool becomeDebris; public bool preventSparks; public float spinRate; public float lightStrength; public float lightRange; public Color lightColor = Color.white; private Projectile _projectile; private PlayerController _owner; private bool _setupLight; private bool _checkedPooled; private bool _isPooled; private void Start() { //IL_00e2: 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_0160: Unknown result type (might be due to invalid IL or missing references) _projectile = ((Component)this).GetComponent(); ref PlayerController owner = ref _owner; GameActor owner2 = _projectile.Owner; owner = (PlayerController)(object)((owner2 is PlayerController) ? owner2 : null); if (!_checkedPooled) { _isPooled = Object.op_Implicit((Object)(object)((Component)this).gameObject.GetComponent()); _checkedPooled = true; } if (!_isPooled) { _projectile.OnDestruction += OnProjectileDestroy; } if (becomeDebris) { _projectile.DestroyMode = (ProjectileDestroyMode)2; } if (!string.IsNullOrEmpty(spawnSound)) { if (uniqueSounds) { ((Component)this).gameObject.Play(spawnSound + "_stop_all"); } ((Component)this).gameObject.Play(spawnSound); } if (!_setupLight && lightStrength > 0f) { Light obj = new GameObject().AddComponent(); obj.color = lightColor; obj.intensity = lightStrength; obj.range = lightRange; obj.type = (LightType)2; obj.bounceIntensity = 1f; obj.renderMode = (LightRenderMode)0; obj.shadows = (LightShadows)0; ((Component)obj).gameObject.transform.parent = ((Component)this).transform; ((Component)obj).gameObject.transform.localPosition = new Vector3(0f, 0f, -0.8f); ((Component)obj).gameObject.AddComponent().heightOffGround = -0.8f; _setupLight = true; } } public void PPPInit(PlayerProjectilePoolInfo pppi) { pppi.OnDestruction = (Action)Delegate.Combine(pppi.OnDestruction, new Action(OnProjectileDestroy)); } public void PPPRespawn() { Start(); } public void PPPReset(GameObject prefab) { //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) CwaffProjectile component = prefab.GetComponent(); spawnSound = component.spawnSound; chargeSound = component.chargeSound; stopSoundOnDeath = component.stopSoundOnDeath; uniqueSounds = component.uniqueSounds; shrapnelVFX = component.shrapnelVFX; shrapnelCount = component.shrapnelCount; shrapnelMinVelocity = component.shrapnelMinVelocity; shrapnelMaxVelocity = component.shrapnelMaxVelocity; shrapnelLifetime = component.shrapnelLifetime; preventOrbiting = component.preventOrbiting; firedForFree = component.firedForFree; becomeDebris = component.becomeDebris; preventSparks = component.preventSparks; spinRate = component.spinRate; lightStrength = component.lightStrength; lightRange = component.lightRange; lightColor = component.lightColor; _projectile = null; _owner = null; } private void Update() { //IL_002b: 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) if (spinRate != 0f && Object.op_Implicit((Object)(object)_projectile.m_transform)) { Transform transform = _projectile.m_transform; transform.rotation *= Quaternion.Euler(0f, 0f, BraveTime.DeltaTime * spinRate); } } private void OnProjectileDestroy(Projectile p) { if (Object.op_Implicit((Object)(object)shrapnelVFX)) { p.SpawnShrapnel(shrapnelVFX, shrapnelCount, shrapnelMinVelocity, shrapnelMaxVelocity, shrapnelLifetime); } if (stopSoundOnDeath && !string.IsNullOrEmpty(spawnSound)) { ((Component)this).gameObject.Play(spawnSound + "_stop"); } if (!_isPooled) { Object.Destroy((Object)(object)this); } } private void OnDestroy() { } internal static void PlayCollisionSounds(Projectile p, bool hitEnemy) { if (GameManager.AUDIO_ENABLED) { if (hitEnemy && !string.IsNullOrEmpty(p.enemyImpactEventName)) { AkSoundEngine.PostEvent(p.enemyImpactEventName, ((Component)p).gameObject); } else if (!hitEnemy && !string.IsNullOrEmpty(p.objectImpactEventName)) { AkSoundEngine.PostEvent(p.objectImpactEventName, ((Component)p).gameObject); } } } internal static void DetermineIfFiredForFree(Projectile p, Gun gun, ProjectileModule module) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Invalid comparison between Unknown and I4 CwaffProjectile component = ((Component)p).gameObject.GetComponent(); if (component == null) { return; } if (gun.InfiniteAmmo) { component.firedForFree = true; return; } if ((Object)(object)gun.modifiedFinalVolley != (Object)null && module == gun.modifiedFinalVolley.projectiles[0]) { module = gun.DefaultModule; } int ammoCost = module.ammoCost; if ((int)module.shootStyle == 3) { ChargeProjectile chargeProjectile = module.GetChargeProjectile(gun.m_moduleData[module].chargeTime); if (chargeProjectile.UsesAmmo) { ammoCost = chargeProjectile.AmmoCost; } } component.firedForFree = ammoCost == 0; } [HarmonyPatch(typeof(GunVolleyModificationItem), "HandleStartOrbit")] [HarmonyPrefix] private static bool PreventOrbitingProjectilePatch(GunVolleyModificationItem __instance, BounceProjModifier bouncer, SpeculativeRigidbody srb) { CwaffProjectile component = ((Component)((BraveBehaviour)bouncer).projectile).GetComponent(); if (component == null) { return true; } return !component.preventOrbiting; } [HarmonyPatch(typeof(GunVolleyModificationItem), "PostProcessProjectileOrbitBeam")] [HarmonyPrefix] private static bool PreventOrbitingBeamPatch(GunVolleyModificationItem __instance, BeamController beam) { CwaffProjectile component = ((Component)((BraveBehaviour)beam).projectile).GetComponent(); if (component == null) { return true; } return !component.preventOrbiting; } [HarmonyPatch(typeof(Projectile), "HandleSparks")] [HarmonyPrefix] private static bool ProjectileHandleSparksPatch(Projectile __instance, Vector2? overridePoint) { CwaffProjectile component = ((Component)__instance).GetComponent(); if (component != null) { return !component.preventSparks; } if (Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { return false; } return true; } [HarmonyPatch(typeof(Gun), "HandleChargeEffects")] [HarmonyPostfix] private static void GunHandleChargeEffectsPatch(Gun __instance, ChargeProjectile oldChargeProjectile, ChargeProjectile newChargeProjectile) { if (newChargeProjectile == null) { return; } Projectile projectile = newChargeProjectile.Projectile; if (projectile != null) { CwaffProjectile component = ((Component)projectile).gameObject.GetComponent(); if (component != null && !string.IsNullOrEmpty(component.chargeSound)) { ((Component)__instance).gameObject.Play(component.chargeSound); } } } [HarmonyPatch(typeof(BasicBeamController), "HandleBeamFrame")] [HarmonyPostfix] private static void BasicBeamControllerHandleBeamFramePatch(BasicBeamController __instance, ref List __result) { if (string.IsNullOrEmpty(((BraveBehaviour)__instance).projectile.enemyImpactEventName)) { return; } CwaffProjectile component = ((Component)__instance).gameObject.GetComponent(); if (component == null) { return; } bool play = false; foreach (SpeculativeRigidbody item in __result) { if (Object.op_Implicit((Object)(object)item) && Object.op_Implicit((Object)(object)((BraveBehaviour)item).aiActor)) { play = true; break; } } ((MonoBehaviour)(object)component).LoopSoundIf(play, ((BraveBehaviour)__instance).projectile.enemyImpactEventName); } } [HarmonyPatch] public class WeirdProjectile : Projectile { public enum FiredBy { FREEFIRE, PRIMARYGUN, SECONDARYGUN, ENEMYGUN } internal static Stack _CurrentProjectileGun = new Stack(); internal static Stack _CurrentProjectileMod = new Stack(); public GameActor sourceOwner { get; private set; } public Gun sourceGun { get; private set; } public ProjectileModule sourceMod { get; private set; } public FiredBy firedBy { get; private set; } private void OnEnable() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) DetermineFiringSource(); base.damageTypes = (CoreDamageTypes)0; base.collidesWithEnemies = false; base.collidesWithPlayer = false; tk2dBaseSprite component = ((Component)this).gameObject.GetComponent(); if (component != null) { Object.Destroy((Object)(object)component); } ((Component)this).gameObject.AddComponent(); } public sealed override void Move() { if (firedBy switch { FiredBy.FREEFIRE => OnFreeFired(), FiredBy.PRIMARYGUN => OnFiredByPlayer(primaryGun: true), FiredBy.SECONDARYGUN => OnFiredByPlayer(primaryGun: false), FiredBy.ENEMYGUN => OnFiredByEnemy(), _ => true, }) { OnFiredByAnything(); } ((Projectile)this).DieInAir(true, false, false, false); } protected virtual bool OnFreeFired() { return true; } protected virtual bool OnFiredByPlayer(bool primaryGun) { return true; } protected virtual bool OnFiredByEnemy() { return true; } protected virtual void OnFiredByAnything() { } protected Projectile SpawnDifferentProjectile(Projectile proj) { //IL_000c: 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) Projectile component = SpawnManager.SpawnProjectile(((Component)proj).gameObject, ((BraveBehaviour)this).transform.position, ((BraveBehaviour)this).transform.rotation, true).GetComponent(); component.Owner = ((Projectile)this).Owner; component.Shooter = ((Projectile)this).Shooter; GameActor owner = ((Projectile)this).Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null) { val.DoPostProcessProjectile(component); } return component; } protected Projectile SpawnDifferentProjectile(GameObject proj) { //IL_0007: 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) Projectile component = SpawnManager.SpawnProjectile(proj, ((BraveBehaviour)this).transform.position, ((BraveBehaviour)this).transform.rotation, true).GetComponent(); component.Owner = ((Projectile)this).Owner; component.Shooter = ((Projectile)this).Shooter; GameActor owner = ((Projectile)this).Owner; PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val != null) { val.DoPostProcessProjectile(component); } return component; } private void DetermineFiringSource() { if (_CurrentProjectileGun.Count != 0) { Gun val = _CurrentProjectileGun.Peek(); if (val != null) { GameActor owner = val.m_owner; if (owner != null) { sourceOwner = owner; sourceGun = val; sourceMod = _CurrentProjectileMod.Peek(); if (owner is AIActor) { firedBy = FiredBy.ENEMYGUN; return; } PlayerController val2 = (PlayerController)(object)((owner is PlayerController) ? owner : null); if (val2 == null) { firedBy = FiredBy.FREEFIRE; } else if ((Object)(object)val == (Object)(object)((GameActor)val2).CurrentGun) { firedBy = FiredBy.PRIMARYGUN; } else if ((Object)(object)val == (Object)(object)val2.CurrentSecondaryGun) { firedBy = FiredBy.SECONDARYGUN; } else { firedBy = FiredBy.FREEFIRE; } return; } } } sourceGun = null; sourceMod = null; firedBy = FiredBy.FREEFIRE; } } public class CwaffBone { private static readonly LinkedList _BonePool = new LinkedList(); private static int _BonesCreated = 0; public Vector2 pos; public Vector2 normal; internal static LinkedListNode Rent(Vector2 pos) { //IL_0037: 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_0042: Unknown result type (might be due to invalid IL or missing references) if (_BonePool.Count == 0) { _BonePool.AddLast(new CwaffBone()); } LinkedListNode? last = _BonePool.Last; _BonePool.RemoveLast(); CwaffBone value = last.Value; value.pos = pos; value.normal = default(Vector2); return last; } internal static void Return(LinkedListNode bone) { _BonePool.AddLast(bone); } internal static void ReturnAll(ref LinkedList bones) { if (bones != null) { while (bones.Count > 0) { LinkedListNode last = bones.Last; bones.RemoveLast(); _BonePool.AddLast(last); } } } private CwaffBone() { _BonesCreated++; } } public class CwaffBoneManager : BraveBehaviour { private const int _SUBTILE_PIXEL_LENGTH = 4; private LinkedList _bones = new LinkedList(); private tk2dTiledSprite _sprite; private int _spriteSubtileWidth; private Vector2 _minBonePosition; private Vector2 _maxBonePosition; private float _globalTimer; private tk2dSpriteAnimationClip _animation; private tk2dSpriteAnimationClip _startAnimation; private float _projectileScale = 1f; private static readonly Quaternion _Rot90 = Quaternion.Euler(0f, 0f, 90f); public void Setup(tk2dSpriteAnimationClip animation, tk2dSpriteAnimationClip startAnimation = null, float projectileScale = 1f) { //IL_0006: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown ((BraveBehaviour)this).transform.rotation = Quaternion.identity; ((BraveBehaviour)this).transform.position = Vector3.zero; _animation = animation; _startAnimation = ((startAnimation != null) ? startAnimation : animation); _projectileScale = projectileScale; _sprite = ((Component)(object)this).GetOrAddComponent(); ((tk2dBaseSprite)_sprite).collection = animation.frames[0].spriteCollection; ((tk2dBaseSprite)_sprite).spriteId = animation.frames[0].spriteId; _sprite.OverrideGetTiledSpriteGeomDesc = new OverrideGetTiledSpriteGeomDescDelegate(GetTiledSpriteGeomDesc); if (startAnimation != null) { _sprite.OverrideSetTiledSpriteGeom = new OverrideSetTiledSpriteGeomDelegate(SetStartAnimatedTiledSpriteGeom); } else { _sprite.OverrideSetTiledSpriteGeom = new OverrideSetTiledSpriteGeomDelegate(SetTiledSpriteGeom); } tk2dSpriteDefinition val = ((tk2dBaseSprite)_sprite).collection.spriteDefinitions[((tk2dBaseSprite)_sprite).spriteId]; _spriteSubtileWidth = Mathf.RoundToInt(val.untrimmedBoundsDataExtents.x / val.texelSize.x) / 4; } public void UpdateTimers() { _globalTimer += BraveTime.DeltaTime; } public void ManualLateUpdate() { //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_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) //IL_0092: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_003f: 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_0051: 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_0063: 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) float num = float.MaxValue; float num2 = float.MinValue; float num3 = float.MaxValue; float num4 = float.MinValue; for (LinkedListNode linkedListNode = _bones.First; linkedListNode != null; linkedListNode = linkedListNode.Next) { Vector2 pos = linkedListNode.Value.pos; if (pos.x < num) { num = pos.x; } if (pos.x > num2) { num2 = pos.x; } if (pos.y < num3) { num3 = pos.y; } if (pos.y > num4) { num4 = pos.y; } } _minBonePosition = new Vector2(num, num3); _maxBonePosition = new Vector2(num2, num4); ((BraveBehaviour)this).transform.position = new Vector3(num, num3); ((tk2dBaseSprite)_sprite).ForceBuild(); ((tk2dBaseSprite)_sprite).UpdateZDepth(); } public void UpdateAnimations() { UpdateTimers(); ((tk2dBaseSprite)_sprite).ForceBuild(); ((tk2dBaseSprite)_sprite).UpdateZDepth(); } public void RecomputeNormals() { //IL_0014: 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_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) //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_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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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) for (LinkedListNode linkedListNode = _bones.First; linkedListNode != _bones.Last; linkedListNode = linkedListNode.Next) { CwaffBone value = linkedListNode.Value; Vector3 val = _Rot90 * Vector2.op_Implicit(linkedListNode.Next.Value.pos - linkedListNode.Value.pos); value.normal = Vector2.op_Implicit(((Vector3)(ref val)).normalized); } if (_bones.Count > 1) { _bones.Last.Value.normal = _bones.Last.Previous.Value.normal; } } public void ReturnAllBones() { CwaffBone.ReturnAll(ref _bones); } public void RentBone(Vector2 pos) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _bones.AddLast(CwaffBone.Rent(pos)); } public bool HasBones() { return _bones.Count > 0; } public int BoneCount() { return _bones.Count; } public void ReplaceBones(List points) { //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_002e: Unknown result type (might be due to invalid IL or missing references) int count = _bones.Count; int count2 = points.Count; LinkedListNode linkedListNode = _bones.First; for (int i = 0; i < points.Count; i++) { if (linkedListNode == null) { _bones.AddLast(CwaffBone.Rent(points[i])); continue; } linkedListNode.Value.pos = points[i]; linkedListNode = linkedListNode.Next; } while (count-- > count2) { linkedListNode = _bones.Last; _bones.RemoveLast(); CwaffBone.Return(linkedListNode); } } public override void OnDestroy() { ((BraveBehaviour)this).OnDestroy(); CwaffBone.ReturnAll(ref _bones); } private void GetTiledSpriteGeomDesc(out int numVertices, out int numIndices, tk2dSpriteDefinition spriteDef, Vector2 dimensions) { int num = Mathf.Max(_bones.Count - 1, 0); numVertices = num * 4; numIndices = num * 6; } private unsafe void SetTiledSpriteGeom(Vector3[] pos, Vector2[] uv, int offset, out Vector3 boundsCenter, out Vector3 boundsExtents, tk2dSpriteDefinition spriteDef, Vector3 scale, Vector2 dimensions, Anchor anchor, float colliderOffsetZ, float colliderExtentZ) { //IL_0008: 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_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) //IL_0022: 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_0035: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_0143: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //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_0165: 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_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0180: 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_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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) boundsCenter = Vector2.op_Implicit(0.5f * (_maxBonePosition + _minBonePosition)); boundsExtents = Vector2.op_Implicit(0.5f * (_maxBonePosition - _minBonePosition)); if (_bones.Count < 2) { return; } int num = Mathf.RoundToInt(spriteDef.untrimmedBoundsDataExtents.x / spriteDef.texelSize.x) / 4; int num2 = _bones.Count - 1; int num3 = num - 1; int num4 = Mathf.CeilToInt((float)num2 / (float)num); int num5 = Mathf.FloorToInt(Mathf.Repeat(_globalTimer * _animation.fps, (float)_animation.frames.Length)); tk2dSpriteAnimationFrame val = _animation.frames[num5]; tk2dSpriteDefinition obj = val.spriteCollection.spriteDefinitions[val.spriteId]; float num6 = 1f / (float)_spriteSubtileWidth; float y = obj.position0.y; float y2 = obj.position1.y; float y3 = obj.position2.y; float y4 = obj.position3.y; Vector2 val2 = obj.uvs[0]; Vector2 val3 = obj.uvs[1]; Vector2 val4 = obj.uvs[2]; Vector2 val5 = obj.uvs[3]; float x = val2.x; float x2 = val4.x; float y5 = val2.y; float y6 = val4.y; float num7 = val3.x - x; float num8 = val5.x - x2; float num9 = val3.y - y5; float num10 = val5.y - y6; float x3 = _minBonePosition.x; float y7 = _minBonePosition.y; float num11 = 1f / (float)num; LinkedListNode linkedListNode = _bones.First; CwaffBone value = linkedListNode.Value; float num12 = value.pos.x - x3; float num13 = value.pos.y - y7; float x4 = value.normal.x; float y8 = value.normal.y; fixed (Vector3* ptr = pos) { fixed (Vector2* ptr2 = uv) { Vector3* ptr3 = ptr; Vector2* ptr4 = ptr2; for (int i = 0; i < num4; i++) { if (i == num4 - 1 && num2 % num != 0) { num3 = num2 % num - 1; } float num14 = 0f; float x5 = num12 + x4 * y; float y9 = num13 + y8 * y; float x6 = num12 + x4 * y3; float y10 = num13 + y8 * y3; for (int j = 0; j <= num3; j++) { float num15 = num12; float num16 = num13; linkedListNode = linkedListNode.Next; value = linkedListNode.Value; num12 = value.pos.x - x3; num13 = value.pos.y - y7; x4 = value.normal.x; y8 = value.normal.y; if (i == num4 - 1 && j == num3) { float num17 = num12 - num15; float num18 = num13 - num16; num11 = Mathf.Sqrt(num17 * num17 + num18 * num18) / (float)num; } float x7 = x + num7 * num14; float y11 = y5 + num9 * num14; float num19 = num14 + num11; float x8 = x2 + num8 * num19; float y12 = y6 + num10 * num19; ((Vector3)ptr3).x = x5; ((Vector3)ptr3).y = y9; ((Vector3)ptr3).z = 0f; ptr3 = (Vector3*)((byte*)ptr3 + Unsafe.SizeOf()); ((Vector2)ptr4).x = x7; ((Vector2)ptr4).y = y11; ptr4 = (Vector2*)((byte*)ptr4 + Unsafe.SizeOf()); x5 = (((Vector3)ptr3).x = num12 + x4 * y2); y9 = (((Vector3)ptr3).y = num13 + y8 * y2); ((Vector3)ptr3).z = 0f; ptr3 = (Vector3*)((byte*)ptr3 + Unsafe.SizeOf()); ((Vector2)ptr4).x = x8; ((Vector2)ptr4).y = y11; ptr4 = (Vector2*)((byte*)ptr4 + Unsafe.SizeOf()); ((Vector3)ptr3).x = x6; ((Vector3)ptr3).y = y10; ((Vector3)ptr3).z = 0f; ptr3 = (Vector3*)((byte*)ptr3 + Unsafe.SizeOf()); ((Vector2)ptr4).x = x7; ((Vector2)ptr4).y = y12; ptr4 = (Vector2*)((byte*)ptr4 + Unsafe.SizeOf()); x6 = (((Vector3)ptr3).x = num12 + x4 * y4); y10 = (((Vector3)ptr3).y = num13 + y8 * y4); ((Vector3)ptr3).z = 0f; ptr3 = (Vector3*)((byte*)ptr3 + Unsafe.SizeOf()); ((Vector2)ptr4).x = x8; ((Vector2)ptr4).y = y12; ptr4 = (Vector2*)((byte*)ptr4 + Unsafe.SizeOf()); num14 += num6; } } } } } public void SetStartAnimatedTiledSpriteGeom(Vector3[] pos, Vector2[] uv, int offset, out Vector3 boundsCenter, out Vector3 boundsExtents, tk2dSpriteDefinition spriteDef, Vector3 scale, Vector2 dimensions, Anchor anchor, float colliderOffsetZ, float colliderExtentZ) { //IL_0048: 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_0053: 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_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_006f: 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_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_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_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: 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_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0201: 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_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: 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_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028c: 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_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: 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_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02de: 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_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0313: 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_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_034c: 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_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0362: 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_036e: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.RoundToInt(spriteDef.untrimmedBoundsDataExtents.x / spriteDef.texelSize.x) / 4; int num2 = Mathf.Max(_bones.Count - 1, 0); int num3 = Mathf.CeilToInt((float)num2 / (float)num); boundsCenter = Vector2.op_Implicit(0.5f * (_minBonePosition + _maxBonePosition)); boundsExtents = Vector2.op_Implicit(0.5f * (_maxBonePosition - _minBonePosition)); LinkedListNode linkedListNode = _bones.First; int num4 = 0; int num5 = Mathf.FloorToInt(Mathf.Repeat(_globalTimer * _animation.fps, (float)_animation.frames.Length)); for (int i = 0; i < num3; i++) { int num6 = num - 1; if (i == num3 - 1 && num2 % num != 0) { num6 = num2 % num - 1; } tk2dSpriteDefinition val = spriteDef; if (i == 0) { int num7 = Mathf.FloorToInt(Mathf.Repeat(_globalTimer * _startAnimation.fps, (float)_startAnimation.frames.Length)); val = ((tk2dBaseSprite)_sprite).Collection.spriteDefinitions[_startAnimation.frames[num7].spriteId]; } else { val = ((tk2dBaseSprite)_sprite).Collection.spriteDefinitions[_animation.frames[num5].spriteId]; } float num8 = 0f; for (int j = 0; j <= num6; j++) { float num9 = 1f; CwaffBone value = linkedListNode.Value; CwaffBone value2 = linkedListNode.Next.Value; if (i == num3 - 1 && j == num6) { num9 = Vector2.Distance(value2.pos, value.pos); } int num10 = offset + num4; pos[num10++] = Vector2Extensions.ToVector3ZUp(value.pos + value.normal * (val.position0.y * _projectileScale) - _minBonePosition, 0f); pos[num10++] = Vector2Extensions.ToVector3ZUp(value2.pos + value2.normal * (val.position1.y * _projectileScale) - _minBonePosition, 0f); pos[num10++] = Vector2Extensions.ToVector3ZUp(value.pos + value.normal * (val.position2.y * _projectileScale) - _minBonePosition, 0f); pos[num10++] = Vector2Extensions.ToVector3ZUp(value2.pos + value2.normal * (val.position3.y * _projectileScale) - _minBonePosition, 0f); Vector2 val2 = Vector2.Lerp(val.uvs[0], val.uvs[1], num8); Vector2 val3 = Vector2.Lerp(val.uvs[2], val.uvs[3], num8 + num9 / (float)num); num10 = offset + num4; uv[num10++] = val2; uv[num10++] = new Vector2(val3.x, val2.y); uv[num10++] = new Vector2(val2.x, val3.y); uv[num10++] = val3; num4 += 4; num8 += num9 / (float)_spriteSubtileWidth; linkedListNode = linkedListNode.Next; } } } } public abstract class DamageAdjuster : MonoBehaviour { public enum ApplyPriority { Top, High, Normal, Low, Bottom } public virtual ApplyPriority Priority => ApplyPriority.Normal; internal static float AdjustDamageStatic(float currentDamage, Projectile proj, SpeculativeRigidbody body) { AIActor component = ((Component)body).GetComponent(); if (component == null) { return currentDamage; } float num = currentDamage; foreach (DamageAdjuster item in from d in ((Component)proj).GetComponents() orderby d.Priority select d) { num = item.AdjustDamage(num, proj, component); } return num; } protected abstract float AdjustDamage(float currentDamage, Projectile proj, AIActor enemy); } public static class CwaffShaders { internal class HellShaderHandler : MonoBehaviour { private Material mat; private int coordsId; private void Start() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown mat = new Material(HellShader); mat.SetTexture("_NoiseTex", (Texture)(object)NoiseTexture); mat.SetFloat("_FogSpeed", 0.085f); mat.SetFloat("_MorphSpeed", 0.068f); mat.SetFloat("_FogSize", 0.31f); mat.SetFloat("_FogThickness", 1f); mat.SetFloat("_FogStrength", 0.675f); coordsId = Shader.PropertyToID("_CamXYWH"); Update(); TurnOn(); } private void Update() { //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_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_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_002e: 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_0041: 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_004d: Unknown result type (might be due to invalid IL or missing references) CameraController mainCameraController = GameManager.Instance.MainCameraController; Vector2 minVisiblePoint = mainCameraController.MinVisiblePoint; Vector2 val = mainCameraController.MaxVisiblePoint - minVisiblePoint; mat.SetVector(coordsId, new Vector4(0.0625f * minVisiblePoint.x, 0.0625f * minVisiblePoint.y, val.x, val.y)); } private void OnDestroy() { TurnOff(); } internal void TurnOn() { Pixelator.Instance.RegisterAdditionalRenderPass(mat); } internal void TurnOff() { Pixelator.Instance.DeregisterAdditionalRenderPass(mat); } } [HarmonyPatch(typeof(SpiceItem), "DoEffect")] private static class SpiceItemDoEffectPatch { private static void Postfix(SpiceItem __instance, PlayerController user) { CheckShaders(user); } } [HarmonyPatch(typeof(AIActor), "Start")] private class RandomCosmicKinPatch { private const float _COSMIFY_CHANCE = 0.0011f; private static void Postfix(AIActor __instance) { if (Random.value > 0.0011f || __instance.EnemyGuid != "01972dee89fc4404a5c408d50007dad5") { return; } tk2dBaseSprite sprite = ((BraveBehaviour)__instance).sprite; tk2dSprite val = (tk2dSprite)(object)((sprite is tk2dSprite) ? sprite : null); if (val == null) { return; } Cosmify((tk2dBaseSprite)(object)val); for (int i = 0; i < ((Component)val).gameObject.transform.childCount; i++) { tk2dSprite component = ((Component)((Component)val).gameObject.transform.GetChild(i)).GetComponent(); if (component != null) { Cosmify((tk2dBaseSprite)(object)component); } } } } public static Shader DigitizeShader; public static Shader UnlitDigitizeShader; public static Shader GoldShader; public static Shader CosmicShader; public static Shader ElectricShader; public static Shader EmissiveAlphaShader; public static Shader CorruptShader; public static Shader ChromaShader; public static Shader DesatShader; public static Shader WiggleShader; public static Shader ScreenWiggleShader; public static Shader ScreenBasicShader; public static Shader ShatterShader; public static Shader GlassShader; public static Shader BirthShader; public static Shader HellShader; public static Texture2D DigitizeTexture; public static Texture2D StarsTexture; public static Texture2D NoiseTexture; public static Texture2D StarNoiseTexture; public static Texture2D PowerdownTexture; public static Texture2D PowerupTexture; internal static Material _WiggleMat; internal static HellShaderHandler _HellShaderHandler; private static string GetShaderBundleNameForPlatform() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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 //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Invalid comparison between Unknown and I4 //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Invalid comparison between Unknown and I4 string text = (((int)SystemInfo.graphicsDeviceType == 17) ? "linux" : (((int)SystemInfo.graphicsDeviceType == 8) ? "linux" : (((int)SystemInfo.graphicsDeviceType == 11) ? "linux" : (((int)SystemInfo.graphicsDeviceType == 16) ? "macos" : (((int)SystemInfo.graphicsDeviceType == 1) ? "windows" : (((int)SystemInfo.graphicsDeviceType == 2) ? "windows" : (((int)SystemInfo.graphicsDeviceType == 18) ? "windows" : (((int)Application.platform == 13) ? "linux" : (((int)Application.platform == 1) ? "macos" : "windows"))))))))); return "CwaffingTheGungy.Resources.cwaffshaders-" + text; } public static void Init() { string shaderBundleNameForPlatform = GetShaderBundleNameForPlatform(); using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(shaderBundleNameForPlatform)) { if (stream == null) { return; } AssetBundle obj = AssetBundle.LoadFromStream(stream); NoiseTexture = obj.LoadAsset("assets/sf_noise_clouds_01.png"); ElectricShader = obj.LoadAsset("assets/electroshader.shader"); DigitizeShader = obj.LoadAsset("assets/digitizeshader.shader"); DigitizeTexture = obj.LoadAsset("assets/bits.png"); UnlitDigitizeShader = obj.LoadAsset("assets/digitizeshaderunlit.shader"); GoldShader = obj.LoadAsset("assets/goldshader.shader"); CosmicShader = obj.LoadAsset("assets/cosmicshader.shader"); StarsTexture = obj.LoadAsset("assets/startexture_cropped.png"); EmissiveAlphaShader = obj.LoadAsset("assets/emissivealphashader.shader"); CorruptShader = obj.LoadAsset("assets/corruptshader.shader"); ChromaShader = obj.LoadAsset("assets/chromashiftshader.shader"); DesatShader = obj.LoadAsset("assets/desaturateshader.shader"); PowerdownTexture = obj.LoadAsset("assets/powerdown.png"); PowerupTexture = obj.LoadAsset("assets/powerup.png"); WiggleShader = obj.LoadAsset("assets/wiggleshader.shader"); ScreenWiggleShader = obj.LoadAsset("assets/screenwiggleshader.shader"); ScreenBasicShader = obj.LoadAsset("assets/screenbasicshader.shader"); ShatterShader = obj.LoadAsset("assets/scattershader.shader"); GlassShader = obj.LoadAsset("assets/glassshader.shader"); StarNoiseTexture = obj.LoadAsset("assets/starnoise.png"); BirthShader = obj.LoadAsset("assets/screenbirthshader.shader"); HellShader = obj.LoadAsset("assets/screenhellshader.shader"); } CwaffEvents.OnCleanStart = (Action)Delegate.Combine(CwaffEvents.OnCleanStart, new Action(ResetShaders)); CwaffEvents.OnStatsRecalculated = (Action)Delegate.Combine(CwaffEvents.OnStatsRecalculated, new Action(CheckShaders)); CwaffEvents.OnNewFloorFullyLoaded = (Action)Delegate.Combine(CwaffEvents.OnNewFloorFullyLoaded, new Action(CheckBulletHellShadersForFloor)); } internal static void CheckShaders(PlayerController player) { CheckSpiceShaders(); } private static void ResetShaders() { CheckSpiceShaders(false); } private static bool SpiceShadersEnabled(bool? enabled = null) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Invalid comparison between Unknown and I4 if (!(enabled ?? CwaffConfig._Gunfig.Enabled("Enable Spice Shaders"))) { return false; } if (!Object.op_Implicit((Object)(object)GameManager.Instance) || !Object.op_Implicit((Object)(object)GameManager.Instance.PrimaryPlayer)) { return false; } if ((int)GameManager.Instance.CurrentGameType == 1) { return false; } return GameManager.Instance.PrimaryPlayer.spiceCount > 0; } internal static void CheckSpiceShaders(bool? enabled = null) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown if (!SpiceShadersEnabled(enabled)) { if (Pixelator.HasInstance) { Pixelator.Instance.DeregisterAdditionalRenderPass(_WiggleMat); } return; } if (_WiggleMat == null) { _WiggleMat = new Material(ScreenWiggleShader); } _WiggleMat.SetFloat("_Amplitude", 0.0008f * (float)Mathf.Min(GameManager.Instance.PrimaryPlayer.spiceCount, 4)); if (Pixelator.HasInstance) { Pixelator.Instance.RegisterAdditionalRenderPass(_WiggleMat); } } internal static void CheckBulletHellShadersForFloor() { CheckBulletHellShaders(CwaffConfig._Gunfig.Enabled("Enable Bullet Hell Shaders")); } internal static void CheckBulletHellShaders(bool enabled) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //IL_0061: Unknown result type (might be due to invalid IL or missing references) if ((int)GameManager.Instance.Dungeon.tileIndices.tilesetId != 128) { enabled = false; } if (!Object.op_Implicit((Object)(object)CwaffRunData.Instance) || !CwaffRunData.Instance.scrambledBulletHell) { enabled = false; } if (enabled && (Object)(object)_HellShaderHandler == (Object)null) { _HellShaderHandler = new GameObject("hell shader handler", new Type[1] { typeof(HellShaderHandler) }).GetComponent(); } else if (!enabled && (Object)(object)_HellShaderHandler != (Object)null) { Object.Destroy((Object)(object)((Component)_HellShaderHandler).gameObject); } } public static void Digitize(T sprite, float delay = 0f) where T : tk2dBaseSprite { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(); tk2dBaseSprite val2 = null; if ((object)typeof(T) == typeof(tk2dSlicedSprite)) { val2 = (tk2dBaseSprite)(object)val.AddComponent(); val2.SetSprite(((tk2dBaseSprite)sprite).collection, ((tk2dBaseSprite)sprite).spriteId); object obj = sprite; tk2dSlicedSprite val3 = (tk2dSlicedSprite)((obj is tk2dSlicedSprite) ? obj : null); tk2dBaseSprite obj2 = ((val2 is tk2dSlicedSprite) ? val2 : null); ((tk2dSlicedSprite)obj2).dimensions = val3.dimensions; ((tk2dSlicedSprite)obj2)._tileStretchedSprites = val3._tileStretchedSprites; } else { val2 = (tk2dBaseSprite)(object)val.AddComponent(); val2.SetSprite(((tk2dBaseSprite)sprite).collection, ((tk2dBaseSprite)sprite).spriteId); } val2.FlipX = ((tk2dBaseSprite)sprite).FlipX; val2.PlaceAtRotatedPositionByAnchor(Vector2.op_Implicit(((tk2dBaseSprite)sprite).WorldCenter), (Anchor)4); ((MonoBehaviour)val2).StartCoroutine(Digitize_CR(val2, delay)); val.Play("femtobyte_digitize_sound"); } public static void MaterializePartial(tk2dBaseSprite sprite) { ((MonoBehaviour)sprite).StartCoroutine(Materialize_CR(sprite, 0f, partial: true)); ((Component)sprite).gameObject.PlayUnique("femtobyte_materialize_sound"); } public static void Materialize(tk2dBaseSprite sprite) { ((MonoBehaviour)sprite).StartCoroutine(Materialize_CR(sprite)); ((Component)sprite).gameObject.PlayUnique("femtobyte_materialize_sound"); } public static void Materialize(tk2dBaseSprite sprite, float delay) { ((MonoBehaviour)sprite).StartCoroutine(Materialize_CR(sprite, delay)); ((Component)sprite).gameObject.PlayUnique("femtobyte_materialize_sound"); } public static IEnumerator Digitize_CR(tk2dBaseSprite s, float delay = 0f) { ((BraveBehaviour)s).renderer.material.shader = DigitizeShader; ((BraveBehaviour)s).renderer.material.SetTexture(CwaffVFX._BinaryTexId, (Texture)(object)DigitizeTexture); ((BraveBehaviour)s).renderer.material.SetFloat(CwaffVFX._BinarizeProgressId, 0f); ((BraveBehaviour)s).renderer.material.SetFloat(CwaffVFX._ColorizeProgressId, 0f); ((BraveBehaviour)s).renderer.material.SetFloat(CwaffVFX._FadeProgressId, 0f); ((BraveBehaviour)s).renderer.material.SetFloat(CwaffVFX._ScrollSpeedId, -3f); SpriteOutlineManager.RemoveOutlineFromSprite(s, false); if (delay > 0f) { yield return (object)new WaitForSeconds(delay); } float phaseTime = 0.05f; for (float elapsed = 0f; elapsed < phaseTime; elapsed += BraveTime.DeltaTime) { float num = elapsed / phaseTime; ((BraveBehaviour)s).renderer.material.SetFloat(CwaffVFX._BinarizeProgressId, num); yield return null; } yield return (object)new WaitForSeconds(0.35f); phaseTime = 0.2f; ((BraveBehaviour)s).renderer.material.SetFloat(CwaffVFX._ScrollSpeedId, -3.75f); for (float elapsed = 0f; elapsed < phaseTime; elapsed += BraveTime.DeltaTime) { float num2 = elapsed / phaseTime; ((BraveBehaviour)s).renderer.material.SetFloat(CwaffVFX._ColorizeProgressId, num2); yield return null; } yield return (object)new WaitForSeconds(0.2f); phaseTime = 0.2f; for (float elapsed = 0f; elapsed < phaseTime; elapsed += BraveTime.DeltaTime) { float num3 = elapsed / phaseTime; ((BraveBehaviour)s).renderer.material.SetFloat(CwaffVFX._FadeProgressId, num3); yield return null; } Object.Destroy((Object)(object)((Component)s).gameObject); } public static IEnumerator Materialize_CR(tk2dBaseSprite s, float delay = 0f, bool partial = false) { Shader oldShader = ((BraveBehaviour)s).renderer.material.shader; s.usesOverrideMaterial = true; ((BraveBehaviour)s).renderer.material.shader = DigitizeShader; ((BraveBehaviour)s).renderer.material.SetTexture(CwaffVFX._BinaryTexId, (Texture)(object)DigitizeTexture); ((BraveBehaviour)s).renderer.material.SetFloat(CwaffVFX._BinarizeProgressId, 1f); ((BraveBehaviour)s).renderer.material.SetFloat(CwaffVFX._ColorizeProgressId, 1f); ((BraveBehaviour)s).renderer.material.SetFloat(CwaffVFX._FadeProgressId, 1f); float phaseTime = 0.1f; ((BraveBehaviour)s).renderer.material.SetFloat(CwaffVFX._ScrollSpeedId, -4.5f); for (float elapsed = 0f; elapsed < phaseTime; elapsed += BraveTime.DeltaTime) { float num = elapsed / phaseTime; ((BraveBehaviour)s).renderer.material.SetFloat(CwaffVFX._FadeProgressId, 1f - num); yield return null; } if (!partial) { yield return (object)new WaitForSeconds(0.4f); phaseTime = 0.15f; ((BraveBehaviour)s).renderer.material.SetFloat(CwaffVFX._ScrollSpeedId, -3.75f); for (float elapsed = 0f; elapsed < phaseTime; elapsed += BraveTime.DeltaTime) { float num2 = elapsed / phaseTime; ((BraveBehaviour)s).renderer.material.SetFloat(CwaffVFX._ColorizeProgressId, 1f - num2); yield return null; } phaseTime = 0.1f; ((BraveBehaviour)s).renderer.material.SetFloat(CwaffVFX._ScrollSpeedId, -3f); for (float elapsed = 0f; elapsed < phaseTime; elapsed += BraveTime.DeltaTime) { float num3 = elapsed / phaseTime; ((BraveBehaviour)s).renderer.material.SetFloat(CwaffVFX._BinarizeProgressId, 1f - num3); yield return null; } ((BraveBehaviour)s).renderer.material.shader = oldShader; } } public static void Cosmify(tk2dBaseSprite s) { s.usesOverrideMaterial = true; ((BraveBehaviour)s).renderer.material.shader = CosmicShader; ((BraveBehaviour)s).renderer.material.SetTexture("_StarTex", (Texture)(object)StarsTexture); } } public static class CwaffMasteries { [HarmonyPatch(typeof(PlayerController), "ForceDropGun")] private class ManuallyDropGunPatch { private static void Postfix(PlayerController __instance, Gun g, ref DebrisObject __result) { if (Object.op_Implicit((Object)(object)__instance) && Object.op_Implicit((Object)(object)((BraveBehaviour)__instance).healthHaver) && ((BraveBehaviour)__instance).healthHaver.IsAlive) { MasteryRitualComponent.PrepareDroppedItemForMasteryRitual(__result); } } } [HarmonyPatch(typeof(GunInventory), "AddGunToInventory")] private class PickUpGunPatch { private static void Prefix(GunInventory __instance, Gun gun, bool makeActive) { MasteryRitualComponent component = ((Component)gun).GetComponent(); if (component != null) { component.DisableEffects(); MasteryRitualComponent._RitualGuns.Remove(component); Object.Destroy((Object)(object)component); } } } [HarmonyPatch(typeof(PlayerController), "DoConsumableBlank")] private class UsedBlankPatch { private static void Prefix(PlayerController __instance) { if (__instance.Blanks > 0) { MasteryRitualComponent.UpdateMasteryRitualStatus(__instance); } } } [HarmonyPatch(typeof(GameUIRoot), "UpdateGunDataInternal")] private class AllowGunDisplayNameMarkupPatch { private static void Prefix(GameUIRoot __instance, PlayerController targetPlayer, GunInventory inventory, int inventoryShift, GameUIAmmoController targetAmmoController, int labelTarget) { if (__instance.gunNameLabels != null) { __instance.gunNameLabels[labelTarget].ProcessMarkup = true; __instance.gunNameLabels[labelTarget].AutoHeight = true; } } } } public class MasteryRitualComponent : MonoBehaviour { private const float _BURN_TIME = 1f; private const float _SIGIL_SPIN_SPEED = 0.5f; private const float _PARTICLE_SPIN_SPEED = 1.4f; private static GameObject _CatalystNiceParticleSytem = null; private static GameObject _MasteryNiceParticleSytem = null; internal static List _RitualGuns = new List(); private Gun _gun; private tk2dBaseSprite _sprite; private ParticleSystem _ps; private GameObject _sigil; private float _spinSpeed = 1f; public static bool CheckRequirementsSatisfiedForMasteryRitual(out MasteryRitualComponent ritualTarget) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_0138: 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_013c: 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_0152: 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_0155: 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_016b: 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_016e: 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_0184: 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_0188: Unknown result type (might be due to invalid IL or missing references) ritualTarget = null; if (GameManager.HasInstance) { PlayerController bestActivePlayer = GameManager.Instance.BestActivePlayer; if (bestActivePlayer != null) { RoomHandler currentRoom = bestActivePlayer.CurrentRoom; if (currentRoom == null || currentRoom.IsSealed) { return false; } CleanUpRitualGunList(); List list = new List(); foreach (MasteryRitualComponent ritualGun in _RitualGuns) { if (Vector3Extensions.GetAbsoluteRoom(((Component)ritualGun).transform.position) == currentRoom) { list.Add(ritualGun); } } if (list.Count != 4) { return false; } for (int i = 0; i < 4; i++) { if (!Object.op_Implicit((Object)(object)list[i]._sprite)) { list[i]._sprite = ((Component)list[i]).gameObject.GetComponent(); if (!Object.op_Implicit((Object)(object)list[i]._sprite)) { return false; } } } Vector2 worldCenter = list[0]._sprite.WorldCenter; Vector2 worldCenter2 = list[1]._sprite.WorldCenter; Vector2 worldCenter3 = list[2]._sprite.WorldCenter; Vector2 worldCenter4 = list[3]._sprite.WorldCenter; MasteryRitualComponent masteryRitualComponent = null; if (PointInTriangle(worldCenter, worldCenter2, worldCenter3, worldCenter4)) { masteryRitualComponent = list[0]; } else if (PointInTriangle(worldCenter2, worldCenter, worldCenter3, worldCenter4)) { masteryRitualComponent = list[1]; } else if (PointInTriangle(worldCenter3, worldCenter2, worldCenter, worldCenter4)) { masteryRitualComponent = list[2]; } else { if (!PointInTriangle(worldCenter4, worldCenter2, worldCenter3, worldCenter)) { return false; } masteryRitualComponent = list[3]; } Gun componentInChildren = ((Component)masteryRitualComponent).GetComponentInChildren(); if (componentInChildren == null) { return false; } int num = componentInChildren.MasteryTokenId(); if (num < 0) { return false; } if (Lazy.AnyoneHas(num)) { return false; } bool flag = false; int num2 = ((PickupObject)(object)componentInChildren).QualityGrade(); foreach (MasteryRitualComponent item in list) { if (!((Object)(object)item == (Object)(object)masteryRitualComponent)) { Gun component = ((Component)item).GetComponent(); if (component == null) { break; } if (((PickupObject)(object)component).QualityGrade() >= num2) { flag = true; break; } } } if (!flag) { return false; } ritualTarget = masteryRitualComponent; return true; } } return false; } public static void UpdateMasteryRitualStatus(PlayerController blankUser) { if (CheckRequirementsSatisfiedForMasteryRitual(out var ritualTarget)) { foreach (MasteryRitualComponent ritualGun in _RitualGuns) { if (!Object.op_Implicit((Object)(object)blankUser)) { ritualGun.EnableEffects((Object)(object)ritualGun == (Object)(object)ritualTarget); } else { ritualGun.DisableEffects(); if ((Object)(object)ritualGun == (Object)(object)ritualTarget) { blankUser.AcquireMastery(((Component)ritualGun).GetComponent()); ((Component)ritualGun).gameObject.GetComponent()?.DoMasteryChecks(blankUser); } else { ritualGun.BurnAway(); } } } return; } foreach (MasteryRitualComponent ritualGun2 in _RitualGuns) { if (Object.op_Implicit((Object)(object)ritualGun2)) { ritualGun2.DisableEffects(); } } } private static bool PointInTriangle(Vector2 p, Vector2 p0, Vector2 p1, Vector2 p2) { //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_0019: 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_0029: 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_0035: 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_0044: 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_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_006e: 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_007c: 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_008b: 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_00a4: 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_00b1: 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_00bf: 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_00cc: 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_00da: 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) float num = 0.5f * ((0f - p1.y) * p2.x + p0.y * (0f - p1.x + p2.x) + p0.x * (p1.y - p2.y) + p1.x * p2.y); int num2 = ((!(num < 0f)) ? 1 : (-1)); float num3 = (p0.y * p2.x - p0.x * p2.y + (p2.y - p0.y) * p.x + (p0.x - p2.x) * p.y) * (float)num2; float num4 = (p0.x * p1.y - p0.y * p1.x + (p0.y - p1.y) * p.x + (p1.x - p0.x) * p.y) * (float)num2; if (num3 > 0f && num4 > 0f) { return num3 + num4 < 2f * num * (float)num2; } return false; } private static void CleanUpRitualGunList() { List list = new List(); foreach (MasteryRitualComponent ritualGun in _RitualGuns) { if (Object.op_Implicit((Object)(object)ritualGun)) { list.Add(ritualGun); } } _RitualGuns = list; } public static void PrepareDroppedItemForMasteryRitual(DebrisObject pickup) { if (Object.op_Implicit((Object)(object)pickup) && ((Component)pickup).GetComponentInChildren() != null) { if (pickup.onGround) { PrepareForMasteryRitual(pickup); } else { pickup.OnGrounded = (Action)Delegate.Combine(pickup.OnGrounded, new Action(PrepareForMasteryRitual)); } } } private static void PrepareForMasteryRitual(DebrisObject pickup) { if (Object.op_Implicit((Object)(object)pickup)) { pickup.OnGrounded = (Action)Delegate.Remove(pickup.OnGrounded, new Action(PrepareForMasteryRitual)); Gun componentInChildren = ((Component)pickup).GetComponentInChildren(); if (componentInChildren != null && Object.op_Implicit((Object)(object)((Component)componentInChildren).gameObject)) { MasteryRitualComponent orAddComponent = GameObjectExtensions.GetOrAddComponent(((Component)componentInChildren).gameObject); _RitualGuns.Add(orAddComponent); UpdateMasteryRitualStatus(null); } } } private static GameObject MakeNiceParticleSystem(Color particleColor, float arcSpeed) { //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_006e: 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_0090: 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_00d5: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_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) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: 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_0131: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: 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_01d1: 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_0227: 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_023d: 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_0265: Invalid comparison between Unknown and I4 //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Invalid comparison between Unknown and I4 //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_030e: 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_0363: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(((Component)Items.CombinedRifle.AsGun().alternateVolley.projectiles[0].projectiles[0]).GetComponent().ParticleSystemToSpawn).RegisterPrefab(); ParticleSystem component = val.GetComponent(); float num = Mathf.Abs(arcSpeed); MainModule main = component.main; ((MainModule)(ref main)).duration = 3600f; ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.15f + 1f / num); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0.25f); ((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(0.0625f); ((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)1; ((MainModule)(ref main)).startRotation = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).startRotation3D = false; ((MainModule)(ref main)).startRotationMultiplier = 0f; ((MainModule)(ref main)).maxParticles = 200; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(particleColor); ForceOverLifetimeModule forceOverLifetime = component.forceOverLifetime; ((ForceOverLifetimeModule)(ref forceOverLifetime)).y = MinMaxCurve.op_Implicit(6f); ((ForceOverLifetimeModule)(ref forceOverLifetime)).z = MinMaxCurve.op_Implicit(15f); RotationOverLifetimeModule rotationOverLifetime = component.rotationOverLifetime; ((RotationOverLifetimeModule)(ref rotationOverLifetime)).enabled = false; RotationBySpeedModule rotationBySpeed = component.rotationBySpeed; ((RotationBySpeedModule)(ref rotationBySpeed)).enabled = false; Gradient val2 = new Gradient(); val2.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(particleColor, 0f), new GradientColorKey(particleColor, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[3] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(1f, 0.8f), new GradientAlphaKey(0f, 1f) }); ColorOverLifetimeModule colorOverLifetime = component.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val2); EmissionModule emission = component.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(30f * num); ParticleSystemRenderer component2 = val.GetComponent(); ((Renderer)component2).material.SetFloat("_InvFade", 3f); ((Renderer)component2).material.SetFloat("_EmissionGain", 0.9f); ((Renderer)component2).material.SetColor("_EmissionColor", particleColor); ((Renderer)component2).material.SetColor("_DiffuseColor", particleColor); ((Renderer)component2).sortingLayerName = "Foreground"; ShapeModule shape = component.shape; ((ShapeModule)(ref shape)).randomDirectionAmount = 0f; ((ShapeModule)(ref shape)).alignToDirection = true; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)10; if ((int)((ShapeModule)(ref shape)).shapeType == 17) { ((ShapeModule)(ref shape)).scale = new Vector3(1f, 1f, 1f); ((ShapeModule)(ref shape)).radiusThickness = 0.0625f; ((ShapeModule)(ref shape)).radiusMode = (ParticleSystemShapeMultiModeValue)1; ((ShapeModule)(ref shape)).donutRadius = 0.25f; ((ShapeModule)(ref shape)).radius = 0.25f + ((ShapeModule)(ref shape)).donutRadius; ((ShapeModule)(ref shape)).rotation = new Vector3(0f, 0f, 0f); ((ShapeModule)(ref shape)).arc = 360f; ((ShapeModule)(ref shape)).arcMode = (ParticleSystemShapeMultiModeValue)1; } else if ((int)((ShapeModule)(ref shape)).shapeType == 10) { ((ShapeModule)(ref shape)).randomDirectionAmount = 0f; ((ShapeModule)(ref shape)).alignToDirection = false; ((ShapeModule)(ref shape)).scale = Vector3.one; ((ShapeModule)(ref shape)).radiusThickness = 0.25f; ((ShapeModule)(ref shape)).radiusMode = (ParticleSystemShapeMultiModeValue)1; ((ShapeModule)(ref shape)).radius = 0.25f + ((ShapeModule)(ref shape)).radiusThickness; ((ShapeModule)(ref shape)).rotation = Vector3.zero; ((ShapeModule)(ref shape)).arc = 360f; ((ShapeModule)(ref shape)).arcMode = (ParticleSystemShapeMultiModeValue)1; ((ShapeModule)(ref shape)).arcSpeed = MinMaxCurve.op_Implicit(arcSpeed); } return val; } public void EnableEffects(bool isMasteryTarget) { //IL_0077: 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_010f: 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_0146: 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_0157: 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_016e: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0195: 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_01b0: 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) if (!((Behaviour)this).isActiveAndEnabled) { ((Behaviour)this).enabled = true; } if (!Object.op_Implicit((Object)(object)_gun)) { _gun = ((Component)this).GetComponent(); if (!Object.op_Implicit((Object)(object)_sprite)) { _sprite = ((BraveBehaviour)_gun).sprite; } } if (Object.op_Implicit((Object)(object)_gun) && Object.op_Implicit((Object)(object)_sprite)) { if (_CatalystNiceParticleSytem == null) { _CatalystNiceParticleSytem = MakeNiceParticleSystem(new Color(0.75f, 0.75f, 0.5f), 1.4f); } if (_MasteryNiceParticleSytem == null) { _MasteryNiceParticleSytem = MakeNiceParticleSystem(new Color(1f, 0.75f, 0.75f), -1.4f); } DisableEffects(); if (isMasteryTarget) { ((Component)this).gameObject.Play("mastery_ritual_activate_sound"); } _spinSpeed = (isMasteryTarget ? (-0.5f) : 0.5f); GameObject val = Object.Instantiate(isMasteryTarget ? _MasteryNiceParticleSytem : _CatalystNiceParticleSytem); val.transform.position = Vector2.op_Implicit(((BraveBehaviour)_gun).sprite.WorldCenter); val.transform.parent = ((Component)this).gameObject.transform; _ps = val.GetComponent(); ShapeModule shape = _ps.shape; Bounds bounds = ((BraveBehaviour)_gun).sprite.GetBounds(); ((ShapeModule)(ref shape)).radius = 0.25f + ((ShapeModule)(ref shape)).radiusThickness + Mathf.Max(((Bounds)(ref bounds)).extents.x, ((Bounds)(ref bounds)).extents.y); EmissionModule emission = _ps.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(32f * ((ShapeModule)(ref shape)).radius * 1.4f); _sigil = SpawnManager.SpawnVFX(VFX.MasterySigil, val.transform.position, Quaternion.identity, true); _sigil.SetAlphaImmediate(0.5f); _sigil.transform.parent = ((Component)this).gameObject.transform; tk2dSprite component = _sigil.GetComponent(); ((tk2dBaseSprite)component).HeightOffGround = -5f; ((tk2dBaseSprite)component).UpdateZDepth(); } } public void DisableEffects() { if (Object.op_Implicit((Object)(object)_ps)) { _ps.Stop(true); ((Component)_ps).gameObject.transform.parent = null; ((Component)_ps).gameObject.ExpireIn(3f); _ps = null; } if (Object.op_Implicit((Object)(object)_sigil)) { _sigil.transform.parent = null; Object.Destroy((Object)(object)_sigil); _sigil = null; } } private void Update() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_gun)) { _gun = ((Component)this).GetComponent(); } if (!Object.op_Implicit((Object)(object)_gun) || (Object)(object)_gun.CurrentOwner != (Object)null) { Object.Destroy((Object)(object)this); } else if (Object.op_Implicit((Object)(object)_sigil)) { _sigil.transform.rotation = (_spinSpeed * 360f * BraveTime.ScaledTimeSinceStartup).EulerZ(); } } private void OnDestroy() { DisableEffects(); _RitualGuns.Remove(this); UpdateMasteryRitualStatus(null); } private void Start() { _gun = ((Component)this).GetComponent(); } private void BurnAway() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) Gun component = ((Component)this).GetComponent(); if (component != null) { RoomHandler absoluteRoom = Vector3Extensions.GetAbsoluteRoom(((Component)this).gameObject.transform.position); if (absoluteRoom != null && absoluteRoom.IsRegistered((IPlayerInteractable)(object)component)) { absoluteRoom.DeregisterInteractable((IPlayerInteractable)(object)component); } else { RoomHandler.unassignedInteractableObjects.Remove((IPlayerInteractable)(object)component); } ((BraveBehaviour)component).sprite.DuplicateInWorldAsMesh().Dissipate(2.5f, 0f, 5f, progressive: true); } Transform parent = ((Component)this).transform.parent; if (parent != null) { Object.Destroy((Object)(object)((Component)parent).gameObject); } else { Object.Destroy((Object)(object)((Component)this).gameObject); } } private static IEnumerator BurnAway_CR(tk2dBaseSprite sprite) { ((BraveBehaviour)sprite).renderer.material.DisableKeyword("TINTING_OFF"); ((BraveBehaviour)sprite).renderer.material.EnableKeyword("TINTING_ON"); ((BraveBehaviour)sprite).renderer.material.DisableKeyword("EMISSIVE_OFF"); ((BraveBehaviour)sprite).renderer.material.EnableKeyword("EMISSIVE_ON"); ((BraveBehaviour)sprite).renderer.material.DisableKeyword("BRIGHTNESS_CLAMP_ON"); ((BraveBehaviour)sprite).renderer.material.EnableKeyword("BRIGHTNESS_CLAMP_OFF"); ((BraveBehaviour)sprite).renderer.material.SetFloat("_EmissiveThresholdSensitivity", 5f); ((BraveBehaviour)sprite).renderer.material.SetFloat(CwaffVFX._EmissiveColorPowerId, 1f); ((BraveBehaviour)sprite).renderer.material.shader = ShaderCache.Acquire("Brave/LitCutoutUber"); ((BraveBehaviour)sprite).renderer.material.SetFloat(CwaffVFX._EmissivePowerId, 10f); for (float elapsed = 0f; elapsed < 1f; elapsed += BraveTime.DeltaTime) { float num = elapsed / 1f; ((BraveBehaviour)sprite).renderer.material.SetFloat("_BurnAmount", num); yield return null; } Object.Destroy((Object)(object)((Component)sprite).gameObject); } } public static class VFX { private const int PIXELS_ABOVE_HEAD = 2; private static Dictionary> extantSprites = new Dictionary>(); public static Dictionary animations = new Dictionary(); public static Dictionary vfxpool = new Dictionary(); public static Dictionary vfxcomplex = new Dictionary(); private static Dictionary vfxObjectToPoolMap = new Dictionary(); public static readonly tk2dSpriteCollectionData Collection = SpriteBuilder.ConstructCollection(Extensions.RegisterPrefab(new GameObject(), deactivate: false, markFake: false), "GungeonCraft_VFX_Collection", false); public static GameObject LaserSightPrefab; public static GameObject MiniPickup; public static GameObject MasterySigil; public static GameObject BasicReticle; public static GameObject SinglePixel; private static VFXPool _None = null; public static void Init() { Object obj = LoadHelper.LoadAssetFromAnywhere("assets/resourcesbundle/global vfx/vfx_lasersight.prefab"); LaserSightPrefab = (GameObject)(object)((obj is GameObject) ? obj : null); MiniPickup = Create("mini_pickup", 12f, loops: false, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); MasterySigil = Create("mastery_sigil", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); BasicReticle = Create("basic_reticle", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); SinglePixel = Create("single_pixel", 2f, loops: true, -1, 1f, (Anchor)4, null, usesZHeight: false, 0f, persist: false, (VFXAlignment)1); } public static tk2dSpriteAnimationClip NewAnimation(this GameObject vfxObject, string animName, List spritePaths, float fps = 2f, bool loops = true, int loopStart = -1, Anchor anchor = (Anchor)4, float emissivePower = -1f, Color? emissiveColour = 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_0024: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0090: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) tk2dSpriteAnimationClip val = new tk2dSpriteAnimationClip { name = animName, fps = fps, frames = (tk2dSpriteAnimationFrame[])(object)new tk2dSpriteAnimationFrame[spritePaths.Count], loopStart = loopStart, wrapMode = (WrapMode)((loopStart > 0) ? 1 : ((!loops) ? 2 : 0)) }; Shader shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTintableTiltedCutoutEmissive"); tk2dSpriteDefinition val2 = Collection.spriteDefinitions[((tk2dBaseSprite)vfxObject.GetComponent()).spriteId]; for (int i = 0; i < spritePaths.Count; i++) { int spriteIdByName = Collection.GetSpriteIdByName(spritePaths[i]); tk2dSpriteDefinition val3 = Collection.spriteDefinitions[spriteIdByName]; val3.BetterConstructOffsetsFromAnchor(anchor); val3.colliderVertices = val2.colliderVertices; val3.material.shader = shader; if (emissivePower > 0f) { val3.material.SetFloat(CwaffVFX._EmissivePowerId, emissivePower); val3.material.SetFloat(CwaffVFX._EmissiveColorPowerId, 1.55f); } if (emissiveColour.HasValue) { val3.material.SetColor(CwaffVFX._EmissiveColorId, emissiveColour.Value); } val.frames[i] = new tk2dSpriteAnimationFrame { spriteId = spriteIdByName, spriteCollection = Collection }; } return val; } public static void AddAnimation(this GameObject vfxObject, string animName, string baseSpriteName, float fps = 2f, bool loops = true, int loopStart = -1, Anchor anchor = (Anchor)4, float emissivePower = -1f, Color? emissiveColour = null) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) tk2dSpriteAnimationClip val = vfxObject.NewAnimation(animName, ResMap.Get(baseSpriteName), fps, loops, loopStart, anchor, emissivePower, emissiveColour); tk2dSpriteAnimation component = vfxObject.GetComponent(); int num = component.clips.Length; Array.Resize(ref component.clips, num + 1); component.clips[num] = val; } private static void RegisterVFX(string name, List spritePaths, float fps = 2f, bool loops = true, int loopStart = -1, float scale = 1f, Anchor anchor = (Anchor)4, IntVector2? dimensions = null, bool usesZHeight = false, float zHeightOffset = 0f, bool persist = false, VFXAlignment alignment = (VFXAlignment)1, float emissivePower = -1f, float emissiveColorPower = -1f, Color? emissiveColour = null, bool orphaned = false, bool attached = true, bool unlit = false, float lightStrength = 0f, float lightRange = 0f, Color? lightColor = null, float lightFadeTime = 0f, bool useBetterEmission = false, float emissiveSensitivity = 0.5f) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_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_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_0097: 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_026e: 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_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_034d: 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_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Expected O, but got Unknown //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Expected O, but got Unknown //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Expected O, but got Unknown //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) if (animations.ContainsKey(name)) { return; } GameObject val = Extensions.RegisterPrefab(new GameObject(name)); tk2dSprite val2 = val.AddComponent(); tk2dSpriteAnimator val3 = val.AddComponent(); tk2dSpriteAnimation val4 = val.AddComponent(); int num = Collection.GetSpriteIdByName(spritePaths[0], -1); if (num == -1) { num = 0; } tk2dSpriteDefinition val5 = Collection.spriteDefinitions[num]; if (dimensions.HasValue) { IntVector2 valueOrDefault = dimensions.GetValueOrDefault(); val5.colliderVertices = (Vector3[])(object)new Vector3[2] { Vector3.zero, 0.0625f * ((IntVector2)(ref valueOrDefault)).ToVector3() }; } else { val5.colliderVertices = (Vector3[])(object)new Vector3[2] { Vector3.zero, val5.position3 }; } ((tk2dBaseSprite)val2).SetSprite(Collection, num); tk2dSpriteAnimationClip val6 = val.NewAnimation(name, spritePaths, fps, loops, loopStart, anchor, emissivePower, emissiveColour); if (emissivePower <= 0f) { ((BraveBehaviour)val2).renderer.material.shader = ShaderCache.Acquire(unlit ? "Brave/PlayerShader" : "tk2d/CutoutVertexColorTilted"); } else if (useBetterEmission) { ((tk2dBaseSprite)(object)val2).MakeGlowyBetter((emissivePower >= 0f) ? new float?(emissivePower) : ((float?)null), emissiveColour, (emissiveColorPower >= 0f) ? new float?(emissiveColorPower) : ((float?)null), emissiveSensitivity); } else { ((BraveBehaviour)val2).renderer.material.shader = ShaderCache.Acquire(unlit ? "Brave/UnlitTintableCutoutColorEmissive" : "Brave/LitTk2dCustomFalloffTintableTiltedCutoutEmissive"); ((BraveBehaviour)val2).renderer.material.SetFloat(CwaffVFX._EmissivePowerId, emissivePower); ((BraveBehaviour)val2).renderer.material.SetFloat(CwaffVFX._EmissiveColorPowerId, (emissiveColorPower >= 0f) ? emissiveColorPower : 1.55f); if (emissiveColour.HasValue) { ((BraveBehaviour)val2).renderer.material.shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTiltedCutoutEmissive"); ((BraveBehaviour)val2).renderer.material.SetColor(CwaffVFX._EmissiveColorId, emissiveColour.Value); } } val4.clips = (tk2dSpriteAnimationClip[])(object)new tk2dSpriteAnimationClip[1] { val6 }; val3.Library = val4; val3.playAutomatically = true; if (!loops && !persist) { SpriteAnimatorKiller obj = val.AddComponent(); obj.animator = val3; obj.fadeTime = -1f; obj.delayDestructionTime = -1f; } if (scale != 1f) { ((tk2dBaseSprite)val2).scale = new Vector3(scale, scale, scale); } if (lightStrength > 0f) { Light obj2 = new GameObject().AddComponent(); obj2.color = (Color)(((??)lightColor) ?? Color.white); obj2.intensity = lightStrength; obj2.range = lightRange; obj2.type = (LightType)2; obj2.bounceIntensity = 1f; ((Component)obj2).gameObject.transform.parent = val.transform; ((Component)obj2).gameObject.transform.localPosition = new Vector3(0f, 0f, -0.8f); ((Component)obj2).gameObject.AddComponent().heightOffGround = -0.8f; } VFXObject val7 = new VFXObject { attached = attached, orphaned = orphaned, persistsOnDeath = persist, usesZHeight = usesZHeight, zHeight = zHeightOffset, alignment = alignment, destructible = false, effect = val }; VFXComplex val8 = new VFXComplex(); val8.effects = (VFXObject[])(object)new VFXObject[1] { val7 }; VFXComplex val9 = val8; VFXPool val10 = new VFXPool(); val10.effects = (VFXComplex[])(object)new VFXComplex[1] { val9 }; val10.type = (VFXPoolType)1; VFXPool value = val10; vfxpool[name] = value; vfxcomplex[name] = val9; animations[name] = val; } public static GameObject Create(string name, float fps = 2f, bool loops = true, int loopStart = -1, float scale = 1f, Anchor anchor = (Anchor)4, IntVector2? dimensions = null, bool usesZHeight = false, float zHeightOffset = 0f, bool persist = false, VFXAlignment alignment = (VFXAlignment)1, float emissivePower = -1f, Color? emissiveColour = null, bool orphaned = false, bool attached = true, bool unlit = false, float lightStrength = 0f, float lightRange = 0f, Color? lightColor = null, float emissiveColorPower = -1f, float lightFadeTime = 0f, bool useBetterEmission = false, float emissiveSensitivity = 0.5f) { //IL_000d: 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) List spritePaths = ResMap.Get(name); bool orphaned2 = orphaned; bool attached2 = attached; bool unlit2 = unlit; RegisterVFX(name, spritePaths, fps, loops, loopStart, scale, anchor, dimensions, usesZHeight, zHeightOffset, persist, alignment, emissivePower, emissiveColorPower, emissiveColour, orphaned2, attached2, unlit2, lightStrength, lightRange, lightColor, lightFadeTime, useBetterEmission, emissiveSensitivity); return animations[name]; } public static VFXPool CreatePool(string name, float fps = 2f, bool loops = true, int loopStart = -1, float scale = 1f, Anchor anchor = (Anchor)4, IntVector2? dimensions = null, bool usesZHeight = false, float zHeightOffset = 0f, bool persist = false, VFXAlignment alignment = (VFXAlignment)1, float emissivePower = -1f, Color? emissiveColour = null, bool orphaned = false, bool attached = true, bool unlit = false, float lightStrength = 0f, float lightRange = 0f, Color? lightColor = null, float emissiveColorPower = -1f, float lightFadeTime = 0f, float emissiveSensitivity = 0.5f) { //IL_000d: 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) List spritePaths = ResMap.Get(name); bool orphaned2 = orphaned; bool attached2 = attached; bool unlit2 = unlit; RegisterVFX(name, spritePaths, fps, loops, loopStart, scale, anchor, dimensions, usesZHeight, zHeightOffset, persist, alignment, emissivePower, emissiveColorPower, emissiveColour, orphaned2, attached2, unlit2, lightStrength, lightRange, lightColor, lightFadeTime, useBetterEmission: true, emissiveSensitivity); return vfxpool[name]; } public static VFXComplex CreateComplex(string name, float fps = 2f, bool loops = true, int loopStart = -1, float scale = 1f, Anchor anchor = (Anchor)4, IntVector2? dimensions = null, bool usesZHeight = false, float zHeightOffset = 0f, bool persist = false, VFXAlignment alignment = (VFXAlignment)1, float emissivePower = -1f, Color? emissiveColour = null, bool orphaned = false, bool attached = true, bool unlit = false, float lightStrength = 0f, float lightRange = 0f, Color? lightColor = null, float emissiveColorPower = -1f, float lightFadeTime = 0f, float emissiveSensitivity = 0.5f) { //IL_000d: 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) List spritePaths = ResMap.Get(name); bool orphaned2 = orphaned; bool attached2 = attached; bool unlit2 = unlit; RegisterVFX(name, spritePaths, fps, loops, loopStart, scale, anchor, dimensions, usesZHeight, zHeightOffset, persist, alignment, emissivePower, emissiveColorPower, emissiveColour, orphaned2, attached2, unlit2, lightStrength, lightRange, lightColor, lightFadeTime, useBetterEmission: true, emissiveSensitivity); return vfxcomplex[name]; } public static void ShowOverheadVFX(this GameActor gunOwner, string name, float timeout) { ((MonoBehaviour)gunOwner).StartCoroutine(gunOwner.ShowVFXCoroutine(name, timeout)); } public static void ShowOverheadAnimatedVFX(this GameActor gunOwner, string name, float timeout) { ((MonoBehaviour)gunOwner).StartCoroutine(gunOwner.ShowAnimatedVFXCoroutine(name, timeout)); } public static void SpawnVFXPool(string name, Vector2 position, bool above = false, float degAngle = 0f, GameObject relativeTo = null) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) SpawnVFXPool(vfxpool[name], position, above, degAngle, relativeTo); } public static void SpawnVFXPool(VFXPool vfx, Vector2 position, bool above = false, float degAngle = 0f, GameObject relativeTo = null) { //IL_0016: 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) Transform val = (((Object)(object)relativeTo != (Object)null) ? relativeTo.transform : null); vfx.SpawnAtPosition(Vector2Extensions.ToVector3ZisY(position, above ? (-1f) : 1f), degAngle, val, (Vector2?)null, (Vector2?)null, (float?)(-0.05f), false, (SpawnMethod)null, (tk2dBaseSprite)null, false); } public static void SpawnVFXPool(GameObject vfx, Vector2 position, bool above = false, float degAngle = 0f, GameObject relativeTo = null) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) SpawnVFXPool(vfx.CreatePoolFromVFXGameObject(), position, above, degAngle, relativeTo); } public static VFXPool VFXPoolNone() { //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_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_001b: Expected O, but got Unknown object obj = _None; if (obj == null) { VFXPool val = new VFXPool { type = (VFXPoolType)0 }; _None = val; obj = (object)val; } return (VFXPool)obj; } public static VFXPool CreatePoolFromVFXGameObject(this GameObject vfx) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_0035: 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_004e: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (!vfxObjectToPoolMap.ContainsKey(vfx)) { VFXObject val = new VFXObject(); val.attached = false; val.persistsOnDeath = false; val.usesZHeight = false; val.zHeight = 0f; val.alignment = (VFXAlignment)1; val.destructible = false; val.effect = vfx; VFXComplex val2 = new VFXComplex(); val2.effects = (VFXObject[])(object)new VFXObject[1] { val }; VFXPool val3 = new VFXPool(); val3.type = (VFXPoolType)1; val3.effects = (VFXComplex[])(object)new VFXComplex[1] { val2 }; vfxObjectToPoolMap[vfx] = val3; } return vfxObjectToPoolMap[vfx]; } private static IEnumerator ShowVFXCoroutine(this GameActor gunOwner, string name, float timeout) { if (!extantSprites.ContainsKey(gunOwner)) { extantSprites[gunOwner] = new List(); } gunOwner.StopAllOverheadVFX(); GameObject newSprite = new GameObject(name, new Type[1] { typeof(tk2dSprite) }) { layer = 0 }; newSprite.transform.position = new Vector3(gunOwner.CenterPosition.x, ((BraveBehaviour)gunOwner).sprite.WorldTopCenter.y + 0.125f); tk2dSprite val = newSprite.AddComponent(); extantSprites[gunOwner].Add(newSprite); ((tk2dBaseSprite)val).SetSprite(Collection, Collection.GetSpriteIdByName(name)); ((tk2dBaseSprite)val).PlaceAtPositionByAnchor(newSprite.transform.position, (Anchor)1); ((BraveBehaviour)val).transform.localPosition = dfVectorExtensions.Quantize(((BraveBehaviour)val).transform.localPosition, 0.0625f); newSprite.transform.parent = ((BraveBehaviour)gunOwner).transform; if (Object.op_Implicit((Object)(object)val)) { ((BraveBehaviour)gunOwner).sprite.AttachRenderer((tk2dBaseSprite)(object)val); ((tk2dBaseSprite)val).depthUsesTrimmedBounds = true; ((tk2dBaseSprite)val).UpdateZDepth(); } ((BraveBehaviour)gunOwner).sprite.UpdateZDepth(); if (timeout > 0f) { yield return (object)new WaitForSeconds(timeout); if (Object.op_Implicit((Object)(object)newSprite)) { extantSprites[gunOwner].Remove(newSprite); Object.Destroy((Object)(object)newSprite.gameObject); } } } private static IEnumerator ShowAnimatedVFXCoroutine(this GameActor gunOwner, string name, float timeout) { if (!extantSprites.ContainsKey(gunOwner)) { extantSprites[gunOwner] = new List(); } gunOwner.StopAllOverheadVFX(); GameObject val = Object.Instantiate(animations[name]); tk2dBaseSprite baseSprite = val.GetComponent(); val.transform.parent = ((BraveBehaviour)gunOwner).transform; val.transform.position = new Vector3(gunOwner.CenterPosition.x, ((BraveBehaviour)gunOwner).sprite.WorldTopCenter.y + 0.125f); extantSprites[gunOwner].Add(((Component)baseSprite).gameObject); Bounds bounds = ((BraveBehaviour)gunOwner).sprite.GetBounds(); Vector3 val2 = ((BraveBehaviour)gunOwner).transform.position + dfVectorExtensions.Quantize(new Vector3((((Bounds)(ref bounds)).max.x + ((Bounds)(ref bounds)).min.x) / 2f, ((Bounds)(ref bounds)).max.y, 0f), 0.0625f); val.transform.position = Vector3Extensions.WithY(Vector2Extensions.ToVector3ZUp(gunOwner.CenterPosition, 0f), val2.y); baseSprite.HeightOffGround = 0.5f; ((BraveBehaviour)gunOwner).sprite.AttachRenderer(baseSprite); if (timeout > 0f) { yield return (object)new WaitForSeconds(timeout); if (Object.op_Implicit((Object)(object)baseSprite)) { extantSprites[gunOwner].Remove(((Component)baseSprite).gameObject); Object.Destroy((Object)(object)((Component)baseSprite).gameObject); } } } public static void StopAllOverheadVFX(this GameActor gunOwner) { if (extantSprites[gunOwner].Count > 0) { for (int num = extantSprites[gunOwner].Count - 1; num >= 0; num--) { Object.Destroy((Object)(object)extantSprites[gunOwner][num].gameObject); } extantSprites[gunOwner].Clear(); } } public static GameObject CreateLaserSight(Vector2 position, float length, float width, float angle, Color? colour = null, float power = 0f) { //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_0016: 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_008d: 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) GameObject obj = SpawnManager.SpawnVFX(LaserSightPrefab, Vector2.op_Implicit(position), Quaternion.Euler(0f, 0f, angle)); tk2dTiledSprite component = obj.GetComponent(); float num = 1f; if (width != -1f) { num = width; } component.dimensions = new Vector2(length, num); if (colour.HasValue) { ((tk2dBaseSprite)component).usesOverrideMaterial = true; ((BraveBehaviour)((BraveBehaviour)component).sprite).renderer.material.shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTintableTiltedCutoutEmissive"); ((BraveBehaviour)((BraveBehaviour)component).sprite).renderer.material.SetColor(CwaffVFX._OverrideColorId, colour.Value); ((BraveBehaviour)((BraveBehaviour)component).sprite).renderer.material.SetColor(CwaffVFX._EmissiveColorId, colour.Value); ((BraveBehaviour)((BraveBehaviour)component).sprite).renderer.material.SetFloat(CwaffVFX._EmissivePowerId, power); ((BraveBehaviour)((BraveBehaviour)component).sprite).renderer.material.SetFloat(CwaffVFX._EmissiveColorPowerId, 1.55f); } return obj; } public static void SetAlpha(this Renderer renderer, float newAlpha = 1f) { if (!Object.op_Implicit((Object)(object)renderer.material)) { return; } if ((Object)(object)renderer.material.shader == (Object)null || ((Object)renderer.material.shader).name != "Brave/Internal/SimpleAlphaFadeUnlit") { tk2dSprite component = ((Component)renderer).gameObject.GetComponent(); if (component != null) { ((tk2dBaseSprite)component).usesOverrideMaterial = true; } renderer.material.shader = ShaderCache.Acquire("Brave/Internal/SimpleAlphaFadeUnlit"); } renderer.material.SetFloat(CwaffVFX._FadeId, newAlpha); } public static void DoGenericItemActivation(this PlayerController player, tk2dBaseSprite itemSprite, string playSound = null) { ((MonoBehaviour)player).StartCoroutine(DoGenericItemActivation_CR(player, itemSprite, playSound)); static IEnumerator DoGenericItemActivation_CR(PlayerController val, tk2dBaseSprite val2, string text = null) { if (text != null) { ((Component)val).gameObject.Play(text); } tk2dSprite sprite = Lazy.SpriteObject(val2.collection, val2.spriteId); ((tk2dBaseSprite)sprite).PlaceAtPositionByAnchor(Vector2.op_Implicit(((BraveBehaviour)val).sprite.WorldTopCenter - new Vector2(0f, -0.5f)), (Anchor)1); ((BraveBehaviour)sprite).transform.parent = ((BraveBehaviour)val).transform; for (float elapsed = 0f; elapsed < 1f; elapsed += BraveTime.DeltaTime) { float num = elapsed / 1f; ((BraveBehaviour)sprite).transform.localScale = Vector2.op_Implicit(new Vector2(Mathf.Cos(elapsed * ((float)Math.PI * 3f)), 1f)); ((tk2dBaseSprite)(object)sprite).PlaceAtScaledPositionByAnchor(Vector2.op_Implicit(((BraveBehaviour)val).sprite.WorldTopCenter - new Vector2(0f, -0.5f + 0.33f * Mathf.Sin(elapsed * ((float)Math.PI * 2f)))), (Anchor)1); ((Component)sprite).gameObject.SetAlpha(1f - num); yield return null; } Object.Destroy((Object)(object)((Component)sprite).gameObject); } } public static CwaffTrailController CreateSpriteTrailObject(string spriteName, int fps = -1, string startAnim = null, float timeTillAnimStart = -1f, float cascadeTimer = -1f, float softMaxLength = -1f, bool destroyOnEmpty = false, GameObject dispersalPrefab = null) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //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_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) try { List list = ResMap.Get(spriteName); string text = list[0]; GameObject val = Extensions.RegisterPrefab(new GameObject()); ((Object)val).name = "trailObject"; int spriteIdByName = Databases.Items.ProjectileCollection.GetSpriteIdByName(text); tk2dTiledSprite obj = val.AddComponent(); ((tk2dBaseSprite)obj).SetSprite(Databases.Items.ProjectileCollection, spriteIdByName); tk2dSpriteDefinition currentSpriteDef = ((tk2dBaseSprite)obj).GetCurrentSpriteDef(); currentSpriteDef.colliderVertices = (Vector3[])(object)new Vector3[2] { Vector3.zero, currentSpriteDef.untrimmedBoundsDataExtents }; tk2dSpriteAnimator val2 = val.AddComponent(); tk2dSpriteAnimation val3 = val.AddComponent(); val3.clips = (tk2dSpriteAnimationClip[])(object)new tk2dSpriteAnimationClip[0]; val2.Library = val3; CwaffTrailController cwaffTrailController = val.AddComponent(); if (list != null) { SetupBeamPart(val3, list, "trail_mid", fps, null, null, currentSpriteDef.colliderVertices, (WrapMode)0); cwaffTrailController.animation = "trail_mid"; cwaffTrailController.usesAnimation = true; } else { currentSpriteDef.BetterConstructOffsetsFromAnchor((Anchor)3); cwaffTrailController.usesAnimation = false; } if (startAnim != null) { SetupBeamPart(val3, ResMap.Get(startAnim), "trail_start", fps, null, null, currentSpriteDef.colliderVertices, (WrapMode)0); cwaffTrailController.startAnimation = "trail_start"; cwaffTrailController.usesStartAnimation = true; } else { cwaffTrailController.usesStartAnimation = false; } if (Object.op_Implicit((Object)(object)dispersalPrefab)) { cwaffTrailController.UsesDispersalParticles = true; cwaffTrailController.DispersalParticleSystemPrefab = dispersalPrefab; } if (softMaxLength > 0f) { cwaffTrailController.usesSoftMaxLength = true; cwaffTrailController.softMaxLength = softMaxLength; } if (cascadeTimer > 0f) { cwaffTrailController.usesCascadeTimer = true; cwaffTrailController.cascadeTimer = cascadeTimer; } if (timeTillAnimStart >= 0f) { cwaffTrailController.usesGlobalTimer = true; cwaffTrailController.globalTimer = timeTillAnimStart; } cwaffTrailController.destroyOnEmpty = destroyOnEmpty; return cwaffTrailController; } catch (Exception ex) { ETGModConsole.Log((object)ex.ToString(), false); return null; } } public static BasicBeamController FixedGenerateBeamPrefab(this Projectile projectile, List beamAnimationPaths, int beamFPS = -1, List impactVFXAnimationPaths = null, int beamImpactFPS = -1, List endVFXAnimationPaths = null, int beamEndFPS = -1, List startVFXAnimationPaths = null, int beamStartFPS = -1, bool glows = false, bool canTelegraph = false, List beamTelegraphAnimationPaths = null, int beamtelegraphFPS = -1, List beamStartTelegraphAnimationPaths = null, int beamStartTelegraphFPS = -1, List beamEndTelegraphAnimationPaths = null, int beamEndTelegraphFPS = -1, float telegraphTime = 1f, bool canDissipate = false, List beamDissipateAnimationPaths = null, int beamDissipateFPS = -1, List beamStartDissipateAnimationPaths = null, int beamStartDissipateFPS = -1, List beamEndDissipateAnimationPaths = null, int beamEndDissipateFPS = -1, float dissipateTime = 1f, List chargeVFXAnimationPaths = null, int beamChargeFPS = -1, bool loopCharge = true, List muzzleVFXAnimationPaths = null, int beamMuzzleFPS = -1) { //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_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_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_0109: 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_011f: Expected O, but got Unknown //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Expected O, but got Unknown //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Expected O, but got Unknown //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_057e: Expected O, but got Unknown //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_0597: Unknown result type (might be due to invalid IL or missing references) //IL_05ab: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04cc: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_0605: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_0526: Unknown result type (might be due to invalid IL or missing references) //IL_064b: Unknown result type (might be due to invalid IL or missing references) //IL_065f: Unknown result type (might be due to invalid IL or missing references) try { if (Object.op_Implicit((Object)(object)((BraveBehaviour)projectile).specRigidbody)) { ((BraveBehaviour)projectile).specRigidbody.CollideWithOthers = false; } string text = beamAnimationPaths[0]; tk2dSpriteCollectionData projectileCollection = Databases.Items.ProjectileCollection; int spriteIdByName = projectileCollection.GetSpriteIdByName(text); tk2dTiledSprite orAddComponent = GameObjectExtensions.GetOrAddComponent(((Component)projectile).gameObject); ((tk2dBaseSprite)orAddComponent).m_transform = ((BraveBehaviour)orAddComponent).transform; ((tk2dBaseSprite)orAddComponent).SetSprite(Databases.Items.ProjectileCollection, spriteIdByName); tk2dSpriteDefinition currentSpriteDef = ((tk2dBaseSprite)orAddComponent).GetCurrentSpriteDef(); currentSpriteDef.colliderVertices = (Vector3[])(object)new Vector3[2] { new Vector3(0f, 0.5f * currentSpriteDef.untrimmedBoundsDataExtents.y, 0f), currentSpriteDef.untrimmedBoundsDataExtents }; tk2dSpriteAnimator orAddComponent2 = GameObjectExtensions.GetOrAddComponent(((Component)projectile).gameObject); tk2dSpriteAnimation orAddComponent3 = GameObjectExtensions.GetOrAddComponent(((Component)projectile).gameObject); orAddComponent3.clips = (tk2dSpriteAnimationClip[])(object)new tk2dSpriteAnimationClip[0]; orAddComponent2.Library = orAddComponent3; Object.Destroy((Object)(object)((Component)projectile).GetComponentInChildren()); ((BraveBehaviour)projectile).sprite = (tk2dBaseSprite)(object)orAddComponent; BasicBeamController orAddComponent4 = GameObjectExtensions.GetOrAddComponent(((Component)projectile).gameObject); if (beamAnimationPaths != null) { tk2dSpriteAnimationClip val = new tk2dSpriteAnimationClip { name = "beam_idle", frames = (tk2dSpriteAnimationFrame[])(object)new tk2dSpriteAnimationFrame[0], fps = beamFPS }; List list = new List(); foreach (string beamAnimationPath in beamAnimationPaths) { int spriteIdByName2 = projectileCollection.GetSpriteIdByName(beamAnimationPath); tk2dSpriteDefinition obj = projectileCollection.spriteDefinitions[spriteIdByName2]; obj.BetterConstructOffsetsFromAnchor((Anchor)3); obj.colliderVertices = currentSpriteDef.colliderVertices; list.Add(new tk2dSpriteAnimationFrame { spriteId = spriteIdByName2, spriteCollection = projectileCollection }); } val.frames = list.ToArray(); orAddComponent3.clips = orAddComponent3.clips.Concat((IEnumerable)(object)new tk2dSpriteAnimationClip[1] { val }).ToArray(); orAddComponent4.beamAnimation = "beam_idle"; } else { currentSpriteDef.BetterConstructOffsetsFromAnchor((Anchor)3); } if (endVFXAnimationPaths != null) { SetupBeamPart(orAddComponent3, endVFXAnimationPaths, "beam_end", beamEndFPS, null, null, currentSpriteDef.colliderVertices, (WrapMode)0); orAddComponent4.beamEndAnimation = "beam_end"; } else { SetupBeamPart(orAddComponent3, beamAnimationPaths, "beam_end", beamFPS, null, null, currentSpriteDef.colliderVertices, (WrapMode)0, null, shouldConstructOffsets: false); orAddComponent4.beamEndAnimation = "beam_end"; } if (impactVFXAnimationPaths != null) { tk2dSpriteDefinition spriteDefinition = projectileCollection.GetSpriteDefinition(impactVFXAnimationPaths[0]); Vector3[] overrideVertices = (Vector3[])(object)new Vector3[2] { 0.5f * spriteDefinition.untrimmedBoundsDataExtents, spriteDefinition.untrimmedBoundsDataExtents }; SetupBeamPart(orAddComponent3, impactVFXAnimationPaths, "beam_impact", beamImpactFPS, null, null, overrideVertices, (WrapMode)0, (Anchor)4); orAddComponent4.impactAnimation = "beam_impact"; } else { orAddComponent4.impactAnimation = null; } if (chargeVFXAnimationPaths != null) { SetupBeamPart(orAddComponent3, chargeVFXAnimationPaths, "beam_charge", beamChargeFPS, null, null, currentSpriteDef.colliderVertices, anchorOverride: (Anchor)4, wrapMode: (WrapMode)((!loopCharge) ? 2 : 0)); orAddComponent4.chargeAnimation = "beam_charge"; } else { orAddComponent4.chargeAnimation = null; } if (muzzleVFXAnimationPaths != null) { SetupBeamPart(orAddComponent3, muzzleVFXAnimationPaths, "beam_muzzle", beamMuzzleFPS, null, null, currentSpriteDef.colliderVertices, (WrapMode)0, (Anchor)4); orAddComponent4.muzzleAnimation = "beam_muzzle"; } else { orAddComponent4.chargeAnimation = null; } if (startVFXAnimationPaths != null) { SetupBeamPart(orAddComponent3, startVFXAnimationPaths, "beam_start", beamStartFPS, null, null, currentSpriteDef.colliderVertices, (WrapMode)0, (Anchor)4); orAddComponent4.beamStartAnimation = "beam_start"; } else { SetupBeamPart(orAddComponent3, beamAnimationPaths, "beam_start", beamFPS, null, null, currentSpriteDef.colliderVertices, (WrapMode)0, null, shouldConstructOffsets: false); orAddComponent4.beamStartAnimation = "beam_start"; } if (canTelegraph) { orAddComponent4.usesTelegraph = true; orAddComponent4.telegraphAnimations = new TelegraphAnims(); if (beamStartTelegraphAnimationPaths != null) { SetupBeamPart(orAddComponent3, beamStartTelegraphAnimationPaths, "beam_telegraph_start", beamStartTelegraphFPS, (Vector2?)new Vector2(0f, 0f), (Vector2?)new Vector2(0f, 0f), (Vector3[])null, (WrapMode)0, (Anchor?)null, shouldConstructOffsets: true); orAddComponent4.telegraphAnimations.beamStartAnimation = "beam_telegraph_start"; } if (beamTelegraphAnimationPaths != null) { SetupBeamPart(orAddComponent3, beamTelegraphAnimationPaths, "beam_telegraph_middle", beamtelegraphFPS, (Vector2?)new Vector2(0f, 0f), (Vector2?)new Vector2(0f, 0f), (Vector3[])null, (WrapMode)0, (Anchor?)null, shouldConstructOffsets: true); orAddComponent4.telegraphAnimations.beamAnimation = "beam_telegraph_middle"; } if (beamEndTelegraphAnimationPaths != null) { SetupBeamPart(orAddComponent3, beamEndTelegraphAnimationPaths, "beam_telegraph_end", beamEndTelegraphFPS, (Vector2?)new Vector2(0f, 0f), (Vector2?)new Vector2(0f, 0f), (Vector3[])null, (WrapMode)0, (Anchor?)null, shouldConstructOffsets: true); orAddComponent4.telegraphAnimations.beamEndAnimation = "beam_telegraph_end"; } orAddComponent4.telegraphTime = telegraphTime; } canDissipate = beamDissipateAnimationPaths != null; if (canDissipate) { orAddComponent4.endType = (BeamEndType)2; orAddComponent4.dissipateAnimations = new TelegraphAnims(); if (beamStartDissipateAnimationPaths != null) { SetupBeamPart(orAddComponent3, beamStartDissipateAnimationPaths, "beam_dissipate_start", beamStartDissipateFPS, (Vector2?)new Vector2(0f, 0f), (Vector2?)new Vector2(0f, 0f), (Vector3[])null, (WrapMode)2, (Anchor?)null, shouldConstructOffsets: true); orAddComponent4.dissipateAnimations.beamStartAnimation = "beam_dissipate_start"; } if (beamDissipateAnimationPaths != null) { SetupBeamPart(orAddComponent3, beamDissipateAnimationPaths, "beam_dissipate_middle", beamDissipateFPS, (Vector2?)new Vector2(0f, 0f), (Vector2?)new Vector2(0f, 0f), (Vector3[])null, (WrapMode)2, (Anchor?)null, shouldConstructOffsets: true); orAddComponent4.dissipateAnimations.beamAnimation = "beam_dissipate_middle"; } if (beamEndDissipateAnimationPaths != null) { SetupBeamPart(orAddComponent3, beamEndDissipateAnimationPaths, "beam_dissipate_end", beamEndDissipateFPS, (Vector2?)new Vector2(0f, 0f), (Vector2?)new Vector2(0f, 0f), (Vector3[])null, (WrapMode)2, (Anchor?)null, shouldConstructOffsets: true); orAddComponent4.dissipateAnimations.beamEndAnimation = "beam_dissipate_end"; } orAddComponent4.dissipateTime = (float)beamDissipateAnimationPaths.Count / (float)beamDissipateFPS; } return orAddComponent4; } catch (Exception ex) { ETGModConsole.Log((object)ex.ToString(), false); return null; } } public static CwaffRaidenBeamController AddRaidenBeamPrefab(this Projectile projectile, string spriteName, int fps = -1, int maxTargets = -1, bool targetOffscreen = false) { //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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_0102: 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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Expected O, but got Unknown try { if (Object.op_Implicit((Object)(object)((BraveBehaviour)projectile).specRigidbody)) { ((BraveBehaviour)projectile).specRigidbody.CollideWithOthers = false; } List list = ResMap.Get(spriteName + "_mid"); string text = list[0]; tk2dSpriteCollectionData projectileCollection = Databases.Items.ProjectileCollection; int spriteIdByName = projectileCollection.GetSpriteIdByName(text); tk2dTiledSprite orAddComponent = GameObjectExtensions.GetOrAddComponent(((Component)projectile).gameObject); ((tk2dBaseSprite)orAddComponent).SetSprite(Databases.Items.ProjectileCollection, spriteIdByName); tk2dSpriteDefinition currentSpriteDef = ((tk2dBaseSprite)orAddComponent).GetCurrentSpriteDef(); currentSpriteDef.colliderVertices = (Vector3[])(object)new Vector3[2] { new Vector3(0f, 0.5f * currentSpriteDef.untrimmedBoundsDataExtents.y, 0f), currentSpriteDef.untrimmedBoundsDataExtents }; tk2dSpriteAnimator orAddComponent2 = GameObjectExtensions.GetOrAddComponent(((Component)projectile).gameObject); tk2dSpriteAnimation orAddComponent3 = GameObjectExtensions.GetOrAddComponent(((Component)projectile).gameObject); orAddComponent3.clips = (tk2dSpriteAnimationClip[])(object)new tk2dSpriteAnimationClip[0]; orAddComponent2.Library = orAddComponent3; Object.Destroy((Object)(object)((Component)projectile).GetComponentInChildren()); ((BraveBehaviour)projectile).sprite = (tk2dBaseSprite)(object)orAddComponent; CwaffRaidenBeamController orAddComponent4 = GameObjectExtensions.GetOrAddComponent(((Component)projectile).gameObject); tk2dSpriteAnimationClip val = new tk2dSpriteAnimationClip { name = "beam_idle", frames = (tk2dSpriteAnimationFrame[])(object)new tk2dSpriteAnimationFrame[0], fps = fps }; List list2 = new List(); foreach (string item in list) { int spriteIdByName2 = projectileCollection.GetSpriteIdByName(item); tk2dSpriteDefinition obj = projectileCollection.spriteDefinitions[spriteIdByName2]; obj.BetterConstructOffsetsFromAnchor((Anchor)3); obj.colliderVertices = currentSpriteDef.colliderVertices; list2.Add(new tk2dSpriteAnimationFrame { spriteId = spriteIdByName2, spriteCollection = projectileCollection }); } val.frames = list2.ToArray(); orAddComponent3.clips = orAddComponent3.clips.Concat((IEnumerable)(object)new tk2dSpriteAnimationClip[1] { val }).ToArray(); orAddComponent4.beamAnimation = "beam_idle"; List list3 = ResMap.Get(spriteName + "_start", quietFailure: true); if (list3 != null) { SetupBeamPart(orAddComponent3, list3, "beam_start", fps, null, null, currentSpriteDef.colliderVertices, (WrapMode)0, (Anchor)4); } else { SetupBeamPart(orAddComponent3, list, "beam_start", fps, null, null, currentSpriteDef.colliderVertices, (WrapMode)0, null, shouldConstructOffsets: false); } orAddComponent4.startAnimation = "beam_start"; orAddComponent4.maxTargets = maxTargets; orAddComponent4.targetType = (targetOffscreen ? CwaffRaidenBeamController.TargetType.Room : CwaffRaidenBeamController.TargetType.Screen); return orAddComponent4; } catch (Exception ex) { ETGModConsole.Log((object)ex.ToString(), false); return null; } } internal static void SetupBeamPart(tk2dSpriteAnimation beamAnimation, List paths, string animationName, int fps, Vector2? colliderDimensions = null, Vector2? colliderOffsets = null, Vector3[] overrideVertices = null, WrapMode wrapMode = (WrapMode)0, Anchor? anchorOverride = null, bool shouldConstructOffsets = true) { //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_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_0026: 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_002e: Expected O, but got Unknown //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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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) tk2dSpriteAnimationClip val = new tk2dSpriteAnimationClip { name = animationName, frames = (tk2dSpriteAnimationFrame[])(object)new tk2dSpriteAnimationFrame[paths.Count], fps = fps, wrapMode = wrapMode }; tk2dSpriteCollectionData projectileCollection = Databases.Items.ProjectileCollection; for (int i = 0; i < paths.Count; i++) { int spriteIdByName = projectileCollection.GetSpriteIdByName(paths[i]); val.frames[i] = new tk2dSpriteAnimationFrame { spriteId = spriteIdByName, spriteCollection = projectileCollection }; tk2dSpriteDefinition val2 = projectileCollection.spriteDefinitions[spriteIdByName]; if (shouldConstructOffsets) { val2.BetterConstructOffsetsFromAnchor((Anchor)(((??)anchorOverride) ?? 3)); } if (overrideVertices != null) { val2.colliderVertices = overrideVertices; continue; } if (colliderDimensions.HasValue) { Vector2 valueOrDefault = colliderDimensions.GetValueOrDefault(); if (colliderOffsets.HasValue) { Vector2 valueOrDefault2 = colliderOffsets.GetValueOrDefault(); val2.colliderVertices = (Vector3[])(object)new Vector3[2] { Vector2.op_Implicit(0.0625f * valueOrDefault2), Vector2.op_Implicit(0.0625f * valueOrDefault) }; continue; } } ETGModConsole.Log((object)"BEAM ERROR: colliderDimensions or colliderOffsets was null with no override vertices!", false); } beamAnimation.clips = beamAnimation.clips.Concat((IEnumerable)(object)new tk2dSpriteAnimationClip[1] { val }).ToArray(); } } public class CwaffVFX { public enum Rot { None, Random, Position, Velocity } public enum Vel { Random, Radial, Away, AwayRadial, InwardToCenter, OutwardFromCenter } private class CwaffVFXManager : MonoBehaviour { [HarmonyPatch] private class CwaffVFXManagerAutostartPatch { [HarmonyPatch(typeof(GameManager), "Start")] [HarmonyPatch(typeof(GameManager), "LoadNextLevel")] [HarmonyPatch(typeof(MainMenuController), "Start")] private static void Postfix() { ((Component)(object)GameManager.Instance).GetOrAddComponent(); } } private void Update() { int count = _SpawnedVFX.Count; LinkedListNode linkedListNode = _SpawnedVFX.First; for (int i = 0; i < count; i++) { CwaffVFX value = linkedListNode.Value; LinkedListNode? next = linkedListNode.Next; value.ManualUpdate(); if (value._shouldDespawn) { _SpawnedVFX.Remove(value._node); _DespawnedVFX.AddLast(value._node); } linkedListNode = next; } } } internal static readonly int _EmissivePowerId = Shader.PropertyToID("_EmissivePower"); internal static readonly int _EmissiveColorId = Shader.PropertyToID("_EmissiveColor"); internal static readonly int _EmissiveColorPowerId = Shader.PropertyToID("_EmissiveColorPower"); internal static readonly int _OverrideColorId = Shader.PropertyToID("_OverrideColor"); internal static readonly int _FadeId = Shader.PropertyToID("_Fade"); internal static readonly int _SensitivityId = Shader.PropertyToID("_EmissiveThresholdSensitivity"); internal static readonly int _CutoffId = Shader.PropertyToID("_Cutoff"); internal static readonly int _ValueMinId = Shader.PropertyToID("_ValueMinimum"); internal static readonly int _ValueMaxId = Shader.PropertyToID("_ValueMaximum"); internal static readonly int _PerpendicularId = Shader.PropertyToID("_Perpendicular"); internal static readonly int _BinarizeProgressId = Shader.PropertyToID("_BinarizeProgress"); internal static readonly int _ColorizeProgressId = Shader.PropertyToID("_ColorizeProgress"); internal static readonly int _FadeProgressId = Shader.PropertyToID("_FadeProgress"); internal static readonly int _ScrollSpeedId = Shader.PropertyToID("_ScrollSpeed"); internal static readonly int _HScrollSpeedId = Shader.PropertyToID("_HScrollSpeed"); internal static readonly int _ColorId = Shader.PropertyToID("_Color"); internal static readonly int _BinaryTexId = Shader.PropertyToID("_BinaryTex"); internal static readonly int _SaturationId = Shader.PropertyToID("_Saturation"); internal static readonly int _EmissionId = Shader.PropertyToID("_Emission"); internal static readonly int _RandomSeedId = Shader.PropertyToID("_RandomSeed"); private static readonly LinkedList _SpawnedVFX = new LinkedList(); private static readonly LinkedList _DespawnedVFX = new LinkedList(); private GameObject _vfx; private LinkedListNode _node; private tk2dSprite _sprite; private tk2dSpriteAnimator _animator; private tk2dSpriteAnimation _library; private Material _material; private Vector3 _velocity = Vector3.zero; private float _curLifeTime; private bool _fadeOut; private float _fadeStartTime; private float _fadeTotalTime; private float _maxLifeTime; private bool _setup; private bool _fadeIn; private float _startScale = 1f; private float _endScale = 1f; private bool _changesScale; private bool _usesLifetime = true; private bool _shouldDespawn; private Transform _anchorTransform; private Vector3 _anchorPos; private int _lastSpriteId = -1; public static void Spawn(GameObject prefab = null, Vector3 position = default(Vector3), Quaternion? rotation = null, Vector2? velocity = null, float lifetime = 0f, float? fadeOutTime = null, float emissivePower = 0f, Color? emissiveColor = null, bool fadeIn = false, float? startScale = null, float? endScale = null, float? height = null, bool randomFrame = false, int specificFrame = -1, bool flipX = false, bool flipY = false, Transform anchorTransform = null, Color? overrideColor = null, float emitColorPower = 1.55f, tk2dSpriteCollectionData spriteCol = null, int spriteId = -1, tk2dSpriteAnimator animator = null, bool unoccluded = false, bool copyShaders = false) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (_DespawnedVFX.Count == 0) { CwaffVFX cwaffVFX = new CwaffVFX(); LinkedListNode node = (cwaffVFX._node = new LinkedListNode(cwaffVFX)); _DespawnedVFX.AddLast(node); } LinkedListNode last = _DespawnedVFX.Last; _DespawnedVFX.RemoveLast(); _SpawnedVFX.AddLast(last); last.Value.Setup(prefab, position, rotation, velocity, lifetime, fadeOutTime, emissivePower, emissiveColor, fadeIn, startScale, endScale, height, randomFrame, specificFrame, flipX, flipY, anchorTransform, overrideColor, emitColorPower, spriteCol, spriteId, animator, unoccluded, copyShaders); } public static void SpawnBurst(GameObject prefab = null, int numToSpawn = 1, Vector2 basePosition = default(Vector2), float positionVariance = 0f, Vector2? baseVelocity = null, float minVelocity = 0f, float velocityVariance = 0f, Vel velType = Vel.Random, Rot rotType = Rot.None, float lifetime = 0f, float? fadeOutTime = null, float emissivePower = 0f, Color? emissiveColor = null, bool fadeIn = false, bool uniform = false, float? startScale = null, float? endScale = null, float? height = null, bool randomFrame = false, int specificFrame = -1, bool flipX = false, bool flipY = false, Transform anchorTransform = null, Color? overrideColor = null, float emitColorPower = 1.55f, float spread = 0f, tk2dSpriteCollectionData spriteCol = null, int spriteId = -1, float lifetimeVariance = 0f, float minVariance = 0f, bool unoccluded = false, bool copyShaders = false) { //IL_0015: 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_001a: 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) //IL_00a5: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_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_00dc: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_0113: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_0135: 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_0137: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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: 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_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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_0158: 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_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0191: 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) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: 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_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: 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_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: 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_01e7: 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_01f3: 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_01de: Unknown result type (might be due to invalid IL or missing references) Vector2 val = (Vector2)(((??)baseVelocity) ?? Vector2.zero); float num = Lazy.RandomAngle(); for (int i = 0; i < numToSpawn; i++) { float self = (uniform ? (num + 360f * ((float)i / (float)numToSpawn)).Clamp360() : Lazy.RandomAngle()); Vector2 val2 = basePosition; if (positionVariance > 0f) { val2 = ((!uniform) ? (val2 + self.ToVector(Random.Range(minVariance, positionVariance))) : (val2 + self.ToVector(positionVariance))); } Vector2 val3 = (Vector2)(velType switch { Vel.Random => val + Lazy.RandomAngle().ToVector(minVelocity + Random.value * velocityVariance), Vel.Radial => val + Lazy.RandomAngle().ToVector(minVelocity + velocityVariance), Vel.Away => val + self.ToVector(minVelocity + Random.value * velocityVariance), Vel.AwayRadial => val + self.ToVector(minVelocity + velocityVariance), Vel.InwardToCenter => val - (val2 - basePosition) / Mathf.Max(lifetime, 0.01f), Vel.OutwardFromCenter => val - (basePosition - val2) / Mathf.Max(lifetime, 0.01f), _ => val, }); if (spread > 0f) { val3 = Vector2.op_Implicit(0f.AddRandomSpread(spread).EulerZ() * Vector2.op_Implicit(val3)); } if (velType == Vel.OutwardFromCenter) { val2 = basePosition; } Quaternion value = (Quaternion)(rotType switch { Rot.Random => Random.Range(0f, 360f).EulerZ(), Rot.Position => self.EulerZ(), Rot.Velocity => val3.EulerZ(), _ => Quaternion.identity, }); Vector3 position = Vector2.op_Implicit(val2); Quaternion? rotation = value; Vector2? velocity = val3; float lifetime2 = lifetime + lifetimeVariance * Random.value; bool fadeIn2 = fadeIn; Spawn(prefab, position, rotation, velocity, lifetime2, fadeOutTime, emissivePower, emissiveColor, fadeIn2, startScale, endScale, height, randomFrame, specificFrame, flipX: false, flipY: false, anchorTransform, overrideColor, emitColorPower, spriteCol, spriteId, null, unoccluded, copyShaders); } } public static void SpawnDebris(GameObject prefab = null, Vector3 position = default(Vector3), float rotation = 0f, float minForce = 1f, float maxForce = 4f, float? startingHeight = null, Transform anchorTransform = null, bool randomFrame = false, int specificFrame = -1, float gravity = -1f) { //IL_0001: 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_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_008a: 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_00ce: 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_00e4: Unknown result type (might be due to invalid IL or missing references) GameObject val = SpawnManager.SpawnDebris(prefab, position, rotation.EulerZ()); ShellCasing component = val.GetComponent(); if (component != null) { component.Trigger(); } DebrisObject component2 = val.GetComponent(); if (component2 != null) { if (randomFrame || specificFrame >= 0) { val.GetComponent()?.PickFrame(specificFrame); } Vector3 val2 = Vector2.op_Implicit(rotation.ToVector(Random.Range(minForce, maxForce))); float valueOrDefault = startingHeight.GetValueOrDefault(); float num; if (!startingHeight.HasValue) { valueOrDefault = Random.value * 0.5f; startingHeight = valueOrDefault; num = valueOrDefault; } else { num = valueOrDefault; } float num2 = num; component2.additionalHeightBoost = position.y - (((Object)(object)anchorTransform != (Object)null) ? anchorTransform.position.y : 0f) + 0.2f - num2; if (gravity >= 0f) { component2.GravityOverride = gravity; } component2.Trigger(new Vector3(val2.x, val2.y, Random.Range(minForce, maxForce)), num2, 1f); } } private CwaffVFX() { //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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown _vfx = new GameObject(); Object.DontDestroyOnLoad((Object)(object)_vfx); _node = null; _sprite = _vfx.AddComponent(); _animator = _vfx.AddComponent(); _library = _vfx.AddComponent(); _material = ((BraveBehaviour)_sprite).renderer.material; _animator.library = _library; _animator.playAutomatically = true; } private static void Despawn(CwaffVFX c) { c._shouldDespawn = true; c._setup = false; c._vfx.SetActive(false); } private void Setup(GameObject prefab = null, Vector3 position = default(Vector3), Quaternion? rotation = null, Vector2? velocity = null, float lifetime = 0f, float? fadeOutTime = null, float emissivePower = 0f, Color? emissiveColor = null, bool fadeIn = false, float? startScale = null, float? endScale = null, float? height = null, bool randomFrame = false, int specificFrame = -1, bool flipX = false, bool flipY = false, Transform anchorTransform = null, Color? overrideColor = null, float emitColorPower = 1.55f, tk2dSpriteCollectionData spriteCol = null, int spriteId = -1, tk2dSpriteAnimator animator = null, bool unoccluded = false, bool copyShaders = false) { //IL_003f: 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_0050: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_021c: 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_0236: Unknown result type (might be due to invalid IL or missing references) //IL_024f: 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_02ad: 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_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Invalid comparison between Unknown and I4 //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Unknown result type (might be due to invalid IL or missing references) _shouldDespawn = false; _vfx.SetActive(true); if (unoccluded) { GameObjectExtensions.SetLayerRecursively(_vfx, 23); } else { GameObjectExtensions.SetLayerRecursively(_vfx, 22); } Transform transform = _vfx.transform; transform.position = position; transform.localRotation = (Quaternion)(((??)rotation) ?? Quaternion.identity); _anchorTransform = anchorTransform; if ((Object)(object)anchorTransform != (Object)null) { _anchorPos = anchorTransform.position; } tk2dSprite val = (Object.op_Implicit((Object)(object)prefab) ? prefab.GetComponent() : null); bool flag = true; if (Object.op_Implicit((Object)(object)prefab)) { tk2dSpriteAnimator component = prefab.GetComponent(); if (component != null) { _animator.defaultClipId = component.defaultClipId; _library.clips = prefab.GetComponent().clips; _animator.playAutomatically = true; _animator.currentClip = _animator.DefaultClip; } else { _animator.defaultClipId = 0; _library.clips = null; _animator.playAutomatically = false; flag = false; } ((tk2dBaseSprite)_sprite).SetSprite(((tk2dBaseSprite)val).collection, ((tk2dBaseSprite)val).spriteId); } else if ((Object)(object)animator != (Object)null) { _animator.defaultClipId = animator.defaultClipId; _library.clips = animator.library.clips; tk2dSpriteAnimationClip defaultClip = _animator.DefaultClip; ((tk2dBaseSprite)_sprite).SetSprite(defaultClip.frames[0].spriteCollection, defaultClip.frames[0].spriteId); _animator.playAutomatically = true; _animator.currentClip = defaultClip; } else { _animator.defaultClipId = 0; _library.clips = null; _animator.playAutomatically = false; ((tk2dBaseSprite)_sprite).SetSprite(spriteCol, spriteId); flag = false; } if (startScale.HasValue) { _startScale = startScale.Value; ((tk2dBaseSprite)_sprite).scale = new Vector3(_startScale, _startScale, 1f); } else { ((tk2dBaseSprite)_sprite).scale = (Object.op_Implicit((Object)(object)val) ? ((tk2dBaseSprite)val).scale : Vector3.one); _startScale = ((tk2dBaseSprite)_sprite).scale.x; } ((tk2dBaseSprite)_sprite).FlipX = flipX; ((tk2dBaseSprite)_sprite).FlipY = flipY; _curLifeTime = 0f; _fadeIn = fadeIn; _velocity = (velocity.HasValue ? (1f / 64f * Vector2Extensions.ToVector3ZisY(velocity.Value, 0f)) : Vector3.zero); _usesLifetime = lifetime > 0f; _maxLifeTime = (_usesLifetime ? lifetime : (((int)_animator.currentClip.wrapMode == 2) ? _animator.currentClip.BaseClipLength : 36000f)); _fadeOut = _usesLifetime && fadeOutTime.HasValue; if (_fadeOut) { _fadeTotalTime = fadeOutTime.Value; _fadeStartTime = _maxLifeTime - _fadeTotalTime; } if (height.HasValue) { ((tk2dBaseSprite)_sprite).HeightOffGround = height.Value; ((tk2dBaseSprite)_sprite).UpdateZDepth(); } _changesScale = endScale.HasValue; if (_changesScale) { _endScale = endScale.Value; } ((tk2dBaseSprite)_sprite).OverrideMaterialMode = (SpriteMaterialOverrideMode)2; _material = ((BraveBehaviour)_sprite).renderer.material; _sprite.ApplyEmissivePropertyBlock = false; if (copyShaders) { Material material = (((BraveBehaviour)_sprite).renderer.material = ((BraveBehaviour)prefab.gameObject.GetComponent()).renderer.material); _material = material; } else if (emissivePower > 0f) { _material.DisableKeyword("BRIGHTNESS_CLAMP_ON"); _material.EnableKeyword("BRIGHTNESS_CLAMP_OFF"); if (emissiveColor.HasValue) { Color valueOrDefault = emissiveColor.GetValueOrDefault(); _material.SetColor(_EmissiveColorId, valueOrDefault); _material.shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTiltedCutoutEmissive"); } else { _material.shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTintableTiltedCutoutEmissive"); } _material.SetFloat(_EmissivePowerId, emissivePower); _material.SetFloat(_EmissiveColorPowerId, emitColorPower); _material.SetColor(_OverrideColorId, (Color)(((??)overrideColor) ?? Color.clear)); } else { _material.shader = ShaderCache.Acquire("Brave/Internal/SimpleAlphaFadeUnlit"); _material.SetFloat(_FadeId, 1f); } if (flag) { if (specificFrame >= 0) { _animator.PickFrame(specificFrame); } else if (randomFrame) { _animator.PickFrame(); } else { _animator.Resume(); _animator.PlayFromFrame(0); } } else { _animator.Pause(); } _lastSpriteId = ((tk2dBaseSprite)_sprite).spriteId; ((tk2dBaseSprite)_sprite).UpdateMaterial(); _setup = true; } private void ManualUpdate() { //IL_006e: 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_007e: 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_008d: 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_00bb: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_014d: Unknown result type (might be due to invalid IL or missing references) if (!_setup) { return; } _curLifeTime += BraveTime.DeltaTime; float num = _curLifeTime / _maxLifeTime; if ((_usesLifetime && num > 1f) || (!_usesLifetime && !_animator.Paused && !_animator.Playing)) { Despawn(this); return; } Transform transform = ((BraveBehaviour)_sprite).transform; transform.position += _velocity * 60f * BraveTime.DeltaTime; if (Object.op_Implicit((Object)(object)_anchorTransform)) { Transform transform2 = ((BraveBehaviour)_sprite).transform; transform2.position += _anchorTransform.position - _anchorPos; _anchorPos = _anchorTransform.position; } ((tk2dBaseSprite)_sprite).UpdateZDepth(); if (_lastSpriteId != ((tk2dBaseSprite)_sprite).spriteId) { _lastSpriteId = ((tk2dBaseSprite)_sprite).spriteId; ((tk2dBaseSprite)_sprite).UpdateMaterial(); } if (_changesScale) { float num2 = (1f - num) * _startScale + num * _endScale; ((tk2dBaseSprite)_sprite).scale = new Vector3(num2, num2, 1f); } if (_fadeOut && _curLifeTime > _fadeStartTime) { float num3 = (_curLifeTime - _fadeStartTime) / _fadeTotalTime; if (!_fadeIn) { num3 = 1f - num3; } ((BraveBehaviour)_sprite).renderer.material.SetFloat(_FadeId, num3); } } } public class OrbitalEffect : MonoBehaviour { private const float _ORBIT_RPS = 0.5f; private const float _ORBIT_SPR = 2f; private AIActor _enemy; private List _orbitals; private int _numOrbitals; private float _enemyGirth; private float _enemyHeight; private float _orbitTimer; private float _orbitalGap; private float _rps; private float _spr; private bool _isEmissive; private bool _overhead; private bool _didSetup; private bool _rotates; private bool _flips; private bool _fades; private float _bobAmount; public void SetupOrbitals(GameObject vfx, int numOrbitals = 3, float rps = 0.5f, bool isEmissive = false, bool isOverhead = false, bool rotates = true, bool flips = false, bool fades = false, float bobAmount = 0f) { //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) //IL_0020: 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_0046: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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) _enemy = ((Component)this).GetComponent(); Bounds bounds = ((BraveBehaviour)_enemy).sprite.GetBounds(); _enemyGirth = ((Bounds)(ref bounds)).size.x / 2f; bounds = ((BraveBehaviour)_enemy).sprite.GetBounds(); _enemyHeight = ((Bounds)(ref bounds)).size.y / 2f; _orbitTimer = 0f; _orbitals = new List(); _numOrbitals = numOrbitals; _orbitalGap = 360f / (float)_numOrbitals; _isEmissive = isEmissive; _overhead = isOverhead; _rps = rps; _spr = 1f / _rps; _rotates = rotates; _flips = flips; _fades = fades; _bobAmount = bobAmount; for (int i = 0; i < _numOrbitals; i++) { _orbitals.Add(SpawnManager.SpawnVFX(vfx, Vector2Extensions.ToVector3ZisY(((GameActor)_enemy).CenterPosition, -1f), Quaternion.identity)); } UpdateOrbitals(); _didSetup = true; } public void ClearOrbitals() { foreach (GameObject orbital in _orbitals) { Object.Destroy((Object)(object)orbital); } _orbitals.Clear(); _numOrbitals = 0; _orbitalGap = 360f; } public void AddOrbital(GameObject vfx) { //IL_000d: 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) _orbitals.Add(SpawnManager.SpawnVFX(vfx, Vector2Extensions.ToVector3ZisY(((GameActor)_enemy).CenterPosition, -1f), Quaternion.identity)); _numOrbitals++; _orbitalGap = 360f / (float)_numOrbitals; } private void Update() { if (!_didSetup) { return; } if (!Object.op_Implicit((Object)(object)_enemy) || !Object.op_Implicit((Object)(object)((BraveBehaviour)_enemy).healthHaver) || ((BraveBehaviour)_enemy).healthHaver.IsDead) { HandleEnemyDied(); return; } _orbitTimer += BraveTime.DeltaTime; if (_orbitTimer > _spr) { _orbitTimer -= _spr; } UpdateOrbitals(); } private void OnDestroy() { HandleEnemyDied(); } public void HandleEnemyDied() { if (_orbitals == null) { return; } foreach (GameObject orbital in _orbitals) { Object.Destroy((Object)(object)orbital); } _orbitals = null; } private float OverheadOffset() { if (!_overhead) { return 0f; } return _enemyHeight; } private void UpdateOrbitals() { //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_00b3: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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_00e8: 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_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_0130: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) int num = 0; float num2 = _orbitTimer / _spr; float num3 = 16f * _enemyGirth; float num4 = 2f * Mathf.Abs(Mathf.Sin((float)Math.PI * 2f * num2)); Vector2 val2 = default(Vector2); foreach (GameObject orbital in _orbitals) { tk2dSprite component = orbital.GetComponent(); ((BraveBehaviour)component).renderer.enabled = ((BraveBehaviour)_enemy).renderer.enabled; float num5 = (_orbitalGap * (float)num + 360f * num2).Clamp360(); float num6 = num5 / 57.29578f; Vector2 val = num5.ToVector(); ((Vector2)(ref val2))..ctor(1.5f * _enemyGirth * val.x, 0.75f * _enemyGirth * val.y + OverheadOffset()); if (_bobAmount > 0f) { val2 += new Vector2(0f, _bobAmount * Mathf.Sin(num6)); } orbital.transform.position = Vector2Extensions.ToVector3ZisY(((GameActor)_enemy).CenterPosition + val2, (num5 < 180f) ? num3 : (0f - num3)); if (_rotates) { orbital.transform.rotation = num5.EulerZ(); } if (_flips) { orbital.transform.localScale = new Vector3(0f - Mathf.Sin(num6), 1f, 1f); } if (_fades) { ((Component)(object)component).SetAlpha((val.y > 0f) ? 0f : Mathf.Abs(Mathf.Sin(num6))); } if (_isEmissive) { ((BraveBehaviour)component).renderer.material.SetFloat(CwaffVFX._EmissivePowerId, num4); } num++; } } } public class GlowAndFadeOut : MonoBehaviour { private const float _MAX_EMIT = 200f; public void Setup(float fadeInTime, float glowInTime, float holdTime, float glowOutTime, float fadeOutTime, float maxEmit = 200f, bool destroy = true) { ((MonoBehaviour)this).StartCoroutine(Top(fadeInTime, glowInTime, holdTime, glowOutTime, fadeOutTime, maxEmit, destroy)); } private IEnumerator Top(float fadeInTime, float glowInTime, float holdTime, float glowOutTime, float fadeOutTime, float maxEmit = 200f, bool destroy = true) { tk2dSprite sprite = ((Component)this).GetComponent(); ((tk2dBaseSprite)sprite).usesOverrideMaterial = true; for (float elapsed = 0f; elapsed < fadeInTime; elapsed += BraveTime.DeltaTime) { float a = elapsed / fadeInTime; ((Component)this).gameObject.SetAlpha(a); yield return null; } ((BraveBehaviour)sprite).renderer.material.shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTintableTiltedCutoutEmissive"); for (float elapsed = 0f; elapsed < glowInTime; elapsed += BraveTime.DeltaTime) { float num = 1f - elapsed / glowInTime; float num2 = 1f - num * num; ((BraveBehaviour)sprite).renderer.material.SetFloat(CwaffVFX._EmissivePowerId, maxEmit * num2); yield return null; } for (float elapsed = 0f; elapsed < holdTime; elapsed += BraveTime.DeltaTime) { yield return null; } for (float elapsed = 0f; elapsed < glowOutTime; elapsed += BraveTime.DeltaTime) { float num3 = elapsed / glowOutTime; float num4 = 1f - num3 * num3; ((BraveBehaviour)sprite).renderer.material.SetFloat(CwaffVFX._EmissivePowerId, maxEmit * num4); yield return null; } for (float elapsed = 0f; elapsed < fadeOutTime; elapsed += BraveTime.DeltaTime) { float num5 = elapsed / fadeOutTime; ((Component)this).gameObject.SetAlpha(1f - num5); yield return null; } if (destroy) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { ((Component)this).gameObject.SetAlpha(1f); } } } public class LightFader : MonoBehaviour { [SerializeField] private float _fadeTime; [SerializeField] private float _startRange; [SerializeField] private Light _light; [SerializeField] private float _timeLeft; public void Setup(float fadeTime) { _light = ((Component)this).gameObject.GetComponent(); if (Object.op_Implicit((Object)(object)_light)) { _fadeTime = fadeTime; _timeLeft = fadeTime; _startRange = _light.range; } } private void OnSpawned() { } private void Update() { if (!Object.op_Implicit((Object)(object)_light)) { Object.Destroy((Object)(object)this); return; } _timeLeft -= BraveTime.DeltaTime; _light.range = _startRange * (_timeLeft / _fadeTime); if (_light.range <= 0f) { Object.Destroy((Object)(object)_light); Object.Destroy((Object)(object)this); } } } [BepInPlugin("pretzel.etg.cwaff", "GungeonCraft", "1.32.3")] [BepInDependency("etgmodding.etg.mtgapi", "1.9.2")] [BepInDependency("alexandria.etgmod.alexandria", "0.4.25")] [BepInDependency("pretzel.etg.gunfig", "1.1.6")] public class Initialisation : BaseUnityPlugin { public static Initialisation Instance; internal static Harmony _Harmony; public void Start() { ETGModMainBehaviour.WaitForGameManagerStart((Action)GMStart); } public void GMStart(GameManager manager) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0676: Unknown result type (might be due to invalid IL or missing references) try { Stopwatch stopwatch = Stopwatch.StartNew(); _ = Process.GetCurrentProcess().WorkingSet64; Instance = this; _Harmony = new Harmony("pretzel.etg.cwaff"); Stopwatch stopwatch2 = Stopwatch.StartNew(); AtlasHelper.InitSetupPatches(_Harmony); CompatibilityPatches.Init(_Harmony); stopwatch2.Stop(); Stopwatch setupLateHarmonyWatch = null; Thread thread = new Thread((ThreadStart)delegate { setupLateHarmonyWatch = Stopwatch.StartNew(); _Harmony.PatchAll(); setupLateHarmonyWatch.Stop(); }); thread.Start(); Stopwatch stopwatch3 = Stopwatch.StartNew(); Assembly executingAssembly = Assembly.GetExecutingAssembly(); Dictionary attachPoints = AtlasHelper.ReadAttachPointsFromTSV(executingAssembly, "CwaffingTheGungy.Resources.Atlases.attach_points.tsv"); int num = 1; while (true) { string text = string.Format("{0}.Resources.Atlases.atlas_{1}.png", "CwaffingTheGungy", num); using (Stream stream = executingAssembly.GetManifestResourceStream(text)) { if (stream == null) { break; } } AtlasHelper.LoadPackedTextureResource(ResourceExtractor.GetTextureFromResource(text, executingAssembly), attachPoints, string.Format("{0}.Resources.Atlases.atlas_{1}.atlas", "CwaffingTheGungy", num)); num++; } ResMap.Build(); stopwatch3.Stop(); Stopwatch stopwatch4 = Stopwatch.StartNew(); CwaffConfig.Init(); CwaffPrerequisite.Init(); ModdedShopItemAdder.Init(); Commands.Init(); CwaffSynergies.InitEnums(); CwaffShaders.Init(); HeckedMode.Init(); VFX.Init(); SoulLinkStatus.Init(); EasyGoopDefinitions.DefineDefaultGoops(); BossBuilder.Init(); CustomNoteDoer.Init(); CwaffTweaks.Init(); HeckedShrine.Init(); IncredibleItems.Init(); CwaffRunData.Init(); Lazy.PrepareAnimationLibraries(); stopwatch4.Stop(); Stopwatch stopwatch5 = Stopwatch.StartNew(); CwaffHats.Init(); stopwatch5.Stop(); Stopwatch setupAudioWatch = null; Thread thread2 = new Thread((ThreadStart)delegate { setupAudioWatch = Stopwatch.StartNew(); AudioResourceLoader.AutoloadFromAssembly(); setupAudioWatch.Stop(); }); thread2.Start(); Stopwatch stopwatch6 = Stopwatch.StartNew(); SaveAPIManager.Setup("cg"); stopwatch6.Stop(); Stopwatch stopwatch7 = Stopwatch.StartNew(); IronMaid.Init(); Natascha.Init(); PaintballCannon.Init(); Tranquilizer.Init(); SoulKaliber.Init(); KiBlast.Init(); Deadline.Init(); BBGun.Init(); Bouncer.Init(); Grandmaster.Init(); QuarterPounder.Init(); HolyWaterGun.Init(); Alyx.Init(); VacuumCleaner.Init(); Gunbrella.Init(); Blackjack.Init(); SchrodingersGat.Init(); RacketLauncher.Init(); Outbreak.Init(); HandCannon.Init(); HatchlingGun.Init(); Ticonderogun.Init(); IceCreamGun.Init(); AimuHakurei.Init(); SeltzerPelter.Init(); Missiletoe.Init(); PlatinumStar.Init(); PistolWhip.Init(); Jugglernaut.Init(); SubtractorBeam.Init(); Alligator.Init(); Lightwing.Init(); KingsLaw.Init(); Pincushion.Init(); Crapshooter.Init(); CarpetBomber.Init(); Uppskeruvel.Init(); Glockarina.Init(); Magunet.Init(); Wavefront.Init(); Scotsman.Init(); ChekhovsGun.Init(); Vladimir.Init(); Blamethrower.Init(); Suncaster.Init(); KALI.Init(); AlienNailgun.Init(); OmnidirectionalLaser.Init(); RCLauncher.Init(); Breegull.Init(); SubMachineGun.Init(); MacchiAuto.Init(); Nycterian.Init(); Maestro.Init(); Starmageddon.Init(); Widowmaker.Init(); Zag.Init(); BlasTechF4.Init(); Telefragger.Init(); English.Init(); Femtobyte.Init(); Exceptional.Init(); Gunflower.Init(); Hallaeribut.Init(); Bubblebeam.Init(); Groundhog.Init(); DerailGun.Init(); Yggdrashell.Init(); Chroma.Init(); Oddjob.Init(); Overflow.Init(); Plasmarble.Init(); Sunderbuss.Init(); Macheening.Init(); Stereoscope.Init(); Flakseed.Init(); Xelsior.Init(); Empath.Init(); Sextant.Init(); Wayfarer.Init(); Leafblower.Init(); Forkbomb.Init(); Zealot.Init(); Toothpaste.Init(); Heartbreaker.Init(); Gradius.Init(); Entropynnium.Init(); Cleansweep.Init(); FluxFist.Init(); Retina.Init(); ChainDriver.Init(); RLTSRTSGTSBTSLB.Init(); PhotonCannon.Init(); FuelRodGun.Init(); Nightlighter.Init(); Gadulo.Init(); DeathNote.Init(); Akelus.Init(); Mtara.Init(); Lazy.FinalizeGuns(); stopwatch7.Stop(); Stopwatch stopwatch8 = Stopwatch.StartNew(); BorrowedTime.Init(); BulletThatCanKillTheFuture.Init(); GunPowderer.Init(); AmazonPrimer.Init(); EmergencySiren.Init(); Itemfinder.Init(); KalibersJustice.Init(); GasterBlaster.Init(); StackOfTorches.Init(); InsurancePolicy.Init(); IceCream.Init(); ChamberJammer.Init(); Cuppajoe.Init(); StopSign.Init(); GunSynthesizer.Init(); ChestScanner.Init(); BulletbotImplant.Init(); Frisbee.Init(); WeightedRobes.Init(); Detergent.Init(); BottledAbyss.Init(); PogoStick.Init(); GlassAmmoBox.Init(); TradingGuide.Init(); stopwatch8.Stop(); Stopwatch stopwatch9 = Stopwatch.StartNew(); DriftersHeadgear.Init(); RatPoison.Init(); JohnsWick.Init(); Gyroscope.Init(); CustodiansBadge.Init(); CreditCard.Init(); LibraryCardtridge.Init(); BlankChecks.Init(); DeadRinger.Init(); VoodooDoll.Init(); CampingSupplies.Init(); WeddingRing.Init(); GorgunEye.Init(); UtilityVest.Init(); WarriorsGi.Init(); CatEarHeadband.Init(); Blazer.Init(); PlotArmor.Init(); FourDBullets.Init(); AstralProjector.Init(); EchoChamber.Init(); BionicFinger.Init(); BubbleWand.Init(); AdrenalineShot.Init(); StuntHelmet.Init(); ComfySlippers.Init(); SafetyGloves.Init(); DrabOutfit.Init(); RingOfDefenestration.Init(); AmmoConservationManual.Init(); ReserveAmmolet.Init(); ReflexAmmolet.Init(); ScavengingArms.Init(); ArmorPiercingRounds.Init(); MMReloading.Init(); MMAiming.Init(); Calculator.Init(); VolcanicAmmolet.Init(); TryhardSnacks.Init(); BulletproofTablecloth.Init(); AmethystShard.Init(); PrismaticScope.Init(); Lichguard.Init(); ScaldingJelly.Init(); Domino.Init(); DisplayPedestal.Init(); GoopStabilizer.Init(); CombatLeotard.Init(); NewtonsApple.Init(); DemolitionContract.Init(); ChewToy.Init(); SuperColdWatch.Init(); VengefulSpirit.Init(); GameManager.Instance.ResolveModdedLootChances(); stopwatch9.Stop(); Stopwatch stopwatch10 = Stopwatch.StartNew(); thread.Join(); stopwatch10.Stop(); Stopwatch stopwatch11 = Stopwatch.StartNew(); Rogo.Init(); Rancher.Init(); stopwatch11.Stop(); Stopwatch stopwatch12 = Stopwatch.StartNew(); try { AssetBundle sharedAssets = ResourceManager.LoadAssetBundle("shared_auto_001"); AssetBundle sharedAssets2 = ResourceManager.LoadAssetBundle("shared_auto_002"); ResourceManager.LoadAssetBundle("shared_base_001"); AssetBundle braveResources = ResourceManager.LoadAssetBundle("brave_resources_001"); AssetBundle enemiesBase = ResourceManager.LoadAssetBundle("enemies_base_001"); ResourceManager.LoadAssetBundle("encounters_base_001"); CwaffDungeonPrefabs.InitCustomPrefabs(sharedAssets, sharedAssets2, braveResources, enemiesBase); CwaffDungeons.InitDungeonFlows(sharedAssets2); } catch (Exception ex) { ETGModConsole.Log((object)"[CtG] ERROR: Exception occured while building prefabs!", true); Debug.LogException(ex); } finally { AssetBundle sharedAssets2 = null; AssetBundle braveResources = null; AssetBundle enemiesBase = null; } SansDungeon.Init(); ArmisticeDungeon.Init(); FlowCommands.Install(); FloorPuzzleRoomController.Init(); ShufflePuzzleRoomController.Init(); stopwatch12.Stop(); Stopwatch stopwatch13 = Stopwatch.StartNew(); BossShared.Init(); SansBoss.Init(); ArmisticeBoss.Init(); stopwatch13.Stop(); Stopwatch stopwatch14 = Stopwatch.StartNew(); CwaffSynergies.Init(); stopwatch14.Stop(); Stopwatch stopwatch15 = Stopwatch.StartNew(); Cammy.Init(); Bart.Init(); Kevlar.Init(); Don.Init(); stopwatch15.Stop(); Stopwatch stopwatch16 = Stopwatch.StartNew(); Lazy.FinalizeAnimationLibraries(); stopwatch16.Stop(); Stopwatch stopwatch17 = Stopwatch.StartNew(); thread2.Join(); stopwatch17.Stop(); stopwatch.Stop(); ETGModConsole.Log((object)("Yay! :D Initialized GungeonCraft v1.32.3 in " + (float)stopwatch.ElapsedMilliseconds / 1000f + " seconds"), false); } catch (Exception ex2) { ETGModConsole.Log((object)ex2.Message, false); ETGModConsole.Log((object)ex2.StackTrace, false); } finally { AtlasHelper.RemoveSetupPatches(_Harmony); } _ = C.DEBUG_BUILD; } } public static class CwaffConfig { public enum SecondaryReloadKey { None, Left, Right } internal static Gunfig _Gunfig; internal const string _SHOP_KEY = "Shop Spawning Behaviour"; internal const string _SECONDARY_RELOAD = "Secondary Reload Button"; internal const string _SPICE_SHADERS = "Enable Spice Shaders"; internal const string _BULLET_HELL_SHADERS = "Enable Bullet Hell Shaders"; internal const string _MUTED_NIGHTLIGHTER = "Reduce Nightlighter Visuals"; internal const string _FUN_CHEST_SOUNDS = "Enable Fun Chest Sounds"; internal static SecondaryReloadKey _SecondaryReload; public static void Init() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) _Gunfig = Gunfig.Get(GunfigHelpers.WithColor("GungeonCraft", C.MOD_COLOR)); Gunfig gunfig = _Gunfig; List obj = new List { "Disabled", GunfigHelpers.Yellow("Left Stick"), GunfigHelpers.Yellow("Right Stick") }; List list = new List { GunfigHelpers.Green("Disables all secondary reload buttons.\nRecommended if you reload with a trigger or bumper."), GunfigHelpers.Green("Pressing the left stick triggers a reload.\nRecommended if you reload with a face button.\nNot recommended with dual stick blanks."), GunfigHelpers.Green("Pressing the right stick triggers a reload.\nRecommended if you reload with a face button.\nNot recommended with dual stick blanks.") }; gunfig.AddScrollBox("Secondary Reload Button", obj, (string)null, (Action)OnSecondaryReloadChange, list, (Update)0); _Gunfig.AddScrollBox("Hecked Mode", new List { "Disabled", GunfigHelpers.Yellow("Hecked"), GunfigHelpers.Yellow("Light"), GunfigHelpers.Yellow("Remixed"), GunfigHelpers.Yellow("Molotov"), GunfigHelpers.Yellow("Grenade"), GunfigHelpers.Magenta("Retrashed") }, (string)null, (Action)null, new List { GunfigHelpers.Green("Enemies spawn with their normal guns.\n\nTakes effect next run."), GunfigHelpers.Green("Enemies spawn with completely random guns.\nNot for the faint of heart.\nTakes effect next run."), GunfigHelpers.Green("Enemies spawn with a balanced variety of guns.\nA lighter hecked experience.\nTakes effect next run."), GunfigHelpers.Green("Enemies & companions spawn with mostly-fair guns.\nEnemies drop guns with 5% ammo when killed.\nTakes effect next run."), GunfigHelpers.Green("All enemies are armed with Molotov Launchers.\n\nTakes effect next run."), GunfigHelpers.Green("All enemies are armed with Grenade Launchers.\n\nTakes effect next run."), GunfigHelpers.Green("All enemies armed, bosses jammed, & chests fused.\nFairy in each pot. Shop prices x10. No combat stealth.\nNo free blanks each floor. Takes effect next run.") }, (Update)1); _Gunfig.AddScrollBox("Shop Spawning Behaviour", new List { "Default", GunfigHelpers.Yellow("Classic") }, (string)null, (Action)null, new List { GunfigHelpers.Green("Companion, Barter, and Insurance Shops\nspawn randomly.\nTakes effect on game restart."), GunfigHelpers.Green("Spawn Companion Shop floor 1, Barter Shop floor 2-3,\nand Insurance Shop with S or A tier item.\nTakes effect on game restart.") }, (Update)2); _Gunfig.AddToggle("Enable Spice Shaders", true, (string)null, (Action)OnSpiceShadersChanged, (Update)1); _Gunfig.AddToggle("Enable Bullet Hell Shaders", true, (string)null, (Action)OnBulletHellShadersChanged, (Update)1); _Gunfig.AddToggle("Reduce Nightlighter Visuals", false, (string)null, (Action)OnNightlighterVisualsChanged, (Update)1); _Gunfig.AddToggle("Enable Fun Chest Sounds", false, (string)null, (Action)null, (Update)1); OnSecondaryReloadChange("Secondary Reload Button", _Gunfig.Value("Secondary Reload Button")); Nightlighter._UseFancyLights = _Gunfig.Disabled("Reduce Nightlighter Visuals"); } private static void OnSpiceShadersChanged(string key, string value) { CwaffShaders.CheckSpiceShaders(value == "1"); } private static void OnBulletHellShadersChanged(string key, string value) { CwaffShaders.CheckBulletHellShaders(value == "1"); } private static void OnNightlighterVisualsChanged(string key, string value) { Nightlighter._UseFancyLights = value == "0"; } private static void OnSecondaryReloadChange(string key, string value) { if (value == "Left Stick") { _SecondaryReload = SecondaryReloadKey.Left; } else if (value == "Right Stick") { _SecondaryReload = SecondaryReloadKey.Right; } else { _SecondaryReload = SecondaryReloadKey.None; } } } }