Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of AiQueOdio v1.8.3
AiqueOdio.dll
Decompiled a week agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using On.RoR2; using On.RoR2.Artifacts; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using RoR2; using RoR2.ExpansionManagement; using RoR2.UI; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("AiqueOdio")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Ai Que Odio Difficulty")] [assembly: AssemblyFileVersion("1.8.3.0")] [assembly: AssemblyInformationalVersion("1.8.3+b07a79928276770ea8d1ecaf82792178084d4448")] [assembly: AssemblyProduct("AiqueOdio")] [assembly: AssemblyTitle("AiqueOdio")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.8.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace AiqueOdio { public sealed class LegendaryDroneShop : MonoBehaviour { public List<DroneIndex> choices; } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct PlayPitiMessage : INetMessage, ISerializableObject { public void Serialize(NetworkWriter writer) { } public void Deserialize(NetworkReader reader) { } public void OnReceived() { AiqueOdioPlugin.PlayPitiLocal(); } } public struct ShowMonsterItemMessage : INetMessage, ISerializableObject { private int itemIndex; private int sequence; public ShowMonsterItemMessage(ItemIndex itemIndex, int sequence) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected I4, but got Unknown this.itemIndex = (int)itemIndex; this.sequence = sequence; } public void Serialize(NetworkWriter writer) { writer.Write(itemIndex); writer.Write(sequence); } public void Deserialize(NetworkReader reader) { itemIndex = reader.ReadInt32(); sequence = reader.ReadInt32(); } public void OnReceived() { AiqueOdioPlugin.ShowMonsterItemLocal((ItemIndex)itemIndex, sequence); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.seuusuario.aiqueodio", "Ai Que Odio Difficulty", "1.8.3")] public sealed class AiqueOdioPlugin : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static Action<Run, RuleBook> <0>__OnRunSetRuleBookGlobal; public static Action<Run> <1>__OnRunStartGlobal; public static Action<Run> <2>__OnRunDestroyGlobal; public static Action<Stage> <3>__OnStageStartGlobal; public static Action<SpawnResult> <4>__OnSpawnedServerGlobal; public static Action <5>__OnFixedUpdate; public static Action<CharacterBody> <6>__OnBodyStartGlobal; public static hook_OnGenerateInteractableCardSelection <7>__ModifyCommandInteractables; public static hook_CreateTerminals <8>__ExpandDroneShop; public static hook_Start <9>__ConfigureDroneShop; public static hook_ShouldDisplayHologram <10>__ShouldDisplayDroneShopPrice; public static hook_SetCloseOnTerminalPurchase <11>__KeepDroneShopSinglePurchase; public static hook_EnsureMonsterTeamItemCount <12>__SuppressAutomaticEvolutionItems; public static hook_SetOptionsServer <13>__FilterTonicDisplayOptionsServer; public static hook_SetOptionsInternal <14>__FilterTonicDisplayOptionsInternal; public static hook_GetLocalizedStringByToken <15>__GetLocalizedStringByToken; } public const string PluginGuid = "com.seuusuario.aiqueodio"; public const string PluginName = "Ai Que Odio Difficulty"; public const string PluginVersion = "1.8.3"; private const float DifficultyScaling = 4f; private const float FirstItemTimeSeconds = 1f; private const float ItemIntervalSeconds = 60f; private const float ItemIntervalReductionPerStage = 2f; private const float MinimumItemIntervalSeconds = 15f; private const int PermanentTonicStage = 5; private const int IndividualDronePrices = -1; private const float DuplicateSoundWindowSeconds = 0.5f; private const float ItemVisualFadeInSeconds = 0.35f; private const float ItemVisualShowcaseSeconds = 4f; private const float ItemVisualTravelSeconds = 0.85f; private const string AudioFileName = "GabiDandoPiti.wav"; private const string ScrapperAddress = "RoR2/Base/Scrapper/iscScrapper.asset"; private const string TripleDroneShopAddress = "RoR2/DLC3/TripleDroneShop/iscTripleDroneShop.asset"; private const string MonsterInventoryPrefabPath = "Prefabs/NetworkedObjects/MonsterTeamGainsItemsArtifactInventory"; private const uint SndAsync = 1u; private const uint SndNoDefault = 2u; private const uint SndFileName = 131072u; private static readonly string[] ChatMessages = new string[4] { "<color=#ff69b4> Os monstros entraram na puberdade e ganharam um {0}!</color>", "<color=#ff69b4> Os monstros estão de TPM e roubaram um {0}!</color>", "<color=#ff69b4> Os monstros gritam por atenção empunhando um {0}!</color>", "<color=#ff69b4> Os monstros estão no cio e acharam um {0}!</color>" }; private static readonly string[] DeathQuotes = new string[8] { "\"AI, QUE MOD DIFÍCIL!!! AI, QUE ÓDIO!!!\"", "\"Nmrl, tem um mod que abre o jogo e aparece 'Vitória', não?\"", "\"Não tem um mod que dá pra jogar enquanto eu durmo não? pprt.\"", "\"Tá a fim de botar na dificuldade Sunny não?\"", "\"Slk, mod mó cota esse, pprt 67\"", "\"Eu vô vê e te aviso o dia que vou entrar de novo, pdc?\"", "\"Experimente tomar cápsulas de ômega 3\"", "\"Mod bucha pprt\"" }; private static readonly string[] AllowedBossItemNames = new string[7] { "lightninggland", "conductor", "shinypearl", "fireballsonhit", "parentegg", "bleedonhitandexplode", "knurl" }; private static readonly string[] BlockedWhiteItemNames = new string[8] { "tooth", "barrieronkill", "sprintbonus", "increasedamageonmultikill", "igniteonkill", "seed", "healwhilesafe", "crowbar" }; private static readonly string[] BlockedGreenItemNames = new string[10] { "infusion", "movespeedonkill", "huntersharpoon", "bandolier", "jumpboost", "sprintarmor", "warcryonmultikill", "attackspeedonmultikill", "bonusgoldpackonkill", "explodeondeath" }; private static readonly string[] BlockedRedItemNames = new string[5] { "ghostonkill", "plant", "laserturbine", "randomequipmenttrigger", "utilityskillmagazine" }; private static readonly string[] StationaryTurretNames = new string[2] { "turret1", "gunnerturret" }; private static DifficultyDef difficultyDef; private static DifficultyIndex difficultyIndex; private static ArtifactDef esmaltePinkArtifactDef; private static ItemDef tonicDisplayItemDef; private static InteractableSpawnCard scrapperSpawnCard; private static InteractableSpawnCard tripleDroneShopSpawnCard; private static GameObject monsterItemDisplayObject; private static Inventory monsterItemDisplayInventory; private static EnemyInfoPanelInventoryProvider monsterItemDisplayProvider; private static readonly Dictionary<ItemIndex, int> MonsterItemStacks = new Dictionary<ItemIndex, int>(); private static string pitiAudioPath; private static float lastPitiPlayTime = float.NegativeInfinity; private static int itemsGivenByTime; private static float lastItemGrantTime; private static float nextItemGrantTime; private static bool tonicDisplayAdded; private static bool tonicBuffConfirmed; private static readonly Dictionary<SpawnCard, InteractableSpawnCard> DroneShopSpawnCards = new Dictionary<SpawnCard, InteractableSpawnCard>(); private static readonly HashSet<SpawnCard> LegendaryDroneShopSpawnCards = new HashSet<SpawnCard>(); private static readonly Queue<ItemIndex> MonsterItemVisualQueue = new Queue<ItemIndex>(); private static AiqueOdioPlugin instance; private static Coroutine monsterItemVisualCoroutine; private static GameObject monsterItemVisualCanvas; private static int monsterItemVisualSequence; private static int lastMonsterItemVisualSequence; [DllImport("winmm.dll", CharSet = CharSet.Unicode, EntryPoint = "PlaySoundW", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] private static extern bool PlaySoundNative(string soundPath, IntPtr module, uint flags); private void Awake() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) instance = this; Log.Init(((BaseUnityPlugin)this).Logger); LoadAudioPath(); NetworkingAPI.RegisterMessageType<PlayPitiMessage>(); NetworkingAPI.RegisterMessageType<ShowMonsterItemMessage>(); LoadDefinitions(); RegisterLanguageTokens(); difficultyIndex = DifficultyAPI.AddDifficulty(difficultyDef); ContentAddition.AddArtifactDef(esmaltePinkArtifactDef); ContentAddition.AddItemDef(tonicDisplayItemDef); SubscribeHooks(); Log.Info("AI, QUE ÓDIO!!! v1.8.3 carregado com sucesso!"); } private void OnDestroy() { //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_00fb: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown //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_017b: Expected O, but got Unknown //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Expected O, but got Unknown //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Expected O, but got Unknown //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Expected O, but got Unknown Run.onRunSetRuleBookGlobal -= OnRunSetRuleBookGlobal; Run.onRunStartGlobal -= OnRunStartGlobal; Run.onRunDestroyGlobal -= OnRunDestroyGlobal; Stage.onStageStartGlobal -= OnStageStartGlobal; SpawnCard.onSpawnedServerGlobal -= OnSpawnedServerGlobal; RoR2Application.onFixedUpdate -= OnFixedUpdate; CharacterBody.onBodyStartGlobal -= OnBodyStartGlobal; object obj = <>O.<7>__ModifyCommandInteractables; if (obj == null) { hook_OnGenerateInteractableCardSelection val = ModifyCommandInteractables; <>O.<7>__ModifyCommandInteractables = val; obj = (object)val; } CommandArtifactManager.OnGenerateInteractableCardSelection -= (hook_OnGenerateInteractableCardSelection)obj; object obj2 = <>O.<8>__ExpandDroneShop; if (obj2 == null) { hook_CreateTerminals val2 = ExpandDroneShop; <>O.<8>__ExpandDroneShop = val2; obj2 = (object)val2; } DroneVendorMultiShopController.CreateTerminals -= (hook_CreateTerminals)obj2; object obj3 = <>O.<9>__ConfigureDroneShop; if (obj3 == null) { hook_Start val3 = ConfigureDroneShop; <>O.<9>__ConfigureDroneShop = val3; obj3 = (object)val3; } DroneVendorMultiShopController.Start -= (hook_Start)obj3; object obj4 = <>O.<10>__ShouldDisplayDroneShopPrice; if (obj4 == null) { hook_ShouldDisplayHologram val4 = ShouldDisplayDroneShopPrice; <>O.<10>__ShouldDisplayDroneShopPrice = val4; obj4 = (object)val4; } DroneVendorMultiShopController.ShouldDisplayHologram -= (hook_ShouldDisplayHologram)obj4; object obj5 = <>O.<11>__KeepDroneShopSinglePurchase; if (obj5 == null) { hook_SetCloseOnTerminalPurchase val5 = KeepDroneShopSinglePurchase; <>O.<11>__KeepDroneShopSinglePurchase = val5; obj5 = (object)val5; } DroneVendorMultiShopController.SetCloseOnTerminalPurchase -= (hook_SetCloseOnTerminalPurchase)obj5; object obj6 = <>O.<12>__SuppressAutomaticEvolutionItems; if (obj6 == null) { hook_EnsureMonsterTeamItemCount val6 = SuppressAutomaticEvolutionItems; <>O.<12>__SuppressAutomaticEvolutionItems = val6; obj6 = (object)val6; } MonsterTeamGainsItemsArtifactManager.EnsureMonsterTeamItemCount -= (hook_EnsureMonsterTeamItemCount)obj6; object obj7 = <>O.<13>__FilterTonicDisplayOptionsServer; if (obj7 == null) { hook_SetOptionsServer val7 = FilterTonicDisplayOptionsServer; <>O.<13>__FilterTonicDisplayOptionsServer = val7; obj7 = (object)val7; } PickupPickerController.SetOptionsServer -= (hook_SetOptionsServer)obj7; object obj8 = <>O.<14>__FilterTonicDisplayOptionsInternal; if (obj8 == null) { hook_SetOptionsInternal val8 = FilterTonicDisplayOptionsInternal; <>O.<14>__FilterTonicDisplayOptionsInternal = val8; obj8 = (object)val8; } PickupPickerController.SetOptionsInternal -= (hook_SetOptionsInternal)obj8; object obj9 = <>O.<15>__GetLocalizedStringByToken; if (obj9 == null) { hook_GetLocalizedStringByToken val9 = GetLocalizedStringByToken; <>O.<15>__GetLocalizedStringByToken = val9; obj9 = (object)val9; } Language.GetLocalizedStringByToken -= (hook_GetLocalizedStringByToken)obj9; ClearMonsterItemVisuals(); DestroyMonsterItemDisplay(); MonsterItemStacks.Clear(); foreach (InteractableSpawnCard value in DroneShopSpawnCards.Values) { Object.Destroy((Object)(object)value); } DroneShopSpawnCards.Clear(); LegendaryDroneShopSpawnCards.Clear(); tripleDroneShopSpawnCard = null; if ((Object)(object)instance == (Object)(object)this) { instance = null; } } private void LoadAudioPath() { string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location) ?? string.Empty, "GabiDandoPiti.wav"); if (!File.Exists(text)) { pitiAudioPath = null; Log.Error("[AiQueOdio] GabiDandoPiti.wav não foi encontrado ao lado da DLL: " + text); } else { pitiAudioPath = text; Log.Info("[AiQueOdio] WAV pronto para reprodução pelo áudio nativo do Windows."); } } internal static void PlayPitiLocal() { if (string.IsNullOrEmpty(pitiAudioPath) || !File.Exists(pitiAudioPath)) { Log.Warning("[AiQueOdio] O áudio não tocou porque o WAV não está disponível."); return; } float realtimeSinceStartup = Time.realtimeSinceStartup; if (realtimeSinceStartup - lastPitiPlayTime < 0.5f) { return; } lastPitiPlayTime = realtimeSinceStartup; try { if (PlaySoundNative(pitiAudioPath, IntPtr.Zero, 131075u)) { Log.Info("[AiQueOdio] Reprodução do Piti iniciada."); } else { Log.Error("[AiQueOdio] O Windows recusou o WAV. Código: " + Marshal.GetLastWin32Error()); } } catch (Exception ex) { Log.Error("[AiQueOdio] Falha na reprodução do WAV: " + ex); } } private static void SubscribeHooks() { //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_00fb: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown //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_017b: Expected O, but got Unknown //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Expected O, but got Unknown //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Expected O, but got Unknown //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Expected O, but got Unknown Run.onRunSetRuleBookGlobal += OnRunSetRuleBookGlobal; Run.onRunStartGlobal += OnRunStartGlobal; Run.onRunDestroyGlobal += OnRunDestroyGlobal; Stage.onStageStartGlobal += OnStageStartGlobal; SpawnCard.onSpawnedServerGlobal += OnSpawnedServerGlobal; RoR2Application.onFixedUpdate += OnFixedUpdate; CharacterBody.onBodyStartGlobal += OnBodyStartGlobal; object obj = <>O.<7>__ModifyCommandInteractables; if (obj == null) { hook_OnGenerateInteractableCardSelection val = ModifyCommandInteractables; <>O.<7>__ModifyCommandInteractables = val; obj = (object)val; } CommandArtifactManager.OnGenerateInteractableCardSelection += (hook_OnGenerateInteractableCardSelection)obj; object obj2 = <>O.<8>__ExpandDroneShop; if (obj2 == null) { hook_CreateTerminals val2 = ExpandDroneShop; <>O.<8>__ExpandDroneShop = val2; obj2 = (object)val2; } DroneVendorMultiShopController.CreateTerminals += (hook_CreateTerminals)obj2; object obj3 = <>O.<9>__ConfigureDroneShop; if (obj3 == null) { hook_Start val3 = ConfigureDroneShop; <>O.<9>__ConfigureDroneShop = val3; obj3 = (object)val3; } DroneVendorMultiShopController.Start += (hook_Start)obj3; object obj4 = <>O.<10>__ShouldDisplayDroneShopPrice; if (obj4 == null) { hook_ShouldDisplayHologram val4 = ShouldDisplayDroneShopPrice; <>O.<10>__ShouldDisplayDroneShopPrice = val4; obj4 = (object)val4; } DroneVendorMultiShopController.ShouldDisplayHologram += (hook_ShouldDisplayHologram)obj4; object obj5 = <>O.<11>__KeepDroneShopSinglePurchase; if (obj5 == null) { hook_SetCloseOnTerminalPurchase val5 = KeepDroneShopSinglePurchase; <>O.<11>__KeepDroneShopSinglePurchase = val5; obj5 = (object)val5; } DroneVendorMultiShopController.SetCloseOnTerminalPurchase += (hook_SetCloseOnTerminalPurchase)obj5; object obj6 = <>O.<12>__SuppressAutomaticEvolutionItems; if (obj6 == null) { hook_EnsureMonsterTeamItemCount val6 = SuppressAutomaticEvolutionItems; <>O.<12>__SuppressAutomaticEvolutionItems = val6; obj6 = (object)val6; } MonsterTeamGainsItemsArtifactManager.EnsureMonsterTeamItemCount += (hook_EnsureMonsterTeamItemCount)obj6; object obj7 = <>O.<13>__FilterTonicDisplayOptionsServer; if (obj7 == null) { hook_SetOptionsServer val7 = FilterTonicDisplayOptionsServer; <>O.<13>__FilterTonicDisplayOptionsServer = val7; obj7 = (object)val7; } PickupPickerController.SetOptionsServer += (hook_SetOptionsServer)obj7; object obj8 = <>O.<14>__FilterTonicDisplayOptionsInternal; if (obj8 == null) { hook_SetOptionsInternal val8 = FilterTonicDisplayOptionsInternal; <>O.<14>__FilterTonicDisplayOptionsInternal = val8; obj8 = (object)val8; } PickupPickerController.SetOptionsInternal += (hook_SetOptionsInternal)obj8; object obj9 = <>O.<15>__GetLocalizedStringByToken; if (obj9 == null) { hook_GetLocalizedStringByToken val9 = GetLocalizedStringByToken; <>O.<15>__GetLocalizedStringByToken = val9; obj9 = (object)val9; } Language.GetLocalizedStringByToken += (hook_GetLocalizedStringByToken)obj9; } private void LoadDefinitions() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown Sprite val = LoadEmbeddedSprite("Dificuldade.png"); Sprite smallIconSelectedSprite = LoadEmbeddedSprite("Esmalte.png"); Sprite smallIconDeselectedSprite = LoadEmbeddedSprite("EsmalteApagado.png"); difficultyDef = new DifficultyDef(4f, "AIQUEODIO_NAME", "AIQUEODIO_ICON", "AIQUEODIO_DESCRIPTION", new Color(1f, 0.4f, 0.7f), "od", true); if ((Object)(object)val != (Object)null) { difficultyDef.foundIconSprite = true; difficultyDef.iconSprite = val; } esmaltePinkArtifactDef = ScriptableObject.CreateInstance<ArtifactDef>(); esmaltePinkArtifactDef.cachedName = "ESMALTE_PINK"; esmaltePinkArtifactDef.nameToken = "ESMALTE_PINK_NAME"; esmaltePinkArtifactDef.descriptionToken = "ESMALTE_PINK_DESCRIPTION"; esmaltePinkArtifactDef.smallIconSelectedSprite = smallIconSelectedSprite; esmaltePinkArtifactDef.smallIconDeselectedSprite = smallIconDeselectedSprite; tonicDisplayItemDef = ScriptableObject.CreateInstance<ItemDef>(); ((Object)tonicDisplayItemDef).name = "AiQueOdioTonicDisplay"; tonicDisplayItemDef.nameToken = "AIQUEODIO_TONIC_DISPLAY_NAME"; tonicDisplayItemDef.pickupToken = "AIQUEODIO_TONIC_DISPLAY_PICKUP"; tonicDisplayItemDef.descriptionToken = "AIQUEODIO_TONIC_DISPLAY_DESCRIPTION"; tonicDisplayItemDef.loreToken = "AIQUEODIO_TONIC_DISPLAY_LORE"; tonicDisplayItemDef.tier = (ItemTier)5; tonicDisplayItemDef.hidden = false; tonicDisplayItemDef.canRemove = false; tonicDisplayItemDef.tags = (ItemTag[])(object)new ItemTag[1] { (ItemTag)4 }; } private static Sprite LoadEmbeddedSprite(string fileName) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) try { string text = "AiqueOdio." + fileName; using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(text); if (stream == null) { Log.Error("[AiQueOdio] Recurso não encontrado: " + text); return null; } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); Texture2D val = new Texture2D(2, 2) { name = Path.GetFileNameWithoutExtension(fileName) }; if (!ImageConversion.LoadImage(val, memoryStream.ToArray())) { Object.Destroy((Object)(object)val); Log.Error("[AiQueOdio] Não foi possível decodificar " + fileName + "."); return null; } return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } catch (Exception ex) { Log.Error("[AiQueOdio] Erro ao carregar " + fileName + ": " + ex.Message); return null; } } private static void RegisterLanguageTokens() { LanguageAPI.Add("AIQUEODIO_NAME", "AI, QUE ÓDIO!!!"); LanguageAPI.Add("AIQUEODIO_DESCRIPTION", "ARTEFATO DA AUTORIDADE DEIXA O JOGO MUITO FÁCIL, AI QUE ÓDIO!!!<style=cStack>\n>Regeneração de Vida: <style=cIsHealth>-40%</style>\n>Escalonamento Base: <style=cIsHealth>+150%</style>\n>Artefatos Automáticos: <style=cIsUtility>Autoridade e Esmalte Pink</style>"); LanguageAPI.Add("ESMALTE_PINK_NAME", "Artefato do Esmalte Pink"); LanguageAPI.Add("ESMALTE_PINK_DESCRIPTION", "Monstros ganham <style=cIsDamage>1 item no primeiro segundo</style>; depois, a cada <style=cIsDamage>60s, 58s, 54s, 48s... (-2s adicionais por fase, mínimo 15s)</style>.\nEstágio 2: Itens Verdes ativados.\nEstágio 3: Itens Vermelhos ativados.\nEstágio 4: Itens de Chefe ativados.\nEstágio 5: Itens de Comida e Tônico Permanente.\nEstágio 6: Microrrobôs."); LanguageAPI.Add("AIQUEODIO_TONIC_DISPLAY_NAME", "Tônico Espinélio Permanente"); LanguageAPI.Add("AIQUEODIO_TONIC_DISPLAY_PICKUP", "Indicador visual do Tônico Espinélio permanente dos monstros."); LanguageAPI.Add("AIQUEODIO_TONIC_DISPLAY_DESCRIPTION", "A partir do estágio 5, todos os monstros recebem permanentemente o efeito do Tônico Espinélio."); LanguageAPI.Add("AIQUEODIO_TONIC_DISPLAY_LORE", "Este item existe apenas para representar o efeito permanente no painel dos monstros."); } private static string GetLocalizedStringByToken(orig_GetLocalizedStringByToken orig, Language self, string token) { if (IsAiqueOdioRun(Run.instance) && !string.IsNullOrEmpty(token) && token.StartsWith("PLAYER_DEATH_QUOTE_", StringComparison.Ordinal)) { int num = (token.GetHashCode() & 0x7FFFFFFF) % DeathQuotes.Length; return DeathQuotes[num]; } return orig.Invoke(self, token); } private static void OnRunSetRuleBookGlobal(Run run, RuleBook ruleBook) { if (IsAiqueOdioRun(run)) { Run.ambientLevelCap = int.MaxValue; } } private static void OnRunStartGlobal(Run run) { ClearMonsterItemVisuals(); monsterItemVisualSequence = 0; lastMonsterItemVisualSequence = 0; itemsGivenByTime = 0; lastItemGrantTime = 0f; nextItemGrantTime = 1f; tonicDisplayAdded = false; tonicBuffConfirmed = false; MonsterItemStacks.Clear(); difficultyDef.scalingValue = 4f; if (!NetworkServer.active || !IsAiqueOdioRun(run)) { return; } Log.Info("[AiQueOdio] Partida iniciada na dificuldade AI, QUE ÓDIO!!!"); RunArtifactManager val = RunArtifactManager.instance; if ((Object)(object)val == (Object)null) { Log.Error("[AiQueOdio] RunArtifactManager indisponível no início da partida."); return; } val.SetArtifactEnabledServer(esmaltePinkArtifactDef, true); val.SetArtifactEnabledServer(Artifacts.Command, true); if ((Object)(object)Equipment.Tonic != (Object)null) { tonicDisplayItemDef.pickupIconSprite = Equipment.Tonic.pickupIconSprite; } CreateMonsterItemDisplay(); } private static void OnRunDestroyGlobal(Run run) { ClearMonsterItemVisuals(); DestroyMonsterItemDisplay(); MonsterItemStacks.Clear(); tonicDisplayAdded = false; tonicBuffConfirmed = false; } private static void CreateMonsterItemDisplay() { DestroyMonsterItemDisplay(); GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/MonsterTeamGainsItemsArtifactInventory"); if ((Object)(object)val == (Object)null) { Log.Error("[AiQueOdio] Não foi possível carregar o painel de itens dos monstros."); return; } monsterItemDisplayObject = Object.Instantiate<GameObject>(val); monsterItemDisplayInventory = monsterItemDisplayObject.GetComponent<Inventory>(); monsterItemDisplayProvider = monsterItemDisplayObject.GetComponent<EnemyInfoPanelInventoryProvider>(); TeamFilter component = monsterItemDisplayObject.GetComponent<TeamFilter>(); if ((Object)(object)monsterItemDisplayInventory == (Object)null || (Object)(object)monsterItemDisplayProvider == (Object)null || (Object)(object)component == (Object)null) { Log.Error("[AiQueOdio] O painel de itens dos monstros está incompleto."); Object.Destroy((Object)(object)monsterItemDisplayObject); monsterItemDisplayObject = null; monsterItemDisplayInventory = null; monsterItemDisplayProvider = null; } else { component.teamIndex = (TeamIndex)2; monsterItemDisplayObject.SetActive(true); NetworkServer.Spawn(monsterItemDisplayObject); ((Behaviour)monsterItemDisplayProvider).enabled = false; ((Behaviour)monsterItemDisplayProvider).enabled = true; monsterItemDisplayProvider.Refresh(); Log.Info("[AiQueOdio] Painel de itens dos monstros preparado sem ativar a Evolução."); } } private static void DestroyMonsterItemDisplay() { if ((Object)(object)monsterItemDisplayObject != (Object)null) { if (NetworkServer.active) { NetworkServer.Destroy(monsterItemDisplayObject); } else { Object.Destroy((Object)(object)monsterItemDisplayObject); } } monsterItemDisplayObject = null; monsterItemDisplayInventory = null; monsterItemDisplayProvider = null; } private static void SuppressAutomaticEvolutionItems(orig_EnsureMonsterTeamItemCount orig, int itemCount) { if (!IsAiqueOdioRun(Run.instance) || IsArtifactEnabled(Artifacts.MonsterTeamGainsItems)) { orig.Invoke(itemCount); } } private static void FilterTonicDisplayOptionsServer(orig_SetOptionsServer orig, PickupPickerController self, Option[] options) { orig.Invoke(self, RemoveTonicDisplayOption(options)); } private static void FilterTonicDisplayOptionsInternal(orig_SetOptionsInternal orig, PickupPickerController self, Option[] options) { orig.Invoke(self, RemoveTonicDisplayOption(options)); } private static Option[] RemoveTonicDisplayOption(Option[] options) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (options == null || options.Length == 0 || (Object)(object)tonicDisplayItemDef == (Object)null || (int)tonicDisplayItemDef.itemIndex == -1) { return options; } List<Option> list = new List<Option>(options.Length); foreach (Option val in options) { PickupDef pickupDef = PickupCatalog.GetPickupDef(val.pickup.pickupIndex); if (pickupDef == null || pickupDef.itemIndex != tonicDisplayItemDef.itemIndex) { list.Add(val); } } if (list.Count != options.Length) { return list.ToArray(); } return options; } private static void OnSpawnedServerGlobal(SpawnResult spawnResult) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) if (!IsAiqueOdioRun(Run.instance) || (Object)(object)spawnResult.spawnedInstance == (Object)null) { return; } if ((Object)(object)spawnResult.spawnRequest?.spawnCard != (Object)null && LegendaryDroneShopSpawnCards.Contains(spawnResult.spawnRequest.spawnCard) && (Object)(object)spawnResult.spawnedInstance.GetComponent<DroneVendorMultiShopController>() != (Object)null) { spawnResult.spawnedInstance.AddComponent<LegendaryDroneShop>().choices = GetEligibleLegendaryDroneChoices(); } if (IsArtifactEnabled(Artifacts.MonsterTeamGainsItems)) { return; } CharacterMaster component = spawnResult.spawnedInstance.GetComponent<CharacterMaster>(); if (!((Object)(object)component != (Object)null) || (int)component.teamIndex != 2 || !((Object)(object)component.inventory != (Object)null)) { return; } foreach (KeyValuePair<ItemIndex, int> monsterItemStack in MonsterItemStacks) { component.inventory.GiveItemPermanent(monsterItemStack.Key, monsterItemStack.Value); } } private static void ModifyCommandInteractables(orig_OnGenerateInteractableCardSelection orig, SceneDirector sceneDirector, DirectorCardCategorySelection selection) { orig.Invoke(sceneDirector, selection); if (IsAiqueOdioRun(Run.instance) && selection?.categories != null) { ReplaceRepairableDronesWithShops(selection); EnsureScrapper(selection); } } private static void ReplaceRepairableDronesWithShops(DirectorCardCategorySelection selection) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Invalid comparison between Unknown and I4 if (tripleDroneShopSpawnCard == null) { tripleDroneShopSpawnCard = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/DLC3/TripleDroneShop/iscTripleDroneShop.asset").WaitForCompletion(); } if ((Object)(object)tripleDroneShopSpawnCard == (Object)null || !new DirectorCard { spawnCard = (SpawnCard)(object)tripleDroneShopSpawnCard }.IsAvailable()) { Log.Warning("[AiQueOdio] A loja de drones não está disponível nesta partida; os drones quebrados foram preservados."); return; } int num = 0; bool flag = GetEligibleLegendaryDroneChoices().Count > 0; for (int i = 0; i < selection.categories.Length; i++) { Category val = selection.categories[i]; if (val.cards == null) { continue; } DirectorCard[] array = (DirectorCard[])(object)new DirectorCard[val.cards.Length]; bool flag2 = false; for (int j = 0; j < val.cards.Length; j++) { DirectorCard val2 = val.cards[j]; SpawnCard val3 = ((val2 != null) ? val2.GetSpawnCard() : null); DroneDef val4 = FindConvertibleDrone(val3); bool flag3 = (Object)(object)val4 != (Object)null && (int)val4.tier == 2; if ((Object)(object)val4 == (Object)null || !val2.IsAvailable() || (flag3 && (!flag || !(val3 is InteractableSpawnCard)))) { array[j] = val2; continue; } InteractableSpawnCard orCreateDroneShopSpawnCard = GetOrCreateDroneShopSpawnCard(val3, flag3); array[j] = CloneDirectorCard(val2, (SpawnCard)(object)orCreateDroneShopSpawnCard); flag2 = true; num++; } if (flag2) { val.cards = array; selection.categories[i] = val; } } Log.Info($"[AiQueOdio] {num} carta(s) de drone quebrado convertida(s) " + "em lojas com uma escolha de cada drone elegível."); } private static DroneDef FindConvertibleDrone(SpawnCard spawnCard) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Invalid comparison between Unknown and I4 //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 if ((Object)(object)spawnCard == (Object)null) { return null; } foreach (DroneDef allDroneDef in DroneCatalog.allDroneDefs) { if ((Object)(object)allDroneDef != (Object)null && !IsStationaryTurret(allDroneDef) && ((allDroneDef.canCombine && ((int)allDroneDef.tier == 0 || (int)allDroneDef.tier == 1)) || ((int)allDroneDef.tier == 2 && (Object)(object)GetDroneRepairPurchase(allDroneDef) != (Object)null)) && (Object)(object)allDroneDef.droneBrokenSpawnCard == (Object)(object)spawnCard) { return allDroneDef; } } return null; } private static InteractableSpawnCard GetOrCreateDroneShopSpawnCard(SpawnCard originalSpawnCard, bool legendary) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (DroneShopSpawnCards.TryGetValue(originalSpawnCard, out var value)) { return value; } value = Object.Instantiate<InteractableSpawnCard>((InteractableSpawnCard)((!legendary) ? ((object)tripleDroneShopSpawnCard) : ((object)(InteractableSpawnCard)originalSpawnCard))); ((SpawnCard)value).prefab = ((SpawnCard)tripleDroneShopSpawnCard).prefab; ((Object)value).name = "iscAiQueOdioDroneShop_" + ((Object)originalSpawnCard).name; ((SpawnCard)value).directorCreditCost = originalSpawnCard.directorCreditCost; InteractableSpawnCard val = (InteractableSpawnCard)(object)((originalSpawnCard is InteractableSpawnCard) ? originalSpawnCard : null); if (val != null) { value.maxSpawnsPerStage = val.maxSpawnsPerStage; } DroneShopSpawnCards.Add(originalSpawnCard, value); if (legendary) { LegendaryDroneShopSpawnCards.Add((SpawnCard)(object)value); } return value; } private static DirectorCard CloneDirectorCard(DirectorCard original, SpawnCard replacementSpawnCard) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown return new DirectorCard { spawnCard = replacementSpawnCard, selectionWeight = original.selectionWeight, spawnDistance = original.spawnDistance, preventOverhead = original.preventOverhead, minimumStageCompletions = original.minimumStageCompletions, requiredUnlockableDef = original.requiredUnlockableDef, forbiddenUnlockableDef = original.forbiddenUnlockableDef }; } private static void EnsureScrapper(DirectorCardCategorySelection selection) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) int num = -1; for (int i = 0; i < selection.categories.Length; i++) { Category val = selection.categories[i]; if (string.Equals(val.name, "Misc", StringComparison.Ordinal)) { num = i; } if (val.cards == null) { continue; } DirectorCard[] cards = val.cards; foreach (DirectorCard val2 in cards) { if ((Object)(object)val2.spawnCard != (Object)null && ((Object)val2.spawnCard).name == "iscScrapper") { return; } } } if (num >= 0) { if (scrapperSpawnCard == null) { scrapperSpawnCard = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/Scrapper/iscScrapper.asset").WaitForCompletion(); } if ((Object)(object)scrapperSpawnCard == (Object)null) { Log.Warning("[AiQueOdio] Não foi possível carregar a Sucatadora."); return; } DirectorCard item = new DirectorCard { spawnCard = (SpawnCard)(object)scrapperSpawnCard, selectionWeight = 1, spawnDistance = (MonsterSpawnDistance)0, preventOverhead = false, minimumStageCompletions = 0 }; Category val3 = selection.categories[num]; List<DirectorCard> list = new List<DirectorCard>(val3.cards ?? Array.Empty<DirectorCard>()) { item }; val3.cards = list.ToArray(); selection.categories[num] = val3; } } private static void ConfigureDroneShop(orig_Start orig, DroneVendorMultiShopController self) { orig.Invoke(self); if (!NetworkServer.active || !IsAiqueOdioRun(Run.instance)) { return; } if (self.doCloseOnTerminalPurchase != null) { for (int i = 0; i < self.doCloseOnTerminalPurchase.Length; i++) { self.doCloseOnTerminalPurchase[i] = true; } } if ((Object)(object)((Component)self).GetComponent<LegendaryDroneShop>() != (Object)null) { ConfigureLegendaryDronePrices(self); } DroneVendorTerminalBehavior[] terminals = self._terminals; Log.Info("[AiQueOdio] Loja de drones preparada com " + $"{((terminals != null) ? terminals.Length : 0)} escolha(s) única(s)."); } private static void ExpandDroneShop(orig_CreateTerminals orig, DroneVendorMultiShopController shop) { //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_00f7: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Invalid comparison between Unknown and I4 //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !IsAiqueOdioRun(Run.instance)) { orig.Invoke(shop); return; } LegendaryDroneShop component = ((Component)shop).GetComponent<LegendaryDroneShop>(); ItemTier val = (ItemTier)(((Object)(object)component != (Object)null) ? 2 : ((int)SelectDroneShopTier(shop))); List<DroneIndex> list = (((Object)(object)component != (Object)null) ? component.choices : GetEligibleDroneChoices(shop, val)); if ((int)val == 1 && list != null && list.Count == 0) { val = (ItemTier)0; list = GetEligibleDroneChoices(shop, val); } if (list == null || list.Count == 0 || shop.terminalPositions == null || shop.terminalPositions.Length == 0) { Log.Warning("[AiQueOdio] A loja não pôde ser ampliada; usando o comportamento padrão."); orig.Invoke(shop); return; } RangeFloat tier1Chance = shop.tier1Chance; RangeFloat tier2Chance = shop.tier2Chance; RangeFloat tier3Chance = shop.tier3Chance; ExplicitPickupDropTable excludedDronesDropTable = shop.excludedDronesDropTable; shop.terminalPositions = CreateDroneTerminalPositions(shop, list.Count); SetFixedDroneShopTier(shop, val); if ((Object)(object)component != (Object)null) { shop.excludedDronesDropTable = null; } try { orig.Invoke(shop); } finally { shop.tier1Chance = tier1Chance; shop.tier2Chance = tier2Chance; shop.tier3Chance = tier3Chance; shop.excludedDronesDropTable = excludedDronesDropTable; } AssignEveryDroneOnce(shop, list); } private static PurchaseInteraction GetDroneRepairPurchase(DroneDef droneDef) { GameObject val = droneDef?.droneBrokenSpawnCard?.prefab; if (!((Object)(object)val != (Object)null)) { return null; } return val.GetComponent<PurchaseInteraction>(); } private static List<DroneIndex> GetEligibleLegendaryDroneChoices() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) List<DroneIndex> list = new List<DroneIndex>(); Run val = Run.instance; if ((Object)(object)val == (Object)null) { return list; } foreach (DroneDef allDroneDef in DroneCatalog.allDroneDefs) { if (!((Object)(object)allDroneDef == (Object)null) && (int)allDroneDef.tier == 2 && !((Object)(object)allDroneDef.bodyPrefab == (Object)null) && val.IsDroneAvailable(allDroneDef.droneIndex) && !list.Contains(allDroneDef.droneIndex)) { PurchaseInteraction droneRepairPurchase = GetDroneRepairPurchase(allDroneDef); ExpansionDef requiredExpansion = allDroneDef.GetRequiredExpansion(); if (!((Object)(object)droneRepairPurchase == (Object)null) && (!((Object)(object)allDroneDef.requiredExpansion != (Object)null) || val.IsExpansionEnabled(allDroneDef.requiredExpansion)) && (!((Object)(object)requiredExpansion != (Object)null) || val.IsExpansionEnabled(requiredExpansion)) && (!((Object)(object)droneRepairPurchase.requiredExpansion != (Object)null) || val.IsExpansionEnabled(droneRepairPurchase.requiredExpansion))) { list.Add(allDroneDef.droneIndex); } } } return list; } private static void ConfigureLegendaryDronePrices(DroneVendorMultiShopController shop) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Invalid comparison between Unknown and I4 //IL_00f3: Unknown result type (might be due to invalid IL or missing references) shop.Networkcost = -1; if (shop._terminals == null) { return; } DroneVendorTerminalBehavior[] terminals = shop._terminals; foreach (DroneVendorTerminalBehavior obj in terminals) { PickupDef pickupDef = PickupCatalog.GetPickupDef(obj.CurrentPickupIndex); DroneDef val = ((pickupDef != null) ? DroneCatalog.GetDroneDef(pickupDef.droneIndex) : null); PurchaseInteraction droneRepairPurchase = GetDroneRepairPurchase(val); PurchaseInteraction purchaseInteraction = obj.purchaseInteraction; if ((Object)(object)droneRepairPurchase == (Object)null || (Object)(object)purchaseInteraction == (Object)null) { if ((Object)(object)purchaseInteraction != (Object)null) { purchaseInteraction.Networkavailable = false; } Log.Warning("[AiQueOdio] Opção lendária desativada: preço de reparo indisponível."); } else { purchaseInteraction.NetworkcostType = droneRepairPurchase.costType; bool flag = (int)droneRepairPurchase.costType == 1 || droneRepairPurchase.automaticallyScaleCostWithDifficulty; purchaseInteraction.Networkcost = (flag ? Run.instance.GetDifficultyScaledCost(droneRepairPurchase.cost) : droneRepairPurchase.cost); purchaseInteraction.solitudeCost = purchaseInteraction.cost; Log.Info($"[AiQueOdio] Loja lendária: {((Object)val).name}, preço {purchaseInteraction.cost} ({purchaseInteraction.costType})."); } } } private static bool ShouldDisplayDroneShopPrice(orig_ShouldDisplayHologram orig, DroneVendorMultiShopController shop, GameObject viewer) { if (!IsAiqueOdioRun(Run.instance) || shop.cost != -1) { return orig.Invoke(shop, viewer); } return false; } private static ItemTier SelectDroneShopTier(DroneVendorMultiShopController shop) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (Run.instance.stageClearCount >= 3) { float num = EvaluateDroneTierChance(shop.tier1Chance); float num2 = EvaluateDroneTierChance(shop.tier2Chance); float num3 = num + num2; if (!(num3 <= 0f)) { if (shop.rng.nextNormalizedFloat * num3 < num) { return (ItemTier)0; } return (ItemTier)1; } return (ItemTier)0; } return (ItemTier)0; } private static float EvaluateDroneTierChance(RangeFloat chance) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp(Run.instance.difficultyCoefficient, 0f, 10f); return chance.min + num / 10f * (chance.max - chance.min); } private static List<DroneIndex> GetEligibleDroneChoices(DroneVendorMultiShopController shop, ItemTier tier) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) List<DroneIndex> obj = (((int)tier == 1) ? Run.instance.availableTier2DroneList : Run.instance.availableTier1DroneList); List<DroneIndex> list = new List<DroneIndex>(obj.Count); foreach (DroneIndex item in obj) { DroneDef droneDef = DroneCatalog.GetDroneDef(item); if (!list.Contains(item) && !IsStationaryTurret(droneDef) && !IsDroneExcluded(shop, item)) { list.Add(item); } } return list; } private static bool IsStationaryTurret(DroneDef droneDef) { if ((Object)(object)droneDef != (Object)null) { if (!ContainsAny(((Object)droneDef).name, StationaryTurretNames)) { GameObject bodyPrefab = droneDef.bodyPrefab; if (!ContainsAny((bodyPrefab != null) ? ((Object)bodyPrefab).name : null, StationaryTurretNames)) { SpawnCard droneBrokenSpawnCard = droneDef.droneBrokenSpawnCard; return ContainsAny((droneBrokenSpawnCard != null) ? ((Object)droneBrokenSpawnCard).name : null, StationaryTurretNames); } } return true; } return false; } private static void SetFixedDroneShopTier(DroneVendorMultiShopController shop, ItemTier selectedTier) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) shop.tier1Chance = CreateFixedRange(((int)selectedTier == 0) ? 1f : 0f); shop.tier2Chance = CreateFixedRange(((int)selectedTier == 1) ? 1f : 0f); shop.tier3Chance = CreateFixedRange(((int)selectedTier == 2) ? 1f : 0f); } private static RangeFloat CreateFixedRange(float value) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) return new RangeFloat { min = value, max = value }; } private static Transform[] CreateDroneTerminalPositions(DroneVendorMultiShopController shop, int terminalCount) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Expected O, but got Unknown //IL_01c2: 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) Transform[] terminalPositions = shop.terminalPositions; Transform[] array = (Transform[])(object)new Transform[terminalCount]; if (terminalCount <= terminalPositions.Length) { if (terminalCount == 1) { array[0] = terminalPositions[terminalPositions.Length / 2]; return array; } for (int i = 0; i < terminalCount; i++) { int num = Mathf.RoundToInt((float)i * ((float)terminalPositions.Length - 1f) / ((float)terminalCount - 1f)); array[i] = terminalPositions[num]; } return array; } Array.Copy(terminalPositions, array, terminalPositions.Length); Vector3 val = Vector3.zero; Transform[] array2 = terminalPositions; foreach (Transform val2 in array2) { val += val2.position; } val /= (float)terminalPositions.Length; Vector3 val3 = ((terminalPositions.Length > 1) ? (terminalPositions[^1].position - terminalPositions[0].position) : ((Component)shop).transform.right); val3.y = 0f; if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val3 = ((Component)shop).transform.right; } ((Vector3)(ref val3)).Normalize(); float num2 = ((terminalPositions.Length > 1) ? (Vector3.Distance(terminalPositions[0].position, terminalPositions[^1].position) / (float)(terminalPositions.Length - 1)) : 1.25f); num2 = Mathf.Max(num2, 1.25f); int num3 = terminalCount - terminalPositions.Length; float num4 = num2 * (float)(terminalPositions.Length - 1) * 0.5f; Quaternion rotation = terminalPositions[terminalPositions.Length / 2].rotation; for (int k = 0; k < num3; k++) { int num5 = k / 2 + 1; float num6 = ((k % 2 == 0) ? 1f : (-1f)); Vector3 position = val + val3 * num6 * (num4 + num2 * (float)num5); GameObject val4 = new GameObject($"AiQueOdioDroneTerminalPosition{k + 1}"); val4.transform.position = position; val4.transform.rotation = rotation; val4.transform.SetParent(((Component)shop).transform, true); array[terminalPositions.Length + k] = val4.transform; } return array; } private static void AssignEveryDroneOnce(DroneVendorMultiShopController shop, List<DroneIndex> candidates) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (shop._terminals == null || shop._terminals.Length != candidates.Count) { Log.Warning("[AiQueOdio] A quantidade de terminais não corresponde às opções de drones."); return; } List<DroneIndex> list = new List<DroneIndex>(candidates); DroneVendorTerminalBehavior[] terminals = shop._terminals; UniquePickup val2 = default(UniquePickup); foreach (DroneVendorTerminalBehavior obj in terminals) { DroneIndex val = shop.rng.NextElementUniform<DroneIndex>(list); list.Remove(val); ((UniquePickup)(ref val2))..ctor(PickupCatalog.FindPickupIndex(val)); val2.upgradeValue = shop.droneUpgradeCount; UniquePickup val3 = val2; obj.SetPickup(val3, false); } } private static bool IsDroneExcluded(DroneVendorMultiShopController shop, DroneIndex droneIndex) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (shop.excludedDronesDropTable?.pickupEntries == null) { return false; } PickupDefEntry[] pickupEntries = shop.excludedDronesDropTable.pickupEntries; for (int i = 0; i < pickupEntries.Length; i++) { Object pickupDef = pickupEntries[i].pickupDef; DroneDef val = (DroneDef)(object)((pickupDef is DroneDef) ? pickupDef : null); if (val != null && val.droneIndex == droneIndex) { return true; } } return false; } private static void KeepDroneShopSinglePurchase(orig_SetCloseOnTerminalPurchase orig, DroneVendorMultiShopController self, PurchaseInteraction purchaseInteraction, bool closeOnPurchase) { orig.Invoke(self, purchaseInteraction, IsAiqueOdioRun(Run.instance) || closeOnPurchase); } private static void OnStageStartGlobal(Stage stage) { if (!NetworkServer.active || !IsAiqueOdioRun(Run.instance)) { return; } string text = (((Object)(object)stage.sceneDef != (Object)null) ? stage.sceneDef.baseSceneName : string.Empty); if (!string.Equals(text, "bazaar", StringComparison.Ordinal)) { int num = Run.instance.stageClearCount + 1; if (num >= 5) { EnsurePermanentTonicOnExistingMonsters(); AddTonicDisplayItems(); } if (num == 6 || text.StartsWith("moon", StringComparison.OrdinalIgnoreCase)) { GiveSpecificItemToMonsters(Items.CaptainDefenseMatrix, 1); Broadcast("<color=#ff0000>ALERTA DE ODIO: Os monstros instalaram Microrrobôs Defensivos!</color>"); } } } private static void OnBodyStartGlobal(CharacterBody body) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 if (NetworkServer.active && IsAiqueOdioRun(Run.instance) && !((Object)(object)body.teamComponent == (Object)null) && (int)body.teamComponent.teamIndex == 2 && Run.instance.stageClearCount + 1 >= 5) { EnsurePermanentTonic(body); } } private static void EnsurePermanentTonicOnExistingMonsters() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { if ((Object)(object)readOnlyInstances != (Object)null && (int)readOnlyInstances.teamIndex == 2) { EnsurePermanentTonic(readOnlyInstances.GetBody()); } } } private static void EnsurePermanentTonic(CharacterBody body) { if (!((Object)(object)body == (Object)null) && !body.HasBuff(Buffs.TonicBuff)) { body.AddBuff(Buffs.TonicBuff); if (!tonicBuffConfirmed && body.HasBuff(Buffs.TonicBuff)) { tonicBuffConfirmed = true; Log.Info("[AiQueOdio] Verificação concluída: o Tônico permanente está ativo nos monstros."); } } } private static void AddTonicDisplayItems() { if (!tonicDisplayAdded) { tonicDisplayAdded = true; AddDisplayOnlyItem(tonicDisplayItemDef, 1); AddDisplayOnlyItem(Items.AutoCastEquipment, 4); RefreshMonsterItemDisplay(); Broadcast("<color=#ff0000>ALERTA DE ODIO: os monstros ativaram o combo permanente de Tônico Espinélio + 4 Gestos dos Afogados!</color>"); Log.Info($"[AiQueOdio] Painel da fase {5} atualizado com 1 Tônico e 4 Gestos " + "(somente indicadores visuais)."); } } private static void AddDisplayOnlyItem(ItemDef itemDef, int count) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)monsterItemDisplayInventory == (Object)null) && !((Object)(object)itemDef == (Object)null) && count > 0) { monsterItemDisplayInventory.GiveItemPermanent(itemDef.itemIndex, count); } } private static void OnFixedUpdate() { Run val = Run.instance; if (!NetworkServer.active || (Object)(object)val == (Object)null || !IsArtifactEnabled(esmaltePinkArtifactDef)) { return; } float runStopwatch = val.GetRunStopwatch(); float monsterItemInterval = GetMonsterItemInterval(val); if (itemsGivenByTime > 0) { nextItemGrantTime = lastItemGrantTime + monsterItemInterval; } int num = 0; while (runStopwatch >= nextItemGrantTime) { num++; itemsGivenByTime++; if (itemsGivenByTime == 1) { lastItemGrantTime = 0f; } else { lastItemGrantTime = nextItemGrantTime; } monsterItemInterval = GetMonsterItemInterval(val); nextItemGrantTime = lastItemGrantTime + monsterItemInterval; } if (num > 0) { GiveRandomItemToMonsters(val, num); } } private static float GetMonsterItemInterval(Run run) { int num = run.stageClearCount + 1; int num2 = Mathf.Max(0, num - 1); float num3 = (float)(num2 * (num2 + 1)) * 2f * 0.5f; return Mathf.Max(15f, 60f - num3); } private static void GiveSpecificItemToMonsters(ItemDef itemDef, int count) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Run.instance != (Object)null && (Object)(object)itemDef != (Object)null) { GiveItemToMonsterTeam(itemDef.itemIndex, count); } } private static void GiveRandomItemToMonsters(Run run, int count) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Invalid comparison between Unknown and I4 //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) List<PickupIndex> validMonsterItems = GetValidMonsterItems(run); if (validMonsterItems.Count == 0) { Log.Warning("[AiQueOdio] Nenhum item válido estava disponível."); return; } PickupDef val = null; for (int i = 0; i < count; i++) { PickupDef pickupDef = PickupCatalog.GetPickupDef(run.treasureRng.NextElementUniform<PickupIndex>(validMonsterItems)); if (pickupDef != null && (int)pickupDef.itemIndex != -1) { GiveItemToMonsterTeam(pickupDef.itemIndex, 1, updateDisplayImmediately: false); AnnounceMonsterItemVisual(pickupDef.itemIndex); val = pickupDef; } } if (val == null) { return; } string text = Language.GetString(val.nameToken); string text2 = "#" + ColorUtility.ToHtmlStringRGB(val.baseColor); Broadcast(string.Format(ChatMessages[Random.Range(0, ChatMessages.Length)], "<color=" + text2 + ">" + text + "</color>")); PlayPitiLocal(); try { NetMessageExtensions.Send((INetMessage)(object)default(PlayPitiMessage), (NetworkDestination)1); } catch (Exception ex) { Log.Error("[AiQueOdio] Falha ao enviar o áudio aos Clients: " + ex); } } private static List<PickupIndex> GetValidMonsterItems(Run run) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0084: Invalid comparison between Unknown and I4 //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) List<PickupIndex> list = new List<PickupIndex>(run.availableTier1DropList); int num = run.stageClearCount + 1; if (num >= 2) { list.AddRange(run.availableTier2DropList); } if (num >= 3) { list.AddRange(run.availableTier3DropList); } if (num >= 4) { list.AddRange(run.availableBossDropList); } if (num >= 5) { list.AddRange(run.availableFoodTierDropList); } List<PickupIndex> list2 = new List<PickupIndex>(list.Count); foreach (PickupIndex item in list) { PickupDef pickupDef = PickupCatalog.GetPickupDef(item); if (IsAllowedMonsterItem((pickupDef != null && (int)pickupDef.itemIndex != -1) ? ItemCatalog.GetItemDef(pickupDef.itemIndex) : null)) { list2.Add(item); } } return list2; } private static bool IsAllowedMonsterItem(ItemDef item) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected I4, but got Unknown if ((Object)(object)item == (Object)null || (Object)(object)item == (Object)(object)tonicDisplayItemDef) { return false; } if ((int)item.tier == 10) { return true; } if (item.tags != null && Array.Exists(item.tags, (ItemTag tag) => (int)tag == 4 || (int)tag == 10)) { return false; } ItemTier tier = item.tier; return (int)tier switch { 0 => !ContainsAny(((Object)item).name, BlockedWhiteItemNames), 1 => !ContainsAny(((Object)item).name, BlockedGreenItemNames), 2 => !ContainsAny(((Object)item).name, BlockedRedItemNames), 4 => ContainsAny(((Object)item).name, AllowedBossItemNames), _ => true, }; } private static bool ContainsAny(string value, string[] fragments) { if (string.IsNullOrEmpty(value)) { return false; } foreach (string value2 in fragments) { if (value.IndexOf(value2, StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } return false; } private static void GiveItemToMonsterTeam(ItemIndex itemIndex, int count, bool updateDisplayImmediately = true) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Invalid comparison between Unknown and I4 //IL_00ac: Unknown result type (might be due to invalid IL or missing references) if ((int)itemIndex == -1 || count <= 0) { return; } if ((Object)(object)tonicDisplayItemDef != (Object)null && itemIndex == tonicDisplayItemDef.itemIndex) { Log.Warning("[AiQueOdio] Uma tentativa de entregar o marcador visual do Tônico foi bloqueada."); return; } MonsterItemStacks.TryGetValue(itemIndex, out var value); MonsterItemStacks[itemIndex] = value + count; if (updateDisplayImmediately) { AddItemToMonsterDisplay(itemIndex, count); } else if ((Object)(object)instance != (Object)null) { ((MonoBehaviour)instance).StartCoroutine(AddItemToMonsterDisplayAfterVisual(itemIndex, count, Run.instance)); } foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { if ((Object)(object)readOnlyInstances != (Object)null && (int)readOnlyInstances.teamIndex == 2) { Inventory inventory = readOnlyInstances.inventory; if (inventory != null) { inventory.GiveItemPermanent(itemIndex, count); } } } } private static IEnumerator AddItemToMonsterDisplayAfterVisual(ItemIndex itemIndex, int count, Run originatingRun) { //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) float delay = 4.85f; while (delay > 0f) { if ((Object)(object)Run.instance != (Object)(object)originatingRun) { yield break; } delay -= Time.unscaledDeltaTime; yield return null; } AddItemToMonsterDisplay(itemIndex, count); } private static void AddItemToMonsterDisplay(ItemIndex itemIndex, int count) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)monsterItemDisplayInventory == (Object)null) { Log.Warning("[AiQueOdio] O painel não recebeu o item porque seu inventário não existe."); return; } monsterItemDisplayInventory.GiveItemPermanent(itemIndex, count); RefreshMonsterItemDisplay(); } private static void AnnounceMonsterItemVisual(ItemIndex itemIndex) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) int sequence = ++monsterItemVisualSequence; ShowMonsterItemLocal(itemIndex, sequence); try { NetMessageExtensions.Send((INetMessage)(object)new ShowMonsterItemMessage(itemIndex, sequence), (NetworkDestination)1); } catch (Exception ex) { Log.Error("[AiQueOdio] Falha ao enviar a animação do item aos Clients: " + ex); } } internal static void ShowMonsterItemLocal(ItemIndex itemIndex, int sequence) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (sequence > lastMonsterItemVisualSequence && IsAiqueOdioRun(Run.instance) && !((Object)(object)ItemCatalog.GetItemDef(itemIndex) == (Object)null)) { lastMonsterItemVisualSequence = sequence; MonsterItemVisualQueue.Enqueue(itemIndex); if ((Object)(object)instance != (Object)null && monsterItemVisualCoroutine == null) { monsterItemVisualCoroutine = ((MonoBehaviour)instance).StartCoroutine(ProcessMonsterItemVisuals()); } } } private static IEnumerator ProcessMonsterItemVisuals() { while (MonsterItemVisualQueue.Count > 0) { ItemIndex itemIndex = MonsterItemVisualQueue.Dequeue(); yield return ShowMonsterItemVisual(itemIndex); } monsterItemVisualCoroutine = null; } private static IEnumerator ShowMonsterItemVisual(ItemIndex itemIndex) { //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) ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); if (!((Object)(object)itemDef == (Object)null) && !((Object)(object)itemDef.pickupIconSprite == (Object)null)) { GameObject canvasObject = (monsterItemVisualCanvas = new GameObject("AiQueOdioMonsterItemVisual", new Type[4] { typeof(RectTransform), typeof(Canvas), typeof(CanvasScaler), typeof(CanvasGroup) })); Canvas component = canvasObject.GetComponent<Canvas>(); component.renderMode = (RenderMode)0; component.overrideSorting = true; component.sortingOrder = 32767; CanvasScaler component2 = canvasObject.GetComponent<CanvasScaler>(); component2.uiScaleMode = (ScaleMode)1; component2.referenceResolution = new Vector2(1920f, 1080f); component2.matchWidthOrHeight = 0.5f; CanvasGroup canvasGroup = canvasObject.GetComponent<CanvasGroup>(); canvasGroup.alpha = 0f; canvasGroup.interactable = false; canvasGroup.blocksRaycasts = false; GameObject val = new GameObject("Item", new Type[2] { typeof(RectTransform), typeof(Image) }); val.transform.SetParent(canvasObject.transform, false); RectTransform iconRoot = val.GetComponent<RectTransform>(); iconRoot.anchorMin = new Vector2(0.5f, 0.5f); iconRoot.anchorMax = new Vector2(0.5f, 0.5f); iconRoot.pivot = new Vector2(0.5f, 0.5f); iconRoot.sizeDelta = new Vector2(84.375f, 84.375f); Image component3 = val.GetComponent<Image>(); ((Graphic)component3).color = new Color(0.025f, 0.025f, 0.035f, 0.92f); ((Graphic)component3).raycastTarget = false; Outline outline = val.AddComponent<Outline>(); ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef(itemDef.tier); Color itemColor = (((Object)(object)itemTierDef != (Object)null) ? Color32.op_Implicit(ColorCatalog.GetColor(itemTierDef.colorIndex)) : Color.white); ((Shadow)outline).effectColor = new Color(itemColor.r, itemColor.g, itemColor.b, 0.95f); ((Shadow)outline).effectDistance = new Vector2(3f, -3f); ((Shadow)outline).useGraphicAlpha = true; GameObject val2 = new GameObject("Icon", new Type[2] { typeof(RectTransform), typeof(Image) }); val2.transform.SetParent((Transform)(object)iconRoot, false); RectTransform component4 = val2.GetComponent<RectTransform>(); component4.anchorMin = new Vector2(0.5f, 0.5f); component4.anchorMax = new Vector2(0.5f, 0.5f); component4.sizeDelta = new Vector2(70.875f, 70.875f); Image component5 = val2.GetComponent<Image>(); component5.sprite = itemDef.pickupIconSprite; component5.preserveAspect = true; ((Graphic)component5).raycastTarget = false; yield return null; RectTransform canvasRect = canvasObject.GetComponent<RectTransform>(); Rect rect = canvasRect.rect; Vector2 showcasePosition = (iconRoot.anchoredPosition = new Vector2(0f, ((Rect)(ref rect)).height * 0.33f)); ((Transform)iconRoot).localScale = Vector3.one * 0.7f; float elapsed = 0f; while (elapsed < 0.35f) { elapsed += Time.unscaledDeltaTime; float num = Mathf.Clamp01(elapsed / 0.35f); float num2 = (canvasGroup.alpha = 1f - Mathf.Pow(1f - num, 3f)); ((Transform)iconRoot).localScale = Vector3.one * Mathf.Lerp(0.7f, 1f, num2); yield return null; } elapsed = 0.35f; while (elapsed < 4f) { elapsed += Time.unscaledDeltaTime; SetSquarePulse(iconRoot, outline, itemColor, elapsed); yield return null; } Vector2 targetPosition = FindMonsterItemPanelPosition(canvasRect); elapsed = 0f; while (elapsed < 0.85f) { elapsed += Time.unscaledDeltaTime; float num4 = Mathf.Clamp01(elapsed / 0.85f); float num5 = num4 * num4 * (3f - 2f * num4); iconRoot.anchoredPosition = Vector2.Lerp(showcasePosition, targetPosition, num5); ((Transform)iconRoot).localScale = Vector3.one * Mathf.Lerp(1f, 0.28f, num5); canvasGroup.alpha = Mathf.Lerp(1f, 0.35f, num5); yield return null; } Object.Destroy((Object)(object)canvasObject); if ((Object)(object)monsterItemVisualCanvas == (Object)(object)canvasObject) { monsterItemVisualCanvas = null; } } } private static void SetSquarePulse(RectTransform iconRoot, Outline outline, Color itemColor, float time) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) float num = 0.5f + 0.5f * Mathf.Sin(time * 7f); ((Transform)iconRoot).localScale = Vector3.one * (1f + 0.055f * num); ((Shadow)outline).effectColor = new Color(itemColor.r, itemColor.g, itemColor.b, Mathf.Lerp(0.65f, 1f, num)); } private static Vector2 FindMonsterItemPanelPosition(RectTransform canvasRect) { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) ItemInventoryDisplay[] array = Object.FindObjectsOfType<ItemInventoryDisplay>(); Vector2 result = default(Vector2); foreach (ItemInventoryDisplay val in array) { if (!((Object)(object)val == (Object)null) && ((Component)val).gameObject.activeInHierarchy && !((Object)(object)((Component)val).GetComponentInParent<EnemyInfoPanel>() == (Object)null)) { Transform transform = ((Component)val).transform; RectTransform val2 = (RectTransform)(object)((transform is RectTransform) ? transform : null); Canvas componentInParent = ((Component)val).GetComponentInParent<Canvas>(); Vector2 val3 = RectTransformUtility.WorldToScreenPoint(((Object)(object)componentInParent != (Object)null && (int)componentInParent.renderMode != 0) ? componentInParent.worldCamera : null, ((Transform)val2).position); if (RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasRect, val3, (Camera)null, ref result)) { return result; } } } Rect rect = canvasRect.rect; float num = ((Rect)(ref rect)).width * 0.38f; rect = canvasRect.rect; return new Vector2(num, ((Rect)(ref rect)).height * 0.18f); } private static void ClearMonsterItemVisuals() { MonsterItemVisualQueue.Clear(); if (monsterItemVisualCoroutine != null && (Object)(object)instance != (Object)null) { ((MonoBehaviour)instance).StopCoroutine(monsterItemVisualCoroutine); } monsterItemVisualCoroutine = null; if ((Object)(object)monsterItemVisualCanvas != (Object)null) { Object.Destroy((Object)(object)monsterItemVisualCanvas); monsterItemVisualCanvas = null; } } private static void RefreshMonsterItemDisplay() { EnemyInfoPanelInventoryProvider obj = monsterItemDisplayProvider; if (obj != null) { obj.Refresh(); } EnemyInfoPanel.RefreshAll(); } private static bool IsAiqueOdioRun(Run run) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)run != (Object)null) { return run.selectedDifficulty == difficultyIndex; } return false; } private static bool IsArtifactEnabled(ArtifactDef artifact) { if ((Object)(object)artifact != (Object)null && (Object)(object)RunArtifactManager.instance != (Object)null) { return RunArtifactManager.instance.IsArtifactEnabled(artifact); } return false; } private static void Broadcast(string message) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = message }); } } internal static class Log { private static ManualLogSource source; internal static void Init(ManualLogSource logSource) { source = logSource; } internal static void Info(object data) { source.LogInfo(data); } internal static void Warning(object data) { source.LogWarning(data); } internal static void Error(object data) { source.LogError(data); } } }