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 Piriri RolesExtras v1.0.0
PiririRolesExtras.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] [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 PiririRolesExtras { [BepInPlugin("piriri.rolesextras", "Piriri Roles Extras", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private static ConfigEntry<KeyCode> ActiveKey; private static ConfigEntry<bool> ShowHud; private static ConfigEntry<float>[] Cooldown = new ConfigEntry<float>[12]; private static readonly string[] ActiveName = new string[12] { null, "Sandálias Aladas", "Égide", "Roda da Fortuna", "Fôlego do Titã", "Voo do Falcão", "Investida", null, "Colheita", null, "Segundo Fôlego", null }; private static readonly float[] DefCooldown = new float[12] { 0f, 50f, 75f, 90f, 80f, 60f, 45f, 0f, 60f, 0f, 60f, 0f }; private float readyAt; private float buffUntil; private int buffGen = -1; private float bSprint = 1f; private float bJump = 1f; private float bMove = 1f; private PlayerController buffPc; private string buffEnd; private GUIStyle st; private GUIStyle hud; private static ConfigEntry<bool> Translate; internal static readonly Dictionary<string, string> TR = new Dictionary<string, string> { { "\nPress ", "\nPressione " }, { " to continue", " para continuar" }, { " to see all your spells and press ", " para ver seus feitiços e pressione " }, { "\nPress [", "\nPressione [" }, { "] While holding an item to Charge it\nPress ", "] segurando um item para recarregá-lo\nPressione " }, { "SPELLS", "FEITIÇOS" }, { "] Heal yourself for 5 health (1 Mana)\n[", "] Cura 5 de vida (1 de mana)\n[" }, { "] Regenerate your stamina to full (3 Mana)\n[", "] Restaura toda a stamina (3 de mana)\n[" }, { "] Become faster for 30 seconds (2 Mana)\n[", "] Fica mais rápido por 30 segundos (2 de mana)\n[" }, { "] Boost the effectivity of spells used in the next 20 seconds (3 Mana)\n[", "] Potencializa os feitiços dos próximos 20 segundos (3 de mana)\n[" }, { "] Jump higher for 30 seconds (2 Mana)", "] Pula mais alto por 30 segundos (2 de mana)" }, { "Used Heal (-1 Mana)", "Cura conjurada (-1 de mana)" }, { "Used Speed (-2 Mana)", "Velocidade conjurada (-2 de mana)" }, { "Used Overcharge (-3 Mana)", "Sobrecarga conjurada (-3 de mana)" }, { "Used Jump Boost (-2 Mana)", "Salto conjurado (-2 de mana)" }, { "Used Stamina Refill (-3 Mana)", "Stamina restaurada (-3 de mana)" }, { "Used x (- y Mana)", "Feitiço conjurado" }, { "Enemy", "Inimigo" }, { "Ability runs out in: ", "A habilidade acaba em: " }, { "Ability is ready in: ", "Habilidade pronta em: " }, { "Ability is ready!\nPress [", "Habilidade pronta!\nPressione [" }, { "] to activate", "] para ativar" }, { "You walk faster", "Você anda mais rápido" }, { "You have more stamina", "Você tem mais stamina" }, { "You have more health", "Você tem mais vida" }, { "You\u00b4re stronger", "Você está mais forte" }, { "You jump higher", "Você pula mais alto" }, { "you walk slower", "você anda mais devagar" }, { "you have less stamina", "você tem menos stamina" }, { "you have less health", "você tem menos vida" }, { "you\u00b4re weaker", "você está mais fraco" }, { "you don\u00b4t jump as high", "você não pula tão alto" }, { " but ", ", mas " }, { "Choose your role", "Escolha sua classe" }, { "Reassign role on respawn", "Nova classe ao renascer" }, { "ON", "SIM" }, { "OFF", "NÃO" }, { "TOP", "TOPO" }, { "LEFT", "ESQUERDA" }, { "Back", "Voltar" }, { "REPO Roles Config", "Classes (REPO Roles)" }, { "REPORoles Classic Config", "Configurar classes" } }; private static int trCount; internal static Plugin Inst; private static readonly string[] Keys = new string[12] { "", "Runner", "Tank", "Gambler", "Strongman", "RangedLooter", "Athletic", "Mage", "Reaper", "Scout", "Regular", "Engineer" }; private static readonly float[][] Def = new float[12][] { null, new float[7] { 1f, 1f, 1f, 0.8f, 1f, 1f, 0.85f }, new float[7] { 1f, 1f, 1f, 0.85f, 1f, 1.25f, 1f }, new float[7] { 1f, 1f, 1f, 1f, 1f, 1f, 1f }, new float[7] { 1f, 0.9f, 1f, 1f, 1f, 1f, 1f }, new float[7] { 1f, 1f, 1f, 1f, 0.85f, 1f, 1f }, new float[7] { 1f, 0.92f, 1f, 1.15f, 1f, 1f, 1f }, new float[7] { 1f, 1f, 1.2f, 1f, 0.9f, 1f, 1f }, new float[7] { 0.95f, 0.95f, 1f, 1f, 1f, 1f, 1f }, new float[7] { 1f, 0.9f, 1.25f, 1f, 1f, 1f, 1f }, new float[7] { 1f, 1f, 1f, 1f, 1.1f, 1.1f, 1f }, new float[7] { 1f, 1f, 1f, 0.9f, 1f, 1.15f, 1f } }; private static readonly string[] Stat = new string[7] { "Move", "Sprint", "Crouch", "Jump", "Energy", "Recharge", "Grab" }; private static ConfigEntry<float>[][] Mult; private static ConfigEntry<bool> Enabled; private static readonly List<bool> stack = new List<bool>(); internal static int CurrentRole; internal static int Gen; private static string msg; private static float msgUntil; private static ConfigEntry<bool> FixShop; private static PropertyInfo regItems; private static MethodInfo addItem; private static ConfigEntry<bool> SodaOn; private static ConfigEntry<bool> SpeedColaInfinite; private static ConfigEntry<int> JuggMaxHP; private static ConfigEntry<float> SodaMaxDur; private static ConfigEntry<float> SpeedColaMaxMult; private static ConfigEntry<float> DoubleTapMaxStr; private static ConfigEntry<float> DoubleTapMaxRange; private void InitClasses() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown ActiveKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Habilidades", "TeclaAtiva", (KeyCode)102, "Tecla da habilidade ativa da classe (Arquimago, Batedor e Artifice usam as teclas do REPORoles)."); ShowHud = ((BaseUnityPlugin)this).Config.Bind<bool>("Habilidades", "MostrarHud", true, "Mostra no canto da tela se a habilidade esta pronta."); for (int i = 1; i < 12; i++) { if (ActiveName[i] != null) { Cooldown[i] = ((BaseUnityPlugin)this).Config.Bind<float>("Classe." + Keys[i], "RecargaAtivaSegundos", DefCooldown[i], new ConfigDescription("Recarga da habilidade ativa.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(20f, 300f), Array.Empty<object>())); } } } internal static void Say(string s, float secs) { msg = s; msgUntil = Time.time + secs; ((BaseUnityPlugin)Inst).Logger.LogInfo((object)s); } private static bool InLevel() { try { return SemiFunc.RunIsLevel(); } catch { return false; } } private void Update() { //IL_00d8: Unknown result type (might be due to invalid IL or missing references) PlayerController instance = PlayerController.instance; if ((Object)(object)buffPc != (Object)null && Time.time > buffUntil) { if (buffGen == Gen && (Object)(object)buffPc == (Object)(object)instance) { instance.SprintSpeed /= bSprint; instance.JumpForce /= bJump; instance.MoveSpeed /= bMove; if (buffEnd != null) { Say(buffEnd, 3f); } } buffPc = null; } if (!Enabled.Value || (Object)(object)instance == (Object)null || CurrentRole < 1 || CurrentRole > 11 || ActiveName[CurrentRole] == null || !InLevel() || !Input.GetKeyDown(ActiveKey.Value)) { return; } try { if ((Object)(object)ChatManager.instance != (Object)null && Traverse.Create((object)ChatManager.instance).Field("chatActive").GetValue<bool>()) { return; } } catch { } if (Time.time < readyAt) { Say(ActiveName[CurrentRole] + ": recarga em " + Mathf.CeilToInt(readyAt - Time.time) + " s.", 2f); return; } bool flag = false; try { flag = UseActive(CurrentRole, instance); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Erro na habilidade ativa: " + ex.Message)); } if (flag) { readyAt = Time.time + Cooldown[CurrentRole].Value; } } private bool TempBuff(PlayerController pc, float sprint, float jump, float move, float secs, string endMsg) { if ((Object)(object)buffPc != (Object)null) { Say("Já existe um efeito ativo.", 2f); return false; } bSprint = sprint; bJump = jump; bMove = move; buffEnd = endMsg; pc.SprintSpeed *= bSprint; pc.JumpForce *= bJump; pc.MoveSpeed *= bMove; buffPc = pc; buffGen = Gen; buffUntil = Time.time + secs; return true; } private static int Health(PlayerAvatar a) { try { return Traverse.Create((object)a.playerHealth).Field("health").GetValue<int>(); } catch { return 0; } } private bool UseActive(int role, PlayerController pc) { //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar instance = PlayerAvatar.instance; switch (role) { case 1: if (!TempBuff(pc, 1.25f, 1f, 1f, 6f, "Sandálias Aladas: efeito encerrado.")) { return false; } pc.Feather(6f); Say("Sandálias Aladas: +25% de corrida e queda suave por 6 s.", 3f); return true; case 2: { if ((Object)(object)instance == (Object)null || Health(instance) <= 35) { Say("Égide: vida insuficiente (precisa de mais de 35).", 2.5f); return false; } int num = 0; foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { if (!((Object)(object)player == (Object)null) && !((Object)(object)player == (Object)(object)instance) && !((Object)(object)player.playerHealth == (Object)null) && Health(player) > 0 && !(Vector3.Distance(((Component)player).transform.position, ((Component)instance).transform.position) > 6f)) { player.playerHealth.HealOther(20, true); num++; } } if (num == 0) { Say("Égide: nenhum aliado a até 6 m.", 2.5f); return false; } instance.playerHealth.Hurt(15, false, -1, false); Say("Égide: " + num + " aliado(s) curado(s) em 20. Você pagou 15 de vida.", 3f); return true; } case 3: switch (Random.Range(0, 6)) { case 0: if (!TempBuff(pc, 1.25f, 1f, 1f, 20f, "A Estrela se apagou.")) { return false; } Say("Arcano: A Estrela. +25% de corrida por 20 s.", 4f); break; case 1: if (!TempBuff(pc, 1f, 1.35f, 1f, 20f, "O Mundo se recolheu.")) { return false; } Say("Arcano: O Mundo. Pulo +35% por 20 s.", 4f); break; case 2: if (!TempBuff(pc, 0.85f, 1f, 0.85f, 20f, "A Força cedeu.")) { return false; } pc.EnergyCurrent = pc.EnergyStart; Say("Arcano: A Força. Stamina cheia, mas -15% de velocidade por 20 s.", 4f); break; case 3: Say("Arcano: A Roda. Nada acontece... desta vez.", 4f); break; case 4: if (!TempBuff(pc, 0.8f, 1.2f, 1f, 20f, "A Lua se pôs.")) { return false; } Say("Arcano: A Lua. Corrida -20%, pulo +20% por 20 s.", 4f); break; default: pc.EnergyCurrent = pc.EnergyStart; Say("Arcano: A Temperança. Stamina restaurada.", 4f); break; } return true; case 4: if (!TempBuff(pc, 1.2f, 1f, 1.2f, 6f, "Fôlego do Titã: efeito encerrado.")) { return false; } pc.EnergyCurrent = pc.EnergyStart; Say("Fôlego do Titã: stamina cheia e +20% de velocidade por 6 s.", 3f); return true; case 5: if (!TempBuff(pc, 1f, 1.25f, 1f, 8f, "Voo do Falcão: efeito encerrado.")) { return false; } pc.Feather(8f); Say("Voo do Falcão: pulo +25% e queda suave por 8 s.", 3f); return true; case 6: if (!TempBuff(pc, 1.5f, 1f, 1f, 4f, "Investida: efeito encerrado.")) { return false; } Say("Investida: +50% de corrida por 4 s.", 3f); return true; case 8: if ((Object)(object)instance == (Object)null || Health(instance) <= 30) { Say("Colheita: vida insuficiente (precisa de mais de 30).", 2.5f); return false; } instance.playerHealth.Hurt(20, false, -1, false); pc.EnergyCurrent = pc.EnergyStart; Say("Colheita: 20 de vida trocados por stamina cheia.", 3f); return true; case 10: pc.EnergyCurrent = Mathf.Min(pc.EnergyStart, pc.EnergyCurrent + pc.EnergyStart * 0.5f); Say("Segundo Fôlego: +50% de stamina.", 3f); return true; default: return false; } } private void OnGUI() { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_0155: 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_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) if (msg != null && Time.time <= msgUntil) { if (st == null) { st = new GUIStyle(GUI.skin.label) { fontSize = 24, alignment = (TextAnchor)4, fontStyle = (FontStyle)1 }; st.normal.textColor = new Color(1f, 0.85f, 0.2f); } GUI.Label(new Rect(0f, (float)Screen.height * 0.18f, (float)Screen.width, 40f), msg, st); } if (ShowHud.Value && Enabled.Value && CurrentRole >= 1 && CurrentRole <= 11 && ActiveName[CurrentRole] != null && InLevel()) { if (hud == null) { hud = new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = (FontStyle)1 }; } float num = readyAt - Time.time; hud.normal.textColor = ((num <= 0f) ? new Color(0.5f, 1f, 0.5f) : new Color(1f, 1f, 1f, 0.7f)); GUI.Label(new Rect(16f, (float)(Screen.height - 64), 500f, 28f), "[" + ((object)ActiveKey.Value/*cast due to .constrained prefix*/).ToString() + "] " + ActiveName[CurrentRole] + ((num <= 0f) ? " - pronta" : (" - " + Mathf.CeilToInt(num) + " s")), hud); } } private void PatchTranslations() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown Translate = ((BaseUnityPlugin)this).Config.Bind<bool>("Traducao", "TraduzirREPORoles", true, "Traduz para PT-BR os textos fixos do REPORoles Classic (sem alterar a DLL dele)."); if (!Translate.Value) { return; } Harmony val = new Harmony("piriri.rolesextras.ptbr"); HarmonyMethod val2 = new HarmonyMethod(typeof(Plugin), "TrTranspiler", (Type[])null); int num = 0; string[] array = new string[7] { "R.E.P.O.Roles.ClassManager:assignRole", "R.E.P.O.Roles.ClassManager:genGamblerEffects", "R.E.P.O.Roles.patches.guiManager:OnGUI", "R.E.P.O.Roles.patches.guiManager:Update", "R.E.P.O.Roles.patches.guiManager:.ctor", "Repo_Roles.ScoutMarker:OnGUI", "Repo_Roles.RepoRoles:<Awake>" }; for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(':'); Type type = AccessTools.TypeByName(array2[0]); if (type == null) { continue; } MethodInfo[] methods = type.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name == array2[1] || (array2[1].StartsWith("<") && methodInfo.Name.StartsWith(array2[1]))) { try { val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null); num++; } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Traducao: falhou em " + methodInfo.Name + ": " + ex.Message)); } } } if (!(array2[1] == ".ctor")) { continue; } ConstructorInfo[] constructors = type.GetConstructors(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (ConstructorInfo constructorInfo in constructors) { try { val.Patch((MethodBase)constructorInfo, (HarmonyMethod)null, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null); num++; } catch { } } } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Traducao PT-BR do REPORoles: " + num + " metodos, " + trCount + " textos trocados.")); } private static IEnumerable<CodeInstruction> TrTranspiler(IEnumerable<CodeInstruction> ins) { foreach (CodeInstruction @in in ins) { if (@in.opcode == OpCodes.Ldstr && @in.operand is string key && TR.TryGetValue(key, out var value)) { @in.operand = value; trCount++; } yield return @in; } } private void Awake() { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Expected O, but got Unknown //IL_016d: Expected O, but got Unknown Inst = this; Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Geral", "Ativar", true, "Liga os extras das classes."); Mult = new ConfigEntry<float>[Keys.Length][]; for (int i = 1; i < Keys.Length; i++) { Mult[i] = new ConfigEntry<float>[Stat.Length]; for (int j = 0; j < Stat.Length; j++) { Mult[i][j] = ((BaseUnityPlugin)this).Config.Bind<float>("Classe." + Keys[i], Stat[j], Def[i][j], new ConfigDescription("Multiplicador extra (1 = sem mudanca).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 1.5f), Array.Empty<object>())); } } Type type = AccessTools.TypeByName("R.E.P.O.Roles.ClassManager"); if (type == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"REPORoles Classic nao encontrado; extras desligados."); return; } MethodInfo methodInfo = AccessTools.Method(type, "assignRole", new Type[2] { typeof(int), typeof(PlayerController) }, (Type[])null); if (methodInfo == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"ClassManager.assignRole nao encontrado; extras desligados."); return; } new Harmony("piriri.rolesextras").Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(Plugin), "Pre", (Type[])null), new HarmonyMethod(typeof(Plugin), "Post", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Piriri Roles Extras carregado (patch em ClassManager.assignRole)."); try { PatchSodas(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)ex); } try { PatchShopStatus(); } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogError((object)ex2); } InitClasses(); PatchTranslations(); } private void PatchShopStatus() { //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown FixShop = ((BaseUnityPlugin)this).Config.Bind<bool>("Correcoes v0.5.0", "ItensDeModsNaLoja", true, "Recoloca os itens/upgrades de mods (REPOLib) na lista de itens do jogo para aparecerem na loja do R.E.P.O. 0.5.0."); Type type = AccessTools.TypeByName("REPOLib.Modules.Items"); regItems = ((type == null) ? null : AccessTools.Property(type, "RegisteredItems")); Type type2 = AccessTools.TypeByName("REPOLib.Extensions.StatsManagerExtensions"); addItem = ((type2 == null) ? null : AccessTools.Method(type2, "AddItem", new Type[2] { typeof(StatsManager), typeof(Item) }, (Type[])null)); if (regItems == null || addItem == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"API do REPOLib nao encontrada; correcao da loja desligada."); return; } Harmony val = new Harmony("piriri.rolesextras.shopfix"); HarmonyMethod val2 = new HarmonyMethod(typeof(Plugin), "EnsureItems", (Type[])null); int num = 0; string[][] array = new string[4][] { new string[3] { "StatsManager", "LoadItemsFromFolder", "post" }, new string[3] { "StatsManager", "RunStartStats", "post" }, new string[3] { "ShopManager", "GetAllItemsFromStatsManager", "pre" }, new string[3] { "StatsManager", "LoadGame", "post" } }; foreach (string[] array2 in array) { Type type3 = AccessTools.TypeByName(array2[0]); MethodInfo methodInfo = ((type3 == null) ? null : AccessTools.Method(type3, array2[1], (Type[])null, (Type[])null)); if (methodInfo == null) { continue; } try { if (array2[2] == "pre") { val.Patch((MethodBase)methodInfo, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } else { val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Correcao da loja: gancho " + array2[1] + " falhou: " + ex.Message)); continue; } num++; } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Correcao da loja v0.5.0 ativa (" + num + " ganchos).")); } private static void EnsureItems(MethodBase __originalMethod) { try { if (!FixShop.Value || (Object)(object)StatsManager.instance == (Object)null || !(regItems.GetValue(null, null) is IEnumerable enumerable)) { return; } Dictionary<string, Item> itemDictionary = StatsManager.instance.itemDictionary; int num = 0; foreach (object item in enumerable) { Item val = (Item)((item is Item) ? item : null); if (!((Object)(object)val == (Object)null) && !itemDictionary.ContainsKey(((Object)val).name) && (bool)addItem.Invoke(null, new object[2] { StatsManager.instance, val })) { num++; } } if (num > 0) { ((BaseUnityPlugin)Inst).Logger.LogInfo((object)("Loja v0.5.0: " + num + " item(ns) de mods recolocados (em " + __originalMethod.Name + "). Total na lista: " + itemDictionary.Count)); } } catch (Exception ex) { ((BaseUnityPlugin)Inst).Logger.LogError((object)("Erro na correcao da loja: " + ex.Message)); } } private void PatchSodas() { //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown SodaOn = ((BaseUnityPlugin)this).Config.Bind<bool>("Soda Perks", "LimitarSodas", true, "Limita os efeitos das sodas do Soda_Perks."); JuggMaxHP = ((BaseUnityPlugin)this).Config.Bind<int>("Soda Perks", "JuggernogVidaMax", 200, "Teto da vida do Juggernog (o mod original da muito mais)."); SodaMaxDur = ((BaseUnityPlugin)this).Config.Bind<float>("Soda Perks", "DuracaoMaxSegundos", 60f, "Duracao maxima de qualquer soda (s)."); SpeedColaInfinite = ((BaseUnityPlugin)this).Config.Bind<bool>("Soda Perks", "SpeedColaStaminaInfinita", false, "Permitir stamina infinita na Speed Cola."); SpeedColaMaxMult = ((BaseUnityPlugin)this).Config.Bind<float>("Soda Perks", "SpeedColaVelocidadeMax", 1.3f, "Teto do multiplicador de velocidade da Speed Cola."); DoubleTapMaxStr = ((BaseUnityPlugin)this).Config.Bind<float>("Soda Perks", "DoubleTapForcaMax", 1.5f, "Teto da forca extra do Double Tap."); DoubleTapMaxRange = ((BaseUnityPlugin)this).Config.Bind<float>("Soda Perks", "DoubleTapAlcanceMax", 1.5f, "Teto do alcance extra do Double Tap."); Type type = AccessTools.TypeByName("MichPerks.R_PerkGhost"); MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "Setup", (Type[])null, (Type[])null)); if (methodInfo == null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Soda_Perks nao encontrado; limites de soda desligados."); return; } new Harmony("piriri.rolesextras.sodas").Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(Plugin), "SodaPre", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Limites de Soda_Perks ativos."); } private static void SodaPre(object __0) { try { if (__0 == null || !SodaOn.Value) { return; } Traverse val = Traverse.Create(__0); int num = Convert.ToInt32(val.Field("tipoDeSoda").GetValue()); float value = val.Field("duracionEfecto").GetValue<float>(); string text = "tipo=" + num + " dur=" + value + " speed=" + val.Field("speedMultiplier").GetValue<float>() + " inf=" + val.Field("energiaInfinita").GetValue<bool>() + " vida=" + val.Field("vidaModoTanque").GetValue<int>() + " forca=" + val.Field("fuerzaExtra").GetValue<float>() + " alcance=" + val.Field("rangoExtra").GetValue<float>() + " buffer=" + val.Field("vidaBuffer").GetValue<int>(); if (value > SodaMaxDur.Value) { val.Field("duracionEfecto").SetValue((object)SodaMaxDur.Value); } switch (num) { case 0: if (!SpeedColaInfinite.Value) { val.Field("energiaInfinita").SetValue((object)false); } if (val.Field("speedMultiplier").GetValue<float>() > SpeedColaMaxMult.Value) { val.Field("speedMultiplier").SetValue((object)SpeedColaMaxMult.Value); } break; case 1: if (val.Field("vidaModoTanque").GetValue<int>() > JuggMaxHP.Value) { val.Field("vidaModoTanque").SetValue((object)JuggMaxHP.Value); } break; case 2: if (val.Field("fuerzaExtra").GetValue<float>() > DoubleTapMaxStr.Value) { val.Field("fuerzaExtra").SetValue((object)DoubleTapMaxStr.Value); } if (val.Field("rangoExtra").GetValue<float>() > DoubleTapMaxRange.Value) { val.Field("rangoExtra").SetValue((object)DoubleTapMaxRange.Value); } break; } ((BaseUnityPlugin)Inst).Logger.LogInfo((object)("Soda limitada. Antes: " + text + " | depois: dur=" + val.Field("duracionEfecto").GetValue<float>() + " vida=" + val.Field("vidaModoTanque").GetValue<int>() + " speed=" + val.Field("speedMultiplier").GetValue<float>() + " inf=" + val.Field("energiaInfinita").GetValue<bool>())); } catch (Exception ex) { ((BaseUnityPlugin)Inst).Logger.LogError((object)("Erro limitando soda: " + ex.Message)); } } private static void Pre() { if (stack.Count > 0) { stack[stack.Count - 1] = true; } stack.Add(item: false); } private static void Post(int __0, PlayerController __1) { bool num = stack[stack.Count - 1]; stack.RemoveAt(stack.Count - 1); if (num || (Object)(object)__1 == (Object)null) { return; } try { Apply(__0, __1); } catch (Exception ex) { ((BaseUnityPlugin)Inst).Logger.LogError((object)("Erro aplicando extras: " + ex)); } } private static void Apply(int role, PlayerController pc) { Gen++; CurrentRole = role; if (!Enabled.Value || role < 1 || role >= Keys.Length) { return; } ConfigEntry<float>[] array = Mult[role]; pc.MoveSpeed *= array[0].Value; pc.SprintSpeed *= array[1].Value; pc.CrouchSpeed *= array[2].Value; pc.JumpForce *= array[3].Value; pc.EnergyStart *= array[4].Value; pc.EnergyCurrent = Mathf.Min(pc.EnergyCurrent * array[4].Value, pc.EnergyStart); FieldInfo fieldInfo = AccessTools.Field(typeof(PlayerController), "sprintRechargeAmount"); if (fieldInfo != null) { fieldInfo.SetValue(pc, (float)fieldInfo.GetValue(pc) * array[5].Value); } if (Math.Abs(array[6].Value - 1f) > 0.001f) { PhysGrabber instance = PhysGrabber.instance; if ((Object)(object)instance != (Object)null) { instance.grabRange *= array[6].Value; } } ((BaseUnityPlugin)Inst).Logger.LogInfo((object)("Extras aplicados na classe " + Keys[role] + ".")); } } }