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 CarlosMMOCore v1.0.2
plugins/CarlosMMOCore.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("CarlosMMOCore")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CarlosMMOCore")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("74e377b3-98aa-47b7-8eaa-4e928465f252")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace CarlosMMOCore; [BepInPlugin("carlos.mmocore", "Carlos MMO Core", "6.5.1")] public class Main : BaseUnityPlugin { public enum PlayerClass { Guerreiro, Tanque, Mago } public enum QuestType { Kill, Collect, Boss } public class QuestDefinition { public QuestType Type; public string Title; public string TargetKeyword; public int Goal; public int RewardXP; public int RewardCoins; public string RewardItemPrefab; public int RewardItemAmount; public QuestDefinition(QuestType type, string title, string targetKeyword, int goal, int rewardXP, int rewardCoins, string rewardItemPrefab, int rewardItemAmount) { Type = type; Title = title; TargetKeyword = targetKeyword; Goal = goal; RewardXP = rewardXP; RewardCoins = rewardCoins; RewardItemPrefab = rewardItemPrefab; RewardItemAmount = rewardItemAmount; } } public class RegionProgressEntry { public string RegionId = ""; public string RegionName = ""; public string BiomeName = ""; public bool Unlocked = false; public bool Visited = false; public bool MonstrumSpawned = false; public bool MonstrumDefeated = false; public int VisitCount = 0; } public class WorldStateData { public string WorldName = "world_default"; public string LastRegionId = ""; public string LastRegionName = ""; public int RegionUnlockCount = 0; public int TotalMonstrumSpawned = 0; public int TotalMonstrumDefeated = 0; } public class TopAlertData { public string Text; public Color Color; public float Duration; public float StartTime; public float Age => Time.time - StartTime; public float Remaining => Mathf.Max(0f, Duration - Age); public bool Expired => Age >= Duration; public TopAlertData(string text, Color color, float duration) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) Text = text; Color = color; Duration = duration; StartTime = Time.time; } } internal static Main Instance; internal static PlayerClass CurrentClass = PlayerClass.Guerreiro; internal static int CurrentXP = 0; internal static int CurrentLevel = 1; internal static int XPToNextLevel = 100; internal static int CurrentQuestIndex = 0; internal static int CurrentQuestProgress = 0; internal static int QuestLoopCount = 1; internal static bool ShowHud = true; private Harmony _harmony; private Texture2D _panelTexture; private Texture2D _barBgTexture; private Texture2D _barFillTexture; private Texture2D _topAlertBgTexture; private Texture2D _topAlertAccentTexture; private GUIStyle _titleStyle; private GUIStyle _textStyle; private GUIStyle _smallStyle; private GUIStyle _classLabelStyle; private GUIStyle _questLabelStyle; private GUIStyle _whiteInfoStyle; private GUIStyle _topAlertStyle; private GUIStyle _topAlertSmallStyle; private float _collectCheckTimer = 0f; private float _uiPulse = 1f; private float _regionCheckTimer = 0f; private float _manualRefreshTimer = 0f; private string _lastKnownRegionId = ""; private string _lastKnownRegionName = ""; private string _lastKnownBiomeName = ""; private bool _didInitialRegionScan = false; private readonly List<TopAlertData> _topAlerts = new List<TopAlertData>(); private readonly Dictionary<string, RegionProgressEntry> _regionStates = new Dictionary<string, RegionProgressEntry>(); private WorldStateData _worldState = new WorldStateData(); private static readonly List<QuestDefinition> QuestChain = new List<QuestDefinition> { new QuestDefinition(QuestType.Kill, "Elimine 12 Greydwarfs", "greydwarf", 12, 320, 60, "Amber", 3), new QuestDefinition(QuestType.Collect, "Colete 60 Madeiras", "Wood", 60, 360, 70, "Coins", 50), new QuestDefinition(QuestType.Kill, "Elimine 10 Esqueletos", "skeleton", 10, 420, 85, "BoneFragments", 12), new QuestDefinition(QuestType.Collect, "Colete 25 Fragmentos de Ossos", "BoneFragments", 25, 460, 90, "AmberPearl", 2), new QuestDefinition(QuestType.Boss, "Derrote 2 Chefes Ancestrais", "ancestral", 2, 700, 140, "Ruby", 3) }; private void Awake() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown Instance = this; LoadData(); ClampLoadedData(); LoadRegionData(); ClampRegionData(); InitUI(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Carlos MMO Core V6.5.1 carregado com WorldData + Regiões + Monstrum."); _harmony = new Harmony("carlos.mmocore"); PatchXP(); PatchLoot(); PatchDamage(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Sistema MMO V6.5.1 ativo: XP, Loot, Classes, Missões, Regiões e Monstrum."); } private void Update() { if (Input.GetKeyDown((KeyCode)287)) { CycleClass(); } if (Input.GetKeyDown((KeyCode)289)) { ShowHud = !ShowHud; ((BaseUnityPlugin)this).Logger.LogInfo((object)("HUD MMO: " + (ShowHud ? "visível" : "oculto"))); SaveData(); } if (Input.GetKeyDown((KeyCode)288)) { TryManualRegionRefresh(); } _collectCheckTimer += Time.deltaTime; if (_collectCheckTimer >= 1f) { _collectCheckTimer = 0f; UpdateCollectQuestProgress(); } _regionCheckTimer += Time.deltaTime; if (_regionCheckTimer >= 1.25f) { _regionCheckTimer = 0f; UpdateRegionSystem(); } _manualRefreshTimer += Time.deltaTime; if (!_didInitialRegionScan && _manualRefreshTimer >= 3f) { _manualRefreshTimer = 0f; TryManualRegionRefresh(); } _uiPulse = 1f + Mathf.Sin(Time.time * 2f) * 0.01f; CleanupTopAlerts(); } private void OnDestroy() { SaveData(); SaveRegionData(); } private void OnApplicationQuit() { SaveData(); SaveRegionData(); } private void CycleClass() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) if (CurrentClass == PlayerClass.Guerreiro) { CurrentClass = PlayerClass.Tanque; } else if (CurrentClass == PlayerClass.Tanque) { CurrentClass = PlayerClass.Mago; } else { CurrentClass = PlayerClass.Guerreiro; } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Classe alterada para: " + GetClassDisplayName(CurrentClass))); PushTopAlert("Classe alterada: " + GetClassDisplayName(CurrentClass), GetClassColor(CurrentClass), 2.8f); SaveData(); } private void InitUI() { //IL_0017: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Expected O, but got Unknown //IL_0193: 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_01a9: Expected O, but got Unknown //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Expected O, but got Unknown //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Expected O, but got Unknown //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Expected O, but got Unknown //IL_0277: Unknown result type (might be due to invalid IL or missing references) _panelTexture = MakeTex(new Color(0f, 0f, 0f, 0.72f)); _barBgTexture = MakeTex(new Color(0.08f, 0.08f, 0.12f, 0.98f)); _barFillTexture = MakeTex(new Color(0.22f, 0.08f, 0.32f, 0.98f)); _topAlertBgTexture = MakeTex(new Color(0f, 0f, 0f, 0.68f)); _topAlertAccentTexture = MakeTex(new Color(0.95f, 0.75f, 0.16f, 0.95f)); _titleStyle = new GUIStyle(); _titleStyle.fontSize = 18; _titleStyle.normal.textColor = Color.white; _textStyle = new GUIStyle(); _textStyle.fontSize = 14; _textStyle.normal.textColor = Color.white; _smallStyle = new GUIStyle(); _smallStyle.fontSize = 13; _smallStyle.normal.textColor = new Color(0.92f, 0.92f, 0.92f, 1f); _classLabelStyle = new GUIStyle(); _classLabelStyle.fontSize = 15; _classLabelStyle.normal.textColor = new Color(0.98f, 0.83f, 0.18f, 1f); _questLabelStyle = new GUIStyle(); _questLabelStyle.fontSize = 15; _questLabelStyle.normal.textColor = new Color(0.98f, 0.83f, 0.18f, 1f); _whiteInfoStyle = new GUIStyle(); _whiteInfoStyle.fontSize = 13; _whiteInfoStyle.normal.textColor = Color.white; _topAlertStyle = new GUIStyle(); _topAlertStyle.fontSize = 18; _topAlertStyle.normal.textColor = Color.white; _topAlertSmallStyle = new GUIStyle(); _topAlertSmallStyle.fontSize = 13; _topAlertSmallStyle.normal.textColor = new Color(0.92f, 0.92f, 0.92f, 1f); } private Texture2D MakeTex(Color color) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_000c: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(1, 1); val.SetPixel(0, 0, color); val.Apply(); return val; } private void PatchXP() { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown Type type = AccessTools.TypeByName("Character"); if (type == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Character não encontrado."); return; } MethodInfo methodInfo = AccessTools.Method(type, "OnDeath", (Type[])null, (Type[])null); MethodInfo method = typeof(Main).GetMethod("OnCharacterDeathPrefix", BindingFlags.Static | BindingFlags.NonPublic); if (methodInfo == null || method == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Patch de XP não pôde ser aplicado."); } else { _harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } private void PatchLoot() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown Type type = AccessTools.TypeByName("CharacterDrop"); if (type == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"CharacterDrop não encontrado."); return; } MethodInfo methodInfo = AccessTools.Method(type, "GenerateDropList", (Type[])null, (Type[])null); MethodInfo method = typeof(Main).GetMethod("OnLootGenerated", BindingFlags.Static | BindingFlags.NonPublic); if (methodInfo == null || method == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Patch de loot não pôde ser aplicado."); } else { _harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } private void PatchDamage() { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown Type type = AccessTools.TypeByName("Character"); if (type == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Character não encontrado para patch de dano."); return; } MethodInfo methodInfo = AccessTools.Method(type, "RPC_Damage", (Type[])null, (Type[])null); MethodInfo method = typeof(Main).GetMethod("OnCharacterDamagePrefix", BindingFlags.Static | BindingFlags.NonPublic); if (methodInfo == null || method == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Patch de dano não pôde ser aplicado."); } else { _harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } private static void OnCharacterDeathPrefix(object __instance) { if (__instance == null || (Object)(object)Instance == (Object)null) { return; } try { MethodInfo methodInfo = AccessTools.Method(__instance.GetType(), "IsPlayer", (Type[])null, (Type[])null); if (!(methodInfo != null) || !(bool)methodInfo.Invoke(__instance, null)) { string text = GetCharacterNameSafe(__instance); if (string.IsNullOrWhiteSpace(text)) { text = "inimigo"; } int xPRewardByClass = GetXPRewardByClass(); AddXP(xPRewardByClass, text); UpdateKillOrBossQuestProgress(__instance, text); TryHandleMonstrumDeath(__instance, text); TrySpawnBoss(__instance); } } catch (Exception ex) { if ((Object)(object)Instance != (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)("Falha em OnCharacterDeathPrefix: " + ex.Message)); } } } private static string GetCharacterNameSafe(object character) { if (character == null) { return ""; } try { Traverse val = Traverse.Create(character); string value = val.Field("m_name").GetValue<string>(); if (!string.IsNullOrWhiteSpace(value)) { return value; } } catch { } try { return character.ToString(); } catch { return ""; } } private static void UpdateKillOrBossQuestProgress(object deadEnemy, string enemyName) { if (QuestChain.Count == 0 || (Object)(object)Instance == (Object)null) { return; } QuestDefinition scaledQuest = GetScaledQuest(); string text = (enemyName ?? "").ToLowerInvariant(); if (scaledQuest.Type == QuestType.Kill) { if (NameMatches(text, scaledQuest.TargetKeyword)) { CurrentQuestProgress++; ((BaseUnityPlugin)Instance).Logger.LogInfo((object)$"Missão de caça: {GetDisplayQuestTitle(scaledQuest)} {CurrentQuestProgress}/{scaledQuest.Goal}"); if (CurrentQuestProgress >= scaledQuest.Goal) { CompleteCurrentQuest(); } SaveData(); } } else if (scaledQuest.Type == QuestType.Boss && IsBossMatch(deadEnemy, text)) { CurrentQuestProgress++; ((BaseUnityPlugin)Instance).Logger.LogInfo((object)$"Missão de chefe: {GetDisplayQuestTitle(scaledQuest)} {CurrentQuestProgress}/{scaledQuest.Goal}"); if (CurrentQuestProgress >= scaledQuest.Goal) { CompleteCurrentQuest(); } SaveData(); } } private void UpdateCollectQuestProgress() { if (QuestChain.Count == 0) { return; } QuestDefinition scaledQuest = GetScaledQuest(); if (scaledQuest.Type == QuestType.Collect) { int playerItemCountRobust = GetPlayerItemCountRobust(scaledQuest.TargetKeyword); playerItemCountRobust = Mathf.Clamp(playerItemCountRobust, 0, scaledQuest.Goal + 9999); if (playerItemCountRobust != CurrentQuestProgress) { CurrentQuestProgress = playerItemCountRobust; ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Missão de coleta: {GetDisplayQuestTitle(scaledQuest)} {CurrentQuestProgress}/{scaledQuest.Goal}"); SaveData(); } if (CurrentQuestProgress >= scaledQuest.Goal) { CompleteCurrentQuest(); } } } private int GetPlayerItemCountRobust(string targetKeyword) { try { Type type = AccessTools.TypeByName("Player"); if (type == null) { return 0; } FieldInfo fieldInfo = AccessTools.Field(type, "m_localPlayer"); object obj = ((fieldInfo != null) ? fieldInfo.GetValue(null) : null); if (obj == null) { return 0; } MethodInfo methodInfo = AccessTools.Method(type, "GetInventory", (Type[])null, (Type[])null); if (methodInfo == null) { return 0; } object obj2 = methodInfo.Invoke(obj, null); if (obj2 == null) { return 0; } MethodInfo methodInfo2 = AccessTools.Method(obj2.GetType(), "GetAllItems", (Type[])null, (Type[])null); if (methodInfo2 == null) { return 0; } object obj3 = methodInfo2.Invoke(obj2, null); if (!(obj3 is IEnumerable enumerable)) { return 0; } int num = 0; foreach (object item in enumerable) { if (item == null) { continue; } string prefabName = ""; string sharedName = ""; int num2 = 1; try { FieldInfo fieldInfo2 = AccessTools.Field(item.GetType(), "m_dropPrefab"); object obj4 = ((fieldInfo2 != null) ? fieldInfo2.GetValue(item) : null); GameObject val = (GameObject)((obj4 is GameObject) ? obj4 : null); if ((Object)(object)val != (Object)null) { prefabName = ((Object)val).name ?? ""; } } catch { } try { FieldInfo fieldInfo3 = AccessTools.Field(item.GetType(), "m_shared"); object obj6 = ((fieldInfo3 != null) ? fieldInfo3.GetValue(item) : null); if (obj6 != null) { FieldInfo fieldInfo4 = AccessTools.Field(obj6.GetType(), "m_name"); object obj7 = ((fieldInfo4 != null) ? fieldInfo4.GetValue(obj6) : null); sharedName = ((obj7 != null) ? obj7.ToString() : ""); } } catch { } try { FieldInfo fieldInfo5 = AccessTools.Field(item.GetType(), "m_stack"); object obj9 = ((fieldInfo5 != null) ? fieldInfo5.GetValue(item) : null); if (obj9 != null) { num2 = Convert.ToInt32(obj9); } } catch { } if (ItemMatchesTarget(prefabName, sharedName, targetKeyword)) { num += Mathf.Max(1, num2); } } return num; } catch { return 0; } } private static bool ItemMatchesTarget(string prefabName, string sharedName, string targetKeyword) { string text = NormalizeText(prefabName); string text2 = NormalizeText(sharedName); string text3 = NormalizeText(targetKeyword); if (string.IsNullOrWhiteSpace(text3)) { return false; } if (text == text3 || text2 == text3) { return true; } if (text.Contains(text3) || text2.Contains(text3)) { return true; } if (text3 == "wood") { return text.Contains("wood") || text2.Contains("wood"); } if (text3 == "bonefragments") { return text.Contains("bonefragment") || text2.Contains("bonefragment") || text2.Contains("fragmento"); } return false; } private static string NormalizeText(string value) { if (string.IsNullOrWhiteSpace(value)) { return ""; } return value.Replace("$item_", "").Replace(" ", "").Replace("_", "") .Replace("-", "") .Trim() .ToLowerInvariant(); } private static bool NameMatches(string value, string targetKeyword) { string text = NormalizeText(value); string value2 = NormalizeText(targetKeyword); if (string.IsNullOrWhiteSpace(text) || string.IsNullOrWhiteSpace(value2)) { return false; } return text.Contains(value2); } private static bool IsBossMatch(object deadEnemy, string lowerEnemyName) { if (NameMatches(lowerEnemyName, "ancestral")) { return true; } if (NameMatches(lowerEnemyName, "greydwarfelite")) { return true; } if (NameMatches(lowerEnemyName, "greydwarfbrute")) { return true; } if (NameMatches(lowerEnemyName, "troll")) { return true; } if (NameMatches(lowerEnemyName, "abomination")) { return true; } if (NameMatches(lowerEnemyName, "berserker")) { return true; } if (NameMatches(lowerEnemyName, "seekerbrute")) { return true; } if (deadEnemy != null) { try { string text = deadEnemy.GetType().Name.ToLowerInvariant(); if (text.Contains("boss")) { return true; } } catch { } } return false; } private static QuestDefinition GetScaledQuest() { QuestDefinition questDefinition = QuestChain[Mathf.Clamp(CurrentQuestIndex, 0, QuestChain.Count - 1)]; int num = Mathf.Max(0, QuestLoopCount - 1); int num2 = questDefinition.Goal; int rewardXP = questDefinition.RewardXP; int rewardCoins = questDefinition.RewardCoins; int rewardItemAmount = questDefinition.RewardItemAmount; if (questDefinition.Type == QuestType.Kill) { num2 += num * 2; } else if (questDefinition.Type == QuestType.Collect) { num2 += num * 5; } else if (questDefinition.Type == QuestType.Boss) { num2 += num / 3; } rewardXP = Mathf.RoundToInt((float)rewardXP * (1f + (float)num * 0.12f)); rewardCoins = Mathf.RoundToInt((float)rewardCoins * (1f + (float)num * 0.1f)); rewardItemAmount += num / 2; return new QuestDefinition(questDefinition.Type, questDefinition.Title, questDefinition.TargetKeyword, Mathf.Max(1, num2), Mathf.Max(1, rewardXP), Mathf.Max(1, rewardCoins), questDefinition.RewardItemPrefab, Mathf.Max(1, rewardItemAmount)); } private static string GetDisplayQuestTitle(QuestDefinition quest) { if (quest == null) { return ""; } return NormalizeText(quest.TargetKeyword) switch { "greydwarf" => $"Elimine {quest.Goal} Greydwarfs", "wood" => $"Colete {quest.Goal} Madeiras", "skeleton" => $"Elimine {quest.Goal} Esqueletos", "bonefragments" => $"Colete {quest.Goal} Fragmentos de Ossos", "ancestral" => $"Derrote {quest.Goal} Chefes Ancestrais", _ => quest.Title, }; } private static void CompleteCurrentQuest() { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Instance == (Object)null) && QuestChain.Count != 0) { QuestDefinition scaledQuest = GetScaledQuest(); ((BaseUnityPlugin)Instance).Logger.LogInfo((object)$"MISSÃO CONCLUÍDA! {GetDisplayQuestTitle(scaledQuest)} | +{scaledQuest.RewardXP} XP | {scaledQuest.RewardCoins} moedas | {scaledQuest.RewardItemPrefab} x{scaledQuest.RewardItemAmount}"); Instance.PushTopAlert("MISSÃO CONCLUÍDA: " + GetDisplayQuestTitle(scaledQuest), new Color(0.45f, 1f, 0.45f, 1f), 3.2f); AddXP(scaledQuest.RewardXP, "missão " + GetDisplayQuestTitle(scaledQuest)); DropQuestRewards(scaledQuest); CurrentQuestIndex++; if (CurrentQuestIndex >= QuestChain.Count) { CurrentQuestIndex = 0; QuestLoopCount++; ((BaseUnityPlugin)Instance).Logger.LogInfo((object)$"Novo ciclo de missões iniciado: Loop {QuestLoopCount}"); Instance.PushTopAlert($"Novo ciclo de missões: Loop {QuestLoopCount}", new Color(1f, 0.82f, 0.22f, 1f), 3f); } CurrentQuestProgress = 0; QuestDefinition scaledQuest2 = GetScaledQuest(); ((BaseUnityPlugin)Instance).Logger.LogInfo((object)$"Nova missão: {GetDisplayQuestTitle(scaledQuest2)} ({scaledQuest2.Goal})"); Instance.PushTopAlert("Nova missão: " + GetDisplayQuestTitle(scaledQuest2), Color.white, 3f); SaveData(); } } private static void DropQuestRewards(QuestDefinition quest) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) Type type = AccessTools.TypeByName("Player"); if (type == null) { return; } FieldInfo fieldInfo = AccessTools.Field(type, "m_localPlayer"); Component val = (Component)((fieldInfo != null) ? /*isinst with value type is only supported in some contexts*/: null); if (!((Object)(object)val == (Object)null)) { Vector3 val2 = val.transform.position + val.transform.forward * 2f; if (quest.RewardCoins > 0) { SpawnRewardPrefab("Coins", val2, quest.RewardCoins); } if (!string.IsNullOrWhiteSpace(quest.RewardItemPrefab) && quest.RewardItemAmount > 0) { SpawnRewardPrefab(quest.RewardItemPrefab, val2 + new Vector3(1f, 0f, 0f), quest.RewardItemAmount); } } } private static void SpawnRewardPrefab(string prefabName, Vector3 pos, int stack) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) try { Type type = AccessTools.TypeByName("ZNetScene"); if (type == null) { return; } PropertyInfo property = type.GetProperty("instance", BindingFlags.Static | BindingFlags.Public); object obj = ((property != null) ? property.GetValue(null, null) : null); if (obj == null) { return; } MethodInfo method = type.GetMethod("GetPrefab", new Type[1] { typeof(string) }); if (method == null) { return; } GameObject val = (GameObject)method.Invoke(obj, new object[1] { prefabName }); if ((Object)(object)val == (Object)null) { if ((Object)(object)Instance != (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)("Prefab de recompensa não encontrado: " + prefabName)); } return; } GameObject val2 = Object.Instantiate<GameObject>(val, pos, Quaternion.identity); if ((Object)(object)val2 == (Object)null) { return; } Type type2 = AccessTools.TypeByName("ItemDrop"); if (type2 != null) { Component component = val2.GetComponent(type2); if ((Object)(object)component != (Object)null) { FieldInfo fieldInfo = AccessTools.Field(type2, "m_itemData"); object obj2 = ((fieldInfo != null) ? fieldInfo.GetValue(component) : null); if (obj2 != null) { FieldInfo fieldInfo2 = AccessTools.Field(obj2.GetType(), "m_stack"); if (fieldInfo2 != null) { fieldInfo2.SetValue(obj2, Mathf.Max(1, stack)); } } } } if ((Object)(object)Instance != (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)$"Recompensa recebida: {prefabName} x{stack}"); } } catch (Exception ex) { if ((Object)(object)Instance != (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)("Falha ao entregar recompensa " + prefabName + ": " + ex.Message)); } } } private static int GetXPRewardByClass() { int num = 60 + Mathf.Min(20, CurrentLevel / 10 * 2); switch (CurrentClass) { case PlayerClass.Guerreiro: num += 10; break; case PlayerClass.Tanque: num += 2; break; case PlayerClass.Mago: num += 5; if (Random.value < 0.18f) { num *= 2; if ((Object)(object)Instance != (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)"Mago ativou XP dobrado!"); } } break; } return num; } private static void OnCharacterDamagePrefix(object __instance, ref object hit) { if (__instance == null || hit == null || (Object)(object)Instance == (Object)null) { return; } try { MethodInfo methodInfo = AccessTools.Method(__instance.GetType(), "IsPlayer", (Type[])null, (Type[])null); if (methodInfo == null) { return; } bool flag = (bool)methodInfo.Invoke(__instance, null); Traverse val = Traverse.Create(hit); Traverse val2 = val.Field("m_damage"); object value = val2.GetValue(); if (value == null) { return; } Traverse dmg = Traverse.Create(value); if (!flag) { if (CurrentClass == PlayerClass.Guerreiro && Random.value < 0.16f) { ApplyOutgoingBonus(dmg, 1.45f); ((BaseUnityPlugin)Instance).Logger.LogInfo((object)"Guerreiro ativou crítico!"); } else if (CurrentClass == PlayerClass.Mago && Random.value < 0.1f) { ApplyOutgoingBonus(dmg, 1.3f); ((BaseUnityPlugin)Instance).Logger.LogInfo((object)"Mago ativou explosão arcana!"); } } else { float incomingDamageMultiplier = GetIncomingDamageMultiplier(); ApplyIncomingMultiplier(dmg, incomingDamageMultiplier); } } catch { } } private static void ApplyOutgoingBonus(Traverse dmg, float multiplier) { MultiplyDamageField(dmg, "m_blunt", multiplier); MultiplyDamageField(dmg, "m_slash", multiplier); MultiplyDamageField(dmg, "m_pierce", multiplier); MultiplyDamageField(dmg, "m_fire", multiplier); MultiplyDamageField(dmg, "m_frost", multiplier); MultiplyDamageField(dmg, "m_lightning", multiplier); MultiplyDamageField(dmg, "m_poison", multiplier); MultiplyDamageField(dmg, "m_spirit", multiplier); } private static void ApplyIncomingMultiplier(Traverse dmg, float multiplier) { MultiplyDamageField(dmg, "m_blunt", multiplier); MultiplyDamageField(dmg, "m_slash", multiplier); MultiplyDamageField(dmg, "m_pierce", multiplier); MultiplyDamageField(dmg, "m_fire", multiplier); MultiplyDamageField(dmg, "m_frost", multiplier); MultiplyDamageField(dmg, "m_lightning", multiplier); MultiplyDamageField(dmg, "m_poison", multiplier); MultiplyDamageField(dmg, "m_spirit", multiplier); } private static float GetIncomingDamageMultiplier() { float num = Mathf.Min(0.2f, Mathf.Max(0f, (float)(QuestLoopCount - 1) * 0.015f)); return CurrentClass switch { PlayerClass.Tanque => 0.8f + num, PlayerClass.Guerreiro => 0.95f + num, PlayerClass.Mago => 1.05f + num, _ => 1f + num, }; } private static void MultiplyDamageField(Traverse damageTraverse, string fieldName, float multiplier) { try { float value = damageTraverse.Field(fieldName).GetValue<float>(); damageTraverse.Field(fieldName).SetValue((object)(value * multiplier)); } catch { } } public static void AddXP(int amount, string source) { //IL_00d6: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Instance == (Object)null)) { CurrentXP += Mathf.Max(0, amount); ((BaseUnityPlugin)Instance).Logger.LogInfo((object)$"[XP] +{amount} XP por {source} ({GetClassDisplayName(CurrentClass)})"); bool flag = false; while (CurrentXP >= XPToNextLevel) { CurrentXP -= XPToNextLevel; CurrentLevel++; XPToNextLevel += 55; flag = true; ((BaseUnityPlugin)Instance).Logger.LogInfo((object)$"SUBIU DE NÍVEL! Agora você está no nível {CurrentLevel}"); Instance.PushTopAlert($"NÍVEL {CurrentLevel} ALCANÇADO!", new Color(0.45f, 1f, 0.45f, 1f), 3.2f); PlayLevelUpEffect(); } if (flag) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)$"Próximo nível em {XPToNextLevel} XP"); } SaveData(); } } private static void PlayLevelUpEffect() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) Type type = AccessTools.TypeByName("Player"); if (type == null) { return; } FieldInfo fieldInfo = AccessTools.Field(type, "m_localPlayer"); Component val = (Component)((fieldInfo != null) ? /*isinst with value type is only supported in some contexts*/: null); if ((Object)(object)val == (Object)null) { return; } try { Transform transform = val.transform; transform.localScale *= 1.02f; if ((Object)(object)Instance != (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)"Efeito de evolução aplicado."); } } catch { } } private static void TrySpawnBoss(object deadEnemy) { if (deadEnemy != null && !((Object)(object)Instance == (Object)null)) { float num = 0.02f + Mathf.Min(0.06f, (float)CurrentLevel * 0.001f) + Mathf.Min(0.04f, (float)(QuestLoopCount - 1) * 0.006f); if (CurrentClass == PlayerClass.Tanque) { num += 0.01f; } if (!(Random.value > num)) { SpawnBoss(deadEnemy); } } } private static void SpawnBoss(object deadEnemy) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) try { FieldInfo field = deadEnemy.GetType().GetField("m_nview", BindingFlags.Instance | BindingFlags.NonPublic); if (field == null) { return; } object value = field.GetValue(deadEnemy); if (value == null) { return; } MethodInfo method = value.GetType().GetMethod("GetZDO"); object obj = ((method != null) ? method.Invoke(value, null) : null); if (obj != null) { MethodInfo method2 = obj.GetType().GetMethod("GetPosition"); if (!(method2 == null)) { Vector3 pos = (Vector3)method2.Invoke(obj, null); SpawnBossAt(pos); } } } catch (Exception ex) { if ((Object)(object)Instance != (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)("Falha ao invocar chefe: " + ex.Message)); } } } private static void SpawnBossAt(Vector3 pos) { //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) string text = ((CurrentLevel < 25) ? "Greydwarf_Elite" : "Troll"); Type type = AccessTools.TypeByName("ZNetScene"); if (type == null) { return; } PropertyInfo property = type.GetProperty("instance", BindingFlags.Static | BindingFlags.Public); object obj = ((property != null) ? property.GetValue(null, null) : null); if (obj == null) { return; } MethodInfo method = type.GetMethod("GetPrefab", new Type[1] { typeof(string) }); if (method == null) { return; } GameObject val = (GameObject)method.Invoke(obj, new object[1] { text }); if ((Object)(object)val == (Object)null) { if ((Object)(object)Instance != (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)("Prefab de chefe não encontrado: " + text)); } return; } GameObject val2 = Object.Instantiate<GameObject>(val, pos + Vector3.forward * 4f, Quaternion.identity); if ((Object)(object)val2 == (Object)null) { return; } Transform transform = val2.transform; transform.localScale *= 1.8f + Mathf.Min(0.8f, (float)(QuestLoopCount - 1) * 0.05f); Transform transform2 = val2.transform; transform2.position += new Vector3(0f, 0.5f, 0f); ((Object)val2).name = "AncestralBoss"; try { Type type2 = AccessTools.TypeByName("Character"); if (type2 != null) { Component component = val2.GetComponent(type2); if ((Object)(object)component != (Object)null) { FieldInfo fieldInfo = AccessTools.Field(type2, "m_name"); if (fieldInfo != null) { fieldInfo.SetValue(component, "ancestral"); } } } } catch { } string text2 = ((text == "Troll") ? "Troll Ancestral" : "Elite Ancestral"); if ((Object)(object)Instance != (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)$"CHEFE SURGIU: {text2} | Loop {QuestLoopCount} | Nível {CurrentLevel}"); Instance.PushTopAlert("CHEFE SURGIU: " + text2, new Color(1f, 0.5f, 0.22f, 1f), 3.2f); } } private static float GetLootMultiplier() { float num = 1.45f + Mathf.Min(0.55f, (float)(QuestLoopCount - 1) * 0.06f); if (CurrentLevel >= 25) { num += 0.15f; } if (CurrentLevel >= 50) { num += 0.15f; } return Mathf.Clamp(num, 1.45f, 2.3f); } private static float GetRareBonus() { float num = 0f; if (CurrentClass == PlayerClass.Mago) { num += 0.05f; } return num + Mathf.Min(0.08f, (float)(QuestLoopCount - 1) * 0.01f); } private static void OnLootGenerated(ref List<KeyValuePair<GameObject, int>> __result) { if (__result == null || __result.Count == 0 || (Object)(object)Instance == (Object)null) { return; } List<KeyValuePair<GameObject, int>> list = new List<KeyValuePair<GameObject, int>>(); foreach (KeyValuePair<GameObject, int> item in __result) { if (!((Object)(object)item.Key == (Object)null)) { int num = Mathf.Max(1, item.Value); int value = Mathf.Max(1, Mathf.RoundToInt((float)num * GetLootMultiplier())); list.Add(new KeyValuePair<GameObject, int>(item.Key, value)); float value2 = Random.value; float rareBonus = GetRareBonus(); if (value2 < 0.03f + rareBonus) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)("DROP LENDÁRIO! (" + ((Object)item.Key).name + ")")); } else if (value2 < 0.1f + rareBonus) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)("DROP ÉPICO! (" + ((Object)item.Key).name + ")")); } else if (value2 < 0.22f + rareBonus) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)("DROP RARO! (" + ((Object)item.Key).name + ")")); } } } __result = list; } private static void SaveData() { PlayerPrefs.SetInt("MMO_Level", CurrentLevel); PlayerPrefs.SetInt("MMO_XP", CurrentXP); PlayerPrefs.SetInt("MMO_XPNext", XPToNextLevel); PlayerPrefs.SetInt("MMO_Class", (int)CurrentClass); PlayerPrefs.SetInt("Quest_Current_Index", CurrentQuestIndex); PlayerPrefs.SetInt("Quest_Current_Progress", CurrentQuestProgress); PlayerPrefs.SetInt("Quest_Loop_Count", QuestLoopCount); PlayerPrefs.SetInt("Quest_Show_Hud", ShowHud ? 1 : 0); PlayerPrefs.Save(); } private static void LoadData() { CurrentLevel = PlayerPrefs.GetInt("MMO_Level", 1); CurrentXP = PlayerPrefs.GetInt("MMO_XP", 0); XPToNextLevel = PlayerPrefs.GetInt("MMO_XPNext", 100); CurrentClass = (PlayerClass)PlayerPrefs.GetInt("MMO_Class", 0); CurrentQuestIndex = PlayerPrefs.GetInt("Quest_Current_Index", 0); CurrentQuestProgress = PlayerPrefs.GetInt("Quest_Current_Progress", 0); QuestLoopCount = PlayerPrefs.GetInt("Quest_Loop_Count", 1); ShowHud = PlayerPrefs.GetInt("Quest_Show_Hud", 1) == 1; } private static void ClampLoadedData() { if (CurrentLevel < 1) { CurrentLevel = 1; } if (CurrentXP < 0) { CurrentXP = 0; } if (XPToNextLevel < 100) { XPToNextLevel = 100; } if (CurrentQuestIndex < 0 || CurrentQuestIndex >= QuestChain.Count) { CurrentQuestIndex = 0; } if (CurrentQuestProgress < 0) { CurrentQuestProgress = 0; } if (QuestLoopCount < 1) { QuestLoopCount = 1; } } private void LoadRegionData() { try { string currentWorldName = GetCurrentWorldName(); _worldState = new WorldStateData(); _worldState.WorldName = currentWorldName; string text = "MMO_WORLD_STATE_" + currentWorldName; string text2 = "MMO_REGION_DATA_" + currentWorldName; string @string = PlayerPrefs.GetString(text, ""); if (!string.IsNullOrWhiteSpace(@string)) { ParseWorldState(@string, _worldState); } _regionStates.Clear(); string string2 = PlayerPrefs.GetString(text2, ""); if (!string.IsNullOrWhiteSpace(string2)) { ParseRegionCollection(string2); } ((BaseUnityPlugin)this).Logger.LogInfo((object)$"WorldData carregado: mundo={_worldState.WorldName} | regiões={_regionStates.Count}"); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Falha ao carregar WorldData: " + ex.Message)); _worldState = new WorldStateData(); _worldState.WorldName = GetCurrentWorldName(); _regionStates.Clear(); } } private void SaveRegionData() { try { if (_worldState == null) { _worldState = new WorldStateData(); } _worldState.WorldName = GetCurrentWorldName(); _worldState.LastRegionId = _lastKnownRegionId ?? ""; _worldState.LastRegionName = _lastKnownRegionName ?? ""; string text = "MMO_WORLD_STATE_" + _worldState.WorldName; string text2 = "MMO_REGION_DATA_" + _worldState.WorldName; PlayerPrefs.SetString(text, SerializeWorldState(_worldState)); PlayerPrefs.SetString(text2, SerializeRegionCollection()); PlayerPrefs.Save(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Falha ao salvar WorldData: " + ex.Message)); } } private void ClampRegionData() { if (_worldState == null) { _worldState = new WorldStateData(); } if (string.IsNullOrWhiteSpace(_worldState.WorldName)) { _worldState.WorldName = GetCurrentWorldName(); } if (_worldState.RegionUnlockCount < 0) { _worldState.RegionUnlockCount = 0; } if (_worldState.TotalMonstrumSpawned < 0) { _worldState.TotalMonstrumSpawned = 0; } if (_worldState.TotalMonstrumDefeated < 0) { _worldState.TotalMonstrumDefeated = 0; } List<string> list = new List<string>(); foreach (KeyValuePair<string, RegionProgressEntry> regionState in _regionStates) { if (string.IsNullOrWhiteSpace(regionState.Key) || regionState.Value == null) { list.Add(regionState.Key); continue; } if (regionState.Value.VisitCount < 0) { regionState.Value.VisitCount = 0; } if (string.IsNullOrWhiteSpace(regionState.Value.RegionName)) { regionState.Value.RegionName = regionState.Key; } if (string.IsNullOrWhiteSpace(regionState.Value.BiomeName)) { regionState.Value.BiomeName = "Unknown"; } } foreach (string item in list) { _regionStates.Remove(item); } } private void UpdateRegionSystem() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) try { Component localPlayerComponent = GetLocalPlayerComponent(); if ((Object)(object)localPlayerComponent == (Object)null) { return; } _didInitialRegionScan = true; Vector3 position = localPlayerComponent.transform.position; string playerBiomeName = GetPlayerBiomeName(position); string text = BuildRegionIdFromBiome(playerBiomeName); string text2 = BuildRegionDisplayName(playerBiomeName); if (!string.IsNullOrWhiteSpace(text)) { RegionProgressEntry orCreateRegion = GetOrCreateRegion(text, text2, playerBiomeName); if (text != _lastKnownRegionId) { _lastKnownRegionId = text; _lastKnownRegionName = text2; _lastKnownBiomeName = playerBiomeName; orCreateRegion.Visited = true; orCreateRegion.VisitCount++; UnlockRegion(text); PushTopAlert("Nova região: " + text2, GetBiomeColor(playerBiomeName), 3f); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Entrou na região " + text2 + " (" + playerBiomeName + ")")); } _worldState.LastRegionId = _lastKnownRegionId; _worldState.LastRegionName = _lastKnownRegionName; DetectMonstrumOnce(orCreateRegion); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Falha em UpdateRegionSystem: " + ex.Message)); } } private void TryManualRegionRefresh() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) try { UpdateRegionSystem(); if (!string.IsNullOrWhiteSpace(_lastKnownRegionName)) { PushTopAlert("Região atual: " + _lastKnownRegionName, new Color(0.8f, 0.9f, 1f, 1f), 2f); } SaveRegionData(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Falha em TryManualRegionRefresh: " + ex.Message)); } } private void UnlockRegion(string regionId) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrWhiteSpace(regionId)) { RegionProgressEntry orCreateRegion = GetOrCreateRegion(regionId, regionId, _lastKnownBiomeName); if (!orCreateRegion.Unlocked) { orCreateRegion.Unlocked = true; _worldState.RegionUnlockCount++; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Região desbloqueada: " + orCreateRegion.RegionName)); PushTopAlert("Região desbloqueada: " + orCreateRegion.RegionName, new Color(1f, 0.82f, 0.22f, 1f), 3.2f); SaveRegionData(); } } } private void DetectMonstrumOnce(RegionProgressEntry region) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) if (region == null || region.MonstrumSpawned || region.MonstrumDefeated || !CanRegionSpawnMonstrum(region.BiomeName)) { return; } Component localPlayerComponent = GetLocalPlayerComponent(); if ((Object)(object)localPlayerComponent == (Object)null) { return; } float monstrumChanceForRegion = GetMonstrumChanceForRegion(region.BiomeName); if (!(Random.value > monstrumChanceForRegion)) { Vector3 val = localPlayerComponent.transform.position + localPlayerComponent.transform.forward * 18f; val += new Vector3(Random.Range(-8f, 8f), 0f, Random.Range(-8f, 8f)); GameObject val2 = SpawnMonstrumAt(region, val); if (!((Object)(object)val2 == (Object)null)) { region.MonstrumSpawned = true; _worldState.TotalMonstrumSpawned++; ((BaseUnityPlugin)this).Logger.LogInfo((object)("MONSTRUM detectado na região " + region.RegionName)); PushTopAlert("MONSTRUM DETECTADO: " + region.RegionName, new Color(1f, 0.32f, 0.22f, 1f), 3.4f); SaveRegionData(); } } } private static void TryHandleMonstrumDeath(object deadEnemy, string enemyName) { //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Instance == (Object)null) { return; } string text = NormalizeText(enemyName); if (!string.IsNullOrWhiteSpace(text) && text.Contains("monstrum")) { string lastKnownRegionId = Instance._lastKnownRegionId; if (!string.IsNullOrWhiteSpace(lastKnownRegionId) && Instance._regionStates.TryGetValue(lastKnownRegionId, out var value) && value != null && !value.MonstrumDefeated) { value.MonstrumDefeated = true; Instance._worldState.TotalMonstrumDefeated++; int amount = 450 + Mathf.Min(600, CurrentLevel * 8); AddXP(amount, "Monstrum"); SpawnRewardPrefab("Coins", GetSafePlayerPosition() + Vector3.right * 1.5f, 120 + CurrentLevel * 2); ((BaseUnityPlugin)Instance).Logger.LogInfo((object)("MONSTRUM derrotado em " + value.RegionName)); Instance.PushTopAlert("MONSTRUM DERROTADO: " + value.RegionName, new Color(0.45f, 1f, 0.45f, 1f), 3.6f); Instance.SaveRegionData(); } } } private GameObject SpawnMonstrumAt(RegionProgressEntry region, Vector3 pos) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) string monstrumPrefabForBiome = GetMonstrumPrefabForBiome(region.BiomeName); GameObject prefabByName = GetPrefabByName(monstrumPrefabForBiome); if ((Object)(object)prefabByName == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Monstrum prefab não encontrado: " + monstrumPrefabForBiome)); return null; } GameObject val = Object.Instantiate<GameObject>(prefabByName, pos, Quaternion.identity); if ((Object)(object)val == (Object)null) { return null; } ((Object)val).name = "Monstrum_" + NormalizeText(region.RegionName); try { Transform transform = val.transform; transform.localScale *= GetMonstrumScaleForBiome(region.BiomeName); } catch { } try { Type type = AccessTools.TypeByName("Character"); if (type != null) { Component component = val.GetComponent(type); if ((Object)(object)component != (Object)null) { FieldInfo fieldInfo = AccessTools.Field(type, "m_name"); if (fieldInfo != null) { fieldInfo.SetValue(component, "monstrum"); } } } } catch { } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Spawnado Monstrum: " + ((Object)val).name + " / prefab=" + monstrumPrefabForBiome)); return val; } private RegionProgressEntry GetOrCreateRegion(string regionId, string regionName, string biomeName) { if (_regionStates.TryGetValue(regionId, out var value) && value != null) { if (string.IsNullOrWhiteSpace(value.RegionName)) { value.RegionName = regionName; } if (string.IsNullOrWhiteSpace(value.BiomeName)) { value.BiomeName = biomeName; } return value; } value = new RegionProgressEntry(); value.RegionId = regionId; value.RegionName = regionName; value.BiomeName = biomeName; _regionStates[regionId] = value; return value; } private string GetCurrentWorldName() { try { Type type = AccessTools.TypeByName("ZNet"); if (type != null) { PropertyInfo property = type.GetProperty("instance", BindingFlags.Static | BindingFlags.Public); object obj = ((property != null) ? property.GetValue(null, null) : null); if (obj != null) { MethodInfo method = type.GetMethod("GetWorldName", BindingFlags.Instance | BindingFlags.Public); if (method != null) { object obj2 = method.Invoke(obj, null); if (obj2 != null) { string value = obj2.ToString(); if (!string.IsNullOrWhiteSpace(value)) { return NormalizeSaveKey(value); } } } } } } catch { } return "world_default"; } private static string NormalizeSaveKey(string value) { if (string.IsNullOrWhiteSpace(value)) { return "world_default"; } return value.Trim().Replace(" ", "_").Replace("/", "_") .Replace("\\", "_"); } private Component GetLocalPlayerComponent() { try { Type type = AccessTools.TypeByName("Player"); if (type == null) { return null; } FieldInfo fieldInfo = AccessTools.Field(type, "m_localPlayer"); return (Component)((fieldInfo != null) ? /*isinst with value type is only supported in some contexts*/: null); } catch { return null; } } private static Vector3 GetSafePlayerPosition() { //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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Instance == (Object)null) { return Vector3.zero; } Component localPlayerComponent = Instance.GetLocalPlayerComponent(); if ((Object)(object)localPlayerComponent == (Object)null) { return Vector3.zero; } return localPlayerComponent.transform.position; } private string GetPlayerBiomeName(Vector3 pos) { //IL_005a: 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) string text = "Unknown"; try { Type type = AccessTools.TypeByName("Heightmap"); if (type != null) { MethodInfo methodInfo = AccessTools.Method(type, "FindBiome", new Type[1] { typeof(Vector3) }, (Type[])null); if (methodInfo != null) { object obj = methodInfo.Invoke(null, new object[1] { pos }); if (obj != null) { text = obj.ToString(); if (!string.IsNullOrWhiteSpace(text)) { return text; } } } } Type type2 = AccessTools.TypeByName("ZoneSystem"); if (type2 != null) { PropertyInfo property = type2.GetProperty("instance", BindingFlags.Static | BindingFlags.Public); object obj2 = ((property != null) ? property.GetValue(null, null) : null); if (obj2 != null) { MethodInfo method = type2.GetMethod("GetBiome", BindingFlags.Instance | BindingFlags.Public); if (method != null) { object obj3 = method.Invoke(obj2, new object[1] { pos }); if (obj3 != null) { text = obj3.ToString(); if (!string.IsNullOrWhiteSpace(text)) { return text; } } } } } } catch { } return text; } private string BuildRegionIdFromBiome(string biomeName) { string text = NormalizeText(biomeName); if (string.IsNullOrWhiteSpace(text)) { return "region_unknown"; } return "region_" + text; } private string BuildRegionDisplayName(string biomeName) { return NormalizeText(biomeName) switch { "meadows" => "Pradarias", "blackforest" => "Floresta Negra", "swamp" => "Pântano", "mountain" => "Montanha", "plains" => "Planícies", "mistlands" => "Terras Nebulosas", "ashlands" => "Terras Cinzentas", "deepnorth" => "Norte Profundo", "ocean" => "Oceano", _ => string.IsNullOrWhiteSpace(biomeName) ? "Região Desconhecida" : biomeName, }; } private bool CanRegionSpawnMonstrum(string biomeName) { string text = NormalizeText(biomeName); int result; switch (text) { default: result = ((text == "deepnorth") ? 1 : 0); break; case "blackforest": case "swamp": case "mountain": case "plains": case "mistlands": case "ashlands": result = 1; break; } return (byte)result != 0; } private float GetMonstrumChanceForRegion(string biomeName) { return NormalizeText(biomeName) switch { "blackforest" => 0.16f, "swamp" => 0.18f, "mountain" => 0.18f, "plains" => 0.2f, "mistlands" => 0.24f, "ashlands" => 0.26f, "deepnorth" => 0.22f, _ => 0f, }; } private string GetMonstrumPrefabForBiome(string biomeName) { return NormalizeText(biomeName) switch { "blackforest" => "Troll", "swamp" => "Abomination", "mountain" => "Fenring", "plains" => "GoblinBrute", "mistlands" => "SeekerBrute", "ashlands" => "Charred_Melee", "deepnorth" => "Wolf", _ => "Greydwarf_Elite", }; } private float GetMonstrumScaleForBiome(string biomeName) { return NormalizeText(biomeName) switch { "blackforest" => 1.65f, "swamp" => 1.7f, "mountain" => 1.55f, "plains" => 1.75f, "mistlands" => 1.8f, "ashlands" => 1.85f, "deepnorth" => 1.6f, _ => 1.5f, }; } private GameObject GetPrefabByName(string prefabName) { try { Type type = AccessTools.TypeByName("ZNetScene"); if (type == null) { return null; } PropertyInfo property = type.GetProperty("instance", BindingFlags.Static | BindingFlags.Public); object obj = ((property != null) ? property.GetValue(null, null) : null); if (obj == null) { return null; } MethodInfo method = type.GetMethod("GetPrefab", new Type[1] { typeof(string) }); if (method == null) { return null; } object? obj2 = method.Invoke(obj, new object[1] { prefabName }); GameObject val = (GameObject)((obj2 is GameObject) ? obj2 : null); if ((Object)(object)val != (Object)null) { return val; } string[] fallbackPrefabs = GetFallbackPrefabs(prefabName); string[] array = fallbackPrefabs; foreach (string text in array) { object? obj3 = method.Invoke(obj, new object[1] { text }); val = (GameObject)((obj3 is GameObject) ? obj3 : null); if ((Object)(object)val != (Object)null) { return val; } } } catch { } return null; } private string[] GetFallbackPrefabs(string prefabName) { return NormalizeText(prefabName) switch { "charredmelee" => new string[4] { "Charred_Archer", "Asksvin", "SeekerBrute", "GoblinBrute" }, "goblinbrute" => new string[3] { "FulingBerserker", "Goblin", "Troll" }, "fenring" => new string[3] { "Wolf", "StoneGolem", "Drake" }, "abomination" => new string[3] { "BlobTar", "DraugrElite", "Wraith" }, "seekerbrute" => new string[3] { "Seeker", "Gjall", "GoblinBrute" }, _ => new string[3] { "Greydwarf_Elite", "Troll", "Wolf" }, }; } private Color GetBiomeColor(string biomeName) { //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) return (Color)(NormalizeText(biomeName) switch { "meadows" => new Color(0.55f, 1f, 0.55f, 1f), "blackforest" => new Color(0.4f, 0.85f, 1f, 1f), "swamp" => new Color(0.55f, 0.9f, 0.35f, 1f), "mountain" => new Color(0.85f, 0.92f, 1f, 1f), "plains" => new Color(1f, 0.84f, 0.25f, 1f), "mistlands" => new Color(0.78f, 0.72f, 1f, 1f), "ashlands" => new Color(1f, 0.45f, 0.25f, 1f), "deepnorth" => new Color(0.72f, 0.92f, 1f, 1f), "ocean" => new Color(0.35f, 0.75f, 1f, 1f), _ => Color.white, }); } private void PushTopAlert(string text, Color color, float duration = 2.5f) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrWhiteSpace(text)) { _topAlerts.Add(new TopAlertData(text, color, Mathf.Max(1f, duration))); if (_topAlerts.Count > 4) { _topAlerts.RemoveAt(0); } } } private void CleanupTopAlerts() { for (int num = _topAlerts.Count - 1; num >= 0; num--) { if (_topAlerts[num] == null || _topAlerts[num].Expired) { _topAlerts.RemoveAt(num); } } } private static string GetClassDisplayName(PlayerClass playerClass) { return playerClass switch { PlayerClass.Guerreiro => "Guerreiro", PlayerClass.Tanque => "Tanque", PlayerClass.Mago => "Mago", _ => playerClass.ToString(), }; } private static Color GetClassColor(PlayerClass playerClass) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) return (Color)(playerClass switch { PlayerClass.Guerreiro => new Color(1f, 0.84f, 0.22f, 1f), PlayerClass.Tanque => new Color(0.73f, 1f, 0.2f, 1f), PlayerClass.Mago => new Color(0.6f, 0.85f, 1f, 1f), _ => Color.white, }); } private static string GetQuestTypeDisplayName(QuestType questType) { return questType switch { QuestType.Kill => "Caçada", QuestType.Collect => "Coleta", QuestType.Boss => "Chefe", _ => questType.ToString(), }; } private void OnGUI() { DrawTopAlerts(); DrawWideHud(); } private void DrawTextOutline(Rect rect, string text, GUIStyle style, Color mainColor, Color outlineColor) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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) Color textColor = style.normal.textColor; style.normal.textColor = outlineColor; GUI.Label(new Rect(((Rect)(ref rect)).x - 1f, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height), text, style); GUI.Label(new Rect(((Rect)(ref rect)).x + 1f, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height), text, style); GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y - 1f, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height), text, style); GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + 1f, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height), text, style); style.normal.textColor = mainColor; GUI.Label(rect, text, style); style.normal.textColor = textColor; } private void DrawTopAlerts() { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) if (_topAlerts == null || _topAlerts.Count == 0 || (Object)(object)_topAlertBgTexture == (Object)null) { return; } TopAlertData topAlertData = _topAlerts[_topAlerts.Count - 1]; if (topAlertData != null) { float num = Screen.width; float num2 = Mathf.Min(760f, num - 80f); float num3 = 58f; float num4 = (num - num2) * 0.5f; float num5 = 26f; float num6 = 1f; if (topAlertData.Age < 0.2f) { num6 = Mathf.Clamp01(topAlertData.Age / 0.2f); } else if (topAlertData.Remaining < 0.3f) { num6 = Mathf.Clamp01(topAlertData.Remaining / 0.3f); } Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, num6); GUI.DrawTexture(new Rect(num4, num5, num2, num3), (Texture)(object)_topAlertBgTexture); GUI.DrawTexture(new Rect(num4 + 6f, num5 + 6f, 6f, num3 - 12f), (Texture)(object)_topAlertAccentTexture); DrawTextOutline(new Rect(num4 + 18f, num5 + 8f, num2 - 36f, 26f), topAlertData.Text, _topAlertStyle, topAlertData.Color, Color.black); string text = ""; if (!string.IsNullOrWhiteSpace(_lastKnownRegionName)) { text = "Região: " + _lastKnownRegionName; } else if (!string.IsNullOrWhiteSpace(_lastKnownBiomeName)) { text = "Bioma: " + _lastKnownBiomeName; } if (!string.IsNullOrWhiteSpace(text)) { DrawTextOutline(new Rect(num4 + 18f, num5 + 31f, num2 - 36f, 18f), text, _topAlertSmallStyle, new Color(0.92f, 0.92f, 0.92f, 1f), Color.black); } GUI.color = color; } } private void DrawWideHud() { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0520: Unknown result type (might be due to invalid IL or missing references) //IL_0544: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_0568: Unknown result type (might be due to invalid IL or missing references) //IL_0586: Unknown result type (might be due to invalid IL or missing references) //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_05da: Unknown result type (might be due to invalid IL or missing references) //IL_05f9: Unknown result type (might be due to invalid IL or missing references) //IL_064d: Unknown result type (might be due to invalid IL or missing references) //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_0652: Unknown result type (might be due to invalid IL or missing references) //IL_0671: Unknown result type (might be due to invalid IL or missing references) //IL_06aa: Unknown result type (might be due to invalid IL or missing references) //IL_06af: Unknown result type (might be due to invalid IL or missing references) //IL_06e9: Unknown result type (might be due to invalid IL or missing references) //IL_0733: Unknown result type (might be due to invalid IL or missing references) if (!ShowHud || (Object)(object)_panelTexture == (Object)null || (Object)(object)_barBgTexture == (Object)null || (Object)(object)_barFillTexture == (Object)null || QuestChain.Count == 0) { return; } QuestDefinition scaledQuest = GetScaledQuest(); float num = Screen.width; float num2 = Screen.height; float num3 = 205f; float num4 = num - 285f; float num5 = 112f; float num6 = num2 - 117f; if (num4 < 760f) { num4 = 760f; } GUI.DrawTexture(new Rect(num3, num6, num4, num5), (Texture)(object)_panelTexture); float num7 = num6 + 5f; float num8 = num6 + 25f; float num9 = num6 + 44f; float num10 = num6 + 63f; string text = (string.IsNullOrWhiteSpace(_lastKnownRegionName) ? "—" : _lastKnownRegionName); string text2 = (string.IsNullOrWhiteSpace(_lastKnownBiomeName) ? "—" : _lastKnownBiomeName); string text3 = "Sem sinal"; if (_regionStates.TryGetValue(_lastKnownRegionId ?? "", out var value) && value != null) { if (value.MonstrumDefeated) { text3 = "Derrotado"; } else if (value.MonstrumSpawned) { text3 = "Ativo"; } } DrawTextOutline(new Rect(num3 + 12f, num7, 120f, 20f), "Carlos MMO", _titleStyle, Color.white, Color.black); DrawTextOutline(new Rect(num3 + 135f, num7, 70f, 20f), "Classe:", _classLabelStyle, new Color(0.98f, 0.83f, 0.18f, 1f), Color.black); DrawTextOutline(new Rect(num3 + 205f, num7, 140f, 20f), GetClassDisplayName(CurrentClass), _classLabelStyle, GetClassColor(CurrentClass), Color.black); DrawTextOutline(new Rect(num3 + 305f, num7, 95f, 20f), $"Nível: {CurrentLevel}", _whiteInfoStyle, new Color(0.88f, 0.95f, 1f, 1f), Color.black); DrawTextOutline(new Rect(num3 + 395f, num7, 80f, 20f), $"Loop: {QuestLoopCount}", _whiteInfoStyle, new Color(0.92f, 0.86f, 1f, 1f), Color.black); DrawTextOutline(new Rect(num3 + 470f, num7, 185f, 20f), $"XP Atual: {CurrentXP}/{XPToNextLevel}", _whiteInfoStyle, new Color(0.75f, 0.9f, 1f, 1f), Color.black); DrawTextOutline(new Rect(num3 + 12f, num8, 72f, 20f), "Missão:", _questLabelStyle, new Color(0.98f, 0.83f, 0.18f, 1f), Color.black); DrawTextOutline(new Rect(num3 + 84f, num8, num4 - 96f, 20f), GetDisplayQuestTitle(scaledQuest), _textStyle, Color.white, Color.black); DrawTextOutline(new Rect(num3 + 12f, num9, 120f, 18f), "Tipo: " + GetQuestTypeDisplayName(scaledQuest.Type), _smallStyle, new Color(0.55f, 0.85f, 1f, 1f), Color.black); DrawTextOutline(new Rect(num3 + 140f, num9, 170f, 18f), $"Progresso: {CurrentQuestProgress}/{scaledQuest.Goal}", _smallStyle, Color.white, Color.black); DrawTextOutline(new Rect(num3 + 320f, num9, 110f, 18f), $"XP: +{scaledQuest.RewardXP}", _smallStyle, new Color(0.55f, 1f, 0.55f, 1f), Color.black); DrawTextOutline(new Rect(num3 + 435f, num9, 125f, 18f), $"Moedas: {scaledQuest.RewardCoins}", _smallStyle, new Color(1f, 0.78f, 0.3f, 1f), Color.black); DrawTextOutline(new Rect(num3 + 565f, num9, 220f, 18f), "F6 classe | F7 região | F8 HUD", _smallStyle, new Color(0.86f, 0.86f, 0.86f, 1f), Color.black); DrawTextOutline(new Rect(num3 + 12f, num10, 240f, 18f), "Região: " + text, _smallStyle, GetBiomeColor(_lastKnownBiomeName), Color.black); DrawTextOutline(new Rect(num3 + 260f, num10, 170f, 18f), "Bioma: " + text2, _smallStyle, new Color(0.85f, 0.92f, 1f, 1f), Color.black); DrawTextOutline(new Rect(num3 + 440f, num10, 185f, 18f), "Monstrum: " + text3, _smallStyle, (text3 == "Ativo") ? new Color(1f, 0.4f, 0.25f, 1f) : new Color(0.65f, 1f, 0.65f, 1f), Color.black); DrawTextOutline(new Rect(num3 + 630f, num10, 200f, 18f), $"Regiões: {_worldState.RegionUnlockCount}", _smallStyle, new Color(1f, 0.84f, 0.22f, 1f), Color.black); float num11 = num3 + 12f; float num12 = num6 + num5 - 8f; float num13 = num4 - 24f; float num14 = 5f; GUI.DrawTexture(new Rect(num11, num12, num13, num14), (Texture)(object)_barBgTexture); float num15 = ((XPToNextLevel > 0) ? ((float)CurrentXP / (float)XPToNextLevel) : 0f); num15 = Mathf.Clamp01(num15); GUI.DrawTexture(new Rect(num11, num12, num13 * num15 * _uiPulse, num14), (Texture)(object)_barFillTexture); } private string SerializeWorldState(WorldStateData state) { if (state == null) { return ""; } return string.Join(";", EscapeData(state.WorldName), EscapeData(state.LastRegionId), EscapeData(state.LastRegionName), state.RegionUnlockCount.ToString(), state.TotalMonstrumSpawned.ToString(), state.TotalMonstrumDefeated.ToString()); } private void ParseWorldState(string raw, WorldStateData target) { if (target != null && !string.IsNullOrWhiteSpace(raw)) { string[] array = raw.Split(new char[1] { ';' }, StringSplitOptions.None); target.WorldName = ((array.Length != 0) ? UnescapeData(array[0]) : "world_default"); target.LastRegionId = ((array.Length > 1) ? UnescapeData(array[1]) : ""); target.LastRegionName = ((array.Length > 2) ? UnescapeData(array[2]) : ""); target.RegionUnlockCount = ((array.Length > 3) ? ParseIntSafe(array[3], 0) : 0); target.TotalMonstrumSpawned = ((array.Length > 4) ? ParseIntSafe(array[4], 0) : 0); target.TotalMonstrumDefeated = ((array.Length > 5) ? ParseIntSafe(array[5], 0) : 0); } } private string SerializeRegionCollection() { StringBuilder stringBuilder = new StringBuilder(); foreach (KeyValuePair<string, RegionProgressEntry> regionState in _regionStates) { RegionProgressEntry value = regionState.Value; if (value != null) { if (stringBuilder.Length > 0) { stringBuilder.Append("||"); } stringBuilder.Append(EscapeData(value.RegionId)).Append(";"); stringBuilder.Append(EscapeData(value.RegionName)).Append(";"); stringBuilder.Append(EscapeData(value.BiomeName)).Append(";"); stringBuilder.Append(value.Unlocked ? "1" : "0").Append(";"); stringBuilder.Append(value.Visited ? "1" : "0").Append(";"); stringBuilder.Append(value.MonstrumSpawned ? "1" : "0").Append(";"); stringBuilder.Append(value.MonstrumDefeated ? "1" : "0").Append(";"); stringBuilder.Append(value.VisitCount.ToString()); } } return stringBuilder.ToString(); } private void ParseRegionCollection(string raw) { if (string.IsNullOrWhiteSpace(raw)) { return; } string[] array = raw.Split(new string[1] { "||" }, StringSplitOptions.RemoveEmptyEntries); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Split(new char[1] { ';' }, StringSplitOptions.None); if (array3.Length >= 8) { RegionProgressEntry regionProgressEntry = new RegionProgressEntry(); regionProgressEntry.RegionId = UnescapeData(array3[0]); regionProgressEntry.RegionName = UnescapeData(array3[1]); regionProgressEntry.BiomeName = UnescapeData(array3[2]); regionProgressEntry.Unlocked = array3[3] == "1"; regionProgressEntry.Visited = array3[4] == "1"; regionProgressEntry.MonstrumSpawned = array3[5] == "1"; regionProgressEntry.MonstrumDefeated = array3[6] == "1"; regionProgressEntry.VisitCount = ParseIntSafe(array3[7], 0); if (!string.IsNullOrWhiteSpace(regionProgressEntry.RegionId)) { _regionStates[regionProgressEntry.RegionId] = regionProgressEntry; } } } } private static int ParseIntSafe(string raw, int fallback) { if (int.TryParse(raw, out var result)) { return result; } return fallback; } private static string EscapeData(string value) { if (value == null) { return ""; } return value.Replace("%", "%25").Replace(";", "%3B").Replace("|", "%7C") .Replace("\n", "%0A") .Replace("\r", "%0D"); } private static string UnescapeData(string value) { if (value == null) { return ""; } return value.Replace("%0D", "\r").Replace("%0A", "\n").Replace("%7C", "|") .Replace("%3B", ";") .Replace("%25", "%"); } }