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 RagnarokValheim v0.14.0
plugins/RagnarokValheim.dll
Decompiled 5 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using RagnarokValheim.Content; using RagnarokValheim.Core; using RagnarokValheim.Data; using RagnarokValheim.Patches; using RagnarokValheim.UI; using Splatform; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] namespace RagnarokValheim { [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("ragheim.ragnarokvalheim", "RagnarokValheim", "0.14.0")] public class Plugin : BaseUnityPlugin { public const string Guid = "ragheim.ragnarokvalheim"; public const string ModName = "RagnarokValheim"; public const string Version = "0.14.0"; public static Plugin Instance; public static ManualLogSource Log; private Harmony _harmony; private void Awake() { //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; RoConfig.Bind(((BaseUnityPlugin)this).Config); PrefabManager.OnVanillaPrefabsAvailable += OnVanillaPrefabsAvailable; Commands.Register(); ((Component)this).gameObject.AddComponent<RoGui>(); ((Component)this).gameObject.AddComponent<RoHud>(); ((Component)this).gameObject.AddComponent<DungeonSystem>(); ((Component)this).gameObject.AddComponent<QualityOfLife>(); ((Component)this).gameObject.AddComponent<PartyHud>(); ((Component)this).gameObject.AddComponent<WorldEvents>(); ((Component)this).gameObject.AddComponent<CampSystem>(); ((Component)this).gameObject.AddComponent<Marker>(); ((Component)this).gameObject.AddComponent<SongAura>(); ((Component)this).gameObject.AddComponent<RefineGlow>(); ((Component)this).gameObject.AddComponent<TowerAura>(); ((Component)this).gameObject.AddComponent<RewardGui>(); ((Component)this).gameObject.AddComponent<MapCoords>(); ((Component)this).gameObject.AddComponent<Measure>(); ((Component)this).gameObject.AddComponent<RoTicker>(); _harmony = new Harmony("ragheim.ragnarokvalheim"); _harmony.PatchAll(typeof(Plugin).Assembly); Log.LogInfo((object)"RagnarokValheim 0.14.0 carregado."); } private void OnVanillaPrefabsAvailable() { RoItems.Register(); CardItems.Register(); Stations.Register(); SkillStatusEffects.Register(); EquipItems.Register(); try { Log.LogInfo((object)("Wiki do mod salva em: " + WikiExport.Export())); } catch (Exception ex) { Log.LogWarning((object)("Não foi possível salvar a wiki: " + ex.Message)); } PrefabManager.OnVanillaPrefabsAvailable -= OnVanillaPrefabsAvailable; } private void OnDestroy() { if (_harmony != null) { _harmony.UnpatchSelf(); } } } public static class RoConfig { public static ConfigEntry<float> ExpPerHp; public static ConfigEntry<float> BossExpMultiplier; public static ConfigEntry<float> JobExpRatio; public static ConfigEntry<float> ExpRate; public static ConfigEntry<float> ShareRange; public static ConfigEntry<float> ExpCurveMultiplier; public static ConfigEntry<float> ZenyPerExp; public static ConfigEntry<float> ZenyRate; public static ConfigEntry<bool> ConvertCoins; public static ConfigEntry<float> HpPerLevel; public static ConfigEntry<float> SpBase; public static ConfigEntry<float> SpPerLevel; public static ConfigEntry<float> SpPerInt; public static ConfigEntry<float> HpRegenPerSec; public static ConfigEntry<float> SpRegenPerSec; public static ConfigEntry<float> SpRegenPerInt; public static ConfigEntry<float> RegenDelay; public static ConfigEntry<float> OffenseStatScale; public static ConfigEntry<float> DefenseStatScale; public static ConfigEntry<float> MaxFlee; public static ConfigEntry<float> MaxVitReduction; public static ConfigEntry<float> CritMultiplier; public static ConfigEntry<float> AspdPerAgi; public static ConfigEntry<float> DrawPerAgi; public static ConfigEntry<float> MaxAttackSpeed; public static ConfigEntry<float> MaxDrawSpeed; public static ConfigEntry<float> CardDropChance; public static ConfigEntry<float> MvpCardDropChance; public static ConfigEntry<float> CardRemovalCostMultiplier; public static ConfigEntry<int> WeaponSecondSlotQuality; public static ConfigEntry<float> RefineMaterialDropChance; public static ConfigEntry<int> RefineZenyBase; public static ConfigEntry<string> RefineSuccessRates; public static ConfigEntry<float> SupportRange; public static ConfigEntry<float> GroupRange; public static ConfigEntry<float> GroupHpPerPlayer; public static ConfigEntry<float> GroupDmgPerPlayer; public static ConfigEntry<float> BossHpPerPlayer; public static ConfigEntry<float> PartyExpBonus; public static ConfigEntry<bool> ShowPartyHud; public static ConfigEntry<string> Difficulty; public static ConfigEntry<float> EliteChance; public static ConfigEntry<bool> WanderingMvpEnabled; public static ConfigEntry<float> WanderingMvpMinutes; public static ConfigEntry<float> WanderingMvpDurationMinutes; public static ConfigEntry<bool> InvasionsEnabled; public static ConfigEntry<float> InvasionChance; public static ConfigEntry<float> RiftMinutes; public static ConfigEntry<float> RaidCooldownMinutes; public static ConfigEntry<string> DungeonCooldowns; public static ConfigEntry<float> FoodStartHp; public static ConfigEntry<float> FoodStartStamina; public static ConfigEntry<float> FoodOtherBiomesFactor; public static ConfigEntry<float> FoodInstantRestore; public static ConfigEntry<float> FoodEatCooldown; public static ConfigEntry<string> FoodExtraAllowed; public static ConfigEntry<bool> FreeTeleport; public static ConfigEntry<float> KafraTeleportCostPer20m; public static ConfigEntry<float> BloodMoonChance; public static ConfigEntry<bool> CampsEnabled; public static ConfigEntry<KeyboardShortcut> MarkerKey; public static ConfigEntry<KeyboardShortcut> HotbarPageKey; public static ConfigEntry<bool> ShowQuestTracker; public static ConfigEntry<bool> DirectLoot; public static ConfigEntry<bool> MapCoords; public static ConfigEntry<bool> SplitZeny; public static ConfigEntry<bool> CastTimes; public static ConfigEntry<float> StackMultiplier; public static ConfigEntry<float> CarryWeightMultiplier; public static ConfigEntry<float> EquipDropMultiplier; public static ConfigEntry<float> DungeonCooldownMinutes; public static ConfigEntry<int> DungeonWaveSize; public static ConfigEntry<string> BiomeScaling; public static ConfigEntry<float> BossHpMultiplier; public static ConfigEntry<float> SkillSpCostMultiplier; public static ConfigEntry<KeyboardShortcut>[] SkillKeys = new ConfigEntry<KeyboardShortcut>[8]; public static ConfigEntry<KeyboardShortcut> StatusKey; public static ConfigEntry<bool> ShowHud; public static ConfigEntry<float> UiScale; public static ConfigEntry<float> HudOffsetY; public static ConfigEntry<KeyboardShortcut> LightKey; public static ConfigEntry<float> LightRange; public static ConfigEntry<float> LightIntensity; public static ConfigEntry<bool> ShowEnemiesOnMap; public static ConfigEntry<float> EnemyMapRange; public static ConfigEntry<bool> HarvestToInventory; private static int _osFrame = -1; private static readonly bool[] _osDown = new bool[5]; private static readonly bool[] _osPressed = new bool[5]; private static readonly bool[] _diagDown = new bool[256]; private static int[] _ratesCache; private static string _ratesSrc; public static void Bind(ConfigFile cfg) { //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_0925: Unknown result type (might be due to invalid IL or missing references) //IL_094f: Unknown result type (might be due to invalid IL or missing references) //IL_0a95: Unknown result type (might be due to invalid IL or missing references) ExpPerHp = S(cfg, "1 - Experiência", "ExpPorHP", 0.5f, "EXP de base por ponto de HP máximo do monstro."); BossExpMultiplier = S(cfg, "1 - Experiência", "MultiplicadorChefe", 5f, "Multiplicador de EXP de chefes."); JobExpRatio = S(cfg, "1 - Experiência", "ProporcaoExpClasse", 0.75f, "EXP de classe = EXP de base × este valor."); ExpRate = S(cfg, "1 - Experiência", "Rate", 1f, "Rate geral de EXP (como servidores de RO)."); ShareRange = S(cfg, "1 - Experiência", "AlcanceGrupo", 60f, "Distância (m) para receber EXP/zeny de abates de outros jogadores."); ExpCurveMultiplier = S(cfg, "1 - Experiência", "MultiplicadorCurva", 1f, "Multiplica a EXP necessária por nível."); ZenyPerExp = S(cfg, "2 - Zeny", "ZenyPorExp", 0.4f, "Zeny por abate = EXP de base × este valor (±20%)."); ZenyRate = S(cfg, "2 - Zeny", "Rate", 1f, "Rate geral de zeny."); ConvertCoins = S(cfg, "2 - Zeny", "ConverterOuro", value: true, "Converte moedas de ouro do Valheim em zeny (1:1)."); HpPerLevel = S(cfg, "3 - Atributos", "HPPorNivel", 0.7f, "HP extra = nível × fator da classe × este valor × (1 + VIT/100)."); SpBase = S(cfg, "3 - Atributos", "SPBaseV2", 10f, "SP base de todo personagem (como no RO)."); SpPerLevel = S(cfg, "3 - Atributos", "SPPorNivelV2", 5f, "SP = (base + nível × fator da classe × este valor) × (1 + INT/100)."); SpPerInt = S(cfg, "3 - Atributos", "SPPorINTV2", 0f, "SP fixo extra por ponto de INT."); HpRegenPerSec = S(cfg, "3 - Atributos", "RegenHPPorSegundoV3", 0.003f, "Regeneração natural de HP por segundo, em fração do HP máximo (0.003 = 0,3%), + VIT × 0,05."); SpRegenPerSec = S(cfg, "3 - Atributos", "RegenSPPorSegundoV3", 0.004f, "Regeneração natural de SP por segundo, em fração do SP máximo (0.004 = 0,4%), + INT × RegenSPPorINT."); SpRegenPerInt = S(cfg, "3 - Atributos", "RegenSPPorINT", 0.025f, "SP regenerado por segundo para cada ponto de INT."); RegenDelay = S(cfg, "3 - Atributos", "AtrasoRegen", 3f, "Segundos sem levar dano (HP) ou sem gastar SP (SP) para a regeneração natural voltar."); OffenseStatScale = S(cfg, "3 - Atributos", "EscalaOfensiva", 1f, "Multiplica todos os bônus de dano vindos de atributos."); DefenseStatScale = S(cfg, "3 - Atributos", "EscalaDefensiva", 1f, "Multiplica esquiva e redução de dano vindas de atributos."); MaxFlee = S(cfg, "3 - Atributos", "EsquivaMaxima", 0.4f, "Chance máxima de esquiva (0-1)."); MaxVitReduction = S(cfg, "3 - Atributos", "ReducaoVITMaxima", 0.35f, "Redução de dano máxima por VIT (0-1)."); CritMultiplier = S(cfg, "3 - Atributos", "MultiplicadorCritico", 1.4f, "Multiplicador de dano crítico."); AspdPerAgi = S(cfg, "3 - Atributos", "VelocidadeAtaquePorAGI", 0.25f, "% de velocidade de ataque por ponto de AGI (99 AGI = +25%)."); DrawPerAgi = S(cfg, "3 - Atributos", "VelocidadeArcoPorAGI", 0.4f, "% de velocidade para puxar o arco por ponto de AGI (99 AGI = +40%)."); MaxAttackSpeed = S(cfg, "3 - Atributos", "VelocidadeAtaqueMaxima", 1.6f, "Velocidade de ataque máxima (1.6 = +60%), somando AGI, habilidades e equipamentos."); MaxDrawSpeed = S(cfg, "3 - Atributos", "VelocidadeArcoMaxima", 1.8f, "Velocidade máxima para puxar o arco (1.8 = +80%)."); CardDropChance = S(cfg, "4 - Cartas", "ChanceCarta", 0.005f, "Chance de carta por abate (0.005 = 0,5%)."); MvpCardDropChance = S(cfg, "4 - Cartas", "ChanceCartaMVP", 0.25f, "Chance de carta de chefe."); CardRemovalCostMultiplier = S(cfg, "4 - Cartas", "CustoRemocao", 1f, "Multiplicador do custo em zeny para remover cartas."); WeaponSecondSlotQuality = S(cfg, "4 - Cartas", "QualidadeSegundoSlot", 3, "Qualidade mínima de arma para o 2º slot."); RefineMaterialDropChance = S(cfg, "5 - Refino", "ChanceMaterial", 0.02f, "Chance de Oridecon/Elunium por abate."); RefineZenyBase = S(cfg, "5 - Refino", "ZenyBase", 500, "Zeny por tentativa = base × (nível alvo + 1)."); RefineSuccessRates = S(cfg, "5 - Refino", "Chances", "100,100,100,100,90,80,60,40,25,15", "Chance (%) para +1 ... +10."); StatusKey = cfg.Bind<KeyboardShortcut>("6 - Interface", "TeclaStatus", new KeyboardShortcut((KeyCode)107, (KeyCode[])(object)new KeyCode[0]), "Abre o inventário direto na aba Ragnarok."); ShowHud = cfg.Bind<bool>("6 - Interface", "MostrarHUD", true, "Mostra classe, níveis, EXP, zeny e a barra de habilidades na parte de baixo da tela."); UiScale = cfg.Bind<float>("6 - Interface", "Escala", 1f, "Escala do HUD do mod."); HudOffsetY = cfg.Bind<float>("6 - Interface", "AlturaHUD", 12f, "Distância do HUD até a borda de baixo da tela (pixels em 1080p)."); LightKey = cfg.Bind<KeyboardShortcut>("10 - Conveniências", "TeclaLuz", new KeyboardShortcut((KeyCode)113, (KeyCode[])(object)new KeyCode[0]), "Liga/desliga a luz ao redor do personagem (os amigos também veem)."); LightRange = cfg.Bind<float>("10 - Conveniências", "AlcanceLuz", 16f, "Alcance da luz em metros."); LightIntensity = cfg.Bind<float>("10 - Conveniências", "IntensidadeLuz", 1.4f, "Intensidade da luz."); ShowEnemiesOnMap = cfg.Bind<bool>("10 - Conveniências", "InimigosNoMapa", true, "Mostra no mapa e no minimapa, em tempo real, os inimigos próximos."); EnemyMapRange = cfg.Bind<float>("10 - Conveniências", "AlcanceInimigosNoMapa", 70f, "Distância (m) dos inimigos mostrados no mapa."); HarvestToInventory = cfg.Bind<bool>("10 - Conveniências", "ColetaDiretoNoInventario", true, "Itens colhidos (frutas, cogumelos, pedras, galhos...) vão direto ao inventário; se estiver cheio, caem no chão."); BiomeScaling = S(cfg, "8 - Inimigos", "MultiplicadoresPorBiomaV2", "Meadows=1.0/1.0,BlackForest=1.4/1.15,Swamp=1.75/1.3,Mountain=2.1/1.45,Ocean=1.75/1.3,Plains=2.5/1.6,Mistlands=3.0/1.75,AshLands=3.5/2.0,DeepNorth=3.5/2.0", "HP/dano dos inimigos por bioma (compensa a força extra dos personagens RO; ver BALANCE.md). Use 1.0/1.0 para desligar."); BossHpMultiplier = S(cfg, "8 - Inimigos", "MultiplicadorHPChefesV2", 1.25f, "HP extra dos chefes (aplicado por cima do bioma)."); SupportRange = S(cfg, "12 - Grupo", "AlcanceSuporte", 15f, "Alcance (m) das curas, buffs e canções de grupo."); GroupRange = S(cfg, "12 - Grupo", "AlcanceGrupoInimigos", 60f, "Jogadores a até esta distância contam para o reforço dos inimigos."); GroupHpPerPlayer = S(cfg, "12 - Grupo", "HPInimigoPorJogador", 0.15f, "HP extra dos inimigos comuns por jogador além do primeiro (0.15 = +15%)."); GroupDmgPerPlayer = S(cfg, "12 - Grupo", "DanoInimigoPorJogador", 0.1f, "Dano extra dos inimigos por jogador além do primeiro (0.10 = +10%)."); BossHpPerPlayer = S(cfg, "12 - Grupo", "HPChefeMVPPorJogador", 0.5f, "HP extra de chefes e MVPs de masmorra por jogador além do primeiro (0.5 = +50%)."); CastTimes = S(cfg, "7 - Habilidades", "TempoDeConjuracao", value: true, "Magias fortes (Nevasca, Meteoros, Magnus, Judex, Cometa...) têm uma conjuração curta antes de sair (1,2 s, menos com DEX)."); SplitZeny = S(cfg, "12 - Grupo", "DividirZenyGrupo", value: true, "O zeny dos abates é dividido entre o grupo como a EXP (com o mesmo bônus por membro). Desligado: cada um recebe o valor inteiro."); PartyExpBonus = S(cfg, "12 - Grupo", "BonusEXPGrupo", 0.2f, "A EXP é dividida entre o grupo, com +20% por membro extra (3 jogadores: cada um recebe ~47%)."); ShowPartyHud = cfg.Bind<bool>("12 - Grupo", "MostrarGrupo", true, "Mostra HP e SP dos outros jogadores próximos na tela."); Difficulty = S(cfg, "13 - Mundo", "Dificuldade", "Normal", "Normal, Pesadelo ou Valhalla. Pesadelo: inimigos +50% HP/+30% dano, +30% EXP. Valhalla: +120% HP/+60% dano, +60% EXP."); EliteChance = S(cfg, "13 - Mundo", "ChanceElite", 0.03f, "Chance de um monstro comum nascer Elite (0.03 = 3%), multiplicada pela dificuldade."); WanderingMvpEnabled = S(cfg, "13 - Mundo", "MVPsErrantes", value: true, "MVPs que aparecem de vez em quando no bioma de um jogador, avisados para todos e marcados no mapa."); WanderingMvpMinutes = S(cfg, "13 - Mundo", "IntervaloMVPErranteMinutos", 40f, "Tempo médio (min) entre MVPs errantes."); WanderingMvpDurationMinutes = S(cfg, "13 - Mundo", "DuracaoMVPErranteMinutos", 20f, "Minutos até o MVP errante ir embora se ninguém derrotá-lo."); InvasionsEnabled = S(cfg, "13 - Mundo", "InvasoesNoturnas", value: true, "Ondas de mortos-vivos atacam as bases à noite (depois do Eikthyr)."); InvasionChance = S(cfg, "13 - Mundo", "ChanceInvasao", 0.3f, "Chance de invasão a cada noite (0.3 = 30%), para cada jogador que estiver em uma base."); RiftMinutes = S(cfg, "13 - Mundo", "TempoFendaMinutos", 10f, "Duração da Fenda do Tempo (min)."); RaidCooldownMinutes = S(cfg, "13 - Mundo", "RecargaRaideMinutos", 60f, "Minutos até poder repetir a raide (por jogador)."); DungeonCooldowns = S(cfg, "9 - Masmorras e equipamentos", "RecargaPorMasmorra", "meadows=10,blackforest=10,swamp=10,mountain=10,plains=10,mistlands=10,ashlands=10,sewer=10,glacial=10,guild=10,cathedral=10,theater=10,raid=60,rift=10", "Minutos de recarga de cada masmorra (por jogador). Ids: meadows, blackforest, swamp, mountain, plains, mistlands, ashlands, sewer, glacial, guild, cathedral, theater, raid; rift = Fendas do Tempo. A Torre não tem recarga. Masmorra fora da lista usa RecargaMasmorraMinutos."); FoodStartHp = S(cfg, "14 - Comida", "HPInicial", 20f, "HP fixo que todo personagem tem (substitui a comida simples do começo)."); FoodStartStamina = S(cfg, "14 - Comida", "StaminaInicial", 20f, "Stamina fixa que todo personagem tem."); FoodOtherBiomesFactor = S(cfg, "14 - Comida", "FatorOutrosBiomas", 0.1f, "O bioma com mais alimentos provados conta inteiro; os outros somam esta fração (0.1 = 10%)."); FoodInstantRestore = S(cfg, "14 - Comida", "RecuperacaoAoComer", 0.3f, "Ao comer, recupera esta fração do HP e da stamina do alimento na hora (o SP recupera metade disso)."); FoodEatCooldown = S(cfg, "14 - Comida", "RecargaComerSegundos", 10f, "Segundos entre uma comida e outra."); FreeTeleport = S(cfg, "15 - Aventura", "TeleporteSemLimite", value: true, "Portais, Asa de Borboleta, Ressuscitar e Kafra levam qualquer item (minério, metais...)."); KafraTeleportCostPer20m = S(cfg, "15 - Aventura", "CustoTeleporteKafra", 1f, "Zeny por cada 20 m de distância no teleporte da Kafra (além de 100z fixos)."); BloodMoonChance = S(cfg, "15 - Aventura", "ChanceLuaDeSangue", 0.12f, "Chance de cada noite ser uma Lua de Sangue (depois do Eikthyr)."); CampsEnabled = S(cfg, "15 - Aventura", "AcampamentosInimigos", value: true, "Acampamentos inimigos conquistáveis (2 por bioma)."); DirectLoot = S(cfg, "10 - Conveniências", "SaqueDiretoNoInventario", value: true, "Itens de monstros mortos por um jogador vão direto para o inventário dele (o que não couber cai aos pés)."); MapCoords = cfg.Bind<bool>("10 - Conveniências", "CoordenadasNoMapa", true, "No mapa grande, mostra a coordenada, o bioma e a distância do ponto sob o cursor."); ShowQuestTracker = cfg.Bind<bool>("10 - Conveniências", "MostrarMissoes", true, "Mostra as missões do dia e a missão de classe no canto direito da tela."); HotbarPageKey = cfg.Bind<KeyboardShortcut>("7 - Habilidades", "TrocarPaginaBarra", new KeyboardShortcut((KeyCode)122, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), "Alterna entre as 2 páginas da barra de habilidades."); MarkerKey = cfg.Bind<KeyboardShortcut>("15 - Aventura", "TeclaMarcador", new KeyboardShortcut((KeyCode)325, (KeyCode[])(object)new KeyCode[0]), "Marca o ponto (ou o inimigo) para onde você está olhando, no mapa e na tela dos amigos."); FoodExtraAllowed = S(cfg, "14 - Comida", "AlimentosDeOutrosMods", "", "Prefabs de alimentos de outros mods aceitos na coleção, separados por vírgula (só depois de validar). Os não listados ficam fora."); StackMultiplier = S(cfg, "11 - Inventário", "MultiplicadorPilha", 5f, "Multiplica a quantidade máxima por slot de itens empilháveis (aplica ao abrir o jogo)."); CarryWeightMultiplier = S(cfg, "11 - Inventário", "MultiplicadorPeso", 5f, "Multiplica o peso máximo que o personagem carrega (inclui bônus de STR, habilidades e Megingjord)."); StackMultiplier.SettingChanged += delegate { if ((Object)(object)ObjectDB.instance != (Object)null) { StackPatches.Apply(ObjectDB.instance); } }; EquipDropMultiplier = S(cfg, "9 - Masmorras e equipamentos", "MultiplicadorDropEquipamento", 1f, "Multiplica a chance de equipamentos únicos de monstros."); DungeonCooldownMinutes = S(cfg, "9 - Masmorras e equipamentos", "RecargaMasmorraMinutos", 10f, "Minutos até poder repetir uma masmorra (por jogador)."); DungeonWaveSize = S(cfg, "9 - Masmorras e equipamentos", "MonstrosPorOnda", 4, "Monstros por onda (+2 por jogador extra perto do portal)."); SkillSpCostMultiplier = S(cfg, "7 - Habilidades", "MultiplicadorCustoSP", 1f, "Multiplica o custo de SP de todas as habilidades."); for (int num = 0; num < 8; num++) { SkillKeys[num] = cfg.Bind<KeyboardShortcut>("7 - Habilidades", "Atalho" + (num + 1), new KeyboardShortcut((KeyCode)(49 + num), (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), "Tecla do slot " + (num + 1) + " da barra de habilidades. Enquanto Alt estiver segurado, os números não usam a barra de itens."); } } private static ConfigEntry<T> S<T>(ConfigFile cfg, string section, string key, T value, string desc) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown string text = desc + " [servidor]"; object[] array = new object[1]; ConfigurationManagerAttributes val = new ConfigurationManagerAttributes(); val.IsAdminOnly = true; array[0] = val; return cfg.Bind<T>(section, key, value, new ConfigDescription(text, (AcceptableValueBase)null, array)); } public static bool KeyDown(KeyboardShortcut k) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_002f: Unknown result type (might be due to invalid IL or missing references) if ((int)((KeyboardShortcut)(ref k)).MainKey == 0 || !Pressed(((KeyboardShortcut)(ref k)).MainKey)) { return false; } foreach (KeyCode modifier in ((KeyboardShortcut)(ref k)).Modifiers) { if (!Input.GetKey(modifier)) { return false; } } return true; } [DllImport("user32.dll")] private static extern short GetAsyncKeyState(int vKey); private static void UpdateOsButtons() { if (_osFrame == Time.frameCount) { return; } _osFrame = Time.frameCount; int[] array = new int[5] { 4, 5, 6, 166, 167 }; for (int i = 0; i < 5; i++) { bool flag = false; try { flag = (GetAsyncKeyState(array[i]) & 0x8000) != 0; } catch (Exception) { } _osPressed[i] = flag && !_osDown[i]; _osDown[i] = flag; } } public static void PollMouse() { UpdateOsButtons(); } public static void LogOsKeys() { for (int i = 1; i < 255; i++) { bool flag = false; try { flag = (GetAsyncKeyState(i) & 0x8000) != 0; } catch (Exception) { break; } if (flag && !_diagDown[i]) { Plugin.Log.LogInfo((object)("Windows recebeu o código 0x" + i.ToString("X2"))); } _diagDown[i] = flag; } } public static bool Pressed(KeyCode k) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Invalid comparison between Unknown and I4 //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Invalid comparison between Unknown and I4 //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Invalid comparison between Unknown and I4 //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Invalid comparison between Unknown and I4 //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Invalid comparison between Unknown and I4 if ((int)k >= 325 && (int)k <= 327) { UpdateOsButtons(); if (Application.isFocused && _osPressed[k - 325]) { return true; } if (Application.isFocused && (int)k == 326 && _osPressed[3]) { return true; } if (Application.isFocused && (int)k == 327 && _osPressed[4]) { return true; } try { Mouse current = Mouse.current; if (current != null) { if ((int)k == 325 && current.middleButton.wasPressedThisFrame) { return true; } if ((int)k == 326 && current.backButton.wasPressedThisFrame) { return true; } if ((int)k == 327 && current.forwardButton.wasPressedThisFrame) { return true; } } } catch (Exception) { } } try { return Input.GetKeyDown(k); } catch (Exception) { return false; } } public static string ShortName(KeyboardShortcut k) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Invalid comparison between Unknown and I4 //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Invalid comparison between Unknown and I4 //IL_0074: Unknown result type (might be due to invalid IL or missing references) List<string> list = new List<string>(); foreach (KeyCode modifier in ((KeyboardShortcut)(ref k)).Modifiers) { if ((int)modifier == 308 || (int)modifier == 307) { list.Add("Alt"); } else if ((int)modifier == 306 || (int)modifier == 305) { list.Add("Ctrl"); } else if ((int)modifier == 304 || (int)modifier == 303) { list.Add("Shift"); } else { list.Add(((object)modifier).ToString()); } } list.Add(KeyName(((KeyboardShortcut)(ref k)).MainKey)); return string.Join("+", list.ToArray()); } public static string KeyName(KeyCode k) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Invalid comparison between Unknown and I4 //IL_0006: 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_0026: Expected I4, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) if ((int)k != 0) { switch (k - 325) { case 0: return "M3"; case 1: return "M4"; case 2: return "M5"; case 3: return "M6"; case 4: return "M7"; default: { string text = ((object)k).ToString(); if (text.StartsWith("Alpha")) { return text.Substring(5); } if (text.StartsWith("Keypad")) { return "Num" + text.Substring(6); } return text; } } } return "—"; } public static int[] GetRefineRates() { string value = RefineSuccessRates.Value; if (_ratesCache != null && _ratesSrc == value) { return _ratesCache; } string[] array = value.Split(','); int[] array2 = new int[10]; for (int i = 0; i < 10; i++) { int result = 100; if (i < array.Length) { int.TryParse(array[i].Trim(), out result); } array2[i] = Mathf.Clamp(result, 0, 100); } _ratesCache = array2; _ratesSrc = value; return array2; } } } namespace RagnarokValheim.Content { public static class CardItems { private const string BasePrefab = "Ruby"; public static void Register() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) int num = 0; foreach (CardDef item in Cards.All) { string itemName = item.ItemName; ItemConfig val = new ItemConfig(); val.Name = (item.Mvp ? "Carta MVP " : "Carta ") + item.Display; val.Description = "Carta de " + item.Display + "."; CustomItem val2 = new CustomItem(itemName, "Ruby", val); if (!((Object)(object)val2.ItemDrop == (Object)null)) { SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_itemType = (ItemType)1; shared.m_maxStackSize = 20; shared.m_weight = 0.1f; shared.m_value = 0; shared.m_teleportable = true; GameObject prefab = Cache.GetPrefab<GameObject>(item.Trophy); ItemDrop val3 = (((Object)(object)prefab != (Object)null) ? prefab.GetComponent<ItemDrop>() : null); if ((Object)(object)val3 != (Object)null && val3.m_itemData.m_shared.m_icons != null && val3.m_itemData.m_shared.m_icons.Length > 0) { shared.m_icons = (Sprite[])(object)new Sprite[1] { val3.m_itemData.m_shared.m_icons[0] }; } ItemManager.Instance.AddItem(val2); num++; } } Plugin.Log.LogInfo((object)("Cartas registradas: " + num + "/" + Cards.All.Count)); } } public static class EquipItems { public static void Register() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) int num = 0; foreach (EquipDef item in Equipment.All) { string id = item.Id; string text = item.Base; ItemConfig val = new ItemConfig(); val.Name = item.Name; val.Description = "Equipamento especial. " + item.Source + "."; CustomItem val2 = new CustomItem(id, text, val); if ((Object)(object)val2.ItemDrop == (Object)null) { Plugin.Log.LogWarning((object)("Equipamento sem base (" + item.Base + "): " + item.Id)); continue; } SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_useDurability = false; shared.m_maxQuality = 1; shared.m_value = 0; if (item.StatMult != 1f) { shared.m_armor *= item.StatMult; shared.m_blockPower *= item.StatMult; DamageTypes damages = shared.m_damages; ((DamageTypes)(ref damages)).Modify(item.StatMult); shared.m_damages = damages; } if (item.Base == "BeltStrength") { shared.m_equipStatusEffect = null; } ItemManager.Instance.AddItem(val2); num++; } Plugin.Log.LogInfo((object)("Equipamentos especiais registrados: " + num + "/" + Equipment.All.Count)); } } public static class RoItems { public const string Oridecon = "RO_Oridecon"; public const string Elunium = "RO_Elunium"; public const string RedPotion = "RO_RedPotion"; public const string OrangePotion = "RO_OrangePotion"; public const string YellowPotion = "RO_YellowPotion"; public const string WhitePotion = "RO_WhitePotion"; public const string BluePotion = "RO_BluePotion"; public const string ButterflyWing = "RO_ButterflyWing"; public const string BattleManual = "RO_BattleManual"; public const string YggLeaf = "RO_YggLeaf"; public const string YggSeed = "RO_YggSeed"; public const string BlueGem = "RO_BlueGem"; public const string TreasureMap = "RO_TreasureMap"; public static readonly string[] Feasts = new string[3] { "RO_FeastSmall", "RO_FeastHunter", "RO_FeastRoyal" }; public static void Register() { //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Expected O, but got Unknown //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Expected O, but got Unknown //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Expected O, but got Unknown //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected O, but got Unknown //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Expected O, but got Unknown //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Expected O, but got Unknown //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Expected O, but got Unknown //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Expected O, but got Unknown //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Expected O, but got Unknown Material("RO_Oridecon", "Iron", "Oridecon", "Metal raro usado para refinar armas no Refinador."); Material("RO_Elunium", "Crystal", "Elunium", "Cristal raro usado para refinar armaduras, escudos, elmos, capas e calçados."); Potion("RO_RedPotion", "MeadHealthMinor", "Poção Vermelha", 40f, 0f); Potion("RO_OrangePotion", "MeadHealthMedium", "Poção Laranja", 90f, 0f); Potion("RO_YellowPotion", "MeadHealthMajor", "Poção Amarela", 160f, 0f); Potion("RO_WhitePotion", "MeadHealthLingering", "Poção Branca", 260f, 0f); Potion("RO_BluePotion", "MeadEitrMinor", "Poção Azul", 0f, 60f); Special("RO_ButterflyWing", "MeadStaminaMinor", "Feathers", "Asa de Borboleta", "Leva você instantaneamente até a sua cama (ponto de renascimento). Não funciona carregando minério ou outros itens que não podem passar por portais."); Special("RO_BattleManual", "MeadTasty", "AmberPearl", "Manual de Combate", "+50% de EXP de base e de classe por 30 minutos."); Special("RO_YggLeaf", "MeadTasty", "Thistle", "Folha de Yggdrasil", "Chama de volta os aliados que morreram nos últimos 6 minutos (como Ressuscitar), com todo o HP. Só é gasta se alguém tiver morrido."); Special("RO_YggSeed", "MeadTasty", "Acorn", "Semente de Yggdrasil", "Recupera todo o HP e todo o SP na hora."); Material("RO_BlueGem", "Eitr", "Gema Azul", "Componente de magias fortes (Nevasca, Chuva de Meteoros, Magnus Exorcismus, Judex, Cometa...). Se houver uma no inventário, a magia a consome e causa +25% de dano por 4 s. Nunca é obrigatória."); Special("RO_TreasureMap", "MeadTasty", "Coins", "Mapa do Tesouro", "Use para marcar no mapa um tesouro enterrado por perto (200–500 m). Chegue ao X para desenterrá-lo; às vezes há guardiões. Um mapa ativo por vez."); Feast(Feasts[0], "Banquete Simples", "+15% de regeneração de HP e +15 de stamina para o grupo (15 m) por 30 min.", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("CookedMeat", 3, 0, true), new RequirementConfig("Raspberry", 6, 0, true), new RequirementConfig("Honey", 3, 0, true) }); Feast(Feasts[1], "Banquete do Caçador", "+5% de HP máx. e +3% de dano para o grupo (15 m) por 30 min.", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("DeerStew", 2, 0, true), new RequirementConfig("Sausages", 3, 0, true), new RequirementConfig("QueensJam", 2, 0, true) }); Feast(Feasts[2], "Banquete Real", "+8% de HP máx., +5% de dano e +15% de regeneração de SP para o grupo (15 m) por 30 min.", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("LoxPie", 2, 0, true), new RequirementConfig("BloodPudding", 2, 0, true), new RequirementConfig("FishWraps", 2, 0, true) }); string[] families = ClassGear.Families; foreach (string text in families) { Simple(ClassGear.Essence(text), ClassGear.EssenceIcons[text], ClassGear.EssenceNames[text], "Material de classe. Usada na Forja Ragnarok para fabricar e evoluir os equipamentos de " + Jobs.Get(text).Name + " e na Mesa Rúnica para encantar. Cai de monstros (mais de elites, variantes, mini-chefes e MVPs).", 100); } Simple("RO_MvpCore", "BlackCore", "Núcleo de MVP", "Núcleo deixado por MVPs de masmorra, MVPs errantes, chefes de instância e da Torre. Necessário para os estágios III e IV da Forja.", 20); foreach (RuneDef rune in ClassGear.Runes) { StringBuilder stringBuilder = new StringBuilder("Runa para a Mesa Rúnica (1 por equipamento):"); CardEffect[] effects = rune.Effects; foreach (CardEffect e in effects) { stringBuilder.Append("\n• ").Append(Cards.Describe(e)); } Simple(rune.ItemName, rune.Icon, rune.Name, stringBuilder.ToString(), 20); } foreach (RelicDef item in Relics.All) { Simple(item.Id, item.Icon, item.Name, "Relíquia de classe. " + Relics.Describe(item), 1); } Simple("RO_ClassEmblem", "SilverNecklace", "Emblema de Classe", "Cai de MVPs de masmorra, MVPs errantes, chefes da Torre, capítulos da Jornada e desafios de classe da Torre. Na Kafra (aba Kafra → Troca de Emblemas), troque pela peça de conjunto de classe que falta ou por uma relíquia perdida.", 100); Special("RO_ReturnScroll", "MeadTasty", "Thistle", "Pergaminho de Retorno", "Volta para o lugar onde você estava antes da última viagem (Kafra, Salão de Odin ou instância). Leva qualquer item."); Special("RO_Ward_Fire", "MeadTasty", "SurtlingCore", "Pedra de Proteção: Fogo", "Use com uma armadura de peito equipada: ela passa a proteger contra fogo (−25% desse dano). Troque quando quiser."); Special("RO_Ward_Water", "MeadTasty", "FreezeGland", "Pedra de Proteção: Água", "Use com uma armadura de peito equipada: ela passa a proteger contra gelo (−25% desse dano). Troque quando quiser."); Special("RO_Ward_Earth", "MeadTasty", "Obsidian", "Pedra de Proteção: Terra", "Use com uma armadura de peito equipada: ela passa a proteger contra veneno (−25%) e um pouco contra dano físico (−5%)."); Special("RO_Ward_Wind", "MeadTasty", "Thunderstone", "Pedra de Proteção: Vento", "Use com uma armadura de peito equipada: ela passa a proteger contra raio (−25% desse dano). Troque quando quiser."); Special("RO_Stone_Fire", "MeadTasty", "SurtlingCore", "Pedra de Fogo", "Encanta a arma equipada com o elemento Fogo (forte contra Terra). O encanto é permanente até usar outra pedra."); Special("RO_Stone_Water", "MeadTasty", "FreezeGland", "Pedra de Água", "Encanta a arma equipada com o elemento Água (forte contra Fogo). O encanto é permanente até usar outra pedra."); Special("RO_Stone_Earth", "MeadTasty", "Obsidian", "Pedra de Terra", "Encanta a arma equipada com o elemento Terra (forte contra Vento). O encanto é permanente até usar outra pedra."); Special("RO_Stone_Wind", "MeadTasty", "Thunderstone", "Pedra de Vento", "Encanta a arma equipada com o elemento Vento (forte contra Água). O encanto é permanente até usar outra pedra."); } private static void Special(string name, string basePrefab, string iconPrefab, string display, string desc) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Expected O, but got Unknown ItemConfig val = new ItemConfig(); val.Name = display; val.Description = desc; CustomItem val2 = new CustomItem(name, basePrefab, val); if ((Object)(object)val2.ItemDrop == (Object)null) { Plugin.Log.LogWarning((object)("Base não encontrada: " + basePrefab)); return; } SE_Stats val3 = ScriptableObject.CreateInstance<SE_Stats>(); ((Object)val3).name = "SE_" + name; ((StatusEffect)val3).m_name = display; ((StatusEffect)val3).m_tooltip = desc; ((StatusEffect)val3).m_ttl = 1f; ((StatusEffect)val3).m_category = "ro_special_" + name; SharedData shared = val2.ItemDrop.m_itemData.m_shared; GameObject prefab = Cache.GetPrefab<GameObject>(iconPrefab); ItemDrop val4 = (((Object)(object)prefab != (Object)null) ? prefab.GetComponent<ItemDrop>() : null); if ((Object)(object)val4 != (Object)null && val4.m_itemData.m_shared.m_icons != null && val4.m_itemData.m_shared.m_icons.Length > 0) { shared.m_icons = (Sprite[])(object)new Sprite[1] { val4.m_itemData.m_shared.m_icons[0] }; } if (shared.m_icons != null && shared.m_icons.Length > 0) { ((StatusEffect)val3).m_icon = shared.m_icons[0]; } shared.m_consumeStatusEffect = (StatusEffect)(object)val3; shared.m_maxStackSize = 20; shared.m_weight = 0.2f; shared.m_food = 0f; shared.m_foodStamina = 0f; shared.m_foodEitr = 0f; shared.m_description = desc; ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)val3, false)); ItemManager.Instance.AddItem(val2); } private static void Feast(string name, string display, string desc, RequirementConfig[] reqs) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Expected O, but got Unknown ItemConfig val = new ItemConfig(); val.Name = display; val.Description = desc; val.CraftingStation = CraftingStations.Cauldron; val.Requirements = reqs; val.Amount = 1; CustomItem val2 = new CustomItem(name, "MeadTasty", val); if (!((Object)(object)val2.ItemDrop == (Object)null)) { SE_Stats val3 = ScriptableObject.CreateInstance<SE_Stats>(); ((Object)val3).name = "SE_" + name; ((StatusEffect)val3).m_name = display; ((StatusEffect)val3).m_tooltip = desc; ((StatusEffect)val3).m_ttl = 1f; ((StatusEffect)val3).m_category = "ro_feast"; SharedData shared = val2.ItemDrop.m_itemData.m_shared; GameObject prefab = Cache.GetPrefab<GameObject>("MeatPlatter"); ItemDrop val4 = (((Object)(object)prefab != (Object)null) ? prefab.GetComponent<ItemDrop>() : null); if ((Object)(object)val4 != (Object)null && val4.m_itemData.m_shared.m_icons != null && val4.m_itemData.m_shared.m_icons.Length > 0) { shared.m_icons = (Sprite[])(object)new Sprite[1] { val4.m_itemData.m_shared.m_icons[0] }; } if (shared.m_icons != null && shared.m_icons.Length > 0) { ((StatusEffect)val3).m_icon = shared.m_icons[0]; } shared.m_consumeStatusEffect = (StatusEffect)(object)val3; shared.m_maxStackSize = 10; shared.m_weight = 1f; shared.m_food = 0f; shared.m_foodStamina = 0f; shared.m_foodEitr = 0f; shared.m_description = desc; ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)val3, false)); ItemManager.Instance.AddItem(val2); } } private static void Simple(string name, string iconPrefab, string display, string desc, int stack) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) ItemConfig val = new ItemConfig(); val.Name = display; val.Description = desc; CustomItem val2 = new CustomItem(name, "Ruby", val); if (!((Object)(object)val2.ItemDrop == (Object)null)) { SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_itemType = (ItemType)1; shared.m_maxStackSize = stack; shared.m_weight = 0.1f; shared.m_value = 0; shared.m_teleportable = true; shared.m_description = desc; GameObject prefab = Cache.GetPrefab<GameObject>(iconPrefab); ItemDrop val3 = (((Object)(object)prefab != (Object)null) ? prefab.GetComponent<ItemDrop>() : null); if ((Object)(object)val3 != (Object)null && val3.m_itemData.m_shared.m_icons != null && val3.m_itemData.m_shared.m_icons.Length > 0) { shared.m_icons = (Sprite[])(object)new Sprite[1] { val3.m_itemData.m_shared.m_icons[0] }; } ItemManager.Instance.AddItem(val2); } } private static void Material(string name, string basePrefab, string display, string desc) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown ItemConfig val = new ItemConfig(); val.Name = display; val.Description = desc; CustomItem val2 = new CustomItem(name, basePrefab, val); if ((Object)(object)val2.ItemDrop == (Object)null) { Plugin.Log.LogWarning((object)("Base não encontrada: " + basePrefab)); return; } SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_maxStackSize = 50; shared.m_weight = 0.5f; shared.m_value = 0; shared.m_teleportable = true; ItemManager.Instance.AddItem(val2); } private static void Potion(string name, string basePrefab, string display, float hp, float sp) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Expected O, but got Unknown ItemConfig val = new ItemConfig(); val.Name = display; CustomItem val2 = new CustomItem(name, basePrefab, val); if ((Object)(object)val2.ItemDrop == (Object)null) { Plugin.Log.LogWarning((object)("Base não encontrada: " + basePrefab)); return; } SE_Stats val3 = ScriptableObject.CreateInstance<SE_Stats>(); ((Object)val3).name = "SE_" + name; ((StatusEffect)val3).m_name = display; ((StatusEffect)val3).m_tooltip = display; ((StatusEffect)val3).m_ttl = 1f; ((StatusEffect)val3).m_category = "ro_potion"; val3.m_healthUpFront = hp; val3.m_eitrUpFront = sp; SharedData shared = val2.ItemDrop.m_itemData.m_shared; if (shared.m_icons != null && shared.m_icons.Length > 0) { ((StatusEffect)val3).m_icon = shared.m_icons[0]; } shared.m_consumeStatusEffect = (StatusEffect)(object)val3; shared.m_maxStackSize = 100; shared.m_weight = 0.3f; shared.m_food = 0f; shared.m_foodStamina = 0f; shared.m_foodEitr = 0f; shared.m_description = ((hp > 0f) ? ("Recupera " + hp + " de HP na hora. Recarga de 1 s.") : ("Recupera " + sp + " de SP (Eitr) na hora. Recarga de 1 s.")); ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)val3, false)); ItemManager.Instance.AddItem(val2); } } public static class SkillStatusEffects { private static readonly Dictionary<string, StatusEffect> Effects = new Dictionary<string, StatusEffect>(); public static void Register() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown foreach (SkillDef item in SkillDefs.All) { if (item.Kind == SkillKind.Buff) { SE_Stats val = ScriptableObject.CreateInstance<SE_Stats>(); ((Object)val).name = "SE_RO_" + item.Id; ((StatusEffect)val).m_name = item.Name; ((StatusEffect)val).m_tooltip = item.Summary; ((StatusEffect)val).m_ttl = 60f; ((StatusEffect)val).m_icon = Icons.ForItem(item.Icon); ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)val, false)); Effects[item.Id] = (StatusEffect)(object)val; } } } public static void Show(string skillId, float duration) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && Effects.TryGetValue(skillId, out var value)) { value.m_ttl = duration; ((Character)localPlayer).GetSEMan().AddStatusEffect(value.NameHash(), true, 0, 0f, (short)0); } } } public static class Icons { private static readonly Dictionary<string, Sprite> Cache = new Dictionary<string, Sprite>(); public static Sprite ForItem(string prefab) { if (string.IsNullOrEmpty(prefab)) { return null; } if (Cache.TryGetValue(prefab, out var value) && (Object)(object)value != (Object)null) { return value; } GameObject val = null; if ((Object)(object)ObjectDB.instance != (Object)null) { val = ObjectDB.instance.GetItemPrefab(prefab); } if ((Object)(object)val == (Object)null) { val = Cache.GetPrefab<GameObject>(prefab); } ItemDrop val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<ItemDrop>() : null); value = (((Object)(object)val2 != (Object)null && val2.m_itemData.m_shared.m_icons != null && val2.m_itemData.m_shared.m_icons.Length > 0) ? val2.m_itemData.m_shared.m_icons[0] : null); if ((Object)(object)value != (Object)null) { Cache[prefab] = value; } return value; } } public enum StationType { Shop, Refiner, CardAltar, Forge, RuneTable } public static class Stations { private class Entry { public string Prefab; public int Price; public int Stack; public string Key; public Entry(string p, int price, int stack, string key) { Prefab = p; Price = price; Stack = stack; Key = key; } } public const string ShopPiece = "RO_KafraShop"; public const string RefinerPiece = "RO_Refiner"; public const string AltarPiece = "RO_CardAltar"; public const string ForgePiece = "RO_ClassForge"; public const string RunePiece = "RO_RuneTable"; public const string Category = "Ragnarok"; private static readonly Entry[] Catalog = new Entry[35] { new Entry("RO_RedPotion", 25, 5, null), new Entry("RO_OrangePotion", 90, 5, "defeated_gdking"), new Entry("RO_YellowPotion", 280, 5, "defeated_dragon"), new Entry("RO_WhitePotion", 700, 5, "defeated_goblinking"), new Entry("RO_BluePotion", 900, 5, "defeated_bonemass"), new Entry("ArrowWood", 2, 20, null), new Entry("ArrowFlint", 4, 20, null), new Entry("ArrowBronze", 8, 20, "defeated_eikthyr"), new Entry("ArrowIron", 14, 20, "defeated_gdking"), new Entry("ArrowSilver", 22, 20, "defeated_bonemass"), new Entry("ArrowNeedle", 30, 20, "defeated_dragon"), new Entry("ArrowCarapace", 40, 20, "defeated_goblinking"), new Entry("BoltBone", 15, 20, "defeated_goblinking"), new Entry("MeadHealthMinor", 60, 1, null), new Entry("MeadStaminaMinor", 60, 1, null), new Entry("MeadPoisonResist", 250, 1, "defeated_gdking"), new Entry("MeadFrostResist", 250, 1, "defeated_bonemass"), new Entry("MeadEitrMinor", 400, 1, "defeated_dragon"), new Entry("Torch", 10, 1, null), new Entry("RO_Elunium", 1500, 1, "defeated_gdking"), new Entry("RO_Oridecon", 2000, 1, "defeated_gdking"), new Entry("RO_ButterflyWing", 1500, 1, null), new Entry("RO_BattleManual", 15000, 1, "defeated_gdking"), new Entry("RO_BlueGem", 600, 1, "defeated_gdking"), new Entry("RO_ReturnScroll", 300, 1, null), new Entry("RO_YggLeaf", 8000, 1, "defeated_bonemass"), new Entry("RO_YggSeed", 12000, 1, "defeated_dragon"), new Entry("RO_Stone_Fire", 3000, 1, "defeated_eikthyr"), new Entry("RO_Ward_Fire", 3000, 1, "defeated_eikthyr"), new Entry("RO_Ward_Water", 3000, 1, "defeated_eikthyr"), new Entry("RO_Ward_Earth", 3000, 1, "defeated_eikthyr"), new Entry("RO_Ward_Wind", 3000, 1, "defeated_eikthyr"), new Entry("RO_Stone_Water", 3000, 1, "defeated_eikthyr"), new Entry("RO_Stone_Earth", 3000, 1, "defeated_eikthyr"), new Entry("RO_Stone_Wind", 3000, 1, "defeated_eikthyr") }; public static void Register() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Expected O, but got Unknown //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Expected O, but got Unknown //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Expected O, but got Unknown Add("RO_KafraShop", "piece_table", StationType.Shop, "Mercador Kafra", "Loja (só zeny), missões do dia e teleporte para outras Kafras.", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Wood", 20, 0, true), new RequirementConfig("Stone", 10, 0, true) }); Add("RO_Refiner", "forge", StationType.Refiner, "Refinador", "Refina equipamentos de +0 a +10 com Oridecon/Elunium e zeny. Nunca quebra itens.", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Stone", 20, 0, true), new RequirementConfig("Wood", 10, 0, true), new RequirementConfig("Flint", 10, 0, true) }); Add("RO_CardAltar", "piece_magetable", StationType.CardAltar, "Altar de Cartas", "Insere e remove cartas de equipamentos.", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Stone", 10, 0, true), new RequirementConfig("Wood", 10, 0, true), new RequirementConfig("Resin", 10, 0, true) }); Add("RO_ClassForge", "piece_artisanstation", StationType.Forge, "Forja Ragnarok", "Fabrica e evolui os equipamentos de classe (estágios I a IV) com Essências, materiais do bioma e Núcleos de MVP.", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Stone", 20, 0, true), new RequirementConfig("Wood", 15, 0, true), new RequirementConfig("Flint", 10, 0, true) }); Add("RO_RuneTable", "piece_stonecutter", StationType.RuneTable, "Mesa Rúnica", "Coloca runas (1 por equipamento) e faz encantamentos aleatórios com os bônus da sua classe.", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig("Stone", 20, 0, true), new RequirementConfig("Wood", 10, 0, true), new RequirementConfig("Resin", 10, 0, true) }); } private static void Add(string name, string basePrefab, StationType type, string display, string desc, RequirementConfig[] reqs) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown PieceConfig val = new PieceConfig(); val.Name = display; val.Description = desc; val.PieceTable = PieceTables.Hammer; val.Category = "Ragnarok"; val.CraftingStation = CraftingStations.Workbench; val.Requirements = reqs; CustomPiece val2 = new CustomPiece(name, basePrefab, val); if ((Object)(object)val2.PiecePrefab == (Object)null) { Plugin.Log.LogWarning((object)("Base de estação não encontrada: " + basePrefab)); return; } GameObject piecePrefab = val2.PiecePrefab; StripInteractables(piecePrefab); RoStation roStation = piecePrefab.AddComponent<RoStation>(); roStation.Type = type; roStation.DisplayName = display; if (type == StationType.Shop) { GameObject val3 = new GameObject("ro_trader"); val3.transform.SetParent(piecePrefab.transform, false); Trader val4 = val3.AddComponent<Trader>(); ((Behaviour)val4).enabled = false; val4.m_name = display; val4.m_items = new List<TradeItem>(); roStation.Trader = val4; } PieceManager.Instance.AddPiece(val2); } private static void StripInteractables(GameObject root) { MonoBehaviour[] componentsInChildren = root.GetComponentsInChildren<MonoBehaviour>(true); foreach (MonoBehaviour val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && !(val is Piece) && !(val is WearNTear) && !(val is ZNetView) && (val is Interactable || val is Hoverable || val is CraftingStation)) { Object.DestroyImmediate((Object)(object)val); } } } public static bool IsModTrader(Trader t) { if ((Object)(object)t != (Object)null) { return (Object)(object)((Component)t).GetComponentInParent<RoStation>() != (Object)null; } return false; } public static void FillCatalog(Trader trader) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown if (trader.m_items != null && trader.m_items.Count > 0) { return; } trader.m_items = new List<TradeItem>(); Entry[] catalog = Catalog; foreach (Entry entry in catalog) { GameObject val = (((Object)(object)ObjectDB.instance != (Object)null) ? ObjectDB.instance.GetItemPrefab(entry.Prefab) : null); ItemDrop val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<ItemDrop>() : null); if ((Object)(object)val2 == (Object)null) { Plugin.Log.LogWarning((object)("Kafra: item não encontrado " + entry.Prefab)); continue; } List<TradeItem> items = trader.m_items; TradeItem val3 = new TradeItem(); val3.m_prefab = val2; val3.m_stack = entry.Stack; val3.m_price = entry.Price; val3.m_requiredGlobalKey = entry.Key ?? ""; val3.m_name = ""; val3.m_tooltip = ""; val3.m_buyKey = ""; val3.m_incrementKey = ""; items.Add(val3); } } } public class RoStation : MonoBehaviour, Hoverable, Interactable { public StationType Type; public string DisplayName; public Trader Trader; private void Awake() { if ((Object)(object)Trader == (Object)null) { Trader = ((Component)this).GetComponentInChildren<Trader>(true); } } public string GetHoverText() { return DisplayName + "\n[<color=yellow><b>$KEY_Use</b></color>] Usar"; } public string GetHoverName() { return DisplayName; } public float GetHoverOffset() { return 0f; } public bool Interact(Humanoid user, bool hold, bool alt) { if (hold || (Object)(object)user != (Object)(object)Player.m_localPlayer) { return false; } switch (Type) { case StationType.Shop: RoPanel.OpenKafra(this); return true; case StationType.Refiner: RoGui.Open(RoGui.Window.Refine, this); return true; case StationType.CardAltar: RoGui.Open(RoGui.Window.Cards, this); return true; case StationType.Forge: RoGui.Open(RoGui.Window.Forge, this); return true; case StationType.RuneTable: RoGui.Open(RoGui.Window.Runes, this); return true; default: return false; } } public bool UseItem(Humanoid user, ItemData item) { return false; } } } namespace RagnarokValheim.Core { public static class Backup { private static Player _savedFor; public static string Folder => Path.GetFullPath(Path.Combine(Paths.BepInExRootPath, Path.Combine("..", "RagnarokValheim_Backups"))); private static string Safe(string s) { char[] invalidFileNameChars = Path.GetInvalidFileNameChars(); foreach (char oldChar in invalidFileNameChars) { s = s.Replace(oldChar, '_'); } return s; } public static string Save(string reason) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || !RoPlayer.Ready) { return null; } RoPlayer.Save(); Directory.CreateDirectory(Folder); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("# RagnarokValheim 0.14.0 — " + localPlayer.GetPlayerName() + " — " + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + " (" + reason + ")"); foreach (KeyValuePair<string, string> customDatum in localPlayer.m_customData) { if (customDatum.Key.StartsWith("ro_")) { stringBuilder.AppendLine(customDatum.Key + "\t" + customDatum.Value.Replace("\n", " ")); } } string text = Path.Combine(Folder, Safe(localPlayer.GetPlayerName()) + "_" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".txt"); File.WriteAllText(text, stringBuilder.ToString(), new UTF8Encoding(encoderShouldEmitUTF8Identifier: false)); List<string> list = new List<string>(Directory.GetFiles(Folder, Safe(localPlayer.GetPlayerName()) + "_*.txt")); list.Sort(); for (int i = 0; i < list.Count - 15; i++) { try { File.Delete(list[i]); } catch (Exception) { } } return text; } public static List<string> List() { Player localPlayer = Player.m_localPlayer; List<string> list = new List<string>(); if ((Object)(object)localPlayer == (Object)null || !Directory.Exists(Folder)) { return list; } list.AddRange(Directory.GetFiles(Folder, Safe(localPlayer.GetPlayerName()) + "_*.txt")); list.Sort(); list.Reverse(); return list; } public static string Restore(int index) { Player localPlayer = Player.m_localPlayer; List<string> list = List(); if ((Object)(object)localPlayer == (Object)null || index < 0 || index >= list.Count) { return "Backup não encontrado."; } Save("antes de restaurar"); list = List(); string path = list[Mathf.Min(index + 1, list.Count - 1)]; int num = 0; string[] array = File.ReadAllLines(path, Encoding.UTF8); foreach (string text in array) { if (!text.StartsWith("#")) { int num2 = text.IndexOf('\t'); if (num2 > 0) { localPlayer.m_customData[text.Substring(0, num2)] = text.Substring(num2 + 1); num++; } } } RoPlayer.Reload(); return "Restaurado: " + Path.GetFileName(path) + " (" + num + " dados)."; } public static void Tick(Player p) { if ((Object)(object)p == (Object)null || (Object)(object)p == (Object)(object)_savedFor || !RoPlayer.Ready) { return; } _savedFor = p; if (!p.m_customData.TryGetValue("ro_seenver", out var value) || value != "0.14.0") { RoPlayer.Center("<color=#ffd780>RagnarokValheim 0.14.0: veja as novidades no painel Ragnarok (K).</color>"); } try { Save("automático ao entrar"); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Backup: " + ex.Message)); } } } public class CampSystem : MonoBehaviour { public class Camp { public string Id; public int Tier; public Biome Biome; public Vector3 Pos; public string Key => "ro_camp_" + Id; public bool Conquered => Progression.HasKey(Key); } [HarmonyPatch(typeof(Game), "Start")] private static class GameStartPatch { private static void Postfix() { ZRoutedRpc.instance.Register<string>("RO_CampActive", (Action<long, string>)delegate(long s, string id) { ActiveUntil[id] = Time.time + 600f; }); } } private const string ActiveRpc = "RO_CampActive"; public static CampSystem Instance; public static readonly List<Camp> Camps = new List<Camp>(); private static readonly Dictionary<string, float> ActiveUntil = new Dictionary<string, float>(); private readonly Dictionary<string, GameObject> _visuals = new Dictionary<string, GameObject>(); private readonly Dictionary<string, PinData> _pins = new Dictionary<string, PinData>(); private readonly Dictionary<string, string> _pinNames = new Dictionary<string, string>(); private bool _ready; private float _timer; private static readonly Biome[] Biomes = (Biome[])(object)new Biome[7] { (Biome)1, (Biome)8, (Biome)2, (Biome)4, (Biome)16, (Biome)512, (Biome)32 }; private void Awake() { Instance = this; } private void Update() { _timer -= Time.deltaTime; if (_timer > 0f) { return; } _timer = 1f; Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || WorldGenerator.instance == null || (Object)(object)ZoneSystem.instance == (Object)null || (Object)(object)ZNetScene.instance == (Object)null) { if ((Object)(object)localPlayer == (Object)null) { Clear(); } } else { if (!RoConfig.CampsEnabled.Value) { return; } if (!_ready) { if ((Object)(object)DungeonSystem.Instance == (Object)null || !DungeonSystem.Instance.HasPosition(Dungeons.All[0])) { return; } Compute(); } foreach (Camp camp in Camps) { UpdateCamp(localPlayer, camp); } } } private void Clear() { foreach (GameObject value in _visuals.Values) { if ((Object)(object)value != (Object)null) { Object.Destroy((Object)(object)value); } } _visuals.Clear(); _pins.Clear(); _pinNames.Clear(); Camps.Clear(); _ready = false; } private void Compute() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) Camps.Clear(); WorldGenerator instance = WorldGenerator.instance; float waterLevel = ZoneSystem.instance.m_waterLevel; List<Vector3> list = new List<Vector3>(); if ((Object)(object)DungeonSystem.Instance != (Object)null) { foreach (DungeonDef item in Dungeons.All) { if (DungeonSystem.Instance.HasPosition(item)) { list.Add(DungeonSystem.Instance.PositionOf(item)); } } } for (int i = 0; i < Biomes.Length; i++) { for (int j = 0; j < 2; j++) { float angle = (float)i * 51f + 25f + (float)j * 180f; if (Find(instance, Biomes[i], angle, waterLevel, list, out var result)) { list.Add(result); Camps.Add(new Camp { Id = i + "_" + j, Tier = i + 1, Biome = Biomes[i], Pos = result }); } } } _ready = true; Plugin.Log.LogInfo((object)("Acampamentos inimigos posicionados: " + Camps.Count)); } private static bool Find(WorldGenerator wg, Biome biome, float angle, float water, List<Vector3> taken, out Vector3 result) { //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) for (float num = 350f; num < 10000f; num += 170f) { int num2 = Mathf.Max(8, Mathf.CeilToInt((float)Math.PI * 2f * num / 170f)); for (int i = 0; i < num2; i++) { int num3 = ((i % 2 == 0) ? 1 : (-1)) * ((i + 1) / 2); float num4 = (angle + (float)num3 * 360f / (float)num2) * ((float)Math.PI / 180f); float num5 = Mathf.Cos(num4) * num; float num6 = Mathf.Sin(num4) * num; if (wg.GetBiome(new Vector3(num5, 0f, num6)) != biome) { continue; } float height = wg.GetHeight(num5, num6); if (height < water + 3f) { continue; } float height2 = wg.GetHeight(num5 + 7f, num6); float height3 = wg.GetHeight(num5 - 7f, num6); float height4 = wg.GetHeight(num5, num6 + 7f); float height5 = wg.GetHeight(num5, num6 - 7f); if (Mathf.Abs(height2 - height) > 2.5f || Mathf.Abs(height3 - height) > 2.5f || Mathf.Abs(height4 - height) > 2.5f || Mathf.Abs(height5 - height) > 2.5f) { continue; } bool flag = false; foreach (Vector3 item in taken) { if (Vector2.Distance(new Vector2(item.x, item.z), new Vector2(num5, num6)) < 300f) { flag = true; } } if (!flag) { result = new Vector3(num5, height, num6); return true; } } } result = Vector3.zero; return false; } private void UpdateCamp(Player p, Camp c) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected O, but got Unknown //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Expected O, but got Unknown //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) float num = Vector2.Distance(new Vector2(((Component)p).transform.position.x, ((Component)p).transform.position.z), new Vector2(c.Pos.x, c.Pos.z)); bool conquered = c.Conquered; string key = "ro_campseen_" + c.Id; if (num < 250f && !p.m_customData.ContainsKey(key)) { p.m_customData[key] = "1"; if (!conquered) { RoPlayer.Notify("<color=#ff9060>Você avistou um acampamento inimigo (" + RoPanel.BiomeName(c.Biome) + ")</color>"); } } if (p.m_customData.ContainsKey(key) && (Object)(object)Minimap.instance != (Object)null) { string text = (conquered ? "Posto avançado (Kafra e cama)" : ("Acampamento inimigo — " + RoPanel.BiomeName(c.Biome))); if (!_pinNames.TryGetValue(c.Id, out var value) || value != text) { if (_pins.TryGetValue(c.Id, out var value2) && value2 != null) { Minimap.instance.RemovePin(value2); } _pins[c.Id] = Minimap.instance.AddPin(c.Pos, (PinType)(conquered ? 1 : 2), text, false, false, 0L, default(PlatformUserID)); _pinNames[c.Id] = text; } } _visuals.TryGetValue(c.Id, out var value3); if (!conquered && num < 150f && (Object)(object)value3 == (Object)null && ZoneSystem.instance.IsZoneLoaded(c.Pos)) { float y = default(float); if (!ZoneSystem.instance.GetGroundHeight(c.Pos, ref y)) { y = c.Pos.y; } GameObject val = new GameObject("RO_Camp_" + c.Id); val.transform.position = new Vector3(c.Pos.x, y, c.Pos.z); GameObject val2 = DungeonSystem.LocalCopy("fire_pit", val.transform.position, Quaternion.identity); if ((Object)(object)val2 != (Object)null) { val2.transform.SetParent(val.transform, true); Transform[] componentsInChildren = val2.GetComponentsInChildren<Transform>(true); foreach (Transform val3 in componentsInChildren) { if (((Object)val3).name == "_enabled" || ((Object)val3).name == "_enabled_high") { ((Component)val3).gameObject.SetActive(true); } } } GameObject val4 = new GameObject("light"); val4.transform.SetParent(val.transform, false); val4.transform.localPosition = Vector3.up * 2f; Light val5 = val4.AddComponent<Light>(); val5.type = (LightType)2; val5.color = new Color(1f, 0.45f, 0.2f); val5.range = 10f; val5.intensity = 2f; val5.shadows = (LightShadows)0; _visuals[c.Id] = val; } else if ((conquered || num > 250f) && (Object)(object)value3 != (Object)null) { Object.Destroy((Object)(object)value3); _visuals.Remove(c.Id); } float value4; bool flag = ActiveUntil.TryGetValue(c.Id, out value4) && Time.time < value4; if (!conquered && !flag && num < 25f && !((Character)p).IsDead() && DungeonSystem.ActiveRun == null && !WorldEvents.InvasionActive) { ZRoutedRpc.instance.InvokeRoutedRPC(0L, "RO_CampActive", new object[1] { c.Id }); ((MonoBehaviour)this).StartCoroutine(Assault(c)); } } private IEnumerator Assault(Camp c) { DungeonDef dg = Dungeons.ByTier(c.Tier); Vector3 center = c.Pos; float ground = default(float); if (ZoneSystem.instance.GetGroundHeight(center, ref ground)) { center.y = ground; } WorldEvents.Message(center, 80f, "<color=#ff9060>Os defensores do acampamento atacam!</color>"); List<Character> alive = new List<Character>(); bool failed = false; for (int wave = 1; wave <= 2; wave++) { if (failed) { break; } int n = 4 + 2 * (EnemyScaling.PlayersNear(center) - 1); for (int i = 0; i < n; i++) { Character m = DungeonSystem.Spawn(dg.Waves[Random.Range(0, dg.Waves.Length)], center, wave + 1, 6f, 14f); if ((Object)(object)m != (Object)null) { MonsterMods.Tag(m, 1f, 1f, 1.2f, null, "camp", 0f); alive.Add(m); } yield return (object)new WaitForSeconds(0.25f); } float timeout = 180f; while (timeout > 0f) { alive.RemoveAll((Character x) => (Object)(object)x == (Object)null || x.IsDead()); if (alive.Count == 0) { break; } Player p = Player.m_localPlayer; if ((Object)(object)p == (Object)null || ((Character)p).IsDead() || Vector3.Distance(((Component)p).transform.position, center) > 90f) { failed = true; break; } DungeonSystem.RunStatus = "Acampamento: onda " + wave + "/2 — restam " + alive.Count; timeout -= 1f; yield return (object)new WaitForSeconds(1f); } if (timeout <= 0f) { failed = true; } } if (!failed) { Character chief = DungeonSystem.Spawn(dg.Mvp, center, Mathf.Min(dg.MvpStars + 1, 3), 6f, 10f); if ((Object)(object)chief != (Object)null) { MonsterMods.MakeElite(chief, (EliteAffix)Random.Range(1, 4)); MonsterMods.Tag(chief, 1.5f * EnemyScaling.MvpExtra(center), 1f, 2f, "Chefe do Acampamento", "camp", 1.2f); } WorldEvents.Message(center, 80f, "<color=#ff4040>O Chefe do Acampamento apareceu!</color>"); float timeout2 = 300f; while ((Object)(object)chief != (Object)null && !chief.IsDead() && timeout2 > 0f) { Player p2 = Player.m_localPlayer; if ((Object)(object)p2 == (Object)null || ((Character)p2).IsDead() || Vector3.Distance(((Component)p2).transform.position, center) > 90f) { failed = true; break; } DungeonSystem.RunStatus = "Acampamento: chefe"; timeout2 -= 1f; yield return (object)new WaitForSeconds(1f); } if (timeout2 <= 0f) { failed = true; } } DungeonSystem.RunStatus = ""; if (failed) { WorldEvents.Message(center, 90f, "<color=#ff6060>O acampamento resistiu.</color> Volte em 10 minutos."); yield break; } ZoneSystem.instance.SetGlobalKey(c.Key); WorldEvents.Message(center, 90f, "<color=#ffd700>Acampamento conquistado! Agora é um posto avançado com Kafra e cama.</color>"); Journal.CountNear(center, 90f, "camp"); Rewards.Spawn("Coins", 80 * c.Tier, center); for (int num = 0; num < 2; num++) { Rewards.Spawn((Random.value < 0.5f) ? "RO_Oridecon" : "RO_Elunium", 1, center); } if (Random.value < 0.5f) { Rewards.Spawn("RO_TreasureMap", 1, center); } Build("fire_pit", center, 0f); Build("RO_KafraShop", center + new Vector3(4f, 0f, 0f), 270f); Build("bed", center + new Vector3(-3.5f, 0f, 2f), 90f); } private static void SetCreator(Piece piece) { if ((Object)(object)piece == (Object)null || (Object)(object)Game.instance == (Object)null) { return; } try { MethodInfo methodInfo = AccessTools.Method(typeof(Piece), "SetCreator", (Type[])null, (Type[])null); if (methodInfo == null) { return; } ParameterInfo[] parameters = methodInfo.GetParameters(); object[] array = new object[parameters.Length]; array[0] = Game.instance.GetPlayerProfile().GetPlayerID(); for (int i = 1; i < parameters.Length; i++) { Type parameterType = parameters[i].ParameterType; object obj = (parameterType.IsValueType ? Activator.CreateInstance(parameterType) : null); MethodInfo methodInfo2 = AccessTools.Method(typeof(Game), "GetPlatformUserID", (Type[])null, (Type[])null) ?? AccessTools.Method(typeof(PlayerProfile), "GetPlatformUserID", (Type[])null, (Type[])null); if (methodInfo2 != null && methodInfo2.ReturnType == parameterType) { obj = (methodInfo2.IsStatic ? methodInfo2.Invoke(null, null) : methodInfo2.Invoke((methodInfo2.DeclaringType == typeof(Game)) ? ((object?)Game.instance) : ((object?)Game.instance.GetPlayerProfile()), null)); } array[i] = obj; } methodInfo.Invoke(piece, array); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Dono do posto: " + ex.Message)); } } private static void Build(string prefabName, Vector3 pos, float yaw) { //IL_0030: 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_004f: Unknown result type (might be due to invalid IL or missing references) GameObject prefab = ZNetScene.instance.GetPrefab(prefabName); if ((Object)(object)prefab == (Object)null) { Plugin.Log.LogWarning((object)("Peça não encontrada: " + prefabName)); return; } float y = default(float); if (ZoneSystem.instance.GetGroundHeight(pos, ref y)) { pos.y = y; } GameObject val = Object.Instantiate<GameObject>(prefab, pos, Quaternion.Euler(0f, yaw, 0f)); SetCreator(val.GetComponent<Piece>()); } } public static class ClassProgress { public class JTask { public string Text; public Func<long> Have; public long Need; public bool Done { get { long num; try { num = Have(); } catch (Exception) { num = 0L; } return num >= Need; } } public long Value { get { try { return Have(); } catch (Exception) { return 0L; } } } } public class Chapter { public string Name; public string Title; public List<JTask> Tasks = new List<JTask>(); public int Essences; public int Emblems; public long Zeny; public string Item; public int ItemAmount; public string RewardText() { List<string> list = new List<string>(); list.Add(Essences + " Essências da sua família"); if (Emblems > 0) { list.Add(Emblems + " Emblemas de Classe"); } list.Add(Zeny.ToString("N0") + "z"); if (Item != null) { list.Add(ItemAmount + "× " + Journal.ItemName(Item)); } list.Add("título \"" + Title + "\""); return string.Join(", ", list.ToArray()); } } public class Offer { public string Item; public string Name; public string Note; public int Cost; public string Blocked; } public const string AuraHideKey = "ro_aurahide"; public static readonly List<Chapter> Chapters; private static string _nextCache; private static float _nextAt; public static readonly int[] LevelMilestones; private static int _chFloor; private static readonly Dictionary<string, long> _snap; private static readonly string[] SnapKeys; private static RelicDef Relic { get { if (RoPlayer.Stats == null) { return null; } return RoPlayer.Stats.Relic; } } public static float HealRange() { RelicDef relic = Relic; return RoConfig.SupportRange.Value + (relic?.HealRange ?? 0f); } public static float SongRange() { RelicDef relic = Relic; return RoConfig.SupportRange.Value + (relic?.SongRange ?? 0f); } public static void AfterHeal(Player target, float amount) { RelicDef relic = Relic; if (relic != null && !(relic.HealRegen <= 0f) && !((Object)(object)target == (Object)null) && !(amount <= 0f) && !((Object)(object)Plugin.Instance == (Object)null)) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(Regen(target, amount * relic.HealRegen)); } } private static IEnumerator Regen(Player target, float total) { float tick = total / 5f; for (int i = 0; i < 5; i++) { yield return (object)new WaitForSeconds(1f); if (!((Object)(object)target == (Object)null) && !((Character)target).IsDead()) { Journal.Add("heal", (long)Mathf.Min(tick, ((Character)target).GetMaxHealth() - ((Character)target).GetHealth())); ((Character)target).Heal(tick, i == 4); continue; } break; } } public static void OnJobChange(JobDef job) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || job == null) { return; } string text = Synergy.FamilyOf(job.Id); if (text == null) { return; } List<string> list = new List<string>(); if (job.Tier == 1) { foreach (ClassLine line in Equipment.Lines) { if (line.Family == text && line.Weapon && Equipment.OwnedStage(localPlayer, line) == 0) { WorldDrops.Give(localPlayer, line.ItemId(1), 1); list.Add(Equipment.ById[line.ItemId(1)].Name); } } WorldDrops.Give(localPlayer, ClassGear.Essence(text), 3); list.Add("3× " + ClassGear.EssenceNames[text]); } else { RelicDef relicDef = Relics.ForJob(job.Id); if (relicDef != null) { if (WorldDrops.Count(localPlayer, relicDef.Id) == 0) { WorldDrops.Give(localPlayer, relicDef.Id, 1); } list.Add("<color=#ffd700>" + relicDef.Name + "</color> (relíquia)"); } else { WorldDrops.Give(localPlayer, "RO_MvpCore", 1); list.Add("Núcleo de MVP"); } int num = ((job.Tier == 2) ? 6 : 10); WorldDrops.Give(localPlayer, ClassGear.Essence(text), num); WorldDrops.Give(localPlayer, "RO_ClassEmblem", (job.Tier == 2) ? 2 : 4); list.Add(num + "× " + ClassGear.EssenceNames[text]); list.Add(((job.Tier == 2) ? 2 : 4) + "× Emblema de Classe"); } RoPlayer.Notify("<color=#ffd780>Presente de " + job.Name + ": " + string.Join(", ", list.ToArray()) + "</color>"); } private static Chapter Ch(string name, string title, int ess, int emb, long zeny, string item, int amount) { Chapter chapter = new Chapter(); chapter.Name = name; chapter.Title = title; chapter.Essences = ess; chapter.Emblems = emb; chapter.Zeny = zeny; chapter.Item = item; chapter.ItemAmount = amount; Chapter chapter2 = chapter; Chapters.Add(chapter2); return chapter2; } private static JTask T(string text, long need, Func<long> have) { JTask jTask = new JTask(); jTask.Text = text; jTask.Need = need; jTask.Have = have; return jTask; } private static JTask Lv(int n) { return T("Chegue ao nível de base " + n, n, () => RoPlayer.Data.BaseLevel); } private static JTask Job(int tier) { return T("Mude para uma classe de " + tier + "ª", tier, () => RoPlayer.Data.Job.Tier); } private static JTask Boss(string key, string name) { return T("Derrote " + name, 1L, () => Progression.HasKey(key) ? 1 : 0); } private static JTask Forge(int stage) { return T("Tenha um equipamento de classe " + Equipment.Roman(stage) + " (Forja Ragnarok)", stage, () => ForgeStage()); } private static JTask Food(int n) { return T("Prove todos os alimentos de " + n + ((n == 1) ? " bioma" : " biomas"), n, () => FoodSystem.CompleteBiomes()); } private static JTask DgLv(int n) { return T("Libere o nível +" + n + " em uma masmorra", n, () => MaxDungeonLevel()); } private static JTask Tower(int n) { return T("Chegue ao andar " + n + " da Torre sem Fim", n, () => DungeonSystem.TowerBest()); } private static JTask MidSet(int n) { return T("Tenha " + n + " peças do conjunto de classe intermediário", n, () => SetPieces(mid: true)); } private static JTask LateSet(int n) { return T("Tenha " + n + " peças do conjunto de classe final", n, () => SetPieces(mid: false)); } private static JTask Dg(string id) { DungeonDef d = Dungeons.Get(id); string text = ((d != null) ? d.Name : id); return T("Conclua " + text, 1L, () => ((d != null && DungeonSystem.Unlocked(d) >= 1) || Journal.Get("dg:" + id) > 0) ? 1 : 0); } static ClassProgress() { Chapters = new List<Chapter>(); LevelMilestones = new int[6] { 30, 50, 70, 90, 120, 150 }; _chFloor = -1; _snap = new Dictionary<string, long>(); SnapKeys = new string[5] { "heal", "rangedhit", "song", "crit", "kill" }; Chapter chapter = Ch("Campos", "Desbravador dos Campos", 3, 0, 1000L, "RO_BattleManual", 1); chapter.Tasks.Add(Lv(15)); chapter.Tasks.Add(Job(1)); chapter.Tasks.Add(Dg("meadows")); chapter.Tasks.Add(Food(1)); chapter.Tasks.Add(Boss("defeated_eikthyr", "Eikthyr")); chapter = Ch("Floresta Negra", "Andarilho da Floresta", 5, 1, 3000L, "RO_YggLeaf", 1); chapter.Tasks.Add(Lv(30)); chapter.Tasks.Add(Forge(1)); chapter.Tasks.Add(Dg("blackforest")); chapter.Tasks.Add(Dg("guild")); chapter.Tasks.Add(Boss("defeated_gdking", "O Ancião")); chapter = Ch("Pântano", "Purificador do Pântano", 6, 2, 8000L, "RO_BlueGem", 3); chapter.Tasks.Add(Lv(45)); chapter.Tasks.Add(Job(2)); chapter.Tasks.Add(Forge(2)); chapter.Tasks.Add(Dg("swamp")); chapter.Tasks.Add(Dg("sewer")); chapter.Tasks.Add(Dg("cathedral")); chapter.Tasks.Add(Boss("defeated_bonemass", "Massa Óssea")); chapter = Ch("Montanhas", "Escalador de Picos", 8, 3, 15000L, "RO_MvpCore", 1); chapter.Tasks.Add(Lv(60)); chapter.Tasks.Add(Dg("mountain")); chapter.Tasks.Add(Dg("glacial")); chapter.Tasks.Add(Dg("theater")); chapter.Tasks.Add(MidSet(2)); chapter.Tasks.Add(Boss("defeated_dragon", "Moder")); chapter = Ch("Planícies", "Conquistador das Planícies", 10, 4, 25000L, "RO_YggLeaf", 2); chapter.Tasks.Add(Lv(75)); chapter.Tasks.Add(Forge(3)); chapter.Tasks.Add(Dg("plains")); chapter.Tasks.Add(Dg("raid")); chapter.Tasks.Add(DgLv(5)); chapter.Tasks.Add(Boss("defeated_goblinking", "Yagluth")); chapter = Ch("Terras Nebulosas", "Vidente da Névoa", 12, 5, 40000L, "RO_YggSeed", 1); chapter.Tasks.Add(Lv(94)); chapter.Tasks.Add(Job(3)); chapter.Tasks.Add(Forge(4)); chapter.Tasks.Add(Dg("mistlands")); chapter.Tasks.Add(MidSet(4)); chapter.Tasks.Add(Boss("defeated_queen", "A Rainha")); chapter = Ch("Cinzas", "Senhor das Cinzas", 15, 6, 60000L, "RO_YggSeed", 2); chapter.Tasks.Add(Lv(115)); chapter.Tasks.Add(Forge(5)); chapter.Tasks.Add(Dg("ashlands")); chapter.Tasks.Add(LateSet(2)); chapter.Tasks.Add(Boss("defeated_fader", "Fader")); chapter = Ch("Lenda de Midgard", "Lenda de Midgard", 20, 10, 100000L, "RO_YggSeed", 3); chapter.Tasks.Add(Lv(145)); chapter.Tasks.Add(Forge(6)); chapter.Tasks.Add(LateSet(4)); chapter.Tasks.Add(Tower(50)); chapter.Tasks.Add(DgLv(10)); chapter.Tasks.Add(T("Tenha a relíquia da sua 3ª classe", 1L, () => (Relic != null && Relic.JobTier >= 3) ? 1 : 0)); } private static int MaxDungeonLevel() { int num = 0; foreach (DungeonDef item in Dungeons.All) { num = Math.Max(num, DungeonSystem.Unlocked(item)); } return num; } public static int ForgeStage() { Player localPlayer = Player.m_localPlayer; string text = ((RoPlayer.Data != null) ? Synergy.FamilyOf(RoPlayer.Data.JobId) : null); int num = (int)Journal.Get("forge"); if ((Object)(object)localPlayer != (Object)null && text != null) { foreach (ClassLine line in Equipment.Lines) { if (line.Family == text) { num = Math.Max(num, Equipment.OwnedStage(localPlayer, line)); } } } return num; } public static int SetPieces(bool mid) { Player localPlayer = Player.m_localPlayer; string text = ((RoPlayer.Data != null) ? Synergy.FamilyOf(RoPlayer.Data.JobId) : null); if ((Object)(object)localPlayer == (Object)null || text == null) { return 0; } int num = 0; foreach (SetDef item in Equipment.ClassSetsOf(text)) { if (Equipment.IsMidSet(item.Id) != mid) { continue; } foreach (string piece in item.Pieces) { if (WorldDrops.Count(localPlayer, piece) > 0) { num++; } } } return num; } public static bool ChapterClaimed(int i) { return Journal.Get("jrny:" + i) > 0; } public static int CurrentChapter() { for (int i = 0; i < Chapters.Count; i++) { if (!ChapterClaimed(i)) { return i; } } return -1; } public static string NextObjective() { if (Time.time < _nextAt) { return _nextCache; } _nextAt = Time.time + 2f; _nextCache = ComputeNextObjective(); return _nextCache; } private static string ComputeNextObjective() { if (RoPlayer.Data == null) { return null; } int num = CurrentChapter(); if (num < 0) { return null; } Chapter chapter = Chapters[num]; foreach (JTask task in chapter.Tasks) { if (!task.Done) { string text = ((task.Need > 1) ? (" " + Math.Min(task.Value, task.Need) + "/" + task.Need) : ""); return "Jornada — " + chapter.Name + ": " + task.Text + text; } } return "Jornada — " + chapter.Name + ": concluído!"; } public static List<string> Titles() { List<string> list = new List<string>(); for (int i = 0; i < Chapters.Count; i++) { if (ChapterClaimed(i)) { list.Add(Chapters[i].Title); } } return list; } public static string MilestoneReward(int lv) { return (lv * 150).ToString("N0") + "z, " + lv / 10 + " Essências" + ((lv >= 50) ? (", " + ((lv < 90) ? 1 : 3) + " Emblemas") : "") + ((lv == 70 || lv == 120) ? ", Folha de Yggdrasil" : "") + ((lv == 150) ? ", 3 Sementes de Yggdrasil" : ""); } private static void GiveMilestone(Player p, int lv, string fam) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) RoPlayer.AddZeny((long)lv * 150L, silent: true); if (fam != null) { WorldDrops.Give(p, ClassGear.Essence(fam), lv / 10); } if (lv >= 50) { WorldDrops.Give(p, "RO_ClassEmblem", (lv < 90) ? 1 : 3); } if (lv == 70 || lv == 120) { WorldDrops.Give(p, "RO_YggLeaf", 1); } if (lv == 150) { WorldDrops.Give(p, "RO_YggSeed", 3); } WorldEvents.Message(((Component)p).transform.position, 60f, "<color=#ffd780>" + p.GetPlayerName() + " alcançou o marco do nível " + lv + "!</color>"); WorldEvents.Fx(4, ((Component)p).transform.position + Vector3.up); RoPlayer.Notify("<color=#ffd780>Marco do nível " + lv + ": " + MilestoneReward(lv) + "</color>"); } public static void Tick(Player p) { //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) RoData data = RoPlayer.Data; if ((Object)(object)p == (Object)null || data == null) { return; } string text = Synergy.FamilyOf(data.JobId); int[] levelMilestones = LevelMilestones; foreach (int num in levelMilestones) { if (data.BaseLevel >= num && Journal.Get("lvms:" + num) <= 0) { Journal.Add("lvms:" + num, 1L); GiveMilestone(p, num, text); } } int num2 = CurrentChapter(); if (num2 < 0 || text == null) { return; } Chapter chapter = Chapters[num2]; foreach (JTask task in chapter.Tasks) { if (!task.Done) { return; } } Journal.Add("jrny:" + num2, 1L); WorldDrops.Give(p, ClassGear.Essence(text), chapter.Essences); if (chapter.Emblems > 0) { WorldDrops.Give(p, "RO_ClassEmblem", chapter.Emblems); } if (chapter.Item != null) { WorldDrops.Give(p, chapter.Item, chapter.ItemAmount); } RoPlayer.AddZeny(chapter.Zeny, silent: true); RoPlayer.Center("<color=#ffd700>Jornada: capítulo \"" + chapter.Name + "\" concluído!</color> Título: " + chapter.Title); RoPlayer.Notify("<color=#ffd780>Recompensa da Jornada: " + chapter.RewardText() + "</color>"); WorldEvents.Message(((Component)p).transform.position, 60f, "<color=#ffd780>" + p.GetPlayerName() + " concluiu o capítulo \"" + chapter.Name + "\" da Jornada!</color>"); WorldEvents.Fx(4, ((Component)p).transform.position + Vector3.up); } public static int RecommendedLevel(DungeonDef d, int level) { if (d == null) { return 1; } int num = Mathf.Clamp(d.Tier, 1, Progression.Milestones.Length); int num2 = ((num <= 1) ? 10 : (Progression.Milestones[num - 1].BaseCap - 15)); if (d.Kind == DungeonKind.Raid) { num2 += 5; } num2 += 2 * Mathf.Max(0, level); return Mathf.Clamp(num2, 1, 150); } public static string RecommendedText(DungeonDef d, int level) { int num = RecommendedLevel(d, level); int num2 = ((RoPlayer.Data == null) ? 1 : RoPlayer.Data.BaseLevel); string text = ((num2 >= num) ? "#90ff90" : ((num2 >= num - 10) ? "#ffd700" : "#ff7060")); return "Nível recomendado: <color=" + text + ">" + num + "</color> (você: " + num2 + ")"; } public static void WarnIfUnderLevel(DungeonDef d, int level) { if (d != null && d.Kind != DungeonKind.Tower && RoPlayer.Data != null) { int num = RecommendedLevel(d, level); if (RoPlayer.Data.BaseLevel < num - 10) { RoPlayer.Center("<color=#ff9a80>Cuidado: " + d.Name + " é recomendada para nível " + num + " (você está no " + RoPlayer.Data.BaseLevel + ").</color>"); } } } public static string ChallengeText(string fam, int floor) { return fam switch { "Acolyte" => "cure " + HealNeed(floor) + " de HP do grupo", "Archer" => "acerte " + RangedNeed(floor) + " ataques à distância (ou cante uma canção)", "Thief" => "acerte " + CritNeed(floor) + " golpes críticos", _ => "derrote 4 inimigos", }; } private static int HealNeed(int floor) { return 300 + 30 * floor; } private static int RangedNeed(int floor) { return 20 + floor / 2; } private static int CritNeed(int floor) { return 10 + floor / 5; } private static long Delta(string key) { long value; return Journal.Get(key) - (_snap.TryGetValue(key, out value) ? value : Journal.Get(key)); } public static void OnTowerFloorStart(int floor) { if (floor % 10 == 0 && RoPlayer.Data != null) { _chFloor = floor; _snap.Clear(); string[] snapKeys = SnapKeys; foreach (string key in snapKeys) { _snap[key] = Journal.Get(key); } string fam = Synergy.FamilyOf(RoPlayer.Data.JobId); RoPlayer.Notify("<color=#d0a0ff>Desafio de classe (andar " + floor + "): " + ChallengeText(fam, floor) + " neste andar.</color>"); } } public static void OnTowerFloorClear(int floor) { Player localPlayer = Player.m_localPlayer; if (floor % 10 != 0 || _chFloor != floor || (Object)(object)localPlayer == (Object)null || RoPlayer.Data == null) { return; } _chFloor = -1; string text = Synergy.FamilyOf(RoPlayer.Data.JobId); if (text switch { "Acolyte" => (Delta("heal") >= HealNeed(floor)) ? 1 : 0, "Archer" => (Delta("rangedhit") >= RangedNeed(floor) || Delta("song") >= 1) ? 1 : 0, "Thief" => (Delta("crit") >= CritNeed(floor)) ? 1 : 0, _ => (Delta("kill") >= 4) ? 1 : 0, } == 0) { RoPlayer.Notify("<color=#a0a0a0>Desafio de classe do andar " + floor + " não cumprido.</color>"); return; } Journal.Add("twch", 1L); WorldDrops.Give(localPlayer, "RO_ClassEmblem", 2); if (text != null) { WorldDrops.Give(localPlayer, ClassGear.Essence(text), 3); } RoPlayer.Center("<color=#d0a0ff>Desafio de classe cumprido!</color> +2 Emblemas de Classe" + ((text != null) ? ", +3 Essências" : "")); if (Journal.Get("twch") == 1 || Journal.Get("twch") == 5 || Journal.Get("twch") == 10) { RoPlayer.Notify("<color=#d0a0ff>Sua Aura da Torre ficou mais forte (" + Journal.Get("twch") + " desafios).</color>"); } } public static int AuraLevel() { long num = Journal.Get("twch"); if (num < 10) { if (num < 5) { if (num < 1) { return 0; } return 1; } return 2; } return 3; } public static bool AuraHidden() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null && localPlayer.m_customData.TryGetValue("ro_aurahide", out var v