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.1.0
AiqueOdio.dll
Decompiled 2 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using On.RoR2; using R2API; using RoR2; using RoR2.Artifacts; using UnityEngine; using UnityEngine.Networking; [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.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+7ee586d7309c338e864996c3039cc0e50bc909ad")] [assembly: AssemblyProduct("AiqueOdio")] [assembly: AssemblyTitle("AiqueOdio")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.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 { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.seuusuario.aiqueodio", "Ai Que Odio Difficulty", "1.1.0")] public class AiqueOdioPlugin : BaseUnityPlugin { public static DifficultyDef AiqueOdioDifficultyDef; public static DifficultyIndex AiqueOdioDifficultyIndex; public static Sprite SpriteDificuldade; public static Sprite SpriteEsmalte; public static Sprite SpriteEsmalteApagado; public static ArtifactDef EsmaltePinkArtifactDef; private static float esmalteTimer = 0f; 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\"" }; public void Awake() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); LoadCustomIcons(); RegisterLanguageTokens(); RegisterDifficulty(); RegisterArtifact(); Run.onRunSetRuleBookGlobal += Run_onRunSetRuleBookGlobal; Run.onRunStartGlobal += Run_onRunStartGlobal; Stage.onStageStartGlobal += Stage_onStageStartGlobal; RoR2Application.onFixedUpdate += RoR2Application_onFixedUpdate; CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal; Language.GetLocalizedStringByToken += new hook_GetLocalizedStringByToken(Language_GetLocalizedStringByToken); Chat.AddMessage_ChatMessageBase += new hook_AddMessage_ChatMessageBase(Chat_AddMessage_ChatMessageBase); Log.Info("AI, QUE ÓDIO!!! Tônico na 5 e Microrrobôs na 6 carregados!"); } private void LoadCustomIcons() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0055: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Expected O, but got Unknown //IL_01a7: 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) try { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("AiqueOdio.Dificuldade.png"); if (stream != null) { byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, array); SpriteDificuldade = 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("Erro ao carregar Dificuldade.png: " + ex.Message); } try { using Stream stream2 = Assembly.GetExecutingAssembly().GetManifestResourceStream("AiqueOdio.Esmalte.png"); if (stream2 != null) { byte[] array2 = new byte[stream2.Length]; stream2.Read(array2, 0, array2.Length); Texture2D val2 = new Texture2D(2, 2); ImageConversion.LoadImage(val2, array2); SpriteEsmalte = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f)); } } catch (Exception ex2) { Log.Error("Erro ao carregar Esmalte.png: " + ex2.Message); } try { using Stream stream3 = Assembly.GetExecutingAssembly().GetManifestResourceStream("AiqueOdio.EsmalteApagado.png"); if (stream3 != null) { byte[] array3 = new byte[stream3.Length]; stream3.Read(array3, 0, array3.Length); Texture2D val3 = new Texture2D(2, 2); ImageConversion.LoadImage(val3, array3); SpriteEsmalteApagado = Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), new Vector2(0.5f, 0.5f)); } } catch (Exception ex3) { Log.Error("Erro ao carregar EsmalteApagado.png: " + ex3.Message); } } private 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>+300%</style>\n>Artefatos Automáticos: <style=cIsUtility>Evolução, Autoridade e Esmalte Pink</style></style>"); LanguageAPI.Add("ESMALTE_PINK_NAME", "Artefato do Esmalte Pink"); LanguageAPI.Add("ESMALTE_PINK_DESCRIPTION", "Monstros ganham <style=cIsDamage>3 itens por fase</style> e <style=cIsDamage>1 item a cada 60s</style>.\nEstágio 2: Itens Verdes ativados.\nEstágio 3: Itens Vermelhos ativados.\nEstágio 4: Itens de Chefe ativados.\nEstágio 5: Tônico Permanente.\nEstágio 6: Microrrobôs."); } private void RegisterDifficulty() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //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) AiqueOdioDifficultyDef = new DifficultyDef(8f, "AIQUEODIO_NAME", "AIQUEODIO_ICON", "AIQUEODIO_DESCRIPTION", new Color(1f, 0.4f, 0.7f), "od", true); if ((Object)(object)SpriteDificuldade != (Object)null) { AiqueOdioDifficultyDef.foundIconSprite = true; AiqueOdioDifficultyDef.iconSprite = SpriteDificuldade; } AiqueOdioDifficultyIndex = DifficultyAPI.AddDifficulty(AiqueOdioDifficultyDef); } private void RegisterArtifact() { EsmaltePinkArtifactDef = ScriptableObject.CreateInstance<ArtifactDef>(); EsmaltePinkArtifactDef.cachedName = "ESMALTE_PINK"; EsmaltePinkArtifactDef.nameToken = "ESMALTE_PINK_NAME"; EsmaltePinkArtifactDef.descriptionToken = "ESMALTE_PINK_DESCRIPTION"; if ((Object)(object)SpriteEsmalte != (Object)null) { EsmaltePinkArtifactDef.smallIconSelectedSprite = SpriteEsmalte; } if ((Object)(object)SpriteEsmalteApagado != (Object)null) { EsmaltePinkArtifactDef.smallIconDeselectedSprite = SpriteEsmalteApagado; } ContentAddition.AddArtifactDef(EsmaltePinkArtifactDef); } private string Language_GetLocalizedStringByToken(orig_GetLocalizedStringByToken orig, Language self, string token) { //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) if ((Object)(object)Run.instance != (Object)null && Run.instance.selectedDifficulty == AiqueOdioDifficultyIndex && !string.IsNullOrEmpty(token) && token.StartsWith("PLAYER_DEATH_QUOTE_")) { int num = Math.Abs(token.GetHashCode()) % deathQuotes.Length; return deathQuotes[num]; } return orig.Invoke(self, token); } private void Chat_AddMessage_ChatMessageBase(orig_AddMessage_ChatMessageBase orig, ChatMessageBase message) { orig.Invoke(message); SimpleChatMessage val = (SimpleChatMessage)(object)((message is SimpleChatMessage) ? message : null); if (val != null && !string.IsNullOrEmpty(val.baseToken) && val.baseToken.Contains("#ff69b4") && val.baseToken.Contains("Os monstros")) { string text = "Play_UI_ping_danger"; LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); if (firstLocalUser != null && (Object)(object)firstLocalUser.cachedBody != (Object)null) { Util.PlaySound(text, ((Component)firstLocalUser.cachedBody).gameObject); } else { Util.PlaySound(text, ((Component)RoR2Application.instance).gameObject); } } } private void Run_onRunSetRuleBookGlobal(Run run, RuleBook ruleBook) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (run.selectedDifficulty == AiqueOdioDifficultyIndex) { Run.ambientLevelCap = int.MaxValue; } } private void Run_onRunStartGlobal(Run run) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (AiqueOdioDifficultyDef != null) { AiqueOdioDifficultyDef.scalingValue = 8f; } esmalteTimer = 0f; if (NetworkServer.active && run.selectedDifficulty == AiqueOdioDifficultyIndex) { RunArtifactManager.instance.SetArtifactEnabledServer(EsmaltePinkArtifactDef, true); RunArtifactManager.instance.SetArtifactEnabledServer(Artifacts.MonsterTeamGainsItems, true); RunArtifactManager.instance.SetArtifactEnabledServer(Artifacts.Command, true); } } private void Stage_onStageStartGlobal(Stage stage) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0098: Expected O, but got Unknown //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_00c8: Expected O, but got Unknown if (!NetworkServer.active || ((Object)(object)stage.sceneDef != (Object)null && stage.sceneDef.baseSceneName == "bazaar")) { return; } if ((Object)(object)Run.instance != (Object)null && Run.instance.selectedDifficulty == AiqueOdioDifficultyIndex) { int num = Run.instance.stageClearCount + 1; string text = (((Object)(object)stage.sceneDef != (Object)null) ? stage.sceneDef.baseSceneName : ""); if (num == 5) { Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "<color=#ff0000>ALERTA DE ODIO: Os monstros injetaram Tônico Espinélio na veia!</color>" }); } if (num == 6 || text.StartsWith("moon")) { GiveSpecificItemToMonsters(Items.CaptainDefenseMatrix, 1); Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "<color=#ff0000>ALERTA DE ODIO: Os monstros instalaram Microrrobôs Defensivos!</color>" }); } } if (RunArtifactManager.instance.IsArtifactEnabled(EsmaltePinkArtifactDef)) { GiveRandomItemToMonsters(3); } } private void CharacterBody_onBodyStartGlobal(CharacterBody body) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 if (NetworkServer.active && (Object)(object)Run.instance != (Object)null && Run.instance.selectedDifficulty == AiqueOdioDifficultyIndex && Object.op_Implicit((Object)(object)body.teamComponent) && (int)body.teamComponent.teamIndex == 2 && Run.instance.stageClearCount + 1 >= 5) { body.AddBuff(Buffs.TonicBuff); } } private void RoR2Application_onFixedUpdate() { if (NetworkServer.active && !((Object)(object)Run.instance == (Object)null) && !((Object)(object)Stage.instance == (Object)null) && RunArtifactManager.instance.IsArtifactEnabled(EsmaltePinkArtifactDef) && (!((Object)(object)Stage.instance.sceneDef != (Object)null) || !(Stage.instance.sceneDef.baseSceneName == "bazaar"))) { float num = 60f; esmalteTimer += Time.fixedDeltaTime; if (esmalteTimer >= num) { esmalteTimer = 0f; GiveRandomItemToMonsters(1); } } } private static void GiveSpecificItemToMonsters(ItemDef itemDef, int count) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Invalid comparison between Unknown and I4 //IL_0065: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Run.instance == (Object)null || (Object)(object)itemDef == (Object)null) { return; } Inventory monsterTeamInventory = MonsterTeamGainsItemsArtifactManager.monsterTeamInventory; if ((Object)(object)monsterTeamInventory != (Object)null) { monsterTeamInventory.GiveItemPermanent(itemDef.itemIndex, count); } foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { if ((int)readOnlyInstances.teamIndex == 2 && (Object)(object)readOnlyInstances.inventory != (Object)null) { readOnlyInstances.inventory.GiveItemPermanent(itemDef.itemIndex, count); } } } private static bool IsCustomBossWhitelisted(string internalName) { string text = internalName.ToLower(); string[] array = new string[7] { "lightninggland", "conductor", "shinypearl", "fireballsonhit", "parentegg", "bleedonhitandexplode", "knurl" }; foreach (string value in array) { if (text.Contains(value)) { return true; } } return false; } private static bool IsCustomGreenBlacklisted(string internalName) { string text = internalName.ToLower(); string[] array = new string[3] { "infusion", "movespeedonkill", "huntersharpoon" }; foreach (string value in array) { if (text.Contains(value)) { return true; } } return false; } private static void GiveRandomItemToMonsters(int count) { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Invalid comparison between Unknown and I4 //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Invalid comparison between Unknown and I4 //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Expected O, but got Unknown //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Invalid comparison between Unknown and I4 //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Invalid comparison between Unknown and I4 //IL_01a0: 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_023a: Invalid comparison between Unknown and I4 //IL_0254: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Run.instance == (Object)null || Run.instance.availableTier1DropList.Count == 0) { return; } int num = Run.instance.stageClearCount + 1; List<PickupIndex> list = new List<PickupIndex>(Run.instance.availableTier1DropList); if (num >= 2 && Run.instance.availableTier2DropList.Count > 0) { list.AddRange(Run.instance.availableTier2DropList); } if (num >= 3 && Run.instance.availableTier3DropList.Count > 0) { list.AddRange(Run.instance.availableTier3DropList); } if (num >= 4 && Run.instance.availableBossDropList.Count > 0) { list.AddRange(Run.instance.availableBossDropList); } List<PickupIndex> list2 = new List<PickupIndex>(); foreach (PickupIndex item in list) { PickupDef pickupDef = PickupCatalog.GetPickupDef(item); if (pickupDef == null || (int)pickupDef.itemIndex == -1) { continue; } ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex); if ((Object)(object)itemDef != (Object)null) { bool flag = Array.Exists(itemDef.tags, (ItemTag tag) => (int)tag == 4) || Array.Exists(itemDef.tags, (ItemTag tag) => (int)tag == 10); if (!flag && (int)itemDef.tier == 1 && IsCustomGreenBlacklisted(((Object)itemDef).name)) { flag = true; } if (!flag && (int)itemDef.tier == 4 && !IsCustomBossWhitelisted(((Object)itemDef).name)) { flag = true; } if (!flag) { list2.Add(item); } } } if (list2.Count == 0) { return; } Inventory monsterTeamInventory = MonsterTeamGainsItemsArtifactManager.monsterTeamInventory; PickupDef val = null; for (int num2 = 0; num2 < count; num2++) { PickupDef pickupDef2 = PickupCatalog.GetPickupDef(Run.instance.treasureRng.NextElementUniform<PickupIndex>(list2)); if (pickupDef2 == null || (int)pickupDef2.itemIndex == -1) { continue; } val = pickupDef2; if ((Object)(object)monsterTeamInventory != (Object)null) { monsterTeamInventory.GiveItemPermanent(pickupDef2.itemIndex, 1); } foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { if ((int)readOnlyInstances.teamIndex == 2 && (Object)(object)readOnlyInstances.inventory != (Object)null) { readOnlyInstances.inventory.GiveItemPermanent(pickupDef2.itemIndex, 1); } } } if (val != null) { string text = Language.GetString(val.nameToken); string text2 = "#" + ColorUtility.ToHtmlStringRGB(val.baseColor); string baseToken = string.Format(chatMessages[Random.Range(0, chatMessages.Length)], "<color=" + text2 + ">" + text + "</color>"); Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = baseToken }); } } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Error(object data) { _logSource.LogError(data); } } }