using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; 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 BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Characters; using Characters.AI; using Characters.AI.TwinSister; using Characters.Abilities; using Characters.Abilities.Customs; using Characters.Abilities.Spirits; using Characters.Actions; using Characters.Cooldowns; using Characters.Gear; using Characters.Gear.Items; using Characters.Gear.Quintessences; using Characters.Gear.Synergy; using Characters.Gear.Synergy.Inscriptions; using Characters.Gear.Weapons; using Characters.Gear.Weapons.Gauges; using Characters.Operations; using Characters.Operations.Attack; using Characters.Operations.Fx; using Characters.Operations.Gauge; using Characters.Operations.Summon; using Characters.Player; using DCDefense; using Data; using FX; using GameResources; using HarmonyLib; using Level; using Level.Npc.FieldNpcs; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Platforms; using Platforms.Steam; using Scenes; using Services; using Singletons; using Steamworks; using UI; using UI.GearPopup; using UI.Inventory; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.ResourceManagement.AsyncOperations; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Plugins.Common")] [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 ChzzkSkul { public static class ChzzkCardSynergy { public static List EnemiesAssetKeys = new List(); public static bool EnemiesKeysCached = false; private static int _cachedCardCount = 0; private static bool _cachedIsSuper = false; private static float _cacheExpireTime = 0f; private const float CACHE_DURATION = 0.3f; public static Character GetPlayer() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown try { if ((Object)(object)Object.FindObjectOfType() == (Object)null) { return null; } Service instance = Singleton.Instance; object obj; if ((Object)(object)instance == (Object)null) { obj = null; } else { LevelManager levelManager = instance.levelManager; obj = (((Object)(object)levelManager != (Object)null) ? levelManager.player : null); } return (Character)obj; } catch { return null; } } public static Inscription TryGetCardInscription(Character player) { if ((Object)(object)player == (Object)null || player.playerComponents == null || player.playerComponents.inventory == null || (Object)(object)player.playerComponents.inventory.synergy == (Object)null) { return null; } try { EnumArray inscriptions = player.playerComponents.inventory.synergy.inscriptions; if (inscriptions == null) { return null; } PropertyInfo property = ((object)inscriptions).GetType().GetProperty("Array"); if (property != null && (!(property.GetValue(inscriptions) is Array array) || 37 >= array.Length)) { return null; } return inscriptions[(Key)37]; } catch { return null; } } private static void RefreshCache() { if (!(Time.time < _cacheExpireTime)) { _cacheExpireTime = Time.time + 0.3f; Character player = GetPlayer(); Inscription val = TryGetCardInscription(player); _cachedCardCount = val?.count ?? 0; _cachedIsSuper = val != null && val.isSuper; } } public static int GetCardCount(Item item = null) { if ((Object)(object)item != (Object)null && (Object)(object)((Component)item).gameObject != (Object)null) { string name = ((Object)((Component)item).gameObject).name; if (name.Contains("_E") || name.Contains("_RE")) { return 4; } } RefreshCache(); return _cachedCardCount; } public static bool IsCardSynergySuper(Item item = null) { if ((Object)(object)item != (Object)null && (Object)(object)((Component)item).gameObject != (Object)null) { string name = ((Object)((Component)item).gameObject).name; if (name.Contains("_R") || name.Contains("_RE")) { return true; } } RefreshCache(); return _cachedIsSuper; } public static void ShowFloatingText(string message) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //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_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) if (message.Contains("$CHAOS$")) { message = "무언가가 일어났습니다!"; } try { Service instance = Singleton.Instance; object obj; if ((Object)(object)instance == (Object)null) { obj = null; } else { LevelManager levelManager = instance.levelManager; obj = (((Object)(object)levelManager != (Object)null) ? levelManager.player : null); } Character val = (Character)obj; if ((Object)val == (Object)null) { return; } Service instance2 = Singleton.Instance; if ((Object)(object)instance2 != (Object)null) { FloatingTextSpawner floatingTextSpawner = instance2.floatingTextSpawner; if ((Object)(object)floatingTextSpawner != (Object)null) { floatingTextSpawner.SpawnBuff(message, ((Component)val).transform.position + Vector3.up * 2f, "#FFD700"); } } } catch { } } public static void InvalidateCache() { _cacheExpireTime = 0f; } } public static class ChzzkStatManager { public class StatData { public double percent = 0.0; public double percentPoint = 0.0; public double constant = 0.0; } [Serializable] public class SavedStatValue { public int categoryIndex; public int kindIndex; public double value; } [Serializable] public class SavedAbilityValue { public GlitchedTrigger trigger; public GlitchedAction action; public float value1; public float value2; public string effectDescription; } [Serializable] public class SavedGlitchedItem { public string originalName; public int slotIndex; public Rarity rarity; public Key keyword1; public Key keyword2; public List stats = new List(); public List abilities = new List(); public string glitchedName; public string glitchedDesc; public string glitchedFlavor; public string copiedItemName; public string extraCopiedItemName; } public class SaveWrapper { public bool ForceNextOmen; public bool ForceNextDarkEnemy; public bool IsBossRushActive; public bool IsScreenEffectActive; public string ScreenEffectType; public float ScreenEffectTimer; public bool IsNukeActive; public int NukeScenesPassed; public float NukeElapsed; public float BossRushElapsed; public List CurrentVoteOptions = new List(); public Dictionary SavedStats = new Dictionary(); public int SpawnedBossCount; public bool IsVoteCompletedInThisStage; public string StageName; public string VotedResultTitle; public List CustomSuperInscriptions = new List(); public List SavedGlitchedItems = new List(); public List ExtraInventoryItems = new List(); public bool IsInventoryExpanded; } public static Dictionary SavedStats = new Dictionary(); public static SaveWrapper SaveData = new SaveWrapper(); private static string saveFilePath => Path.Combine(Application.persistentDataPath, "ChzzkSkul_SavedStats.json"); public static event Action OnSave; public static event Action OnLoad; public static event Action OnClear; public static string GetOriginalItemName(string name) { if (string.IsNullOrEmpty(name)) { return name; } if (name.StartsWith("Glitched-")) { int num = "Glitched-".Length - 1; int num2 = name.LastIndexOf('-'); if (num2 > num) { return name.Substring(num + 1, num2 - num - 1); } } return name; } public static void Load() { try { if (!File.Exists(saveFilePath)) { return; } string text = File.ReadAllText(saveFilePath); try { SaveWrapper saveWrapper = JsonConvert.DeserializeObject(text); if (saveWrapper != null) { SaveData = saveWrapper; if (saveWrapper.SavedStats != null) { SavedStats = saveWrapper.SavedStats; } ChzzkStatManager.OnLoad?.Invoke(); } } catch (Exception ex) { Debug.LogError((object)("[ChzzkStatManager] JSON Deserialize Error: " + ex.Message)); } } catch (Exception ex2) { Debug.LogError((object)("[ChzzkStatManager] Load Error: " + ex2.Message)); } } public static void Save() { try { SaveData.SavedStats = SavedStats; ChzzkStatManager.OnSave?.Invoke(); string contents = JsonConvert.SerializeObject((object)SaveData, (Formatting)1); File.WriteAllText(saveFilePath, contents); } catch (Exception ex) { Debug.LogError((object)("[ChzzkStatManager] Save Error: " + ex.Message)); } } public static int KindToInt(Kind kind) { if (kind == Kind.AttackDamage) { return 0; } if (kind == Kind.PhysicalAttackDamage) { return 1; } if (kind == Kind.MagicAttackDamage) { return 2; } if (kind == Kind.AttackSpeed) { return 3; } if (kind == Kind.MovementSpeed) { return 4; } if (kind == Kind.CriticalChance) { return 5; } if (kind == Kind.CriticalDamage) { return 6; } if (kind == Kind.Health) { return 7; } if (kind == Kind.TakingDamage) { return 8; } return -1; } public static Kind IntToKind(int id) { return (Kind)(id switch { 0 => Kind.AttackDamage, 1 => Kind.PhysicalAttackDamage, 2 => Kind.MagicAttackDamage, 3 => Kind.AttackSpeed, 4 => Kind.MovementSpeed, 5 => Kind.CriticalChance, 6 => Kind.CriticalDamage, 7 => Kind.Health, 8 => Kind.TakingDamage, _ => Kind.AttackDamage, }); } public static void AddStat(Character player, Category category, Kind kind, double value) { //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown int num = KindToInt(kind); if (num != -1) { if (!SavedStats.ContainsKey(num)) { SavedStats[num] = new StatData(); } if (category == Category.Percent) { SavedStats[num].percent += value; } else if (category == Category.PercentPoint) { SavedStats[num].percentPoint += value; } else if (category == Category.Constant) { SavedStats[num].constant += value; } Save(); if ((Object)(object)player != (Object)null && player.stat != null) { double num2 = ((category == Category.Percent) ? (1.0 + value) : value); player.stat.AttachValues(new Values((Value[])(object)new Value[1] { new Value(category, kind, num2) })); } } } public static void ApplyToPlayer(Character player) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown if ((Object)(object)player == (Object)null || player.stat == null) { return; } foreach (KeyValuePair savedStat in SavedStats) { Kind val = IntToKind(savedStat.Key); if (savedStat.Value.percent != 0.0) { player.stat.AttachValues(new Values((Value[])(object)new Value[1] { new Value(Category.Percent, val, 1.0 + savedStat.Value.percent) })); } if (savedStat.Value.percentPoint != 0.0) { player.stat.AttachValues(new Values((Value[])(object)new Value[1] { new Value(Category.PercentPoint, val, savedStat.Value.percentPoint) })); } if (savedStat.Value.constant != 0.0) { player.stat.AttachValues(new Values((Value[])(object)new Value[1] { new Value(Category.Constant, val, savedStat.Value.constant) })); } } } public static void Clear() { if (SavedStats.Count > 0) { SavedStats.Clear(); } SaveData.IsInventoryExpanded = false; if (SaveData.ExtraInventoryItems != null) { SaveData.ExtraInventoryItems.Clear(); } if (SaveData.SavedGlitchedItems != null) { SaveData.SavedGlitchedItems.Clear(); } ChzzkStatManager.OnClear?.Invoke(); Save(); Debug.Log((object)"[ChzzkStatManager] Cleared saved stats because a new run started."); } } public sealed class VaseOfTheFallenAbilityComponent : AbilityComponent, IStackable { public int currentKillCount { get; set; } public float stack { get { return currentKillCount; } set { currentKillCount = (int)value; } } public override void Initialize() { base.Initialize(); base._ability.component = this; } } [Serializable] public class VaseOfTheFallenAbility : Ability, ICloneable { public class Instance : AbilityInstance { private Values _stats; private float _currentRevengeCooldown; private float _revengeTimeRemaining = 1f; public bool _canRevenge = false; public bool _isCooldown = false; private int _lostStacks; public override float iconFillAmount => _isCooldown ? (1f - _currentRevengeCooldown / base.ability._revengeCooldown) : (1f - _revengeTimeRemaining / base.ability._revengeTimeout); public override int iconStacks => ((Object)(object)base.ability.component != (Object)null) ? base.ability.component.currentKillCount : 0; public override Sprite icon { get { if ((Object)(object)base.ability.component == (Object)null || base.ability.component.currentKillCount == 0) { return null; } return ((Ability)base.ability)._defaultIcon; } } public Instance(Character owner, VaseOfTheFallenAbility ability) : base(owner, ability) { } public override void OnAttach() { //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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown _stats = base.ability._statPerStack.Clone(); ((AbilityInstance)this).owner.stat.AttachValues(_stats); RefreshStacks(); Character owner = ((AbilityInstance)this).owner; owner.onKilled = (OnKilledDelegate)Delegate.Combine((Delegate?)(object)owner.onKilled, (Delegate?)new OnKilledDelegate(OnKilledEnemy)); ((Health)((AbilityInstance)this).owner.health).onTakeDamage.Add(-1000, new TakeDamageDelegate(OnTakeDamage)); } public override void OnDetach() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown Character owner = ((AbilityInstance)this).owner; owner.onKilled = (OnKilledDelegate)Delegate.Remove((Delegate?)(object)owner.onKilled, (Delegate?)new OnKilledDelegate(OnKilledEnemy)); ((AbilityInstance)this).owner.stat.DetachValues(_stats); ((Health)((AbilityInstance)this).owner.health).onTakeDamage.Remove(new TakeDamageDelegate(OnTakeDamage)); } private void OnKilledEnemy(ITarget target, ref Damage damage) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 if ((int)target.character.type != 7 && (Object)(object)base.ability.component != (Object)null) { int currentKillCount = base.ability.component.currentKillCount; base.ability.component.currentKillCount = Math.Min(currentKillCount + 1, base.ability._maxStack); RefreshStacks(); } } private unsafe bool OnTakeDamage(ref Damage damage) { //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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown if (((AbilityInstance)this).owner.invulnerable.value) { return false; } AttackType attackType = damage.attackType; if (((object)(*(AttackType*)(&attackType))/*cast due to .constrained prefix*/).Equals((object)(AttackType)0)) { return false; } if (damage.@null) { return false; } if (((Damage)(ref damage)).amount < 1.0) { return false; } if ((Object)(object)base.ability.component != (Object)null) { int currentKillCount = base.ability.component.currentKillCount; _lostStacks = currentKillCount / 2; base.ability.component.currentKillCount /= 2; RefreshStacks(); _canRevenge = true; _revengeTimeRemaining = base.ability._revengeTimeout; ((PriorityList)(object)((AbilityInstance)this).owner.onGiveDamage).Add(int.MaxValue, new GiveDamageDelegate(OnRevenge)); } return false; } private bool OnRevenge(ITarget target, ref Damage damage) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown if (damage.@null) { return false; } if (((Damage)(ref damage)).amount < 1.0) { return false; } _canRevenge = false; _revengeTimeRemaining = base.ability._revengeTimeout; ((PriorityList)(object)((AbilityInstance)this).owner.onGiveDamage).Remove(new GiveDamageDelegate(OnRevenge)); if (_isCooldown) { return false; } if ((Object)(object)base.ability.component != (Object)null) { base.ability.component.currentKillCount += _lostStacks / 2; } _isCooldown = true; _currentRevengeCooldown = 0f; return false; } public override void UpdateTime(float deltaTime) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown ((AbilityInstance)this).UpdateTime(deltaTime); if (_canRevenge) { _revengeTimeRemaining -= deltaTime; } if (_revengeTimeRemaining < 0f) { _revengeTimeRemaining = base.ability._revengeTimeout; _canRevenge = false; ((PriorityList)(object)((AbilityInstance)this).owner.onGiveDamage).Remove(new GiveDamageDelegate(OnRevenge)); } if (_isCooldown) { _currentRevengeCooldown += deltaTime; } if (_currentRevengeCooldown > base.ability._revengeCooldown) { _currentRevengeCooldown = 0f; _isCooldown = false; } } private void RefreshStacks() { if (!((Object)(object)base.ability.component == (Object)null)) { int currentKillCount = base.ability.component.currentKillCount; for (int i = 0; i < ((ReorderableArray)(object)_stats).values.Length; i++) { ((ReorderableArray)(object)_stats).values[i].value = ((ReorderableArray)(object)base.ability._statPerStack).values[i].GetStackedValue((double)currentKillCount); } ((AbilityInstance)this).owner.stat.SetNeedUpdate(); } } } [SerializeField] internal float _revengeTimeout = 1f; [SerializeField] internal float _revengeCooldown = 1f; [SerializeField] internal int _maxStack = 1; [SerializeField] internal Values _statPerStack; public VaseOfTheFallenAbilityComponent component { get; set; } public override IAbilityInstance CreateInstance(Character owner) { return (IAbilityInstance)(object)new Instance(owner, this); } public object Clone() { return new VaseOfTheFallenAbility { _revengeTimeout = _revengeTimeout, _revengeCooldown = _revengeCooldown, _maxStack = _maxStack, _statPerStack = _statPerStack.Clone(), _defaultIcon = base._defaultIcon }; } } public sealed class CorruptedSymbolAbilityComponent : AbilityComponent { public override void Initialize() { base.Initialize(); } } [Serializable] public class CorruptedSymbolAbility : Ability, ICloneable { public class Instance : AbilityInstance { private Values _stats; private EnumArray _inscriptions; private Inventory _inventory; public override int iconStacks => SpoilsInscriptionCount(); public int SpoilsInscriptionCount() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 foreach (Inscription inscription in _inscriptions) { if ((int)inscription.key == 21) { return inscription.count; } } return 0; } public Instance(Character owner, CorruptedSymbolAbility ability) : base(owner, ability) { _inventory = owner.playerComponents.inventory; _inscriptions = owner.playerComponents.inventory.synergy.inscriptions; } public override void OnAttach() { _stats = base.ability._statPerStack.Clone(); ((AbilityInstance)this).owner.stat.AttachValues(_stats); RefreshSpoilsInscriptionCount(); _inventory.onUpdatedKeywordCounts += RefreshSpoilsInscriptionCount; } public override void OnDetach() { ((AbilityInstance)this).owner.stat.DetachValues(_stats); _inventory.onUpdatedKeywordCounts -= RefreshSpoilsInscriptionCount; } private void RefreshSpoilsInscriptionCount() { for (int i = 0; i < ((ReorderableArray)(object)_stats).values.Length; i++) { ((ReorderableArray)(object)_stats).values[i].value = ((ReorderableArray)(object)base.ability._statPerStack).values[i].GetStackedValue((double)SpoilsInscriptionCount()); } ((AbilityInstance)this).owner.stat.SetNeedUpdate(); } } [SerializeField] internal Values _statPerStack; public override IAbilityInstance CreateInstance(Character owner) { return (IAbilityInstance)(object)new Instance(owner, this); } public object Clone() { return new CorruptedSymbolAbility { _statPerStack = _statPerStack.Clone(), _defaultIcon = base._defaultIcon }; } } public sealed class GodLittleBoneAbilityComponent : AbilityComponent { public override void Initialize() { base.Initialize(); } } [Serializable] public class GodLittleBoneAbility : Ability, ICloneable { public class Instance : AbilityInstance { public Instance(Character owner, GodLittleBoneAbility ability) : base(owner, ability) { } public override void OnAttach() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown ((PriorityList)(object)((AbilityInstance)this).owner.onGiveDamage).Add(100, new GiveDamageDelegate(OnGiveDamage)); } public override void OnDetach() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown ((PriorityList)(object)((AbilityInstance)this).owner.onGiveDamage).Remove(new GiveDamageDelegate(OnGiveDamage)); } private bool OnGiveDamage(ITarget target, ref Damage damage) { if (damage.@null || ((Damage)(ref damage)).amount < 1.0) { return false; } damage.multiplier *= 1.5; return false; } } public override IAbilityInstance CreateInstance(Character owner) { return (IAbilityInstance)(object)new Instance(owner, this); } public object Clone() { return new GodLittleBoneAbility { _defaultIcon = base._defaultIcon }; } } public sealed class StreamerHealAbilityComponent : AbilityComponent { public override void Initialize() { base.Initialize(); } } [Serializable] public class StreamerHealAbility : Ability, ICloneable { public class Instance : AbilityInstance { private float _elapsed = 0f; public Instance(Character owner, StreamerHealAbility ability) : base(owner, ability) { } public override void OnAttach() { } public override void OnDetach() { } public override void UpdateTime(float deltaTime) { ((AbilityInstance)this).UpdateTime(deltaTime); _elapsed += deltaTime; if (_elapsed >= 3f) { _elapsed -= 3f; ((Health)((AbilityInstance)this).owner.health).Heal(1.0, true); } } } public override IAbilityInstance CreateInstance(Character owner) { return (IAbilityInstance)(object)new Instance(owner, this); } public object Clone() { return new StreamerHealAbility { _defaultIcon = base._defaultIcon }; } } public enum GlitchedTrigger { OnAttack, OnSkill, OnHit, OnDash, OnSwap, OnPeriodic, OnKill, OnPassive } public enum GlitchedAction { AddDamage, Shield, Heal, StatBoost, SpawnGold, SpawnBone, Explosion, SelfExplosion, StatDebuff, LoseGold, CastRandomSkill, UseRandomQuintessence, SpawnEnemy, SpawnItem, Freeze, Teleport, SpawnTemporarySpirit, PassiveBonusDamage, PassiveSummonSpirit, PassiveStatBoost, PassiveCopyItem, None } public sealed class TMTrainerAbilityComponent : AbilityComponent { public override void Initialize() { base.Initialize(); } } [Serializable] public class TMTrainerAbility : Ability, ICloneable { public class Instance : AbilityInstance { private float _cooldownTimer = 0f; private float _periodicTimer = 0f; private Random _rnd = new Random(); private List _summonedSpirits = new List(); private Values _passiveStats; private static readonly string[] SpiritItemNames = new string[6] { "UndineWaterSpirit", "SalamanderFireSpirit", "GnomeEarthSpirit", "SylphidWindSpirit", "LughLightSpirit", "DeathShadowSpirit" }; private static readonly FieldInfo damageKeyField = typeof(Damage).GetField("key", BindingFlags.Instance | BindingFlags.Public); public Instance(Character owner, TMTrainerAbility ability) : base(owner, ability) { } public override void OnAttach() { //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Expected O, but got Unknown //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Expected O, but got Unknown //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Expected O, but got Unknown //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Expected O, but got Unknown //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown if (base.ability.trigger == GlitchedTrigger.OnPassive) { if (base.ability.action == GlitchedAction.PassiveSummonSpirit) { string spiritItemName = SpiritItemNames[_rnd.Next(SpiritItemNames.Length)]; ((MonoBehaviour)((AbilityInstance)this).owner).StartCoroutine(C_SummonSpirit(spiritItemName)); } else if (base.ability.action == GlitchedAction.PassiveBonusDamage) { ((PriorityList)(object)((AbilityInstance)this).owner.onGiveDamage).Add(100, new GiveDamageDelegate(OnGiveDamageForPassiveBonus)); } else if (base.ability.action == GlitchedAction.PassiveStatBoost) { int num = (int)base.ability.value2; Kind val = Kind.AttackSpeed; switch (num) { case 1: val = Kind.PhysicalAttackDamage; break; case 2: val = Kind.MagicAttackDamage; break; case 3: val = Kind.MovementSpeed; break; } _passiveStats = new Values((Value[])(object)new Value[1] { new Value(Category.PercentPoint, val, (double)base.ability.value1 / 100.0) }); ((AbilityInstance)this).owner.stat.AttachValues(_passiveStats); ((AbilityInstance)this).owner.stat.SetNeedUpdate(); } } else { switch (base.ability.trigger) { case GlitchedTrigger.OnAttack: ((PriorityList)(object)((AbilityInstance)this).owner.onGiveDamage).Add(100, new GiveDamageDelegate(OnGiveDamageForAttack)); break; case GlitchedTrigger.OnHit: ((Health)((AbilityInstance)this).owner.health).onTakeDamage.Add(-100, new TakeDamageDelegate(OnTakeDamageForHit)); break; case GlitchedTrigger.OnKill: { Character owner = ((AbilityInstance)this).owner; owner.onKilled = (OnKilledDelegate)Delegate.Combine((Delegate?)(object)owner.onKilled, (Delegate?)new OnKilledDelegate(OnKilled)); break; } case GlitchedTrigger.OnSkill: case GlitchedTrigger.OnDash: case GlitchedTrigger.OnSwap: ((AbilityInstance)this).owner.onStartAction += OnStartAction; break; case GlitchedTrigger.OnPeriodic: break; } } } public override void OnDetach() { //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: 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_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown foreach (Spirit summonedSpirit in _summonedSpirits) { if ((Object)(object)summonedSpirit != (Object)null && (Object)(object)((Component)summonedSpirit).gameObject != (Object)null) { Object.Destroy((Object)(object)((Component)summonedSpirit).gameObject); } } _summonedSpirits.Clear(); if (_passiveStats != null) { ((AbilityInstance)this).owner.stat.DetachValues(_passiveStats); ((AbilityInstance)this).owner.stat.SetNeedUpdate(); } if (base.ability.trigger == GlitchedTrigger.OnPassive) { if (base.ability.action == GlitchedAction.PassiveBonusDamage) { ((PriorityList)(object)((AbilityInstance)this).owner.onGiveDamage).Remove(new GiveDamageDelegate(OnGiveDamageForPassiveBonus)); } return; } switch (base.ability.trigger) { case GlitchedTrigger.OnAttack: ((PriorityList)(object)((AbilityInstance)this).owner.onGiveDamage).Remove(new GiveDamageDelegate(OnGiveDamageForAttack)); break; case GlitchedTrigger.OnHit: ((Health)((AbilityInstance)this).owner.health).onTakeDamage.Remove(new TakeDamageDelegate(OnTakeDamageForHit)); break; case GlitchedTrigger.OnKill: { Character owner = ((AbilityInstance)this).owner; owner.onKilled = (OnKilledDelegate)Delegate.Remove((Delegate?)(object)owner.onKilled, (Delegate?)new OnKilledDelegate(OnKilled)); break; } case GlitchedTrigger.OnSkill: case GlitchedTrigger.OnDash: case GlitchedTrigger.OnSwap: ((AbilityInstance)this).owner.onStartAction -= OnStartAction; break; case GlitchedTrigger.OnPeriodic: break; } } public override void UpdateTime(float deltaTime) { ((AbilityInstance)this).UpdateTime(deltaTime); if (base.ability.trigger == GlitchedTrigger.OnPeriodic) { _periodicTimer += deltaTime; if (_periodicTimer >= base.ability.value2) { _periodicTimer = 0f; TriggerAction(null); } } } private bool OnGiveDamageForAttack(ITarget target, ref Damage damage) { if (base.ability.trigger == GlitchedTrigger.OnAttack) { if (damage.key == "GlitchedPassiveBonus") { return false; } TriggerAction(target); } return false; } private bool OnTakeDamageForHit(ref Damage damage) { if (base.ability.trigger == GlitchedTrigger.OnHit) { TriggerAction(null); } return false; } private void OnKilled(ITarget target, ref Damage damage) { if (base.ability.trigger == GlitchedTrigger.OnKill) { TriggerAction(target); } } private void OnStartAction(Action action) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Invalid comparison between Unknown and I4 if (!((Object)(object)action == (Object)null)) { bool flag = false; if (base.ability.trigger == GlitchedTrigger.OnSkill && (int)action.type == 4) { flag = true; } else if (base.ability.trigger == GlitchedTrigger.OnDash && (int)action.type == 0) { flag = true; } else if (base.ability.trigger == GlitchedTrigger.OnSwap && (int)action.type == 5) { flag = true; } if (flag) { TriggerAction(null); } } } private void TriggerAction(ITarget target) { //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_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_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_05fe: Unknown result type (might be due to invalid IL or missing references) //IL_0742: Unknown result type (might be due to invalid IL or missing references) //IL_0743: Unknown result type (might be due to invalid IL or missing references) //IL_0b17: Unknown result type (might be due to invalid IL or missing references) //IL_0b18: 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_0226: 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_018a: 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_0543: 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_0552: 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) //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_05cf: 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_064c: Unknown result type (might be due to invalid IL or missing references) //IL_0652: Invalid comparison between Unknown and I4 //IL_0791: Unknown result type (might be due to invalid IL or missing references) //IL_0797: Invalid comparison between Unknown and I4 //IL_0b66: Unknown result type (might be due to invalid IL or missing references) //IL_0b6c: Invalid comparison between Unknown and I4 //IL_01eb: 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_0656: Unknown result type (might be due to invalid IL or missing references) //IL_065c: Invalid comparison between Unknown and I4 //IL_079b: Unknown result type (might be due to invalid IL or missing references) //IL_07a1: Invalid comparison between Unknown and I4 //IL_08aa: 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_08c1: Unknown result type (might be due to invalid IL or missing references) //IL_0b70: Unknown result type (might be due to invalid IL or missing references) //IL_0b76: Invalid comparison between Unknown and I4 //IL_0691: Unknown result type (might be due to invalid IL or missing references) //IL_069f: Unknown result type (might be due to invalid IL or missing references) //IL_06a4: Unknown result type (might be due to invalid IL or missing references) //IL_07d6: 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_07e9: 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_027a: Invalid comparison between Unknown and I4 //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Invalid comparison between Unknown and I4 //IL_02b9: 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_02cc: 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_0345: 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) if ((Object)(object)((AbilityInstance)this).owner == (Object)null || (Object)(object)((Component)((AbilityInstance)this).owner).gameObject == (Object)null || (Object)(object)((Component)((AbilityInstance)this).owner).transform == (Object)null || (Object)(object)((AbilityInstance)this).owner.health == (Object)null || ((Health)((AbilityInstance)this).owner.health).dead) { return; } Vector3 position = ((Component)((AbilityInstance)this).owner).transform.position; if (target != null && (Object)(object)target.transform != (Object)null) { position = target.transform.position; } switch (base.ability.action) { case GlitchedAction.AddDamage: { double num9 = base.ability.value1; bool flag2 = _rnd.Next(2) == 0; if (target != null && (Object)(object)target.character != (Object)null && (Object)(object)((Component)target.character).transform != (Object)null && (Object)(object)target.character.health != (Object)null && !((Health)target.character.health).dead) { Damage val9 = default(Damage); ((Damage)(ref val9))..ctor(Attacker.op_Implicit(((AbilityInstance)this).owner), num9, Vector2.op_Implicit(((Component)target.character).transform.position), (Attribute)(!flag2), (AttackType)4, (MotionType)0, 1.0, 0f, 0.0, 1.0, 1.0, true, false, 0.0, 0.0, (short)0, (PriorityList)null, 1.0); object obj5 = val9; damageKeyField.SetValue(obj5, "GlitchedPassiveBonus"); val9 = (Damage)obj5; ((AbilityInstance)this).owner.Attack(target, ref val9); break; } Collider2D[] array7 = Physics2D.OverlapCircleAll(Vector2.op_Implicit(position), 5f); Collider2D[] array8 = array7; Damage val11 = default(Damage); foreach (Collider2D val10 in array8) { if (!((Object)(object)val10 == (Object)null)) { Character componentInParent4 = ((Component)val10).GetComponentInParent(); if ((Object)(object)componentInParent4 != (Object)null && (int)componentInParent4.type != 6 && (int)componentInParent4.type != 7 && (Object)(object)componentInParent4.health != (Object)null && !((Health)componentInParent4.health).dead) { ((Damage)(ref val11))..ctor(Attacker.op_Implicit(((AbilityInstance)this).owner), num9, Vector2.op_Implicit(((Component)componentInParent4).transform.position), (Attribute)(!flag2), (AttackType)4, (MotionType)0, 1.0, 0f, 0.0, 1.0, 1.0, true, false, 0.0, 0.0, (short)0, (PriorityList)null, 1.0); object obj6 = val11; damageKeyField.SetValue(obj6, "GlitchedPassiveBonus"); val11 = (Damage)obj6; ((AbilityInstance)this).owner.Attack(componentInParent4, ref val11); } } } break; } case GlitchedAction.Shield: { double num7 = base.ability.value1; try { FieldInfo field = ((object)((AbilityInstance)this).owner.health).GetType().GetField("shield", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object value = field.GetValue(((AbilityInstance)this).owner.health); if (value != null) { (value.GetType().GetMethod("Add", new Type[2] { typeof(Object), typeof(double) }) ?? value.GetType().GetMethod("Add", new Type[2] { typeof(object), typeof(double) }))?.Invoke(value, new object[2] { ((AbilityInstance)this).owner, num7 }); } } break; } catch { break; } } case GlitchedAction.Heal: { double num6 = base.ability.value1; ((Health)((AbilityInstance)this).owner.health).Heal(num6, true); break; } case GlitchedAction.StatBoost: { bool attackSpeed2 = _rnd.Next(2) == 0; double amount2 = (double)base.ability.value1 / 100.0; ((MonoBehaviour)((AbilityInstance)this).owner).StartCoroutine(C_TriggerStatBoost(attackSpeed2, amount2, base.ability.value2)); break; } case GlitchedAction.SpawnGold: { int num5 = (int)base.ability.value1; try { Service instance2 = Singleton.Instance; if ((Object)(object)instance2 != (Object)null && (Object)(object)instance2.levelManager != (Object)null) { instance2.levelManager.DropCurrency((Type)0, num5, 10, ((Component)((AbilityInstance)this).owner).transform.position + Vector3.up * 1.5f); } break; } catch { break; } } case GlitchedAction.SpawnBone: { int num4 = (int)base.ability.value1; try { Service instance = Singleton.Instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.levelManager != (Object)null) { instance.levelManager.DropCurrency((Type)2, num4, num4, ((Component)((AbilityInstance)this).owner).transform.position + Vector3.up * 1.5f); } break; } catch { break; } } case GlitchedAction.Explosion: { double num8 = base.ability.value1; Collider2D[] array5 = Physics2D.OverlapCircleAll(Vector2.op_Implicit(position), 7f); Collider2D[] array6 = array5; Damage val8 = default(Damage); foreach (Collider2D val7 in array6) { if (!((Object)(object)val7 == (Object)null)) { Character componentInParent3 = ((Component)val7).GetComponentInParent(); if ((Object)(object)componentInParent3 != (Object)null && (int)componentInParent3.type != 6 && (int)componentInParent3.type != 7 && (Object)(object)componentInParent3.health != (Object)null && !((Health)componentInParent3.health).dead) { ((Damage)(ref val8))..ctor(Attacker.op_Implicit(((AbilityInstance)this).owner), num8, Vector2.op_Implicit(((Component)componentInParent3).transform.position), (Attribute)2, (AttackType)4, (MotionType)0, 1.0, 0f, 0.0, 1.0, 1.0, true, false, 0.0, 0.0, (short)0, (PriorityList)null, 1.0); ((AbilityInstance)this).owner.Attack(componentInParent3, ref val8); } } } break; } case GlitchedAction.SelfExplosion: { double num2 = base.ability.value1; double num3 = _rnd.Next(3, 11); Collider2D[] array3 = Physics2D.OverlapCircleAll(Vector2.op_Implicit(position), 8f); Collider2D[] array4 = array3; Damage val5 = default(Damage); foreach (Collider2D val4 in array4) { if (!((Object)(object)val4 == (Object)null)) { Character componentInParent2 = ((Component)val4).GetComponentInParent(); if ((Object)(object)componentInParent2 != (Object)null && (int)componentInParent2.type != 6 && (int)componentInParent2.type != 7 && (Object)(object)componentInParent2.health != (Object)null && !((Health)componentInParent2.health).dead) { ((Damage)(ref val5))..ctor(Attacker.op_Implicit(((AbilityInstance)this).owner), num2, Vector2.op_Implicit(((Component)componentInParent2).transform.position), (Attribute)2, (AttackType)4, (MotionType)0, 1.0, 0f, 0.0, 1.0, 1.0, true, false, 0.0, 0.0, (short)0, (PriorityList)null, 1.0); ((AbilityInstance)this).owner.Attack(componentInParent2, ref val5); } } } if ((Object)(object)((AbilityInstance)this).owner != (Object)null && (Object)(object)((AbilityInstance)this).owner.health != (Object)null && !((Health)((AbilityInstance)this).owner.health).dead) { Damage val6 = default(Damage); ((Damage)(ref val6))..ctor(Attacker.op_Implicit(((AbilityInstance)this).owner), num3, Vector2.op_Implicit(((Component)((AbilityInstance)this).owner).transform.position), (Attribute)2, (AttackType)4, (MotionType)0, 1.0, 0f, 0.0, 1.0, 1.0, true, false, 0.0, 0.0, (short)0, (PriorityList)null, 1.0); ((Health)((AbilityInstance)this).owner.health).TakeDamage(ref val6); } break; } case GlitchedAction.StatDebuff: { bool attackSpeed = _rnd.Next(2) == 0; double amount = (double)(0f - base.ability.value1) / 100.0; ((MonoBehaviour)((AbilityInstance)this).owner).StartCoroutine(C_TriggerStatBoost(attackSpeed, amount, base.ability.value2)); break; } case GlitchedAction.LoseGold: { int val2 = (int)base.ability.value1; try { int num = Math.Min(val2, Currency.gold.balance); if (num > 0) { Currency.gold.Consume(num); } break; } catch { break; } } case GlitchedAction.CastRandomSkill: { if (((AbilityInstance)this).owner.playerComponents == null || ((AbilityInstance)this).owner.playerComponents.inventory == null || !((Object)(object)((AbilityInstance)this).owner.playerComponents.inventory.weapon != (Object)null)) { break; } Weapon current = ((AbilityInstance)this).owner.playerComponents.inventory.weapon.current; if ((Object)(object)current != (Object)null && current.currentSkills != null && current.currentSkills.Count > 0) { SkillInfo val3 = current.currentSkills[_rnd.Next(current.currentSkills.Count)]; if ((Object)(object)val3 != (Object)null && (Object)(object)val3.action != (Object)null) { val3.action.TryStart(); } } break; } case GlitchedAction.UseRandomQuintessence: ((MonoBehaviour)((AbilityInstance)this).owner).StartCoroutine(C_UseRandomQuintessence(((AbilityInstance)this).owner)); break; case GlitchedAction.SpawnEnemy: ((MonoBehaviour)((AbilityInstance)this).owner).StartCoroutine(C_SpawnRandomEnemy(((AbilityInstance)this).owner)); break; case GlitchedAction.SpawnItem: ((MonoBehaviour)((AbilityInstance)this).owner).StartCoroutine(C_SpawnRandomItem(((AbilityInstance)this).owner)); break; case GlitchedAction.Freeze: { Collider2D[] array = Physics2D.OverlapCircleAll(Vector2.op_Implicit(position), 8f); bool flag = false; Collider2D[] array2 = array; foreach (Collider2D val in array2) { if (!((Object)(object)val == (Object)null)) { Character componentInParent = ((Component)val).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && (int)componentInParent.type != 6 && (int)componentInParent.type != 7 && (Object)(object)componentInParent.health != (Object)null && !((Health)componentInParent.health).dead && (Object)(object)componentInParent.status != (Object)null) { componentInParent.status.ApplyFreeze(((AbilityInstance)this).owner); flag = true; } } } if (!flag) { } break; } case GlitchedAction.Teleport: break; case GlitchedAction.SpawnTemporarySpirit: { string spiritItemName = SpiritItemNames[_rnd.Next(SpiritItemNames.Length)]; ((MonoBehaviour)((AbilityInstance)this).owner).StartCoroutine(C_SummonSpirit(spiritItemName, base.ability.value1)); break; } } } private IEnumerator C_SpawnRandomEnemy(Character owner) { if (ChzzkCardSynergy.EnemiesAssetKeys == null || ChzzkCardSynergy.EnemiesAssetKeys.Count == 0) { yield break; } string foundKey = ChzzkCardSynergy.EnemiesAssetKeys[_rnd.Next(ChzzkCardSynergy.EnemiesAssetKeys.Count)]; if (foundKey == null) { yield break; } AsyncOperationHandle handle = Addressables.InstantiateAsync((object)foundKey, (Transform)null, false, true); while (!handle.IsDone) { yield return null; } if ((Object)(object)owner == (Object)null || (Object)(object)((Component)owner).gameObject == (Object)null || (Object)(object)((Component)owner).transform == (Object)null || (int)handle.Status != 1) { yield break; } GameObject loadedObj = handle.Result; if (!((Object)(object)loadedObj != (Object)null)) { yield break; } Character enemyChar = loadedObj.GetComponent(); if (!((Object)(object)enemyChar != (Object)null)) { yield break; } loadedObj.transform.position = ((Component)owner).transform.position + new Vector3((float)_rnd.Next(-4, 5), 1f, 0f); loadedObj.SetActive(true); if ((Object)(object)enemyChar.attach != (Object)null) { enemyChar.attach.SetActive(true); } yield return null; if (!((Object)(object)enemyChar != (Object)null) || !((Object)(object)owner != (Object)null) || !((Object)(object)((Component)owner).gameObject != (Object)null)) { yield break; } MonoBehaviour[] componentsInChildren = ((Component)enemyChar).GetComponentsInChildren(true); foreach (MonoBehaviour mono in componentsInChildren) { if ((Object)(object)mono == (Object)null) { continue; } AIController controller = (AIController)(object)((mono is AIController) ? mono : null); if (controller != null) { controller.target = owner; try { controller.FoundEnemy(); } catch { } } } if ((Object)(object)Map.Instance != (Object)null && (Object)(object)Map.Instance.waveContainer != (Object)null) { try { Map.Instance.waveContainer.Attach(enemyChar); } catch { } } } private IEnumerator C_SpawnRandomItem(Character owner) { Service service = Singleton.Instance; if (!((Object)(object)service != (Object)null) || !((Object)(object)service.gearManager != (Object)null) || !((Object)(object)service.levelManager != (Object)null)) { yield break; } Rarity rarity = (Rarity)_rnd.Next(4); ItemReference itemRef = service.gearManager.GetItemToTake(rarity); if (itemRef != null) { ItemRequest request = itemRef.LoadAsync(); while (!((Request)(object)request).isDone) { yield return null; } if (!((Object)(object)owner == (Object)null) && !((Object)(object)((Component)owner).gameObject == (Object)null) && !((Object)(object)((Component)owner).transform == (Object)null) && (Object)(object)((Request)(object)request).asset != (Object)null) { service.levelManager.DropItem(request, ((Component)owner).transform.position + Vector3.up * 1f); } } } private IEnumerator C_UseRandomQuintessence(Character owner) { Service service = Singleton.Instance; if (!((Object)(object)service != (Object)null) || !((Object)(object)service.gearManager != (Object)null)) { yield break; } Rarity rarity = (Rarity)_rnd.Next(4); EssenceReference quinteRef = service.gearManager.GetQuintessenceToTake(rarity); if (quinteRef == null) { yield break; } EssenceRequest req = quinteRef.LoadAsync(); while (!((Request)(object)req).isDone) { yield return null; } if ((Object)(object)owner == (Object)null || (Object)(object)((Component)owner).gameObject == (Object)null || (Object)(object)((Component)owner).transform == (Object)null || !((Object)(object)((Request)(object)req).asset != (Object)null)) { yield break; } Quintessence prefab = ((Component)((Request)(object)req).asset).GetComponent(); if ((Object)(object)prefab != (Object)null) { Quintessence quinteInstance = Object.Instantiate(prefab); ((Component)quinteInstance).transform.parent = ((Component)owner).transform; ((Component)quinteInstance).transform.localPosition = Vector3.zero; try { ((Gear)quinteInstance).Initialize(); quinteInstance.SetOwner(owner); quinteInstance.Use(); } catch (Exception ex) { Debug.LogError((object)("[UseRandomQuintessence] Failed to use quintessence: " + ex)); } Object.Destroy((Object)(object)((Component)quinteInstance).gameObject, 20f); } } private IEnumerator C_SummonSpirit(string spiritItemName, float duration = -1f) { Service service = Singleton.Instance; if ((Object)(object)service == (Object)null) { yield break; } GlobalSummonedSpirits.RemoveAll((Spirit s) => (Object)(object)s == (Object)null || (Object)(object)((Component)s).gameObject == (Object)null); if (GlobalSummonedSpirits.Count >= 128) { yield break; } ItemReference itemRef = null; if (!GearResource.instance.TryGetItemReferenceByName(spiritItemName, ref itemRef)) { yield break; } ItemRequest req = itemRef.LoadAsync(); while (!((Request)(object)req).isDone) { yield return null; } if ((Object)(object)((AbilityInstance)this).owner == (Object)null || (Object)(object)((Component)((AbilityInstance)this).owner).gameObject == (Object)null || !((Object)(object)((Request)(object)req).asset != (Object)null)) { yield break; } Item itemPrefab = ((Component)((Request)(object)req).asset).GetComponent(); if (!((Object)(object)itemPrefab != (Object)null)) { yield break; } Spirit spiritComponent = ((Component)itemPrefab).GetComponentInChildren(true); if (!((Object)(object)spiritComponent != (Object)null)) { yield break; } GameObject spiritGo = Object.Instantiate(((Component)spiritComponent).gameObject); spiritGo.transform.position = ((Component)((AbilityInstance)this).owner).transform.position; Spirit spiritInstance = spiritGo.GetComponent(); if ((Object)(object)spiritInstance != (Object)null) { ((AbilityAttacher)spiritInstance).Initialize(((AbilityInstance)this).owner); spiritInstance.targetPosition = ((Component)((AbilityInstance)this).owner).transform; spiritInstance.Attach(); ((AbilityAttacher)spiritInstance).StartAttach(); _summonedSpirits.Add(spiritInstance); GlobalSummonedSpirits.Add(spiritInstance); if (duration > 0f) { ((MonoBehaviour)((AbilityInstance)this).owner).StartCoroutine(C_TemporarySpirit(spiritInstance, duration)); } } } private IEnumerator C_TemporarySpirit(Spirit spirit, float duration) { yield return (object)new WaitForSeconds(duration); if ((Object)(object)spirit != (Object)null) { _summonedSpirits.Remove(spirit); try { spirit.Detach(); } catch { } try { ((AbilityAttacher)spirit).StopAttach(); } catch { } try { Object.Destroy((Object)(object)((Component)spirit).gameObject); } catch { } } } private bool OnGiveDamageForPassiveBonus(ITarget target, ref Damage damage) { //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_00d9: 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_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) if (damage.@null || ((Damage)(ref damage)).amount < 1.0) { return false; } if (damage.key == "GlitchedPassiveBonus") { return false; } double num = base.ability.value1; bool flag = _rnd.Next(2) == 0; if (target != null && (Object)(object)target.character != (Object)null && (Object)(object)((Component)target.character).transform != (Object)null && (Object)(object)target.character.health != (Object)null && !((Health)target.character.health).dead) { Damage val = default(Damage); ((Damage)(ref val))..ctor(Attacker.op_Implicit(((AbilityInstance)this).owner), num, Vector2.op_Implicit(((Component)target.character).transform.position), (Attribute)(!flag), (AttackType)4, (MotionType)0, 1.0, 0f, 0.0, 1.0, 1.0, true, false, 0.0, 0.0, (short)0, (PriorityList)null, 1.0); object obj = val; damageKeyField.SetValue(obj, "GlitchedPassiveBonus"); val = (Damage)obj; ((AbilityInstance)this).owner.Attack(target, ref val); } return false; } private IEnumerator C_TriggerStatBoost(bool attackSpeed, double amount, float duration) { if (!((Object)(object)((AbilityInstance)this).owner == (Object)null) && !((Object)(object)((Component)((AbilityInstance)this).owner).gameObject == (Object)null) && ((AbilityInstance)this).owner.stat != null) { Category category = Category.PercentPoint; Kind kind = (attackSpeed ? Kind.BasicAttackSpeed : Kind.SkillCooldownSpeed); Value val = new Value(category, kind, amount); Values statValues = new Values((Value[])(object)new Value[1] { val }); ((AbilityInstance)this).owner.stat.AttachValues(statValues); if (amount < 0.0) { string msg = ((!PluginItems.IsKorean()) ? (attackSpeed ? $"[Data Degrade] Attack speed reduced by {Math.Abs(amount) * 100.0:F0}%!" : $"[Data Degrade] Cooldown speed reduced by {Math.Abs(amount) * 100.0:F0}%!") : (attackSpeed ? $"[?곗씠???\u0080?? 怨듦꺽 ?띾룄 {amount * 100.0:F0}% 媛먯냼!" : $"[?곗씠???\u0080?? 荑⑤떎???띾룄 {amount * 100.0:F0}% 媛먯냼!")); ChzzkCardSynergy.ShowFloatingText(msg); } else { string msg2 = ((!PluginItems.IsKorean()) ? (attackSpeed ? $"[Data Alter] Attack speed +{amount * 100.0:F0}%!" : $"[Data Alter] Cooldown speed +{amount * 100.0:F0}%!") : (attackSpeed ? $"[?곗씠??蹂\u0080議? 怨듦꺽 ?띾룄 +{amount * 100.0:F0}% 媛\u0080??" : $"[?곗씠??蹂\u0080議? 荑⑤떎???띾룄 +{amount * 100.0:F0}% 媛\u0080??")); ChzzkCardSynergy.ShowFloatingText(msg2); } yield return (object)new WaitForSeconds(duration); if ((Object)(object)((AbilityInstance)this).owner != (Object)null && (Object)(object)((Component)((AbilityInstance)this).owner).gameObject != (Object)null && ((AbilityInstance)this).owner.stat != null) { ((AbilityInstance)this).owner.stat.DetachValues(statValues); } } } } public GlitchedTrigger trigger; public GlitchedAction action; public float value1; public float value2; public string effectDescription; public static readonly List GlobalSummonedSpirits = new List(); public override IAbilityInstance CreateInstance(Character owner) { return (IAbilityInstance)(object)new Instance(owner, this); } public object Clone() { return MemberwiseClone(); } } public sealed class GlitchedStatAbilityComponent : AbilityComponent { public override void Initialize() { base.Initialize(); } } [Serializable] public class GlitchedStatAbility : Ability, ICloneable { public class Instance : AbilityInstance { private Values _stats; public Instance(Character owner, GlitchedStatAbility ability) : base(owner, ability) { } public override void OnAttach() { if (base.ability.stats != null) { _stats = base.ability.stats.Clone(); ((AbilityInstance)this).owner.stat.AttachValues(_stats); ((AbilityInstance)this).owner.stat.SetNeedUpdate(); } } public override void OnDetach() { if (_stats != null) { ((AbilityInstance)this).owner.stat.DetachValues(_stats); ((AbilityInstance)this).owner.stat.SetNeedUpdate(); } } } public Values stats; public override IAbilityInstance CreateInstance(Character owner) { return (IAbilityInstance)(object)new Instance(owner, this); } public object Clone() { return new GlitchedStatAbility { stats = ((stats != null) ? stats.Clone() : null), _defaultIcon = base._defaultIcon }; } } [HarmonyPatch] public class UseSkillBypassPatch { [HarmonyPrefix] [HarmonyPatch(typeof(CooldownSerializer), "get_canUse")] private static bool get_canUse_Prefix(CooldownSerializer __instance, ref bool __result) { try { Character player = ChzzkCardSynergy.GetPlayer(); if ((Object)(object)player != (Object)null && player.playerComponents != null && player.playerComponents.inventory != null) { WeaponInventory weapon = player.playerComponents.inventory.weapon; if ((Object)(object)weapon != (Object)null) { Weapon current = weapon.current; if ((Object)(object)current != (Object)null && current.currentSkills != null) { foreach (SkillInfo currentSkill in current.currentSkills) { if ((Object)(object)currentSkill != (Object)null && (Object)(object)currentSkill.action != (Object)null && currentSkill.action.cooldown == __instance) { __result = true; return false; } } } Weapon next = weapon.next; if ((Object)(object)next != (Object)null && next.currentSkills != null) { foreach (SkillInfo currentSkill2 in next.currentSkills) { if ((Object)(object)currentSkill2 != (Object)null && (Object)(object)currentSkill2.action != (Object)null && currentSkill2.action.cooldown == __instance) { __result = true; return false; } } } } } } catch (Exception ex) { Debug.LogWarning((object)("[UseSkillBypassPatch] Failed to bypass cooldown: " + ex.Message)); } return true; } } public sealed class GuanYuCrescentBladeAbilityComponent : AbilityComponent { public override void Initialize() { base.Initialize(); } } [Serializable] public class GuanYuCrescentBladeAbility : Ability, ICloneable { public class Instance : AbilityInstance { private float _cooldownTimer = 0f; private const float Cooldown = 0f; public Instance(Character owner, GuanYuCrescentBladeAbility ability) : base(owner, ability) { } public override void OnAttach() { ((AbilityInstance)this).owner.onStartAction += OnStartAction; } public override void OnDetach() { ((AbilityInstance)this).owner.onStartAction -= OnStartAction; } public override void UpdateTime(float deltaTime) { ((AbilityInstance)this).UpdateTime(deltaTime); if (_cooldownTimer > 0f) { _cooldownTimer -= deltaTime; } } private void OnStartAction(Action action) { //IL_001a: 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_0036: Invalid comparison between Unknown and I4 //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Invalid comparison between Unknown and I4 //IL_005e: 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_006c: Invalid comparison between Unknown and I4 if (!((Object)(object)action == (Object)null)) { Debug.Log((object)$"[ChzzkSkul] GuanYu Crescent Blade OnStartAction: name='{((Object)action).name}', type={action.type}"); if ((int)action.type == 1 || (((Object)action).name != null && ((Object)action).name.IndexOf("attack", StringComparison.OrdinalIgnoreCase) >= 0 && (int)action.type != 4 && (int)action.type != 0 && (int)action.type != 5)) { TriggerSlash(); } } } private void TriggerSlash() { //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_04d7: 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_035b: 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_047a: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Invalid comparison between Unknown and I4 //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Invalid comparison between Unknown and I4 //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) //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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Invalid comparison between Unknown and I4 //IL_03f5: 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_02e4: Unknown result type (might be due to invalid IL or missing references) bool flag = false; _cooldownTimer = 0f; if ((Object)(object)((AbilityInstance)this).owner == (Object)null || (Object)(object)((Component)((AbilityInstance)this).owner).gameObject == (Object)null || (Object)(object)((AbilityInstance)this).owner.health == (Object)null || ((Health)((AbilityInstance)this).owner.health).dead) { return; } int num = 0; try { Collider2D[] array = Physics2D.OverlapCircleAll(Vector2.op_Implicit(((Component)((AbilityInstance)this).owner).transform.position), 10f); Collider2D[] array2 = array; foreach (Collider2D val in array2) { if (!((Object)(object)val == (Object)null)) { Character componentInParent = ((Component)val).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && (int)componentInParent.type != 6 && (int)componentInParent.type != 7 && (Object)(object)componentInParent.health != (Object)null && !((Health)componentInParent.health).dead) { num++; } } } } catch { } double baseMultiplier = 1.0; if (num == 1) { baseMultiplier = 1.5; } Debug.Log((object)("[ChzzkSkul] GuanYu TriggerSlash executing! GreenSlashEffect: " + ((GreenSlashEffect != null) ? "Ready" : "NULL") + ", BlackCircleEffect: " + ((BlackCircleEffect != null) ? "Ready" : "NULL") + ", SlashSound: " + ((SlashSound != null) ? "Ready" : "NULL"))); Vector3 val2 = ((Component)((AbilityInstance)this).owner).transform.position; if ((Object)(object)((AbilityInstance)this).owner.collider != (Object)null) { Bounds bounds = ((Collider2D)((AbilityInstance)this).owner.collider).bounds; val2 = ((Bounds)(ref bounds)).center; } float num2 = (((int)((AbilityInstance)this).owner.lookingDirection == 1) ? (-1f) : 1f); val2.x += num2 * 1.5f; float num3 = ((num >= 4) ? 1.1f : 0.7f); MonoBehaviour val3 = null; MonoBehaviour val4 = null; EffectInfo val5 = GreenSlashEffect ?? SlashEffect; if (val5 != null) { try { EffectPoolInstance val6 = val5.Spawn(val2, 0f, num3); val3 = (MonoBehaviour)(object)val6; if ((Object)(object)val3 != (Object)null) { if (!((Component)val3).gameObject.activeSelf) { Debug.Log((object)"[ChzzkSkul] GuanYu GreenSlashEffect spawned inactive! Forcing SetActive(true)."); ((Component)val3).gameObject.SetActive(true); } SpriteRenderer component = ((Component)val3).GetComponent(); if ((Object)(object)component != (Object)null) { ((Renderer)component).enabled = true; } Animator component2 = ((Component)val3).GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Behaviour)component2).enabled = true; } Debug.Log((object)$"[ChzzkSkul] GuanYu GreenSlashEffect spawned successfully at {val2} (scale {num3})"); } else { Debug.LogWarning((object)"[ChzzkSkul] GuanYu GreenSlashEffect Spawn returned null!"); } } catch (Exception ex) { Debug.LogError((object)("[ChzzkSkul] Failed to spawn GuanYu GreenSlashEffect: " + ex)); } } else { Debug.LogWarning((object)"[ChzzkSkul] GuanYu GreenSlashEffect is null, cannot spawn green visual!"); } if (BlackCircleEffect != null) { try { EffectPoolInstance val7 = BlackCircleEffect.Spawn(val2, 0f, num3); val4 = (MonoBehaviour)(object)val7; if ((Object)(object)val4 != (Object)null) { if (!((Component)val4).gameObject.activeSelf) { Debug.Log((object)"[ChzzkSkul] GuanYu BlackCircleEffect spawned inactive! Forcing SetActive(true)."); ((Component)val4).gameObject.SetActive(true); } SpriteRenderer component3 = ((Component)val4).GetComponent(); if ((Object)(object)component3 != (Object)null) { ((Renderer)component3).enabled = true; } Animator component4 = ((Component)val4).GetComponent(); if ((Object)(object)component4 != (Object)null) { ((Behaviour)component4).enabled = true; } Debug.Log((object)$"[ChzzkSkul] GuanYu BlackCircleEffect spawned successfully at {val2} (scale {num3})"); } else { Debug.LogWarning((object)"[ChzzkSkul] GuanYu BlackCircleEffect Spawn returned null!"); } } catch (Exception ex2) { Debug.LogError((object)("[ChzzkSkul] Failed to spawn GuanYu BlackCircleEffect: " + ex2)); } } else { Debug.LogWarning((object)"[ChzzkSkul] GuanYu BlackCircleEffect is null, cannot spawn black visual!"); } if (SlashSound != null) { try { PersistentSingleton.Instance.PlaySound(SlashSound, val2); Debug.Log((object)$"[ChzzkSkul] GuanYu SlashSound played successfully at {val2}"); } catch (Exception ex3) { Debug.LogError((object)("[ChzzkSkul] Failed to play GuanYu SlashSound: " + ex3)); } } else { Debug.LogWarning((object)"[ChzzkSkul] GuanYu SlashSound is null, cannot play audio!"); } ((MonoBehaviour)((AbilityInstance)this).owner).StartCoroutine(PerformContinuousSlash(val3 ?? val4, ((AbilityInstance)this).owner.lookingDirection, baseMultiplier, num3, val2)); } private IEnumerator PerformContinuousSlash(MonoBehaviour spawnedEffect, LookingDirection direction, double baseMultiplier, float visualScale, Vector3 spawnPos) { //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_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) float duration = 0.25f; float elapsed = 0f; HashSet alreadyHit = new HashSet(); while (elapsed < duration && !((Object)(object)((AbilityInstance)this).owner == (Object)null) && !((Object)(object)((Component)((AbilityInstance)this).owner).gameObject == (Object)null) && !((Object)(object)((AbilityInstance)this).owner.health == (Object)null) && !((Health)((AbilityInstance)this).owner.health).dead) { Vector3 slashCenter = (((Object)(object)spawnedEffect != (Object)null && (Object)(object)((Component)spawnedEffect).gameObject != (Object)null) ? ((Component)spawnedEffect).transform.position : spawnPos); try { Collider2D[] colliders = Physics2D.OverlapCircleAll(Vector2.op_Implicit(slashCenter), 12f * visualScale); Collider2D[] array = colliders; foreach (Collider2D c in array) { if ((Object)(object)c == (Object)null) { continue; } Character enemy = ((Component)c).GetComponentInParent(); if (!((Object)(object)enemy != (Object)null) || (int)enemy.type == 6 || (int)enemy.type == 7 || !((Object)(object)enemy.health != (Object)null) || ((Health)enemy.health).dead || alreadyHit.Contains(enemy)) { continue; } float dx = ((Component)enemy).transform.position.x - slashCenter.x; float dy = Mathf.Abs(((Component)enemy).transform.position.y - slashCenter.y); float minDx = -7.5f * visualScale; float maxDx = 7.5f * visualScale; float maxDy = 5f * visualScale; if (dx >= minDx && dx <= maxDx && dy <= maxDy) { alreadyHit.Add(enemy); double currentMultiplier = baseMultiplier; if (((Health)enemy.health).percent <= 0.5) { currentMultiplier *= 1.5; } double physPower = ((AbilityInstance)this).owner.stat.GetFinal(Kind.PhysicalAttackDamage); Damage slashDmg = new Damage(Attacker.op_Implicit(((AbilityInstance)this).owner), 35.0 * currentMultiplier * physPower, Vector2.op_Implicit(((Component)enemy).transform.position), (Attribute)0, (AttackType)4, (MotionType)0, "GuanYuSlash", 1.0, 0f, 0.0, 1.0, 1.0, true, false, 0.0, 0.0, (short)0, (PriorityList)null, 1.0); try { ((AbilityInstance)this).owner.Attack(enemy, ref slashDmg); Debug.Log((object)$"[ChzzkSkul] GuanYu attacked enemy {((Object)enemy).name} for {35.0 * currentMultiplier} damage (continuous slash, elapsed {elapsed}s)."); } catch (Exception ex) { Debug.LogError((object)("[ChzzkSkul] Failed to execute Attack on enemy: " + ex)); } } } } catch (Exception ex2) { Debug.LogError((object)("[ChzzkSkul] GuanYu continuous overlap search exception: " + ex2)); } elapsed += Time.deltaTime; yield return null; } } } public static EffectInfo SlashEffect; public static EffectInfo GreenSlashEffect; public static EffectInfo BlackCircleEffect; public static SoundInfo SlashSound; public override IAbilityInstance CreateInstance(Character owner) { return (IAbilityInstance)(object)new Instance(owner, this); } public object Clone() { return new GuanYuCrescentBladeAbility { _defaultIcon = base._defaultIcon }; } } public sealed class ZeusHammerAbilityComponent : AbilityComponent { public override void Initialize() { base.Initialize(); } } [Serializable] public class ZeusHammerAbility : Ability, ICloneable { public class Instance : AbilityInstance { private float _timer = 0f; private const float Interval = 0.4f; public Instance(Character owner, ZeusHammerAbility ability) : base(owner, ability) { } public override void OnAttach() { } public override void OnDetach() { } public override void UpdateTime(float deltaTime) { ((AbilityInstance)this).UpdateTime(deltaTime); _timer += deltaTime; if (_timer >= 0.4f) { _timer = 0f; TriggerLightning(); } } private void TriggerLightning() { //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_010d: 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_01af: 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) if ((Object)(object)((AbilityInstance)this).owner == (Object)null || (Object)(object)((Component)((AbilityInstance)this).owner).gameObject == (Object)null || (Object)(object)((AbilityInstance)this).owner.health == (Object)null || ((Health)((AbilityInstance)this).owner.health).dead) { return; } Collider2D[] source = Physics2D.OverlapCircleAll(Vector2.op_Implicit(((Component)((AbilityInstance)this).owner).transform.position), 7f); List list = (from c in source select ((Object)(object)c != (Object)null) ? ((Component)c).GetComponentInParent() : null into c where (Object)(object)c != (Object)null && (int)c.type != 6 && (int)c.type != 7 && (Object)(object)c.health != (Object)null && !((Health)c.health).dead select c).Distinct().ToList(); if (list.Count > 0) { int index = Random.Range(0, list.Count); Character val = list[index]; double final = ((AbilityInstance)this).owner.stat.GetFinal(Kind.MagicAttackDamage); Damage val2 = default(Damage); ((Damage)(ref val2))..ctor(Attacker.op_Implicit(((AbilityInstance)this).owner), 35.0 * final, Vector2.op_Implicit(((Component)val).transform.position), (Attribute)1, (AttackType)4, (MotionType)0, "ZeusLightning", 1.0, 0f, 0.0, 1.0, 1.0, true, false, 0.0, 0.0, (short)0, (PriorityList)null, 1.0); ((AbilityInstance)this).owner.Attack(val, ref val2); if (LightningEffect != null) { LightningEffect.Spawn(((Component)val).transform.position, 0f, 1f); } if (LightningSound != null) { PersistentSingleton.Instance.PlaySound(LightningSound, ((Component)val).transform.position); } } } } public static EffectInfo LightningEffect; public static SoundInfo LightningSound; public override IAbilityInstance CreateInstance(Character owner) { return (IAbilityInstance)(object)new Instance(owner, this); } public object Clone() { return new ZeusHammerAbility { _defaultIcon = base._defaultIcon }; } } public sealed class MedjedCloakAbilityComponent : AbilityComponent { public override void Initialize() { base.Initialize(); } } [Serializable] public class MedjedCloakAbility : Ability, ICloneable { public class Instance : AbilityInstance { public Instance(Character owner, MedjedCloakAbility ability) : base(owner, ability) { } public override void OnAttach() { IsActive = true; } public override void OnDetach() { IsActive = false; } } public static bool IsActive; public override IAbilityInstance CreateInstance(Character owner) { return (IAbilityInstance)(object)new Instance(owner, this); } public object Clone() { return new MedjedCloakAbility { _defaultIcon = base._defaultIcon }; } } public sealed class VirusAbilityComponent : AbilityComponent { public override void Initialize() { base.Initialize(); } } [Serializable] public class VirusAbility : Ability, ICloneable { public class Instance : AbilityInstance { private float _timer = 0f; private const float Interval = 10f; public Instance(Character owner, VirusAbility ability) : base(owner, ability) { } public override void OnAttach() { } public override void OnDetach() { } public override void UpdateTime(float deltaTime) { ((AbilityInstance)this).UpdateTime(deltaTime); _timer += deltaTime; if (_timer >= 10f) { _timer = 0f; TriggerVirusDamage(); } } private void TriggerVirusDamage() { if (!((Object)(object)((AbilityInstance)this).owner == (Object)null) && !((Object)(object)((AbilityInstance)this).owner.health == (Object)null) && !((Health)((AbilityInstance)this).owner.health).dead) { ((Health)((AbilityInstance)this).owner.health).TakeHealth(0.5); ChzzkCardSynergy.ShowFloatingText("諛붿씠?ъ뒪 ?④낵濡?泥대젰??0.5 媛먯냼?덉뒿?덈떎."); } } } public override IAbilityInstance CreateInstance(Character owner) { return (IAbilityInstance)(object)new Instance(owner, this); } public object Clone() { return new VirusAbility { _defaultIcon = base._defaultIcon }; } } public sealed class ChallengersBeltAbilityComponent : AbilityComponent { public override void Initialize() { base.Initialize(); } } [Serializable] public class ChallengersBeltAbility : Ability, ICloneable { public class Instance : AbilityInstance { public Instance(Character owner, ChallengersBeltAbility ability) : base(owner, ability) { } public override void OnAttach() { IsActive = true; } public override void OnDetach() { IsActive = false; } } public static bool IsActive; public override IAbilityInstance CreateInstance(Character owner) { return (IAbilityInstance)(object)new Instance(owner, this); } public object Clone() { return new ChallengersBeltAbility { _defaultIcon = base._defaultIcon }; } } [Serializable] public sealed class BrokenHeartEvolveBehavior : MonoBehaviour { [SerializeField] private Item _item = null; private void Update() { Character player = Singleton.Instance.levelManager.player; if (!((Object)(object)player == (Object)null) && player.playerComponents != null && player.playerComponents.inventory != null) { List items = player.playerComponents.inventory.quintessence.items; if (items.Any((Quintessence q) => (Object)(object)q != (Object)null && ((Object)q).name.Equals("Succubus", StringComparison.OrdinalIgnoreCase))) { ChangeItem(); } } } private void ChangeItem() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Invalid comparison between Unknown and I4 //IL_007f: 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_0084: 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) ItemReference val = default(ItemReference); if (GearResource.instance.TryGetItemReferenceByName(((Object)_item).name + "_2", ref val)) { ItemRequest val2 = val.LoadAsync(); ((Request)(object)val2).WaitForCompletion(); if ((int)((Gear)_item).state == 1) { Character player = Singleton.Instance.levelManager.player; Vector3 val3 = (((Object)(object)player != (Object)null) ? ((Component)player).transform.position : ((Component)_item).transform.position); Item val4 = Singleton.Instance.levelManager.DropItem(val2, val3); _item.ChangeOnInventory(val4); } } } } [Serializable] public sealed class SmallTwigEvolveBehavior : MonoBehaviour { [SerializeField] private Item _item = null; private bool _hasEquipped = false; private Character player; private void Awake() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown player = Singleton.Instance.levelManager.player; _hasEquipped = false; player.playerComponents.inventory.weapon.onSwap += CheckEvolveCondition; player.playerComponents.inventory.weapon.onChanged += new OnChangeDelegate(OnSkullChanged); } private void OnDestroy() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown if ((Object)(object)player != (Object)null && player.playerComponents != null && player.playerComponents.inventory != null) { player.playerComponents.inventory.weapon.onSwap -= CheckEvolveCondition; player.playerComponents.inventory.weapon.onChanged -= new OnChangeDelegate(OnSkullChanged); } } private void Update() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 if ((int)((Gear)_item).state == 1 && !_hasEquipped) { CheckEvolveCondition(); _hasEquipped = true; } } private void OnSkullChanged(Weapon old, Weapon @new) { CheckEvolveCondition(); } private void CheckEvolveCondition() { Weapon current = player.playerComponents.inventory.weapon.current; if ((Object)(object)current != (Object)null && (((Object)current).name.Equals("Skul", StringComparison.OrdinalIgnoreCase) || ((Object)current).name.Equals("HeroSkul", StringComparison.OrdinalIgnoreCase))) { ChangeItem(); } } private void ChangeItem() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 //IL_0073: 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_0078: 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) ItemReference val = default(ItemReference); if (GearResource.instance.TryGetItemReferenceByName(((Object)_item).name + "_2", ref val)) { ItemRequest val2 = val.LoadAsync(); ((Request)(object)val2).WaitForCompletion(); if ((int)((Gear)_item).state == 1) { Vector3 val3 = (((Object)(object)player != (Object)null) ? ((Component)player).transform.position : ((Component)_item).transform.position); Item val4 = Singleton.Instance.levelManager.DropItem(val2, val3); _item.ChangeOnInventory(val4); } } } } [Serializable] public sealed class SmallTwigRevertBehavior : MonoBehaviour { [SerializeField] private Item _item = null; private bool _hasEquipped = false; private Character player; private void Awake() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown player = Singleton.Instance.levelManager.player; _hasEquipped = false; player.playerComponents.inventory.weapon.onSwap += CheckRevertCondition; player.playerComponents.inventory.weapon.onChanged += new OnChangeDelegate(OnSkullChanged); } private void OnDestroy() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown if ((Object)(object)player != (Object)null && player.playerComponents != null && player.playerComponents.inventory != null) { player.playerComponents.inventory.weapon.onSwap -= CheckRevertCondition; player.playerComponents.inventory.weapon.onChanged -= new OnChangeDelegate(OnSkullChanged); } } private void Update() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 if ((int)((Gear)_item).state == 1 && !_hasEquipped) { CheckRevertCondition(); _hasEquipped = true; } } private void OnSkullChanged(Weapon old, Weapon @new) { CheckRevertCondition(); } private void CheckRevertCondition() { Weapon current = player.playerComponents.inventory.weapon.current; if ((Object)(object)current != (Object)null && !((Object)current).name.Equals("Skul", StringComparison.OrdinalIgnoreCase) && !((Object)current).name.Equals("HeroSkul", StringComparison.OrdinalIgnoreCase)) { ChangeItem(); } } private void ChangeItem() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Invalid comparison between Unknown and I4 //IL_0090: 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_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) string text = ((Object)_item).name; if (text.EndsWith("_2")) { text = text.Substring(0, text.Length - 2); } ItemReference val = default(ItemReference); if (GearResource.instance.TryGetItemReferenceByName(text, ref val)) { ItemRequest val2 = val.LoadAsync(); ((Request)(object)val2).WaitForCompletion(); if ((int)((Gear)_item).state == 1) { Vector3 val3 = (((Object)(object)player != (Object)null) ? ((Component)player).transform.position : ((Component)_item).transform.position); Item val4 = Singleton.Instance.levelManager.DropItem(val2, val3); _item.ChangeOnInventory(val4); } } } } [Serializable] public sealed class ScaleOfTheOtherworldBehavior : MonoBehaviour { [SerializeField] private Item _item = null; private void Awake() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_004a: 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) if ((Object)(object)_item == (Object)null) { _item = ((Component)this).GetComponentInParent() ?? ((Component)this).GetComponent(); } if (!((Object)(object)_item == (Object)null)) { BonusKeyword val = new BonusKeyword(); val.type = (Type)0; val.count = 1; _item.bonusKeyword = (BonusKeyword[])(object)new BonusKeyword[1] { val }; Key[] array = new Key[36]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); Key[] array2 = (Key[])(object)array; Random random = new Random(); int num = random.Next(array2.Length); int num2; for (num2 = random.Next(array2.Length); num2 == num; num2 = random.Next(array2.Length)) { } _item.keyword1 = array2[num]; _item.keyword2 = array2[num2]; } } } [Serializable] public sealed class CardFoolBehavior : MonoBehaviour { [SerializeField] private Item _item = null; private bool _isHooked = false; private Character _lastOwner = null; private Values _extraStats = null; private Values _dashStats = null; private bool _hasDashCharge = false; private bool _lastIsSuper = false; private bool _lastIsEnhanced = false; private Random _rnd = new Random(); private void Awake() { if ((Object)(object)_item == (Object)null) { _item = ((Component)this).GetComponentInParent() ?? ((Component)this).GetComponent(); } } private void Update() { //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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 //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown if ((Object)(object)_item == (Object)null || (Object)(object)((Gear)_item).owner == (Object)null) { ClearStats(); Unsubscribe(); return; } if ((Object)(object)((Gear)_item).owner != (Object)(object)_lastOwner) { Unsubscribe(); _lastOwner = ((Gear)_item).owner; Subscribe(); } bool flag = ChzzkCardSynergy.IsCardSynergySuper(_item); bool flag2 = ChzzkCardSynergy.GetCardCount(_item) >= 6; if (_extraStats == null || flag != _lastIsSuper || flag2 != _lastIsEnhanced) { ClearStats(); _lastIsSuper = flag; _lastIsEnhanced = flag2; List list = new List(); if (!flag) { double num = (flag2 ? 0.3 : 0.2); list.Add(new Value(Category.PercentPoint, Kind.MovementSpeed, num)); } else { list.Add(new Value(Category.PercentPoint, Kind.MovementSpeed, -0.1)); } if (list.Count > 0) { _extraStats = new Values(list.ToArray()); ((Gear)_item).owner.stat.AttachValues(_extraStats); ((Gear)_item).owner.stat.SetNeedUpdate(); } } } private void Subscribe() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown if ((Object)(object)_lastOwner == (Object)null) { return; } try { _lastOwner.onStartAction += OnStartAction; ((PriorityList)(object)_lastOwner.onGiveDamage).Add(100, new GiveDamageDelegate(OnGiveDamage)); _isHooked = true; } catch { } } private void Unsubscribe() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown if ((Object)(object)_lastOwner == (Object)null || !_isHooked) { return; } try { _lastOwner.onStartAction -= OnStartAction; ((PriorityList)(object)_lastOwner.onGiveDamage).Remove(new GiveDamageDelegate(OnGiveDamage)); _isHooked = false; } catch { } } private void OnStartAction(Action action) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)action == (Object)null) && (int)action.type == 0 && !((Object)(object)_lastOwner == (Object)null) && _lastIsSuper) { ((MonoBehaviour)this).StartCoroutine(C_FoolDashBuff()); } } private IEnumerator C_FoolDashBuff() { if (!((Object)(object)_lastOwner == (Object)null) && _dashStats == null) { double speed = (_lastIsEnhanced ? 0.7 : 0.5); float duration = (_lastIsEnhanced ? 1.5f : 1f); _dashStats = new Values((Value[])(object)new Value[1] { new Value(Category.PercentPoint, Kind.MovementSpeed, speed) }); _lastOwner.stat.AttachValues(_dashStats); _lastOwner.stat.SetNeedUpdate(); _hasDashCharge = true; yield return (object)new WaitForSeconds(duration); if ((Object)(object)_lastOwner != (Object)null && _dashStats != null) { _lastOwner.stat.DetachValues(_dashStats); _lastOwner.stat.SetNeedUpdate(); _dashStats = null; } _hasDashCharge = false; } } private bool OnGiveDamage(ITarget target, ref Damage damage) { if (_hasDashCharge && (Object)(object)_lastOwner != (Object)null) { _hasDashCharge = false; double num = (_lastIsEnhanced ? 2.5 : 2.0); damage.multiplier *= num; ChzzkCardSynergy.ShowFloatingText(PluginItems.IsKorean() ? "[??쐞移?愿묐?] ?\u0080誘몄? 利앺룺!" : "[Reversed Fool] Damage Amplified!"); if (_dashStats != null && (Object)(object)_lastOwner != (Object)null) { try { _lastOwner.stat.DetachValues(_dashStats); _lastOwner.stat.SetNeedUpdate(); } catch { } _dashStats = null; } } return false; } private void ClearStats() { if ((Object)(object)_lastOwner != (Object)null) { if (_extraStats != null) { try { _lastOwner.stat.DetachValues(_extraStats); } catch { } } if (_dashStats != null) { try { _lastOwner.stat.DetachValues(_dashStats); } catch { } } try { _lastOwner.stat.SetNeedUpdate(); } catch { } } _extraStats = null; _dashStats = null; _hasDashCharge = false; } private void OnDestroy() { ClearStats(); Unsubscribe(); } } [Serializable] public sealed class CardMagicianBehavior : MonoBehaviour { [SerializeField] private Item _item = null; private bool _isHooked = false; private Character _lastOwner = null; private Values _extraStats = null; private bool _lastIsSuper = false; private bool _lastIsEnhanced = false; private Random _rnd = new Random(); private void Awake() { if ((Object)(object)_item == (Object)null) { _item = ((Component)this).GetComponentInParent() ?? ((Component)this).GetComponent(); } } private void Update() { //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Expected O, but got Unknown //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown if ((Object)(object)_item == (Object)null || (Object)(object)((Gear)_item).owner == (Object)null) { ClearStats(); Unsubscribe(); return; } if ((Object)(object)((Gear)_item).owner != (Object)(object)_lastOwner) { Unsubscribe(); _lastOwner = ((Gear)_item).owner; Subscribe(); } bool flag = ChzzkCardSynergy.IsCardSynergySuper(_item); bool flag2 = ChzzkCardSynergy.GetCardCount(_item) >= 6; if (_extraStats == null || flag != _lastIsSuper || flag2 != _lastIsEnhanced) { ClearStats(); _lastIsSuper = flag; _lastIsEnhanced = flag2; List list = new List(); if (!flag) { double num = (flag2 ? 0.5 : 0.3); double num2 = (flag2 ? 0.3 : 0.15); list.Add(new Value(Category.PercentPoint, Kind.MagicAttackDamage, num)); list.Add(new Value(Category.PercentPoint, Kind.SkillCooldownSpeed, num2)); } else { list.Add(new Value(Category.PercentPoint, Kind.MagicAttackDamage, -0.15)); } if (list.Count > 0) { _extraStats = new Values(list.ToArray()); ((Gear)_item).owner.stat.AttachValues(_extraStats); ((Gear)_item).owner.stat.SetNeedUpdate(); } } } private void Subscribe() { if ((Object)(object)_lastOwner == (Object)null) { return; } try { _lastOwner.onStartAction += OnStartAction; _isHooked = true; } catch { } } private void Unsubscribe() { if ((Object)(object)_lastOwner == (Object)null || !_isHooked) { return; } try { _lastOwner.onStartAction -= OnStartAction; _isHooked = false; } catch { } } private void OnStartAction(Action action) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 if (!((Object)(object)action == (Object)null) && !((Object)(object)_lastOwner == (Object)null) && (int)action.type == 4 && _lastIsSuper) { double num = (_lastIsEnhanced ? 35 : 20); if ((double)_rnd.Next(100) < num) { ((MonoBehaviour)this).StartCoroutine(C_ResetCooldownDelayed(action)); } } } private IEnumerator C_ResetCooldownDelayed(Action action) { yield return (object)new WaitForSeconds(0.1f); if ((Object)(object)action != (Object)null && (Object)(object)_lastOwner != (Object)null) { TryResetSkillCooldown(action); ChzzkCardSynergy.ShowFloatingText(PluginItems.IsKorean() ? "[??쐞移?留덉닠?? ?ㅽ궗 荑⑤떎??珥덇린??" : "[Reversed Magician] Skill Cooldown Reset!"); } } private void TryResetSkillCooldown(Action action) { if ((Object)(object)action == (Object)null || action.cooldown == null) { return; } try { CooldownSerializer cooldown = action.cooldown; ICooldown cooldown2 = cooldown.cooldown; if (cooldown2 == null) { return; } Time val = (Time)(object)((cooldown2 is Time) ? cooldown2 : null); if (val != null) { FieldInfo fieldInfo = AccessTools.Field(typeof(Time), "remainTime"); if (fieldInfo != null) { fieldInfo.SetValue(val, 0f); } else { val.remainTime = 0f; } val.stacks = val.maxStack; } cooldown.stacks = cooldown.maxStack; } catch (Exception ex) { Debug.LogWarning((object)("[CardMagicianBehavior] Failed to reset cooldown: " + ex)); } } private void ClearStats() { if ((Object)(object)_lastOwner != (Object)null && _extraStats != null) { try { _lastOwner.stat.DetachValues(_extraStats); _lastOwner.stat.SetNeedUpdate(); } catch { } } _extraStats = null; } private void OnDestroy() { ClearStats(); Unsubscribe(); } } [Serializable] public sealed class CardHighPriestessBehavior : MonoBehaviour { [SerializeField] private Item _item = null; private bool _isHooked = false; private Character _lastOwner = null; private Values _extraStats = null; private float _healTimer = 0f; private float _reversedHealLimitTimer = 0f; private double _reversedHealedThisSecond = 0.0; private bool _lastIsSuper = false; private bool _lastIsEnhanced = false; private Random _rnd = new Random(); private void Awake() { if ((Object)(object)_item == (Object)null) { _item = ((Component)this).GetComponentInParent() ?? ((Component)this).GetComponent(); } } private void Update() { //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Expected O, but got Unknown //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown if ((Object)(object)_item == (Object)null || (Object)(object)((Gear)_item).owner == (Object)null || (Object)(object)((Gear)_item).owner.health == (Object)null || ((Health)((Gear)_item).owner.health).dead) { ClearStats(); Unsubscribe(); return; } if ((Object)(object)((Gear)_item).owner != (Object)(object)_lastOwner) { Unsubscribe(); _lastOwner = ((Gear)_item).owner; Subscribe(); } bool flag = ChzzkCardSynergy.IsCardSynergySuper(_item); bool flag2 = ChzzkCardSynergy.GetCardCount(_item) >= 6; if (_extraStats == null || flag != _lastIsSuper || flag2 != _lastIsEnhanced) { ClearStats(); _lastIsSuper = flag; _lastIsEnhanced = flag2; List list = new List(); if (!flag) { double num = (flag2 ? 40.0 : 20.0); list.Add(new Value(Category.Constant, Kind.Health, num)); } else { list.Add(new Value(Category.Constant, Kind.Health, -15.0)); } if (list.Count > 0) { _extraStats = new Values(list.ToArray()); ((Gear)_item).owner.stat.AttachValues(_extraStats); ((Gear)_item).owner.stat.SetNeedUpdate(); } } if (!flag) { _healTimer += Time.deltaTime; double num2 = (flag2 ? 1.0 : 0.5); if (_healTimer >= 1f) { _healTimer = 0f; ((Health)((Gear)_item).owner.health).Heal(num2, true); } } else { _reversedHealLimitTimer += Time.deltaTime; if (_reversedHealLimitTimer >= 1f) { _reversedHealLimitTimer = 0f; _reversedHealedThisSecond = 0.0; } } } private void Subscribe() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown if ((Object)(object)_lastOwner == (Object)null) { return; } try { ((PriorityList)(object)_lastOwner.onGiveDamage).Add(100, new GiveDamageDelegate(OnGiveDamage)); _isHooked = true; } catch { } } private void Unsubscribe() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown if ((Object)(object)_lastOwner == (Object)null || !_isHooked) { return; } try { ((PriorityList)(object)_lastOwner.onGiveDamage).Remove(new GiveDamageDelegate(OnGiveDamage)); _isHooked = false; } catch { } } private bool OnGiveDamage(ITarget target, ref Damage damage) { if ((Object)(object)_lastOwner == (Object)null || target == null || (Object)(object)target.character == (Object)null || ((Health)target.character.health).dead) { return false; } if (_lastIsSuper) { double num = (_lastIsEnhanced ? 6.0 : 3.0); if (_reversedHealedThisSecond < num) { double num2 = (_lastIsEnhanced ? 0.02 : 0.01); double num3 = ((Damage)(ref damage)).amount * num2; if (num3 > 0.1) { double num4 = Math.Min(num3, num - _reversedHealedThisSecond); _reversedHealedThisSecond += num4; ((Health)_lastOwner.health).Heal(num4, true); } } } return false; } private void ClearStats() { if ((Object)(object)_lastOwner != (Object)null && _extraStats != null) { try { _lastOwner.stat.DetachValues(_extraStats); _lastOwner.stat.SetNeedUpdate(); } catch { } } _extraStats = null; } private void OnDestroy() { ClearStats(); Unsubscribe(); } } [Serializable] public sealed class CardEmpressBehavior : MonoBehaviour { [SerializeField] private Item _item = null; private bool _isHooked = false; private Character _lastOwner = null; private float _cooldownTimer = 0f; private bool _lastIsSuper = false; private bool _lastIsEnhanced = false; private void Awake() { if ((Object)(object)_item == (Object)null) { _item = ((Component)this).GetComponentInParent() ?? ((Component)this).GetComponent(); } } private void Update() { if (!((Object)(object)_item == (Object)null)) { if ((Object)(object)((Gear)_item).owner != (Object)(object)_lastOwner) { Unsubscribe(); _lastOwner = ((Gear)_item).owner; Subscribe(); } bool lastIsSuper = ChzzkCardSynergy.IsCardSynergySuper(_item); bool lastIsEnhanced = ChzzkCardSynergy.GetCardCount(_item) >= 6; _lastIsSuper = lastIsSuper; _lastIsEnhanced = lastIsEnhanced; if (_cooldownTimer > 0f) { _cooldownTimer -= Time.deltaTime; } } } private void Subscribe() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown if ((Object)(object)_lastOwner == (Object)null) { return; } try { ((Health)_lastOwner.health).onTakeDamage.Add(-10, new TakeDamageDelegate(OnTakeDamage)); _isHooked = true; } catch { } } private void Unsubscribe() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown if ((Object)(object)_lastOwner == (Object)null || !_isHooked) { return; } try { ((Health)_lastOwner.health).onTakeDamage.Remove(new TakeDamageDelegate(OnTakeDamage)); _isHooked = false; } catch { } } private bool OnTakeDamage(ref Damage damage) { if ((Object)(object)_lastOwner == (Object)null || (Object)(object)_lastOwner.health == (Object)null || ((Health)_lastOwner.health).dead || _cooldownTimer > 0f) { return false; } if (!_lastIsSuper) { _cooldownTimer = (_lastIsEnhanced ? 12f : 15f); double num = (_lastIsEnhanced ? 30.0 : 15.0); try { FieldInfo field = ((object)_lastOwner.health).GetType().GetField("shield", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object value = field.GetValue(_lastOwner.health); if (value != null) { (value.GetType().GetMethod("Add", new Type[2] { typeof(Object), typeof(double) }) ?? value.GetType().GetMethod("Add", new Type[2] { typeof(object), typeof(double) }))?.Invoke(value, new object[2] { _lastOwner, num }); ChzzkCardSynergy.ShowFloatingText(PluginItems.IsKorean() ? $"[?ы솴?? 蹂댄샇留?+{num} ?띾뱷!" : $"[Empress] Shield +{num} gained!"); } } } catch { } } else { ((MonoBehaviour)this).StartCoroutine(C_EmpressAura()); } return false; } private IEnumerator C_EmpressAura() { _cooldownTimer = (_lastIsEnhanced ? 12f : 15f); float duration = 10f; double dmgPerSec = (_lastIsEnhanced ? 12.0 : 5.0); ChzzkCardSynergy.ShowFloatingText(PluginItems.IsKorean() ? "[??쐞移??ы솴?? ?붿뿼 ?ㅻ씪 ?쒖꽦??" : "[Reversed Empress] Fire Aura Active!"); for (float elapsed = 0f; elapsed < duration; elapsed += 1f) { if (!((Object)(object)_lastOwner != (Object)null)) { break; } if (((Health)_lastOwner.health).dead) { break; } Collider2D[] colliders = Physics2D.OverlapCircleAll(Vector2.op_Implicit(((Component)_lastOwner).transform.position), 5f); Collider2D[] array = colliders; foreach (Collider2D col in array) { if (!((Object)(object)col == (Object)null)) { Character enemy = ((Component)col).GetComponentInParent(); if ((Object)(object)enemy != (Object)null && (int)enemy.type != 6 && (int)enemy.type != 7 && (Object)(object)enemy.health != (Object)null && !((Health)enemy.health).dead) { Damage dmgObj = new Damage(Attacker.op_Implicit(_lastOwner), dmgPerSec, Vector2.op_Implicit(((Component)enemy).transform.position), (Attribute)2, (AttackType)4, (MotionType)0, 1.0, 0f, 0.0, 1.0, 1.0, true, false, 0.0, 0.0, (short)0, (PriorityList)null, 1.0); _lastOwner.Attack(enemy, ref dmgObj); } } } yield return (object)new WaitForSeconds(1f); } } private void OnDestroy() { Unsubscribe(); } } [Serializable] public sealed class CardEmperorBehavior : MonoBehaviour { [SerializeField] private Item _item = null; private bool _isHooked = false; private Character _lastOwner = null; private Values _extraStats = null; private bool _lastIsSuper = false; private bool _lastIsEnhanced = false; private Random _rnd = new Random(); private void Awake() { if ((Object)(object)_item == (Object)null) { _item = ((Component)this).GetComponentInParent() ?? ((Component)this).GetComponent(); } } private void Update() { //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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 //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown if ((Object)(object)_item == (Object)null || (Object)(object)((Gear)_item).owner == (Object)null) { ClearStats(); Unsubscribe(); return; } if ((Object)(object)((Gear)_item).owner != (Object)(object)_lastOwner) { Unsubscribe(); _lastOwner = ((Gear)_item).owner; Subscribe(); } bool flag = ChzzkCardSynergy.IsCardSynergySuper(_item); bool flag2 = ChzzkCardSynergy.GetCardCount(_item) >= 6; if (_extraStats == null || flag != _lastIsSuper || flag2 != _lastIsEnhanced) { ClearStats(); _lastIsSuper = flag; _lastIsEnhanced = flag2; List list = new List(); if (!flag) { double num = (flag2 ? 0.5 : 0.3); list.Add(new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, num)); } else { list.Add(new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, -0.15)); } if (list.Count > 0) { _extraStats = new Values(list.ToArray()); ((Gear)_item).owner.stat.AttachValues(_extraStats); ((Gear)_item).owner.stat.SetNeedUpdate(); } } } private void Subscribe() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown if ((Object)(object)_lastOwner == (Object)null) { return; } try { ((PriorityList)(object)_lastOwner.onGiveDamage).Add(100, new GiveDamageDelegate(OnGiveDamage)); _isHooked = true; } catch { } } private void Unsubscribe() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown if ((Object)(object)_lastOwner == (Object)null || !_isHooked) { return; } try { ((PriorityList)(object)_lastOwner.onGiveDamage).Remove(new GiveDamageDelegate(OnGiveDamage)); _isHooked = false; } catch { } } private bool OnGiveDamage(ITarget target, ref Damage damage) { //IL_00cb: 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_01e4: 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) if ((Object)(object)_lastOwner == (Object)null || target == null || (Object)(object)target.character == (Object)null || (Object)(object)target.character.health == (Object)null || ((Health)target.character.health).dead) { return false; } if (!_lastIsSuper) { double num = (_lastIsEnhanced ? 20.0 : 10.0); if ((double)_rnd.Next(100) < num) { double num2 = (_lastIsEnhanced ? 0.8 : 0.5); double num3 = ((Damage)(ref damage)).amount * num2; Damage val = default(Damage); ((Damage)(ref val))..ctor(Attacker.op_Implicit(_lastOwner), num3, Vector2.op_Implicit(target.transform.position), (Attribute)0, (AttackType)4, (MotionType)0, 1.0, 0f, 0.0, 1.0, 1.0, true, false, 0.0, 0.0, (short)0, (PriorityList)null, 1.0); _lastOwner.Attack(target, ref val); } } else { double num4 = (_lastIsEnhanced ? 25.0 : 15.0); if ((double)_rnd.Next(100) < num4) { if ((Object)(object)target.character.status != (Object)null) { target.character.status.ApplyStun(_lastOwner); } double num5 = (_lastIsEnhanced ? 1.5 : 1.0); double num6 = ((Damage)(ref damage)).amount * num5; Damage val2 = default(Damage); ((Damage)(ref val2))..ctor(Attacker.op_Implicit(_lastOwner), num6, Vector2.op_Implicit(target.transform.position), (Attribute)2, (AttackType)4, (MotionType)0, 1.0, 0f, 0.0, 1.0, 1.0, true, false, 0.0, 0.0, (short)0, (PriorityList)null, 1.0); _lastOwner.Attack(target, ref val2); ChzzkCardSynergy.ShowFloatingText(PluginItems.IsKorean() ? "[??쐞移??⑹젣] ?ㅽ꽩 諛?怨좎젙?쇳빐!" : "[Reversed Emperor] Stun & Fixed Damage!"); } } return false; } private void ClearStats() { if ((Object)(object)_lastOwner != (Object)null && _extraStats != null) { try { _lastOwner.stat.DetachValues(_extraStats); _lastOwner.stat.SetNeedUpdate(); } catch { } } _extraStats = null; } private void OnDestroy() { ClearStats(); Unsubscribe(); } } [Serializable] public sealed class CardHierophantBehavior : MonoBehaviour { [SerializeField] private Item _item = null; private bool _isHooked = false; private Character _lastOwner = null; private Values _extraStats = null; private Values _dashStats = null; private bool _lastIsSuper = false; private bool _lastIsEnhanced = false; private void Awake() { if ((Object)(object)_item == (Object)null) { _item = ((Component)this).GetComponentInParent() ?? ((Component)this).GetComponent(); } } private void Update() { //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Expected O, but got Unknown //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Expected O, but got Unknown if ((Object)(object)_item == (Object)null || (Object)(object)((Gear)_item).owner == (Object)null) { ClearStats(); Unsubscribe(); return; } if ((Object)(object)((Gear)_item).owner != (Object)(object)_lastOwner) { Unsubscribe(); _lastOwner = ((Gear)_item).owner; Subscribe(); } bool flag = ChzzkCardSynergy.IsCardSynergySuper(_item); bool flag2 = ChzzkCardSynergy.GetCardCount(_item) >= 6; if (_extraStats == null || flag != _lastIsSuper || flag2 != _lastIsEnhanced) { ClearStats(); _lastIsSuper = flag; _lastIsEnhanced = flag2; List list = new List(); if (!flag) { double num = (flag2 ? (-0.15) : (-0.1)); list.Add(new Value(Category.PercentPoint, Kind.TakingDamage, num)); } else { double num2 = (flag2 ? 0.25 : 0.15); list.Add(new Value(Category.PercentPoint, Kind.TakingDamage, 0.1)); list.Add(new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, num2)); list.Add(new Value(Category.PercentPoint, Kind.MagicAttackDamage, num2)); } if (list.Count > 0) { _extraStats = new Values(list.ToArray()); ((Gear)_item).owner.stat.AttachValues(_extraStats); ((Gear)_item).owner.stat.SetNeedUpdate(); } } } private void Subscribe() { if ((Object)(object)_lastOwner == (Object)null) { return; } try { _lastOwner.onStartAction += OnStartAction; _isHooked = true; } catch { } } private void Unsubscribe() { if ((Object)(object)_lastOwner == (Object)null || !_isHooked) { return; } try { _lastOwner.onStartAction -= OnStartAction; _isHooked = false; } catch { } } private void OnStartAction(Action action) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)action == (Object)null) && (int)action.type == 0 && !((Object)(object)_lastOwner == (Object)null) && !_lastIsSuper) { ((MonoBehaviour)this).StartCoroutine(C_HierophantDashBuff()); } } private IEnumerator C_HierophantDashBuff() { if (!((Object)(object)_lastOwner == (Object)null) && _dashStats == null) { double val = (_lastIsEnhanced ? (-0.25) : (-0.15)); _dashStats = new Values((Value[])(object)new Value[1] { new Value(Category.PercentPoint, Kind.TakingDamage, val) }); _lastOwner.stat.AttachValues(_dashStats); _lastOwner.stat.SetNeedUpdate(); yield return (object)new WaitForSeconds(3f); if ((Object)(object)_lastOwner != (Object)null && _dashStats != null) { _lastOwner.stat.DetachValues(_dashStats); _lastOwner.stat.SetNeedUpdate(); _dashStats = null; } } } private void ClearStats() { if ((Object)(object)_lastOwner != (Object)null) { if (_extraStats != null) { try { _lastOwner.stat.DetachValues(_extraStats); } catch { } } if (_dashStats != null) { try { _lastOwner.stat.DetachValues(_dashStats); } catch { } } try { _lastOwner.stat.SetNeedUpdate(); } catch { } } _extraStats = null; _dashStats = null; } private void OnDestroy() { ClearStats(); Unsubscribe(); } } [Serializable] public sealed class CardLoversBehavior : MonoBehaviour { [SerializeField] private Item _item = null; private bool _isHooked = false; private Character _lastOwner = null; private Values _extraStats = null; private Values _buffStats = null; private bool _lastIsSuper = false; private bool _lastIsEnhanced = false; private void Awake() { if ((Object)(object)_item == (Object)null) { _item = ((Component)this).GetComponentInParent() ?? ((Component)this).GetComponent(); } } private void Update() { //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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 //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown if ((Object)(object)_item == (Object)null || (Object)(object)((Gear)_item).owner == (Object)null) { ClearStats(); Unsubscribe(); return; } if ((Object)(object)((Gear)_item).owner != (Object)(object)_lastOwner) { Unsubscribe(); _lastOwner = ((Gear)_item).owner; Subscribe(); } bool flag = ChzzkCardSynergy.IsCardSynergySuper(_item); bool flag2 = ChzzkCardSynergy.GetCardCount(_item) >= 6; if (_extraStats == null || flag != _lastIsSuper || flag2 != _lastIsEnhanced) { ClearStats(); _lastIsSuper = flag; _lastIsEnhanced = flag2; List list = new List(); if (!flag) { double num = (flag2 ? 0.2 : 0.1); list.Add(new Value(Category.PercentPoint, Kind.CriticalChance, num)); } else { list.Add(new Value(Category.PercentPoint, Kind.CriticalChance, -0.05)); } if (list.Count > 0) { _extraStats = new Values(list.ToArray()); ((Gear)_item).owner.stat.AttachValues(_extraStats); ((Gear)_item).owner.stat.SetNeedUpdate(); } } } private void Subscribe() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown if ((Object)(object)_lastOwner == (Object)null) { return; } try { ((PriorityList)(object)_lastOwner.onGiveDamage).Add(100, new GiveDamageDelegate(OnGiveDamage)); _isHooked = true; } catch { } } private void Unsubscribe() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown if ((Object)(object)_lastOwner == (Object)null || !_isHooked) { return; } try { ((PriorityList)(object)_lastOwner.onGiveDamage).Remove(new GiveDamageDelegate(OnGiveDamage)); _isHooked = false; } catch { } } private bool OnGiveDamage(ITarget target, ref Damage damage) { if ((Object)(object)_lastOwner == (Object)null) { return false; } if (_lastIsSuper) { if (damage.critical) { damage.critical = false; } double num = (_lastIsEnhanced ? 1.25 : 1.15); damage.multiplier *= num; } else if (damage.critical) { ((MonoBehaviour)this).StartCoroutine(C_LoversBuff()); } return false; } private IEnumerator C_LoversBuff() { if (!((Object)(object)_lastOwner == (Object)null) && _buffStats == null) { double val = (_lastIsEnhanced ? 0.25 : 0.15); _buffStats = new Values((Value[])(object)new Value[1] { new Value(Category.PercentPoint, Kind.MovementSpeed, val) }); _lastOwner.stat.AttachValues(_buffStats); _lastOwner.stat.SetNeedUpdate(); yield return (object)new WaitForSeconds(3f); if ((Object)(object)_lastOwner != (Object)null && _buffStats != null) { _lastOwner.stat.DetachValues(_buffStats); _lastOwner.stat.SetNeedUpdate(); _buffStats = null; } } } private void ClearStats() { if ((Object)(object)_lastOwner != (Object)null) { if (_extraStats != null) { try { _lastOwner.stat.DetachValues(_extraStats); } catch { } } if (_buffStats != null) { try { _lastOwner.stat.DetachValues(_buffStats); } catch { } } try { _lastOwner.stat.SetNeedUpdate(); } catch { } } _extraStats = null; _buffStats = null; } private void OnDestroy() { ClearStats(); Unsubscribe(); } } [Serializable] public sealed class CardChariotBehavior : MonoBehaviour { [SerializeField] private Item _item = null; private Character _lastOwner = null; private Values _extraStats = null; private Values _stillStats = null; private Vector3 _lastPos; private bool _isStill = false; private bool _lastIsSuper = false; private bool _lastIsEnhanced = false; private void Awake() { if ((Object)(object)_item == (Object)null) { _item = ((Component)this).GetComponentInParent() ?? ((Component)this).GetComponent(); } } private void Update() { //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_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Expected O, but got Unknown //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Expected O, but got Unknown //IL_01ea: 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_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_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Expected O, but got Unknown //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013e: 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 if ((Object)(object)_item == (Object)null || (Object)(object)((Gear)_item).owner == (Object)null) { ClearStats(); return; } if ((Object)(object)((Gear)_item).owner != (Object)(object)_lastOwner) { _lastOwner = ((Gear)_item).owner; _lastPos = ((Component)_lastOwner).transform.position; _isStill = false; ClearStats(); } bool flag = ChzzkCardSynergy.IsCardSynergySuper(_item); bool flag2 = ChzzkCardSynergy.GetCardCount(_item) >= 6; if (_extraStats == null || flag != _lastIsSuper || flag2 != _lastIsEnhanced) { ClearStats(); _lastIsSuper = flag; _lastIsEnhanced = flag2; List list = new List(); if (!flag) { double num = (flag2 ? 0.35 : 0.2); double num2 = (flag2 ? 0.25 : 0.15); list.Add(new Value(Category.PercentPoint, Kind.MovementSpeed, num)); list.Add(new Value(Category.PercentPoint, Kind.BasicAttackSpeed, num2)); } else { list.Add(new Value(Category.PercentPoint, Kind.MovementSpeed, -0.1)); } if (list.Count > 0) { _extraStats = new Values(list.ToArray()); ((Gear)_item).owner.stat.AttachValues(_extraStats); ((Gear)_item).owner.stat.SetNeedUpdate(); } } if (flag) { float num3 = Vector3.Distance(((Component)_lastOwner).transform.position, _lastPos); _lastPos = ((Component)_lastOwner).transform.position; bool flag3 = num3 < 0.01f; if (flag3 == _isStill) { return; } _isStill = flag3; if (_stillStats != null) { try { _lastOwner.stat.DetachValues(_stillStats); } catch { } _stillStats = null; } if (_isStill) { double num4 = (flag2 ? 0.8 : 0.5); _stillStats = new Values((Value[])(object)new Value[1] { new Value(Category.PercentPoint, Kind.BasicAttackSpeed, num4) }); _lastOwner.stat.AttachValues(_stillStats); _lastOwner.stat.SetNeedUpdate(); } return; } if (_stillStats != null) { try { _lastOwner.stat.DetachValues(_stillStats); } catch { } _stillStats = null; } _isStill = false; } private void ClearStats() { if ((Object)(object)_lastOwner != (Object)null) { if (_extraStats != null) { try { _lastOwner.stat.DetachValues(_extraStats); } catch { } } if (_stillStats != null) { try { _lastOwner.stat.DetachValues(_stillStats); } catch { } } try { _lastOwner.stat.SetNeedUpdate(); } catch { } } _extraStats = null; _stillStats = null; _isStill = false; } private void OnDestroy() { ClearStats(); } } [Serializable] public sealed class CardJusticeBehavior : MonoBehaviour { [SerializeField] private Item _item = null; private bool _isHooked = false; private Character _lastOwner = null; private bool _lastIsSuper = false; private bool _lastIsEnhanced = false; private Random _rnd = new Random(); private void Awake() { if ((Object)(object)_item == (Object)null) { _item = ((Component)this).GetComponentInParent() ?? ((Component)this).GetComponent(); } } private void Update() { if (!((Object)(object)_item == (Object)null)) { if ((Object)(object)((Gear)_item).owner != (Object)(object)_lastOwner) { Unsubscribe(); _lastOwner = ((Gear)_item).owner; Subscribe(); } bool lastIsSuper = ChzzkCardSynergy.IsCardSynergySuper(_item); bool lastIsEnhanced = ChzzkCardSynergy.GetCardCount(_item) >= 6; _lastIsSuper = lastIsSuper; _lastIsEnhanced = lastIsEnhanced; } } private void Subscribe() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown if ((Object)(object)_lastOwner == (Object)null) { return; } try { ((Health)_lastOwner.health).onTakeDamage.Add(-10, new TakeDamageDelegate(OnTakeDamage)); _isHooked = true; } catch { } } private void Unsubscribe() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown if ((Object)(object)_lastOwner == (Object)null || !_isHooked) { return; } try { ((Health)_lastOwner.health).onTakeDamage.Remove(new TakeDamageDelegate(OnTakeDamage)); _isHooked = false; } catch { } } private bool OnTakeDamage(ref Damage damage) { //IL_01ec: 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_00ee: 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) if ((Object)(object)_lastOwner == (Object)null || (Object)(object)damage.attacker.character == (Object)null) { return false; } if (_lastIsSuper) { double num = (_lastIsEnhanced ? 50.0 : 30.0); if ((double)_rnd.Next(100) < num) { double amount = ((Damage)(ref damage)).amount; damage.@null = true; damage.multiplier = 0.0; double num2 = amount * (_lastIsEnhanced ? 3.0 : 2.0); Character character = damage.attacker.character; if ((Object)(object)character != (Object)null && !((Health)character.health).dead) { Damage val = default(Damage); ((Damage)(ref val))..ctor(Attacker.op_Implicit(_lastOwner), num2, Vector2.op_Implicit(((Component)character).transform.position), (Attribute)2, (AttackType)4, (MotionType)0, 1.0, 0f, 0.0, 1.0, 1.0, true, false, 0.0, 0.0, (short)0, (PriorityList)null, 1.0); _lastOwner.Attack(character, ref val); } ChzzkCardSynergy.ShowFloatingText(PluginItems.IsKorean() ? "[??쐞移??뺤쓽] ?쇳빐 臾댄슚??諛?諛섏궗!" : "[Reversed Justice] Damage Negated & Reflected!"); } } else { double num3 = (_lastIsEnhanced ? 1.0 : 0.5); double num4 = ((Damage)(ref damage)).amount * num3; Character character2 = damage.attacker.character; if ((Object)(object)character2 != (Object)null && !((Health)character2.health).dead) { Damage val2 = default(Damage); ((Damage)(ref val2))..ctor(Attacker.op_Implicit(_lastOwner), num4, Vector2.op_Implicit(((Component)character2).transform.position), (Attribute)2, (AttackType)4, (MotionType)0, 1.0, 0f, 0.0, 1.0, 1.0, true, false, 0.0, 0.0, (short)0, (PriorityList)null, 1.0); _lastOwner.Attack(character2, ref val2); } } return false; } private void OnDestroy() { Unsubscribe(); } } [Serializable] public sealed class CardHermitBehavior : MonoBehaviour { } [Serializable] public sealed class CardWheelOfFortuneBehavior : MonoBehaviour { [SerializeField] private Item _item = null; private bool _isHooked = false; private Character _lastOwner = null; private bool _lastIsSuper = false; private bool _lastIsEnhanced = false; private Random _rnd = new Random(); private void Awake() { if ((Object)(object)_item == (Object)null) { _item = ((Component)this).GetComponentInParent() ?? ((Component)this).GetComponent(); } } private void Update() { if (!((Object)(object)_item == (Object)null)) { if ((Object)(object)((Gear)_item).owner != (Object)(object)_lastOwner) { Unsubscribe(); _lastOwner = ((Gear)_item).owner; Subscribe(); } bool lastIsSuper = ChzzkCardSynergy.IsCardSynergySuper(_item); bool lastIsEnhanced = ChzzkCardSynergy.GetCardCount(_item) >= 6; _lastIsSuper = lastIsSuper; _lastIsEnhanced = lastIsEnhanced; } } private void Subscribe() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown if ((Object)(object)_lastOwner == (Object)null) { return; } try { ((PriorityList)(object)_lastOwner.onGiveDamage).Add(200, new GiveDamageDelegate(OnGiveDamage)); _isHooked = true; } catch { } } private void Unsubscribe() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown if ((Object)(object)_lastOwner == (Object)null || !_isHooked) { return; } try { ((PriorityList)(object)_lastOwner.onGiveDamage).Remove(new GiveDamageDelegate(OnGiveDamage)); _isHooked = false; } catch { } } private bool OnGiveDamage(ITarget target, ref Damage damage) { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Invalid comparison between Unknown and I4 //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_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 ((Object)(object)_lastOwner == (Object)null || target == null || (Object)(object)target.character == (Object)null || (Object)(object)target.character.health == (Object)null || ((Health)target.character.health).dead) { return false; } if (_lastIsSuper) { double num = (_lastIsEnhanced ? 2.0 : 1.0); if (_rnd.NextDouble() * 100.0 < num) { if ((int)target.character.type == 3 || (int)target.character.type == 2 || (int)target.character.type == 1) { double num2 = (_lastIsEnhanced ? 1000.0 : 500.0); Damage val = default(Damage); ((Damage)(ref val))..ctor(Attacker.op_Implicit(_lastOwner), num2, Vector2.op_Implicit(target.transform.position), (Attribute)2, (AttackType)4, (MotionType)0, 1.0, 0f, 0.0, 1.0, 1.0, true, false, 0.0, 0.0, (short)0, (PriorityList)null, 1.0); _lastOwner.Attack(target, ref val); ChzzkCardSynergy.ShowFloatingText(PluginItems.IsKorean() ? "[??쐞移??대챸???섎젅諛뷀\u0080? 蹂댁뒪 異붽? 怨좎젙 ?쇳빐!" : "[Reversed Wheel] Extra Fixed Damage to Boss!"); } else { double num3 = ((Health)target.character.health).currentHealth + 999.0; Damage val2 = default(Damage); ((Damage)(ref val2))..ctor(Attacker.op_Implicit(_lastOwner), num3, Vector2.op_Implicit(target.transform.position), (Attribute)2, (AttackType)4, (MotionType)0, 1.0, 0f, 0.0, 1.0, 1.0, true, false, 0.0, 0.0, (short)0, (PriorityList)null, 1.0); _lastOwner.Attack(target, ref val2); ChzzkCardSynergy.ShowFloatingText(PluginItems.IsKorean() ? "[??쐞移??대챸???섎젅諛뷀\u0080? 利됱궗!" : "[Reversed Wheel] Instant Kill!"); } } } else { double num4 = (_lastIsEnhanced ? 10.0 : 5.0); if (_rnd.NextDouble() * 100.0 < num4) { double num5 = (_lastIsEnhanced ? 2.5 : 2.0); damage.multiplier *= num5; ChzzkCardSynergy.ShowFloatingText(PluginItems.IsKorean() ? "[?대챸???섎젅諛뷀\u0080? ?쇳빐??利앺룺!" : "[Wheel of Fortune] Damage Amplified!"); } } return false; } private void OnDestroy() { Unsubscribe(); } } [Serializable] public sealed class CardStrengthBehavior : MonoBehaviour { [SerializeField] private Item _item = null; private Values _strengthStats = null; private double _lastBonus = -1.0; private bool _lastIsSuper = false; private bool _lastIsEnhanced = false; private void Awake() { if ((Object)(object)_item == (Object)null) { _item = ((Component)this).GetComponentInParent() ?? ((Component)this).GetComponent(); } } private void Update() { //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Expected O, but got Unknown //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Expected O, but got Unknown //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Expected O, but got Unknown //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Expected O, but got Unknown //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown if ((Object)(object)_item == (Object)null || (Object)(object)((Gear)_item).owner == (Object)null || (Object)(object)((Gear)_item).owner.health == (Object)null || ((Health)((Gear)_item).owner.health).dead) { ClearStats(); return; } bool flag = ChzzkCardSynergy.IsCardSynergySuper(_item); bool flag2 = ChzzkCardSynergy.GetCardCount(_item) >= 6; if (!flag) { double num = 1.0 - ((Health)((Gear)_item).owner.health).percent; double num2 = (flag2 ? 0.4 : 0.25); double num3 = (flag2 ? 1.0 : 0.5); double num4 = num2 + num * num3; if (Math.Abs(num4 - _lastBonus) > 0.005 || _strengthStats == null || _lastIsSuper != flag || _lastIsEnhanced != flag2) { ClearStats(); _lastBonus = num4; _lastIsSuper = flag; _lastIsEnhanced = flag2; _strengthStats = new Values((Value[])(object)new Value[1] { new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, num4) }); ((Gear)_item).owner.stat.AttachValues(_strengthStats); ((Gear)_item).owner.stat.SetNeedUpdate(); } return; } double percent = ((Health)((Gear)_item).owner.health).percent; double num5 = -0.1; double num6 = (flag2 ? 0.85 : 0.5); double num7 = ((percent >= 0.9) ? (num5 + num6) : num5); if (Math.Abs(num7 - _lastBonus) > 0.005 || _strengthStats == null || _lastIsSuper != flag || _lastIsEnhanced != flag2) { ClearStats(); _lastBonus = num7; _lastIsSuper = flag; _lastIsEnhanced = flag2; _strengthStats = new Values((Value[])(object)new Value[2] { new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, num7), new Value(Category.PercentPoint, Kind.MagicAttackDamage, num7) }); ((Gear)_item).owner.stat.AttachValues(_strengthStats); ((Gear)_item).owner.stat.SetNeedUpdate(); } } private void ClearStats() { if (_strengthStats != null && (Object)(object)_item != (Object)null && (Object)(object)((Gear)_item).owner != (Object)null) { try { ((Gear)_item).owner.stat.DetachValues(_strengthStats); ((Gear)_item).owner.stat.SetNeedUpdate(); } catch { } } _strengthStats = null; _lastBonus = -1.0; } private void OnDestroy() { ClearStats(); } } public sealed class CardMoonBehavior : MonoBehaviour { [SerializeField] private Item _item = null; private bool _isHooked = false; private Character _lastOwner = null; private Values _extraStats = null; private bool _lastIsSuper = false; private bool _lastIsEnhanced = false; private Random _rnd = new Random(); private void Awake() { if ((Object)(object)_item == (Object)null) { _item = ((Component)this).GetComponentInParent() ?? ((Component)this).GetComponent(); } } private void Update() { //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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 //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown if ((Object)(object)_item == (Object)null || (Object)(object)((Gear)_item).owner == (Object)null) { ClearStats(); Unsubscribe(); return; } if ((Object)(object)((Gear)_item).owner != (Object)(object)_lastOwner) { Unsubscribe(); _lastOwner = ((Gear)_item).owner; Subscribe(); } bool flag = ChzzkCardSynergy.IsCardSynergySuper(_item); bool flag2 = ChzzkCardSynergy.GetCardCount(_item) >= 6; if (_extraStats == null || flag != _lastIsSuper || flag2 != _lastIsEnhanced) { ClearStats(); _lastIsSuper = flag; _lastIsEnhanced = flag2; List list = new List(); if (!flag) { double num = (flag2 ? 0.5 : 0.3); list.Add(new Value(Category.PercentPoint, Kind.MagicAttackDamage, num)); } else { list.Add(new Value(Category.PercentPoint, Kind.MagicAttackDamage, -0.1)); } if (list.Count > 0) { _extraStats = new Values(list.ToArray()); ((Gear)_item).owner.stat.AttachValues(_extraStats); ((Gear)_item).owner.stat.SetNeedUpdate(); } } } private void Subscribe() { if ((Object)(object)_lastOwner == (Object)null) { return; } try { _lastOwner.onStartAction += OnStartAction; _isHooked = true; } catch { } } private void Unsubscribe() { if ((Object)(object)_lastOwner == (Object)null || !_isHooked) { return; } try { _lastOwner.onStartAction -= OnStartAction; _isHooked = false; } catch { } } private void OnStartAction(Action action) { //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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Invalid comparison between Unknown and I4 //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Invalid comparison between Unknown and I4 //IL_0123: 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) if ((Object)(object)_lastOwner == (Object)null || !_lastIsSuper) { return; } double num = (_lastIsEnhanced ? 25.0 : 15.0); if (!(_rnd.NextDouble() * 100.0 < num)) { return; } Collider2D[] array = Physics2D.OverlapCircleAll(Vector2.op_Implicit(((Component)_lastOwner).transform.position), 6f); bool flag = false; double num2 = (_lastIsEnhanced ? 60.0 : 30.0); Collider2D[] array2 = array; Damage val2 = default(Damage); foreach (Collider2D val in array2) { if (!((Object)(object)val == (Object)null)) { Character componentInParent = ((Component)val).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && (int)componentInParent.type != 6 && (int)componentInParent.type != 7 && (Object)(object)componentInParent.health != (Object)null && !((Health)componentInParent.health).dead) { ((Damage)(ref val2))..ctor(Attacker.op_Implicit(_lastOwner), num2, Vector2.op_Implicit(((Component)componentInParent).transform.position), (Attribute)2, (AttackType)4, (MotionType)0, 1.0, 0f, 0.0, 1.0, 1.0, true, false, 0.0, 0.0, (short)0, (PriorityList)null, 1.0); _lastOwner.Attack(componentInParent, ref val2); flag = true; } } } if (flag) { ChzzkCardSynergy.ShowFloatingText(PluginItems.IsKorean() ? "[??쐞移??? ?щ튆 ??컻!" : "[Reversed Moon] Moonlight Blast!"); } } private void ClearStats() { if ((Object)(object)_lastOwner != (Object)null && _extraStats != null) { try { _lastOwner.stat.DetachValues(_extraStats); _lastOwner.stat.SetNeedUpdate(); } catch { } } _extraStats = null; } private void OnDestroy() { ClearStats(); Unsubscribe(); } } public sealed class CardSunBehavior : MonoBehaviour { [SerializeField] private Item _item = null; private bool _isHooked = false; private Character _lastOwner = null; private Values _extraStats = null; private bool _lastIsSuper = false; private bool _lastIsEnhanced = false; private Random _rnd = new Random(); private bool _isApplyingDamage = false; private void Awake() { if ((Object)(object)_item == (Object)null) { _item = ((Component)this).GetComponentInParent() ?? ((Component)this).GetComponent(); } } private void Update() { //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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 //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown if ((Object)(object)_item == (Object)null || (Object)(object)((Gear)_item).owner == (Object)null) { ClearStats(); Unsubscribe(); return; } if ((Object)(object)((Gear)_item).owner != (Object)(object)_lastOwner) { Unsubscribe(); _lastOwner = ((Gear)_item).owner; Subscribe(); } bool flag = ChzzkCardSynergy.IsCardSynergySuper(_item); bool flag2 = ChzzkCardSynergy.GetCardCount(_item) >= 6; if (_extraStats == null || flag != _lastIsSuper || flag2 != _lastIsEnhanced) { ClearStats(); _lastIsSuper = flag; _lastIsEnhanced = flag2; List list = new List(); if (!flag) { double num = (flag2 ? 0.5 : 0.3); list.Add(new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, num)); } else { list.Add(new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, -0.1)); } if (list.Count > 0) { _extraStats = new Values(list.ToArray()); ((Gear)_item).owner.stat.AttachValues(_extraStats); ((Gear)_item).owner.stat.SetNeedUpdate(); } } } private void Subscribe() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown if ((Object)(object)_lastOwner == (Object)null) { return; } try { ((PriorityList)(object)_lastOwner.onGiveDamage).Add(150, new GiveDamageDelegate(OnGiveDamage)); _isHooked = true; } catch { } } private void Unsubscribe() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown if ((Object)(object)_lastOwner == (Object)null || !_isHooked) { return; } try { ((PriorityList)(object)_lastOwner.onGiveDamage).Remove(new GiveDamageDelegate(OnGiveDamage)); _isHooked = false; } catch { } } private bool OnGiveDamage(ITarget target, ref Damage damage) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Invalid comparison between Unknown and I4 //IL_00ed: 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) if (_isApplyingDamage) { return false; } if ((Object)(object)_lastOwner == (Object)null || !_lastIsSuper || target == null || (Object)(object)target.character == (Object)null || (Object)(object)target.character.health == (Object)null || ((Health)target.character.health).dead) { return false; } if ((int)damage.attackType == 4) { return false; } double num = (_lastIsEnhanced ? 25.0 : 15.0); if (_rnd.NextDouble() * 100.0 < num) { double num2 = (_lastIsEnhanced ? 60.0 : 30.0); Character character = target.character; Damage val = default(Damage); ((Damage)(ref val))..ctor(Attacker.op_Implicit(_lastOwner), num2, Vector2.op_Implicit(((Component)character).transform.position), (Attribute)2, (AttackType)4, (MotionType)0, 1.0, 0f, 0.0, 1.0, 1.0, true, false, 0.0, 0.0, (short)0, (PriorityList)null, 1.0); _isApplyingDamage = true; try { _lastOwner.Attack(character, ref val); } finally { _isApplyingDamage = false; } ChzzkCardSynergy.ShowFloatingText(PluginItems.IsKorean() ? "[역위치 태양] 태양 화염 폭발!" : "[Reversed Sun] Solar Flare!"); } return false; } private void ClearStats() { if ((Object)(object)_lastOwner != (Object)null && _extraStats != null) { try { _lastOwner.stat.DetachValues(_extraStats); _lastOwner.stat.SetNeedUpdate(); } catch { } } _extraStats = null; } private void OnDestroy() { ClearStats(); Unsubscribe(); } } public sealed class CardSupernovaBehavior : MonoBehaviour { [SerializeField] private Item _item = null; private bool _isHooked = false; private Character _lastOwner = null; private Values _extraStats = null; private bool _lastIsSuper = false; private bool _lastIsEnhanced = false; private float _swapCooldownTimer = 0f; private static Item _doomsdayPrefab; private static bool _loadingDoomsday; private void Awake() { if ((Object)(object)_item == (Object)null) { _item = ((Component)this).GetComponentInParent() ?? ((Component)this).GetComponent(); } } private void Start() { if ((Object)(object)_doomsdayPrefab == (Object)null && !_loadingDoomsday) { ((MonoBehaviour)this).StartCoroutine(C_LoadDoomsdayTemplate()); } } private IEnumerator C_LoadDoomsdayTemplate() { _loadingDoomsday = true; while ((Object)(object)GearResource.instance == (Object)null) { yield return null; } ItemReference itemRef = null; if (GearResource.instance.TryGetItemReferenceByName("Doomsday", ref itemRef)) { ItemRequest req = itemRef.LoadAsync(); while (!((Request)(object)req).isDone) { yield return null; } if ((Object)(object)((Request)(object)req).asset != (Object)null) { _doomsdayPrefab = ((Request)(object)req).asset; Debug.Log((object)"[CardSupernova] Cached Doomsday prefab successfully."); } } _loadingDoomsday = false; } private void TriggerApocalypse() { if ((Object)(object)_lastOwner == (Object)null) { return; } if ((Object)(object)_doomsdayPrefab == (Object)null) { Debug.LogWarning((object)"[CardSupernova] TriggerApocalypse: Doomsday prefab not loaded yet, starting load..."); if (!_loadingDoomsday) { ((MonoBehaviour)this).StartCoroutine(C_LoadDoomsdayTemplate()); } return; } try { Item val = Object.Instantiate(_doomsdayPrefab); if ((Object)(object)val == (Object)null) { Debug.LogError((object)"[CardSupernova] TriggerApocalypse: Failed to instantiate Doomsday prefab."); return; } GameObject gameObject = ((Component)val).gameObject; DroppedGear component = gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = false; } SpriteRenderer[] componentsInChildren = gameObject.GetComponentsInChildren(true); SpriteRenderer[] array = componentsInChildren; foreach (SpriteRenderer val2 in array) { ((Renderer)val2).enabled = false; } Collider2D[] componentsInChildren2 = gameObject.GetComponentsInChildren(true); Collider2D[] array2 = componentsInChildren2; foreach (Collider2D val3 in array2) { ((Behaviour)val3).enabled = false; } DoomsdayComponent val4 = null; AbilityComponent[] componentsInChildren3 = gameObject.GetComponentsInChildren(true); AbilityComponent[] array3 = componentsInChildren3; foreach (AbilityComponent val5 in array3) { if ((Object)(object)val5 != (Object)null && ((object)val5).GetType().Name.Contains("DoomsdayComponent")) { val4 = (DoomsdayComponent)(object)((val5 is DoomsdayComponent) ? val5 : null); break; } } if ((Object)(object)val4 == (Object)null) { Debug.LogError((object)"[CardSupernova] TriggerApocalypse: DoomsdayComponent not found in instantiated prefab."); Object.Destroy((Object)(object)gameObject); return; } gameObject.SetActive(true); Transform val6 = ((Component)val4).transform; while ((Object)(object)val6 != (Object)null) { ((Component)val6).gameObject.SetActive(true); if ((Object)(object)val6 == (Object)(object)gameObject.transform) { break; } val6 = val6.parent; } FieldInfo field = ((object)val4).GetType().GetField("_ability", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { Debug.LogError((object)"[CardSupernova] TriggerApocalypse: _ability field not found on DoomsdayComponent."); Object.Destroy((Object)(object)gameObject); return; } object? value = field.GetValue(val4); Doomsday val7 = (Doomsday)((value is Doomsday) ? value : null); if (val7 == null) { Debug.LogError((object)"[CardSupernova] TriggerApocalypse: _ability value is null."); Object.Destroy((Object)(object)gameObject); return; } FieldInfo field2 = typeof(Doomsday).GetField("_item", BindingFlags.Instance | BindingFlags.NonPublic); if (field2 != null) { field2.SetValue(val7, _item); } val7.component = val4; ((Ability)val7).Initialize(); MonoBehaviour[] componentsInChildren4 = gameObject.GetComponentsInChildren(true); foreach (MonoBehaviour val8 in componentsInChildren4) { if ((Object)(object)val8 == (Object)null) { continue; } FieldInfo[] fields = ((object)val8).GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo[] array4 = fields; foreach (FieldInfo fieldInfo in array4) { if (typeof(IAttackDamage).IsAssignableFrom(fieldInfo.FieldType)) { try { fieldInfo.SetValue(val8, val4); } catch (Exception ex) { Debug.LogWarning((object)("[CardSupernova] Failed to inject IAttackDamage into " + ((object)val8).GetType().Name + "." + fieldInfo.Name + ": " + ex.Message)); } } } } _lastOwner.ability.Add((IAbility)(object)val7); Debug.Log((object)"[CardSupernova] TriggerApocalypse: Successfully added Doomsday ability to player."); float duration = 11f; Type type = typeof(Doomsday); while (type != null) { FieldInfo field3 = type.GetField("_duration", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.NonPublic); if (field3 != null) { try { duration = (float)field3.GetValue(val7); } catch { } break; } type = type.BaseType; } ((MonoBehaviour)this).StartCoroutine(C_RunApocalypseTimer(_lastOwner, val7, gameObject, duration)); } catch (Exception ex2) { Debug.LogError((object)("[CardSupernova] TriggerApocalypse exception: " + ex2)); } } private IEnumerator C_RunApocalypseTimer(Character target, Doomsday ability, GameObject instanceObj, float duration) { yield return (object)new WaitForSeconds(duration); if ((Object)(object)target != (Object)null && ability != null) { try { target.ability.Remove((IAbility)(object)ability); Debug.Log((object)"[CardSupernova] Apocalypse ability removed - explosion should fire now."); } catch (Exception ex) { Debug.LogError((object)("[CardSupernova] Failed to remove Doomsday ability: " + ex)); } } if ((Object)(object)instanceObj != (Object)null) { yield return (object)new WaitForSeconds(3f); try { Object.Destroy((Object)(object)instanceObj); } catch { } } } private void Update() { //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Expected O, but got Unknown //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Expected O, but got Unknown //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Expected O, but got Unknown if ((Object)(object)_item == (Object)null || (Object)(object)((Gear)_item).owner == (Object)null) { ClearStats(); Unsubscribe(); return; } if ((Object)(object)((Gear)_item).owner != (Object)(object)_lastOwner) { Unsubscribe(); _lastOwner = ((Gear)_item).owner; Subscribe(); } bool flag = ChzzkCardSynergy.IsCardSynergySuper(_item); bool flag2 = ChzzkCardSynergy.GetCardCount(_item) >= 6; if (_extraStats == null || flag != _lastIsSuper || flag2 != _lastIsEnhanced) { ClearStats(); _lastIsSuper = flag; _lastIsEnhanced = flag2; List list = new List(); if (!flag) { double num = (flag2 ? 1.3 : 0.8); list.Add(new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, num)); list.Add(new Value(Category.PercentPoint, Kind.MagicAttackDamage, num)); } else { list.Add(new Value(Category.PercentPoint, Kind.PhysicalAttackDamage, -0.2)); list.Add(new Value(Category.PercentPoint, Kind.MagicAttackDamage, -0.2)); } if (list.Count > 0) { _extraStats = new Values(list.ToArray()); ((Gear)_item).owner.stat.AttachValues(_extraStats); ((Gear)_item).owner.stat.SetNeedUpdate(); } } if (_swapCooldownTimer > 0f) { _swapCooldownTimer -= Time.deltaTime; } } private void Subscribe() { if ((Object)(object)_lastOwner == (Object)null) { return; } try { _lastOwner.playerComponents.inventory.weapon.onSwap += OnSwap; _isHooked = true; } catch { } } private void Unsubscribe() { if ((Object)(object)_lastOwner == (Object)null || !_isHooked) { return; } try { _lastOwner.playerComponents.inventory.weapon.onSwap -= OnSwap; _isHooked = false; } catch { } } private void OnSwap() { if (!((Object)(object)_lastOwner == (Object)null) && !(_swapCooldownTimer > 0f)) { _swapCooldownTimer = 5f; TriggerSupernova(_lastIsSuper); TriggerApocalypse(); } } private void TriggerSupernova(bool reversed) { //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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Invalid comparison between Unknown and I4 //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_00f3: 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) double num = 150.0; num = ((!reversed) ? (_lastIsEnhanced ? 300.0 : 150.0) : (_lastIsEnhanced ? 500.0 : 250.0)); Collider2D[] array = Physics2D.OverlapCircleAll(Vector2.op_Implicit(((Component)_lastOwner).transform.position), 15f); bool flag = false; Collider2D[] array2 = array; Damage val2 = default(Damage); foreach (Collider2D val in array2) { if (!((Object)(object)val == (Object)null)) { Character componentInParent = ((Component)val).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && (int)componentInParent.type != 6 && (int)componentInParent.type != 7 && (Object)(object)componentInParent.health != (Object)null && !((Health)componentInParent.health).dead) { ((Damage)(ref val2))..ctor(Attacker.op_Implicit(_lastOwner), num, Vector2.op_Implicit(((Component)componentInParent).transform.position), (Attribute)2, (AttackType)4, (MotionType)0, 1.0, 0f, 0.0, 1.0, 1.0, true, false, 0.0, 0.0, (short)0, (PriorityList)null, 1.0); _lastOwner.Attack(componentInParent, ref val2); flag = true; } } } if (flag) { if (reversed) { ChzzkCardSynergy.ShowFloatingText(PluginItems.IsKorean() ? "[??쐞移?珥덉떊?? ?뚭눼?곸씤 珥덉떊???\u0080??컻!" : "[Reversed Supernova] Destructive Supernova Blast!"); } else { ChzzkCardSynergy.ShowFloatingText(PluginItems.IsKorean() ? "[珥덉떊?? 珥덉떊????컻!" : "[Supernova] Supernova Blast!"); } } } private void ClearStats() { if ((Object)(object)_lastOwner != (Object)null && _extraStats != null) { try { _lastOwner.stat.DetachValues(_extraStats); _lastOwner.stat.SetNeedUpdate(); } catch { } } _extraStats = null; } private void OnDestroy() { ClearStats(); Unsubscribe(); } } [Serializable] public sealed class QuantumSwordBehavior : MonoBehaviour { [SerializeField] private Item _item = null; private bool _isHooked = false; private Character _lastOwner = null; private static EffectInfo _globalEffect; private EffectInfo _cachedEffect = null; private static SoundInfo _globalSound; private SoundInfo _cachedSound = null; private void Awake() { if ((Object)(object)_item == (Object)null) { _item = ((Component)this).GetComponentInParent() ?? ((Component)this).GetComponent(); } } private void Update() { if (!((Object)(object)_item == (Object)null) && (Object)(object)((Gear)_item).owner != (Object)(object)_lastOwner) { Unsubscribe(); _lastOwner = ((Gear)_item).owner; Subscribe(); } } private void Subscribe() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown if ((Object)(object)_lastOwner == (Object)null) { return; } try { Character lastOwner = _lastOwner; lastOwner.onGaveDamage = (GaveDamageDelegate)Delegate.Combine((Delegate?)(object)lastOwner.onGaveDamage, (Delegate?)new GaveDamageDelegate(OnGaveDamage)); _isHooked = true; } catch { } } private void Unsubscribe() { //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 if ((Object)(object)_lastOwner == (Object)null || !_isHooked) { return; } try { Character lastOwner = _lastOwner; lastOwner.onGaveDamage = (GaveDamageDelegate)Delegate.Remove((Delegate?)(object)lastOwner.onGaveDamage, (Delegate?)new GaveDamageDelegate(OnGaveDamage)); _isHooked = false; } catch { } } public void SetEffectInfo(EffectInfo effectInfo) { _cachedEffect = effectInfo; if (effectInfo != null) { _globalEffect = effectInfo; } } public void SetSoundInfo(SoundInfo soundInfo) { _cachedSound = soundInfo; if (soundInfo != null) { _globalSound = soundInfo; } } private EffectInfo FindEffectInfo() { if (_cachedEffect != null) { return _cachedEffect; } if (_globalEffect != null) { _cachedEffect = _globalEffect; return _cachedEffect; } if ((Object)(object)_item == (Object)null) { return null; } _cachedEffect = CustomSpriteHelper.FindEffectInfo(((Component)_item).gameObject); if (_cachedEffect != null) { _globalEffect = _cachedEffect; } return _cachedEffect; } private SoundInfo FindSoundInfo() { if (_cachedSound != null) { return _cachedSound; } if (_globalSound != null) { _cachedSound = _globalSound; return _cachedSound; } if ((Object)(object)_item == (Object)null) { return null; } _cachedSound = CustomSpriteHelper.FindSoundInfo(((Component)_item).gameObject); if (_cachedSound != null) { _globalSound = _cachedSound; } return _cachedSound; } private void OnGaveDamage(ITarget target, in Damage originalDamage, in Damage gaveDamage, double damageDealt) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Invalid comparison between Unknown and I4 //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_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_0118: 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_01d9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_lastOwner == (Object)null || target == null || (Object)(object)target.character == (Object)null || ((Health)target.character.health).dead || (int)gaveDamage.attackType == 4 || gaveDamage.critical) { return; } try { double final = _lastOwner.stat.GetFinal(Kind.CriticalChance); double num = 1.0 - final; if (num < 0.0) { num = 0.0; } if (num > 1.0) { num = 1.0; } if (!(Random.value < (float)num)) { return; } Damage val = gaveDamage; double num2 = ((Damage)(ref val)).amount * 0.5; if (num2 > 0.1) { Damage val2 = default(Damage); ((Damage)(ref val2))..ctor(Attacker.op_Implicit(_lastOwner), num2, Vector2.op_Implicit(((Component)target.character).transform.position), (Attribute)1, (AttackType)4, (MotionType)0, 1.0, 0f, 0.0, 1.0, 1.0, true, false, 0.0, 0.0, (short)0, (PriorityList)null, 1.0); _lastOwner.Attack(target, ref val2); EffectInfo val3 = FindEffectInfo(); if (val3 != null) { val3.Spawn(((Component)target.character).transform.position, 0f, 1f); } SoundInfo val4 = FindSoundInfo(); if (val4 != null) { PersistentSingleton.Instance.PlaySound(val4, ((Component)target.character).transform.position); } } } catch { } } private void OnDestroy() { Unsubscribe(); } } [Serializable] public sealed class IdolOfTheOtherworldBehavior : MonoBehaviour { private struct SurfaceRange { public float minX; public float maxX; public float y; } public static readonly List ActiveSpikes = new List(); [SerializeField] private Item _item = null; private bool _isHooked = false; private Character _lastOwner = null; private bool _isDestroying = false; private SoundInfo _cachedSound = null; private SummonOperationRunnersOnGround _summonComponent = null; public static void ClearActiveSpikes() { if (ActiveSpikes == null) { return; } for (int num = ActiveSpikes.Count - 1; num >= 0; num--) { GameObject val = ActiveSpikes[num]; if ((Object)(object)val != (Object)null) { try { Object.Destroy((Object)(object)val); } catch { } } } ActiveSpikes.Clear(); } private SummonOperationRunnersOnGround GetSummonComponent() { if ((Object)(object)_summonComponent != (Object)null) { return _summonComponent; } if ((Object)(object)_item == (Object)null) { _item = ((Component)this).GetComponentInParent() ?? ((Component)this).GetComponent(); } if ((Object)(object)_item != (Object)null) { _summonComponent = ((Component)_item).GetComponentInChildren(true); } if ((Object)(object)_summonComponent == (Object)null) { _summonComponent = ((Component)this).GetComponentInChildren(true); } return _summonComponent; } public void Initialize(SummonOperationRunnersOnGround summonComponent) { _summonComponent = summonComponent; } private void Awake() { if ((Object)(object)_item == (Object)null) { _item = ((Component)this).GetComponentInParent() ?? ((Component)this).GetComponent(); } GetSummonComponent(); } private void Update() { if (!((Object)(object)_item == (Object)null) && !((Object)(object)((Component)_item).gameObject == (Object)null)) { if ((Object)(object)((Gear)_item).owner == (Object)null) { Unsubscribe(); } else if ((Object)(object)((Gear)_item).owner != (Object)(object)_lastOwner) { Unsubscribe(); _lastOwner = ((Gear)_item).owner; Subscribe(); } } } private void Subscribe() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_lastOwner == (Object)null) { return; } try { if ((Object)(object)_item != (Object)null) { ((Component)_item).transform.SetParent(((Component)_lastOwner).transform); ((Component)_item).transform.localPosition = Vector3.zero; ((Component)_item).gameObject.SetActive(true); SummonOperationRunnersOnGround summonComponent = GetSummonComponent(); if ((Object)(object)summonComponent != (Object)null) { ((Component)summonComponent).gameObject.SetActive(true); object? value = typeof(SummonOperationRunnersOnGround).GetField("_terrainFindingRange", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(summonComponent); BoxCollider2D val = (BoxCollider2D)((value is BoxCollider2D) ? value : null); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(true); } } } _lastOwner.playerComponents.inventory.weapon.onSwap += OnSwap; _isHooked = true; Debug.Log((object)"[IdolOfTheOtherworldBehavior] Subscribed to onSwap successfully."); } catch (Exception ex) { Debug.LogError((object)("[IdolOfTheOtherworldBehavior] Error in Subscribe: " + ex)); } } private void Unsubscribe() { if ((Object)(object)_lastOwner == (Object)null || !_isHooked) { return; } try { _lastOwner.playerComponents.inventory.weapon.onSwap -= OnSwap; _isHooked = false; if (!_isDestroying && (Object)(object)_item != (Object)null && (Object)(object)((Component)_item).gameObject != (Object)null) { try { if (((Component)_item).gameObject.activeInHierarchy && (Object)(object)((Component)_item).transform.parent != (Object)null) { ((Component)_item).transform.SetParent((Transform)null); } ((Component)_item).gameObject.SetActive(false); } catch { } } Debug.Log((object)"[IdolOfTheOtherworldBehavior] Unsubscribed from onSwap successfully."); } catch { } } public void SetSoundInfo(SoundInfo soundInfo) { _cachedSound = soundInfo; } private SoundInfo FindSoundInfo() { if (_cachedSound != null) { return _cachedSound; } if ((Object)(object)_item == (Object)null) { return null; } _cachedSound = CustomSpriteHelper.FindSoundInfo(((Component)_item).gameObject); return _cachedSound; } private List FindSurfacesDirectly(Character owner) { //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_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_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_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_0175: 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_017a: 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_01a8: 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_01e6: 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_020f: 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_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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //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_015c: 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_0267: 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_027e: 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_02bd: 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_02d6: 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_030e: Unknown result type (might be due to invalid IL or missing references) List list = new List(); SummonOperationRunnersOnGround summonComponent = GetSummonComponent(); if ((Object)(object)summonComponent == (Object)null) { Debug.LogError((object)"[IdolOfTheOtherworldBehavior] FindSurfacesDirectly: summon is null!"); return list; } try { FieldInfo field = typeof(SummonOperationRunnersOnGround).GetField("_terrainFindingRange", BindingFlags.Instance | BindingFlags.NonPublic); object? value = field.GetValue(summonComponent); BoxCollider2D val = (BoxCollider2D)((value is BoxCollider2D) ? value : null); if ((Object)(object)val == (Object)null) { Debug.LogError((object)"[IdolOfTheOtherworldBehavior] FindSurfacesDirectly: rangeCol is null!"); return list; } FieldInfo field2 = typeof(SummonOperationRunnersOnGround).GetField("_includePlatform", BindingFlags.Instance | BindingFlags.NonPublic); bool flag = !(field2 != null) || (bool)field2.GetValue(summonComponent); Vector2 offset = ((Collider2D)val).offset; Transform transform = ((Component)val).transform; Vector3 position = transform.position; if (transform.position == Vector3.zero || !((Component)transform).gameObject.activeInHierarchy) { Vector3 val2 = Vector3.zero; Transform val3 = transform; while ((Object)(object)val3 != (Object)null && (Object)(object)val3 != (Object)(object)((Component)_item).transform) { val2 += val3.localPosition; val3 = val3.parent; } position = ((Component)owner).transform.position + val2 + Vector2.op_Implicit(offset); } else { position = transform.position + Vector2.op_Implicit(offset); } Vector2 size = val.size; size.x *= 3f; size.y *= 2f; float z = ((Component)val).transform.eulerAngles.z; int num = 262144; if (flag) { num |= 0x20000; } Debug.Log((object)$"[IdolOfTheOtherworldBehavior] FindSurfacesDirectly: worldCenter={position}, size={size}, angle={z}, layerMask={num}"); Collider2D[] array = Physics2D.OverlapBoxAll(Vector2.op_Implicit(position), size, z, num); if (array == null || array.Length == 0) { Debug.LogWarning((object)"[IdolOfTheOtherworldBehavior] OverlapBoxAll found no hits on layers."); return list; } Debug.Log((object)$"[IdolOfTheOtherworldBehavior] OverlapBoxAll found {array.Length} hits"); float num2 = position.x - size.x / 2f; float num3 = position.x + size.x / 2f; Collider2D[] array2 = array; foreach (Collider2D val4 in array2) { if (!((Object)(object)val4 == (Object)null)) { Bounds bounds = val4.bounds; float num4 = Mathf.Max(((Bounds)(ref bounds)).min.x, num2); float num5 = Mathf.Min(((Bounds)(ref bounds)).max.x, num3); float y = ((Bounds)(ref bounds)).max.y; Debug.Log((object)$"[IdolOfTheOtherworldBehavior] Ground hit: {((Object)val4).name}, bounds={bounds}, surface range minX={num4}, maxX={num5}, y={y}"); list.Add(new SurfaceRange { minX = num4, maxX = num5, y = y }); } } } catch (Exception ex) { Debug.LogError((object)("[IdolOfTheOtherworldBehavior] Error in FindSurfacesDirectly: " + ex)); } return list; } private void SpawnSpikeDirectly(Character owner, Vector3 position) { //IL_0061: 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_024d: 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_027d: 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_02e5: 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_0308: Unknown result type (might be due to invalid IL or missing references) SummonOperationRunnersOnGround summonComponent = GetSummonComponent(); if ((Object)(object)summonComponent == (Object)null) { return; } try { FieldInfo field = typeof(SummonOperationRunnersOnGround).GetField("_operationRunner", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); object? value = field.GetValue(summonComponent); OperationRunner val = (OperationRunner)((value is OperationRunner) ? value : null); if ((Object)(object)val == (Object)null) { Debug.LogError((object)"[IdolOfTheOtherworldBehavior] SpawnSpikeDirectly: runnerPrefab is null!"); return; } Debug.Log((object)$"[IdolOfTheOtherworldBehavior] Spawning spike directly at {position}"); OperationRunner val2 = Object.Instantiate(val, position, Quaternion.identity); if (!((Object)(object)val2 != (Object)null)) { return; } ActiveSpikes.Add(((Component)val2).gameObject); ((Component)val2).gameObject.SetActive(true); OperationInfos operationInfos = val2.operationInfos; if ((Object)(object)operationInfos != (Object)null) { FieldInfo field2 = typeof(OperationInfos).GetField("m_onEnd", BindingFlags.Instance | BindingFlags.NonPublic); if (field2 != null) { field2.SetValue(operationInfos, null); } } Component component = ((Component)val2).GetComponent("PoolObject"); if ((Object)(object)component != (Object)null) { try { Type type = ((object)component).GetType(); FieldInfo fieldInfo = null; FieldInfo fieldInfo2 = null; FieldInfo fieldInfo3 = null; Type type2 = type; while (type2 != null) { if (fieldInfo == null) { fieldInfo = type2.GetField("_pool", BindingFlags.Instance | BindingFlags.NonPublic); } if (fieldInfo2 == null) { fieldInfo2 = type2.GetField("_poolIndex", BindingFlags.Instance | BindingFlags.NonPublic); } if (fieldInfo3 == null) { fieldInfo3 = type2.GetField("onDespawn", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } type2 = type2.BaseType; } if (fieldInfo != null) { fieldInfo.SetValue(component, null); } if (fieldInfo2 != null) { fieldInfo2.SetValue(component, 0); } if (fieldInfo3 != null) { fieldInfo3.SetValue(component, null); } } catch (Exception ex) { Debug.LogError((object)("[IdolOfTheOtherworldBehavior] Failed to nullify PoolObject fields: " + ex)); } } SpriteRenderer[] componentsInChildren = ((Component)val2).GetComponentsInChildren(true); foreach (SpriteRenderer val3 in componentsInChildren) { val3.color = new Color(1f, 0f, 0f, val3.color.a); if ((Object)(object)((Renderer)val3).material != (Object)null) { ((Renderer)val3).material.color = Color.red; } } FadeColor[] componentsInChildren2 = ((Component)val2).GetComponentsInChildren(true); Color val5 = default(Color); foreach (FadeColor obj in componentsInChildren2) { FieldInfo field3 = typeof(FadeColor).GetField("_target", BindingFlags.Instance | BindingFlags.NonPublic); if (field3 != null) { Color val4 = (Color)field3.GetValue(obj); ((Color)(ref val5))..ctor(1f, 0f, 0f, val4.a); field3.SetValue(obj, val5); } } if ((Object)(object)operationInfos != (Object)null) { FieldInfo field4 = typeof(OperationInfos).GetField("_duration", BindingFlags.Instance | BindingFlags.NonPublic); if (field4 != null) { float num = (float)field4.GetValue(operationInfos); Debug.Log((object)$"[IdolOfTheOtherworldBehavior] Original duration was {num}, overriding to 9.0s"); field4.SetValue(operationInfos, Mathf.Max(num, 9f)); } Object.Destroy((Object)(object)((Component)val2).gameObject, 10f); operationInfos.Run(owner); } else { Object.Destroy((Object)(object)((Component)val2).gameObject, 10f); } } catch (Exception ex2) { Debug.LogError((object)("[IdolOfTheOtherworldBehavior] Error in SpawnSpikeDirectly: " + ex2)); } } private IEnumerator C_SpawnSpikesWorldOrder(Character owner, List surfaces) { SummonOperationRunnersOnGround summon = GetSummonComponent(); if ((Object)(object)summon == (Object)null) { yield break; } FieldInfo fWidth = typeof(SummonOperationRunnersOnGround).GetField("_width", BindingFlags.Instance | BindingFlags.NonPublic); float width = ((fWidth != null) ? ((float)fWidth.GetValue(summon)) : 1.5f); FieldInfo fDelay = typeof(SummonOperationRunnersOnGround).GetField("_delay", BindingFlags.Instance | BindingFlags.NonPublic); float delay = ((fDelay != null) ? ((float)fDelay.GetValue(summon)) : 0.1f); FieldInfo fOrder = typeof(SummonOperationRunnersOnGround).GetField("_order", BindingFlags.Instance | BindingFlags.NonPublic); int order = ((fOrder != null) ? ((int)fOrder.GetValue(summon)) : 0); FieldInfo fNoise = typeof(SummonOperationRunnersOnGround).GetField("_noise", BindingFlags.Instance | BindingFlags.NonPublic); PositionNoise noise = ((!(fNoise != null)) ? ((PositionNoise)null) : ((PositionNoise)fNoise.GetValue(summon))); List spawnPositions = new List(); foreach (SurfaceRange surface in surfaces) { float length = (surface.maxX - surface.minX) / width; float extra = length - (float)(int)length; float startX = surface.minX + extra * width / 2f; for (int j = 0; (float)j < length; j++) { float spawnX = startX + width * (float)j; float spawnY = surface.y; if (noise != null) { Vector2 noiseOffset = noise.EvaluateAsVector2(); spawnX += noiseOffset.x; spawnY += noiseOffset.y; } spawnPositions.Add(new Vector3(spawnX, spawnY, 0f)); } } Debug.Log((object)$"[IdolOfTheOtherworldBehavior] C_SpawnSpikesWorldOrder: positionsCount={spawnPositions.Count}, width={width}, delay={delay}, order={order}"); if (spawnPositions.Count == 0) { yield break; } if (order == 0) { foreach (Vector3 pos in spawnPositions) { SpawnSpikeDirectly(owner, pos); } yield break; } Vector3 origin = ((Component)owner).transform.position; List> posWithDist = new List>(); foreach (Vector3 pos2 in spawnPositions) { posWithDist.Add(new KeyValuePair(pos2, Vector3.Distance(origin, pos2))); } if (order == 1) { posWithDist.Sort((KeyValuePair a, KeyValuePair b) => a.Value.CompareTo(b.Value)); } else { posWithDist.Sort((KeyValuePair a, KeyValuePair b) => b.Value.CompareTo(a.Value)); } float prevDistance = posWithDist[0].Value; foreach (KeyValuePair item in posWithDist) { SpawnSpikeDirectly(owner, item.Key); float distDiff = Mathf.Abs(item.Value - prevDistance); yield return (object)new WaitForSeconds(distDiff / width * delay); prevDistance = item.Value; } } private void OnSwap() { //IL_0081: 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) SummonOperationRunnersOnGround summonComponent = GetSummonComponent(); Character lastOwner = _lastOwner; Debug.Log((object)("[IdolOfTheOtherworldBehavior] OnSwap triggered! owner=" + ((lastOwner != null) ? ((Object)lastOwner).name : null) + ", summon=" + ((summonComponent != null) ? ((Object)summonComponent).name : null))); if ((Object)(object)_lastOwner == (Object)null || (Object)(object)summonComponent == (Object)null) { return; } try { SoundInfo val = FindSoundInfo(); if (val != null) { PersistentSingleton.Instance.PlaySound(val, ((Component)_lastOwner).transform.position); } List list = FindSurfacesDirectly(_lastOwner); Debug.Log((object)$"[IdolOfTheOtherworldBehavior] OnSwap found {list.Count} surfaces."); if (list.Count > 0) { ((MonoBehaviour)this).StartCoroutine(C_SpawnSpikesWorldOrder(_lastOwner, list)); return; } Debug.LogWarning((object)"[IdolOfTheOtherworldBehavior] No surfaces found, falling back to direct spike spawn on owner."); SpawnSpikeDirectly(_lastOwner, ((Component)_lastOwner).transform.position); } catch (Exception ex) { Debug.LogError((object)("[IdolOfTheOtherworldBehavior] Error during OnSwap: " + ex)); } } private void OnDestroy() { _isDestroying = true; Unsubscribe(); } } public class IdolOfTheOtherworldSpike : MonoBehaviour { private Character _owner = null; private Collider2D[] _colliders = null; private Collider2D[] _results = (Collider2D[])(object)new Collider2D[20]; private ContactFilter2D _contactFilter; private void Start() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) _colliders = ((Component)this).GetComponentsInChildren(true); _contactFilter = default(ContactFilter2D); _contactFilter.useTriggers = true; ((MonoBehaviour)this).StartCoroutine(C_ApplyDamageDelayed()); } private Character GetOwnerFromOperationInfos() { OperationInfos val = ((Component)this).GetComponent(); if ((Object)(object)val == (Object)null) { val = ((Component)this).GetComponentInParent(); } if ((Object)(object)val != (Object)null) { FieldInfo field = typeof(OperationInfos).GetField("_owner", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object? value = field.GetValue(val); return (Character)((value is Character) ? value : null); } } return null; } private IEnumerator C_ApplyDamageDelayed() { float elapsed = 0f; float initialDelay = 0.15f; yield return (object)new WaitForSeconds(initialDelay); float tickInterval; for (elapsed += initialDelay; elapsed < 9f; elapsed += tickInterval) { _owner = GetOwnerFromOperationInfos(); if ((Object)(object)_owner == (Object)null || (Object)(object)_owner.health == (Object)null || ((Health)_owner.health).dead) { break; } try { if (_colliders != null && _colliders.Length != 0) { HashSet hitEnemies = new HashSet(); Collider2D col = _colliders[0]; if ((Object)(object)col != (Object)null) { ((Component)col).gameObject.SetActive(true); ((Behaviour)col).enabled = true; Array.Clear(_results, 0, _results.Length); int count = col.OverlapCollider(_contactFilter, _results); for (int i = 0; i < count; i++) { Collider2D resCol = _results[i]; if (!((Object)(object)resCol == (Object)null)) { Character enemy = ((Component)resCol).GetComponentInParent(); if ((Object)(object)enemy != (Object)null && (int)enemy.type != 6 && (int)enemy.type != 7 && (Object)(object)enemy.health != (Object)null && !((Health)enemy.health).dead) { hitEnemies.Add(enemy); } } } } if (hitEnemies.Count > 0) { double physDmg = _owner.stat.GetFinal(Kind.PhysicalAttackDamage); double magicDmg = _owner.stat.GetFinal(Kind.MagicAttackDamage); Attribute attr = (Attribute)(!(physDmg >= magicDmg)); double currentPower = (((int)attr == 0) ? physDmg : magicDmg); foreach (Character enemy2 in hitEnemies) { if (!((Object)(object)enemy2 == (Object)null) && !((Object)(object)enemy2.health == (Object)null) && !((Health)enemy2.health).dead) { Damage dmgObj = new Damage(Attacker.op_Implicit(_owner), 10.0 * currentPower, Vector2.op_Implicit(((Component)enemy2).transform.position), attr, (AttackType)4, (MotionType)0, 1.0, 0f, 0.0, 1.0, 1.0, true, false, 0.0, 0.0, (short)0, (PriorityList)null, 1.0); _owner.Attack(enemy2, ref dmgObj); if (Random.value < 0.25f) { float randVal = Random.value; Kind randomKind = ((randVal < 0.25f) ? ((Kind)1) : ((randVal < 0.5f) ? ((Kind)0) : ((!(randVal < 0.75f)) ? ((Kind)3) : ((Kind)4)))); ApplyInfo applyInfo = new ApplyInfo(randomKind); _owner.GiveStatus(enemy2, applyInfo); } } } } } } catch (Exception ex) { Debug.LogError((object)("[IdolOfTheOtherworldSpike] Error during tick damage: " + ex)); } tickInterval = 0.5f; yield return (object)new WaitForSeconds(tickInterval); } } private void OnDestroy() { IdolOfTheOtherworldBehavior.ActiveSpikes.Remove(((Component)this).gameObject); } } [HarmonyPatch] public class CustomGearsPatch { [HarmonyPatch] public class SacredOrbRarityPatch { [HarmonyPrefix] [HarmonyPatch(typeof(GearManager), "GetItemToTake", new Type[] { typeof(Random), typeof(Rarity) })] [HarmonyPatch(typeof(GearManager), "GetItemToTake", new Type[] { typeof(Rarity) })] [HarmonyPatch(typeof(GearManager), "GetWeaponToTake", new Type[] { typeof(Random), typeof(Rarity) })] [HarmonyPatch(typeof(GearManager), "GetWeaponToTake", new Type[] { typeof(Rarity) })] [HarmonyPatch(typeof(GearManager), "GetWeaponByCategory", new Type[] { typeof(Random), typeof(Rarity), typeof(Category) })] private static void Prefix(ref Rarity rarity) { if (HasSacredOrb() && ((int)rarity == 0 || (int)rarity == 1) && Random.value < 0.4f) { rarity = (Rarity)((Random.value < 0.8f) ? 2 : 3); Debug.Log((object)$"[CustomGearsPatch] Sacred Orb upgrade active! Rarity common/rare request upgraded to {rarity}"); } } } private static Dictionary currentRequests = new Dictionary(); private static Dictionary currentGearRequests = new Dictionary(); private static Dictionary currentWeaponRequests = new Dictionary(); private static Dictionary currentWeaponGearRequests = new Dictionary(); private static Dictionary ItemStrings = new Dictionary(); private static Dictionary WeaponStrings = new Dictionary(); public static Dictionary GlitchedStrings = new Dictionary(); [HarmonyPrefix] [HarmonyPatch(typeof(GearResource), "Initialize")] private static void InjectCustomGears(ref GearResource __instance) { List list = new List(); if (__instance._items != null) { list.AddRange(__instance._items); Debug.Log((object)$"[CustomGearsPatch] Found {__instance._items.Length} vanilla items in self._items."); } FieldInfo fieldInfo = AccessTools.Field(typeof(GearResource), "_dlcItems"); if (fieldInfo != null) { if (fieldInfo.GetValue(__instance) is List list2) { list.AddRange(list2); Debug.Log((object)$"[CustomGearsPatch] Found {list2.Count} DLC items in _dlcItems."); } else { Debug.LogWarning((object)"[CustomGearsPatch] _dlcItems list is null."); } } else { Debug.LogWarning((object)"[CustomGearsPatch] _dlcItems field not found on GearResource."); } ItemReference val = ((IEnumerable)list).FirstOrDefault((Func)((ItemReference i) => ((GearReference)(i?)).name.Equals("IdolOfTheForgotten", StringComparison.OrdinalIgnoreCase) ?? false)); if (val != null) { CustomItemReference customItemReference = CustomItems.Items.FirstOrDefault((CustomItemReference i) => i.name.Equals("Custom-IdolOfTheOtherworld", StringComparison.OrdinalIgnoreCase)); if (customItemReference != null) { ((GearReference)customItemReference).path = ((GearReference)val).path; Debug.Log((object)("[CustomGearsPatch] Dynamically bound IdolOfTheOtherworld path to '" + ((GearReference)val).path + "' (guid remains custom: '" + ((GearReference)customItemReference).guid + "')")); } } else { Debug.LogError((object)"[CustomGearsPatch] Failed to find vanilla IdolOfTheForgotten in self._items or self._dlcItems!"); } ItemReference val2 = ((IEnumerable)list).FirstOrDefault((Func)((ItemReference i) => ((GearReference)(i?)).name.Equals("BattlefieldCup_2", StringComparison.OrdinalIgnoreCase) ?? false)); if (val2 == null) { val2 = ((IEnumerable)list).FirstOrDefault((Func)((ItemReference i) => ((GearReference)(i?)).name.Equals("BattlefieldCup", StringComparison.OrdinalIgnoreCase) ?? false)); } if (val2 != null) { CustomItemReference customItemReference2 = CustomItems.Items.FirstOrDefault((CustomItemReference i) => i.name.Equals("Custom-GuanYuCrescentBlade", StringComparison.OrdinalIgnoreCase)); if (customItemReference2 != null) { ((GearReference)customItemReference2).path = ((GearReference)val2).path; Debug.Log((object)("[CustomGearsPatch] Dynamically bound GuanYuCrescentBlade path to '" + ((GearReference)val2).path + "'")); } } else { Debug.LogError((object)"[CustomGearsPatch] Failed to find vanilla BattlefieldCup or BattlefieldCup_2 in self._items or self._dlcItems!"); } ItemReference val3 = ((IEnumerable)list).FirstOrDefault((Func)((ItemReference i) => ((GearReference)(i?)).name.Equals("11thFingerOfThunderbolt", StringComparison.OrdinalIgnoreCase) ?? false)); if (val3 != null) { CustomItemReference customItemReference3 = CustomItems.Items.FirstOrDefault((CustomItemReference i) => i.name.Equals("Custom-ZeusHammer", StringComparison.OrdinalIgnoreCase)); if (customItemReference3 != null) { ((GearReference)customItemReference3).path = ((GearReference)val3).path; Debug.Log((object)("[CustomGearsPatch] Dynamically bound ZeusHammer path to '" + ((GearReference)val3).path + "'")); } } else { Debug.LogError((object)"[CustomGearsPatch] Failed to find vanilla 11thFingerOfThunderbolt in self._items or self._dlcItems!"); } if (__instance._items == null) { Debug.LogError((object)"[CustomGearsPatch] self._items is null in GearResource!"); return; } ItemReference[] array = (ItemReference[])(object)CustomItems.Items.Where((CustomItemReference i) => i != null && !string.IsNullOrEmpty(i.name) && !string.IsNullOrEmpty(((GearReference)i).guid)).ToArray(); ItemReference[] array2 = array; ItemStrings = CustomItems.MakeStringDictionary(); HashSet hashSet = new HashSet(from i in __instance._items where i != null select ((GearReference)i).name, StringComparer.OrdinalIgnoreCase); HashSet hashSet2 = new HashSet(from i in __instance._items where i != null && !string.IsNullOrEmpty(((GearReference)i).guid) select ((GearReference)i).guid, StringComparer.OrdinalIgnoreCase); List list3 = new List(); ItemReference[] array3 = array2; foreach (ItemReference val4 in array3) { if (hashSet.Contains(((GearReference)val4).name)) { Debug.LogWarning((object)("[CustomGearsPatch] Item with name '" + ((GearReference)val4).name + "' is already in GearResource. Skipping duplicate.")); continue; } if (hashSet2.Contains(((GearReference)val4).guid)) { Debug.LogWarning((object)("[CustomGearsPatch] Item with guid '" + ((GearReference)val4).guid + "' is already in GearResource. Skipping duplicate.")); continue; } list3.Add(val4); hashSet.Add(((GearReference)val4).name); hashSet2.Add(((GearReference)val4).guid); } if (list3.Count > 0) { int num2 = __instance._items.Length; Array.Resize(ref __instance._items, num2 + list3.Count); list3.ToArray().CopyTo(__instance._items, num2); Sprite[] array4 = (from i in list3 where (Object)(object)((GearReference)i).thumbnail != (Object)null select ((GearReference)i).thumbnail).ToArray(); if (array4.Length != 0 && __instance._gearThumbnails != null) { HashSet hashSet3 = new HashSet(from t in __instance._gearThumbnails where (Object)(object)t != (Object)null && !string.IsNullOrEmpty(((Object)t).name) select ((Object)t).name, StringComparer.OrdinalIgnoreCase); List list4 = new List(); Sprite[] array5 = array4; foreach (Sprite val5 in array5) { if (hashSet3.Contains(((Object)val5).name)) { Debug.LogWarning((object)("[CustomGearsPatch] Thumbnail with name '" + ((Object)val5).name + "' is already in _gearThumbnails. Skipping duplicate.")); continue; } list4.Add(val5); hashSet3.Add(((Object)val5).name); } if (list4.Count > 0) { int num4 = __instance._gearThumbnails.Length; Array.Resize(ref __instance._gearThumbnails, num4 + list4.Count); list4.ToArray().CopyTo(__instance._gearThumbnails, num4); } } } if (__instance._weapons != null) { WeaponReference[] array6 = (WeaponReference[])(object)CustomSkulls.Skulls.Where((CustomWeaponReference w) => w != null && !string.IsNullOrEmpty(w.name) && !string.IsNullOrEmpty(((GearReference)w).guid)).ToArray(); WeaponReference[] array7 = array6; WeaponStrings = CustomSkulls.MakeStringDictionary(); HashSet hashSet4 = new HashSet(from w in __instance._weapons where w != null select ((GearReference)w).name, StringComparer.OrdinalIgnoreCase); HashSet hashSet5 = new HashSet(from w in __instance._weapons where w != null && !string.IsNullOrEmpty(((GearReference)w).guid) select ((GearReference)w).guid, StringComparer.OrdinalIgnoreCase); List list5 = new List(); WeaponReference[] array8 = array7; foreach (WeaponReference val6 in array8) { if (hashSet4.Contains(((GearReference)val6).name)) { Debug.LogWarning((object)("[CustomGearsPatch] Weapon with name '" + ((GearReference)val6).name + "' is already in GearResource. Skipping duplicate.")); continue; } if (hashSet5.Contains(((GearReference)val6).guid)) { Debug.LogWarning((object)("[CustomGearsPatch] Weapon with guid '" + ((GearReference)val6).guid + "' is already in GearResource. Skipping duplicate.")); continue; } list5.Add(val6); hashSet4.Add(((GearReference)val6).name); hashSet5.Add(((GearReference)val6).guid); } if (list5.Count > 0) { int num6 = __instance._weapons.Length; Array.Resize(ref __instance._weapons, num6 + list5.Count); list5.ToArray().CopyTo(__instance._weapons, num6); Sprite[] array9 = (from w in list5 where (Object)(object)((GearReference)w).thumbnail != (Object)null select ((GearReference)w).thumbnail).ToArray(); if (array9.Length != 0 && __instance._gearThumbnails != null) { HashSet hashSet6 = new HashSet(from t in __instance._gearThumbnails where (Object)(object)t != (Object)null && !string.IsNullOrEmpty(((Object)t).name) select ((Object)t).name, StringComparer.OrdinalIgnoreCase); List list6 = new List(); Sprite[] array10 = array9; foreach (Sprite val7 in array10) { if (hashSet6.Contains(((Object)val7).name)) { Debug.LogWarning((object)("[CustomGearsPatch] Skull thumbnail with name '" + ((Object)val7).name + "' is already in _gearThumbnails. Skipping duplicate.")); continue; } list6.Add(val7); hashSet6.Add(((Object)val7).name); } if (list6.Count > 0) { int num8 = __instance._gearThumbnails.Length; Array.Resize(ref __instance._gearThumbnails, num8 + list6.Count); list6.ToArray().CopyTo(__instance._gearThumbnails, num8); } } } Debug.Log((object)$"[CustomGearsPatch] Injected {list3.Count} custom items and {list5.Count} custom skulls successfully!"); } else { Debug.Log((object)$"[CustomGearsPatch] Injected {list3.Count} custom items successfully!"); } } [HarmonyPostfix] [HarmonyPatch(typeof(GearResource), "Initialize")] private static void InjectCustomGearsPostfix(ref GearResource __instance) { try { ItemReference val = ((IEnumerable)__instance._items).FirstOrDefault((Func)((ItemReference i) => ((GearReference)(i?)).name.Equals("IdolOfTheForgotten", StringComparison.OrdinalIgnoreCase) ?? false)); if (val != null) { try { ItemRequest val2 = val.LoadAsync(); ((Request)(object)val2).WaitForCompletion(); Item asset = ((Request)(object)val2).asset; if ((Object)(object)asset != (Object)null) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("=== IdolOfTheForgotten Deep Dump ==="); MonoBehaviour[] componentsInChildren = ((Component)asset).GetComponentsInChildren(true); foreach (MonoBehaviour val3 in componentsInChildren) { if (!((Object)(object)val3 == (Object)null)) { stringBuilder.AppendLine("Component: " + ((object)val3).GetType().FullName + " on GameObject: " + ((Object)((Component)val3).gameObject).name); DumpObjectFields(val3, stringBuilder, "", new HashSet(), 0); } } SummonOperationRunnersOnGround componentInChildren = ((Component)asset).GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { FieldInfo field = typeof(SummonOperationRunnersOnGround).GetField("_operationRunner", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object? value = field.GetValue(componentInChildren); MonoBehaviour val4 = (MonoBehaviour)((value is MonoBehaviour) ? value : null); if ((Object)(object)val4 != (Object)null) { stringBuilder.AppendLine("\n=== OperationRunner (IdolOfTheForgotten_Area) Deep Dump ==="); MonoBehaviour[] componentsInChildren2 = ((Component)val4).GetComponentsInChildren(true); foreach (MonoBehaviour val5 in componentsInChildren2) { if (!((Object)(object)val5 == (Object)null)) { stringBuilder.AppendLine("Component: " + ((object)val5).GetType().FullName + " on GameObject: " + ((Object)((Component)val5).gameObject).name); DumpObjectFields(val5, stringBuilder, "", new HashSet(), 0); } } } } } File.WriteAllText("C:\\Users\\jimin\\Documents\\ChzzkSkulConnection\\IdolDump.txt", stringBuilder.ToString()); Debug.Log((object)"[ChzzkSkul] IdolOfTheForgotten and Area dumped to IdolDump.txt successfully!"); } } catch (Exception ex) { Debug.LogError((object)("[ChzzkSkul] Failed to dump IdolOfTheForgotten: " + ex.Message)); } } FieldInfo fieldInfo = AccessTools.Field(typeof(GearResource), "_gearThumbnailDictionary"); if (!(fieldInfo != null) || !(fieldInfo.GetValue(__instance) is Dictionary dictionary)) { return; } foreach (CustomItemReference item in CustomItems.Items) { if ((Object)(object)((GearReference)item).thumbnail != (Object)null) { dictionary[item.name] = ((GearReference)item).thumbnail; } } foreach (CustomWeaponReference skull in CustomSkulls.Skulls) { if ((Object)(object)((GearReference)skull).thumbnail != (Object)null) { dictionary[skull.name] = ((GearReference)skull).thumbnail; } } } catch (Exception ex2) { Debug.LogWarning((object)("[CustomGearsPatch] InjectCustomGearsPostfix failed: " + ex2.Message)); } } private static void DumpObjectFields(object obj, StringBuilder sb, string indent, HashSet visited, int depth) { if (obj == null || depth > 12) { return; } Type type = obj.GetType(); if (type.IsPrimitive || type.IsEnum || type == typeof(string)) { return; } if (!type.IsValueType) { if (visited.Contains(obj)) { return; } visited.Add(obj); } if (obj is IEnumerable enumerable) { int num = 0; { foreach (object item in enumerable) { if (item != null) { sb.AppendLine($"{indent} [{num}]: {item.GetType().FullName}"); DumpObjectFields(item, sb, indent + " ", visited, depth + 1); num++; } } return; } } FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { try { object value = fieldInfo.GetValue(obj); if (value == null) { sb.AppendLine(indent + " " + fieldInfo.FieldType.Name + " " + fieldInfo.Name + " = null"); continue; } if (fieldInfo.FieldType == typeof(EffectInfo)) { EffectInfo val = (EffectInfo)((value is EffectInfo) ? value : null); sb.AppendLine(string.Format("{0} [EFFECT] {1} -> EffectName: {2}, loop: {3}", indent, fieldInfo.Name, ((Object)(object)val.effect != (Object)null) ? ((Object)val.effect).name : "null", val.loop)); DumpObjectFields(value, sb, indent + " ", visited, depth + 1); continue; } if (fieldInfo.FieldType == typeof(SoundInfo)) { sb.AppendLine(indent + " [SOUND] " + fieldInfo.Name); DumpObjectFields(value, sb, indent + " ", visited, depth + 1); continue; } Object val2 = (Object)((value is Object) ? value : null); if (val2 != null) { sb.AppendLine(indent + " " + fieldInfo.FieldType.Name + " " + fieldInfo.Name + " = " + val2.name + " (Unity Object)"); } else if (fieldInfo.FieldType.IsClass && fieldInfo.FieldType.Namespace != null && (!fieldInfo.FieldType.Namespace.StartsWith("System") || typeof(IEnumerable).IsAssignableFrom(fieldInfo.FieldType))) { sb.AppendLine(indent + " " + fieldInfo.FieldType.Name + " " + fieldInfo.Name + ":"); DumpObjectFields(value, sb, indent + " ", visited, depth + 1); } } catch (Exception ex) { sb.AppendLine(indent + " Error reading field " + fieldInfo.Name + ": " + ex.Message); } } } [HarmonyPrefix] [HarmonyPatch(typeof(GearManager), "Initialize")] private static bool GearManagerInitializePrefix(GearManager __instance) { try { Debug.Log((object)"[CustomGearsPatch] Running custom GearManager.Initialize directly to prevent EnumArray -1 index crashes."); GearResource instance = GearResource.instance; if ((Object)(object)instance == (Object)null) { Debug.LogError((object)"[CustomGearsPatch] GearResource.instance is null! Falling back to original Initialize."); return true; } SafeInitializeEnumArray(__instance._items, instance.items, (ItemReference i) => ((GearReference)i).rarity, (IEnumerable g) => g.ToArray()); SafeInitializeEnumArray(__instance._quintessences, instance.essences, (EssenceReference e) => ((GearReference)e).rarity, (IEnumerable g) => g.ToArray()); SafeInitializeEnumArray(__instance._weapons, instance.weapons, (WeaponReference w) => ((GearReference)w).rarity, (IEnumerable g) => g.ToArray()); if (__instance._nonDLCLockedGears != null) { List[] array = __instance._nonDLCLockedGears.Array; if (array != null && array.Length < 5) { List[] array2 = new List[5]; Array.Copy(array, array2, array.Length); __instance._nonDLCLockedGears.Array = array2; Debug.Log((object)"[CustomGearsPatch] Expanded GearManager._nonDLCLockedGears array to 5 slots in Prefix."); } } PropertyInfo property = typeof(GearManager).GetProperty("initialized", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanWrite) { property.SetValue(__instance, true); } else { FieldInfo fieldInfo = AccessTools.Field(typeof(GearManager), "_initialized"); if (fieldInfo != null) { fieldInfo.SetValue(__instance, true); } else { MethodInfo method = typeof(GearManager).GetMethod("set_initialized", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { method.Invoke(__instance, new object[1] { true }); } else { Debug.LogError((object)"[CustomGearsPatch] Failed to set initialized flag on GearManager!"); } } } Debug.Log((object)"[CustomGearsPatch] Custom GearManager.Initialize completed successfully! (Original skipped)"); return false; } catch (Exception ex) { Debug.LogError((object)("[CustomGearsPatch] Fatal error in custom GearManager.Initialize: " + ex)); return true; } } private static void SafeInitializeEnumArray(EnumArray enumArray, IEnumerable sourceElements, Func raritySelector, Func, TArray> arrayConverter) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected I4, but got Unknown if (enumArray == null) { return; } FieldInfo fieldInfo = AccessTools.Field(((object)enumArray).GetType(), "_array"); if (fieldInfo == null) { return; } TArray[] array = new TArray[5]; IEnumerable> enumerable = sourceElements.GroupBy(raritySelector); foreach (IGrouping item in enumerable) { int num = (int)item.Key; if (num >= 0 && num < 5) { array[num] = arrayConverter(item); } else { Debug.LogWarning((object)$"[CustomGearsPatch] Skipping invalid/unsupported rarity index: {num} for elements in group."); } } fieldInfo.SetValue(enumArray, array); } [HarmonyPostfix] [HarmonyPatch(typeof(GearManager), "Initialize")] private static void GearManagerInitializePostfix(ref GearManager __instance) { try { FieldInfo fieldInfo = AccessTools.Field(typeof(GearManager), "_items"); if (!(fieldInfo != null)) { return; } object value = fieldInfo.GetValue(__instance); if (value == null) { return; } FieldInfo fieldInfo2 = AccessTools.Field(value.GetType(), "_array"); if (!(fieldInfo2 != null) || !(fieldInfo2.GetValue(value) is ItemReference[][] array)) { return; } for (int i = 0; i < array.Length; i++) { if (array[i] == null) { continue; } List list = new List(); ItemReference[] array2 = array[i]; foreach (ItemReference val in array2) { if (val != null) { string name = ((GearReference)val).name; if ((name.StartsWith("Custom-Card") || name.StartsWith("Card")) && (name.EndsWith("_R") || name.EndsWith("_E") || name.EndsWith("_RE"))) { Debug.Log((object)("[CustomGearsPatch] Filtering out card variant from GearManager drop pool: " + name)); continue; } } list.Add(val); } array[i] = list.ToArray(); } } catch (Exception ex) { Debug.LogError((object)("[CustomGearsPatch] Failed to filter card variants in GearManager: " + ex)); } } [HarmonyPrefix] [HarmonyPatch(typeof(GearManager), "UpdateLockedGearList")] private static bool UpdateLockedGearListPrefix(GearManager __instance) { //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Expected I4, but got Unknown try { GearResource instance = GearResource.instance; if ((Object)(object)instance == (Object)null) { return true; } ReadOnlyCollection items = instance.items; ReadOnlyCollection essences = instance.essences; ReadOnlyCollection weapons = instance.weapons; List list = new List(items.Count + essences.Count + weapons.Count); list.AddRange((IEnumerable)items); list.AddRange((IEnumerable)essences); list.AddRange((IEnumerable)weapons); if (__instance._nonDLCLockedGears != null) { List[] array = __instance._nonDLCLockedGears.Array; if (array == null || array.Length < 5) { List[] array2 = new List[5]; if (array != null) { Array.Copy(array, array2, array.Length); } for (int i = 0; i < array2.Length; i++) { if (array2[i] == null) { array2[i] = new List(); } } __instance._nonDLCLockedGears.Array = array2; } } IEnumerable> enumerable = from g in list group g by g.rarity; foreach (IGrouping item in enumerable) { int num = (int)item.Key; if (num < 0 || num >= 5) { continue; } List list2 = item.Where((GearReference gear) => gear.obtainable && (int)gear.dlcTitle == -1 && !gear.unlocked).ToList(); if (__instance._nonDLCLockedGears != null) { List[] array3 = __instance._nonDLCLockedGears.Array; if (array3 != null && num < array3.Length) { array3[num] = list2; } } } return false; } catch (Exception ex) { Debug.LogError((object)("[ChzzkSkul] Error in UpdateLockedGearList Prefix: " + ex)); return true; } } [HarmonyPrefix] [HarmonyPatch(typeof(GearManager), "GetGearToUnlock")] private static bool GetGearToUnlockPrefix(GearManager __instance, Random random, ref Rarity rarity, ref GearReference __result) { int num = (int)rarity; if (num < 0 || num >= 5) { __result = null; return false; } return true; } [HarmonyPrefix] [HarmonyPatch(typeof(GearManager), "TryGetGearToUnlock")] private static bool TryGetGearToUnlockPrefix(GearManager __instance, Random random, ref Rarity rarity, ref bool __result, ref GearReference gearReference) { int num = (int)rarity; if (num < 0 || num >= 5) { gearReference = null; __result = false; return false; } return true; } [HarmonyPrefix] [HarmonyPatch(typeof(GearManager), "GetItemListByRarity")] private static bool GetItemListByRarityPrefix(GearManager __instance, Rarity rarity, ref ICollection __result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Expected I4, but got Unknown int num = (int)rarity; if (num < 0 || num >= 5) { __result = new List(); return false; } ItemReference[][] array = __instance._items?.Array; if (array == null || num >= array.Length || array[num] == null) { __result = new List(); return false; } return true; } [HarmonyPrefix] [HarmonyPatch(typeof(GearManager), "GetWeaponListByRarity")] private static bool GetWeaponListByRarityPrefix(GearManager __instance, Rarity rarity, ref ICollection __result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Expected I4, but got Unknown int num = (int)rarity; if (num < 0 || num >= 5) { __result = new List(); return false; } WeaponReference[][] array = __instance._weapons?.Array; if (array == null || num >= array.Length || array[num] == null) { __result = new List(); return false; } return true; } [HarmonyPrefix] [HarmonyPatch(typeof(GearManager), "GetEssenceListByRarity")] private static bool GetEssenceListByRarityPrefix(GearManager __instance, Rarity rarity, ref ICollection __result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Expected I4, but got Unknown int num = (int)rarity; if (num < 0 || num >= 5) { __result = new List(); return false; } EssenceReference[][] array = __instance._quintessences?.Array; if (array == null || num >= array.Length || array[num] == null) { __result = new List(); return false; } return true; } [HarmonyPrefix] [HarmonyPatch(typeof(GearManager), "GetItemToTake", new Type[] { typeof(Random), typeof(Rarity) })] private static bool GetItemToTakePrefix(GearManager __instance, Random random, ref Rarity rarity) { int num = (int)rarity; if (num < 0 || num >= 5) { rarity = (Rarity)0; } return true; } [HarmonyPrefix] [HarmonyPatch(typeof(GearManager), "GetQuintessenceToTake", new Type[] { typeof(Random), typeof(Rarity) })] private static bool GetQuintessenceToTakePrefix(GearManager __instance, Random random, ref Rarity rarity) { int num = (int)rarity; if (num < 0 || num >= 5) { rarity = (Rarity)0; } return true; } [HarmonyPrefix] [HarmonyPatch(typeof(GearManager), "GetWeaponToTake", new Type[] { typeof(Random), typeof(Rarity) })] private static bool GetWeaponToTakePrefix(GearManager __instance, Random random, ref Rarity rarity) { int num = (int)rarity; if (num < 0 || num >= 5) { rarity = (Rarity)0; } return true; } [HarmonyPrefix] [HarmonyPatch(typeof(GearManager), "GetWeaponByCategory")] private static bool GetWeaponByCategoryPrefix(GearManager __instance, Random random, ref Rarity rarity) { int num = (int)rarity; if (num < 0 || num >= 5) { rarity = (Rarity)0; } return true; } [HarmonyPrefix] [HarmonyPatch(typeof(GearManager), "GetItemByKey")] private static bool GetItemByKeyPrefix(GearManager __instance, string key, ref ItemReference __result) { ItemReference[][] array = __instance._items?.Array; if (array == null) { __result = null; return false; } ItemReference[][] array2 = array; foreach (ItemReference[] array3 in array2) { if (array3 != null) { ItemReference val = ((IEnumerable)array3).FirstOrDefault((Func)((ItemReference item) => ((GearReference)(item?)).name.Equals(key, StringComparison.OrdinalIgnoreCase) ?? false)); if (val != null) { __result = val; return false; } } } __result = null; return false; } [HarmonyPrefix] [HarmonyPatch(typeof(GearManager), "GetItemByKeyword")] private static bool GetItemByKeywordPrefix(GearManager __instance, Random random, Rarity rarity, Key key, ref ItemReference __result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Expected I4, but got Unknown int num = (int)rarity; if (num < 0 || num >= 5) { __result = null; return false; } ItemReference[][] array = __instance._items?.Array; if (array == null || num >= array.Length || array[num] == null) { __result = null; return false; } return true; } public static bool HasSacredOrb() { try { Character player = ChzzkCardSynergy.GetPlayer(); if ((Object)(object)player == (Object)null || player.playerComponents == null || player.playerComponents.inventory == null || (Object)(object)player.playerComponents.inventory.item == (Object)null) { return false; } foreach (Item item in player.playerComponents.inventory.item.items) { if ((Object)(object)item != (Object)null && (((Object)item).name == "Custom-SacredOrb" || ((Object)item).name == "SacredOrb")) { return true; } } } catch (Exception ex) { Debug.LogError((object)("[CustomGearsPatch] Error in HasSacredOrb: " + ex)); } return false; } public static bool HasCardHermit() { try { Character player = ChzzkCardSynergy.GetPlayer(); if ((Object)(object)player == (Object)null || player.playerComponents == null || player.playerComponents.inventory == null || (Object)(object)player.playerComponents.inventory.item == (Object)null) { return false; } foreach (Item item in player.playerComponents.inventory.item.items) { if ((Object)(object)item != (Object)null && (((Object)item).name == "CardHermit" || ((Object)item).name == "Custom-CardHermit" || ((Object)item).name.Contains("CardHermit"))) { return true; } } } catch (Exception ex) { Debug.LogError((object)("[CustomGearsPatch] Error in HasCardHermit: " + ex)); } return false; } [HarmonyPostfix] [HarmonyPatch(typeof(ItemReference), "LoadAsync")] private static void RegisterItemRequest(ref ItemReference __instance, ref ItemRequest __result) { if (__instance is CustomItemReference value) { currentRequests[__result] = value; } } [HarmonyPostfix] [HarmonyPatch(typeof(WeaponReference), "LoadAsync")] private static void RegisterWeaponRequest(ref WeaponReference __instance, ref WeaponRequest __result) { if (__instance is CustomWeaponReference value) { currentWeaponRequests[__result] = value; } } [HarmonyPostfix] [HarmonyPatch(typeof(GearReference), "LoadAsync")] private static void RegisterGearRequest(ref GearReference __instance, ref GearRequest __result) { if (__instance is CustomItemReference value) { currentGearRequests[__result] = value; } else if (__instance is CustomWeaponReference value2) { currentWeaponGearRequests[__result] = value2; } } [HarmonyPrefix] [HarmonyPatch(typeof(LevelManager), "DropItem", new Type[] { typeof(ItemRequest), typeof(Vector3) })] private static bool DropCustomItem(ref LevelManager __instance, ItemRequest gearRequest, Vector3 position, ref Item __result) { //IL_0035: 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 (!currentRequests.ContainsKey(gearRequest)) { return true; } CustomItemReference customItemReference = currentRequests[gearRequest]; Debug.Log((object)$"[ChzzkSkul] DropCustomItem prefix: Dropping Custom Item '{customItemReference.name}' (Original: {customItemReference.itemName}) at {position}"); Item item = customItemReference.GetItem(((Component)((Request)(object)gearRequest).asset).gameObject.GetComponent()); __result = __instance.DropItem(item, position); currentRequests.Remove(gearRequest); return false; } [HarmonyPrefix] [HarmonyPatch(typeof(LevelManager), "DropWeapon", new Type[] { typeof(WeaponRequest), typeof(Vector3) })] private static bool DropCustomWeapon(ref LevelManager __instance, WeaponRequest gearRequest, Vector3 position, ref Weapon __result) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (!currentWeaponRequests.ContainsKey(gearRequest)) { return true; } CustomWeaponReference customWeaponReference = currentWeaponRequests[gearRequest]; Weapon weapon = customWeaponReference.GetWeapon(((Component)((Request)(object)gearRequest).asset).gameObject.GetComponent()); __result = __instance.DropWeapon(weapon, position); currentWeaponRequests.Remove(gearRequest); return false; } [HarmonyPrefix] [HarmonyPatch(typeof(LevelManager), "DropGear", new Type[] { typeof(GearRequest), typeof(Vector3) })] private static bool DropCustomGear(ref LevelManager __instance, GearRequest gearRequest, Vector3 position, ref Gear __result) { //IL_002e: 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_009c: 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 (currentGearRequests.ContainsKey(gearRequest)) { CustomItemReference customItemReference = currentGearRequests[gearRequest]; Debug.Log((object)$"[ChzzkSkul] DropCustomGear prefix: Dropping Custom Item '{customItemReference.name}' (Original: {customItemReference.itemName}) at {position}"); Item item = customItemReference.GetItem(((Component)((Request)(object)gearRequest).asset).gameObject.GetComponent()); __result = (Gear)(object)__instance.DropItem(item, position); currentGearRequests.Remove(gearRequest); return false; } if (currentWeaponGearRequests.ContainsKey(gearRequest)) { CustomWeaponReference customWeaponReference = currentWeaponGearRequests[gearRequest]; Debug.Log((object)$"[ChzzkSkul] DropCustomGear prefix: Dropping Custom Skull '{customWeaponReference.name}' at {position}"); Weapon weapon = customWeaponReference.GetWeapon(((Component)((Request)(object)gearRequest).asset).gameObject.GetComponent()); __result = (Gear)(object)__instance.DropWeapon(weapon, position); currentWeaponGearRequests.Remove(gearRequest); return false; } return true; } [HarmonyPrefix] [HarmonyPatch(typeof(Localization), "GetLocalizedString", new Type[] { typeof(string) })] private static bool InjectCustomStrings(string key, ref string __result) { if (key != null && (key.StartsWith("item/Card") || key.StartsWith("item/Custom-Card")) && GetCardStringOverride(key, ref __result)) { return false; } if (GlitchedStrings.TryGetValue(key, out var value)) { __result = value; return false; } switch (key) { case "synergy/key/37/name": __result = (PluginItems.IsKorean() ? "카드" : "Card"); return false; case "synergy/key/37/desc/1": __result = (PluginItems.IsKorean() ? "카드가 강화됩니다.\n강화된 카드는 더욱 강력한 효과를 발휘합니다." : "Cards are enhanced.\nEnhanced cards exert more powerful effects."); return false; case "synergy/key/37/desc/2": __result = (PluginItems.IsKorean() ? "공격 시 원래 데미지의 110%의 추가 공격이 발동합니다." : "Attacks trigger an additional hit dealing 110% of the original damage."); return false; case "synergy/key/37/desc/tuning": __result = (PluginItems.IsKorean() ? "카드 시너지 효과 활성화" : "Card synergy effect active"); return false; default: if (key.StartsWith("item/Custom-")) { string text = ""; string cleanName = ""; if (key.EndsWith("/name")) { text = "/name"; cleanName = key.Substring(12, key.Length - 12 - 5); } else if (key.EndsWith("/desc")) { text = "/desc"; cleanName = key.Substring(12, key.Length - 12 - 5); } else if (key.EndsWith("/flavor")) { text = "/flavor"; cleanName = key.Substring(12, key.Length - 12 - 7); } if (!string.IsNullOrEmpty(cleanName)) { CustomItemReference customItemReference = CustomItems.Items.FirstOrDefault((CustomItemReference i) => i.name == "Custom-" + cleanName || i.name == cleanName); if (customItemReference != null) { switch (text) { case "/name": __result = customItemReference.itemName; break; case "/desc": __result = customItemReference.itemDescription; break; case "/flavor": __result = customItemReference.itemLore; break; } return false; } } } if (key.StartsWith("weapon/Custom-")) { string text2 = ""; string cleanName2 = ""; if (key.EndsWith("/name")) { text2 = "/name"; cleanName2 = key.Substring(14, key.Length - 14 - 5); } else if (key.EndsWith("/desc")) { text2 = "/desc"; cleanName2 = key.Substring(14, key.Length - 14 - 5); } else if (key.EndsWith("/flavor")) { text2 = "/flavor"; cleanName2 = key.Substring(14, key.Length - 14 - 7); } if (!string.IsNullOrEmpty(cleanName2)) { CustomWeaponReference customWeaponReference = CustomSkulls.Skulls.FirstOrDefault((CustomWeaponReference w) => w.name == "Custom-" + cleanName2 || w.name == cleanName2); if (customWeaponReference != null) { switch (text2) { case "/name": __result = customWeaponReference.weaponName; break; case "/desc": __result = customWeaponReference.weaponDescription; break; case "/flavor": __result = customWeaponReference.weaponLore; break; } return false; } } } if (ItemStrings.ContainsKey(key)) { __result = ItemStrings[key]; return false; } if (WeaponStrings.ContainsKey(key)) { __result = WeaponStrings[key]; return false; } return true; } static bool GetCardStringOverride(string text4, ref string reference) { string text3 = text4; if (text3.StartsWith("item/Custom-")) { text3 = "item/" + text3.Substring(12); } string text5 = ""; string text6 = ""; if (text3.EndsWith("/name")) { text5 = "name"; text6 = text3.Substring(5, text3.Length - 5 - 5); } else if (text3.EndsWith("/desc")) { text5 = "desc"; text6 = text3.Substring(5, text3.Length - 5 - 5); } else { if (!text3.EndsWith("/flavor")) { return false; } text5 = "flavor"; text6 = text3.Substring(5, text3.Length - 5 - 7); } bool flag = text6.Contains("_R") || text6.Contains("_RE") || ChzzkCardSynergy.IsCardSynergySuper(); bool flag2 = text6.Contains("_E") || text6.Contains("_RE") || ChzzkCardSynergy.GetCardCount() >= 4; bool flag3 = PluginItems.IsKorean(); string text7 = text6; if (text7.EndsWith("_RE")) { text7 = text7.Substring(0, text7.Length - 3); } else if (text7.EndsWith("_R")) { text7 = text7.Substring(0, text7.Length - 2); } else if (text7.EndsWith("_E")) { text7 = text7.Substring(0, text7.Length - 2); } switch (text5) { case "name": { string text8 = ""; switch (text7) { case "CardFool": text8 = (flag3 ? "광대 카드" : "Fool Card"); break; case "CardMagician": text8 = (flag3 ? "마술사 카드" : "Magician Card"); break; case "CardHighPriestess": text8 = (flag3 ? "여사제 카드" : "High Priestess Card"); break; case "CardEmpress": text8 = (flag3 ? "여황제 카드" : "Empress Card"); break; case "CardEmperor": text8 = (flag3 ? "황제 카드" : "Emperor Card"); break; case "CardHierophant": text8 = (flag3 ? "교황 카드" : "Hierophant Card"); break; case "CardLovers": text8 = (flag3 ? "연인 카드" : "Lovers Card"); break; case "CardChariot": text8 = (flag3 ? "전차 카드" : "Chariot Card"); break; case "CardJustice": text8 = (flag3 ? "정의 카드" : "Justice Card"); break; case "CardHermit": text8 = (flag3 ? "은둔자 카드" : "Hermit Card"); break; case "CardWheelOfFortune": text8 = (flag3 ? "운명의 수레바퀴 카드" : "Wheel of Fortune Card"); break; case "CardStrength": text8 = (flag3 ? "힘 카드" : "Strength Card"); break; case "CardMoon": text8 = (flag3 ? "달 카드" : "Moon Card"); break; case "CardSun": text8 = (flag3 ? "태양 카드" : "Sun Card"); break; case "CardSupernova": text8 = (flag3 ? "초신성 폭발 카드" : "Supernova Card"); break; default: return false; } if (flag) { if (flag2) { reference = (flag3 ? (text8 + " [역방향·강화]") : (text8 + " [Reversed·Enhanced]")); } else { reference = (flag3 ? (text8 + " [역방향]") : (text8 + " [Reversed]")); } } else if (flag2) { reference = (flag3 ? (text8 + " [강화]") : (text8 + " [Enhanced]")); } else { reference = text8; } return true; } case "desc": switch (text7) { case "CardFool": if (!flag) { reference = (flag3 ? ("이동 속도가 " + (flag2 ? "30%" : "20%") + " 증가하고 대시 거리와 무적 시간이 약간 증가합니다.") : ("Increases Movement Speed by " + (flag2 ? "30%" : "20%") + " and slightly increases Dash distance/invulnerability.")); } else { reference = (flag3 ? ("[역방향] 이동 속도가 10% 감소합니다.\n대시 시 " + (flag2 ? "1.5초간 이동 속도 +70%" : "1초간 이동 속도 +50%") + " 버프를 얻으며, 버프 지속 중 다음 공격의 피해가 " + (flag2 ? "2.5배" : "2배") + "로 증폭됩니다.") : ("[Reversed Penalty] Reduces Movement Speed by 10%.\nDashing grants " + (flag2 ? "+70% Movement Speed for 1.5s" : "+50% Movement Speed for 1s") + ", and amplifies the next attack damage by " + (flag2 ? "2.5x" : "2x") + " (consumes buff).")); } return true; case "CardMagician": if (!flag) { reference = (flag3 ? ("마법 공격력이 " + (flag2 ? "50%" : "30%") + " 증가하고 스킬 Cooldown 속도가 " + (flag2 ? "30%" : "15%") + " 증가합니다.") : ("Increases Magic Attack by " + (flag2 ? "50%" : "30%") + " and Skill Cooldown Speed by " + (flag2 ? "30%" : "15%") + ".")); } else { reference = (flag3 ? ("[역방향] 마법 공격력이 15% 감소합니다.\n스킬 사용 시 " + (flag2 ? "20%" : "10%") + " 확률로 해당 스킬의 쿨다운이 즉시 초기화됩니다.") : ("[Reversed Penalty] Reduces Magic Attack by 15%.\nUsing a skill has a " + (flag2 ? "20%" : "10%") + " chance to instantly reset its cooldown.")); } return true; case "CardHighPriestess": if (!flag) { reference = (flag3 ? ("최대 체력이 " + (flag2 ? "35" : "20") + " 증가하고 매초 체력을 " + (flag2 ? "1.0" : "0.5") + " 회복합니다.") : ("Increases Max Health by " + (flag2 ? "35" : "20") + " and regenerates " + (flag2 ? "1.0" : "0.5") + " HP per second.")); } else { reference = (flag3 ? ("[역방향] 최대 체력이 15 감소합니다.\n적 처치 시 " + (flag2 ? "50%" : "30%") + " 확률로 체력을 " + (flag2 ? "8" : "5") + " 회복합니다.") : ("[Reversed Penalty] Reduces Max Health by 15.\nDefeating an enemy has a " + (flag2 ? "50%" : "30%") + " chance to restore " + (flag2 ? "8" : "5") + " HP.")); } return true; case "CardEmpress": if (!flag) { reference = (flag3 ? ("최대 체력이 " + (flag2 ? "35" : "20") + " 증가합니다.\n피격 시 10초간 유지되는 " + (flag2 ? "30" : "15") + "의 보호막을 획득합니다 (재발동 쿨다운: " + (flag2 ? "12초" : "15초") + ").") : ("Increases Max Health by " + (flag2 ? "35" : "20") + ".\nUpon taking damage, grants " + (flag2 ? "30" : "15") + " Shield for 10 seconds (Cooldown: " + (flag2 ? "12s" : "15s") + ").")); } else { reference = (flag3 ? ("피격 시 주변 적들에게 매초 " + (flag2 ? "12" : "5") + "의 고정 피해를 주는 화염 오라를 10초간 활성화합니다 (재발동 쿨다운: " + (flag2 ? "12초" : "15초") + ").") : ("Upon taking damage, activates a Fire Aura for 10 seconds that deals " + (flag2 ? "12" : "5") + " Fixed Damage per second to nearby enemies (Cooldown: " + (flag2 ? "12s" : "15s") + ").")); } return true; case "CardEmperor": if (!flag) { reference = (flag3 ? ("물리 공격력이 " + (flag2 ? "50%" : "30%") + " 증가하고 기본 공격 시 10% 확률로 50%의 추가 물리 피해를 입힙니다.") : ("Increases Physical Attack by " + (flag2 ? "50%" : "30%") + " and normal attacks have a 10% chance to deal 50% additional Physical Damage.")); } else { reference = (flag3 ? ("[역방향] 물리 공격력이 15% 감소합니다.\n기본 공격 시 " + (flag2 ? "15%" : "10%") + " 확률로 적을 1.5초간 기절시키고 " + (flag2 ? "40" : "20") + "의 고정 피해를 입힙니다.") : ("[Reversed Penalty] Reduces Physical Attack by 15%.\nNormal attacks have a " + (flag2 ? "15%" : "10%") + " chance to stun the target for 1.5 seconds and deal " + (flag2 ? "40" : "20") + " Fixed Damage.")); } return true; case "CardHierophant": if (!flag) { reference = (flag3 ? ("받는 피해가 " + (flag2 ? "18%" : "10%") + " 감소하며 대시 시 3초간 받는 피해가 추가로 " + (flag2 ? "25%" : "15%") + " 감소합니다.") : ("Reduces damage taken by " + (flag2 ? "18%" : "10%") + ", and dashing reduces damage taken by an additional " + (flag2 ? "25%" : "15%") + " for 3 seconds.")); } else { reference = (flag3 ? ("[역방향] 받는 피해가 10% 증가합니다.\n물리 및 마법 공격력이 " + (flag2 ? "60%" : "35%") + " 증가합니다.") : ("[Reversed Penalty] Increases damage taken by 10%.\nIncreases Physical and Magic Attack by " + (flag2 ? "60%" : "35%") + ".")); } return true; case "CardLovers": if (!flag) { reference = (flag3 ? ("치명타 확률이 " + (flag2 ? "18%" : "10%") + " 증가하고 치명타 발생 시 3초간 이동속도가 " + (flag2 ? "25%" : "15%") + " 증가합니다.") : ("Increases Critical Chance by " + (flag2 ? "18%" : "10%") + ", and critical hits increase Movement Speed by " + (flag2 ? "25%" : "15%") + " for 3 seconds.")); } else { reference = (flag3 ? ("[역방향] 치명타 확률이 5% 감소합니다.\n치명타 발생 시 " + (flag2 ? "35%" : "20%") + " 확률로 적이 받는 피해를 3초간 " + (flag2 ? "35%" : "20%") + " 증가시킵니다.") : ("[Reversed Penalty] Reduces Critical Chance by 5%.\nCritical hits have a " + (flag2 ? "35%" : "20%") + " chance to make target take " + (flag2 ? "35%" : "20%") + " more damage for 3 seconds.")); } return true; case "CardChariot": if (!flag) { reference = (flag3 ? ("이동 속도가 " + (flag2 ? "35%" : "20%") + " 증가하고 공격 속도가 " + (flag2 ? "25%" : "15%") + " 증가합니다.") : ("Increases Movement Speed by " + (flag2 ? "35%" : "20%") + " and Attack Speed by " + (flag2 ? "25%" : "15%") + ".")); } else { reference = (flag3 ? ("[역방향] 이동 속도가 10% 감소합니다.\n가만히 서 있을 때 1.5초마다 물리 및 마법 공격력이 15% 증가합니다 (최대 " + (flag2 ? "75%" : "45%") + " 중첩, 이동 시 해제).") : ("[Reversed Penalty] Reduces Movement Speed by 10%.\nStanding still grants +15% Physical and Magic Attack every 1.5 seconds (Max " + (flag2 ? "75%" : "45%") + ", resets on move).")); } return true; case "CardJustice": if (!flag) { reference = (flag3 ? ("받는 피해가 " + (flag2 ? "10%" : "5%") + " 감소하고 피격 시 받은 피해의 " + (flag2 ? "100%" : "50%") + "를 고정 피해로 반사합니다.") : ("Reduces damage taken by " + (flag2 ? "10%" : "5%") + ", and reflects " + (flag2 ? "100%" : "50%") + " of damage taken back as Fixed Damage.")); } else { reference = (flag3 ? ("피격 시 " + (flag2 ? "50%" : "30%") + " 확률로 피해를 완전히 무효화하고 원래 피해의 " + (flag2 ? "3배" : "2배") + "를 고정 피해로 반사합니다.") : ("Upon taking damage, has a " + (flag2 ? "50%" : "30%") + " chance to negate the damage and reflect " + (flag2 ? "3x" : "2x") + " of the original damage back as Fixed Damage.")); } return true; case "CardHermit": if (!flag) { reference = (flag3 ? ("최대 체력이 " + (flag2 ? "25" : "15") + " 증가합니다.\n상점 아이템 가격이 30% 할인됩니다.") : ("Increases Max Health by " + (flag2 ? "25" : "15") + ".\nShop items are discounted by 30%.")); } else { reference = (flag3 ? ("공격력(물리/마법)이 " + (flag2 ? "40%" : "25%") + " 증가하고 상점 아이템 가격이 30% 할인됩니다.") : ("Increases Physical/Magic Attack by " + (flag2 ? "40%" : "25%") + ", and shop items are discounted by 30%.")); } return true; case "CardWheelOfFortune": if (!flag) { reference = (flag3 ? ("치명타 확률이 " + (flag2 ? "8%" : "5%") + " 증가하고 공격 시 " + (flag2 ? "10%" : "5%") + " 확률로 피해량이 " + (flag2 ? "2.5배" : "2배") + "로 증폭됩니다.") : ("Increases Critical Chance by " + (flag2 ? "8%" : "5%") + ", and attacking has a " + (flag2 ? "10%" : "5%") + " chance to amplify damage by " + (flag2 ? "2.5x" : "2x") + ".")); } else { reference = (flag3 ? ("공격 시 " + (flag2 ? "2%" : "1%") + " 확률로 일반 적을 즉사시킵니다. 보스 및 모험가 공격 시에는 " + (flag2 ? "1000" : "500") + "의 추가 고정 피해를 입힙니다.") : ("Attacking has a " + (flag2 ? "2%" : "1%") + " chance to instantly kill normal enemies, and deals " + (flag2 ? "1000" : "500") + " additional Fixed Damage to Bosses.")); } return true; case "CardStrength": if (!flag) { reference = (flag3 ? ("근접 공격 피해가 " + (flag2 ? "40%" : "25%") + " 증가하고 잃은 체력 1%당 물리 공격력이 " + (flag2 ? "1.0%" : "0.5%") + " 증가합니다.") : ("Increases Melee Damage by " + (flag2 ? "40%" : "25%") + " and increases Physical Attack by " + (flag2 ? "1.0%" : "0.5%") + " for every 1% of missing health.")); } else { reference = (flag3 ? ("[역방향] 물리 및 마법 공격력이 10% 감소합니다.\n단, 체력이 90% 이상일 때는 물리 및 마법 공격력이 " + (flag2 ? "125%" : "75%") + " 증가합니다.") : ("[Reversed Penalty] Reduces Physical and Magic Attack by 10%.\nHowever, if health is above 90%, increases Physical and Magic Attack by " + (flag2 ? "125%" : "75%") + ".")); } return true; case "CardMoon": if (!flag) { reference = (flag3 ? ("마법 공격력이 " + (flag2 ? "50%" : "30%") + " 증가합니다.") : ("Increases Magic Attack by " + (flag2 ? "50%" : "30%") + ".")); } else { reference = (flag3 ? ("[역방향] 마법 공격력이 10% 감소합니다.\n치명타 피해량이 " + (flag2 ? "50%" : "30%") + " 증가합니다.") : ("[Reversed Penalty] Reduces Magic Attack by 10%.\nIncreases Critical Damage by " + (flag2 ? "50%" : "30%") + ".")); } return true; case "CardSun": if (!flag) { reference = (flag3 ? ("물리 공격력이 " + (flag2 ? "50%" : "30%") + " 증가합니다.") : ("Increases Physical Attack by " + (flag2 ? "50%" : "30%") + ".")); } else { reference = (flag3 ? ("[역방향] 물리 공격력이 10% 감소합니다.\n기본 공격 속도가 " + (flag2 ? "50%" : "30%") + " 증가합니다.") : ("[Reversed Penalty] Reduces Physical Attack by 10%.\nIncreases Basic Attack Speed by " + (flag2 ? "50%" : "30%") + ".")); } return true; case "CardSupernova": if (!flag) { reference = (flag3 ? ("물리 및 마법 공격력이 " + (flag2 ? "120%" : "80%") + " 증가합니다.\n교대 시 넓은 범위에 " + (flag2 ? "300" : "150") + "의 고정 피해를 주는 초신성 폭발(아포칼립스)을 유발합니다 (쿨다운: 5초).") : ("Increases Physical and Magic Attack by " + (flag2 ? "120%" : "80%") + ".\nSwapping triggers a massive Supernova Blast dealing " + (flag2 ? "300" : "150") + " Fixed Damage (Cooldown: 5s).")); } else { reference = (flag3 ? ("[역방향] 물리 및 마법 공격력이 20% 감소합니다.\n교대 시 넓은 범위에 " + (flag2 ? "500" : "250") + "의 고정 피해를 주는 초신성 폭발(아포칼립스)을 유발합니다 (쿨다운: 5초).") : ("[Reversed Penalty] Reduces Physical and Magic Attack by 20%.\nSwapping triggers a massive Supernova Blast dealing " + (flag2 ? "500" : "250") + " Fixed Damage (Cooldown: 5s).")); } return true; default: return false; } case "flavor": if (flag) { reference = (flag3 ? "원래의 의미가 비틀려 그 반대의 운명이 계시됩니다. 그것이 꼭 파멸만을 뜻하지는 않을 것입니다." : "The original meaning is twisted, revealing the opposite destiny. This may not necessarily mean ruin."); } else { switch (text6) { case "CardFool": reference = (flag3 ? "새로운 시작과 무한한 가능성을 상징하는 카드." : "A card signifying new beginnings and boundless potential."); break; case "CardMagician": reference = (flag3 ? "구현과 기발함을 나타내는 카드." : "A card indicating manifestation and resourcefulness."); break; case "CardHighPriestess": reference = (flag3 ? "숨겨진 비밀과 직관으로 가득한 카드." : "A card filled with hidden secrets and intuition."); break; case "CardEmpress": reference = (flag3 ? "풍요와 대지, 그리고 보호의 기운을 담은 카드." : "A card carrying abundance, motherhood, and security."); break; case "CardEmperor": reference = (flag3 ? "권위와 질서, 지배를 상징하는 카드." : "A card representing authority, structure, and control."); break; case "CardHierophant": reference = (flag3 ? "정신적 인도와 전통의 수호를 의미하는 카드." : "A card showing spiritual guidance and tradition."); break; case "CardLovers": reference = (flag3 ? "조화와 관계, 그리고 선택을 속삭이는 카드." : "A card indicating harmony, connection, and choices."); break; case "CardChariot": reference = (flag3 ? "의지력과 정복, 그리고 기세를 떨치는 전차의 카드." : "A card depicting willpower, victory, and momentum."); break; case "CardJustice": reference = (flag3 ? "정확한 균형 and 인과응보의 법칙을 보여주는 카드." : "A card demonstrating balance, truth, and karma."); break; case "CardHermit": reference = (flag3 ? "성찰과 내적인 지혜를 추구하는 은둔자의 카드." : "A card indicating self-reflection and inner wisdom."); break; case "CardWheelOfFortune": reference = (flag3 ? "운명의 전환점 and 무작위한 행운을 가져다주는 카드." : "A card capturing luck, fate, and turning points."); break; case "CardStrength": reference = (flag3 ? "용기와 정신력, 그리고 강인한 의지를 상징하는 카드." : "A card embodying courage, inner power, and fortitude."); break; case "CardMoon": reference = (flag3 ? "비밀과 무의식, 그리고 환상을 비추는 밤의 카드." : "A card indicating mystery, subconsciousness, and dreams."); break; case "CardSun": reference = (flag3 ? "생명력과 활기, 그리고 눈부신 성공을 발산하는 태양의 카드." : "A card radiating vitality, joy, and success."); break; case "CardSupernova": reference = (flag3 ? "별이 붕괴하며 가장 화려한 최후와 시작을 맞이하는 초신성의 힘이 담긴 카드." : "A card capturing the ultimate collapse and birth of a star."); break; default: return false; } } return true; default: return false; } } } public static bool HasErrorCreator() { Character player = ChzzkCardSynergy.GetPlayer(); if ((Object)(object)player == (Object)null || player.playerComponents == null || player.playerComponents.inventory == null) { return false; } foreach (Item item in player.playerComponents.inventory.item.items) { if ((Object)(object)item != (Object)null && (((Object)item).name.Contains("TMTrainer") || ((Object)item).name.Contains("ErrorCreator"))) { return true; } } return false; } private static string GetStatNameKR(Kind kind) { if (kind == Kind.PhysicalAttackDamage) { return "물리공격력"; } if (kind == Kind.MagicAttackDamage) { return "마법공격력"; } if (kind == Kind.BasicAttackSpeed) { return "공격 속도"; } if (kind == Kind.SkillCooldownSpeed) { return "스킬 쿨다운 속도"; } if (kind == Kind.CriticalChance) { return "치명타 확률"; } if (kind == Kind.Health) { return "최대 체력"; } if (kind == Kind.MovementSpeed) { return "이동 속도"; } if (kind == Kind.TakingDamage) { return "받는 피해"; } return ((object)kind).ToString(); } private static Item GetRandomOriginalItem(Random rnd) { try { ReadOnlyCollection items = GearResource.instance.items; List list = new List(); foreach (ItemReference item in items) { if (item != null && !string.IsNullOrEmpty(((GearReference)item).name)) { string name = ((GearReference)item).name; if (!name.Contains("TMTrainer") && !name.Contains("ErrorCreator") && !name.StartsWith("Custom-") && !name.StartsWith("Glitched-")) { list.Add(item); } } } if (list.Count == 0) { return null; } ItemReference val = list[rnd.Next(list.Count)]; ItemRequest val2 = val.LoadAsync(); ((Request)(object)val2).WaitForCompletion(); if ((Object)(object)((Request)(object)val2).asset != (Object)null) { return ((Component)((Request)(object)val2).asset).GetComponent(); } } catch (Exception ex) { Debug.LogError((object)("[GetRandomOriginalItem] Error choosing random item: " + ex)); } return null; } public static void CopyItemEffects(Item target, Item source) { //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_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_0047: 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 //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Expected O, but got Unknown //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Expected O, but got Unknown //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Expected O, but got Unknown //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Expected O, but got Unknown //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Expected O, but got Unknown if ((Object)(object)target == (Object)null || (Object)(object)source == (Object)null) { return; } target.keyword1 = source.keyword1; target.keyword2 = source.keyword2; ((Gear)target)._stat = new Values(Array.Empty()); List list = new List(); if (((Gear)source)._stat != null && ((ReorderableArray)(object)((Gear)source)._stat).values != null) { list.AddRange(((ReorderableArray)(object)((Gear)source)._stat).values); } GlitchedStatAbility glitchedStatAbility = new GlitchedStatAbility(); glitchedStatAbility.stats = new Values(list.ToArray()); GameObject val = new GameObject("GlitchedStatAbilityAttacher", new Type[1] { typeof(AlwaysAbilityAttacher) }); val.transform.parent = ((Component)target).gameObject.transform; AlwaysAbilityAttacher component = val.GetComponent(); GameObject val2 = new GameObject("GlitchedStatAbilityComponent", new Type[1] { typeof(GlitchedStatAbilityComponent) }); val2.transform.parent = val.transform; GlitchedStatAbilityComponent component2 = val2.GetComponent(); FieldInfo fieldInfo = AccessTools.Field(typeof(GlitchedStatAbilityComponent), "_ability"); if (fieldInfo != null) { fieldInfo.SetValue(component2, glitchedStatAbility); } component._abilityComponent = (AbilityComponent)(object)component2; if (source._abilityAttacher != null) { GameObject container = ((SubcomponentArray)(object)source._abilityAttacher)._container; if ((Object)(object)container != (Object)null) { GameObject val3 = Object.Instantiate(container, ((Component)target).transform); ((Object)val3).name = "Ability Attacher"; AbilityAttacher[] componentsInChildren = val3.GetComponentsInChildren(true); target._abilityAttacher = new Subcomponents(); ((SubcomponentArray)(object)target._abilityAttacher)._container = val3; ((SubcomponentArray)(object)target._abilityAttacher)._components = componentsInChildren; } else if (((SubcomponentArray)(object)source._abilityAttacher)._components != null) { GameObject val4 = new GameObject("Ability Attacher"); val4.transform.parent = ((Component)target).gameObject.transform; List list2 = new List(); AbilityAttacher[] components = ((SubcomponentArray)(object)source._abilityAttacher)._components; foreach (AbilityAttacher val5 in components) { if (!((Object)(object)val5 == (Object)null)) { AbilityAttacher item = Object.Instantiate(val5, val4.transform); list2.Add(item); } } target._abilityAttacher = new Subcomponents(); ((SubcomponentArray)(object)target._abilityAttacher)._container = val4; ((SubcomponentArray)(object)target._abilityAttacher)._components = list2.ToArray(); } else { target._abilityAttacher = null; } } else { target._abilityAttacher = null; } if (target._abilityAttacher == null) { target._abilityAttacher = new Subcomponents(); ((SubcomponentArray)(object)target._abilityAttacher)._container = new GameObject("Ability Attacher"); ((SubcomponentArray)(object)target._abilityAttacher)._container.transform.parent = ((Component)target).gameObject.transform; ((SubcomponentArray)(object)target._abilityAttacher)._components = (AbilityAttacher[])(object)new AbilityAttacher[1] { (AbilityAttacher)component }; } else { AbilityAttacher[] components2 = ((SubcomponentArray)(object)target._abilityAttacher)._components; AbilityAttacher[] array = (AbilityAttacher[])(object)new AbilityAttacher[components2.Length + 1]; components2.CopyTo(array, 0); array[components2.Length] = (AbilityAttacher)(object)component; ((SubcomponentArray)(object)target._abilityAttacher)._components = array; } } public static void AppendItemEffects(Item target, Item source) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_0282: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Expected O, but got Unknown //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Expected O, but got Unknown if ((Object)(object)target == (Object)null || (Object)(object)source == (Object)null) { return; } List list = new List(); if (((Gear)source)._stat != null && ((ReorderableArray)(object)((Gear)source)._stat).values != null) { list.AddRange(((ReorderableArray)(object)((Gear)source)._stat).values); } AlwaysAbilityAttacher val = null; if (list.Count > 0) { GlitchedStatAbility glitchedStatAbility = new GlitchedStatAbility(); glitchedStatAbility.stats = new Values(list.ToArray()); GameObject val2 = new GameObject("GlitchedStatAbilityAttacher_Extra", new Type[1] { typeof(AlwaysAbilityAttacher) }); val2.transform.parent = ((Component)target).gameObject.transform; val = val2.GetComponent(); GameObject val3 = new GameObject("GlitchedStatAbilityComponent_Extra", new Type[1] { typeof(GlitchedStatAbilityComponent) }); val3.transform.parent = val2.transform; GlitchedStatAbilityComponent component = val3.GetComponent(); FieldInfo fieldInfo = AccessTools.Field(typeof(GlitchedStatAbilityComponent), "_ability"); if (fieldInfo != null) { fieldInfo.SetValue(component, glitchedStatAbility); } val._abilityComponent = (AbilityComponent)(object)component; } List list2 = new List(); if ((Object)(object)val != (Object)null) { list2.Add((AbilityAttacher)(object)val); } if (source._abilityAttacher != null) { GameObject container = ((SubcomponentArray)(object)source._abilityAttacher)._container; if ((Object)(object)container != (Object)null) { GameObject val4 = Object.Instantiate(container, ((Component)target).transform); ((Object)val4).name = "Ability Attacher Extra"; AbilityAttacher[] componentsInChildren = val4.GetComponentsInChildren(true); list2.AddRange(componentsInChildren); } else if (((SubcomponentArray)(object)source._abilityAttacher)._components != null) { GameObject val5 = new GameObject("Ability Attacher Extra"); val5.transform.parent = ((Component)target).gameObject.transform; AbilityAttacher[] components = ((SubcomponentArray)(object)source._abilityAttacher)._components; foreach (AbilityAttacher val6 in components) { if (!((Object)(object)val6 == (Object)null)) { AbilityAttacher item = Object.Instantiate(val6, val5.transform); list2.Add(item); } } } } if (list2.Count > 0) { if (target._abilityAttacher == null) { target._abilityAttacher = new Subcomponents(); ((SubcomponentArray)(object)target._abilityAttacher)._container = new GameObject("Ability Attacher"); ((SubcomponentArray)(object)target._abilityAttacher)._container.transform.parent = ((Component)target).gameObject.transform; ((SubcomponentArray)(object)target._abilityAttacher)._components = list2.ToArray(); } else { AbilityAttacher[] array = (AbilityAttacher[])(((object)((SubcomponentArray)(object)target._abilityAttacher)._components) ?? ((object)new AbilityAttacher[0])); AbilityAttacher[] array2 = (AbilityAttacher[])(object)new AbilityAttacher[array.Length + list2.Count]; array.CopyTo(array2, 0); list2.CopyTo(array2, array.Length); ((SubcomponentArray)(object)target._abilityAttacher)._components = array2; } } } public static void GlitchItem(Item item) { //IL_0481: 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_0306: Expected O, but got Unknown //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Expected O, but got Unknown //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Expected O, but got Unknown //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Expected O, but got Unknown //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Expected O, but got Unknown //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Expected O, but got Unknown if ((Object)(object)item == (Object)null || ((Object)item).name.Contains("TMTrainer") || ((Object)item).name.Contains("ErrorCreator") || (Object)(object)((Component)item).gameObject.GetComponent() != (Object)null) { return; } string text = ((Object)((Component)item).gameObject).name.Replace("(Clone)", "").Trim(); Sprite val = ((Gear)item).icon; if ((Object)(object)val == (Object)null) { val = ((Gear)item).thumbnail; } if ((Object)(object)val == (Object)null) { val = GearResource.instance.GetGearThumbnail(text); } Sprite glitchedIcon = CustomSpriteHelper.CreateGlitchedSprite(val); Sprite val2 = ((Gear)item).thumbnail; if ((Object)(object)val2 == (Object)null) { val2 = ((Gear)item).icon; } if ((Object)(object)val2 == (Object)null) { val2 = GearResource.instance.GetGearThumbnail(text); } Sprite glitchedThumbnail = CustomSpriteHelper.CreateGlitchedSprite(val2); Sprite val3 = null; if ((Object)(object)((Gear)item).dropped != (Object)null && (Object)(object)((Gear)item).dropped.spriteRenderer != (Object)null) { val3 = ((Gear)item).dropped.spriteRenderer.sprite; } if ((Object)(object)val3 == (Object)null && (Object)(object)((Gear)item).dropped != (Object)null) { SpriteRenderer componentInChildren = ((Component)((Gear)item).dropped).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { val3 = componentInChildren.sprite; } } if ((Object)(object)val3 == (Object)null) { val3 = val; } Sprite val4 = CustomSpriteHelper.CreateGlitchedSprite(val3); GlitchedItemMarker glitchedItemMarker = ((Component)item).gameObject.GetComponent(); if ((Object)(object)glitchedItemMarker == (Object)null) { glitchedItemMarker = ((Component)item).gameObject.AddComponent(); } glitchedItemMarker.glitchedIcon = glitchedIcon; glitchedItemMarker.glitchedThumbnail = glitchedThumbnail; glitchedItemMarker.glitchedDroppedSprite = val4; if ((Object)(object)((Gear)item).dropped != (Object)null) { if ((Object)(object)((Gear)item).dropped.spriteRenderer != (Object)null) { ((Gear)item).dropped.spriteRenderer.sprite = val4; } Animator val5 = ((Component)((Gear)item).dropped).gameObject.GetComponent() ?? ((Component)((Gear)item).dropped).gameObject.GetComponentInChildren(); if ((Object)(object)val5 != (Object)null) { ((Behaviour)val5).enabled = false; } } Random rnd = new Random(); Item randomOriginalItem = GetRandomOriginalItem(rnd); if ((Object)(object)randomOriginalItem != (Object)null) { glitchedItemMarker.copiedItemName = ((Object)((Component)randomOriginalItem).gameObject).name.Replace("(Clone)", "").Trim(); CopyItemEffects(item, randomOriginalItem); } else { glitchedItemMarker.copiedItemName = ""; List list = new List(); if (((Gear)item)._stat != null && ((ReorderableArray)(object)((Gear)item)._stat).values != null) { list.AddRange(((ReorderableArray)(object)((Gear)item)._stat).values); } ((Gear)item)._stat = new Values(Array.Empty()); GlitchedStatAbility glitchedStatAbility = new GlitchedStatAbility(); glitchedStatAbility.stats = new Values(list.ToArray()); GameObject val6 = new GameObject("GlitchedStatAbilityAttacher", new Type[1] { typeof(AlwaysAbilityAttacher) }); val6.transform.parent = ((Component)item).gameObject.transform; AlwaysAbilityAttacher component = val6.GetComponent(); GameObject val7 = new GameObject("GlitchedStatAbilityComponent", new Type[1] { typeof(GlitchedStatAbilityComponent) }); val7.transform.parent = val6.transform; GlitchedStatAbilityComponent component2 = val7.GetComponent(); FieldInfo fieldInfo = AccessTools.Field(typeof(GlitchedStatAbilityComponent), "_ability"); if (fieldInfo != null) { fieldInfo.SetValue(component2, glitchedStatAbility); } component._abilityComponent = (AbilityComponent)(object)component2; if (item._abilityAttacher == null) { item._abilityAttacher = new Subcomponents(); ((SubcomponentArray)(object)item._abilityAttacher)._container = new GameObject("Ability Attacher"); ((SubcomponentArray)(object)item._abilityAttacher)._container.transform.parent = ((Component)item).gameObject.transform; ((SubcomponentArray)(object)item._abilityAttacher)._components = (AbilityAttacher[])(object)new AbilityAttacher[1] { (AbilityAttacher)component }; } else { AbilityAttacher[] components = ((SubcomponentArray)(object)item._abilityAttacher)._components; AbilityAttacher[] array = (AbilityAttacher[])(object)new AbilityAttacher[components.Length + 1]; components.CopyTo(array, 0); array[components.Length] = (AbilityAttacher)(object)component; ((SubcomponentArray)(object)item._abilityAttacher)._components = array; } } ((Gear)item)._rarity = (Rarity)0; List list2 = new List(); TMTrainerAbility tMTrainerAbility = GenerateRandomActionAbility(rnd); list2.Add(tMTrainerAbility.effectDescription); AttachAbilityToItem(item, tMTrainerAbility); TMTrainerAbility tMTrainerAbility2 = GenerateRandomPassiveAbility(rnd); if (tMTrainerAbility2.action == GlitchedAction.PassiveCopyItem) { Item randomOriginalItem2 = GetRandomOriginalItem(rnd); if ((Object)(object)randomOriginalItem2 != (Object)null) { string extraCopiedItemName = (glitchedItemMarker.extraCopiedItemName = ((Object)((Component)randomOriginalItem2).gameObject).name.Replace("(Clone)", "").Trim()); AppendItemEffects(item, randomOriginalItem2); tMTrainerAbility2.effectDescription = GetAbilityDescription(tMTrainerAbility2.trigger, tMTrainerAbility2.action, tMTrainerAbility2.value1, tMTrainerAbility2.value2, extraCopiedItemName); } } list2.Add(tMTrainerAbility2.effectDescription); AttachAbilityToItem(item, tMTrainerAbility2); string text2 = Localization.GetLocalizedString("item/" + text + "/name"); if (string.IsNullOrEmpty(text2) || text2 == "item/" + text + "/name") { text2 = text; } string text3 = "Glitched-" + text + "-" + ((Object)item).GetInstanceID(); ((Object)((Component)item).gameObject).name = text3; string key = "item/" + text3 + "/name"; string key2 = "item/" + text3 + "/desc"; string key3 = "item/" + text3 + "/flavor"; string value = GenerateGlitchedName(text2, rnd); string value2 = ((PluginItems.ShowGlitchedEffects == null || !PluginItems.ShowGlitchedEffects.Value) ? GenerateGlitchedDescription(rnd) : string.Join("\n", list2)); string value3 = GenerateGlitchedFlavor(rnd); GlitchedStrings[key] = value; GlitchedStrings[key2] = value2; GlitchedStrings[key3] = value3; } public static void ReapplyGlitchedItemIfSaved(Item item) { } public static void AttachAbilityToItem(Item item, TMTrainerAbility glitchedAbility) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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 GameObject val = new GameObject("GlitchedAbilityAttacher", new Type[1] { typeof(AlwaysAbilityAttacher) }); val.transform.parent = ((Component)item).gameObject.transform; AlwaysAbilityAttacher component = val.GetComponent(); GameObject val2 = new GameObject("GlitchedAbilityComponent", new Type[1] { typeof(TMTrainerAbilityComponent) }); val2.transform.parent = val.transform; TMTrainerAbilityComponent component2 = val2.GetComponent(); FieldInfo fieldInfo = AccessTools.Field(typeof(TMTrainerAbilityComponent), "_ability"); if (fieldInfo != null) { fieldInfo.SetValue(component2, glitchedAbility); } component._abilityComponent = (AbilityComponent)(object)component2; if (item._abilityAttacher == null) { item._abilityAttacher = new Subcomponents(); ((SubcomponentArray)(object)item._abilityAttacher)._container = new GameObject("Ability Attacher"); ((SubcomponentArray)(object)item._abilityAttacher)._container.transform.parent = ((Component)item).gameObject.transform; ((SubcomponentArray)(object)item._abilityAttacher)._components = (AbilityAttacher[])(object)new AbilityAttacher[1] { (AbilityAttacher)component }; } else { AbilityAttacher[] components = ((SubcomponentArray)(object)item._abilityAttacher)._components; AbilityAttacher[] array = (AbilityAttacher[])(object)new AbilityAttacher[components.Length + 1]; components.CopyTo(array, 0); array[components.Length] = (AbilityAttacher)(object)component; ((SubcomponentArray)(object)item._abilityAttacher)._components = array; } } public static string GetAbilityDescription(GlitchedTrigger trigger, GlitchedAction action, float val1, float val2, string extraCopiedItemName = "") { string text = ""; string text2 = ""; if (PluginItems.IsKorean()) { switch (trigger) { case GlitchedTrigger.OnAttack: text = "공격 시"; break; case GlitchedTrigger.OnSkill: text = "스킬 사용 시"; break; case GlitchedTrigger.OnHit: text = "피격 시"; break; case GlitchedTrigger.OnDash: text = "대시 시"; break; case GlitchedTrigger.OnSwap: text = "교대 시"; break; case GlitchedTrigger.OnPeriodic: text = $"{val2}초마다"; break; case GlitchedTrigger.OnKill: text = "적 처치 시"; break; case GlitchedTrigger.OnPassive: text = "패시브"; break; } switch (action) { case GlitchedAction.AddDamage: text2 = $"적에게 {val1} 추가 피해"; break; case GlitchedAction.Shield: text2 = $"보호막 {val1} 생성"; break; case GlitchedAction.Heal: text2 = $"체력 {val1} 회복"; break; case GlitchedAction.StatBoost: text2 = $"{val2}초간 공속 또는 쿨감 {val1}% 증가"; break; case GlitchedAction.SpawnGold: text2 = $"골드 +{val1} 획득"; break; case GlitchedAction.SpawnBone: text2 = $"뼈다귀 +{val1} 획득"; break; case GlitchedAction.Explosion: text2 = $"주변 {val1} 범위 데미지 유발"; break; case GlitchedAction.SelfExplosion: text2 = $"자폭을 유발하여 주변 적에게 {val1} 피해, 자신에게 3~10 피해"; break; case GlitchedAction.StatDebuff: text2 = $"{val2}초간 공속 또는 쿨감 {val1}% 감소"; break; case GlitchedAction.LoseGold: text2 = $"골드 -{val1} 강제 손실"; break; case GlitchedAction.CastRandomSkill: text2 = "현재 스컬의 무작위 스킬 발동"; break; case GlitchedAction.UseRandomQuintessence: text2 = "무작위 정수 드롭"; break; case GlitchedAction.SpawnEnemy: text2 = "주변에 무작위 몬스터 소환"; break; case GlitchedAction.SpawnItem: text2 = "무작위 아이템 드롭"; break; case GlitchedAction.Freeze: text2 = "주변 적들 일시 빙결"; break; case GlitchedAction.Teleport: text2 = "무작위 위치로 공간 이동"; break; case GlitchedAction.SpawnTemporarySpirit: text2 = $"일시적 무작위 정령 소환 ({val1}초간)"; break; case GlitchedAction.PassiveBonusDamage: text2 = $"공격 시 {val1} 추가 고정 피해"; break; case GlitchedAction.PassiveSummonSpirit: text2 = "무작위 정령 소령"; break; case GlitchedAction.PassiveStatBoost: { string arg = "공격 속도"; switch ((int)val2) { case 1: arg = "물리공격력"; break; case 2: arg = "마법공격력"; break; case 3: arg = "이동 속도"; break; } text2 = $"상시 {arg} {val1}% 증가"; break; } case GlitchedAction.PassiveCopyItem: if (!string.IsNullOrEmpty(extraCopiedItemName)) { string text3 = Localization.GetLocalizedString("item/" + extraCopiedItemName + "/name"); if (string.IsNullOrEmpty(text3) || text3 == "item/" + extraCopiedItemName + "/name") { text3 = extraCopiedItemName; } text2 = "아이템 [" + text3 + "] 효과 획득"; } else { text2 = "무작위 아이템 효과 획득"; } break; } if (trigger == GlitchedTrigger.OnPassive) { return text2; } return text + " " + text2; } switch (trigger) { case GlitchedTrigger.OnAttack: text = "On Attack,"; break; case GlitchedTrigger.OnSkill: text = "On Skill,"; break; case GlitchedTrigger.OnHit: text = "On Hit,"; break; case GlitchedTrigger.OnDash: text = "On Dash,"; break; case GlitchedTrigger.OnSwap: text = "On Swap,"; break; case GlitchedTrigger.OnPeriodic: text = $"Every {val2}s,"; break; case GlitchedTrigger.OnKill: text = "On Kill,"; break; case GlitchedTrigger.OnPassive: text = "Passive:"; break; } switch (action) { case GlitchedAction.AddDamage: text2 = $"deals {val1} extra damage to enemies"; break; case GlitchedAction.Shield: text2 = $"grants {val1} shield"; break; case GlitchedAction.Heal: text2 = $"heals {val1} HP"; break; case GlitchedAction.StatBoost: text2 = $"increases attack speed or CD speed by {val1}% for {val2}s"; break; case GlitchedAction.SpawnGold: text2 = $"gains +{val1} gold"; break; case GlitchedAction.SpawnBone: text2 = $"gains +{val1} bone"; break; case GlitchedAction.Explosion: text2 = $"triggers an explosion dealing {val1} damage"; break; case GlitchedAction.SelfExplosion: text2 = $"triggers self-explosion dealing {val1} damage to enemies and 3~10 damage to self"; break; case GlitchedAction.StatDebuff: text2 = $"reduces attack speed or CD speed by {val1}% for {val2}s"; break; case GlitchedAction.LoseGold: text2 = $"loses -{val1} gold"; break; case GlitchedAction.CastRandomSkill: text2 = "casts a random skill of current skull"; break; case GlitchedAction.UseRandomQuintessence: text2 = "uses a random quintessence"; break; case GlitchedAction.SpawnEnemy: text2 = "spawns a random normal enemy"; break; case GlitchedAction.SpawnItem: text2 = "drops a random item"; break; case GlitchedAction.Freeze: text2 = "freezes nearby enemies temporarily"; break; case GlitchedAction.Teleport: text2 = "teleports to a random position"; break; case GlitchedAction.SpawnTemporarySpirit: text2 = $"summons a temporary spirit for {val1}s"; break; case GlitchedAction.PassiveBonusDamage: text2 = $"attacks deal +{val1} fixed damage"; break; case GlitchedAction.PassiveSummonSpirit: text2 = "summons a permanent random spirit"; break; case GlitchedAction.PassiveStatBoost: { string arg2 = "Attack Speed"; switch ((int)val2) { case 1: arg2 = "Physical Attack"; break; case 2: arg2 = "Magic Attack"; break; case 3: arg2 = "Movement Speed"; break; } text2 = $"increases {arg2} by {val1}%"; break; } case GlitchedAction.PassiveCopyItem: if (!string.IsNullOrEmpty(extraCopiedItemName)) { string text4 = Localization.GetLocalizedString("item/" + extraCopiedItemName + "/name"); if (string.IsNullOrEmpty(text4) || text4 == "item/" + extraCopiedItemName + "/name") { text4 = extraCopiedItemName; } text2 = "gains Item [" + text4 + "] effects"; } else { text2 = "gains a random item effect"; } break; } return text + " " + text2; } private static TMTrainerAbility GenerateRandomActionAbility(Random rnd) { GlitchedTrigger[] array = new GlitchedTrigger[7] { GlitchedTrigger.OnAttack, GlitchedTrigger.OnSkill, GlitchedTrigger.OnHit, GlitchedTrigger.OnDash, GlitchedTrigger.OnSwap, GlitchedTrigger.OnPeriodic, GlitchedTrigger.OnKill }; GlitchedAction[] array2 = new GlitchedAction[13] { GlitchedAction.AddDamage, GlitchedAction.Shield, GlitchedAction.Heal, GlitchedAction.SpawnGold, GlitchedAction.SpawnBone, GlitchedAction.Explosion, GlitchedAction.SelfExplosion, GlitchedAction.LoseGold, GlitchedAction.CastRandomSkill, GlitchedAction.SpawnEnemy, GlitchedAction.SpawnItem, GlitchedAction.Freeze, GlitchedAction.SpawnTemporarySpirit }; GlitchedTrigger glitchedTrigger = array[rnd.Next(array.Length)]; GlitchedAction glitchedAction = array2[rnd.Next(array2.Length)]; if (glitchedAction == GlitchedAction.SpawnTemporarySpirit && rnd.Next(100) < 80) { glitchedAction = array2[rnd.Next(array2.Length)]; } float num = 0f; float num2 = 0f; if (glitchedTrigger == GlitchedTrigger.OnPeriodic) { num = 100f; num2 = rnd.Next(3, 10); } else { num = 100f; num2 = 0.5f; } switch (glitchedAction) { case GlitchedAction.AddDamage: num = rnd.Next(15, 61); break; case GlitchedAction.Shield: num = rnd.Next(10, 41); num2 = rnd.Next(8, 16); break; case GlitchedAction.Heal: num = rnd.Next(2, 9); num2 = rnd.Next(10, 21); break; case GlitchedAction.SpawnGold: num = rnd.Next(15, 51); num2 = rnd.Next(5, 16); break; case GlitchedAction.SpawnBone: num = rnd.Next(1, 4); num2 = rnd.Next(10, 26); break; case GlitchedAction.Explosion: num = rnd.Next(20, 81); num2 = rnd.Next(6, 16); break; case GlitchedAction.SelfExplosion: num = rnd.Next(50, 121); num2 = rnd.Next(8, 19); break; case GlitchedAction.LoseGold: num = rnd.Next(5, 21); num2 = rnd.Next(5, 16); break; case GlitchedAction.CastRandomSkill: num = 0f; num2 = rnd.Next(5, 16); break; case GlitchedAction.UseRandomQuintessence: num = 0f; num2 = rnd.Next(10, 26); break; case GlitchedAction.SpawnEnemy: num = 0f; num2 = rnd.Next(5, 16); break; case GlitchedAction.SpawnItem: num = 0f; num2 = rnd.Next(10, 26); break; case GlitchedAction.Freeze: num = 0f; num2 = rnd.Next(5, 16); break; case GlitchedAction.Teleport: num = 0f; num2 = rnd.Next(5, 16); break; case GlitchedAction.SpawnTemporarySpirit: num = 15f; num2 = rnd.Next(15, 30); break; } return new TMTrainerAbility { trigger = glitchedTrigger, action = glitchedAction, value1 = num, value2 = num2, effectDescription = GetAbilityDescription(glitchedTrigger, glitchedAction, num, num2) }; } private static TMTrainerAbility GenerateRandomPassiveAbility(Random rnd) { GlitchedTrigger trigger = GlitchedTrigger.OnPassive; int num = rnd.Next(1000); GlitchedAction glitchedAction = ((num < 3) ? GlitchedAction.PassiveSummonSpirit : ((num >= 5) ? GlitchedAction.PassiveCopyItem : GlitchedAction.PassiveStatBoost)); float num2 = 0f; float num3 = 0f; switch (glitchedAction) { case GlitchedAction.PassiveSummonSpirit: num2 = 0f; break; case GlitchedAction.PassiveStatBoost: num2 = rnd.Next(10, 31); num3 = rnd.Next(4); break; case GlitchedAction.PassiveCopyItem: num2 = 0f; num3 = 0f; break; case GlitchedAction.None: num2 = 0f; num3 = 0f; break; } return new TMTrainerAbility { trigger = trigger, action = glitchedAction, value1 = num2, value2 = num3, effectDescription = GetAbilityDescription(trigger, glitchedAction, num2, num3) }; } private static string GenerateGlitchedName(string originalName, Random rnd) { string[] array = new string[5] { "ERR_", "GLITCH_", "SYS_ERR_", "TMT_", "CRASH_" }; string[] array2 = new string[7] { "0x00", "0xFF", "NaN", "null", "404", "500", "0x3B" }; char[] array3 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+{}|:<>?".ToCharArray(); string text = ""; for (int i = 0; i < rnd.Next(3, 7); i++) { text += array3[rnd.Next(array3.Length)]; } return "" + array[rnd.Next(array.Length)] + text + "_" + array2[rnd.Next(array2.Length)] + ""; } private static string GenerateGlitchedFlavor(Random rnd) { string[] array = new string[7] { "S\u0337y\u0337s\u0337t\u0337e\u0337m\u0337 \u0337E\u0337r\u0337r\u0337o\u0337r\u0337:\u0337 \u0337C\u0337o\u0337r\u0337r\u0337u\u0337p\u0337t\u0337e\u0337d\u0337", "0x00000000 -> null reference exception", "\u0338 Ȯ Ȯϰ ΰ Ե ΰ", "E\u0334R\u0334R\u0334O\u0334R\u0334 \u0334F\u0334O\u0334U\u0334N\u0334D\u0334", "?\ufffd\ufe0f System.NullReferenceException: Object reference not set to an instance of an object.", "TMTrainer active: data overwritten", "D\u0335A\u0334T\u0334A\u0334 \u0335L\u0338E\u0335A\u0338K\u0335 \u0335D\u0336E\u0336T\u0336E\u0336C\u0336T\u0336E\u0336D\u0336" }; return array[rnd.Next(array.Length)]; } private static string GenerateGlitchedDescription(Random rnd) { string[] array = new string[15] { "D\u0335A\u0334T\u0334A\u0334 \u0335L\u0338E\u0335A\u0338K\u0335 \u0335D\u0336E\u0336T\u0336E\u0336C\u0336T\u0336E\u0336D\u0336", "System.NullReferenceException: Object reference not set...", " at Characters.Gear.Items.Item.Activate()", " at Characters.Player.Inventory.Update()", "0x00000000 -> 0xFFFFFFFF (Null)", "Error code: 404 Not Found", "C\u0337o\u0337r\u0337r\u0337u\u0337p\u0337t\u0337e\u0337d\u0337 \u0337S\u0337e\u0337c\u0337t\u0337o\u0337r\u0337 \u03370\u0337x\u03377\u0337F\u0337", "Illegal operation in thread 0x3B", "FATAL ERROR: Memory corruption at 0x002B3A", "ÿØÿà JFIF ` ` ÿÛ C", "I\u0336n\u0336s\u0336c\u0336r\u0336i\u0336p\u0336t\u0336i\u0336o\u0336n\u0336 \u0336D\u0336a\u0336t\u0336a\u0336 \u0336L\u0336o\u0336s\u0336t\u0336", "WARNING: Stack overflow in SynergyEngine", " [0x00] unknown opcode 0xFE", " [0x01] register overflow", " [0x02] data segment mismatch" }; int num = rnd.Next(3, 7); List list = new List(); for (int i = 0; i < num; i++) { list.Add(array[rnd.Next(array.Length)]); } char[] array2 = "?\ufffd▒?\ufffd█?\ufffd\ufffd??\ufffd□?\ufffd▼?\ufffd●?\ufffd☆?\ufffd☣?\ufffd⚓?\ufffd⚙?\ufffd\ufffd?".ToCharArray(); string text = ""; for (int j = 0; j < rnd.Next(10, 30); j++) { text += array2[rnd.Next(array2.Length)]; } list.Add("" + text + ""); return string.Join("\n", list); } [HarmonyPostfix] [HarmonyPatch(typeof(LevelManager), "DropItem", new Type[] { typeof(ItemRequest), typeof(Vector3) })] private static void DropItem_Postfix1(ref Item __result) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__result != (Object)null) { Debug.Log((object)$"[ChzzkSkul] Spawned Item (via ItemRequest): {((Object)__result).name} (Rarity: {((Gear)__result).rarity})"); if (HasErrorCreator()) { GlitchItem(__result); } } } [HarmonyPostfix] [HarmonyPatch(typeof(LevelManager), "DropItem", new Type[] { typeof(Item), typeof(Vector3) })] private static void DropItem_Postfix2(ref Item __result) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__result != (Object)null) { Debug.Log((object)$"[ChzzkSkul] Spawned Item (via Item instance): {((Object)__result).name} (Rarity: {((Gear)__result).rarity})"); if (HasErrorCreator()) { GlitchItem(__result); } } } [HarmonyPostfix] [HarmonyPatch(typeof(LevelManager), "DropGear", new Type[] { typeof(GearRequest), typeof(Vector3) })] private static void DropGear_Postfix(ref Gear __result) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__result != (Object)null)) { return; } Gear obj = __result; Item val = (Item)(object)((obj is Item) ? obj : null); if (val != null) { Debug.Log((object)$"[ChzzkSkul] Spawned Item (via DropGear): {((Object)val).name} (Rarity: {((Gear)val).rarity})"); if (HasErrorCreator()) { GlitchItem(val); } } else { Debug.Log((object)("[ChzzkSkul] Spawned Gear (Other, via DropGear): " + ((Object)__result).name + " (Type: " + ((object)__result).GetType().Name + ")")); } } [HarmonyPrefix] [HarmonyPatch(typeof(Item), "OnEquipped")] private static void Item_OnEquipped_Prefix(Item __instance) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)__instance != (Object)null) { Debug.Log((object)$"[ChzzkSkul] Item Equipped: {((Object)__instance).name} (Rarity: {((Gear)__instance).rarity})"); } ReapplyGlitchedItemIfSaved(__instance); } catch (Exception arg) { Debug.LogError((object)$"[CustomGearsPatch] Error in Item_OnEquipped_Prefix: {arg}"); } } public static void ExpandInventoryIfNeeded(Item equippingItem = null) { } [HarmonyPrefix] [HarmonyPatch(typeof(Spirit), "Update")] public static bool Spirit_Update_Prefix(Spirit __instance) { //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null) { return true; } try { Character player = ChzzkCardSynergy.GetPlayer(); if ((Object)(object)player != (Object)null) { if ((Object)(object)((AbilityAttacher)__instance).owner == (Object)null || (Object)(object)((AbilityAttacher)__instance).owner != (Object)(object)player || (Object)(object)__instance.targetPosition == (Object)null) { ((AbilityAttacher)__instance).Initialize(player); __instance.targetPosition = ((Component)player).transform; __instance.Attach(); ((AbilityAttacher)__instance).StartAttach(); } } else if ((Object)(object)((AbilityAttacher)__instance).owner == (Object)null || (Object)(object)__instance.targetPosition == (Object)null) { Object.Destroy((Object)(object)((Component)__instance).gameObject); return false; } if ((Object)(object)__instance.targetPosition == (Object)null || (Object)(object)((AbilityAttacher)__instance).owner == (Object)null) { Object.Destroy((Object)(object)((Component)__instance).gameObject); return false; } Vector3 position = __instance.targetPosition.position; CharacterChronometer chronometer = ((AbilityAttacher)__instance).owner.chronometer; if (chronometer == null || chronometer.master == null) { Object.Destroy((Object)(object)((Component)__instance).gameObject); return false; } float deltaTime = ((ChronometerBase)chronometer.master).deltaTime; } catch { try { Object.Destroy((Object)(object)((Component)__instance).gameObject); } catch { } return false; } return true; } [HarmonyPostfix] [HarmonyPatch(typeof(Item), "OnEquipped")] public static void Item_OnEquipped_Postfix(Item __instance) { if (!((Object)(object)__instance != (Object)null) || !((Object)__instance).name.Equals("Custom-IdolOfTheOtherworld", StringComparison.OrdinalIgnoreCase)) { return; } try { IdolOfTheOtherworldBehavior componentInChildren = ((Component)__instance).GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { ((Component)componentInChildren).gameObject.SetActive(true); ((Behaviour)componentInChildren).enabled = true; ((Component)__instance).gameObject.SetActive(true); Debug.Log((object)"[CustomGearsPatch] Explicitly activated IdolOfTheOtherworld and its behavior on Equip!"); } } catch (Exception ex) { Debug.LogError((object)("[CustomGearsPatch] Error in Item_OnEquipped_Postfix for IdolOfTheOtherworld: " + ex)); } } [HarmonyPrefix] [HarmonyPatch(typeof(DroppedGear), "InteractWith")] public static void DroppedGear_InteractWith_Prefix() { try { ExpandInventoryIfNeeded(); } catch (Exception ex) { Debug.LogError((object)("[DroppedGear_InteractWith_Prefix] Error: " + ex)); } } } public static class GlitchedItemHelper { public static void RebindAllTransforms(object obj, Character player, HashSet visited = null) { } } public class GlitchedItemMarker : MonoBehaviour { public Sprite glitchedIcon; public Sprite glitchedThumbnail; public Sprite glitchedDroppedSprite; public string copiedItemName; public string extraCopiedItemName; } [HarmonyPatch] public class GlitchedSpriteInterceptor { [HarmonyPrefix] [HarmonyPatch(typeof(Gear), "get_icon")] private static bool GetIcon_Prefix(Gear __instance, ref Sprite __result) { GlitchedItemMarker component = ((Component)__instance).gameObject.GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.glitchedIcon != (Object)null) { __result = component.glitchedIcon; return false; } if (((Object)__instance).name != null && ((Object)__instance).name.StartsWith("Custom-")) { string cleanName = ((Object)__instance).name.Replace("(Clone)", "").Trim(); CustomItemReference customItemReference = CustomItems.Items.FirstOrDefault((CustomItemReference i) => i.name == cleanName); if (customItemReference != null && (Object)(object)((GearReference)customItemReference).icon != (Object)null) { __result = ((GearReference)customItemReference).icon; return false; } CustomWeaponReference customWeaponReference = CustomSkulls.Skulls.FirstOrDefault((CustomWeaponReference w) => w.name == cleanName); if (customWeaponReference != null && (Object)(object)((GearReference)customWeaponReference).icon != (Object)null) { __result = ((GearReference)customWeaponReference).icon; return false; } } return true; } [HarmonyPrefix] [HarmonyPatch(typeof(Gear), "get_thumbnail")] private static bool GetThumbnail_Prefix(Gear __instance, ref Sprite __result) { GlitchedItemMarker component = ((Component)__instance).gameObject.GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.glitchedThumbnail != (Object)null) { __result = component.glitchedThumbnail; return false; } if (((Object)__instance).name != null && ((Object)__instance).name.StartsWith("Custom-")) { string cleanName = ((Object)__instance).name.Replace("(Clone)", "").Trim(); CustomItemReference customItemReference = CustomItems.Items.FirstOrDefault((CustomItemReference i) => i.name == cleanName); if (customItemReference != null && (Object)(object)((GearReference)customItemReference).thumbnail != (Object)null) { __result = ((GearReference)customItemReference).thumbnail; return false; } CustomWeaponReference customWeaponReference = CustomSkulls.Skulls.FirstOrDefault((CustomWeaponReference w) => w.name == cleanName); if (customWeaponReference != null && (Object)(object)((GearReference)customWeaponReference).thumbnail != (Object)null) { __result = ((GearReference)customWeaponReference).thumbnail; return false; } } return true; } } [HarmonyPatch] public class DroppedGearSpriteFix { [HarmonyPrefix] [HarmonyPatch(typeof(DroppedGear), "Initialize", new Type[] { typeof(Gear) })] private static void Initialize_Prefix(Gear gear) { if (!((Object)(object)gear == (Object)null)) { Item val = (Item)(object)((gear is Item) ? gear : null); if (val != null && CustomGearsPatch.HasErrorCreator()) { CustomGearsPatch.GlitchItem(val); } } } [HarmonyPostfix] [HarmonyPatch(typeof(DroppedGear), "Initialize", new Type[] { typeof(Gear) })] private static void Initialize_Postfix(DroppedGear __instance, Gear gear) { if ((Object)(object)gear == (Object)null) { return; } if ((Object)(object)((Component)__instance).gameObject.GetComponent() == (Object)null) { HermitDiscountMarker hermitDiscountMarker = ((Component)__instance).gameObject.AddComponent(); if (__instance.price > 0) { hermitDiscountMarker.originalPrice = __instance.price; } } GlitchedItemMarker component = ((Component)gear).gameObject.GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.glitchedDroppedSprite != (Object)null) { if ((Object)(object)__instance.spriteRenderer != (Object)null) { __instance.spriteRenderer.sprite = component.glitchedDroppedSprite; Animator val = ((Component)__instance).gameObject.GetComponent() ?? ((Component)__instance).gameObject.GetComponentInChildren(); if ((Object)(object)val != (Object)null) { ((Behaviour)val).enabled = false; } Debug.Log((object)("[DroppedGearSpriteFix] Forced glitched world sprite on DroppedGear for " + ((Object)gear).name)); } } else { if (((Object)gear).name == null || !((Object)gear).name.StartsWith("Custom-")) { return; } string cleanName = ((Object)gear).name.Replace("(Clone)", "").Trim(); Sprite val2 = null; CustomItemReference customItemReference = CustomItems.Items.FirstOrDefault((CustomItemReference i) => i.name == cleanName); if (customItemReference != null) { val2 = ((GearReference)customItemReference).icon; } else { CustomWeaponReference customWeaponReference = CustomSkulls.Skulls.FirstOrDefault((CustomWeaponReference w) => w.name == cleanName); if (customWeaponReference != null) { val2 = ((GearReference)customWeaponReference).icon; } } if ((Object)(object)val2 != (Object)null && (Object)(object)__instance.spriteRenderer != (Object)null) { __instance.spriteRenderer.sprite = val2; Animator val3 = ((Component)__instance).gameObject.GetComponent() ?? ((Component)__instance).gameObject.GetComponentInChildren(); if ((Object)(object)val3 != (Object)null) { ((Behaviour)val3).enabled = false; } Debug.Log((object)("[DroppedGearSpriteFix] Forced custom world sprite on DroppedGear for " + ((Object)gear).name)); } } } } [HarmonyPatch] public class DarkAideAIPatch { [HarmonyPrefix] [HarmonyPatch(typeof(DarkAideAI), "ClampDestinationY")] private static void ClampDestinationY_Prefix(DarkAideAI __instance) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_008d: 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_00a5: 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 ((Object)(object)__instance == (Object)null) { return; } try { FieldInfo fieldInfo = AccessTools.Field(typeof(DarkAideAI), "_minHeightTransform"); if (fieldInfo != null && fieldInfo.GetValue(__instance) == null) { GameObject val = new GameObject("DummyMinHeight"); val.transform.parent = ((Component)__instance).transform; Character player = ChzzkCardSynergy.GetPlayer(); float num = (((Object)(object)player != (Object)null) ? ((Component)player).transform.position.y : ((Component)__instance).transform.position.y); val.transform.position = new Vector3(((Component)__instance).transform.position.x, num - 1.5f, 0f); fieldInfo.SetValue(__instance, val.transform); Debug.Log((object)"[DarkAideAIPatch] Initialized null _minHeightTransform on DarkAideAI dynamically."); } } catch (Exception ex) { Debug.LogWarning((object)("[DarkAideAIPatch] Failed to check/initialize _minHeightTransform: " + ex)); } } } [HarmonyPatch(typeof(ItemInventory), "TryEquip")] public class ItemInventory_TryEquip_Patch { [HarmonyPrefix] private static bool Prefix(ItemInventory __instance, Item item, ref bool __result) { try { CustomGearsPatch.ExpandInventoryIfNeeded(item); int num = ((CustomGearsPatch.HasErrorCreator() || ((Object)item).name.Contains("TMTrainer") || ((Object)item).name.Contains("ErrorCreator")) ? 50 : 9); for (int i = 0; i < num; i++) { if (i < __instance.items.Count && (Object)(object)__instance.items[i] == (Object)null) { __instance.EquipAt(item, i); __result = true; return false; } } __result = false; return false; } catch (Exception ex) { Debug.LogError((object)("[ItemInventory_TryEquip_Patch] Prefix error: " + ex)); return true; } } } [HarmonyPatch(typeof(AddGaugeValue), "Run")] public class Patch_AddGaugeValue_Run { [HarmonyPrefix] private static bool Prefix(AddGaugeValue __instance) { if ((Object)(object)__instance == (Object)null) { return false; } ValueGauge value = Traverse.Create((object)__instance).Field("_gaugeWithValue").Value; if ((Object)(object)value == (Object)null) { return false; } return true; } } [HarmonyPatch(typeof(ClearGaugeValue), "Run")] public class Patch_ClearGaugeValue_Run { [HarmonyPrefix] private static bool Prefix(ClearGaugeValue __instance) { if ((Object)(object)__instance == (Object)null) { return false; } ValueGauge value = Traverse.Create((object)__instance).Field("_gaugeWithValue").Value; if ((Object)(object)value == (Object)null) { return false; } return true; } } [HarmonyPatch(typeof(SetGaugeColor), "Run")] public class Patch_SetGaugeColor_Run { [HarmonyPrefix] private static bool Prefix(SetGaugeColor __instance) { if ((Object)(object)__instance == (Object)null) { return false; } ValueGauge value = Traverse.Create((object)__instance).Field("_gaugeWithValue").Value; if ((Object)(object)value == (Object)null) { return false; } return true; } } [HarmonyPatch(typeof(SetGaugeValue), "Run")] public class Patch_SetGaugeValue_Run { [HarmonyPrefix] private static bool Prefix(SetGaugeValue __instance) { if ((Object)(object)__instance == (Object)null) { return false; } ValueGauge value = Traverse.Create((object)__instance).Field("_gaugeWithValue").Value; if ((Object)(object)value == (Object)null) { return false; } return true; } } [HarmonyPatch(typeof(Panel), "Awake")] public class Patch_InventoryPanel_Awake { [HarmonyPostfix] private static void Postfix(Panel __instance) { } } [HarmonyPatch(typeof(Panel), "UpdateGearInfo")] public class Patch_InventoryPanel_UpdateGearInfo { [HarmonyPrefix] private static bool Prefix(Panel __instance) { return true; } } [HarmonyPatch(typeof(DroppedGear), "InteractWith")] public class DroppedGear_InteractWith_Patch { [HarmonyPrefix] private static bool Prefix(DroppedGear __instance, Character character) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.gear == (Object)null) { return true; } if (!__instance.gear.lootable) { return true; } Currency val = Currency.currencies[__instance.priceCurrency]; if (!val.Has(__instance.price)) { return true; } Gear gear = __instance.gear; Item val2 = (Item)(object)((gear is Item) ? gear : null); if (val2 != null) { CustomGearsPatch.ExpandInventoryIfNeeded(val2); ItemInventory item = character.playerComponents.inventory.item; int num = ((CustomGearsPatch.HasErrorCreator() || ((Object)val2).name.Contains("TMTrainer") || ((Object)val2).name.Contains("ErrorCreator")) ? 50 : 9); bool flag = false; for (int i = 0; i < num; i++) { if (i < item.items.Count && (Object)(object)item.items[i] == (Object)null) { flag = true; break; } } if (!flag) { Scene.instance.uiManager.itemSelect.Open(val2); return false; } } return true; } } [HarmonyPatch(typeof(ItemInventory), "Awake")] public class ItemInventory_Awake_Patch { [HarmonyPostfix] private static void Postfix(ItemInventory __instance) { try { CustomGearsPatch.ExpandInventoryIfNeeded(); } catch (Exception ex) { Debug.LogError((object)("[ItemInventory_Awake_Patch] Postfix error: " + ex)); } } } [HarmonyPatch(typeof(ItemInventory), "EquipAt")] public class ItemInventory_EquipAt_Patch { [HarmonyPostfix] private static void Postfix() { try { ChzzkStatManager.Save(); Debug.Log((object)"[ItemInventory_EquipAt_Patch] Inventory changed (EquipAt), auto-saved stats/items."); } catch (Exception ex) { Debug.LogError((object)("[ItemInventory_EquipAt_Patch] Save error: " + ex)); } } } [HarmonyPatch(typeof(ItemInventory), "Drop")] public class ItemInventory_Drop_Patch { [HarmonyPostfix] private static void Postfix() { try { ChzzkStatManager.Save(); Debug.Log((object)"[ItemInventory_Drop_Patch] Inventory changed (Drop), auto-saved stats/items."); } catch (Exception ex) { Debug.LogError((object)("[ItemInventory_Drop_Patch] Save error: " + ex)); } } } [HarmonyPatch(typeof(ItemInventory), "Trim")] public class ItemInventory_Trim_Patch { [HarmonyPostfix] private static void Postfix() { try { ChzzkStatManager.Save(); Debug.Log((object)"[ItemInventory_Trim_Patch] Inventory changed (Trim), auto-saved stats/items."); } catch (Exception ex) { Debug.LogError((object)("[ItemInventory_Trim_Patch] Save error: " + ex)); } } } [HarmonyPatch(typeof(LevelManager), "InvokeOnMapChanged")] public class LevelManager_InvokeOnMapChanged_Patch { [HarmonyPostfix] private static void Postfix() { try { IdolOfTheOtherworldBehavior.ClearActiveSpikes(); if ((Object)(object)PluginItems.Instance != (Object)null) { ((MonoBehaviour)PluginItems.Instance).StartCoroutine(RestoreInventoryOnMapChange()); } } catch (Exception ex) { Debug.LogError((object)("[LevelManager_InvokeOnMapChanged_Patch] error: " + ex)); } } private static IEnumerator RestoreInventoryOnMapChange() { yield return (object)new WaitForSeconds(0.5f); CustomGearsPatch.ExpandInventoryIfNeeded(); Character player = ChzzkCardSynergy.GetPlayer(); if ((Object)(object)player == (Object)null || player.playerComponents == null || player.playerComponents.inventory == null) { yield break; } ItemInventory itemInventory = player.playerComponents.inventory.item; if ((Object)(object)itemInventory == (Object)null) { yield break; } List extraItems = ChzzkStatManager.SaveData.ExtraInventoryItems; if (extraItems == null || extraItems.Count == 0) { yield break; } Service service = Singleton.Instance; if ((Object)(object)service == (Object)null || (Object)(object)service.gearManager == (Object)null || (Object)(object)service.levelManager == (Object)null) { yield break; } for (int i = 0; i < extraItems.Count; i++) { string itemName = extraItems[i]; int targetSlotIndex = 9 + i; if (string.IsNullOrEmpty(itemName)) { continue; } itemName = ChzzkStatManager.GetOriginalItemName(itemName); if (targetSlotIndex < itemInventory.items.Count && (Object)(object)itemInventory.items[targetSlotIndex] != (Object)null) { continue; } ItemReference itemRef = null; if (!GearResource.instance.TryGetItemReferenceByName(itemName, ref itemRef)) { continue; } ItemRequest req = itemRef.LoadAsync(); while (!((Request)(object)req).isDone) { yield return null; } if (!((Object)(object)((Request)(object)req).asset != (Object)null)) { continue; } Item drop = service.levelManager.DropItem(req, ((Component)player).transform.position); if (!((Object)(object)drop != (Object)null)) { continue; } try { MethodInfo equipAtMethod = typeof(ItemInventory).GetMethod("EquipAt", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? typeof(ItemInventory).GetMethod("EquipAt"); if (equipAtMethod != null) { equipAtMethod.Invoke(itemInventory, new object[2] { drop, targetSlotIndex }); } else if (targetSlotIndex < itemInventory.items.Count) { itemInventory.items[targetSlotIndex] = drop; ((Gear)drop).state = (State)1; ((Gear)drop).OnEquipped(); } } catch (Exception ex) { Debug.LogError((object)("[RestoreInventoryOnMapChange] Failed to equip extra item: " + ex)); } } } } [HarmonyPatch(typeof(DropMovement), "Awake")] public class DropMovement_Awake_Patch { [HarmonyPrefix] private static void Prefix(DropMovement __instance) { if ((Object)(object)__instance == (Object)null) { return; } try { FieldInfo field = typeof(DropMovement).GetField("_graphic", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null && field.GetValue(__instance) == null) { field.SetValue(__instance, ((Component)__instance).transform); Debug.Log((object)"[DropMovement_Awake_Patch] Null _graphic corrected in Awake."); } } catch (Exception ex) { Debug.LogError((object)("[DropMovement_Awake_Patch] error: " + ex)); } } } [HarmonyPatch(typeof(DropMovement), "OnEnable")] public class DropMovement_OnEnable_Patch { [HarmonyPrefix] private static void Prefix(DropMovement __instance) { if ((Object)(object)__instance == (Object)null) { return; } try { FieldInfo field = typeof(DropMovement).GetField("_graphic", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null && field.GetValue(__instance) == null) { field.SetValue(__instance, ((Component)__instance).transform); Debug.Log((object)"[DropMovement_OnEnable_Patch] Null _graphic corrected in OnEnable."); } } catch (Exception ex) { Debug.LogError((object)("[DropMovement_OnEnable_Patch] error: " + ex)); } } } [HarmonyPatch] public class DropMovement_CMove_Patch { [HarmonyTargetMethod] private static MethodBase TargetMethod() { return typeof(DropMovement).GetNestedType("d__36", BindingFlags.Public | BindingFlags.NonPublic)?.GetMethod("MoveNext", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } [HarmonyPrefix] private static bool Prefix(object __instance, ref bool __result) { try { if (__instance == null) { return true; } FieldInfo field = __instance.GetType().GetField("<>4__this", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { return true; } object? value = field.GetValue(__instance); DropMovement val = (DropMovement)((value is DropMovement) ? value : null); if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).gameObject == (Object)null) { __result = false; return false; } FieldInfo field2 = typeof(DropMovement).GetField("_graphic", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field2 != null) { object? value2 = field2.GetValue(val); Transform val2 = (Transform)((value2 is Transform) ? value2 : null); if ((Object)(object)val2 == (Object)null || (Object)(object)((Component)val2).gameObject == (Object)null) { __result = false; return false; } } } catch { __result = false; return false; } return true; } } [HarmonyPatch] public class DropMovement_CFloat_Patch { [HarmonyTargetMethod] private static MethodBase TargetMethod() { return typeof(DropMovement).GetNestedType("d__37", BindingFlags.Public | BindingFlags.NonPublic)?.GetMethod("MoveNext", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } [HarmonyPrefix] private static bool Prefix(object __instance, ref bool __result) { try { if (__instance == null) { return true; } FieldInfo field = __instance.GetType().GetField("<>4__this", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { return true; } object? value = field.GetValue(__instance); DropMovement val = (DropMovement)((value is DropMovement) ? value : null); if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).gameObject == (Object)null) { __result = false; return false; } FieldInfo field2 = typeof(DropMovement).GetField("_graphic", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field2 != null) { object? value2 = field2.GetValue(val); Transform val2 = (Transform)((value2 is Transform) ? value2 : null); if ((Object)(object)val2 == (Object)null || (Object)(object)((Component)val2).gameObject == (Object)null) { __result = false; return false; } } } catch { __result = false; return false; } return true; } } [HarmonyPatch] public class FloatingTextSpawner_CMove_Patch { [HarmonyTargetMethod] private static MethodBase TargetMethod() { return typeof(FloatingTextSpawner).GetNestedType("d__25", BindingFlags.Public | BindingFlags.NonPublic)?.GetMethod("MoveNext", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } [HarmonyPrefix] private static bool Prefix(object __instance, ref bool __result) { try { if (__instance == null) { return true; } FieldInfo field = __instance.GetType().GetField("transform", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object? value = field.GetValue(__instance); Transform val = (Transform)((value is Transform) ? value : null); if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).gameObject == (Object)null) { __result = false; return false; } } } catch { __result = false; return false; } return true; } } [HarmonyPatch] public class FloatingTextSpawner_CFadeOut_d26_Patch { [HarmonyTargetMethod] private static MethodBase TargetMethod() { return typeof(FloatingTextSpawner).GetNestedType("d__26", BindingFlags.Public | BindingFlags.NonPublic)?.GetMethod("MoveNext", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } [HarmonyPrefix] private static bool Prefix(object __instance, ref bool __result) { try { if (__instance == null) { return true; } FieldInfo field = __instance.GetType().GetField("spawned", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object? value = field.GetValue(__instance); MonoBehaviour val = (MonoBehaviour)((value is MonoBehaviour) ? value : null); if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).gameObject == (Object)null) { __result = false; return false; } } } catch { __result = false; return false; } return true; } } [HarmonyPatch] public class FloatingTextSpawner_CFadeOut_d27_Patch { [HarmonyTargetMethod] private static MethodBase TargetMethod() { return typeof(FloatingTextSpawner).GetNestedType("d__27", BindingFlags.Public | BindingFlags.NonPublic)?.GetMethod("MoveNext", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } [HarmonyPrefix] private static bool Prefix(object __instance, ref bool __result) { try { if (__instance == null) { return true; } FieldInfo field = __instance.GetType().GetField("spawned", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object? value = field.GetValue(__instance); MonoBehaviour val = (MonoBehaviour)((value is MonoBehaviour) ? value : null); if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).gameObject == (Object)null) { __result = false; return false; } } } catch { __result = false; return false; } return true; } } [HarmonyPatch] public class AddGaugeValuePatch1 { private static readonly FieldInfo _gaugeField = AccessTools.Field(typeof(AddGaugeValue), "_gaugeWithValue"); [HarmonyTargetMethod] private static MethodBase TargetMethod() { try { MethodInfo[] methods = typeof(AddGaugeValue).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo[] array = methods; foreach (MethodInfo methodInfo in array) { if (methodInfo.Name == "Run") { ParameterInfo[] parameters = methodInfo.GetParameters(); if (parameters.Length == 1 && parameters[0].ParameterType.Name == "Character") { return methodInfo; } } } } catch { } return null; } [HarmonyPrefix] private static bool Prefix(object __instance) { if (__instance == null || !(__instance is AddGaugeValue)) { return true; } if (_gaugeField == null || _gaugeField.GetValue(__instance) == null) { return false; } return true; } } [HarmonyPatch] public class AddGaugeValuePatch2 { private static readonly FieldInfo _gaugeField = AccessTools.Field(typeof(AddGaugeValue), "_gaugeWithValue"); [HarmonyTargetMethod] private static MethodBase TargetMethod() { try { MethodInfo[] methods = typeof(AddGaugeValue).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo[] array = methods; foreach (MethodInfo methodInfo in array) { if (methodInfo.Name == "Run") { ParameterInfo[] parameters = methodInfo.GetParameters(); if (parameters.Length == 2 && parameters[0].ParameterType.Name == "Character" && parameters[1].ParameterType.Name == "Character") { return methodInfo; } } } } catch { } return null; } [HarmonyPrefix] private static bool Prefix(object __instance) { if (__instance == null || !(__instance is AddGaugeValue)) { return true; } if (_gaugeField == null || _gaugeField.GetValue(__instance) == null) { return false; } return true; } } [HarmonyPatch] public class AddGaugeValuePatch3 { private static readonly FieldInfo _gaugeField = AccessTools.Field(typeof(AddGaugeValue), "_gaugeWithValue"); [HarmonyTargetMethod] private static MethodBase TargetMethod() { try { MethodInfo[] methods = typeof(AddGaugeValue).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo[] array = methods; foreach (MethodInfo methodInfo in array) { if (methodInfo.Name == "Run") { ParameterInfo[] parameters = methodInfo.GetParameters(); if (parameters.Length == 2 && parameters[0].ParameterType.Name == "Character" && parameters[1].ParameterType.Name.Contains("IList")) { return methodInfo; } } } } catch { } return null; } [HarmonyPrefix] private static bool Prefix(object __instance) { if (__instance == null || !(__instance is AddGaugeValue)) { return true; } if (_gaugeField == null || _gaugeField.GetValue(__instance) == null) { return false; } return true; } } [HarmonyPatch] public class SpawnEffectPatch1 { private static readonly FieldInfo _infoField = AccessTools.Field(typeof(SpawnEffect), "_info"); [HarmonyTargetMethod] private static MethodBase TargetMethod() { try { MethodInfo[] methods = typeof(SpawnEffect).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo[] array = methods; foreach (MethodInfo methodInfo in array) { if (methodInfo.Name == "Run") { ParameterInfo[] parameters = methodInfo.GetParameters(); if (parameters.Length == 1 && parameters[0].ParameterType.Name == "Character") { return methodInfo; } } } } catch { } return null; } [HarmonyPrefix] private static bool Prefix(object __instance) { if (__instance == null || !(__instance is SpawnEffect)) { return true; } if (_infoField == null || _infoField.GetValue(__instance) == null) { return false; } return true; } } [HarmonyPatch] public class SpawnEffectPatch2 { private static readonly FieldInfo _infoField = AccessTools.Field(typeof(SpawnEffect), "_info"); [HarmonyTargetMethod] private static MethodBase TargetMethod() { try { MethodInfo[] methods = typeof(SpawnEffect).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo[] array = methods; foreach (MethodInfo methodInfo in array) { if (methodInfo.Name == "Run") { ParameterInfo[] parameters = methodInfo.GetParameters(); if (parameters.Length == 2 && parameters[0].ParameterType.Name == "Character" && parameters[1].ParameterType.Name == "Character") { return methodInfo; } } } } catch { } return null; } [HarmonyPrefix] private static bool Prefix(object __instance) { if (__instance == null || !(__instance is SpawnEffect)) { return true; } if (_infoField == null || _infoField.GetValue(__instance) == null) { return false; } return true; } } [HarmonyPatch] public class SpawnEffectPatch3 { private static readonly FieldInfo _infoField = AccessTools.Field(typeof(SpawnEffect), "_info"); [HarmonyTargetMethod] private static MethodBase TargetMethod() { try { MethodInfo[] methods = typeof(SpawnEffect).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo[] array = methods; foreach (MethodInfo methodInfo in array) { if (methodInfo.Name == "Run") { ParameterInfo[] parameters = methodInfo.GetParameters(); if (parameters.Length == 2 && parameters[0].ParameterType.Name == "Character" && parameters[1].ParameterType.Name.Contains("IList")) { return methodInfo; } } } } catch { } return null; } [HarmonyPrefix] private static bool Prefix(object __instance) { if (__instance == null || !(__instance is SpawnEffect)) { return true; } if (_infoField == null || _infoField.GetValue(__instance) == null) { return false; } return true; } } [HarmonyPatch(typeof(Synergy), "Initialize")] public class SynergyInitializePatch { [HarmonyPostfix] private static void Postfix(Synergy __instance) { //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Invalid comparison between Unknown and I4 //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Expected O, but got Unknown //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Expected O, but got Unknown //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Expected O, but got Unknown try { FieldInfo fieldInfo = AccessTools.Field(typeof(Synergy), "inscriptions"); if (fieldInfo == null) { return; } object value = fieldInfo.GetValue(__instance); if (value == null) { return; } Type type = value.GetType(); FieldInfo fieldInfo2 = AccessTools.Field(type, "_array"); if (fieldInfo2 == null) { return; } Inscription[] array = fieldInfo2.GetValue(value) as Inscription[]; if (array == null) { return; } if (array.Length < 38) { Inscription[] array2 = (Inscription[])(object)new Inscription[38]; Array.Copy(array, array2, array.Length); fieldInfo2.SetValue(value, array2); array = array2; } try { FieldInfo fieldInfo3 = AccessTools.Field(typeof(Synergy), "_synergySettings"); if (fieldInfo3 != null) { object value2 = fieldInfo3.GetValue(__instance); if (value2 != null) { FieldInfo fieldInfo4 = AccessTools.Field(typeof(SynergySettings), "_settings"); if (fieldInfo4 != null) { object value3 = fieldInfo4.GetValue(value2); if (value3 != null) { FieldInfo fieldInfo5 = AccessTools.Field(value3.GetType(), "_array"); if (fieldInfo5 != null) { InscriptionSettings[] array3 = fieldInfo5.GetValue(value3) as InscriptionSettings[]; if (array3 != null) { if (array3.Length < 38) { InscriptionSettings[] array4 = (InscriptionSettings[])(object)new InscriptionSettings[38]; Array.Copy(array3, array4, array3.Length); fieldInfo5.SetValue(value3, array4); array3 = array4; Debug.Log((object)"[SynergyInitializePatch] Expanded InscriptionSettingsByKey _array to 38."); } if (array3[37] == null) { InscriptionSettings val = new InscriptionSettings(); AccessTools.Field(typeof(InscriptionSettings), "_steps")?.SetValue(val, new int[2] { 2, 4 }); array3[37] = val; Debug.Log((object)"[SynergyInitializePatch] Injected InscriptionSettings for Card (37) into InscriptionSettingsByKey."); } } } } } } } } catch (Exception ex) { Debug.LogError((object)("[SynergyInitializePatch] Failed to patch InscriptionSettingsByKey: " + ex)); } bool flag = false; if (array[37] != null && (int)array[37].key == 37) { ReadOnlyCollection steps = array[37].steps; if (steps != null && steps.Count == 2 && steps[0] == 2 && steps[1] == 4) { flag = true; } } if (flag) { return; } Inscription val2 = array[36]; if (val2 == null) { for (int i = 0; i < array.Length; i++) { if (array[i] != null) { val2 = array[i]; break; } } } Inscription val3 = new Inscription(); val3.canBeSuper = PlayerPrefs.GetInt("ChzzkSkul_Card_Super", 0) == 1; AccessTools.Field(typeof(Inscription), "k__BackingField")?.SetValue(val3, (object)(Key)37); FieldInfo fieldInfo6 = AccessTools.Field(typeof(Inscription), "k__BackingField"); ReadOnlyCollection value4 = Array.AsReadOnly(new int[2] { 2, 4 }); fieldInfo6?.SetValue(val3, value4); AccessTools.Field(typeof(Inscription), "k__BackingField")?.SetValue(val3, 2); AccessTools.Field(typeof(Inscription), "k__BackingField")?.SetValue(val3, true); Type typeFromHandle = typeof(InscriptionSettings); InscriptionSettings val4 = new InscriptionSettings(); AccessTools.Field(typeFromHandle, "_steps")?.SetValue(val4, new int[2] { 2, 4 }); AccessTools.Field(typeof(Inscription), "k__BackingField")?.SetValue(val3, val4); if (val2 != null) { FieldInfo fieldInfo7 = AccessTools.Field(typeof(Inscription), "k__BackingField"); fieldInfo7?.SetValue(val3, fieldInfo7.GetValue(val2)); FieldInfo fieldInfo8 = AccessTools.Field(typeof(Inscription), "_itemInventory"); fieldInfo8?.SetValue(val3, fieldInfo8.GetValue(val2)); FieldInfo fieldInfo9 = AccessTools.Field(typeof(Inscription), "k__BackingField"); FieldInfo fieldInfo10 = AccessTools.Field(typeof(Inscription), "k__BackingField"); FieldInfo fieldInfo11 = AccessTools.Field(typeof(Inscription), "k__BackingField"); FieldInfo fieldInfo12 = AccessTools.Field(typeof(Inscription), "k__BackingField"); fieldInfo9?.SetValue(val3, fieldInfo9.GetValue(val2)); fieldInfo10?.SetValue(val3, fieldInfo10.GetValue(val2)); fieldInfo11?.SetValue(val3, fieldInfo11.GetValue(val2)); fieldInfo12?.SetValue(val3, fieldInfo12.GetValue(val2)); } array[37] = val3; try { CommonResource instance = CommonResource.instance; if ((Object)(object)instance != (Object)null) { Dictionary keywordIconDictionary = instance.keywordIconDictionary; Dictionary keywordFullactiveIconDictionary = instance.keywordFullactiveIconDictionary; Dictionary keywordDeactiveIconDictionary = instance.keywordDeactiveIconDictionary; Dictionary keywordSuperDictionary = instance.keywordSuperDictionary; if (keywordIconDictionary != null && !keywordIconDictionary.ContainsKey("37")) { Sprite value6; if (keywordIconDictionary.TryGetValue("Mystery", out var value5)) { keywordIconDictionary["37"] = value5; } else if (keywordIconDictionary.TryGetValue("36", out value6)) { keywordIconDictionary["37"] = value6; } } if (keywordFullactiveIconDictionary != null && !keywordFullactiveIconDictionary.ContainsKey("37")) { Sprite value8; if (keywordFullactiveIconDictionary.TryGetValue("Mystery", out var value7)) { keywordFullactiveIconDictionary["37"] = value7; } else if (keywordFullactiveIconDictionary.TryGetValue("36", out value8)) { keywordFullactiveIconDictionary["37"] = value8; } } if (keywordDeactiveIconDictionary != null && !keywordDeactiveIconDictionary.ContainsKey("37")) { Sprite value10; if (keywordDeactiveIconDictionary.TryGetValue("Mystery", out var value9)) { keywordDeactiveIconDictionary["37"] = value9; } else if (keywordDeactiveIconDictionary.TryGetValue("36", out value10)) { keywordDeactiveIconDictionary["37"] = value10; } } if (keywordSuperDictionary != null && !keywordSuperDictionary.ContainsKey("37")) { Sprite value12; if (keywordSuperDictionary.TryGetValue("Mystery", out var value11)) { keywordSuperDictionary["37"] = value11; } else if (keywordSuperDictionary.TryGetValue("36", out value12)) { keywordSuperDictionary["37"] = value12; } } Debug.Log((object)"[SynergyInitializePatch] Injected card icons into CommonResource dictionaries."); } } catch (Exception ex2) { Debug.LogError((object)("[SynergyInitializePatch] Failed to inject icons into CommonResource: " + ex2)); } Debug.Log((object)"[SynergyInitializePatch] Injected/Restored custom card inscription at index 37."); } catch (Exception ex3) { Debug.LogError((object)("[SynergyInitializePatch] Failed to patch: " + ex3)); } } } [HarmonyPatch(typeof(Inscription), "Destory")] public class InscriptionDestoryPatch { [HarmonyPrefix] private static bool Prefix(Inscription __instance) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 if (__instance != null && (int)__instance.key == 37) { try { __instance.canBeSuper = false; __instance.Clear(); PlayerPrefs.SetInt("ChzzkSkul_Card_Super", 0); PlayerPrefs.Save(); } catch (Exception ex) { Debug.LogError((object)("[InscriptionDestoryPatch] Error in bypass Destory: " + ex)); } return false; } return true; } } [HarmonyPatch(typeof(UIManager), "Update")] public class UIManagerUpdatePatch { [HarmonyFinalizer] private static Exception Finalizer(Exception __exception) { if (__exception != null && __exception is InvalidCastException) { return null; } return __exception; } } public static class AssetDumper { public static void SaveSpriteToPng(Sprite sprite, string filePath) { //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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)sprite == (Object)null) { return; } try { Texture2D texture = sprite.texture; if (!((Object)(object)texture == (Object)null)) { RenderTexture temporary = RenderTexture.GetTemporary(((Texture)texture).width, ((Texture)texture).height, 0, (RenderTextureFormat)7, (RenderTextureReadWrite)1); Graphics.Blit((Texture)(object)texture, temporary); RenderTexture active = RenderTexture.active; RenderTexture.active = temporary; Rect rect = sprite.rect; Texture2D val = new Texture2D((int)((Rect)(ref rect)).width, (int)((Rect)(ref rect)).height); val.ReadPixels(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height), 0, 0); val.Apply(); RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); byte[] bytes = ImageConversion.EncodeToPNG(val); File.WriteAllBytes(filePath, bytes); Object.Destroy((Object)(object)val); } } catch (Exception ex) { Debug.LogError((object)("[AssetDumper] Failed to save sprite to " + filePath + ": " + ex.Message)); } } public static void DumpAllAssets() { try { string dumpDir = Path.Combine(Application.persistentDataPath, "OmenChest_AssetDump"); Directory.CreateDirectory(dumpDir); Directory.CreateDirectory(Path.Combine(dumpDir, "Inscriptions")); Directory.CreateDirectory(Path.Combine(dumpDir, "Items")); CommonResource instance = CommonResource.instance; if ((Object)(object)instance != (Object)null) { DumpDict(instance.keywordIconDictionary, "Active"); DumpDict(instance.keywordDeactiveIconDictionary, "Deactive"); DumpDict(instance.keywordFullactiveIconDictionary, "FullActive"); DumpDict(instance.keywordSuperDictionary, "Super"); } GearResource instance2 = GearResource.instance; if ((Object)(object)instance2 != (Object)null && instance2.items != null) { foreach (ItemReference item in instance2.items) { if (item != null) { string text = string.Join("_", ((GearReference)item).name.Split(Path.GetInvalidFileNameChars())); if ((Object)(object)((GearReference)item).icon != (Object)null) { SaveSpriteToPng(((GearReference)item).icon, Path.Combine(dumpDir, "Items", text + "_icon.png")); } if ((Object)(object)((GearReference)item).thumbnail != (Object)null) { SaveSpriteToPng(((GearReference)item).thumbnail, Path.Combine(dumpDir, "Items", text + "_thumb.png")); } } } } Debug.Log((object)("[AssetDumper] All assets dumped successfully to " + dumpDir + "!")); void DumpDict(Dictionary dict, string folderName) { if (dict == null) { return; } string text2 = Path.Combine(dumpDir, "Inscriptions", folderName); Directory.CreateDirectory(text2); foreach (KeyValuePair item2 in dict) { if ((Object)(object)item2.Value != (Object)null) { SaveSpriteToPng(item2.Value, Path.Combine(text2, item2.Key + ".png")); } } } } catch (Exception ex) { Debug.LogError((object)("[AssetDumper] Error during dump: " + ex)); } } } [HarmonyPatch(typeof(Synergy), "UpdateBonus")] public class SynergyUpdateBonusPatch { [HarmonyPostfix] private static void Postfix(Synergy __instance) { try { FieldInfo fieldInfo = AccessTools.Field(typeof(Synergy), "inscriptions"); if (fieldInfo == null) { return; } object value = fieldInfo.GetValue(__instance); if (value != null) { Type type = value.GetType(); FieldInfo fieldInfo2 = AccessTools.Field(type, "_array"); if (!(fieldInfo2 == null) && fieldInfo2.GetValue(value) is Inscription[] array && array.Length > 37 && array[37] != null) { array[37].Update(); } } } catch (Exception ex) { Debug.LogError((object)("[SynergyUpdateBonusPatch] Error: " + ex)); } } } [HarmonyPatch(typeof(Inscription), "Update")] public class InscriptionUpdateFinalizerPatch { [HarmonyFinalizer] private static Exception Finalizer(Exception __exception, Inscription __instance) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 if (__exception != null && (int)__instance.key == 37) { return null; } return __exception; } } [HarmonyPatch(typeof(Synergy), "ChangeToSuperable")] public class SynergyChangeToSuperablePatch { [HarmonyPrefix] private static bool Prefix(Synergy __instance, Key key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Invalid comparison between Unknown and I4 if ((int)key == 37) { try { object obj = AccessTools.Field(typeof(Synergy), "inscriptions")?.GetValue(__instance); Inscription val = ((((obj != null) ? AccessTools.Field(obj.GetType(), "_array") : null)?.GetValue(obj) is Inscription[] array && array.Length > 37) ? array[37] : null); if (val != null) { val.canBeSuper = true; } if (AccessTools.Field(typeof(Synergy), "onChanged")?.GetValue(__instance) is Action action) { action(); } PlayerPrefs.SetInt("ChzzkSkul_Card_Super", 1); PlayerPrefs.Save(); Debug.Log((object)"[SynergyChangeToSuperablePatch] Successfully awakened card inscription and saved to PlayerPrefs."); } catch (Exception ex) { Debug.LogError((object)("[SynergyChangeToSuperablePatch] Error: " + ex)); } return false; } return true; } } [HarmonyPatch] public class GainSuperInscriptionPatch { [HarmonyTargetMethod] private static MethodBase TargetMethod() { try { return (typeof(GameData).GetNestedType("HardmodeProgress", BindingFlags.Public | BindingFlags.NonPublic)?.GetNestedType("DemonCastleDefense", BindingFlags.Public | BindingFlags.NonPublic))?.GetMethod("GainSuperInscription", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(Key) }, null); } catch { return null; } } [HarmonyPrefix] private static bool Prefix(Key key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Invalid comparison between Unknown and I4 if ((int)key == 37) { Debug.Log((object)"[GainSuperInscriptionPatch] Skipped GainSuperInscription for custom key 37 to avoid KeyNotFoundException."); return false; } return true; } } [HarmonyPatch] public class SuperInscriptionCollectorLoadPatch { [HarmonyTargetMethod] private static MethodBase TargetMethod() { try { return typeof(SuperInscriptionCollector).GetMethod("Load", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } catch { return null; } } [HarmonyPostfix] private static void Postfix(SuperInscriptionCollector __instance) { //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_017d: 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_01d0: Unknown result type (might be due to invalid IL or missing references) try { Service instance = Singleton.Instance; object obj; if (instance == null) { obj = null; } else { LevelManager levelManager = instance.levelManager; obj = ((levelManager != null) ? levelManager.player : null); } Character val = (Character)obj; if ((Object)(object)val == (Object)null) { return; } Synergy val2 = val.playerComponents?.inventory?.synergy; if ((Object)(object)val2 == (Object)null) { return; } object obj2 = AccessTools.Field(typeof(Synergy), "inscriptions")?.GetValue(val2); if (obj2 == null || !(AccessTools.Field(obj2.GetType(), "_array")?.GetValue(obj2) is Inscription[] array) || array.Length <= 37 || array[37] == null) { return; } Inscription val3 = array[37]; if (!val3.isMaxStep || val3.canBeSuper) { return; } FieldInfo fieldInfo = AccessTools.Field(typeof(SuperInscriptionCollector), "_lastPoint"); if (!(fieldInfo == null)) { Vector2 val4 = (Vector2)fieldInfo.GetValue(__instance); FieldInfo fieldInfo2 = AccessTools.Field(typeof(SuperInscriptionCollector), "_distance"); float num = ((fieldInfo2 != null) ? ((float)fieldInfo2.GetValue(__instance)) : 3f); Vector2 val5 = default(Vector2); ((Vector2)(ref val5))..ctor(val4.x + num, val4.y); MethodInfo method = typeof(SuperInscriptionCollector).GetMethod("Put", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!(method == null)) { method.Invoke(__instance, new object[2] { (object)(Key)37, val5 }); Debug.Log((object)"[SuperInscriptionCollectorLoadPatch] Spawned SuperInscriptionBox for Card inscription (key=37)."); } } } catch (Exception ex) { Debug.LogError((object)("[SuperInscriptionCollectorLoadPatch] Error: " + ex)); } } } [HarmonyPatch] public class InscriptionGetDescriptionPatch { [HarmonyTargetMethod] private static MethodBase TargetMethod() { try { return typeof(Inscription).GetMethod("GetDescription", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(int) }, null); } catch { return null; } } [HarmonyPrefix] private static bool Prefix(Inscription __instance, int step, ref string __result) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 try { if ((int)__instance.key != 37) { return true; } bool flag = PluginItems.IsKorean(); switch (step) { case 1: __result = (flag ? "카드가 강화?\ufffd니??\n강화??카드???\ufffd욱 강력???\ufffd과\ufffd?발휘?\ufffd니??" : "Cards are enhanced.\nEnhanced cards exert more powerful effects."); return false; case 2: __result = (flag ? "공격 ???\ufffd래 ?\ufffd\ufffd?지??110%??추\ufffd? 공격??발동?\ufffd니??" : "Attacks trigger an additional hit dealing 110% of the original damage."); return false; } } catch { } return true; } } [HarmonyPatch(typeof(InscriptionStepLevel), "Set")] public class InscriptionStepLevelSetPatch { [HarmonyPrefix] private static void Prefix(Key key, bool fullactiveColorChange) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Invalid comparison between Unknown and I4 if ((int)key != 37) { return; } try { Service instance = Singleton.Instance; object obj; if (instance == null) { obj = null; } else { LevelManager levelManager = instance.levelManager; obj = ((levelManager != null) ? levelManager.player : null); } Character val = (Character)obj; if ((Object)(object)val == (Object)null) { return; } Synergy val2 = val.playerComponents?.inventory?.synergy; if ((Object)(object)val2 == (Object)null) { return; } object obj2 = AccessTools.Field(typeof(Synergy), "inscriptions")?.GetValue(val2); if (obj2 == null || !(AccessTools.Field(obj2.GetType(), "_array")?.GetValue(obj2) is Inscription[] array) || array.Length <= 37 || array[37] == null) { return; } Inscription val3 = array[37]; ReadOnlyCollection steps = val3.steps; if (steps == null || steps.Count != 2) { Debug.Log((object)("[InscriptionStepLevelSetPatch] Repairing card inscription steps. Current count: " + ((steps == null) ? "null" : steps.Count.ToString()))); FieldInfo fieldInfo = AccessTools.Field(typeof(Inscription), "k__BackingField"); ReadOnlyCollection value = Array.AsReadOnly(new int[2] { 2, 4 }); fieldInfo?.SetValue(val3, value); AccessTools.Field(typeof(Inscription), "k__BackingField")?.SetValue(val3, 2); InscriptionSettings settings = val3.settings; if (settings != null) { AccessTools.Field(typeof(InscriptionSettings), "_steps")?.SetValue(settings, new int[2] { 2, 4 }); } } } catch (Exception ex) { Debug.LogError((object)("[InscriptionStepLevelSetPatch] Error repairing steps: " + ex)); } } } [HarmonyPatch(typeof(FloatingText))] public class FloatingText_Patch { [HarmonyPatch("Despawn", new Type[] { typeof(float) })] [HarmonyPrefix] public static bool DespawnPrefix1(FloatingText __instance) { if ((Object)(object)__instance == (Object)null || (Object)(object)((Component)__instance).gameObject == (Object)null || !((Component)__instance).gameObject.activeInHierarchy) { return false; } return true; } [HarmonyPatch("Despawn", new Type[] { })] [HarmonyPrefix] public static bool DespawnPrefix2(FloatingText __instance) { if ((Object)(object)__instance == (Object)null || (Object)(object)((Component)__instance).gameObject == (Object)null || !((Component)__instance).gameObject.activeInHierarchy) { return false; } return true; } [HarmonyPatch("FadeOut")] [HarmonyPrefix] public static bool FadeOutPrefix(FloatingText __instance) { if ((Object)(object)__instance == (Object)null || (Object)(object)((Component)__instance).gameObject == (Object)null || !((Component)__instance).gameObject.activeInHierarchy) { return false; } return true; } } [HarmonyPatch(typeof(ValueByRarity))] public class ValueByRarity_Patch { [HarmonyPatch("get_Item", new Type[] { typeof(Rarity) })] [HarmonyPrefix] public static bool get_Item_Prefix(ValueByRarity __instance, Rarity rarity, ref float __result) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected I4, but got Unknown if (__instance == null || __instance._values == null) { return true; } int num = (int)rarity; if (num < 0 || num >= __instance._values.Length) { if (num < 0) { __result = ((__instance._values.Length != 0) ? __instance._values[0] : 0f); } else { __result = ((__instance._values.Length != 0) ? __instance._values[__instance._values.Length - 1] : 0f); } return false; } return true; } } [HarmonyPatch(typeof(RarityPrices))] public class RarityPrices_Patch { private static readonly FieldInfo _pricesField = AccessTools.Field(typeof(RarityPrices), "_prices"); [HarmonyPatch("get_Item", new Type[] { typeof(Rarity) })] [HarmonyPrefix] public static bool get_Item_Prefix(RarityPrices __instance, Rarity rarity, ref int __result) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected I4, but got Unknown if (__instance == null || _pricesField == null) { return true; } if (!(_pricesField.GetValue(__instance) is int[] array)) { return true; } int num = (int)rarity; if (num < 0 || num >= array.Length) { if (num < 0) { __result = ((array.Length != 0) ? array[0] : 0); } else { __result = ((array.Length != 0) ? array[^1] : 0); } return false; } return true; } } [HarmonyPatch(typeof(CurrencyRangeByRarity))] public class CurrencyRangeByRarity_Patch { [HarmonyPatch("Evaluate", new Type[] { typeof(Rarity) })] [HarmonyPrefix] public static bool EvaluatePrefix(CurrencyRangeByRarity __instance, Rarity rarity, ref int __result) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected I4, but got Unknown if (__instance == null) { return true; } int num = (int)rarity; if (num < 0 || num > 3) { if (num < 0) { __result = Random.Range(((Vector2Int)(ref __instance._commonRange)).x, ((Vector2Int)(ref __instance._commonRange)).y); } else { __result = Random.Range(((Vector2Int)(ref __instance._legendaryRange)).x, ((Vector2Int)(ref __instance._legendaryRange)).y); } return false; } return true; } } [HarmonyPatch(typeof(Localization))] public class Localization_Patch { [HarmonyPatch("GetLocalizedString", new Type[] { typeof(string) })] [HarmonyPrefix] public static bool GetLocalizedStringPrefix(string key, ref string __result) { if (string.IsNullOrEmpty(key)) { return true; } if (key.Equals("gear/rarity/4", StringComparison.OrdinalIgnoreCase) || key.Equals("rarity/4", StringComparison.OrdinalIgnoreCase) || key.Equals("Rarity/4", StringComparison.OrdinalIgnoreCase)) { __result = "신화"; return false; } if (key.Equals("gear/rarity/-1", StringComparison.OrdinalIgnoreCase) || key.Equals("rarity/-1", StringComparison.OrdinalIgnoreCase) || key.Equals("Rarity/-1", StringComparison.OrdinalIgnoreCase)) { __result = "무작위"; return false; } return true; } } [HarmonyPatch] public class Localization_TryGet_Patch { [HarmonyTargetMethod] public static MethodBase TargetMethod() { return typeof(Localization).GetMethod("TryGetLocalizedString", new Type[2] { typeof(string), typeof(string).MakeByRefType() }); } [HarmonyPrefix] public static bool Prefix(string key, ref string @string, ref bool __result) { if (string.IsNullOrEmpty(key)) { return true; } if (key.Equals("gear/rarity/4", StringComparison.OrdinalIgnoreCase) || key.Equals("rarity/4", StringComparison.OrdinalIgnoreCase) || key.Equals("Rarity/4", StringComparison.OrdinalIgnoreCase)) { @string = "신화"; __result = true; return false; } if (key.Equals("gear/rarity/-1", StringComparison.OrdinalIgnoreCase) || key.Equals("rarity/-1", StringComparison.OrdinalIgnoreCase) || key.Equals("Rarity/-1", StringComparison.OrdinalIgnoreCase)) { @string = "무작위"; __result = true; return false; } return true; } } [HarmonyPatch(typeof(GearPopup))] public class GearPopup_Patch { private static readonly Dictionary _originalRarities = new Dictionary(); private static void SafeSetOriginalRarity(GearPopup popup, Rarity original) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)popup == (Object)null)) { _originalRarities[((Object)popup).GetInstanceID()] = original; } } private static bool TryGetOriginalRarity(GearPopup popup, out Rarity original) { original = (Rarity)0; if ((Object)(object)popup == (Object)null) { return false; } return _originalRarities.TryGetValue(((Object)popup).GetInstanceID(), out original); } private static void ClearOriginalRarity(GearPopup popup) { if (!((Object)(object)popup == (Object)null)) { _originalRarities.Remove(((Object)popup).GetInstanceID()); } } private static void PrefixGear(GearPopup __instance, Gear gear) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected I4, but got Unknown //IL_0027: 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 (!((Object)(object)gear == (Object)null)) { int num = (int)gear.rarity; if (num == 4 || num == -1) { SafeSetOriginalRarity(__instance, gear.rarity); gear._rarity = (Rarity)((num == 4) ? 3 : 0); } } } private static void PostfixGear(GearPopup __instance, Gear gear) { //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_002a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)gear == (Object)null) && TryGetOriginalRarity(__instance, out var original)) { gear._rarity = original; ClearOriginalRarity(__instance); OverrideRarityUI(__instance, original); } } [HarmonyPatch("Set", new Type[] { typeof(Gear) })] [HarmonyPrefix] public static void SetGear_Prefix(GearPopup __instance, Gear gear) { PrefixGear(__instance, gear); } [HarmonyPatch("Set", new Type[] { typeof(Gear) })] [HarmonyPostfix] public static void SetGear_Postfix(GearPopup __instance, Gear gear) { PostfixGear(__instance, gear); } [HarmonyPatch("Set", new Type[] { typeof(Item) })] [HarmonyPrefix] public static void SetItem_Prefix(GearPopup __instance, Item item) { PrefixGear(__instance, (Gear)(object)item); } [HarmonyPatch("Set", new Type[] { typeof(Item) })] [HarmonyPostfix] public static void SetItem_Postfix(GearPopup __instance, Item item) { PostfixGear(__instance, (Gear)(object)item); } [HarmonyPatch("Set", new Type[] { typeof(Weapon) })] [HarmonyPrefix] public static void SetWeapon_Prefix(GearPopup __instance, Weapon weapon) { PrefixGear(__instance, (Gear)(object)weapon); } [HarmonyPatch("Set", new Type[] { typeof(Weapon) })] [HarmonyPostfix] public static void SetWeapon_Postfix(GearPopup __instance, Weapon weapon) { PostfixGear(__instance, (Gear)(object)weapon); } [HarmonyPatch("Set", new Type[] { typeof(Quintessence) })] [HarmonyPrefix] public static void SetQuintessence_Prefix(GearPopup __instance, Quintessence quintessence) { PrefixGear(__instance, (Gear)(object)quintessence); } [HarmonyPatch("Set", new Type[] { typeof(Quintessence) })] [HarmonyPostfix] public static void SetQuintessence_Postfix(GearPopup __instance, Quintessence quintessence) { PostfixGear(__instance, (Gear)(object)quintessence); } [HarmonyPatch("Set", new Type[] { typeof(string), typeof(string), typeof(Rarity) })] [HarmonyPrefix] public static void SetString_Prefix(GearPopup __instance, ref Rarity rarity) { int num = (int)rarity; if (num == 4 || num == -1) { SafeSetOriginalRarity(__instance, rarity); rarity = (Rarity)((num == 4) ? 3 : 0); } } [HarmonyPatch("Set", new Type[] { typeof(string), typeof(string), typeof(Rarity) })] [HarmonyPostfix] public static void SetString_Postfix(GearPopup __instance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (TryGetOriginalRarity(__instance, out var original)) { ClearOriginalRarity(__instance); OverrideRarityUI(__instance, original); } } private static void OverrideRarityUI(GearPopup popup, Rarity originalRarity) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected I4, but got Unknown if (!((Object)(object)popup == (Object)null) && !((Object)(object)popup._rarity == (Object)null)) { popup._rarity.richText = true; if ((Object)(object)popup._name != (Object)null) { popup._name.richText = true; } if ((Object)(object)popup._description != (Object)null) { popup._description.richText = true; } switch ((int)originalRarity) { case 4: popup._rarity.text = "?\ufffd화"; break; case -1: popup._rarity.text = "무\ufffd?\ufffd?/color>"; break; } } } } [HarmonyPatch(typeof(ItemOption))] public class ItemOption_Patch { private static readonly Dictionary _originalRarities = new Dictionary(); [HarmonyPatch("Set", new Type[] { typeof(Item) })] [HarmonyPrefix] public static void Set_Prefix(ItemOption __instance, Item item) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected I4, but got Unknown //IL_0031: 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 (!((Object)(object)item == (Object)null)) { int num = (int)((Gear)item).rarity; if (num == 4 || num == -1) { _originalRarities[((Object)__instance).GetInstanceID()] = ((Gear)item).rarity; ((Gear)item)._rarity = (Rarity)((num == 4) ? 3 : 0); } } } [HarmonyPatch("Set", new Type[] { typeof(Item) })] [HarmonyPostfix] public static void Set_Postfix(ItemOption __instance, Item item) { //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_003e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)item == (Object)null) && _originalRarities.TryGetValue(((Object)__instance).GetInstanceID(), out var value)) { ((Gear)item)._rarity = value; _originalRarities.Remove(((Object)__instance).GetInstanceID()); OverrideItemOptionUI(__instance, value); } } private static void OverrideItemOptionUI(ItemOption option, Rarity originalRarity) { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected I4, but got Unknown if ((Object)(object)option == (Object)null) { return; } if ((Object)(object)option._rarity != (Object)null) { option._rarity.richText = true; } if ((Object)(object)option._name != (Object)null) { option._name.richText = true; } if ((Object)(object)option._description != (Object)null) { option._description.richText = true; } if ((Object)(object)option._flavorSimple != (Object)null) { option._flavorSimple.richText = true; } if ((Object)(object)option._flavorDetail != (Object)null) { option._flavorDetail.richText = true; } if ((Object)(object)option._rarity != (Object)null) { switch ((int)originalRarity) { case 4: option._rarity.text = "?\ufffd화"; break; case -1: option._rarity.text = "무\ufffd?\ufffd?/color>"; break; } } } } [HarmonyPatch(typeof(WeaponOption))] public class WeaponOption_Patch { private static readonly Dictionary _originalRarities = new Dictionary(); [HarmonyPatch("Set", new Type[] { typeof(Weapon) })] [HarmonyPrefix] public static void Set_Prefix(WeaponOption __instance, Weapon weapon) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected I4, but got Unknown //IL_0031: 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 (!((Object)(object)weapon == (Object)null)) { int num = (int)((Gear)weapon).rarity; if (num == 4 || num == -1) { _originalRarities[((Object)__instance).GetInstanceID()] = ((Gear)weapon).rarity; ((Gear)weapon)._rarity = (Rarity)((num == 4) ? 3 : 0); } } } [HarmonyPatch("Set", new Type[] { typeof(Weapon) })] [HarmonyPostfix] public static void Set_Postfix(WeaponOption __instance, Weapon weapon) { //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_003e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)weapon == (Object)null) && _originalRarities.TryGetValue(((Object)__instance).GetInstanceID(), out var value)) { ((Gear)weapon)._rarity = value; _originalRarities.Remove(((Object)__instance).GetInstanceID()); OverrideWeaponOptionUI(__instance, value); } } private static void OverrideWeaponOptionUI(WeaponOption option, Rarity originalRarity) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected I4, but got Unknown if ((Object)(object)option == (Object)null) { return; } if ((Object)(object)option._rarity != (Object)null) { option._rarity.richText = true; } if ((Object)(object)option._name != (Object)null) { option._name.richText = true; } if ((Object)(object)option._passive != (Object)null) { option._passive.richText = true; } if ((Object)(object)option._swapSkillDescription != (Object)null) { option._swapSkillDescription.richText = true; } if ((Object)(object)option._rarity != (Object)null) { switch ((int)originalRarity) { case 4: option._rarity.text = "?\ufffd화"; break; case -1: option._rarity.text = "무\ufffd?\ufffd?/color>"; break; } } } } [HarmonyPatch(typeof(QuintessenceOption))] public class QuintessenceOption_Patch { private static readonly Dictionary _originalRarities = new Dictionary(); [HarmonyPatch("Set", new Type[] { typeof(Quintessence) })] [HarmonyPrefix] public static void Set_Prefix(QuintessenceOption __instance, Quintessence essence) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected I4, but got Unknown //IL_0031: 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 (!((Object)(object)essence == (Object)null)) { int num = (int)((Gear)essence).rarity; if (num == 4 || num == -1) { _originalRarities[((Object)__instance).GetInstanceID()] = ((Gear)essence).rarity; ((Gear)essence)._rarity = (Rarity)((num == 4) ? 3 : 0); } } } [HarmonyPatch("Set", new Type[] { typeof(Quintessence) })] [HarmonyPostfix] public static void Set_Postfix(QuintessenceOption __instance, Quintessence essence) { //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_003e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)essence == (Object)null) && _originalRarities.TryGetValue(((Object)__instance).GetInstanceID(), out var value)) { ((Gear)essence)._rarity = value; _originalRarities.Remove(((Object)__instance).GetInstanceID()); OverrideQuintessenceOptionUI(__instance, value); } } private static void OverrideQuintessenceOptionUI(QuintessenceOption option, Rarity originalRarity) { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected I4, but got Unknown if ((Object)(object)option == (Object)null) { return; } if ((Object)(object)option._rarity != (Object)null) { option._rarity.richText = true; } if ((Object)(object)option._name != (Object)null) { option._name.richText = true; } if ((Object)(object)option._flavor != (Object)null) { option._flavor.richText = true; } if ((Object)(object)option._activeName != (Object)null) { option._activeName.richText = true; } if ((Object)(object)option._activeDescription != (Object)null) { option._activeDescription.richText = true; } if ((Object)(object)option._rarity != (Object)null) { switch ((int)originalRarity) { case 4: option._rarity.text = "?\ufffd화"; break; case -1: option._rarity.text = "무\ufffd?\ufffd?/color>"; break; } } } } [HarmonyPatch(typeof(OliveTreeCudgelOption))] public class OliveTreeCudgelOption_Patch { private static readonly Dictionary _originalRarities = new Dictionary(); [HarmonyPatch("Set", new Type[] { typeof(Item) })] [HarmonyPrefix] public static void Set_Prefix(OliveTreeCudgelOption __instance, Item item) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected I4, but got Unknown //IL_0031: 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 (!((Object)(object)item == (Object)null)) { int num = (int)((Gear)item).rarity; if (num == 4 || num == -1) { _originalRarities[((Object)__instance).GetInstanceID()] = ((Gear)item).rarity; ((Gear)item)._rarity = (Rarity)((num == 4) ? 3 : 0); } } } [HarmonyPatch("Set", new Type[] { typeof(Item) })] [HarmonyPostfix] public static void Set_Postfix(OliveTreeCudgelOption __instance, Item item) { //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_003e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)item == (Object)null) && _originalRarities.TryGetValue(((Object)__instance).GetInstanceID(), out var value)) { ((Gear)item)._rarity = value; _originalRarities.Remove(((Object)__instance).GetInstanceID()); OverrideOliveTreeCudgelOptionUI(__instance, value); } } private static void OverrideOliveTreeCudgelOptionUI(OliveTreeCudgelOption option, Rarity originalRarity) { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected I4, but got Unknown if ((Object)(object)option == (Object)null) { return; } if ((Object)(object)option._rarity != (Object)null) { option._rarity.richText = true; } if ((Object)(object)option._name != (Object)null) { option._name.richText = true; } if ((Object)(object)option._description != (Object)null) { option._description.richText = true; } if ((Object)(object)option._flavorSimple != (Object)null) { option._flavorSimple.richText = true; } if ((Object)(object)option._flavorDetail != (Object)null) { option._flavorDetail.richText = true; } if ((Object)(object)option._rarity != (Object)null) { switch ((int)originalRarity) { case 4: option._rarity.text = "?\ufffd화"; break; case -1: option._rarity.text = "무\ufffd?\ufffd?/color>"; break; } } } } public static class EnumArray_ManualPatch { public static void Patch(Harmony harmony) { //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Expected O, but got Unknown //IL_04fa: Unknown result type (might be due to invalid IL or missing references) //IL_0508: Expected O, but got Unknown //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Expected O, but got Unknown //IL_054c: Unknown result type (might be due to invalid IL or missing references) //IL_055a: Expected O, but got Unknown //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Expected O, but got Unknown //IL_0599: Unknown result type (might be due to invalid IL or missing references) //IL_05a7: Expected O, but got Unknown //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Expected O, but got Unknown //IL_05e6: Unknown result type (might be due to invalid IL or missing references) //IL_05f4: Expected O, but got Unknown //IL_0638: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Expected O, but got Unknown Debug.Log((object)"[ChzzkSkul.EnumArray_ManualPatch] Initializing manual generic patching."); Type[] array = new Type[9] { typeof(EnumArray), typeof(EnumArray), typeof(EnumArray), typeof(EnumArray>), typeof(EnumArray), typeof(EnumArray), typeof(EnumArray), typeof(EnumArray), typeof(EnumArray) }; Type[] array2 = array; foreach (Type type in array2) { try { Type type2 = type.GetGenericArguments()[0]; Type type3 = type.GetGenericArguments()[1]; Type type4 = typeof(GenericEnumArrayPatch<, >).MakeGenericType(type2, type3); MethodInfo method = type.GetMethod("get_Item", new Type[1] { type2 }); if (method != null) { MethodInfo method2 = type4.GetMethod("get_Item_Prefix", BindingFlags.Static | BindingFlags.Public); harmony.Patch((MethodBase)method, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Debug.Log((object)("[ChzzkSkul.EnumArray_ManualPatch] Successfully patched get_Item for " + type.FullName)); } MethodInfo method3 = type.GetMethod("set_Item", new Type[2] { type2, type3 }); if (method3 != null) { MethodInfo method4 = type4.GetMethod("set_Item_Prefix", BindingFlags.Static | BindingFlags.Public); harmony.Patch((MethodBase)method3, new HarmonyMethod(method4), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Debug.Log((object)("[ChzzkSkul.EnumArray_ManualPatch] Successfully patched set_Item for " + type.FullName)); } MethodInfo method5 = type.GetMethod("Get", new Type[1] { type2 }); if (method5 != null) { MethodInfo method6 = type4.GetMethod("Get_Prefix", BindingFlags.Static | BindingFlags.Public); harmony.Patch((MethodBase)method5, new HarmonyMethod(method6), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Debug.Log((object)("[ChzzkSkul.EnumArray_ManualPatch] Successfully patched Get for " + type.FullName)); } MethodInfo method7 = type.GetMethod("GetOrDefault", new Type[1] { type2 }); if (method7 != null) { MethodInfo method8 = type4.GetMethod("GetOrDefault_Prefix", BindingFlags.Static | BindingFlags.Public); harmony.Patch((MethodBase)method7, new HarmonyMethod(method8), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Debug.Log((object)("[ChzzkSkul.EnumArray_ManualPatch] Successfully patched GetOrDefault for " + type.FullName)); } MethodInfo method9 = type.GetMethod("Set", new Type[2] { type2, type3 }); if (method9 != null) { MethodInfo method10 = type4.GetMethod("Set_Prefix", BindingFlags.Static | BindingFlags.Public); harmony.Patch((MethodBase)method9, new HarmonyMethod(method10), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Debug.Log((object)("[ChzzkSkul.EnumArray_ManualPatch] Successfully patched Set for " + type.FullName)); } } catch (Exception arg) { Debug.LogError((object)$"[ChzzkSkul.EnumArray_ManualPatch] Failed to patch {type.FullName}: {arg}"); } } try { List list = new List(); Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { string name = assembly.GetName().Name; if (!(name == "Assembly-CSharp") && !(name == "ChzzkSkul") && !(name == "Assembly-CSharp-firstpass")) { continue; } Type[] types = assembly.GetTypes(); foreach (Type type5 in types) { FieldInfo[] fields = type5.GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { Type fieldType = fieldInfo.FieldType; if (fieldType.IsGenericType && fieldType.GetGenericTypeDefinition() == typeof(EnumArray<, >)) { Type[] genericArguments = fieldType.GetGenericArguments(); if (genericArguments.Length == 2 && (genericArguments[0] == typeof(Rarity) || genericArguments[0] == typeof(Key)) && Array.IndexOf(array, fieldType) < 0 && !list.Contains(fieldType)) { list.Add(fieldType); } } } } } foreach (Type item in list) { try { Type type6 = item.GetGenericArguments()[0]; Type type7 = item.GetGenericArguments()[1]; Type type8 = typeof(GenericEnumArrayPatch<, >).MakeGenericType(type6, type7); MethodInfo method11 = item.GetMethod("get_Item", new Type[1] { type6 }); if (method11 != null) { MethodInfo method12 = type8.GetMethod("get_Item_Prefix", BindingFlags.Static | BindingFlags.Public); harmony.Patch((MethodBase)method11, new HarmonyMethod(method12), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo method13 = item.GetMethod("set_Item", new Type[2] { type6, type7 }); if (method13 != null) { MethodInfo method14 = type8.GetMethod("set_Item_Prefix", BindingFlags.Static | BindingFlags.Public); harmony.Patch((MethodBase)method13, new HarmonyMethod(method14), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo method15 = item.GetMethod("Get", new Type[1] { type6 }); if (method15 != null) { MethodInfo method16 = type8.GetMethod("Get_Prefix", BindingFlags.Static | BindingFlags.Public); harmony.Patch((MethodBase)method15, new HarmonyMethod(method16), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo method17 = item.GetMethod("GetOrDefault", new Type[1] { type6 }); if (method17 != null) { MethodInfo method18 = type8.GetMethod("GetOrDefault_Prefix", BindingFlags.Static | BindingFlags.Public); harmony.Patch((MethodBase)method17, new HarmonyMethod(method18), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo method19 = item.GetMethod("Set", new Type[2] { type6, type7 }); if (method19 != null) { MethodInfo method20 = type8.GetMethod("Set_Prefix", BindingFlags.Static | BindingFlags.Public); harmony.Patch((MethodBase)method19, new HarmonyMethod(method20), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } Debug.Log((object)("[ChzzkSkul.EnumArray_ManualPatch] Successfully patched dynamically discovered EnumArray: " + item.FullName)); } catch (Exception arg2) { Debug.LogWarning((object)$"[ChzzkSkul.EnumArray_ManualPatch] Failed to patch dynamically discovered {item.FullName}: {arg2}"); } } } catch (Exception arg3) { Debug.LogWarning((object)$"[ChzzkSkul.EnumArray_ManualPatch] Error during dynamic EnumArray discovery: {arg3}"); } } } public static class GenericEnumArrayPatch where TEnum : struct, Enum { public static bool get_Item_Prefix(EnumArray __instance, TEnum key, ref T __result) { int num = Convert.ToInt32(key); T[] array = __instance.Array; if (array == null) { __result = default(T); return false; } if (num < 0) { __result = ((array.Length != 0) ? array[0] : default(T)); return false; } if (num >= array.Length) { __result = default(T); return false; } return true; } public static bool set_Item_Prefix(EnumArray __instance, TEnum key, T value) { int num = Convert.ToInt32(key); if (num < 0) { num = 0; } T[] array = __instance.Array; if (array == null) { return false; } if (num >= array.Length) { T[] array2 = new T[num + 1]; Array.Copy(array, array2, array.Length); __instance.Array = array2; array = array2; Debug.Log((object)$"[ChzzkSkul.EnumArray_Patch] Resized EnumArray<{typeof(TEnum).Name}, {typeof(T).Name}> array to {num + 1}"); } array[num] = value; return false; } public static bool Get_Prefix(EnumArray __instance, TEnum type, ref T __result) { return get_Item_Prefix(__instance, type, ref __result); } public static bool GetOrDefault_Prefix(EnumArray __instance, TEnum type, ref T __result) { int num = Convert.ToInt32(type); T[] array = __instance.Array; if (array == null) { __result = default(T); return false; } if (num < 0 || num >= array.Length) { __result = default(T); return false; } return true; } public static bool Set_Prefix(EnumArray __instance, TEnum type, T value) { return set_Item_Prefix(__instance, type, value); } } [HarmonyPatch(typeof(LevelManager), "InvokeOnActivateMapReward")] public class LevelManager_InvokeOnActivateMapReward_Patch { [HarmonyPostfix] public static void Postfix() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (MedjedCloakAbility.IsActive) { Character player = ChzzkCardSynergy.GetPlayer(); if ((Object)(object)player != (Object)null) { ((MonoBehaviour)PluginItems.Instance).StartCoroutine(C_DropMedjedCloakRewards(((Component)player).transform.position)); } } } private static IEnumerator C_DropMedjedCloakRewards(Vector3 position) { //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) Service service = Singleton.Instance; if ((Object)(object)service == (Object)null || (Object)(object)service.gearManager == (Object)null || (Object)(object)service.levelManager == (Object)null) { yield break; } Rarity rarity = PickRandomRarity(); ItemReference itemRef = service.gearManager.GetItemToTake(rarity) ?? service.gearManager.GetItemToTake((Rarity)0); if (itemRef != null) { ItemRequest req = itemRef.LoadAsync(); while (!((Request)(object)req).isDone) { yield return null; } if ((Object)(object)((Request)(object)req).asset != (Object)null) { service.levelManager.DropItem(req, position + Vector3.right * 1.5f); } } Rarity rarity2 = PickRandomRarity(); WeaponReference weaponRef = service.gearManager.GetWeaponToTake(rarity2) ?? service.gearManager.GetWeaponToTake((Rarity)0); if (weaponRef != null) { WeaponRequest req2 = weaponRef.LoadAsync(); while (!((Request)(object)req2).isDone) { yield return null; } if ((Object)(object)((Request)(object)req2).asset != (Object)null) { service.levelManager.DropWeapon(req2, position + Vector3.left * 1.5f); } } ChzzkCardSynergy.ShowFloatingText("메제?\ufffd의 망토 ?\ufffd과\ufffd?무작???\ufffd이?\ufffd과 ?\ufffd컬???\ufffd롭?\ufffd었?\ufffd니??"); } private static Rarity PickRandomRarity() { //IL_000a: 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) int num = Random.Range(0, 4); return (Rarity)num; } } public class Character_Start_Patch { [HarmonyPostfix] public static void Postfix(Character __instance) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 if (ChallengersBeltAbility.IsActive && (int)__instance.type != 6 && (int)__instance.type != 7 && (Object)(object)__instance.health != (Object)null) { double num = ((Health)__instance.health).maximumHealth * 5.0; ((Health)__instance.health).SetMaximumHealth(num); ((Health)__instance.health).SetHealth(num, num); } } } public class Health_TakeDamage_Patch { [HarmonyPrefix] public static bool Prefix(Health __instance, ref Damage damage) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 if (ChallengersBeltAbility.IsActive && (Object)(object)__instance.owner != (Object)null && (int)__instance.owner.type == 6 && !damage.@null) { damage.multiplier *= 1.5; damage.@base *= 1.5; } return true; } } [HarmonyPatch(typeof(Chest), "Initialize")] public class Chest_Initialize_Patch { [HarmonyPrefix] public static bool Prefix(Chest __instance, ref Rarity ____rarity, ref Animator ____animator, ref RuntimeAnimatorController ____commonChest, ref RuntimeAnimatorController ____legendaryChest, ref List ____toDropRequests, ref List ____toDropReferences, ref Gear[] ____rewards) { int num = (int)____rarity; if (num == 4 || num == -1) { if (num == 4) { ____animator.runtimeAnimatorController = ____legendaryChest; } else { ____animator.runtimeAnimatorController = ____commonChest; } ____toDropRequests = new List(3); ____toDropReferences = new List(3); ____rewards = (Gear[])(object)new Gear[3]; return false; } return true; } } [HarmonyPatch(typeof(HardmodeChest), "Initialize")] public class HardmodeChest_Initialize_Patch { [HarmonyPrefix] public static bool Prefix(HardmodeChest __instance, ref Rarity ____rarity, ref Animator ____animator, ref RuntimeAnimatorController ____commonChest, ref RuntimeAnimatorController ____legendaryChest, ref List ____toDropRequests, ref List ____toDropReferences, ref Gear[] ____rewards, ref int ____rewardCount, int ____normalChestItemCount) { int num = (int)____rarity; if (num == 4 || num == -1) { if (num == 4) { ____animator.runtimeAnimatorController = ____legendaryChest; } else { ____animator.runtimeAnimatorController = ____commonChest; } ____rewardCount = ____normalChestItemCount; ____toDropRequests = new List(____rewardCount); ____toDropReferences = new List(____rewardCount); ____rewards = (Gear[])(object)new Gear[____rewardCount]; return false; } return true; } } [HarmonyPatch(typeof(Chest), "EvaluateGearRarity")] public class Chest_EvaluateGearRarity_Patch { [HarmonyPrefix] public static bool Prefix(Chest __instance, ref Rarity ____rarity, ref Rarity ____gearRarity) { int num = (int)____rarity; if (num == 4 || num == -1) { ____gearRarity = ____rarity; return false; } return true; } [HarmonyPostfix] public static void Postfix(ref Rarity ____gearRarity, Random ____random) { if ((int)____gearRarity == 3) { if (____random.NextDouble() < 0.2) { ____gearRarity = (Rarity)4; Debug.Log((object)"[ChzzkSkul] Chest Postfix: Legendary rarity upgraded to Mythic (4) with 20% chance!"); } } else if ((int)____gearRarity == 0 && ____random.NextDouble() < 0.05) { ____gearRarity = (Rarity)(-1); Debug.Log((object)"[ChzzkSkul] Chest Postfix: Common rarity downgraded to Trash (-1) with 5% chance!"); } } } [HarmonyPatch(typeof(HardmodeChest), "EvaluateGearRarity")] public class HardmodeChest_EvaluateGearRarity_Patch { [HarmonyPrefix] public static bool Prefix(HardmodeChest __instance, ref Rarity ____rarity, ref Rarity ____gearRarity) { int num = (int)____rarity; if (num == 4 || num == -1) { ____gearRarity = ____rarity; return false; } return true; } [HarmonyPostfix] public static void Postfix(ref Rarity ____gearRarity, Random ____random) { if ((int)____gearRarity == 3) { if (____random.NextDouble() < 0.2) { ____gearRarity = (Rarity)4; Debug.Log((object)"[ChzzkSkul] HardmodeChest Postfix: Legendary rarity upgraded to Mythic (4) with 20% chance!"); } } else if ((int)____gearRarity == 0 && ____random.NextDouble() < 0.05) { ____gearRarity = (Rarity)(-1); Debug.Log((object)"[ChzzkSkul] HardmodeChest Postfix: Common rarity downgraded to Trash (-1) with 5% chance!"); } } } [HarmonyPatch(typeof(AbilityAttacher), "Initialize")] public class AbilityAttacher_Initialize_Patch { [HarmonyPrefix] public static void Prefix(AbilityAttacher __instance, Character character) { try { if ((Object)(object)__instance == (Object)null) { return; } Item item = ((Component)__instance).GetComponentInParent(); if ((Object)(object)item == (Object)null) { return; } CustomItemReference customItemReference = CustomItems.Items.FirstOrDefault((CustomItemReference ci) => ((Object)item).name == ci.name || ((Object)item).name == "Custom-" + ci.name); if (customItemReference == null) { return; } AlwaysAbilityAttacher val = (AlwaysAbilityAttacher)(object)((__instance is AlwaysAbilityAttacher) ? __instance : null); if (val == null || !((Object)(object)val._abilityComponent != (Object)null)) { return; } Type type = ((object)val._abilityComponent).GetType(); FieldInfo fieldInfo = AccessTools.Field(type, "_ability"); if (!(fieldInfo != null) || fieldInfo.GetValue(val._abilityComponent) != null) { return; } int result = 0; string name = ((Object)((Component)val).gameObject).name; if (name.StartsWith("[") && name.EndsWith("]")) { int.TryParse(name.Substring(1, name.Length - 2), out result); } if (customItemReference.abilities != null && result >= 0 && result < customItemReference.abilities.Length) { Ability val2 = customItemReference.abilities[result]; if (val2 != null) { Ability value = (Ability)((val2 is ICloneable cloneable) ? ((object)/*isinst with value type is only supported in some contexts*/) : ((object)val2)); fieldInfo.SetValue(val._abilityComponent, value); Debug.Log((object)$"[ChzzkSkul] Successfully restored null _ability on custom item {((Object)item).name} for attacher index {result}"); } } } catch (Exception ex) { Debug.LogError((object)("[ChzzkSkul] Error in AbilityAttacher.Initialize patch: " + ex)); } } } [HarmonyPatch(typeof(FieldNpc), "OnDestroy")] public class FieldNpcOnDestroyPatch { [HarmonyPrefix] public static bool Prefix(FieldNpc __instance) { try { if (Service.quitting) { return false; } Service instance = Singleton.Instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.levelManager != (Object)null && (Object)(object)instance.levelManager.player != (Object)null && (Object)(object)instance.levelManager.player.health != (Object)null) { MethodInfo method = typeof(FieldNpc).GetMethod("StopConversation", BindingFlags.Instance | BindingFlags.NonPublic); if (method != null) { Delegate? obj = Delegate.CreateDelegate(typeof(TookDamageDelegate), __instance, method, throwOnBindFailure: false); TookDamageDelegate val = (TookDamageDelegate)(object)((obj is TookDamageDelegate) ? obj : null); if (val != null) { ((Health)instance.levelManager.player.health).onTookDamage -= val; } } } try { FieldInfo field = typeof(FieldNpc).GetField("_npcConversation", BindingFlags.Instance | BindingFlags.NonPublic); NpcConversation val2 = (NpcConversation)((field != null) ? /*isinst with value type is only supported in some contexts*/: null); if ((Object)(object)val2 != (Object)null) { val2.portrait = null; val2.visible = false; } if ((Object)(object)LetterBox.instance != (Object)null) { LetterBox.instance.Disappear(0.4f); } } catch { } } catch (Exception ex) { Debug.LogError((object)("[ChzzkSkul] Error in FieldNpcOnDestroyPatch: " + ex)); } return false; } } [HarmonyPatch(typeof(SleepySkeleton), "OnDestroy")] public class SleepySkeletonOnDestroyPatch { [HarmonyPrefix] public static bool Prefix(SleepySkeleton __instance) { try { if (!Service.quitting) { Service instance = Singleton.Instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.levelManager != (Object)null && (Object)(object)instance.levelManager.player != (Object)null && (Object)(object)instance.levelManager.player.health != (Object)null) { MethodInfo method = typeof(FieldNpc).GetMethod("StopConversation", BindingFlags.Instance | BindingFlags.NonPublic); if (method != null) { Delegate? obj = Delegate.CreateDelegate(typeof(TookDamageDelegate), __instance, method, throwOnBindFailure: false); TookDamageDelegate val = (TookDamageDelegate)(object)((obj is TookDamageDelegate) ? obj : null); if (val != null) { ((Health)instance.levelManager.player.health).onTookDamage -= val; } } } try { FieldInfo field = typeof(FieldNpc).GetField("_npcConversation", BindingFlags.Instance | BindingFlags.NonPublic); NpcConversation val2 = (NpcConversation)((field != null) ? /*isinst with value type is only supported in some contexts*/: null); if ((Object)(object)val2 != (Object)null) { val2.portrait = null; val2.visible = false; } if ((Object)(object)LetterBox.instance != (Object)null) { LetterBox.instance.Disappear(0.4f); } } catch { } } Service instance2 = Singleton.Instance; if ((Object)(object)instance2 != (Object)null && (Object)(object)instance2.gearManager != (Object)null) { MethodInfo method2 = typeof(SleepySkeleton).GetMethod("Load", BindingFlags.Instance | BindingFlags.NonPublic); if (method2 != null && Delegate.CreateDelegate(typeof(Action), __instance, method2, throwOnBindFailure: false) is Action action) { instance2.gearManager.onWeaponInstanceChanged -= action; } } FieldInfo field2 = typeof(SleepySkeleton).GetField("_weaponRequest", BindingFlags.Instance | BindingFlags.NonPublic); ((Request)((field2 != null) ? /*isinst with value type is only supported in some contexts*/: null))?.Release(); } catch (Exception ex) { Debug.LogError((object)("[ChzzkSkul] Error in SleepySkeletonOnDestroyPatch: " + ex)); } return false; } } public static class CustomGearsManualPatch { public static void Patch(Harmony harmony) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown try { MethodInfo method = typeof(Health).GetMethod("TakeDamage", BindingFlags.Instance | BindingFlags.Public, null, new Type[1] { typeof(Damage).MakeByRefType() }, null); if (method == null) { PluginItems.Log.LogError((object)"[CustomGearsPatch] Failed to find TakeDamage(ref Damage) method on Characters.Health"); return; } MethodInfo method2 = typeof(Health_TakeDamage_Patch).GetMethod("Prefix", BindingFlags.Static | BindingFlags.Public); if (method2 == null) { PluginItems.Log.LogError((object)"[CustomGearsPatch] Failed to find Prefix method on Health_TakeDamage_Patch"); return; } harmony.Patch((MethodBase)method, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); PluginItems.Log.LogInfo((object)"[CustomGearsPatch] TakeDamage(ref Damage) successfully manually patched!"); } catch (Exception ex) { PluginItems.Log.LogError((object)("[CustomGearsPatch] ManualPatch exception: " + ex)); } } } public class HermitDiscountMarker : MonoBehaviour { public int originalPrice = -1; private DroppedGear _droppedGear; private void Awake() { _droppedGear = ((Component)this).GetComponent(); } private void Start() { if ((Object)(object)_droppedGear != (Object)null && _droppedGear.price > 0 && originalPrice == -1) { originalPrice = _droppedGear.price; } } private void Update() { if ((Object)(object)_droppedGear == (Object)null) { return; } if ((originalPrice == -1 || originalPrice <= 0) && _droppedGear.price > 0) { originalPrice = _droppedGear.price; } if (originalPrice > 0) { int num = (CustomGearsPatch.HasCardHermit() ? ((int)((float)originalPrice * 0.7f)) : originalPrice); if (_droppedGear.price != num) { _droppedGear.price = num; } } } } [HarmonyPatch(typeof(InstantAttack), "Run")] public class InstantAttack_Run_Patch { [HarmonyPrefix] public static void Prefix(InstantAttack __instance, Character owner) { try { FieldInfo fieldInfo = AccessTools.Field(typeof(InstantAttack), "_attackDamage"); if (!(fieldInfo != null)) { return; } object? value = fieldInfo.GetValue(__instance); IAttackDamage val = (IAttackDamage)((value is IAttackDamage) ? value : null); if (val != null) { return; } if ((Object)(object)owner != (Object)null && (Object)(object)owner.ability != (Object)null) { Instance instanceByInstanceType = owner.ability.GetInstanceByInstanceType(); if (instanceByInstanceType != null) { FieldInfo field = typeof(AbilityInstance).GetField("ability", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object? value2 = field.GetValue(instanceByInstanceType); Doomsday val2 = (Doomsday)((value2 is Doomsday) ? value2 : null); if (val2 != null && (Object)(object)val2.component != (Object)null) { fieldInfo.SetValue(__instance, val2.component); return; } } } } IAttackDamage componentInParent = ((Component)__instance).GetComponentInParent(); if (componentInParent != null) { fieldInfo.SetValue(__instance, componentInParent); } } catch (Exception ex) { Debug.LogError((object)("[InstantAttack_Run_Patch] Exception: " + ex)); } } } [Serializable] public class CustomItemReference : ItemReference { private string _originalName; public string itemName_EN; public string itemName_KR; public string itemDescription_EN; public string itemDescription_KR; public string itemLore_EN; public string itemLore_KR; public Values stats; public Ability[] abilities; public Type[] extraComponents; public string[] forbiddenDrops = new string[0]; public Sprite miniIcon; public string spriteName; private Item item = null; private static GameObject rootObj; public string name { get { return ((GearReference)this).name; } set { _originalName = value; ((GearReference)this).name = "Custom-" + _originalName; ((GearReference)this).guid = "custom_item://" + value; ((GearReference)this).displayNameKey = "item/" + ((GearReference)this).name + "/name"; } } public string itemName { get { if (PluginItems.IsKorean()) { return string.IsNullOrEmpty(itemName_KR) ? itemName_EN : itemName_KR; } return string.IsNullOrEmpty(itemName_EN) ? itemName_KR : itemName_EN; } } public string itemDescription { get { if (PluginItems.IsKorean()) { return string.IsNullOrEmpty(itemDescription_KR) ? itemDescription_EN : itemDescription_KR; } return string.IsNullOrEmpty(itemDescription_EN) ? itemDescription_KR : itemDescription_EN; } } public string itemLore { get { if (PluginItems.IsKorean()) { return string.IsNullOrEmpty(itemLore_KR) ? itemLore_EN : itemLore_KR; } return string.IsNullOrEmpty(itemLore_EN) ? itemLore_KR : itemLore_EN; } } public CustomItemReference() { ((GearReference)this).obtainable = true; ((GearReference)this).needUnlock = false; ((GearReference)this).path = "Assets/Gear/Items/BasicCarleonSword.prefab"; } public Item GetItem(Item baseItem) { //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) //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_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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0e23: 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_087f: Unknown result type (might be due to invalid IL or missing references) //IL_0886: Expected O, but got Unknown //IL_08a9: Unknown result type (might be due to invalid IL or missing references) //IL_08ae: Unknown result type (might be due to invalid IL or missing references) //IL_08b1: Expected O, but got Unknown //IL_08b6: Expected O, but got Unknown //IL_092d: Unknown result type (might be due to invalid IL or missing references) //IL_0934: Expected O, but got Unknown //IL_0a2c: Unknown result type (might be due to invalid IL or missing references) //IL_0a33: Expected O, but got Unknown Debug.Log((object)("[ChzzkSkul] GetItem called for Custom Item: " + this.name)); if ((Object)(object)item == (Object)null) { Debug.Log((object)("[ChzzkSkul] Instantiating and initializing new Custom Item instance for: " + this.name)); if ((Object)(object)rootObj == (Object)null) { rootObj = new GameObject("CustomItems"); rootObj.SetActive(false); Object.DontDestroyOnLoad((Object)(object)rootObj); } item = Object.Instantiate(baseItem, rootObj.transform); ((Object)((Component)item).gameObject).name = this.name; item.keyword1 = base.prefabKeyword1; item.keyword2 = base.prefabKeyword2; ((Gear)item)._stat = stats; ((Gear)item)._rarity = ((GearReference)this).rarity; ((Gear)item)._gearTag = ((GearReference)this).gearTag; ((Gear)item)._groupItemKeys = forbiddenDrops.Select((string n) => "Custom-" + n).ToArray(); string gearName = (string.IsNullOrEmpty(spriteName) ? _originalName : spriteName); if ((Object)(object)((GearReference)this).icon == (Object)null) { ((GearReference)this).icon = CustomSpriteHelper.GetOrGenerateSprite(gearName, ((GearReference)this).rarity, isIcon: true); if ((Object)(object)((GearReference)this).icon == (Object)null) { ((GearReference)this).icon = ((Gear)baseItem).icon; } } if ((Object)(object)((GearReference)this).thumbnail == (Object)null) { ((GearReference)this).thumbnail = CustomSpriteHelper.GetOrGenerateSprite(gearName, ((GearReference)this).rarity, isIcon: false); if ((Object)(object)((GearReference)this).thumbnail == (Object)null) { ((GearReference)this).thumbnail = ((Gear)baseItem).thumbnail; } } if ((Object)(object)((GearReference)this).icon != (Object)null && (Object)(object)((Gear)item).dropped != (Object)null && (Object)(object)((Gear)item).dropped.spriteRenderer != (Object)null) { ((Gear)item).dropped.spriteRenderer.sprite = ((GearReference)this).icon; } if (abilities != null && abilities.Length != 0) { if (_originalName == "GuanYuCrescentBlade") { EffectInfo val = null; SoundInfo val2 = null; try { GearResource instance = GearResource.instance; List list = new List(); if (instance._items != null) { list.AddRange(instance._items); } FieldInfo fieldInfo = AccessTools.Field(typeof(GearResource), "_dlcItems"); if (fieldInfo != null && fieldInfo.GetValue(instance) is List collection) { list.AddRange(collection); } string[] array = new string[2] { "BattlefieldCup_2", "BattlefieldCup" }; ItemReference val3 = null; string[] array2 = array; foreach (string name in array2) { val3 = ((IEnumerable)list).FirstOrDefault((Func)((ItemReference i) => ((GearReference)(i?)).name.Equals(name, StringComparison.OrdinalIgnoreCase) ?? false)); if (val3 == null) { continue; } ItemRequest val4 = val3.LoadAsync(); ((Request)(object)val4).WaitForCompletion(); Item asset = ((Request)(object)val4).asset; if (!((Object)(object)asset != (Object)null)) { continue; } Debug.Log((object)("[ChzzkSkul] Fallback asset loaded: " + ((Object)asset).name + ". Starting deep dump of EffectInfos/SoundInfos:")); DumpAllEffectInfos(((Component)asset).gameObject); val = CustomSpriteHelper.FindEffectInfo(((Component)asset).gameObject); if (((Object)asset).name.Equals("BattlefieldCup_2", StringComparison.OrdinalIgnoreCase)) { Dictionary dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase); HashSet checkedObjects = new HashSet(); MonoBehaviour[] componentsInChildren = ((Component)asset).gameObject.GetComponentsInChildren(true); foreach (MonoBehaviour val5 in componentsInChildren) { if ((Object)(object)val5 != (Object)null) { CustomSpriteHelper.FindAllEffectInfosRecursive(val5, ((object)val5).GetType().Name, dictionary, checkedObjects); } } Debug.Log((object)$"[ChzzkSkul] GuanYu Override: Gathered {dictionary.Count} total keys for BattlefieldCup_2:"); foreach (KeyValuePair item in dictionary) { string text = (((Object)(object)item.Value.effect != (Object)null) ? ((Object)item.Value.effect).name : "null"); string text2 = (((Object)(object)item.Value.animation != (Object)null) ? ((Object)item.Value.animation).name : "null"); Debug.Log((object)("[ChzzkSkul] Gathered Key: '" + item.Key + "' (Asset: '" + text + "', Anim: '" + text2 + "')")); } EffectInfo val6 = null; EffectInfo val7 = null; string text3 = dictionary.Keys.FirstOrDefault((string k) => k.Contains("_abilityAttacher._components[1]") && k.Contains("_onPass") && k.EndsWith("_operations._components[3]._operation._info")); if (text3 == null) { text3 = dictionary.Keys.FirstOrDefault((string k) => k.EndsWith("_operations._components[3]._operation._info", StringComparison.OrdinalIgnoreCase)); } string text4 = dictionary.Keys.FirstOrDefault((string k) => k.Contains("_abilityAttacher._components[1]") && k.Contains("_onPass") && k.EndsWith("_operations._components[0]._operation._info")); if (text4 == null) { text4 = dictionary.Keys.FirstOrDefault((string k) => k.EndsWith("_operations._components[0]._operation._info", StringComparison.OrdinalIgnoreCase)); } if (text3 != null) { val6 = dictionary[text3]; Debug.Log((object)("[ChzzkSkul] GuanYu Override: Found GreenSlashEffect from path '" + text3 + "'")); } if (text4 != null) { val7 = dictionary[text4]; Debug.Log((object)("[ChzzkSkul] GuanYu Override: Found BlackCircleEffect from path '" + text4 + "'")); } GuanYuCrescentBladeAbility.GreenSlashEffect = val6; GuanYuCrescentBladeAbility.BlackCircleEffect = val7; val = val6 ?? val7; } val2 = CustomSpriteHelper.FindSoundInfo(((Component)asset).gameObject); if (val != null && val2 != null) { Debug.Log((object)("[ChzzkSkul] Successfully cached target slashing effects from fallback asset: " + ((Object)asset).name)); break; } } } catch (Exception ex) { Debug.LogError((object)("[ChzzkSkul] Failed to load fallback slash effect: " + ex)); } if (val == null) { val = CustomSpriteHelper.FindEffectInfo(((Component)this.item).gameObject); } if (val2 == null) { val2 = CustomSpriteHelper.FindSoundInfo(((Component)this.item).gameObject); } GuanYuCrescentBladeAbility.SlashEffect = val; GuanYuCrescentBladeAbility.SlashSound = val2; if (GuanYuCrescentBladeAbility.GreenSlashEffect == null) { GuanYuCrescentBladeAbility.GreenSlashEffect = val; } Debug.Log((object)("[ChzzkSkul] GuanYuCrescentBlade cached slash effect: " + ((val != null) ? "Found" : "NULL") + ", sound: " + ((val2 != null) ? "Found" : "NULL"))); } else if (_originalName == "ZeusHammer") { EffectInfo val8 = CustomSpriteHelper.FindEffectInfo(((Component)this.item).gameObject); SoundInfo val9 = CustomSpriteHelper.FindSoundInfo(((Component)this.item).gameObject); ZeusHammerAbility.LightningEffect = val8; ZeusHammerAbility.LightningSound = val9; Debug.Log((object)("[ChzzkSkul] ZeusHammer cached lightning effect: " + ((val8 != null) ? "Found" : "NULL") + ", sound: " + ((val9 != null) ? "Found" : "NULL"))); if (val8 == null) { Debug.Log((object)"[ChzzkSkul] ZeusHammer effect is null! Dumping GameObject:"); CustomSpriteHelper.DumpGameObject(((Component)this.item).gameObject); } } AbilityAttacher[] componentsInChildren2 = ((Component)this.item).GetComponentsInChildren(true); AbilityAttacher[] array3 = componentsInChildren2; foreach (AbilityAttacher val10 in array3) { if ((Object)(object)val10 != (Object)null) { Object.DestroyImmediate((Object)(object)val10); } } GameObject val11 = new GameObject("Ability Attacher"); val11.transform.parent = ((Component)this.item).gameObject.transform; Item obj = this.item; Subcomponents val12 = new Subcomponents(); Subcomponents val13 = val12; obj._abilityAttacher = val12; Subcomponents val14 = val13; ((SubcomponentArray)(object)val14)._container = val11; ((SubcomponentArray)(object)val14)._components = (AbilityAttacher[])(object)new AbilityAttacher[abilities.Length]; if ((Object)(object)miniIcon != (Object)null) { abilities[0]._defaultIcon = miniIcon; } for (int num4 = 0; num4 < abilities.Length; num4++) { GameObject val15 = new GameObject("[" + num4 + "]", new Type[1] { typeof(AlwaysAbilityAttacher) }); val15.transform.parent = val11.transform; AlwaysAbilityAttacher component = val15.GetComponent(); component._abilityComponent = CreateAbilityObject(val15, abilities[num4]); ((SubcomponentArray)(object)val14)._components[num4] = (AbilityAttacher)(object)component; } } else if (this.item._abilityAttacher != null && ((SubcomponentArray)(object)this.item._abilityAttacher)._components != null) { AbilityAttacher[] components = ((SubcomponentArray)(object)this.item._abilityAttacher)._components; foreach (AbilityAttacher val16 in components) { if ((Object)(object)val16 != (Object)null) { ((Behaviour)val16).enabled = false; } } } if (extraComponents != null && extraComponents.Length != 0) { GameObject val17 = new GameObject("Extra Behaviors"); val17.transform.parent = ((Component)this.item).gameObject.transform; Type[] array4 = extraComponents; foreach (Type type in array4) { Component obj2 = val17.AddComponent(type); FieldInfo fieldInfo2 = AccessTools.Field(type, "_item"); if (fieldInfo2 != null) { fieldInfo2.SetValue(obj2, this.item); } } QuantumSwordBehavior componentInChildren = ((Component)this.item).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { EffectInfo val18 = CustomSpriteHelper.FindEffectInfo(((Component)this.item).gameObject); if (val18 != null) { componentInChildren.SetEffectInfo(val18); Debug.Log((object)"[ChzzkSkul] Found and caching EffectInfo for QuantumSword!"); } else { Debug.LogWarning((object)"[ChzzkSkul] Could not find EffectInfo for QuantumSword!"); } SoundInfo val19 = CustomSpriteHelper.FindSoundInfo(((Component)this.item).gameObject); if (val19 != null) { componentInChildren.SetSoundInfo(val19); Debug.Log((object)"[ChzzkSkul] Found and caching SoundInfo for QuantumSword!"); } else { Debug.LogWarning((object)"[ChzzkSkul] Could not find SoundInfo for QuantumSword!"); } AbilityAttacher[] componentsInChildren3 = ((Component)this.item).GetComponentsInChildren(true); AbilityAttacher[] array5 = componentsInChildren3; foreach (AbilityAttacher val20 in array5) { if ((Object)(object)val20 != (Object)null) { if ((Object)(object)((Component)val20).gameObject != (Object)(object)((Component)this.item).gameObject) { Debug.Log((object)("[ChzzkSkul] Destroying vanilla attacher gameobject immediately: " + ((Object)((Component)val20).gameObject).name)); Object.DestroyImmediate((Object)(object)((Component)val20).gameObject); } else { Debug.Log((object)("[ChzzkSkul] Destroying vanilla attacher component immediately: " + ((object)val20).GetType().FullName)); Object.DestroyImmediate((Object)(object)val20); } } } if (this.item._abilityAttacher != null) { ((SubcomponentArray)(object)this.item._abilityAttacher)._components = (AbilityAttacher[])(object)new AbilityAttacher[0]; } } IdolOfTheOtherworldBehavior componentInChildren2 = ((Component)this.item).GetComponentInChildren(); if ((Object)(object)componentInChildren2 != (Object)null) { SummonOperationRunnersOnGround componentInChildren3 = ((Component)this.item).GetComponentInChildren(true); if ((Object)(object)componentInChildren3 != (Object)null) { FieldInfo field = typeof(SummonOperationRunnersOnGround).GetField("_operationRunner", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object? value = field.GetValue(componentInChildren3); MonoBehaviour val21 = (MonoBehaviour)((value is MonoBehaviour) ? value : null); if ((Object)(object)val21 != (Object)null) { MonoBehaviour val22 = Object.Instantiate(val21, rootObj.transform); ((Object)((Component)val22).gameObject).name = "CustomIdolSpikeAreaPrefab"; Component component2 = ((Component)val22).GetComponent("PoolObject"); if ((Object)(object)component2 != (Object)null) { try { Type type2 = ((object)component2).GetType(); FieldInfo fieldInfo3 = null; FieldInfo fieldInfo4 = null; FieldInfo fieldInfo5 = null; Type type3 = type2; while (type3 != null) { if (fieldInfo3 == null) { fieldInfo3 = type3.GetField("_pool", BindingFlags.Instance | BindingFlags.NonPublic); } if (fieldInfo4 == null) { fieldInfo4 = type3.GetField("_poolIndex", BindingFlags.Instance | BindingFlags.NonPublic); } if (fieldInfo5 == null) { fieldInfo5 = type3.GetField("onDespawn", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } type3 = type3.BaseType; } if (fieldInfo3 != null) { fieldInfo3.SetValue(component2, null); } if (fieldInfo4 != null) { fieldInfo4.SetValue(component2, 0); } if (fieldInfo5 != null) { fieldInfo5.SetValue(component2, null); } } catch (Exception ex2) { Debug.LogError((object)("[ChzzkSkul] Failed to nullify customRunner PoolObject fields: " + ex2)); } } SpriteRenderer[] componentsInChildren4 = ((Component)val22).GetComponentsInChildren(true); foreach (SpriteRenderer val23 in componentsInChildren4) { val23.color = Color.red; } InstantAttack[] componentsInChildren5 = ((Component)val22).GetComponentsInChildren(true); foreach (InstantAttack val24 in componentsInChildren5) { Object.DestroyImmediate((Object)(object)val24); } Collider2D[] componentsInChildren6 = ((Component)val22).GetComponentsInChildren(true); foreach (Collider2D val25 in componentsInChildren6) { if ((Object)(object)((Component)val25).gameObject.GetComponent() == (Object)null) { ((Component)val25).gameObject.AddComponent(); } } ((Component)val22).gameObject.AddComponent(); FieldInfo field2 = typeof(SummonOperationRunnersOnGround).GetField("_terrainFindingRange", BindingFlags.Instance | BindingFlags.NonPublic); if (field2 != null) { object? value2 = field2.GetValue(componentInChildren3); BoxCollider2D val26 = (BoxCollider2D)((value2 is BoxCollider2D) ? value2 : null); if ((Object)(object)val26 != (Object)null) { ((Component)val26).gameObject.SetActive(true); } } Transform val27 = ((Component)componentInChildren3).transform; while ((Object)(object)val27 != (Object)null && (Object)(object)val27 != (Object)(object)((Component)this.item).transform) { ((Component)val27).gameObject.SetActive(true); val27 = val27.parent; } Debug.Log((object)"[ChzzkSkul] Successfully initialized SummonOperationRunnersOnGround for IdolOfTheOtherworld!"); } } } else { Debug.LogError((object)"[ChzzkSkul] Failed to find SummonOperationRunnersOnGround on the cloned item!"); } SoundInfo val28 = CustomSpriteHelper.FindSoundInfo(((Component)this.item).gameObject); if (val28 != null) { componentInChildren2.SetSoundInfo(val28); } AbilityAttacher[] componentsInChildren7 = ((Component)this.item).GetComponentsInChildren(true); AbilityAttacher[] array6 = componentsInChildren7; foreach (AbilityAttacher val29 in array6) { if ((Object)(object)val29 != (Object)null) { ((Behaviour)val29).enabled = false; } } if (this.item._abilityAttacher != null) { ((SubcomponentArray)(object)this.item._abilityAttacher)._components = (AbilityAttacher[])(object)new AbilityAttacher[0]; } } } } return this.item; } private static AbilityComponent CreateAbilityObject(GameObject parent, Ability ability) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown Type abilityType = ((object)ability).GetType(); Assembly assembly = abilityType.Assembly; string componentName = abilityType.Name + "Component"; Type[] array = (from type2 in assembly.GetTypes() where string.Equals(type2.Namespace, abilityType.Namespace, StringComparison.Ordinal) && string.Equals(type2.Name, componentName, StringComparison.Ordinal) select type2).ToArray(); if (array.Length == 1) { Type type = array[0]; GameObject val = new GameObject("Ability", new Type[1] { type }); val.transform.parent = parent.transform; FieldInfo fieldInfo = AccessTools.Field(type, "_ability"); Component component = val.GetComponent(type); fieldInfo.SetValue(component, ability); return (AbilityComponent)component; } throw new NotImplementedException("Ability Component Type " + componentName + " not found."); } private static void DumpAllEffectInfos(GameObject gameObject) { if ((Object)(object)gameObject == (Object)null) { return; } HashSet checkedObjects = new HashSet(); MonoBehaviour[] componentsInChildren = gameObject.GetComponentsInChildren(true); foreach (MonoBehaviour val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { DumpEffectInfoRecursive(val, ((object)val).GetType().Name, checkedObjects); } } } private static void DumpEffectInfoRecursive(object obj, string path, HashSet checkedObjects) { if (obj == null || checkedObjects.Contains(obj)) { return; } checkedObjects.Add(obj); Type type = obj.GetType(); if (type.IsPrimitive || type.IsEnum || type == typeof(string)) { return; } if (obj is IEnumerable enumerable) { int num = 0; foreach (object item in enumerable) { if (item != null) { DumpEffectInfoRecursive(item, $"{path}[{num}]", checkedObjects); } num++; } } Type type2 = type; while (type2 != null) { FieldInfo[] fields = type2.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { if (fieldInfo.FieldType == typeof(EffectInfo)) { try { object? value = fieldInfo.GetValue(obj); EffectInfo val = (EffectInfo)((value is EffectInfo) ? value : null); string text = "Null"; if (val != null) { string text2 = (((Object)(object)val.effect != (Object)null) ? ((Object)val.effect).name : "null"); string text3 = (((Object)(object)val.animation != (Object)null) ? ((Object)val.animation).name : "null"); text = "NotNull (EffectObj: '" + text2 + "', Anim: '" + text3 + "')"; } Debug.Log((object)("[ChzzkSkul] Found EffectInfo field: path='" + path + "." + fieldInfo.Name + "', value=" + text)); } catch { } } else if (fieldInfo.FieldType == typeof(SoundInfo)) { try { object? value2 = fieldInfo.GetValue(obj); SoundInfo val2 = (SoundInfo)((value2 is SoundInfo) ? value2 : null); Debug.Log((object)("[ChzzkSkul] Found SoundInfo field: path='" + path + "." + fieldInfo.Name + "', value=" + ((val2 != null) ? "NotNull" : "Null"))); } catch { } } else { if (!fieldInfo.FieldType.IsClass || (fieldInfo.FieldType.Namespace != null && fieldInfo.FieldType.Namespace.StartsWith("System") && !typeof(IEnumerable).IsAssignableFrom(fieldInfo.FieldType))) { continue; } try { object value3 = fieldInfo.GetValue(obj); if (value3 != null) { DumpEffectInfoRecursive(value3, path + "." + fieldInfo.Name, checkedObjects); } } catch { } } } type2 = type2.BaseType; } } } public static class CustomSpriteHelper { private static readonly Dictionary _glitchedSpriteCache = new Dictionary(); public static Texture2D ResizeTexture(Texture2D source, int targetWidth, int targetHeight) { //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown //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_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_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_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_00c5: 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_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_00d4: 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_00df: 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_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_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) int width = ((Texture)source).width; int height = ((Texture)source).height; Color[] pixels = source.GetPixels(); Color[] array = (Color[])(object)new Color[targetWidth * targetHeight]; for (int i = 0; i < targetHeight; i++) { float num = (float)i / (float)targetHeight * (float)height; int num2 = (int)num; int num3 = ((num2 + 1 < height) ? (num2 + 1) : (height - 1)); float num4 = num - (float)num2; int num5 = num2 * width; int num6 = num3 * width; for (int j = 0; j < targetWidth; j++) { float num7 = (float)j / (float)targetWidth * (float)width; int num8 = (int)num7; int num9 = ((num8 + 1 < width) ? (num8 + 1) : (width - 1)); float num10 = num7 - (float)num8; Color val = pixels[num5 + num8]; Color val2 = pixels[num5 + num9]; Color val3 = pixels[num6 + num8]; Color val4 = pixels[num6 + num9]; Color val5 = Color.Lerp(val, val2, num10); Color val6 = Color.Lerp(val3, val4, num10); Color val7 = Color.Lerp(val5, val6, num4); array[i * targetWidth + j] = val7; } } Texture2D val8 = new Texture2D(targetWidth, targetHeight, (TextureFormat)4, false); val8.SetPixels(array); ((Texture)val8).filterMode = (FilterMode)0; val8.Apply(); return val8; } public static void MakeTextureBackgroundTransparent(Texture2D tex) { //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: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_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_00d2: 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_00df: 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_0157: 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_00f9: 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_0107: 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_0115: 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_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_019a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)tex == (Object)null) { return; } try { Color[] pixels = tex.GetPixels(); Color val = pixels[0]; if (val.a < 0.9f) { return; } float num = 0.15f; for (int i = 0; i < pixels.Length; i++) { Color val2 = pixels[i]; float num2 = Mathf.Abs(val2.r - val.r); float num3 = Mathf.Abs(val2.g - val.g); float num4 = Mathf.Abs(val2.b - val.b); if (num2 < num && num3 < num && num4 < num) { pixels[i] = new Color(0f, 0f, 0f, 0f); } else if (val.r < 0.1f && val.g < 0.1f && val.b < 0.1f && val2.r < 0.05f && val2.g < 0.05f && val2.b < 0.05f) { pixels[i] = new Color(0f, 0f, 0f, 0f); } else if (val.r > 0.9f && val.g > 0.9f && val.b > 0.9f && val2.r > 0.95f && val2.g > 0.95f && val2.b > 0.95f) { pixels[i] = new Color(0f, 0f, 0f, 0f); } } tex.SetPixels(pixels); tex.Apply(); } catch (Exception ex) { Debug.LogWarning((object)("[CustomSpriteHelper] Failed to make background transparent: " + ex.Message)); } } public static Sprite LoadEmbeddedSprite(string resourceName, bool isIcon) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_00d2: 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) try { Assembly assembly = typeof(CustomSpriteHelper).Assembly; using Stream stream = assembly.GetManifestResourceStream(resourceName); if (stream != null) { byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if (ImageConversion.LoadImage(val, array)) { ((Texture)val).filterMode = (FilterMode)0; MakeTextureBackgroundTransparent(val); int num = (isIcon ? 24 : 68); if (((Texture)val).width != num || ((Texture)val).height != num) { Texture2D val2 = ResizeTexture(val, num, num); Object.Destroy((Object)(object)val); val = val2; } Sprite val3 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 32f); ((Object)val3).name = resourceName; return val3; } } } catch (Exception ex) { Debug.LogWarning((object)("[CustomSpriteHelper] Failed to load embedded sprite " + resourceName + ": " + ex.Message)); } return null; } public static Sprite FlipTextureVertically(Sprite original) { //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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //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_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_013f: 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) if ((Object)(object)original == (Object)null) { return null; } try { Texture2D texture = original.texture; if ((Object)(object)texture == (Object)null) { return original; } Rect rect = original.rect; int num = (int)((Rect)(ref rect)).width; int num2 = (int)((Rect)(ref rect)).height; int num3 = (int)((Rect)(ref rect)).x; int num4 = (int)((Rect)(ref rect)).y; Texture2D val = new Texture2D(num, num2, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[num * num2]; Color[] array2 = null; try { array2 = texture.GetPixels(num3, num4, num, num2); } catch { return original; } if (array2 != null) { for (int i = 0; i < num2; i++) { for (int j = 0; j < num; j++) { array[i * num + j] = array2[(num2 - 1 - i) * num + j]; } } val.SetPixels(array); ((Texture)val).filterMode = (FilterMode)0; val.Apply(); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0.5f, 0.5f); if (num > 0 && num2 > 0) { ((Vector2)(ref val2))..ctor(original.pivot.x / (float)num, original.pivot.y / (float)num2); } Sprite val3 = Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num2), val2, original.pixelsPerUnit); ((Object)val3).name = ((Object)original).name + "-Reversed"; return val3; } } catch (Exception ex) { Debug.LogWarning((object)("[CustomSpriteHelper] Failed to flip texture vertically: " + ex.Message)); } return original; } private static Sprite LoadBaseSprite(string gearName, string baseFileName, Rarity rarity, bool isIcon, out bool isReversed, out bool isEnhanced) { //IL_0498: 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_0381: Expected O, but got Unknown //IL_0409: 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) isReversed = false; isEnhanced = false; if (gearName.EndsWith("_RE")) { isReversed = true; isEnhanced = true; } else if (gearName.EndsWith("_R")) { isReversed = true; } else if (gearName.EndsWith("_E")) { isEnhanced = true; } try { string text = (isIcon ? "_icon" : "_thumb"); string[] array = ((!isIcon) ? new string[2] { "_thumb", "_tumb" } : new string[1] { "_icon" }); string[] array2 = new string[3] { ".png", ".jpg", ".jpeg" }; List list = new List { gearName, baseFileName }; if (baseFileName.StartsWith("Card") && baseFileName != "Card") { list.Add((baseFileName == "CardSupernova") ? "CardSupernova" : "Card"); } string[] array3 = list.ToArray(); string[] array4 = array3; foreach (string text2 in array4) { string[] array5 = array; foreach (string text3 in array5) { string resourceName = "ChzzkSkul.Sprites." + text2 + text3 + ".png"; Sprite val = LoadEmbeddedSprite(resourceName, isIcon); if ((Object)(object)val != (Object)null) { ((Object)val).name = text2 + text3; return val; } } } string directoryName = Path.GetDirectoryName(typeof(CustomSpriteHelper).Assembly.Location); string path = "c:\\Users\\jimin\\Documents\\OmenChest-main\\Sprites"; List list2 = new List(); string[] array6 = array; foreach (string text4 in array6) { string[] array7 = array2; foreach (string text5 in array7) { list2.Add(Path.Combine(directoryName, "Sprites", gearName + text4 + text5)); list2.Add(Path.Combine(directoryName, gearName + text4 + text5)); list2.Add(Path.Combine(path, gearName + text4 + text5)); list2.Add(Path.Combine(directoryName, "Sprites", baseFileName + text4 + text5)); list2.Add(Path.Combine(directoryName, baseFileName + text4 + text5)); list2.Add(Path.Combine(path, baseFileName + text4 + text5)); if (baseFileName.StartsWith("Card") && baseFileName != "Card") { string text6 = ((baseFileName == "CardSupernova") ? "CardSupernova" : "Card"); list2.Add(Path.Combine(directoryName, "Sprites", text6 + text4 + text5)); list2.Add(Path.Combine(directoryName, text6 + text4 + text5)); list2.Add(Path.Combine(path, text6 + text4 + text5)); } } } foreach (string item in list2) { if (!File.Exists(item)) { continue; } byte[] array8 = File.ReadAllBytes(item); Texture2D val2 = new Texture2D(2, 2, (TextureFormat)4, false); if (ImageConversion.LoadImage(val2, array8)) { ((Texture)val2).filterMode = (FilterMode)0; MakeTextureBackgroundTransparent(val2); int num = (isIcon ? 24 : 68); if (((Texture)val2).width != num || ((Texture)val2).height != num) { Texture2D val3 = ResizeTexture(val2, num, num); Object.Destroy((Object)(object)val2); val2 = val3; } Sprite val4 = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f), 32f); ((Object)val4).name = gearName + text; return val4; } } } catch (Exception ex) { Debug.LogWarning((object)("[CustomSpriteHelper] Failed to load sprite for " + gearName + ": " + ex.Message)); } return GeneratePlaceholderSprite(baseFileName + (isIcon ? "_icon" : "_thumb"), rarity); } public static Sprite ApplyEffects(Sprite original, bool isReversed, bool isEnhanced) { //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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //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_012d: 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_0149: 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_03b8: 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_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_023b: 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_0249: 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_05ed: Unknown result type (might be due to invalid IL or missing references) //IL_05b3: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Unknown result type (might be due to invalid IL or missing references) //IL_0346: 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) //IL_0257: 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_0516: Unknown result type (might be due to invalid IL or missing references) //IL_051d: 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_0533: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)original == (Object)null) { return null; } try { Texture2D texture = original.texture; if ((Object)(object)texture == (Object)null) { return original; } Rect rect = original.rect; int num = (int)((Rect)(ref rect)).width; int num2 = (int)((Rect)(ref rect)).height; int num3 = (int)((Rect)(ref rect)).x; int num4 = (int)((Rect)(ref rect)).y; Texture2D val = new Texture2D(num, num2, (TextureFormat)4, false); Color[] array = null; try { array = texture.GetPixels(num3, num4, num, num2); } catch { return original; } if (array == null) { return original; } bool[] array2 = new bool[array.Length]; Queue> queue = new Queue>(); int[,] array3 = new int[4, 2] { { 0, 0 }, { 0, num2 - 1 }, { num - 1, 0 }, { num - 1, num2 - 1 } }; for (int i = 0; i < 4; i++) { int num5 = array3[i, 0]; int num6 = array3[i, 1]; int num7 = num6 * num + num5; Color val2 = array[num7]; if ((val2.a < 0.1f || (val2.r < 0.15f && val2.g < 0.15f && val2.b < 0.15f)) && !array2[num7]) { array2[num7] = true; queue.Enqueue(new Tuple(num5, num6)); } } int[] array4 = new int[4] { 0, 0, 1, -1 }; int[] array5 = new int[4] { 1, -1, 0, 0 }; while (queue.Count > 0) { Tuple tuple = queue.Dequeue(); int item = tuple.Item1; int item2 = tuple.Item2; for (int j = 0; j < 4; j++) { int num8 = item + array4[j]; int num9 = item2 + array5[j]; if (num8 < 0 || num8 >= num || num9 < 0 || num9 >= num2) { continue; } int num10 = num9 * num + num8; if (!array2[num10]) { Color val3 = array[num10]; if (val3.a < 0.1f || (val3.r < 0.15f && val3.g < 0.15f && val3.b < 0.15f)) { array2[num10] = true; queue.Enqueue(new Tuple(num8, num9)); } } } } for (int k = 0; k < array.Length; k++) { if (array2[k]) { array[k] = new Color(0f, 0f, 0f, 0f); } } if (isReversed) { Color[] array6 = (Color[])(object)new Color[num * num2]; for (int l = 0; l < num2; l++) { for (int m = 0; m < num; m++) { array6[l * num + m] = array[(num2 - 1 - l) * num + m]; } } array = array6; } if (isEnhanced) { Color val4 = (isReversed ? new Color(1f, 0.1f, 0.1f, 1f) : new Color(0f, 0.5f, 1f, 1f)); int num11 = ((num <= 30) ? 1 : 3); Color[] array7 = (Color[])(object)new Color[num * num2]; Array.Copy(array, array7, array.Length); for (int n = 0; n < num2; n++) { for (int num12 = 0; num12 < num; num12++) { int num13 = n * num + num12; if (!(array[num13].a < 0.1f)) { continue; } float num14 = float.MaxValue; for (int num15 = Math.Max(0, n - num11); num15 <= Math.Min(num2 - 1, n + num11); num15++) { for (int num16 = Math.Max(0, num12 - num11); num16 <= Math.Min(num - 1, num12 + num11); num16++) { int num17 = num15 * num + num16; if (array[num17].a >= 0.1f) { float num18 = (float)Math.Sqrt((num12 - num16) * (num12 - num16) + (n - num15) * (n - num15)); if (num18 < num14) { num14 = num18; } } } } if (num14 <= (float)num11) { float num19 = 1f - num14 / ((float)num11 + 0.5f); array7[num13] = new Color(val4.r, val4.g, val4.b, num19 * 0.8f); } } } array = array7; } val.SetPixels(array); ((Texture)val).filterMode = (FilterMode)0; val.Apply(); Vector2 val5 = default(Vector2); ((Vector2)(ref val5))..ctor(0.5f, 0.5f); if (num > 0 && num2 > 0) { ((Vector2)(ref val5))..ctor(original.pivot.x / (float)num, original.pivot.y / (float)num2); } Sprite val6 = Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num2), val5, original.pixelsPerUnit); ((Object)val6).name = ((Object)original).name + (isReversed ? "-Reversed" : "") + (isEnhanced ? "-Enhanced" : ""); return val6; } catch (Exception ex) { Debug.LogWarning((object)("[CustomSpriteHelper] Failed to apply effects: " + ex.Message)); } return original; } public static Sprite GetOrGenerateSprite(string gearName, Rarity rarity, bool isIcon) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) string text = gearName; if (text.EndsWith("_RE")) { text = text.Substring(0, text.Length - 3); } else if (text.EndsWith("_R")) { text = text.Substring(0, text.Length - 2); } else if (text.EndsWith("_E")) { text = text.Substring(0, text.Length - 2); } bool isReversed; bool isEnhanced; Sprite val = LoadBaseSprite(gearName, text, rarity, isIcon, out isReversed, out isEnhanced); if ((Object)(object)val == (Object)null) { return null; } if (text.StartsWith("Card")) { return ApplyEffects(val, isReversed, isEnhanced); } if (isReversed) { return FlipTextureVertically(val); } return val; } private static Sprite GeneratePlaceholderSprite(string gearName, Rarity rarity) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown //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_0012: 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_002d: Expected I4, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_010a: 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_0269: 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_0190: 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_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_0202: 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_01ee: 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) try { int num = 32; Texture2D val = new Texture2D(num, num, (TextureFormat)4, false); Color val2 = default(Color); switch ((int)rarity) { case 0: ((Color)(ref val2))..ctor(0.6f, 0.6f, 0.6f, 1f); break; case 1: ((Color)(ref val2))..ctor(0.1f, 0.4f, 0.8f, 1f); break; case 2: ((Color)(ref val2))..ctor(0.6f, 0.2f, 0.8f, 1f); break; case 3: ((Color)(ref val2))..ctor(0.9f, 0.6f, 0.1f, 1f); break; default: ((Color)(ref val2))..ctor(0.5f, 0.5f, 0.5f, 1f); break; } Color val3 = default(Color); ((Color)(ref val3))..ctor(val2.r * 0.4f, val2.g * 0.4f, val2.b * 0.4f, 1f); Color val4 = default(Color); ((Color)(ref val4))..ctor(val2.r * 1.3f, val2.g * 1.3f, val2.b * 1.3f, 1f); Color[] array = (Color[])(object)new Color[num * num]; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { if (j == 0 || j == num - 1 || i == 0 || i == num - 1) { array[i * num + j] = val3; } else if (j == 1 || i == num - 2) { array[i * num + j] = val4; } else if (j == num - 2 || i == 1) { array[i * num + j] = val3; } else if (Math.Abs(j - num / 2) + Math.Abs(i - num / 2) < num / 4) { array[i * num + j] = val4; } else { array[i * num + j] = val2; } } } val.SetPixels(array); ((Texture)val).filterMode = (FilterMode)0; val.Apply(); Sprite val5 = Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num), new Vector2(0.5f, 0.5f), 32f); ((Object)val5).name = gearName; return val5; } catch (Exception ex) { Debug.LogWarning((object)("[CustomSpriteHelper] Failed to generate placeholder for " + gearName + ": " + ex.Message)); return null; } } public static Sprite CreateGlitchedSprite(Sprite original) { //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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_039a: 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_0365: 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_02b2: 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_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_0132: 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_0214: 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_0219: 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_02e9: 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_0184: 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_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_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) if ((Object)(object)original == (Object)null) { return GeneratePlaceholderSprite("GlitchedItem", (Rarity)0); } if (_glitchedSpriteCache.TryGetValue(original, out var value) && (Object)(object)value != (Object)null) { return value; } try { Texture2D texture = original.texture; if ((Object)(object)texture == (Object)null) { Sprite val = GeneratePlaceholderSprite("GlitchedItem", (Rarity)0); _glitchedSpriteCache[original] = val; return val; } Rect rect = original.rect; int num = (int)((Rect)(ref rect)).width; int num2 = (int)((Rect)(ref rect)).height; int num3 = (int)((Rect)(ref rect)).x; int num4 = (int)((Rect)(ref rect)).y; Texture2D val2 = new Texture2D(num, num2, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[num * num2]; Random random = new Random(); bool flag = true; Color[] array2 = null; try { array2 = texture.GetPixels(num3, num4, num, num2); } catch { flag = false; } for (int i = 0; i < num2; i++) { for (int j = 0; j < num; j++) { int num5 = i * num + j; if (flag && array2 != null) { Color val3 = array2[num5]; if (val3.a > 0.1f && random.Next(100) < 20) { switch (random.Next(3)) { case 0: array[num5] = new Color(1f, 0f, 1f, 1f); break; case 1: array[num5] = new Color(0f, 1f, 1f, 1f); break; default: array[num5] = Color.black; break; } } else { array[num5] = val3; } } else { bool flag2 = (j / 4 + i / 4) % 2 == 0; array[num5] = (Color)(flag2 ? new Color(1f, 0f, 1f, 1f) : Color.black); } } } if (flag) { int num6 = random.Next(1, 4); for (int k = 0; k < num6; k++) { int num7 = random.Next(2, num2 - 2); Color val4 = ((random.Next(2) == 0) ? new Color(1f, 0f, 1f, 1f) : new Color(0f, 1f, 1f, 1f)); int num8 = random.Next(0, num / 2); int num9 = random.Next(num / 3, num); for (int l = num8; l < Math.Min(num8 + num9, num); l++) { array[num7 * num + l] = val4; } } } val2.SetPixels(array); ((Texture)val2).filterMode = (FilterMode)0; val2.Apply(); Vector2 val5 = default(Vector2); ((Vector2)(ref val5))..ctor(0.5f, 0.5f); if (num > 0 && num2 > 0) { ((Vector2)(ref val5))..ctor(original.pivot.x / (float)num, original.pivot.y / (float)num2); } Sprite val6 = Sprite.Create(val2, new Rect(0f, 0f, (float)num, (float)num2), val5, original.pixelsPerUnit); ((Object)val6).name = (((Object)original).name ?? "GlitchedSprite") + "-Glitched"; _glitchedSpriteCache[original] = val6; return val6; } catch (Exception ex) { Debug.LogWarning((object)("[CustomSpriteHelper] Failed to glitch sprite: " + ex.Message)); Sprite val7 = GeneratePlaceholderSprite("GlitchedItem", (Rarity)0); if ((Object)(object)val7 != (Object)null) { _glitchedSpriteCache[original] = val7; } return val7 ?? original; } } public static EffectInfo FindEffectInfo(GameObject gameObject) { if ((Object)(object)gameObject == (Object)null) { return null; } Dictionary dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase); HashSet checkedObjects = new HashSet(); MonoBehaviour[] componentsInChildren = gameObject.GetComponentsInChildren(true); foreach (MonoBehaviour val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { FindAllEffectInfosRecursive(val, ((object)val).GetType().Name, dictionary, checkedObjects); } } if (dictionary.Count == 0) { return null; } Debug.Log((object)$"[ChzzkSkul] FindEffectInfo gathered {dictionary.Count} effects for '{((Object)gameObject).name}':"); foreach (KeyValuePair item in dictionary) { string text = (((Object)(object)item.Value.effect != (Object)null) ? ((Object)item.Value.effect).name : "null"); string text2 = (((Object)(object)item.Value.animation != (Object)null) ? ((Object)item.Value.animation).name : "null"); Debug.Log((object)("[ChzzkSkul] Path: '" + item.Key + "', Asset: '" + text + "', Anim: '" + text2 + "'")); } string[] array = new string[11] { "slash", "blade", "wave", "cut", "crescent", "swing", "projectile", "wind", "spirit", "gale", "storm" }; string[] array2 = new string[6] { "attack", "action", "charge", "fire", "hit", "impact" }; string[] array3 = array; foreach (string value in array3) { foreach (KeyValuePair item2 in dictionary) { string text3 = ""; try { if ((Object)(object)item2.Value.effect != (Object)null) { text3 = ((Object)item2.Value.effect).name; if (string.IsNullOrEmpty(text3) && (Object)(object)((Component)item2.Value.effect).gameObject != (Object)null) { text3 = ((Object)((Component)item2.Value.effect).gameObject).name; } } } catch { } string text4 = ""; try { if ((Object)(object)item2.Value.animation != (Object)null) { text4 = ((Object)item2.Value.animation).name; } } catch { } if (item2.Key.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0 || text3.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0 || text4.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0) { Debug.Log((object)("[ChzzkSkul] Smartly selected primary effect '" + item2.Key + "' (Asset: '" + text3 + "', Anim: '" + text4 + "') for visual.")); return item2.Value; } } } string[] array4 = array2; foreach (string value2 in array4) { foreach (KeyValuePair item3 in dictionary) { string text5 = ""; try { if ((Object)(object)item3.Value.effect != (Object)null) { text5 = ((Object)item3.Value.effect).name; if (string.IsNullOrEmpty(text5) && (Object)(object)((Component)item3.Value.effect).gameObject != (Object)null) { text5 = ((Object)((Component)item3.Value.effect).gameObject).name; } } } catch { } string text6 = ""; try { if ((Object)(object)item3.Value.animation != (Object)null) { text6 = ((Object)item3.Value.animation).name; } } catch { } if (item3.Key.IndexOf(value2, StringComparison.OrdinalIgnoreCase) >= 0 || text5.IndexOf(value2, StringComparison.OrdinalIgnoreCase) >= 0 || text6.IndexOf(value2, StringComparison.OrdinalIgnoreCase) >= 0) { Debug.Log((object)("[ChzzkSkul] Smartly selected secondary effect '" + item3.Key + "' (Asset: '" + text5 + "', Anim: '" + text6 + "') for visual.")); return item3.Value; } } } List> list = dictionary.Where((KeyValuePair pair) => pair.Key.IndexOf("loop", StringComparison.OrdinalIgnoreCase) < 0 && pair.Key.IndexOf("buff", StringComparison.OrdinalIgnoreCase) < 0 && pair.Key.IndexOf("aura", StringComparison.OrdinalIgnoreCase) < 0).ToList(); if (list.Count > 0) { KeyValuePair keyValuePair = list.First(); Debug.Log((object)("[ChzzkSkul] Selected filtered fallback effect '" + keyValuePair.Key + "' for visual.")); return keyValuePair.Value; } KeyValuePair keyValuePair2 = dictionary.First(); Debug.Log((object)("[ChzzkSkul] Selected default effect '" + keyValuePair2.Key + "' for visual.")); return keyValuePair2.Value; } public static void FindAllEffectInfosRecursive(object obj, string path, Dictionary gathered, HashSet checkedObjects) { if (obj == null || checkedObjects.Contains(obj)) { return; } checkedObjects.Add(obj); Type type = obj.GetType(); if (type.IsPrimitive || type.IsEnum || type == typeof(string)) { return; } if (obj is IEnumerable enumerable) { int num = 0; foreach (object item in enumerable) { if (item != null) { FindAllEffectInfosRecursive(item, $"{path}[{num}]", gathered, checkedObjects); } num++; } } Type type2 = type; while (type2 != null) { FieldInfo[] fields = type2.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { if (fieldInfo.FieldType == typeof(EffectInfo)) { try { object? value = fieldInfo.GetValue(obj); EffectInfo val = (EffectInfo)((value is EffectInfo) ? value : null); if (val != null) { string key = path + "." + fieldInfo.Name; if (!gathered.ContainsKey(key)) { gathered[key] = val; } } } catch { } } else { if (!fieldInfo.FieldType.IsClass || (fieldInfo.FieldType.Namespace != null && fieldInfo.FieldType.Namespace.StartsWith("System") && !typeof(IEnumerable).IsAssignableFrom(fieldInfo.FieldType))) { continue; } try { object value2 = fieldInfo.GetValue(obj); if (value2 != null) { FindAllEffectInfosRecursive(value2, path + "." + fieldInfo.Name, gathered, checkedObjects); } } catch { } } } type2 = type2.BaseType; } } public static SoundInfo FindSoundInfo(GameObject gameObject) { if ((Object)(object)gameObject == (Object)null) { return null; } Dictionary dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase); HashSet checkedObjects = new HashSet(); MonoBehaviour[] componentsInChildren = gameObject.GetComponentsInChildren(true); foreach (MonoBehaviour val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { FindAllSoundInfosRecursive(val, ((object)val).GetType().Name, dictionary, checkedObjects); } } if (dictionary.Count == 0) { return null; } string[] array = new string[6] { "slash", "swing", "cut", "blade", "wave", "crescent" }; string[] array2 = new string[6] { "attack", "action", "charge", "fire", "hit", "impact" }; string[] array3 = array; foreach (string value in array3) { foreach (KeyValuePair item in dictionary) { if (item.Key.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0) { Debug.Log((object)("[ChzzkSkul] Smartly selected primary sound '" + item.Key + "' for audio.")); return item.Value; } } } string[] array4 = array2; foreach (string value2 in array4) { foreach (KeyValuePair item2 in dictionary) { if (item2.Key.IndexOf(value2, StringComparison.OrdinalIgnoreCase) >= 0) { Debug.Log((object)("[ChzzkSkul] Smartly selected secondary sound '" + item2.Key + "' for audio.")); return item2.Value; } } } KeyValuePair keyValuePair = dictionary.First(); Debug.Log((object)("[ChzzkSkul] Selected default sound '" + keyValuePair.Key + "' for audio.")); return keyValuePair.Value; } private static void FindAllSoundInfosRecursive(object obj, string path, Dictionary gathered, HashSet checkedObjects) { if (obj == null || checkedObjects.Contains(obj)) { return; } checkedObjects.Add(obj); Type type = obj.GetType(); if (type.IsPrimitive || type.IsEnum || type == typeof(string)) { return; } if (obj is IEnumerable enumerable) { int num = 0; foreach (object item in enumerable) { if (item != null) { FindAllSoundInfosRecursive(item, $"{path}[{num}]", gathered, checkedObjects); } num++; } } Type type2 = type; while (type2 != null) { FieldInfo[] fields = type2.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { if (fieldInfo.FieldType == typeof(SoundInfo)) { try { object? value = fieldInfo.GetValue(obj); SoundInfo val = (SoundInfo)((value is SoundInfo) ? value : null); if (val != null) { string key = path + "." + fieldInfo.Name; if (!gathered.ContainsKey(key)) { gathered[key] = val; } } } catch { } } else { if (!fieldInfo.FieldType.IsClass || (fieldInfo.FieldType.Namespace != null && fieldInfo.FieldType.Namespace.StartsWith("System") && !typeof(IEnumerable).IsAssignableFrom(fieldInfo.FieldType))) { continue; } try { object value2 = fieldInfo.GetValue(obj); if (value2 != null) { FindAllSoundInfosRecursive(value2, path + "." + fieldInfo.Name, gathered, checkedObjects); } } catch { } } } type2 = type2.BaseType; } } public static void DumpGameObject(GameObject go, string indent = "") { if ((Object)(object)go == (Object)null) { return; } Debug.Log((object)(indent + "GameObject: " + ((Object)go).name)); Component[] components = go.GetComponents(); foreach (Component val in components) { if ((Object)(object)val == (Object)null) { continue; } Debug.Log((object)(indent + " Component: " + ((object)val).GetType().FullName)); try { FieldInfo[] fields = ((object)val).GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { object value = fieldInfo.GetValue(val); if (value != null) { Debug.Log((object)$"{indent} Field: {fieldInfo.Name} ({fieldInfo.FieldType.Name}) = {value}"); } } } catch { } } for (int k = 0; k < go.transform.childCount; k++) { DumpGameObject(((Component)go.transform.GetChild(k)).gameObject, indent + " "); } } } public class CustomItems { public static readonly List Items = InitializeItems(); private static List InitializeItems() { //IL_001c: 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_006e: 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_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_010f: 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_0159: 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_01bf: 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_025d: 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_02a7: 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_030d: 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_03ab: 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_03f5: 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_045a: 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_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_059e: 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_05e8: Unknown result type (might be due to invalid IL or missing references) //IL_0645: Unknown result type (might be due to invalid IL or missing references) //IL_064e: Unknown result type (might be due to invalid IL or missing references) //IL_068f: 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_06f4: Unknown result type (might be due to invalid IL or missing references) //IL_0735: 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_079b: Unknown result type (might be due to invalid IL or missing references) //IL_07dc: Unknown result type (might be due to invalid IL or missing references) //IL_0839: 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) //IL_0883: 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_08e9: Unknown result type (might be due to invalid IL or missing references) //IL_092a: Unknown result type (might be due to invalid IL or missing references) //IL_0987: Unknown result type (might be due to invalid IL or missing references) //IL_0990: Unknown result type (might be due to invalid IL or missing references) //IL_09d1: Unknown result type (might be due to invalid IL or missing references) //IL_0a2e: 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_0a78: Unknown result type (might be due to invalid IL or missing references) //IL_0ad5: Unknown result type (might be due to invalid IL or missing references) //IL_0ade: Unknown result type (might be due to invalid IL or missing references) //IL_0b1f: Unknown result type (might be due to invalid IL or missing references) //IL_0b88: Unknown result type (might be due to invalid IL or missing references) //IL_0b90: Unknown result type (might be due to invalid IL or missing references) //IL_0bb2: Unknown result type (might be due to invalid IL or missing references) //IL_0bb8: Expected O, but got Unknown //IL_0bb8: Unknown result type (might be due to invalid IL or missing references) //IL_0bc2: Expected O, but got Unknown //IL_0bfe: Unknown result type (might be due to invalid IL or missing references) //IL_0c5b: Unknown result type (might be due to invalid IL or missing references) //IL_0c64: Unknown result type (might be due to invalid IL or missing references) //IL_0c8b: Unknown result type (might be due to invalid IL or missing references) //IL_0c93: Unknown result type (might be due to invalid IL or missing references) //IL_0cf0: Unknown result type (might be due to invalid IL or missing references) //IL_0cf9: Unknown result type (might be due to invalid IL or missing references) //IL_0d3a: Unknown result type (might be due to invalid IL or missing references) //IL_0d96: Unknown result type (might be due to invalid IL or missing references) //IL_0d9f: Unknown result type (might be due to invalid IL or missing references) //IL_0ddb: Unknown result type (might be due to invalid IL or missing references) //IL_0e38: Unknown result type (might be due to invalid IL or missing references) //IL_0e41: Unknown result type (might be due to invalid IL or missing references) //IL_0e7d: Unknown result type (might be due to invalid IL or missing references) //IL_0eda: 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_0f1f: Unknown result type (might be due to invalid IL or missing references) //IL_0f7c: Unknown result type (might be due to invalid IL or missing references) //IL_0f85: Unknown result type (might be due to invalid IL or missing references) //IL_0fac: Unknown result type (might be due to invalid IL or missing references) //IL_1009: 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_104e: Unknown result type (might be due to invalid IL or missing references) //IL_10ab: Unknown result type (might be due to invalid IL or missing references) //IL_10b4: Unknown result type (might be due to invalid IL or missing references) //IL_115e: Unknown result type (might be due to invalid IL or missing references) //IL_1163: Unknown result type (might be due to invalid IL or missing references) //IL_11e0: Unknown result type (might be due to invalid IL or missing references) //IL_11e5: Unknown result type (might be due to invalid IL or missing references) //IL_11ee: Unknown result type (might be due to invalid IL or missing references) //IL_11f3: Unknown result type (might be due to invalid IL or missing references) //IL_123e: 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_12c0: 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_12ce: Unknown result type (might be due to invalid IL or missing references) //IL_1436: Unknown result type (might be due to invalid IL or missing references) //IL_144c: Unknown result type (might be due to invalid IL or missing references) //IL_1319: Unknown result type (might be due to invalid IL or missing references) //IL_1396: Unknown result type (might be due to invalid IL or missing references) //IL_139b: Unknown result type (might be due to invalid IL or missing references) //IL_13a4: Unknown result type (might be due to invalid IL or missing references) //IL_13a9: Unknown result type (might be due to invalid IL or missing references) List list = new List(); CustomItemReference customItemReference = new CustomItemReference(); customItemReference.name = "TMTrainer"; ((GearReference)customItemReference).rarity = (Rarity)0; customItemReference.itemName_EN = "Error Creator"; customItemReference.itemName_KR = "오류생성자"; customItemReference.itemDescription_EN = "When held, items dropped will have glitched sprites and will be granted 2 to 3 randomized special effects."; customItemReference.itemDescription_KR = "소지 시 드롭되는 아이템의 스프라이트가 무작위로 깨져 나오며, 해당 아이템에 2~3개의 무작위 특수 효과가 부여됩니다."; customItemReference.itemLore_EN = "The fabric of reality is unraveling."; customItemReference.itemLore_KR = "현실의 구조가 깨져나가기 시작했다."; ((ItemReference)customItemReference).prefabKeyword1 = (Key)34; ((ItemReference)customItemReference).prefabKeyword2 = (Key)31; list.Add(customItemReference); CustomItemReference customItemReference2 = new CustomItemReference(); customItemReference2.name = "Libra"; ((GearReference)customItemReference2).rarity = (Rarity)3; customItemReference2.spriteName = "Libra"; customItemReference2.itemName_EN = "Scale of the Otherworld"; customItemReference2.itemName_KR = "이계의 천칭"; customItemReference2.itemDescription_EN = "Reduces damage taken by 10%.\nIncreases the count of all owned inscriptions by 1.\nThis item randomly gains 2 inscriptions."; customItemReference2.itemDescription_KR = "받는 피해가 10% 감소합니다.\n보유하고 있는 모든 각인의 개수가 1개 증가합니다.\n이 아이템은 무작위 각인 2개를 갖습니다."; customItemReference2.itemLore_EN = "A scale that measures the balance of different dimensions."; customItemReference2.itemLore_KR = "서로 다른 차원의 균형을 측정하는 천칭."; ((ItemReference)customItemReference2).prefabKeyword1 = (Key)34; ((ItemReference)customItemReference2).prefabKeyword2 = (Key)36; customItemReference2.stats = new Values((Value[])(object)new Value[1] { new Value(Category.PercentPoint, Kind.TakingDamage, -0.1) }); customItemReference2.extraComponents = new Type[1] { typeof(ScaleOfTheOtherworldBehavior) }; list.Add(customItemReference2); CustomItemReference customItemReference3 = new CustomItemReference(); customItemReference3.name = "CardFool"; ((GearReference)customItemReference3).rarity = (Rarity)1; customItemReference3.spriteName = "CardFool"; customItemReference3.itemName_EN = "Fool Card"; customItemReference3.itemName_KR = "광대 카드"; customItemReference3.itemDescription_EN = "Increases Attack Speed by 10%.\nIncreases Dash distance and invulnerability duration slightly."; customItemReference3.itemDescription_KR = "공격 속도가 10% 증가합니다.\n대시 거리와 대시 중 무적 시간이 약간 증가합니다."; customItemReference3.itemLore_EN = "A card signifying new beginnings and boundless potential."; customItemReference3.itemLore_KR = "새로운 시작과 무한한 가능성을 상징하는 카드."; ((ItemReference)customItemReference3).prefabKeyword1 = (Key)37; ((ItemReference)customItemReference3).prefabKeyword2 = (Key)24; customItemReference3.extraComponents = new Type[1] { typeof(CardFoolBehavior) }; list.Add(customItemReference3); CustomItemReference customItemReference4 = new CustomItemReference(); customItemReference4.name = "CardMagician"; ((GearReference)customItemReference4).rarity = (Rarity)1; customItemReference4.spriteName = "CardMagician"; customItemReference4.itemName_EN = "Magician Card"; customItemReference4.itemName_KR = "마술사 카드"; customItemReference4.itemDescription_EN = "Increases Magic Attack by 30% and Skill Cooldown Speed by 15%."; customItemReference4.itemDescription_KR = "마법공격력이 30% 증가하고 스킬 쿨다운 속도가 15% 증가합니다."; customItemReference4.itemLore_EN = "A card indicating manifestation and resourcefulness."; customItemReference4.itemLore_KR = "현현과 기발함을 나타내는 카드."; ((ItemReference)customItemReference4).prefabKeyword1 = (Key)37; ((ItemReference)customItemReference4).prefabKeyword2 = (Key)28; customItemReference4.extraComponents = new Type[1] { typeof(CardMagicianBehavior) }; list.Add(customItemReference4); CustomItemReference customItemReference5 = new CustomItemReference(); customItemReference5.name = "CardHighPriestess"; ((GearReference)customItemReference5).rarity = (Rarity)1; customItemReference5.spriteName = "CardHighPriestess"; customItemReference5.itemName_EN = "High Priestess Card"; customItemReference5.itemName_KR = "여사제 카드"; customItemReference5.itemDescription_EN = "Increases Max Health by 20.\nRegenerates 0.5 HP per second."; customItemReference5.itemDescription_KR = "최대 체력이 20 증가합니다.\n매초 체력을 0.5 회복합니다."; customItemReference5.itemLore_EN = "A card filled with hidden secrets and intuition."; customItemReference5.itemLore_KR = "숨겨진 비밀과 직관으로 가득한 카드."; ((ItemReference)customItemReference5).prefabKeyword1 = (Key)37; ((ItemReference)customItemReference5).prefabKeyword2 = (Key)14; customItemReference5.extraComponents = new Type[1] { typeof(CardHighPriestessBehavior) }; list.Add(customItemReference5); CustomItemReference customItemReference6 = new CustomItemReference(); customItemReference6.name = "CardEmpress"; ((GearReference)customItemReference6).rarity = (Rarity)1; customItemReference6.spriteName = "CardEmpress"; customItemReference6.itemName_EN = "Empress Card"; customItemReference6.itemName_KR = "여황제 카드"; customItemReference6.itemDescription_EN = "Increases Max Health by 20.\nUpon taking damage, grants 15 Shield for 10 seconds (Cooldown: 15s)."; customItemReference6.itemDescription_KR = "최대 체력이 20 증가합니다.\n피격 시 10초간 지속되는 15의 보호막을 획득합니다 (재발동 쿨타임 15초)."; customItemReference6.itemLore_EN = "A card carrying abundance, motherhood, and security."; customItemReference6.itemLore_KR = "풍요와 대지, 그리고 보호의 기운을 담은 카드."; ((ItemReference)customItemReference6).prefabKeyword1 = (Key)37; ((ItemReference)customItemReference6).prefabKeyword2 = (Key)15; customItemReference6.extraComponents = new Type[1] { typeof(CardEmpressBehavior) }; list.Add(customItemReference6); CustomItemReference customItemReference7 = new CustomItemReference(); customItemReference7.name = "CardEmperor"; ((GearReference)customItemReference7).rarity = (Rarity)1; customItemReference7.spriteName = "CardEmperor"; customItemReference7.itemName_EN = "Emperor Card"; customItemReference7.itemName_KR = "황제 카드"; customItemReference7.itemDescription_EN = "Increases Physical Attack by 30%.\nNormal attacks have a 10% chance to deal 50% additional Physical Damage."; customItemReference7.itemDescription_KR = "물리공격력이 30% 증가합니다.\n기본 공격 시 10% 확률로 50%의 추가 물리 피해를 입힙니다."; customItemReference7.itemLore_EN = "A card representing authority, structure, and control."; customItemReference7.itemLore_KR = "권위와 질서, 지배를 상징하는 카드."; ((ItemReference)customItemReference7).prefabKeyword1 = (Key)37; ((ItemReference)customItemReference7).prefabKeyword2 = (Key)2; customItemReference7.extraComponents = new Type[1] { typeof(CardEmperorBehavior) }; list.Add(customItemReference7); CustomItemReference customItemReference8 = new CustomItemReference(); customItemReference8.name = "CardHierophant"; ((GearReference)customItemReference8).rarity = (Rarity)1; customItemReference8.spriteName = "CardHierophant"; customItemReference8.itemName_EN = "Hierophant Card"; customItemReference8.itemName_KR = "교황 카드"; customItemReference8.itemDescription_EN = "Reduces damage taken by 10%.\nDashing reduces damage taken by an additional 15% for 3 seconds."; customItemReference8.itemDescription_KR = "받는 피해가 10% 감소합니다.\n대시 시 3초간 받는 피해가 15% 추가로 감소합니다."; customItemReference8.itemLore_EN = "A card showing spiritual guidance and tradition."; customItemReference8.itemLore_KR = "정신적 인도와 전통의 수호를 의미하는 카드."; ((ItemReference)customItemReference8).prefabKeyword1 = (Key)37; ((ItemReference)customItemReference8).prefabKeyword2 = (Key)8; customItemReference8.extraComponents = new Type[1] { typeof(CardHierophantBehavior) }; list.Add(customItemReference8); CustomItemReference customItemReference9 = new CustomItemReference(); customItemReference9.name = "CardLovers"; ((GearReference)customItemReference9).rarity = (Rarity)1; customItemReference9.spriteName = "CardLovers"; customItemReference9.itemName_EN = "Lovers Card"; customItemReference9.itemName_KR = "연인 카드"; customItemReference9.itemDescription_EN = "Increases Critical Chance by 10%.\nCritical hits increase Movement Speed by 15% for 3 seconds."; customItemReference9.itemDescription_KR = "치명타 확률이 10% 증가합니다.\n치명타 발생 시 3초간 이동속도가 15% 증가합니다."; customItemReference9.itemLore_EN = "A card indicating harmony, connection, and choices."; customItemReference9.itemLore_KR = "조화와 관계, 그리고 선택을 속삭이는 카드."; ((ItemReference)customItemReference9).prefabKeyword1 = (Key)37; ((ItemReference)customItemReference9).prefabKeyword2 = (Key)23; customItemReference9.extraComponents = new Type[1] { typeof(CardLoversBehavior) }; list.Add(customItemReference9); CustomItemReference customItemReference10 = new CustomItemReference(); customItemReference10.name = "CardChariot"; ((GearReference)customItemReference10).rarity = (Rarity)1; customItemReference10.spriteName = "CardChariot"; customItemReference10.itemName_EN = "Chariot Card"; customItemReference10.itemName_KR = "전차 카드"; customItemReference10.itemDescription_EN = "Increases Movement Speed by 20% and Attack Speed by 15%."; customItemReference10.itemDescription_KR = "이동속도가 20% 증가하고 공격 속도가 15% 증가합니다."; customItemReference10.itemLore_EN = "A card depicting willpower, victory, and momentum."; customItemReference10.itemLore_KR = "의지력과 정복, 그리고 기세를 펼치는 전차의 카드."; ((ItemReference)customItemReference10).prefabKeyword1 = (Key)37; ((ItemReference)customItemReference10).prefabKeyword2 = (Key)13; customItemReference10.extraComponents = new Type[1] { typeof(CardChariotBehavior) }; list.Add(customItemReference10); CustomItemReference customItemReference11 = new CustomItemReference(); customItemReference11.name = "CardJustice"; ((GearReference)customItemReference11).rarity = (Rarity)1; customItemReference11.spriteName = "CardJustice"; customItemReference11.itemName_EN = "Justice Card"; customItemReference11.itemName_KR = "정의 카드"; customItemReference11.itemDescription_EN = "Reduces damage taken by 5%.\nUpon taking damage, reflects 50% of the damage back to the attacker as True Damage."; customItemReference11.itemDescription_KR = "받는 피해가 5% 감소합니다.\n피격 시 받은 피해의 50%만큼 적에게 고정 피해로 반사합니다."; customItemReference11.itemLore_EN = "A card demonstrating balance, truth, and karma."; customItemReference11.itemLore_KR = "정확한 균형과 인과응보의 법칙을 보여주는 카드."; ((ItemReference)customItemReference11).prefabKeyword1 = (Key)37; ((ItemReference)customItemReference11).prefabKeyword2 = (Key)7; customItemReference11.extraComponents = new Type[1] { typeof(CardJusticeBehavior) }; list.Add(customItemReference11); CustomItemReference customItemReference12 = new CustomItemReference(); customItemReference12.name = "CardHermit"; ((GearReference)customItemReference12).rarity = (Rarity)1; customItemReference12.spriteName = "CardHermit"; customItemReference12.itemName_EN = "Hermit Card"; customItemReference12.itemName_KR = "은둔자 카드"; customItemReference12.itemDescription_EN = "Increases Max Health by 15.\nShop items are discounted by 30%."; customItemReference12.itemDescription_KR = "최대 체력이 15 증가합니다.\n상점 아이템 가격이 30% 할인됩니다."; customItemReference12.itemLore_EN = "A card indicating self-reflection and inner wisdom."; customItemReference12.itemLore_KR = "성찰과 내적인 지혜를 추구하는 은둔자의 카드."; ((ItemReference)customItemReference12).prefabKeyword1 = (Key)37; ((ItemReference)customItemReference12).prefabKeyword2 = (Key)20; customItemReference12.extraComponents = new Type[1] { typeof(CardHermitBehavior) }; list.Add(customItemReference12); CustomItemReference customItemReference13 = new CustomItemReference(); customItemReference13.name = "CardWheelOfFortune"; ((GearReference)customItemReference13).rarity = (Rarity)1; customItemReference13.spriteName = "CardWheelOfFortune"; customItemReference13.itemName_EN = "Wheel of Fortune Card"; customItemReference13.itemName_KR = "운명의 수레바퀴 카드"; customItemReference13.itemDescription_EN = "Increases Critical Chance by 5%.\nAttacking has a 5% chance to amplify damage dealt by 100% (deals double damage)."; customItemReference13.itemDescription_KR = "치명타 확률이 5% 증가합니다.\n공격 시 5% 확률로 데미지가 100% 증폭됩니다 (2배의 데미지)."; customItemReference13.itemLore_EN = "A card capturing luck, fate, and turning points."; customItemReference13.itemLore_KR = "운명의 전환점과 무작위한 행운을 가져다주는 카드."; ((ItemReference)customItemReference13).prefabKeyword1 = (Key)37; ((ItemReference)customItemReference13).prefabKeyword2 = (Key)19; customItemReference13.extraComponents = new Type[1] { typeof(CardWheelOfFortuneBehavior) }; list.Add(customItemReference13); CustomItemReference customItemReference14 = new CustomItemReference(); customItemReference14.name = "CardStrength"; ((GearReference)customItemReference14).rarity = (Rarity)1; customItemReference14.spriteName = "CardStrength"; customItemReference14.itemName_EN = "Strength Card"; customItemReference14.itemName_KR = "힘 카드"; customItemReference14.itemDescription_EN = "Increases Melee Damage by 25%.\nIncreases Physical Attack by 0.5% for every 1% of missing health."; customItemReference14.itemDescription_KR = "근접 공격 피해가 25% 증가합니다.\n잃은 체력 1%당 물리공격력이 0.5% 추가로 증가합니다."; customItemReference14.itemLore_EN = "A card embodying courage, inner power, and fortitude."; customItemReference14.itemLore_KR = "용기와 정신력, 그리고 강인한 투지를 상징하는 카드."; ((ItemReference)customItemReference14).prefabKeyword1 = (Key)37; ((ItemReference)customItemReference14).prefabKeyword2 = (Key)22; customItemReference14.extraComponents = new Type[1] { typeof(CardStrengthBehavior) }; list.Add(customItemReference14); CustomItemReference customItemReference15 = new CustomItemReference(); customItemReference15.name = "CardMoon"; ((GearReference)customItemReference15).rarity = (Rarity)1; customItemReference15.spriteName = "CardMoon"; customItemReference15.itemName_EN = "Moon Card"; customItemReference15.itemName_KR = "달 카드"; customItemReference15.itemDescription_EN = "Increases Magic Attack by 30%."; customItemReference15.itemDescription_KR = "마법공격력이 30% 증가합니다."; customItemReference15.itemLore_EN = "A card indicating mystery, subconsciousness, and dreams."; customItemReference15.itemLore_KR = "비밀과 무의식, 그리고 환상을 비추는 달의 카드."; ((ItemReference)customItemReference15).prefabKeyword1 = (Key)37; ((ItemReference)customItemReference15).prefabKeyword2 = (Key)23; customItemReference15.extraComponents = new Type[1] { typeof(CardMoonBehavior) }; list.Add(customItemReference15); CustomItemReference customItemReference16 = new CustomItemReference(); customItemReference16.name = "CardSun"; ((GearReference)customItemReference16).rarity = (Rarity)1; customItemReference16.spriteName = "CardSun"; customItemReference16.itemName_EN = "Sun Card"; customItemReference16.itemName_KR = "태양 카드"; customItemReference16.itemDescription_EN = "Increases Physical Attack by 30%."; customItemReference16.itemDescription_KR = "물리공격력이 30% 증가합니다."; customItemReference16.itemLore_EN = "A card radiating vitality, joy, and success."; customItemReference16.itemLore_KR = "생명력과 활기, 그리고 눈부신 성공을 발산하는 태양의 카드."; ((ItemReference)customItemReference16).prefabKeyword1 = (Key)37; ((ItemReference)customItemReference16).prefabKeyword2 = (Key)23; customItemReference16.extraComponents = new Type[1] { typeof(CardSunBehavior) }; list.Add(customItemReference16); CustomItemReference customItemReference17 = new CustomItemReference(); customItemReference17.name = "CardSupernova"; ((GearReference)customItemReference17).rarity = (Rarity)3; customItemReference17.spriteName = "CardSupernova"; customItemReference17.itemName_EN = "Supernova Card"; customItemReference17.itemName_KR = "초신성 폭발 카드"; customItemReference17.itemDescription_EN = "Increases Physical and Magic Attack by 80%.\nSwapping triggers a massive Supernova Blast dealing 150 Fixed Damage (Cooldown: 5s)."; customItemReference17.itemDescription_KR = "물리 및 마법 공격력이 80% 증가합니다.\n교대 시 넓은 범위에 150의 고정 피해를 주는 초신성 대폭발을 일으킵니다 (재발동 쿨타임: 5초)."; customItemReference17.itemLore_EN = "A celestial event where a star collapses and erupts in ultimate destruction and creation."; customItemReference17.itemLore_KR = "별이 붕괴하며 가장 화려한 최후와 시작을 맞이하는 초신성의 힘이 담긴 카드."; ((ItemReference)customItemReference17).prefabKeyword1 = (Key)37; ((ItemReference)customItemReference17).prefabKeyword2 = (Key)23; customItemReference17.extraComponents = new Type[1] { typeof(CardSupernovaBehavior) }; list.Add(customItemReference17); CustomItemReference customItemReference18 = new CustomItemReference(); customItemReference18.name = "QuantumSword"; ((GearReference)customItemReference18).rarity = (Rarity)1; ((GearReference)customItemReference18).path = "Assets/Gear/Items/InvisibleKnife.prefab"; customItemReference18.spriteName = "QuantumSword"; customItemReference18.itemName_EN = "Quantum Sword"; customItemReference18.itemName_KR = "양자의 검"; customItemReference18.itemDescription_EN = "Increases Critical Chance by 20%.\nNon-critical attacks have a chance equal to (100% - Critical Chance) to unleash an invisible slash dealing additional Magic damage."; customItemReference18.itemDescription_KR = "치명타 확률이 20% 증가합니다.\n비치명타 공격 시 치명타 확률의 반대 확률(100% - 치명타 확률)로 보이지 않는 검기를 날려 추가 마법 피해를 입힙니다."; customItemReference18.itemLore_EN = "Reality is born from the collapse of probability."; customItemReference18.itemLore_KR = "확률의 붕괴 속에서 실재가 태어난다."; ((ItemReference)customItemReference18).prefabKeyword1 = (Key)30; ((ItemReference)customItemReference18).prefabKeyword2 = (Key)2; customItemReference18.stats = new Values((Value[])(object)new Value[1] { new Value(Category.PercentPoint, Kind.CriticalChance, 0.2) }); customItemReference18.extraComponents = new Type[1] { typeof(QuantumSwordBehavior) }; list.Add(customItemReference18); CustomItemReference customItemReference19 = new CustomItemReference(); customItemReference19.name = "SacredOrb"; ((GearReference)customItemReference19).rarity = (Rarity)3; customItemReference19.spriteName = "SacredOrb"; customItemReference19.itemName_EN = "Sacred Orb of the Otherworld"; customItemReference19.itemName_KR = "이계의 신성한 오브"; customItemReference19.itemDescription_EN = "Prevents Common and Rare items and skulls from dropping."; customItemReference19.itemDescription_KR = "일반 등급과 레어 등급의 머리(스컬)와 아이템이 나오지 않습니다."; customItemReference19.itemLore_EN = "An orb containing pure dimensional energy that alters probability."; customItemReference19.itemLore_KR = "차원의 순수한 힘이 깃들어 확률을 비트는 구체."; ((ItemReference)customItemReference19).prefabKeyword1 = (Key)34; ((ItemReference)customItemReference19).prefabKeyword2 = (Key)36; list.Add(customItemReference19); CustomItemReference customItemReference20 = new CustomItemReference(); customItemReference20.name = "IdolOfTheOtherworld"; ((GearReference)customItemReference20).rarity = (Rarity)4; ((GearReference)customItemReference20).gearTag = (Tag)8; customItemReference20.spriteName = "IdolOfTheOtherworld"; customItemReference20.itemName_EN = "Omen: Idol of Disaster"; customItemReference20.itemName_KR = "흉조: 재앙의 우상"; customItemReference20.itemDescription_EN = "Triggers the Idol of Disaster effect on swap, creating red spikes on the ground for 9 seconds. Spikes deal Adaptive Damage and randomly inflict Freeze, Stun, Poison, or Wound per tick."; customItemReference20.itemDescription_KR = "교대 시 지면에 9초간 유지되는 붉은 가시들을 소환합니다. 가시는 닿아있는 적에게 틱당 적응형 대미지를 입히고 무작위 상태 이상(빙결, 기절, 독, 상처)을 부여합니다."; customItemReference20.itemLore_EN = "An idol from a twisted dimension, reflecting disaster and curse."; customItemReference20.itemLore_KR = "재앙과 저주를 담고 있는, 뒤틀린 차원의 우상."; ((ItemReference)customItemReference20).prefabKeyword1 = (Key)34; ((ItemReference)customItemReference20).prefabKeyword2 = (Key)27; customItemReference20.extraComponents = new Type[1] { typeof(IdolOfTheOtherworldBehavior) }; list.Add(customItemReference20); CustomItemReference customItemReference21 = new CustomItemReference(); customItemReference21.name = "GuanYuCrescentBlade"; ((GearReference)customItemReference21).rarity = (Rarity)4; customItemReference21.spriteName = "GuanYuCrescentBlade"; customItemReference21.itemName_EN = "Mythic: Guan Yu's Crescent Blade"; customItemReference21.itemName_KR = "신화: 관우의 청룡언월도"; customItemReference21.itemDescription_EN = "Your basic attacks trigger a powerful strike dealing adaptive damage. (Cooldown: 0.5s)"; customItemReference21.itemDescription_KR = "기본 공격 시 쿨타임(0.5초)을 가지고 추가 피해를 입힙니다."; customItemReference21.itemLore_EN = "A legendary glaive wielded by the God of War, Guan Yu."; customItemReference21.itemLore_KR = "무신 관우가 사용했던 전설적인 청룡언월도."; ((ItemReference)customItemReference21).prefabKeyword1 = (Key)3; ((ItemReference)customItemReference21).prefabKeyword2 = (Key)10; customItemReference21.abilities = (Ability[])(object)new Ability[1] { new GuanYuCrescentBladeAbility() }; list.Add(customItemReference21); CustomItemReference customItemReference22 = new CustomItemReference(); customItemReference22.name = "ZeusHammer"; ((GearReference)customItemReference22).rarity = (Rarity)4; customItemReference22.spriteName = "ZeusHammer"; customItemReference22.itemName_EN = "Mythic: Zeus's Hammer"; customItemReference22.itemName_KR = "신화: 제우스의 망치"; customItemReference22.itemDescription_EN = "Lightning strikes nearby enemies periodically, dealing magic damage."; customItemReference22.itemDescription_KR = "주변 적에게 주기적으로 벼락을 떨어트려 마법 피해를 입힙니다."; customItemReference22.itemLore_EN = "A hammer crackling with infinite thunderbolts, representing the supreme god."; customItemReference22.itemLore_KR = "최고의 신을 상징하는, 무한한 번개가 몰아치는 망치."; ((ItemReference)customItemReference22).prefabKeyword1 = (Key)12; ((ItemReference)customItemReference22).prefabKeyword2 = (Key)28; customItemReference22.abilities = (Ability[])(object)new Ability[1] { new ZeusHammerAbility() }; list.Add(customItemReference22); CustomItemReference customItemReference23 = new CustomItemReference(); customItemReference23.name = "MedjedCloak"; ((GearReference)customItemReference23).rarity = (Rarity)4; customItemReference23.spriteName = "MedjedCloak"; customItemReference23.itemName_EN = "Mythic: Medjed's Cloak"; customItemReference23.itemName_KR = "신화: 메제드의 망토"; customItemReference23.itemDescription_EN = "Upon stage clear, drops a random item and skull."; customItemReference23.itemDescription_KR = "스테이지 클리어 시 무작위 아이템과 스컬을 드롭합니다."; customItemReference23.itemLore_EN = "A cloak associated with the mysterious god, Medjed, yielding random dimensional artifacts."; customItemReference23.itemLore_KR = "신비한 존재 메제드를 연상케 하는, 차원의 보상을 뿜어내는 망토."; ((ItemReference)customItemReference23).prefabKeyword1 = (Key)31; ((ItemReference)customItemReference23).prefabKeyword2 = (Key)32; customItemReference23.abilities = (Ability[])(object)new Ability[1] { new MedjedCloakAbility() }; list.Add(customItemReference23); CustomItemReference customItemReference24 = new CustomItemReference(); customItemReference24.name = "PrettyTrash"; ((GearReference)customItemReference24).rarity = (Rarity)(-1); customItemReference24.spriteName = "PrettyTrash"; customItemReference24.itemName_EN = "Trash: Pretty Trash"; customItemReference24.itemName_KR = "쓰레기: 이쁜 쓰레기"; customItemReference24.itemDescription_EN = "It is just a pretty trash."; customItemReference24.itemDescription_KR = "이쁜 쓰레기다."; customItemReference24.itemLore_EN = "Looks glittering, but completely useless."; customItemReference24.itemLore_KR = "빛나 보이지만, 정말 아무런 쓸모가 없다."; ((ItemReference)customItemReference24).prefabKeyword1 = (Key)36; ((ItemReference)customItemReference24).prefabKeyword2 = (Key)19; list.Add(customItemReference24); CustomItemReference customItemReference25 = new CustomItemReference(); customItemReference25.name = "Virus"; ((GearReference)customItemReference25).rarity = (Rarity)(-1); customItemReference25.spriteName = "Virus"; customItemReference25.itemName_EN = "Trash: Virus"; customItemReference25.itemName_KR = "쓰레기: 바이러스"; customItemReference25.itemDescription_EN = "Lose 0.5 HP every 10 seconds."; customItemReference25.itemDescription_KR = "10초마다 체력이 0.5 감소합니다."; customItemReference25.itemLore_EN = "A malicious digital curse slowly decaying your vitals."; customItemReference25.itemLore_KR = "생명력을 서서히 갉아먹는 디지털 저주."; ((ItemReference)customItemReference25).prefabKeyword1 = (Key)19; ((ItemReference)customItemReference25).prefabKeyword2 = (Key)21; customItemReference25.abilities = (Ability[])(object)new Ability[1] { new VirusAbility() }; list.Add(customItemReference25); CustomItemReference customItemReference26 = new CustomItemReference(); customItemReference26.name = "ChallengersBelt"; ((GearReference)customItemReference26).rarity = (Rarity)(-1); customItemReference26.spriteName = "ChallengersBelt"; customItemReference26.itemName_EN = "Trash: Challenger's Belt"; customItemReference26.itemName_KR = "쓰레기: 도전자 벨트"; customItemReference26.itemDescription_EN = "All enemies have 5x Max HP and deal 1.5x damage."; customItemReference26.itemDescription_KR = "모든 적들의 체력이 5배가 되고 데미지가 1.5배로 증가합니다."; customItemReference26.itemLore_EN = "Wearing this invites unmatched hostility and strength to your foes."; customItemReference26.itemLore_KR = "이 벨트를 매는 것은 주변 적들에게 상상초월의 투지와 광기를 불어넣는 행위다."; ((ItemReference)customItemReference26).prefabKeyword1 = (Key)19; ((ItemReference)customItemReference26).prefabKeyword2 = (Key)22; customItemReference26.abilities = (Ability[])(object)new Ability[1] { new ChallengersBeltAbility() }; list.Add(customItemReference26); List list2 = new List(); foreach (CustomItemReference item in list) { if (item.name.StartsWith("Custom-Card") || item.name.StartsWith("Card")) { string text = item.name.Replace("Custom-", ""); CustomItemReference customItemReference27 = new CustomItemReference(); customItemReference27.name = text + "_R"; ((GearReference)customItemReference27).rarity = ((GearReference)item).rarity; ((GearReference)customItemReference27).obtainable = false; customItemReference27.spriteName = item.spriteName + "_R"; customItemReference27.itemName_EN = item.itemName_EN; customItemReference27.itemName_KR = item.itemName_KR; customItemReference27.itemDescription_EN = item.itemDescription_EN; customItemReference27.itemDescription_KR = item.itemDescription_KR; customItemReference27.itemLore_EN = item.itemLore_EN; customItemReference27.itemLore_KR = item.itemLore_KR; ((ItemReference)customItemReference27).prefabKeyword1 = ((ItemReference)item).prefabKeyword1; ((ItemReference)customItemReference27).prefabKeyword2 = ((ItemReference)item).prefabKeyword2; customItemReference27.extraComponents = item.extraComponents; list2.Add(customItemReference27); CustomItemReference customItemReference28 = new CustomItemReference(); customItemReference28.name = text + "_E"; ((GearReference)customItemReference28).rarity = (Rarity)((text == "CardSupernova") ? 3 : 2); ((GearReference)customItemReference28).obtainable = false; customItemReference28.spriteName = item.spriteName + "_E"; customItemReference28.itemName_EN = item.itemName_EN; customItemReference28.itemName_KR = item.itemName_KR; customItemReference28.itemDescription_EN = item.itemDescription_EN; customItemReference28.itemDescription_KR = item.itemDescription_KR; customItemReference28.itemLore_EN = item.itemLore_EN; customItemReference28.itemLore_KR = item.itemLore_KR; ((ItemReference)customItemReference28).prefabKeyword1 = ((ItemReference)item).prefabKeyword1; ((ItemReference)customItemReference28).prefabKeyword2 = ((ItemReference)item).prefabKeyword2; customItemReference28.extraComponents = item.extraComponents; list2.Add(customItemReference28); CustomItemReference customItemReference29 = new CustomItemReference(); customItemReference29.name = text + "_RE"; ((GearReference)customItemReference29).rarity = (Rarity)((text == "CardSupernova") ? 3 : 2); ((GearReference)customItemReference29).obtainable = false; customItemReference29.spriteName = item.spriteName + "_RE"; customItemReference29.itemName_EN = item.itemName_EN; customItemReference29.itemName_KR = item.itemName_KR; customItemReference29.itemDescription_EN = item.itemDescription_EN; customItemReference29.itemDescription_KR = item.itemDescription_KR; customItemReference29.itemLore_EN = item.itemLore_EN; customItemReference29.itemLore_KR = item.itemLore_KR; ((ItemReference)customItemReference29).prefabKeyword1 = ((ItemReference)item).prefabKeyword1; ((ItemReference)customItemReference29).prefabKeyword2 = ((ItemReference)item).prefabKeyword2; customItemReference29.extraComponents = item.extraComponents; list2.Add(customItemReference29); } } list.AddRange(list2); foreach (CustomItemReference item2 in list) { string gearName = (string.IsNullOrEmpty(item2.spriteName) ? item2.name.Replace("Custom-", "") : item2.spriteName); ((GearReference)item2).icon = CustomSpriteHelper.GetOrGenerateSprite(gearName, ((GearReference)item2).rarity, isIcon: true); ((GearReference)item2).thumbnail = CustomSpriteHelper.GetOrGenerateSprite(gearName, ((GearReference)item2).rarity, isIcon: false); } return list; } internal static void LoadSprites() { } internal static Dictionary MakeStringDictionary() { Dictionary dictionary = new Dictionary(Items.Count * 3); foreach (CustomItemReference item in Items) { dictionary.Add("item/" + item.name + "/name", item.itemName); dictionary.Add("item/" + item.name + "/desc", item.itemDescription); dictionary.Add("item/" + item.name + "/flavor", item.itemLore); } return dictionary; } } public class CustomSkulls { public static readonly List Skulls = InitializeSkulls(); private static List InitializeSkulls() { return new List(); } internal static Dictionary MakeStringDictionary() { Dictionary dictionary = new Dictionary(Skulls.Count * 3); foreach (CustomWeaponReference skull in Skulls) { dictionary.Add("weapon/" + skull.name + "/name", skull.weaponName); dictionary.Add("weapon/" + skull.name + "/desc", skull.weaponDescription); dictionary.Add("weapon/" + skull.name + "/flavor", skull.weaponLore); } return dictionary; } } [Serializable] public class CustomWeaponReference : WeaponReference { private string _originalName; public string weaponName_EN; public string weaponName_KR; public string weaponDescription_EN; public string weaponDescription_KR; public string weaponLore_EN; public string weaponLore_KR; public Values stats; public Ability[] passiveAbilities; public Sprite miniIcon; private Weapon weapon = null; private static GameObject rootObj; public string name { get { return ((GearReference)this).name; } set { _originalName = value; ((GearReference)this).name = "Custom-" + _originalName; ((GearReference)this).guid = "custom_weapon://" + value; ((GearReference)this).displayNameKey = "weapon/" + ((GearReference)this).name + "/name"; } } public string weaponName { get { if (PluginItems.IsKorean()) { return string.IsNullOrEmpty(weaponName_KR) ? weaponName_EN : weaponName_KR; } return string.IsNullOrEmpty(weaponName_EN) ? weaponName_KR : weaponName_EN; } } public string weaponDescription { get { if (PluginItems.IsKorean()) { return string.IsNullOrEmpty(weaponDescription_KR) ? weaponDescription_EN : weaponDescription_KR; } return string.IsNullOrEmpty(weaponDescription_EN) ? weaponDescription_KR : weaponDescription_EN; } } public string weaponLore { get { if (PluginItems.IsKorean()) { return string.IsNullOrEmpty(weaponLore_KR) ? weaponLore_EN : weaponLore_KR; } return string.IsNullOrEmpty(weaponLore_EN) ? weaponLore_KR : weaponLore_EN; } } public CustomWeaponReference() { ((GearReference)this).obtainable = true; ((GearReference)this).needUnlock = false; ((GearReference)this).path = "Assets/Gear/Weapons/Skul/Skul.prefab"; } public Weapon GetWeapon(Weapon baseWeapon) { //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_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_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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_00d6: 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_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0178: 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_01a3: Expected O, but got Unknown //IL_01a8: Expected O, but got Unknown //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Expected O, but got Unknown if ((Object)(object)weapon == (Object)null) { if ((Object)(object)rootObj == (Object)null) { rootObj = new GameObject("CustomWeapons"); rootObj.SetActive(false); Object.DontDestroyOnLoad((Object)(object)rootObj); } weapon = Object.Instantiate(baseWeapon, rootObj.transform); ((Object)((Component)weapon).gameObject).name = name; ((Gear)weapon)._stat = stats; ((Gear)weapon)._rarity = ((GearReference)this).rarity; ((Gear)weapon)._gearTag = ((GearReference)this).gearTag; weapon._category = base.category; if ((Object)(object)((GearReference)this).icon == (Object)null) { ((GearReference)this).icon = CustomSpriteHelper.GetOrGenerateSprite(_originalName, ((GearReference)this).rarity, isIcon: true); if ((Object)(object)((GearReference)this).icon == (Object)null) { ((GearReference)this).icon = ((Gear)baseWeapon).icon; } } if ((Object)(object)((GearReference)this).thumbnail == (Object)null) { ((GearReference)this).thumbnail = CustomSpriteHelper.GetOrGenerateSprite(_originalName, ((GearReference)this).rarity, isIcon: false); if ((Object)(object)((GearReference)this).thumbnail == (Object)null) { ((GearReference)this).thumbnail = ((Gear)baseWeapon).thumbnail; } } if (passiveAbilities != null && passiveAbilities.Length != 0) { GameObject val = new GameObject("Passive Ability Attacher"); val.transform.parent = ((Component)weapon).gameObject.transform; Weapon obj = weapon; Subcomponents val2 = new Subcomponents(); Subcomponents val3 = val2; obj._passiveAbilityAttacher = val2; Subcomponents val4 = val3; ((SubcomponentArray)(object)val4)._container = val; ((SubcomponentArray)(object)val4)._components = (AbilityAttacher[])(object)new AbilityAttacher[passiveAbilities.Length]; if ((Object)(object)miniIcon != (Object)null) { passiveAbilities[0]._defaultIcon = miniIcon; } for (int i = 0; i < passiveAbilities.Length; i++) { GameObject val5 = new GameObject("[" + i + "]", new Type[1] { typeof(AlwaysAbilityAttacher) }); val5.transform.parent = val.transform; AlwaysAbilityAttacher component = val5.GetComponent(); component._abilityComponent = CreateAbilityObject(val5, passiveAbilities[i]); ((SubcomponentArray)(object)val4)._components[i] = (AbilityAttacher)(object)component; } } } return weapon; } private static AbilityComponent CreateAbilityObject(GameObject parent, Ability ability) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown Type abilityType = ((object)ability).GetType(); Assembly assembly = abilityType.Assembly; string componentName = abilityType.Name + "Component"; Type[] array = (from type2 in assembly.GetTypes() where string.Equals(type2.Namespace, abilityType.Namespace, StringComparison.Ordinal) && string.Equals(type2.Name, componentName, StringComparison.Ordinal) select type2).ToArray(); if (array.Length == 1) { Type type = array[0]; GameObject val = new GameObject("Ability", new Type[1] { type }); val.transform.parent = parent.transform; FieldInfo fieldInfo = AccessTools.Field(type, "_ability"); Component component = val.GetComponent(type); fieldInfo.SetValue(component, ability); return (AbilityComponent)component; } throw new NotImplementedException("Ability Component Type " + componentName + " not found."); } } [BepInPlugin("com.slibul.chzzkskulitems", "ChzzkSkulItems", "1.1.8")] public class PluginItems : BaseUnityPlugin { public static ManualLogSource Log; public static ConfigEntry CustomItemLanguage; public static ConfigEntry ShowGlitchedEffects; public static PluginItems Instance; private static Harmony _harmonyInstance; private static bool? _isEnabled; public static bool IsModActive => _isEnabled == true; public static bool IsKorean() { if (CustomItemLanguage != null) { string value = CustomItemLanguage.Value; if (value.Equals("Korean", StringComparison.OrdinalIgnoreCase)) { return true; } if (value.Equals("English", StringComparison.OrdinalIgnoreCase)) { return false; } if (value.Equals("Auto", StringComparison.OrdinalIgnoreCase)) { return "language".Equals("korean", StringComparison.OrdinalIgnoreCase); } } return true; } private void Awake() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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 Instance = this; Log = ((BaseUnityPlugin)this).Logger; CustomItemLanguage = ((BaseUnityPlugin)this).Config.Bind("General", "커스텀 아이템 언어", "Korean", new ConfigDescription("커스텀 아이템 및 스컬의 언어 설정입니다.", (AcceptableValueBase)(object)new AcceptableValueList(new string[3] { "Korean", "English", "Auto" }), Array.Empty())); ShowGlitchedEffects = ((BaseUnityPlugin)this).Config.Bind("General", "오류 아이템 효과 표시", false, "오류 아이템의 실제 세부 효과를 설명에 표시할지 여부입니다."); _harmonyInstance = new Harmony("com.slibul.chzzkskulitems"); bool enabled = _isEnabled ?? true; _isEnabled = null; SetEnabled(enabled); Log.LogInfo((object)"ChzzkSkulItems (Items & Skulls) plugin loaded successfully!"); } public static void SetEnabled(bool enabled) { if (Log == null || _harmonyInstance == null) { _isEnabled = enabled; } else { if (_isEnabled == enabled) { return; } if (enabled) { Log.LogInfo((object)"[PluginItems] Enabling Items & Skulls module (Applying patches)..."); try { _harmonyInstance.PatchAll(Assembly.GetExecutingAssembly()); EnumArray_ManualPatch.Patch(_harmonyInstance); CustomGearsManualPatch.Patch(_harmonyInstance); ChzzkStatManager.Load(); } catch (Exception ex) { Log.LogError((object)("Error enabling PluginItems: " + ex)); } } else { Log.LogInfo((object)"[PluginItems] Disabling Items & Skulls module (Unpatching)..."); try { _harmonyInstance.UnpatchSelf(); Character player = ChzzkCardSynergy.GetPlayer(); if ((Object)(object)player != (Object)null && player.stat != null) { try { ChzzkStatManager.SavedStats.Clear(); player.stat.SetNeedUpdate(); } catch { } } } catch (Exception ex2) { Log.LogError((object)("Error disabling PluginItems: " + ex2)); } } _isEnabled = enabled; UpdateSaveFilePath(enabled); } } public static void UpdateSaveFilePath(bool isItemsModeEnabled) { //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) try { PlatformManager val = Object.FindObjectOfType(); if ((Object)(object)val == (Object)null || val.platform == null) { return; } Traverse val2 = Traverse.Create((object)val.platform); object value = val2.Field("_saveSystem").GetValue(); if (value != null) { Traverse val3 = Traverse.Create(value); string text = SteamUser.GetSteamID().m_SteamID.ToString(); string text2 = text + ".dat"; string text3 = (isItemsModeEnabled ? text2.Replace(".dat", "_mod.dat") : text2); string text4 = Path.Combine(Application.persistentDataPath, text3); val3.Field("_saveFileName").SetValue((object)text3); val3.Field("_saveFilePath").SetValue((object)text4); val3.Field("_tempFilePath").SetValue((object)(text4 + ".tmp")); val3.Field("_backupFilePath").SetValue((object)(text4 + ".bak")); ManualLogSource log = Log; if (log != null) { log.LogInfo((object)("[SaveSystemPatch] Dynamically redirected save file to: " + text3)); } } } catch (Exception ex) { ManualLogSource log2 = Log; if (log2 != null) { log2.LogError((object)("[SaveSystemPatch] Failed to dynamically update save file path: " + ex)); } } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static class SteamSaveSystemConstructorPatch { [HarmonyPostfix] public static void Postfix(SteamSaveSystem __instance) { try { if (!PluginItems.IsModActive) { return; } Traverse val = Traverse.Create((object)__instance); string value = val.Field("_saveFileName").GetValue(); if (!value.EndsWith("_mod.dat")) { string text = value.Replace(".dat", "_mod.dat"); val.Field("_saveFileName").SetValue((object)text); string text2 = Path.Combine(Application.persistentDataPath, text); val.Field("_saveFilePath").SetValue((object)text2); val.Field("_tempFilePath").SetValue((object)(text2 + ".tmp")); val.Field("_backupFilePath").SetValue((object)(text2 + ".bak")); ManualLogSource log = PluginItems.Log; if (log != null) { log.LogInfo((object)("[SaveSystemPatch] ItemsMod is enabled. Redirected save file to: " + text)); } } } catch (Exception ex) { ManualLogSource log2 = PluginItems.Log; if (log2 != null) { log2.LogError((object)("[SaveSystemPatch] Constructor patch failed: " + ex)); } } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "ChzzItem"; public const string PLUGIN_NAME = "ChzzItem"; public const string PLUGIN_VERSION = "1.1.8"; } } namespace System { internal readonly struct Index : IEquatable { private readonly int _value; public static Index Start => new Index(0); public static Index End => new Index(-1); public bool IsFromEnd => _value < 0; public int Value => IsFromEnd ? (~_value) : _value; [MethodImpl(MethodImplOptions.AggressiveInlining)] public Index(int value, bool fromEnd = false) { if (value < 0) { throw new ArgumentOutOfRangeException("value"); } _value = (fromEnd ? (~value) : value); } private Index(int value) { _value = value; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static implicit operator Index(int value) { return new Index(value); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public int GetOffset(int length) { int num = _value; if (IsFromEnd) { num += length + 1; } return num; } public bool Equals(Index other) { return _value == other._value; } public override bool Equals(object value) { return value is Index index && _value == index._value; } public override int GetHashCode() { return _value; } public override string ToString() { return IsFromEnd ? $"^{Value}" : Value.ToString(); } } internal readonly struct Range : IEquatable { public Index Start { get; } public Index End { get; } public static Range All => Index.Start..Index.End; public Range(Index start, Index end) { Start = start; End = end; } public static Range StartAt(Index start) { return start..Index.End; } public static Range EndAt(Index end) { return Index.Start..end; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public (int Offset, int Length) GetOffsetAndLength(int length) { int offset = Start.GetOffset(length); int offset2 = End.GetOffset(length); if ((uint)offset2 > (uint)length || (uint)offset > (uint)offset2) { throw new ArgumentOutOfRangeException("length"); } return (Offset: offset, Length: offset2 - offset); } public bool Equals(Range other) { return Start.Equals(other.Start) && End.Equals(other.End); } public override bool Equals(object value) { return value is Range range && range.Equals(this); } public override int GetHashCode() { return Start.GetHashCode() ^ (End.GetHashCode() << 16); } public override string ToString() { return $"{Start}..{End}"; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } internal static class IsExternalInit { } }