Decompiled source of SkillsReworked v1.0.5
SkillsReworked.dll
Decompiled 2 weeks 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.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using Groups; using HarmonyLib; using JetBrains.Annotations; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Extensions; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using SkillsReworked.Commands; using SkillsReworked.Integration; using SkillsReworked.Net; using SkillsReworked.Skillsystem; using SkillsReworked.UI; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("SkillsReworked")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SkillsReworked")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")] [assembly: AssemblyFileVersion("1.0.5")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.5.0")] namespace SkillsReworked { [BepInPlugin("M2Valheim.SkillsReworked", "SkillsReworked", "1.0.5")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class SkillsReworked : BaseUnityPlugin { public enum RebirthCostMode { None, LevelOnly, ItemOnly, Both } public const string PluginGUID = "M2Valheim.SkillsReworked"; public const string PluginName = "SkillsReworked"; public const string PluginVersion = "1.0.5"; private CustomLocalization _localization; private Harmony _harmony; private ConfigFileWatcher _configFileWatcher; public static SkillType M2CharacterLevelSkillType; public static ConfigEntry<int> basePointsCfg; public static ConfigEntry<int> pointsPerLevelCfg; public static ConfigEntry<float> multiplierCfg; public static ConfigEntry<float> deathXpLossFractionCfg; public static ConfigEntry<float> groupShareRadiusCfg; public static ConfigEntry<float> groupShareFactorCfg; public static ConfigEntry<bool> rebirthCostEnabledCfg; public static ConfigEntry<RebirthCostMode> rebirthCostModeCfg; public static ConfigEntry<int> rebirthLevelLossCfg; public static ConfigEntry<string> rebirthItemNameCfg; public static ConfigEntry<int> rebirthItemAmountCfg; public static ConfigEntry<bool> skillCapsEnabledCfg; public static ConfigEntry<int> capBeforeEikthyrCfg; public static ConfigEntry<int> capAfterEikthyrCfg; public static ConfigEntry<int> capAfterElderCfg; public static ConfigEntry<int> capAfterBonemassCfg; public static ConfigEntry<int> capAfterModerCfg; public static ConfigEntry<int> capAfterYagluthCfg; public static ConfigEntry<int> capAfterQueenCfg; public static ConfigEntry<int> capAfterFaderCfg; public static ConfigEntry<int> meadowsOptimalLevelCfg; public static ConfigEntry<int> blackForestOptimalLevelCfg; public static ConfigEntry<int> swampOptimalLevelCfg; public static ConfigEntry<int> mountainOptimalLevelCfg; public static ConfigEntry<int> plainsOptimalLevelCfg; public static ConfigEntry<int> mistlandsOptimalLevelCfg; public static ConfigEntry<int> ashlandsOptimalLevelCfg; public static ConfigEntry<int> deepNorthOptimalLevelCfg; public static ConfigEntry<float> xpMinFactorCfg; public static ConfigEntry<int> xpMaxOverLevelCfg; public static ConfigEntry<float> bossXpMultiplierCfg; public static ConfigEntry<bool> prestigeEnabledCfg; public static ConfigEntry<int> prestigeRequiredLevelCfg; public static ConfigEntry<int> prestigeMaxRankCfg; public static ConfigEntry<int> prestigePointsPerRankCfg; public static ConfigEntry<bool> prestigeItemCostEnabledCfg; public static ConfigEntry<string> prestigeItemNameCfg; public static ConfigEntry<int> prestigeItemAmountCfg; private void Awake() { //IL_068b: Unknown result type (might be due to invalid IL or missing references) //IL_0690: Unknown result type (might be due to invalid IL or missing references) //IL_069c: Unknown result type (might be due to invalid IL or missing references) //IL_06a8: Unknown result type (might be due to invalid IL or missing references) //IL_06b4: Unknown result type (might be due to invalid IL or missing references) //IL_06c0: Unknown result type (might be due to invalid IL or missing references) //IL_06ce: Expected O, but got Unknown //IL_06d5: Unknown result type (might be due to invalid IL or missing references) //IL_06da: Unknown result type (might be due to invalid IL or missing references) //IL_06e4: Unknown result type (might be due to invalid IL or missing references) //IL_0716: Unknown result type (might be due to invalid IL or missing references) //IL_0720: Expected O, but got Unknown AcceptableValueRange<float> val = new AcceptableValueRange<float>(0f, 10f); AcceptableValueRange<float> val2 = new AcceptableValueRange<float>(0f, 1f); AcceptableValueRange<float> val3 = new AcceptableValueRange<float>(0f, 100f); AcceptableValueRange<int> val4 = new AcceptableValueRange<int>(0, 150); AcceptableValueRange<int> val5 = new AcceptableValueRange<int>(0, 50); AcceptableValueRange<int> val6 = new AcceptableValueRange<int>(0, 100); AcceptableValueRange<int> val7 = new AcceptableValueRange<int>(0, 999); AcceptableValueRange<int> val8 = new AcceptableValueRange<int>(1, 100); AcceptableValueRange<int> val9 = new AcceptableValueRange<int>(0, 100); AcceptableValueRange<int> val10 = new AcceptableValueRange<int>(1, 100); AcceptableValueRange<int> val11 = new AcceptableValueRange<int>(0, 100); AcceptableValueRange<int> val12 = new AcceptableValueRange<int>(0, 100); basePointsCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "1 - General", "Base points", 15, "The base points you get at level 0.", true, true, true, (AcceptableValueBase)(object)val4, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); pointsPerLevelCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "1 - General", "Points per level", 5, "The skill points you get per level.", true, true, true, (AcceptableValueBase)(object)val5, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); multiplierCfg = ConfigFileExtensions.BindConfigInOrder<float>(((BaseUnityPlugin)this).Config, "1 - General", "XP multiplier", 1f, "The multiplier applied to all XP gained for the Level skill.", true, true, true, (AcceptableValueBase)(object)val, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); deathXpLossFractionCfg = ConfigFileExtensions.BindConfigInOrder<float>(((BaseUnityPlugin)this).Config, "1 - General", "Death XP loss", 0.25f, "XP loss of current level progress on death.\nIf the loss is larger than your current progress, your skill level will drop\nand the remaining loss is applied to the skill progress of the level below.\nExample: You are level 25 with 12% progress and the loss is 25%.\nYou will drop to level 24 with 87% progress.\n0 = no loss, 1 = lose 100% of one level worth of progress.", true, true, true, (AcceptableValueBase)(object)val2, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); rebirthCostEnabledCfg = ConfigFileExtensions.BindConfigInOrder<bool>(((BaseUnityPlugin)this).Config, "2 - Rebirth", "Enable Rebirth costs", true, "If true, performing a Rebirth consumes levels and/or items as configured.", true, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); rebirthCostModeCfg = ConfigFileExtensions.BindConfigInOrder<RebirthCostMode>(((BaseUnityPlugin)this).Config, "2 - Rebirth", "Rebirth cost mode", RebirthCostMode.Both, "Which costs are applied when performing a Rebirth: None, LevelOnly, ItemOnly, Both.", true, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); rebirthLevelLossCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "2 - Rebirth", "Levels lost per Rebirth", 5, "How many 'Level' skill levels are lost when performing Rebirth (if mode includes Level).", true, true, true, (AcceptableValueBase)(object)val6, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); rebirthItemNameCfg = ConfigFileExtensions.BindConfigInOrder<string>(((BaseUnityPlugin)this).Config, "2 - Rebirth", "Rebirth item name", "Coins", "Prefab name of the item required for Rebirth (e.g. 'Coins', 'TrophyEikthyr').", true, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); rebirthItemAmountCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "2 - Rebirth", "Rebirth item amount", 999, "How many items are required when performing Rebirth (if mode includes Item).", true, true, true, (AcceptableValueBase)(object)val7, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); groupShareRadiusCfg = ConfigFileExtensions.BindConfigInOrder<float>(((BaseUnityPlugin)this).Config, "3 - Groups", "GroupShareRadius", 50f, "Radius (in meters) around a kill in which group members receive bonus XP.", true, true, true, (AcceptableValueBase)(object)val3, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); groupShareFactorCfg = ConfigFileExtensions.BindConfigInOrder<float>(((BaseUnityPlugin)this).Config, "3 - Groups", "GroupShareFactor", 0.3f, "Fraction of the killer's XP that nearby group members receive (0.3 = 30%).", true, true, true, (AcceptableValueBase)(object)val2, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); skillCapsEnabledCfg = ConfigFileExtensions.BindConfigInOrder<bool>(((BaseUnityPlugin)this).Config, "4 - Skill Caps", "Enable skill caps", true, "If true, regular skills are limited by boss-based caps.", true, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); capBeforeEikthyrCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "4 - Skill Caps", "Cap before Eikthyr", 20, "Max skill level before defeating Eikthyr.", true, true, true, (AcceptableValueBase)(object)val8, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); capAfterEikthyrCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "4 - Skill Caps", "Cap after Eikthyr", 30, "Max skill level after defeating Eikthyr.", true, true, true, (AcceptableValueBase)(object)val8, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); capAfterElderCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "4 - Skill Caps", "Cap after Elder", 40, "Max skill level after defeating The Elder.", true, true, true, (AcceptableValueBase)(object)val8, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); capAfterBonemassCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "4 - Skill Caps", "Cap after Bonemass", 50, "Max skill level after defeating Bonemass.", true, true, true, (AcceptableValueBase)(object)val8, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); capAfterModerCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "4 - Skill Caps", "Cap after Moder", 60, "Max skill level after defeating Moder.", true, true, true, (AcceptableValueBase)(object)val8, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); capAfterYagluthCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "4 - Skill Caps", "Cap after Yagluth", 70, "Max skill level after defeating Yagluth.", true, true, true, (AcceptableValueBase)(object)val8, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); capAfterQueenCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "4 - Skill Caps", "Cap after Queen", 80, "Max skill level after defeating The Queen.", true, true, true, (AcceptableValueBase)(object)val8, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); capAfterFaderCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "4 - Skill Caps", "Cap after Fader", 100, "Max skill level after defeating The Fader.", true, true, true, (AcceptableValueBase)(object)val8, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); meadowsOptimalLevelCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "5 - XP Scaling", "Meadows optimal level", 10, "Optimal level for combat in the Meadows.\nAt or below this level: full XP, above this level: reduced XP.", true, true, true, (AcceptableValueBase)(object)val8, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); blackForestOptimalLevelCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "5 - XP Scaling", "BlackForest optimal level", 20, "Optimal level for combat in the Black Forest.", true, true, true, (AcceptableValueBase)(object)val8, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); swampOptimalLevelCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "5 - XP Scaling", "Swamp optimal level", 30, "Optimal level for combat in the Swamp.", true, true, true, (AcceptableValueBase)(object)val8, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); mountainOptimalLevelCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "5 - XP Scaling", "Mountain optimal level", 40, "Optimal level for combat in the Mountains.", true, true, true, (AcceptableValueBase)(object)val8, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); plainsOptimalLevelCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "5 - XP Scaling", "Plains optimal level", 50, "Optimal level for combat in the Plains.", true, true, true, (AcceptableValueBase)(object)val8, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); mistlandsOptimalLevelCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "5 - XP Scaling", "Mistlands optimal level", 60, "Optimal level for combat in the Mistlands.", true, true, true, (AcceptableValueBase)(object)val8, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); ashlandsOptimalLevelCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "5 - XP Scaling", "AshLands optimal level", 70, "Optimal level for combat in the Ashlands.", true, true, true, (AcceptableValueBase)(object)val8, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); deepNorthOptimalLevelCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "5 - XP Scaling", "DeepNorth optimal level", 80, "Optimal level for combat in the Deep North.", true, true, true, (AcceptableValueBase)(object)val8, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); xpMinFactorCfg = ConfigFileExtensions.BindConfigInOrder<float>(((BaseUnityPlugin)this).Config, "5 - XP Scaling", "XP minimum factor", 0.05f, "Minimum XP factor for heavily overleveled biomes.\nExample: 0.05 = you always get at least 5% of the XP,\nno matter how far above the biome's optimal level you are.", true, true, true, (AcceptableValueBase)(object)val2, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); xpMaxOverLevelCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "5 - XP Scaling", "XP levels above optimal until minimum", 15, "How many levels above the biome's optimal level are needed\nuntil the XP factor is reduced to xpMinFactor.\nExample: 30 = at +30 levels or more you only get xpMinFactor.", true, true, true, (AcceptableValueBase)(object)val9, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); bossXpMultiplierCfg = ConfigFileExtensions.BindConfigInOrder<float>(((BaseUnityPlugin)this).Config, "5 - XP Scaling", "Boss XP multiplier", 1f, "Multiplier applied to XP gained from boss kills.\nExample: 2.0 = bosses give 2x as much XP as normal.", true, true, true, (AcceptableValueBase)(object)val, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); prestigeEnabledCfg = ConfigFileExtensions.BindConfigInOrder<bool>(((BaseUnityPlugin)this).Config, "6 - Prestige", "Enable Prestige", true, "Enables the prestige system. Prestige allows you to reset your Level skill\nafter reaching a certain value and gain additional permanent skill points.", true, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); prestigeRequiredLevelCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "6 - Prestige", "Required Level for Prestige", 100, "Minimum Level skill required in order to prestige.", true, true, true, (AcceptableValueBase)(object)val10, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); prestigeMaxRankCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "6 - Prestige", "Max Prestige Rank", 10, "Maximum prestige rank that can be reached.", true, true, true, (AcceptableValueBase)(object)val11, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); prestigePointsPerRankCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "6 - Prestige", "Extra points per Prestige rank (per level)", 1, "Additional skill points per level and per prestige rank.\nExample: PointsPerLevel = 5, Extra = 1, Prestige rank = 2 → 5 + 2*1 = 7 points per level.", true, true, true, (AcceptableValueBase)(object)val12, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); prestigeItemCostEnabledCfg = ConfigFileExtensions.BindConfigInOrder<bool>(((BaseUnityPlugin)this).Config, "6 - Prestige", "Enable Prestige item cost", true, "If true, performing Prestige consumes items configured below.", true, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); prestigeItemNameCfg = ConfigFileExtensions.BindConfigInOrder<string>(((BaseUnityPlugin)this).Config, "6 - Prestige", "Prestige item name", "TrophyFader", "Prefab name of the item required for Prestige (e.g. 'Coins', 'TrophyEikthyr').", true, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); prestigeItemAmountCfg = ConfigFileExtensions.BindConfigInOrder<int>(((BaseUnityPlugin)this).Config, "6 - Prestige", "Prestige item amount", 1, "How many items are required when performing Prestige if item cost is enabled.", true, true, true, (AcceptableValueBase)(object)val7, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null); AddLocalizations(); SkillConfig val13 = new SkillConfig { Identifier = "M2CharacterLevel", Name = "Level", Description = "$m2_sr_skill_desc", IncreaseStep = 0.1f, IconPath = "M2Valheim-SkillsReworked/M2CharacterLevel.png" }; M2CharacterLevelSkillType = SkillManager.Instance.AddSkill(val13); Logger.LogInfo((object)$"Registered Level skill: {M2CharacterLevelSkillType}"); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new SetPrestigeCommand()); CreateConfigWatcher(); _harmony = new Harmony("M2Valheim.SkillsReworked"); _harmony.PatchAll(); } private void CreateConfigWatcher() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown _configFileWatcher = new ConfigFileWatcher(((BaseUnityPlugin)this).Config, 0L); _configFileWatcher.OnConfigFileReloaded += delegate { Logger.LogInfo((object)"Config file reloaded, applying new config values..."); Logger.LogInfo((object)$"Applied config to Level skill: xp multiplier = {multiplierCfg.Value}"); TryRefreshSkillUi(); }; } private void TryRefreshSkillUi() { try { SkillUiSession.RefreshDialogSoft(); } catch (Exception arg) { Logger.LogDebug((object)$"Could not refresh skill UI after config change: {arg}"); } } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void AddLocalizations() { _localization = LocalizationManager.Instance.GetLocalization(); Dictionary<string, string> dictionary = new Dictionary<string, string> { { "m2_sr_skill_name", "Level" }, { "m2_sr_skill_desc", "Increases your skill points." }, { "m2_sr_unspent_points", "Available points: {0}" }, { "m2_sr_no_points_allocated", "You have not allocated any points." }, { "m2_sr_apply_dialog_title", "Apply allocated points?" }, { "m2_sr_apply_dialog_text", "Apply {0} point(s) to your skills?\nYou currently have {1} available." }, { "m2_sr_rebirth_confirm_text", "Do you really want to reset all skills?\nThis cannot be undone." }, { "m2_sr_rebirth_need_levels", "You need at least {0} levels in 'Level' to perform a Rebirth." }, { "m2_sr_rebirth_need_items", "You need {0}x {1} to perform a Rebirth." }, { "m2_sr_rebirth_cost_levels", "Rebirth consumed {0} 'Level' skill levels." }, { "m2_sr_rebirth_cost_items", "Rebirth consumed {0}x {1}." }, { "m2_sr_rebirth_done", "All skills have been reset (Rebirth)." }, { "m2_sr_death_loss", "You lost {0}% of a Level on death." }, { "m2_sr_btn_apply", "Apply" }, { "m2_sr_btn_reset", "Reset" }, { "m2_sr_btn_rebirth", "Rebirth" }, { "m2_sr_btn_prestige", "Prestige" }, { "m2_sr_prestige_need_level", "You need at least Level {0} in 'Level' to prestige." }, { "m2_sr_prestige_max_rank", "You have already reached the maximum Prestige rank." }, { "m2_sr_prestige_confirm_text", "Prestige to rank {0}?\nYour skill points per Level will increase by +{1}." }, { "m2_sr_prestige_done", "Prestige {0} reached!" }, { "m2_sr_prestige_rank", "Prestige: {0}" }, { "m2_sr_prestige_need_items", "You need {0}x {1} to prestige." }, { "m2_sr_prestige_cost_items", "Prestige consumed {0}x {1}." } }; Dictionary<string, string> dictionary2 = new Dictionary<string, string> { { "m2_sr_skill_name", "Level" }, { "m2_sr_skill_desc", "Erhöht deine verfügbaren Fertigkeitspunkte." }, { "m2_sr_unspent_points", "Verfügbare Punkte: {0}" }, { "m2_sr_no_points_allocated", "Du hast keine Punkte verteilt." }, { "m2_sr_apply_dialog_title", "Verteilte Punkte anwenden?" }, { "m2_sr_apply_dialog_text", "{0} Punkt(e) auf deine Fertigkeiten anwenden?\nDu hast aktuell {1} verfügbar." }, { "m2_sr_rebirth_confirm_text", "Möchtest du wirklich alle Fertigkeiten zurücksetzen?\nDies kann nicht rückgängig gemacht werden." }, { "m2_sr_rebirth_need_levels", "Du benötigst mindestens {0} Stufen in „Level“, um eine Wiedergeburt durchzuführen." }, { "m2_sr_rebirth_need_items", "Du benötigst {0}× {1}, um eine Wiedergeburt durchzuführen." }, { "m2_sr_rebirth_cost_levels", "Wiedergeburt hat {0} „Level“-Stufen verbraucht." }, { "m2_sr_rebirth_cost_items", "Wiedergeburt hat {0}× {1} verbraucht." }, { "m2_sr_rebirth_done", "Alle Fertigkeiten wurden zurückgesetzt (Wiedergeburt)." }, { "m2_sr_death_loss", "Du verlierst {0}% einer Stufe beim Tod." }, { "m2_sr_btn_apply", "Übernehmen" }, { "m2_sr_btn_reset", "Zurücksetzen" }, { "m2_sr_btn_rebirth", "Wiedergeburt" }, { "m2_sr_btn_prestige", "Prestige" }, { "m2_sr_prestige_need_level", "Du benötigst mindestens Stufe {0} in „Level“, um ein Prestige durchzuführen." }, { "m2_sr_prestige_max_rank", "Du hast bereits den maximalen Prestige-Rang erreicht." }, { "m2_sr_prestige_confirm_text", "Zum Prestige-Rang {0} aufsteigen?\nDeine Fertigkeitspunkte pro Level erhöhen sich um +{1}." }, { "m2_sr_prestige_done", "Prestige-Rang {0} erreicht!" }, { "m2_sr_prestige_rank", "Prestige: {0}" }, { "m2_sr_prestige_need_items", "Du benötigst {0}× {1}, um ein Prestige durchzuführen." }, { "m2_sr_prestige_cost_items", "Prestige hat {0}× {1} verbraucht." } }; CustomLocalization localization = _localization; string text = "English"; localization.AddTranslation(ref text, dictionary); CustomLocalization localization2 = _localization; text = "German"; localization2.AddTranslation(ref text, dictionary2); } } } namespace SkillsReworked.UI { public static class LevelXpHudManager { private class HudData { public RectTransform Root; public RectTransform FastFill; public RectTransform SlowFill; public TMP_Text Label; public float MaxWidth; public float FastFraction; public float SlowFraction; } private static readonly Dictionary<Hud, HudData> Bars = new Dictionary<Hud, HudData>(); private const float BlueWidth = 260f; private const float BlueHeight = 25f; private const float Margin = 3f; private const float XOffset = -20f; private const float YOffset = -65f; private const float SlowCatchupSpeed = 0.1f; public static void RefreshForLocalPlayer() { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) Hud instance = Hud.instance; if ((Object)(object)instance == (Object)null) { return; } if (!Bars.TryGetValue(instance, out var value) || (Object)(object)value.Root == (Object)null) { CreateBarForHud(instance); if (!Bars.TryGetValue(instance, out value) || (Object)(object)value.Root == (Object)null) { return; } } if (!instance.IsVisible()) { SetActiveSafe(value, active: false); return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { SetActiveSafe(value, active: false); return; } Skills skills = ((Character)localPlayer).GetSkills(); Skill val = ((skills != null) ? skills.GetSkill(SkillsReworked.M2CharacterLevelSkillType) : null); if (val == null) { SetActiveSafe(value, active: false); return; } int num = Mathf.FloorToInt(val.m_level); float currentLevelFraction = LevelXpMath.GetCurrentLevelFraction(val); float num2 = Mathf.Clamp01(currentLevelFraction); if (num <= 0 && num2 <= 0f) { value.FastFraction = 0f; value.SlowFraction = 0f; if ((Object)(object)value.FastFill != (Object)null) { value.FastFill.sizeDelta = new Vector2(0f, value.FastFill.sizeDelta.y); } if ((Object)(object)value.SlowFill != (Object)null) { value.SlowFill.sizeDelta = new Vector2(0f, value.SlowFill.sizeDelta.y); } if ((Object)(object)value.Label != (Object)null) { value.Label.text = string.Empty; } SetActiveSafe(value, active: false); } else { SetActiveSafe(value, active: true); if ((Object)(object)instance.m_healthBarRoot != (Object)null) { Vector2 anchoredPosition = instance.m_healthBarRoot.anchoredPosition; value.Root.anchoredPosition = anchoredPosition + new Vector2(-20f, -65f); } else { value.Root.anchoredPosition = new Vector2(0f, -80f); } value.FastFraction = num2; if ((Object)(object)value.FastFill != (Object)null) { value.FastFill.sizeDelta = new Vector2(value.MaxWidth * value.FastFraction, value.FastFill.sizeDelta.y); } if ((Object)(object)value.Label != (Object)null) { value.Label.text = $"Level {num}"; } } } public static void Update(float dt) { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) if (Bars.Count == 0) { return; } foreach (KeyValuePair<Hud, HudData> bar in Bars) { HudData value = bar.Value; if (value != null && !((Object)(object)value.Root == (Object)null) && ((Component)value.Root).gameObject.activeSelf && !((Object)(object)value.SlowFill == (Object)null)) { float slowFraction = value.SlowFraction; float fastFraction = value.FastFraction; if (!Mathf.Approximately(slowFraction, fastFraction)) { float num = 0.1f * dt; float num2 = (value.SlowFraction = Mathf.MoveTowards(slowFraction, fastFraction, num)); value.SlowFill.sizeDelta = new Vector2(value.MaxWidth * num2, value.SlowFill.sizeDelta.y); } } } } private static void CreateBarForHud(Hud hud) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Expected O, but got Unknown //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Expected O, but got Unknown //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)hud == (Object)null || Bars.ContainsKey(hud)) { return; } RectTransform val = (RectTransform)(((Object)(object)hud.m_healthBarRoot != (Object)null) ? /*isinst with value type is only supported in some contexts*/: /*isinst with value type is only supported in some contexts*/); if (!((Object)(object)val == (Object)null)) { GameObject val2 = new GameObject("SkillsReworked_LevelXpBar", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); RectTransform component = val2.GetComponent<RectTransform>(); ((Transform)component).SetParent((Transform)(object)val, false); if ((Object)(object)hud.m_healthBarRoot != (Object)null) { component.anchorMin = hud.m_healthBarRoot.anchorMin; component.anchorMax = hud.m_healthBarRoot.anchorMax; component.pivot = hud.m_healthBarRoot.pivot; } else { component.anchorMin = new Vector2(0f, 1f); component.anchorMax = new Vector2(0f, 1f); component.pivot = new Vector2(0f, 1f); } float num = 266f; float num2 = 31f; component.sizeDelta = new Vector2(num, num2); component.anchoredPosition = Vector2.zero; Image component2 = val2.GetComponent<Image>(); ((Graphic)component2).color = new Color(0f, 0f, 0f, 0.65f); Image val3 = null; if ((Object)(object)hud.m_staminaBar2Fast != (Object)null) { val3 = ((Component)hud.m_staminaBar2Fast).GetComponentInChildren<Image>(); } if ((Object)(object)val3 == (Object)null && (Object)(object)hud.m_healthBarFast != (Object)null) { val3 = ((Component)hud.m_healthBarFast).GetComponentInChildren<Image>(); } GameObject val4 = new GameObject("FillFast", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); RectTransform component3 = val4.GetComponent<RectTransform>(); ((Transform)component3).SetParent((Transform)(object)component, false); component3.anchorMin = new Vector2(0f, 0.5f); component3.anchorMax = new Vector2(0f, 0.5f); component3.pivot = new Vector2(0f, 0.5f); component3.anchoredPosition = new Vector2(3f, 0f); component3.sizeDelta = new Vector2(0f, 25f); Image component4 = val4.GetComponent<Image>(); ((Graphic)component4).color = new Color(1f, 0.86f, 0.25f, 0.95f); GameObject val5 = new GameObject("FillSlow", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); RectTransform component5 = val5.GetComponent<RectTransform>(); ((Transform)component5).SetParent((Transform)(object)component, false); component5.anchorMin = new Vector2(0f, 0.5f); component5.anchorMax = new Vector2(0f, 0.5f); component5.pivot = new Vector2(0f, 0.5f); component5.anchoredPosition = new Vector2(3f, 0f); component5.sizeDelta = new Vector2(0f, 25f); Image component6 = val5.GetComponent<Image>(); ((Graphic)component6).color = new Color(0.16f, 0.6f, 0.95f, 0.95f); if ((Object)(object)val3 != (Object)null && (Object)(object)val3.sprite != (Object)null) { CopySpriteSettings(val3, component4); CopySpriteSettings(val3, component6); } Shadow val6 = val5.AddComponent<Shadow>(); val6.effectColor = new Color(0f, 0f, 0f, 0.85f); val6.effectDistance = new Vector2(0f, -2f); val6.useGraphicAlpha = true; TMP_Text val7 = null; TMP_Text val8 = hud.m_staminaText ?? hud.m_healthText; if ((Object)(object)val8 != (Object)null) { val7 = Object.Instantiate<TMP_Text>(val8, (Transform)(object)component); ((Object)val7).name = "LevelXpLabel"; val7.alignment = (TextAlignmentOptions)514; RectTransform val9 = (RectTransform)val7.transform; val9.anchorMin = new Vector2(0f, 0f); val9.anchorMax = new Vector2(1f, 1f); val9.offsetMin = Vector2.zero; val9.offsetMax = Vector2.zero; val7.enableAutoSizing = false; val7.fontSize = val8.fontSize; val7.text = string.Empty; } Bars[hud] = new HudData { Root = component, FastFill = component3, SlowFill = component5, Label = val7, MaxWidth = 260f, FastFraction = 0f, SlowFraction = 0f }; ((Component)component).gameObject.SetActive(false); } } public static void OnHudDestroy(Hud hud) { if (!((Object)(object)hud == (Object)null) && Bars.TryGetValue(hud, out var value)) { if ((Object)(object)value.Root != (Object)null) { Object.Destroy((Object)(object)((Component)value.Root).gameObject); } Bars.Remove(hud); } } private static void SetActiveSafe(HudData data, bool active) { if (!((Object)(object)data?.Root == (Object)null)) { GameObject gameObject = ((Component)data.Root).gameObject; if (gameObject.activeSelf != active) { gameObject.SetActive(active); } } } private static void CopySpriteSettings(Image from, Image to) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) to.sprite = from.sprite; to.type = from.type; to.pixelsPerUnitMultiplier = from.pixelsPerUnitMultiplier; to.preserveAspect = from.preserveAspect; } } public class SkillRowController : MonoBehaviour { public static readonly List<SkillRowController> ActiveControllers = new List<SkillRowController>(); public SkillType SkillType; public int AllocatedPoints; public Text CounterText; private void Awake() { if (!ActiveControllers.Contains(this)) { ActiveControllers.Add(this); } } private void OnDestroy() { ActiveControllers.Remove(this); } public void RefreshCounter() { if ((Object)(object)CounterText != (Object)null) { CounterText.text = AllocatedPoints.ToString(); } } } public static class SkillUiHelper { public static void EnsureButtons(RectTransform row, SkillType skillType) { //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Expected O, but got Unknown //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Expected O, but got Unknown if ((Object)(object)row == (Object)null) { return; } Transform val = Utils.FindChild((Transform)(object)row, "name", (IterativeSearchType)0); if ((Object)(object)val != (Object)null) { RectTransform val2 = (RectTransform)(object)((val is RectTransform) ? val : null); if (val2 != null) { Rect rect = val2.rect; float width = ((Rect)(ref rect)).width; float num = Mathf.Min(width, 100f); if (num < width) { float x = val2.pivot.x; float num2 = val2.anchoredPosition.x - x * width; val2.SetSizeWithCurrentAnchors((Axis)0, num); float num3 = num2 + x * num; val2.anchoredPosition = new Vector2(num3, val2.anchoredPosition.y); } } } SkillRowController skillRowController = ((Component)row).GetComponent<SkillRowController>() ?? ((Component)row).gameObject.AddComponent<SkillRowController>(); skillRowController.SkillType = skillType; if ((Object)(object)skillRowController.CounterText != (Object)null) { return; } Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0.5f, 0.5f); Vector2 val4 = default(Vector2); ((Vector2)(ref val4))..ctor(0.5f, 0.5f); GameObject val5 = GUIManager.Instance.CreateButton("+", (Transform)(object)row, val3, val4, new Vector2(-10f, 0f), 24f, 24f); Button component = val5.GetComponent<Button>(); GameObject val6 = GUIManager.Instance.CreateButton("-", (Transform)(object)row, val3, val4, new Vector2(-35f, 0f), 24f, 24f); Button component2 = val6.GetComponent<Button>(); GameObject val7 = GUIManager.Instance.CreateText("0", (Transform)(object)row, val3, val4, new Vector2(25f, 0f), GUIManager.Instance.AveriaSerifBold, 16, GUIManager.Instance.ValheimOrange, true, Color.black, 30f, 20f, false); Text component3 = val7.GetComponent<Text>(); skillRowController.CounterText = component3; skillRowController.AllocatedPoints = 0; skillRowController.RefreshCounter(); if (!SkillRowController.ActiveControllers.Contains(skillRowController)) { SkillRowController.ActiveControllers.Add(skillRowController); } SkillRowController ctrl = skillRowController; ((UnityEvent)component.onClick).AddListener((UnityAction)delegate { //IL_004c: Unknown result type (might be due to invalid IL or missing references) Player val8 = SkillUiSession.CurrentPlayer ?? Player.m_localPlayer; if (!((Object)(object)val8 == (Object)null) && SkillUiSession.GetCurrentUnspent() > 0) { Skills skills = ((Character)val8).GetSkills(); Skill val9 = ((skills != null) ? skills.GetSkill(ctrl.SkillType) : null); if (val9 != null) { float level = val9.m_level; float num4 = level + (float)ctrl.AllocatedPoints + 1f; float currentSkillCap = SkillCapManager.GetCurrentSkillCap(val8); if (num4 > currentSkillCap) { return; } } ctrl.AllocatedPoints++; ctrl.RefreshCounter(); SkillUiSession.RefreshUnspentLabel(); } }); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { if (ctrl.AllocatedPoints > 0) { ctrl.AllocatedPoints--; ctrl.RefreshCounter(); SkillUiSession.RefreshUnspentLabel(); } }); } } public static class SkillUiSession { public static Player CurrentPlayer; public static int BaseAvailablePoints; public static Text UnspentText; public static Text PrestigeText; public static float LastScrollPos = 1f; public static bool SuppressAutoScroll = false; public static RectTransform RootPanel; public static SkillsDialog CurrentDialog; private static GameObject _rebirthDialogRoot; private static GameObject _applyDialogRoot; private static GameObject _prestigeDialogRoot; private static Text _applyDialogLabel; private static Text _prestigeDialogLabel; public static GameObject PrestigeIconRoot; public static Button PrestigeButton; public static void Initialize(Player player, Text unspentText) { CurrentPlayer = player; UnspentText = unspentText; BaseAvailablePoints = ((!((Object)(object)player == (Object)null)) ? SkillPointManager.GetAvailablePoints(player) : 0); ResetAllocated(); RefreshUnspentLabel(); RefreshPrestigeLabel(); } public static void ResetAllocated() { foreach (SkillRowController activeController in SkillRowController.ActiveControllers) { activeController.AllocatedPoints = 0; activeController.RefreshCounter(); } } public static int GetTotalAllocated() { return SkillRowController.ActiveControllers.Sum((SkillRowController c) => c.AllocatedPoints); } public static int GetCurrentUnspent() { int num = BaseAvailablePoints - GetTotalAllocated(); return Mathf.Max(0, num); } public static void RefreshUnspentLabel() { if (!((Object)(object)UnspentText == (Object)null)) { string format = Localization.instance.Localize("$m2_sr_unspent_points"); UnspentText.text = string.Format(format, GetCurrentUnspent()); } } public static void RefreshPrestigeLabel() { if (!((Object)(object)PrestigeText == (Object)null) && !((Object)(object)CurrentPlayer == (Object)null)) { ConfigEntry<bool> prestigeEnabledCfg = SkillsReworked.prestigeEnabledCfg; int num = ((prestigeEnabledCfg == null || prestigeEnabledCfg.Value) ? PrestigeManager.GetPrestigeRank(CurrentPlayer) : 0); PrestigeText.text = num.ToString(); } } public static void OnApplyRequested() { if ((Object)(object)CurrentPlayer == (Object)null) { return; } int totalAllocated = GetTotalAllocated(); if (totalAllocated <= 0) { string text = Localization.instance.Localize("$m2_sr_no_points_allocated"); ((Character)CurrentPlayer).Message((MessageType)2, text, 0, (Sprite)null); return; } if ((Object)(object)_applyDialogRoot == (Object)null) { CreateApplyDialog(); } if ((Object)(object)_applyDialogLabel != (Object)null) { int baseAvailablePoints = BaseAvailablePoints; string format = Localization.instance.Localize("$m2_sr_apply_dialog_text"); _applyDialogLabel.text = string.Format(format, totalAllocated, baseAvailablePoints); } _applyDialogRoot.SetActive(true); } private static void ApplyAllocatedPoints() { //IL_00c5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)CurrentPlayer == (Object)null) { return; } Skills skills = ((Character)CurrentPlayer).GetSkills(); if ((Object)(object)skills == (Object)null) { return; } int num = (BaseAvailablePoints = SkillPointManager.GetAvailablePoints(CurrentPlayer)); if (num <= 0) { RefreshUnspentLabel(); RefreshDialogSoft(); return; } int num2 = num; int num3 = 0; foreach (SkillRowController activeController in SkillRowController.ActiveControllers) { if (activeController.AllocatedPoints <= 0) { continue; } if (num2 <= 0) { activeController.AllocatedPoints = 0; activeController.RefreshCounter(); continue; } Skill skill = skills.GetSkill(activeController.SkillType); if (skill == null) { activeController.AllocatedPoints = 0; activeController.RefreshCounter(); continue; } float currentSkillCap = SkillCapManager.GetCurrentSkillCap(CurrentPlayer); int allocatedPoints = activeController.AllocatedPoints; for (int i = 0; i < allocatedPoints; i++) { if (num2 <= 0) { break; } if (skill.m_level >= currentSkillCap) { break; } skill.m_level += 1f; skill.m_accumulator = 0f; num3++; num2--; } activeController.AllocatedPoints = 0; activeController.RefreshCounter(); } if (num3 <= 0) { RefreshUnspentLabel(); RefreshDialogSoft(); } else if (!SkillPointManager.TrySpendPoints(CurrentPlayer, num3)) { Logger.LogWarning((object)$"[SkillsReworked] TrySpendPoints({num3}) failed after applying skill levels."); BaseAvailablePoints = SkillPointManager.GetAvailablePoints(CurrentPlayer); RefreshUnspentLabel(); RefreshDialogSoft(); } else { BaseAvailablePoints = SkillPointManager.GetAvailablePoints(CurrentPlayer); RefreshUnspentLabel(); RefreshDialogSoft(); } } private static void CreateApplyDialog() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0064: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_019e: 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_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Expected O, but got Unknown //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Expected O, but got Unknown _applyDialogRoot = new GameObject("SkillsReworked_ApplyDialog", new Type[1] { typeof(RectTransform) }); RectTransform component = _applyDialogRoot.GetComponent<RectTransform>(); RectTransform val = (RectTransform)(((object)RootPanel) ?? ((object)/*isinst with value type is only supported in some contexts*/)); _applyDialogRoot.transform.SetParent((Transform)(object)val, false); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.anchoredPosition = Vector2.zero; component.sizeDelta = new Vector2(400f, 150f); Image val2 = _applyDialogRoot.AddComponent<Image>(); GUIManager.Instance.ApplyWoodpanelStyle(((Component)val2).transform); string text = Localization.instance.Localize("$m2_sr_apply_dialog_title"); GameObject val3 = GUIManager.Instance.CreateText(text, (Transform)(object)component, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -40f), GUIManager.Instance.AveriaSerifBold, 16, Color.white, true, Color.black, 320f, 80f, false); _applyDialogLabel = val3.GetComponent<Text>(); if ((Object)(object)_applyDialogLabel != (Object)null) { _applyDialogLabel.alignment = (TextAnchor)4; } string text2 = Localization.instance.Localize("$menu_yes"); string text3 = Localization.instance.Localize("$menu_no"); GameObject val4 = GUIManager.Instance.CreateButton(text2, (Transform)(object)component, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(60f, 30f), 100f, 30f); ((UnityEvent)val4.GetComponent<Button>().onClick).AddListener(new UnityAction(OnApplyConfirm)); GameObject val5 = GUIManager.Instance.CreateButton(text3, (Transform)(object)component, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(-60f, 30f), 100f, 30f); ((UnityEvent)val5.GetComponent<Button>().onClick).AddListener(new UnityAction(OnApplyCancel)); } private static void OnApplyConfirm() { ApplyAllocatedPoints(); if ((Object)(object)_applyDialogRoot != (Object)null) { _applyDialogRoot.SetActive(false); } } private static void OnApplyCancel() { if ((Object)(object)_applyDialogRoot != (Object)null) { _applyDialogRoot.SetActive(false); } } public static void OnResetClicked() { ResetAllocated(); RefreshUnspentLabel(); RefreshDialogSoft(); } public static void OnRebirthRequested() { if (!((Object)(object)CurrentPlayer == (Object)null)) { if ((Object)(object)_rebirthDialogRoot == (Object)null) { CreateRebirthDialog(); } _rebirthDialogRoot.SetActive(true); } } private static void CreateRebirthDialog() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0064: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Expected O, but got Unknown //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Expected O, but got Unknown _rebirthDialogRoot = new GameObject("SkillsReworked_RebirthDialog", new Type[1] { typeof(RectTransform) }); RectTransform component = _rebirthDialogRoot.GetComponent<RectTransform>(); RectTransform val = (RectTransform)(((object)RootPanel) ?? ((object)/*isinst with value type is only supported in some contexts*/)); _rebirthDialogRoot.transform.SetParent((Transform)(object)val, false); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.anchoredPosition = Vector2.zero; component.sizeDelta = new Vector2(400f, 150f); Image val2 = _rebirthDialogRoot.AddComponent<Image>(); GUIManager.Instance.ApplyWoodpanelStyle(((Component)val2).transform); string text = Localization.instance.Localize("$m2_sr_rebirth_confirm_text"); GameObject val3 = GUIManager.Instance.CreateText(text, (Transform)(object)component, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -40f), GUIManager.Instance.AveriaSerifBold, 16, Color.white, true, Color.black, 280f, 80f, false); Text component2 = val3.GetComponent<Text>(); if ((Object)(object)component2 != (Object)null) { component2.alignment = (TextAnchor)4; } string text2 = Localization.instance.Localize("$menu_yes"); string text3 = Localization.instance.Localize("$menu_no"); GameObject val4 = GUIManager.Instance.CreateButton(text2, (Transform)(object)component, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(60f, 30f), 100f, 30f); ((UnityEvent)val4.GetComponent<Button>().onClick).AddListener(new UnityAction(OnRebirthConfirm)); GameObject val5 = GUIManager.Instance.CreateButton(text3, (Transform)(object)component, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(-60f, 30f), 100f, 30f); ((UnityEvent)val5.GetComponent<Button>().onClick).AddListener(new UnityAction(OnRebirthCancel)); } private static void OnRebirthConfirm() { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Invalid comparison between Unknown and I4 //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)CurrentPlayer == (Object)null) { return; } Skills skills = ((Character)CurrentPlayer).GetSkills(); if ((Object)(object)skills == (Object)null) { return; } bool flag = SkillsReworked.rebirthCostEnabledCfg?.Value ?? true; SkillsReworked.RebirthCostMode rebirthCostMode = SkillsReworked.rebirthCostModeCfg?.Value ?? SkillsReworked.RebirthCostMode.LevelOnly; bool flag2 = flag && (rebirthCostMode == SkillsReworked.RebirthCostMode.LevelOnly || rebirthCostMode == SkillsReworked.RebirthCostMode.Both); bool flag3 = flag && (rebirthCostMode == SkillsReworked.RebirthCostMode.ItemOnly || rebirthCostMode == SkillsReworked.RebirthCostMode.Both); int num = SkillsReworked.rebirthLevelLossCfg?.Value ?? 0; string text = SkillsReworked.rebirthItemNameCfg?.Value; int num2 = SkillsReworked.rebirthItemAmountCfg?.Value ?? 0; if (flag2 && num > 0) { Skill skill = skills.GetSkill(SkillsReworked.M2CharacterLevelSkillType); int num3 = ((skill != null) ? Mathf.FloorToInt(skill.m_level) : 0); if (num3 < num) { string format = Localization.instance.Localize("$m2_sr_rebirth_need_levels"); string text2 = string.Format(format, num); ((Character)CurrentPlayer).Message((MessageType)2, text2, 0, (Sprite)null); if ((Object)(object)_rebirthDialogRoot != (Object)null) { _rebirthDialogRoot.SetActive(false); } return; } } if (flag3 && num2 > 0 && !string.IsNullOrEmpty(text) && !CheckItemRequirement(CurrentPlayer, text, num2, "$m2_sr_rebirth_need_items", (MessageType)2, _rebirthDialogRoot)) { return; } if (flag2 && num > 0) { Skill skill2 = skills.GetSkill(SkillsReworked.M2CharacterLevelSkillType); if (skill2 != null) { skill2.m_level = Mathf.Max(0f, skill2.m_level - (float)num); skill2.m_accumulator = 0f; string format2 = Localization.instance.Localize("$m2_sr_rebirth_cost_levels"); string text3 = string.Format(format2, num); ((Character)CurrentPlayer).Message((MessageType)1, text3, 0, (Sprite)null); } else { Logger.LogWarning((object)"[SkillsReworked] Rebirth level cost: Level skill missing."); } } if (flag3 && num2 > 0 && !string.IsNullOrEmpty(text)) { ConsumeItemCost(CurrentPlayer, text, num2, "$m2_sr_rebirth_cost_items", (MessageType)1); } List<Skill> skillList = skills.GetSkillList(); foreach (Skill item in skillList) { if (item?.m_info != null) { SkillType skill3 = item.m_info.m_skill; if ((int)skill3 != 0 && (int)skill3 != 999 && skill3 != SkillsReworked.M2CharacterLevelSkillType) { skills.ResetSkill(skill3); } } } SkillPointManager.ResetSpentPoints(CurrentPlayer); BaseAvailablePoints = SkillPointManager.GetAvailablePoints(CurrentPlayer); ResetAllocated(); RefreshUnspentLabel(); string text4 = Localization.instance.Localize("$m2_sr_rebirth_done"); ((Character)CurrentPlayer).Message((MessageType)1, text4, 0, (Sprite)null); Logger.LogInfo((object)"[SkillsReworked] Rebirth: all skills reset and spent points cleared"); if ((Object)(object)_rebirthDialogRoot != (Object)null) { _rebirthDialogRoot.SetActive(false); } RefreshDialogSoft(); if ((Object)(object)CurrentPlayer == (Object)(object)Player.m_localPlayer) { LevelXpHudManager.RefreshForLocalPlayer(); } } private static void OnRebirthCancel() { if ((Object)(object)_rebirthDialogRoot != (Object)null) { _rebirthDialogRoot.SetActive(false); } } private static string GetItemSharedName(string prefabName) { if (string.IsNullOrEmpty(prefabName)) { return null; } ObjectDB instance = ObjectDB.instance; if ((Object)(object)instance == (Object)null) { return null; } GameObject itemPrefab = instance.GetItemPrefab(prefabName); if ((Object)(object)itemPrefab == (Object)null) { return null; } ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); if ((Object)(object)component == (Object)null) { return null; } return component.m_itemData.m_shared.m_name; } private static string GetItemDisplayName(string prefabName) { string itemSharedName = GetItemSharedName(prefabName); if (string.IsNullOrEmpty(itemSharedName)) { return prefabName ?? string.Empty; } return Localization.instance.Localize(itemSharedName); } private static bool CheckItemRequirement(Player player, string prefabName, int amount, string needLocKey, MessageType messageType, GameObject dialogRootToClose) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null || amount <= 0 || string.IsNullOrEmpty(prefabName)) { return true; } string itemSharedName = GetItemSharedName(prefabName); string itemDisplayName = GetItemDisplayName(prefabName); Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory == null || string.IsNullOrEmpty(itemSharedName) || inventory.CountItems(itemSharedName, -1, true) < amount) { string format = Localization.instance.Localize(needLocKey); string text = string.Format(format, amount, itemDisplayName); ((Character)player).Message(messageType, text, 0, (Sprite)null); if ((Object)(object)dialogRootToClose != (Object)null) { dialogRootToClose.SetActive(false); } return false; } return true; } private static void ConsumeItemCost(Player player, string prefabName, int amount, string costLocKey, MessageType messageType) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)player == (Object)null) && amount > 0 && !string.IsNullOrEmpty(prefabName)) { string itemSharedName = GetItemSharedName(prefabName); string itemDisplayName = GetItemDisplayName(prefabName); Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory != null && !string.IsNullOrEmpty(itemSharedName)) { inventory.RemoveItem(itemSharedName, amount, -1, true); string format = Localization.instance.Localize(costLocKey); string text = string.Format(format, amount, itemDisplayName); ((Character)player).Message(messageType, text, 0, (Sprite)null); } } } public static void OnPrestigeRequested() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)CurrentPlayer == (Object)null) { return; } ConfigEntry<bool> prestigeEnabledCfg = SkillsReworked.prestigeEnabledCfg; if (prestigeEnabledCfg != null && !prestigeEnabledCfg.Value) { return; } Skills skills = ((Character)CurrentPlayer).GetSkills(); if ((Object)(object)skills == (Object)null) { return; } Skill skill = skills.GetSkill(SkillsReworked.M2CharacterLevelSkillType); int num = ((skill != null) ? Mathf.FloorToInt(skill.m_level) : 0); int num2 = SkillsReworked.prestigeRequiredLevelCfg?.Value ?? 100; int num3 = SkillsReworked.prestigeMaxRankCfg?.Value ?? 10; int prestigeRank = PrestigeManager.GetPrestigeRank(CurrentPlayer); if (num < num2) { string format = Localization.instance.Localize("$m2_sr_prestige_need_level"); string text = string.Format(format, num2); ((Character)CurrentPlayer).Message((MessageType)2, text, 0, (Sprite)null); return; } if (prestigeRank >= num3) { string text2 = Localization.instance.Localize("$m2_sr_prestige_max_rank"); ((Character)CurrentPlayer).Message((MessageType)2, text2, 0, (Sprite)null); return; } if ((Object)(object)_prestigeDialogRoot == (Object)null) { CreatePrestigeDialog(); } if ((Object)(object)_prestigeDialogLabel != (Object)null) { int num4 = prestigeRank + 1; int num5 = SkillsReworked.prestigePointsPerRankCfg?.Value ?? 0; string format2 = Localization.instance.Localize("$m2_sr_prestige_confirm_text"); _prestigeDialogLabel.text = string.Format(format2, num4, num5); } _prestigeDialogRoot.SetActive(true); } private static void CreatePrestigeDialog() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0064: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_019e: 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_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Expected O, but got Unknown //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Expected O, but got Unknown _prestigeDialogRoot = new GameObject("SkillsReworked_PrestigeDialog", new Type[1] { typeof(RectTransform) }); RectTransform component = _prestigeDialogRoot.GetComponent<RectTransform>(); RectTransform val = (RectTransform)(((object)RootPanel) ?? ((object)/*isinst with value type is only supported in some contexts*/)); _prestigeDialogRoot.transform.SetParent((Transform)(object)val, false); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.anchoredPosition = Vector2.zero; component.sizeDelta = new Vector2(420f, 170f); Image val2 = _prestigeDialogRoot.AddComponent<Image>(); GUIManager.Instance.ApplyWoodpanelStyle(((Component)val2).transform); string text = Localization.instance.Localize("$m2_sr_prestige_confirm_text"); GameObject val3 = GUIManager.Instance.CreateText(text, (Transform)(object)component, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -40f), GUIManager.Instance.AveriaSerifBold, 16, Color.white, true, Color.black, 320f, 90f, false); _prestigeDialogLabel = val3.GetComponent<Text>(); if ((Object)(object)_prestigeDialogLabel != (Object)null) { _prestigeDialogLabel.alignment = (TextAnchor)4; } string text2 = Localization.instance.Localize("$menu_yes"); string text3 = Localization.instance.Localize("$menu_no"); GameObject val4 = GUIManager.Instance.CreateButton(text2, (Transform)(object)component, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(60f, 30f), 100f, 30f); ((UnityEvent)val4.GetComponent<Button>().onClick).AddListener(new UnityAction(OnPrestigeConfirm)); GameObject val5 = GUIManager.Instance.CreateButton(text3, (Transform)(object)component, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(-60f, 30f), 100f, 30f); ((UnityEvent)val5.GetComponent<Button>().onClick).AddListener(new UnityAction(OnPrestigeCancel)); } private static void OnPrestigeConfirm() { //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Invalid comparison between Unknown and I4 //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)CurrentPlayer == (Object)null) { return; } Skills skills = ((Character)CurrentPlayer).GetSkills(); if ((Object)(object)skills == (Object)null) { return; } ConfigEntry<bool> prestigeEnabledCfg = SkillsReworked.prestigeEnabledCfg; if (prestigeEnabledCfg != null && !prestigeEnabledCfg.Value) { return; } int num = SkillsReworked.prestigeMaxRankCfg?.Value ?? 10; int prestigeRank = PrestigeManager.GetPrestigeRank(CurrentPlayer); if (prestigeRank >= num) { return; } bool flag = SkillsReworked.prestigeItemCostEnabledCfg?.Value ?? false; string text = SkillsReworked.prestigeItemNameCfg?.Value; int num2 = SkillsReworked.prestigeItemAmountCfg?.Value ?? 0; if (flag && num2 > 0 && !string.IsNullOrEmpty(text)) { if (!CheckItemRequirement(CurrentPlayer, text, num2, "$m2_sr_prestige_need_items", (MessageType)2, _prestigeDialogRoot)) { return; } ConsumeItemCost(CurrentPlayer, text, num2, "$m2_sr_prestige_cost_items", (MessageType)1); } PrestigeManager.AddPrestige(CurrentPlayer, 1); Skill skill = skills.GetSkill(SkillsReworked.M2CharacterLevelSkillType); if (skill != null) { skill.m_level = 0f; skill.m_accumulator = 0f; } List<Skill> skillList = skills.GetSkillList(); foreach (Skill item in skillList) { if (item?.m_info != null) { SkillType skill2 = item.m_info.m_skill; if ((int)skill2 != 0 && (int)skill2 != 999 && skill2 != SkillsReworked.M2CharacterLevelSkillType) { skills.ResetSkill(skill2); } } } SkillPointManager.ResetSpentPoints(CurrentPlayer); BaseAvailablePoints = SkillPointManager.GetAvailablePoints(CurrentPlayer); ResetAllocated(); RefreshUnspentLabel(); if ((Object)(object)CurrentPlayer == (Object)(object)Player.m_localPlayer) { LevelXpHudManager.RefreshForLocalPlayer(); } int prestigeRank2 = PrestigeManager.GetPrestigeRank(CurrentPlayer); string format = Localization.instance.Localize("$m2_sr_prestige_done"); string text2 = string.Format(format, prestigeRank2); ((Character)CurrentPlayer).Message((MessageType)1, text2, 0, (Sprite)null); if ((Object)(object)_prestigeDialogRoot != (Object)null) { _prestigeDialogRoot.SetActive(false); } RefreshDialogSoft(); } private static void OnPrestigeCancel() { if ((Object)(object)_prestigeDialogRoot != (Object)null) { _prestigeDialogRoot.SetActive(false); } } public static void RefreshDialogSoft() { if (!((Object)(object)CurrentDialog == (Object)null) && !((Object)(object)CurrentPlayer == (Object)null) && ((Component)CurrentDialog).gameObject.activeInHierarchy) { ScrollRect skillListScrollRect = CurrentDialog.skillListScrollRect; if ((Object)(object)skillListScrollRect != (Object)null) { LastScrollPos = skillListScrollRect.verticalNormalizedPosition; } SuppressAutoScroll = true; CurrentDialog.Setup(CurrentPlayer); SuppressAutoScroll = false; if ((Object)(object)skillListScrollRect != (Object)null) { skillListScrollRect.verticalNormalizedPosition = LastScrollPos; } RefreshUnspentLabel(); RefreshPrestigeLabel(); } } } public static class UiSpriteHelper { private static bool _cached; private static Sprite _workbenchStarSprite; private static Type _workbenchStarType; private static float _workbenchStarPPU; private static bool _workbenchStarPreserveAspect; private static Material _workbenchStarMaterial; public static void ApplyWorkbenchLevelStar(Image target) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)target == (Object)null)) { CacheWorkbenchStarOnce(); if ((Object)(object)_workbenchStarSprite != (Object)null) { target.sprite = _workbenchStarSprite; target.type = _workbenchStarType; target.pixelsPerUnitMultiplier = _workbenchStarPPU; target.preserveAspect = _workbenchStarPreserveAspect; ((Graphic)target).material = _workbenchStarMaterial; ((Graphic)target).color = Color.white; } else { target.sprite = null; target.type = (Type)1; target.preserveAspect = false; ((Graphic)target).color = GUIManager.Instance.ValheimOrange; } } } private static void CacheWorkbenchStarOnce() { //IL_0108: 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) if (_cached) { return; } _cached = true; InventoryGui instance = InventoryGui.instance; if ((Object)(object)instance == (Object)null) { Logger.LogWarning((object)"[SkillsReworked.UI.UiSpriteHelper] InventoryGui.instance is null"); return; } RectTransform crafting = instance.m_crafting; if ((Object)(object)crafting == (Object)null) { Logger.LogWarning((object)"[SkillsReworked.UI.UiSpriteHelper] InventoryGui.m_crafting is null"); return; } Transform val = ((Transform)crafting).Find("Level"); if ((Object)(object)val == (Object)null) { Transform[] componentsInChildren = ((Component)crafting).GetComponentsInChildren<Transform>(true); foreach (Transform val2 in componentsInChildren) { if (((Object)val2).name == "Level") { val = val2; break; } } } if ((Object)(object)val == (Object)null) { Logger.LogWarning((object)"[SkillsReworked.UI.UiSpriteHelper] Could not find 'Level' under InventoryGui.m_crafting"); return; } Image component = ((Component)val).GetComponent<Image>(); if ((Object)(object)component == (Object)null) { Logger.LogWarning((object)"[SkillsReworked.UI.UiSpriteHelper] 'Level' does not have an Image component"); return; } _workbenchStarSprite = component.sprite; _workbenchStarType = component.type; _workbenchStarPPU = component.pixelsPerUnitMultiplier; _workbenchStarPreserveAspect = component.preserveAspect; _workbenchStarMaterial = ((Graphic)component).material; } } } namespace SkillsReworked.Skillsystem { public static class LevelXpMath { public static float GetRequirementForLevel(int levelIndex) { float num = Mathf.Floor((float)levelIndex + 1f); return Mathf.Pow(num, 1.5f) * 0.5f + 0.5f; } public static float GetCurrentLevelFraction(Skill levelSkill) { if (levelSkill == null) { return 0f; } int levelIndex = Mathf.FloorToInt(levelSkill.m_level); float requirementForLevel = GetRequirementForLevel(levelIndex); if (requirementForLevel <= 0f) { return 0f; } return Mathf.Clamp01(levelSkill.m_accumulator / requirementForLevel); } public static int GetPlayerLevel(Player player) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null) { return 0; } Skills skills = ((Character)player).GetSkills(); if ((Object)(object)skills == (Object)null) { return 0; } Skill skill = skills.GetSkill(SkillsReworked.M2CharacterLevelSkillType); if (skill == null) { return 0; } return Mathf.FloorToInt(skill.m_level); } private static int GetOptimalLevelForBiome(Biome biome) { //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_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 //IL_000a: 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_0022: Expected I4, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Invalid comparison between Unknown and I4 //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Invalid comparison between Unknown and I4 //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 if ((int)biome <= 16) { switch (biome - 1) { default: if ((int)biome != 8) { if ((int)biome != 16) { break; } return SkillsReworked.plainsOptimalLevelCfg?.Value ?? 50; } return SkillsReworked.blackForestOptimalLevelCfg?.Value ?? 20; case 0: return SkillsReworked.meadowsOptimalLevelCfg?.Value ?? 10; case 1: return SkillsReworked.swampOptimalLevelCfg?.Value ?? 30; case 3: return SkillsReworked.mountainOptimalLevelCfg?.Value ?? 40; case 2: break; } } else { if ((int)biome == 32) { return SkillsReworked.ashlandsOptimalLevelCfg?.Value ?? 70; } if ((int)biome == 64) { return SkillsReworked.deepNorthOptimalLevelCfg?.Value ?? 70; } if ((int)biome == 512) { return SkillsReworked.mistlandsOptimalLevelCfg?.Value ?? 60; } } return SkillsReworked.meadowsOptimalLevelCfg?.Value ?? 10; } public static Biome GetMobBiome(Character mob) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)mob == (Object)null) { return (Biome)1; } MobBiomeTracker component = ((Component)mob).GetComponent<MobBiomeTracker>(); if ((Object)(object)component != (Object)null && (int)component.SpawnBiome > 0) { return component.SpawnBiome; } return Heightmap.FindBiome(((Component)mob).transform.position); } public static float GetLevelBasedXpFactor(Player player, Character mob) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null || (Object)(object)mob == (Object)null) { return 1f; } return GetLevelBasedXpFactor(player, GetMobBiome(mob)); } public static float GetLevelBasedXpFactor(Player player, Biome biome) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null) { return 1f; } int playerLevel = GetPlayerLevel(player); int optimalLevelForBiome = GetOptimalLevelForBiome(biome); if (optimalLevelForBiome <= 0) { return 1f; } if (playerLevel <= optimalLevelForBiome) { return 1f; } int num = playerLevel - optimalLevelForBiome; int num2 = SkillsReworked.xpMaxOverLevelCfg?.Value ?? 30; if (num2 <= 0) { num2 = 1; } float num3 = SkillsReworked.xpMinFactorCfg?.Value ?? 0.05f; num3 = Mathf.Clamp(num3, 0.01f, 1f); float num4 = Mathf.Clamp01((float)num / (float)num2); float num5 = Mathf.Lerp(1f, num3, num4); return Mathf.Clamp(num5, num3, 1f); } public static float ApplyLevelScaling(Player player, Character mob, float xp) { if (xp <= 0f) { return 0f; } float levelBasedXpFactor = GetLevelBasedXpFactor(player, mob); return xp * levelBasedXpFactor; } public static float ApplyLevelScaling(Player player, Biome biome, float xp) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (xp <= 0f) { return 0f; } float levelBasedXpFactor = GetLevelBasedXpFactor(player, biome); return xp * levelBasedXpFactor; } } public class MobBiomeTracker : MonoBehaviour { public Biome SpawnBiome; } public static class PrestigeManager { private const string PrestigeKey = "SkillsReworked.PrestigeRank"; public static int GetPrestigeRank(Player player) { if ((Object)(object)player == (Object)null || player.m_customData == null) { return 0; } if (player.m_customData.TryGetValue("SkillsReworked.PrestigeRank", out var value) && int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { return Mathf.Max(0, result); } return 0; } public static void AddPrestige(Player player, int amount) { if (!((Object)(object)player == (Object)null) && amount != 0) { int num = SkillsReworked.prestigeMaxRankCfg?.Value ?? 10; int prestigeRank = GetPrestigeRank(player); int newRank = Mathf.Clamp(prestigeRank + amount, 0, num); SetPrestigeRank(player, newRank); } } public static void SetPrestigeRank(Player player, int newRank) { if (!((Object)(object)player == (Object)null)) { if (player.m_customData == null) { player.m_customData = new Dictionary<string, string>(); } int num = SkillsReworked.prestigeMaxRankCfg?.Value ?? 10; newRank = Mathf.Clamp(newRank, 0, num); player.m_customData["SkillsReworked.PrestigeRank"] = newRank.ToString(CultureInfo.InvariantCulture); } } } public static class SkillCapManager { public static float GetCurrentSkillCap(Player player) { if ((Object)(object)player == (Object)null) { return 100f; } if (SkillsReworked.skillCapsEnabledCfg != null && !SkillsReworked.skillCapsEnabledCfg.Value) { return 100f; } int num = SkillsReworked.capBeforeEikthyrCfg?.Value ?? 30; int num2 = SkillsReworked.capAfterEikthyrCfg?.Value ?? num; int num3 = SkillsReworked.capAfterElderCfg?.Value ?? num2; int num4 = SkillsReworked.capAfterBonemassCfg?.Value ?? num3; int num5 = SkillsReworked.capAfterModerCfg?.Value ?? num4; int num6 = SkillsReworked.capAfterYagluthCfg?.Value ?? num5; int num7 = SkillsReworked.capAfterQueenCfg?.Value ?? num6; int cap = SkillsReworked.capAfterFaderCfg?.Value ?? num7; if (((Humanoid)player).HaveUniqueKey("defeated_fader")) { return ClampCap(cap); } if (((Humanoid)player).HaveUniqueKey("defeated_queen")) { return ClampCap(num7); } if (((Humanoid)player).HaveUniqueKey("defeated_goblinking")) { return ClampCap(num6); } if (((Humanoid)player).HaveUniqueKey("defeated_dragon")) { return ClampCap(num5); } if (((Humanoid)player).HaveUniqueKey("defeated_bonemass")) { return ClampCap(num4); } if (((Humanoid)player).HaveUniqueKey("defeated_gdking")) { return ClampCap(num3); } if (((Humanoid)player).HaveUniqueKey("defeated_eikthyr")) { return ClampCap(num2); } return ClampCap(num); } private static float ClampCap(int cap) { return Mathf.Clamp((float)cap, 0f, 100f); } } public static class SkillPointManager { private const string spentKey = "SkillsReworked.SpentSkillPoints"; private static int BasePoints => SkillsReworked.basePointsCfg?.Value ?? 50; private static int PointsPerLevel => SkillsReworked.pointsPerLevelCfg?.Value ?? 15; private static int GetSpentPoints(Player player) { if ((Object)(object)player == (Object)null || player.m_customData == null) { return 0; } if (player.m_customData.TryGetValue("SkillsReworked.SpentSkillPoints", out var value) && int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { return Mathf.Max(0, result); } return 0; } private static void SetSpentPoints(Player player, int spentPoints) { if (!((Object)(object)player == (Object)null)) { if (player.m_customData == null) { player.m_customData = new Dictionary<string, string>(); } spentPoints = Mathf.Max(0, spentPoints); player.m_customData["SkillsReworked.SpentSkillPoints"] = spentPoints.ToString(CultureInfo.InvariantCulture); } } public static int GetTotalPoints(Player player) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null) { return 0; } Skills skills = ((Character)player).GetSkills(); if ((Object)(object)skills == (Object)null) { return 0; } Skill skill = skills.GetSkill(SkillsReworked.M2CharacterLevelSkillType); int num = 0; if (skill != null) { num = Mathf.FloorToInt(skill.m_level); } if (num < 0) { num = 0; } int basePoints = BasePoints; int pointsPerLevel = PointsPerLevel; ConfigEntry<bool> prestigeEnabledCfg = SkillsReworked.prestigeEnabledCfg; int num2 = ((prestigeEnabledCfg == null || prestigeEnabledCfg.Value) ? PrestigeManager.GetPrestigeRank(player) : 0); int num3 = SkillsReworked.prestigePointsPerRankCfg?.Value ?? 0; int num4 = pointsPerLevel + num2 * num3; if (num4 < 0) { num4 = 0; } int num5 = basePoints + num * num4; return Mathf.Max(0, num5); } public static int GetAvailablePoints(Player player) { int totalPoints = GetTotalPoints(player); int spentPoints = GetSpentPoints(player); int num = totalPoints - spentPoints; return Mathf.Max(0, num); } public static bool TrySpendPoints(Player player, int amount) { if ((Object)(object)player == (Object)null) { return false; } if (amount <= 0) { return true; } int availablePoints = GetAvailablePoints(player); if (availablePoints < amount) { return false; } int spentPoints = GetSpentPoints(player); spentPoints += amount; SetSpentPoints(player, spentPoints); return true; } public static void ResetSpentPoints(Player player) { if (!((Object)(object)player == (Object)null)) { if (player.m_customData == null) { player.m_customData = new Dictionary<string, string>(); } player.m_customData["SkillsReworked.SpentSkillPoints"] = "0"; } } } } namespace SkillsReworked.Patches { [HarmonyPatch(typeof(Character), "Awake")] public static class Patch_Character_Awake { private static void Postfix(Character __instance) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null) { return; } if (!__instance.IsPlayer() && !__instance.IsTamed()) { MobBiomeTracker mobBiomeTracker = ((Component)__instance).GetComponent<MobBiomeTracker>(); if ((Object)(object)mobBiomeTracker == (Object)null) { mobBiomeTracker = ((Component)__instance).gameObject.AddComponent<MobBiomeTracker>(); } mobBiomeTracker.SpawnBiome = Heightmap.FindBiome(((Component)__instance).transform.position); } if (Object.op_Implicit((Object)(object)__instance.m_nview)) { __instance.m_nview.Register<string, Vector3>("SkillsReworked_RPC_SetPlayerKeyOnBossDeath", (Action<long, string, Vector3>)Patch_Character_OnDeath.RPC_SetPlayerKeyOnBossDeath); __instance.m_nview.Register<string, Vector3, float, int>("SkillsReworked_RPC_MobDeathEvent", (Method<string, Vector3, float, int>)Patch_Character_OnDeath.RPC_OnMobDeathEvent); } } } [HarmonyPatch(typeof(Character), "OnDeath")] public static class Patch_Character_OnDeath { private const float BossKeyMaxDistance = 300f; internal const string BossKeyRpcName = "SkillsReworked_RPC_SetPlayerKeyOnBossDeath"; internal const string MobDeathEventRpcName = "SkillsReworked_RPC_MobDeathEvent"; [HarmonyPrefix] private static void Prefix(Character __instance, HitData ___m_lastHit) { //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Expected I4, but got Unknown //IL_0081: 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_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || !Object.op_Implicit((Object)(object)__instance.m_nview) || !__instance.m_nview.IsOwner()) { return; } if (!string.IsNullOrEmpty(__instance.m_defeatSetGlobalKey)) { __instance.m_nview.InvokeRPC(ZNetView.Everybody, "SkillsReworked_RPC_SetPlayerKeyOnBossDeath", new object[2] { __instance.m_defeatSetGlobalKey, ((Component)__instance).transform.position }); } if (__instance.IsPlayer() || __instance.IsTamed() || ___m_lastHit == null) { return; } Character attacker = ___m_lastHit.GetAttacker(); Player val = (Player)(object)((attacker is Player) ? attacker : null); if (val == null) { return; } float num = __instance.GetMaxHealth() * 0.1f; float num2 = SkillsReworked.multiplierCfg?.Value ?? 1f; float num3 = num * num2 + 5f; if (__instance.m_boss) { float num4 = SkillsReworked.bossXpMultiplierCfg?.Value ?? 3f; num3 *= num4; } if (num3 <= 0f) { return; } string playerName = val.GetPlayerName(); Vector3 position = ((Component)val).transform.position; Biome mobBiome = LevelXpMath.GetMobBiome(__instance); long num5 = ZNetView.Everybody; try { ZNetView nview = ((Character)val).m_nview; ZDO val2 = ((nview != null) ? nview.GetZDO() : null); if (val2 != null) { num5 = val2.GetOwner(); } } catch { num5 = ZNetView.Everybody; } long num6 = ((num5 != ZNetView.Everybody) ? num5 : ZNetView.Everybody); __instance.m_nview.InvokeRPC(num6, "SkillsReworked_RPC_MobDeathEvent", new object[4] { playerName, position, num3, (int)mobBiome }); } internal static void RPC_OnMobDeathEvent(long sender, string killerName, Vector3 killerPos, float totalXp, int biomeInt) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) if (totalXp <= 0f) { return; } Player localPlayer = Player.m_localPlayer; if (Object.op_Implicit((Object)(object)localPlayer) && !(localPlayer.GetPlayerName() != killerName)) { Biome biome = (Biome)biomeInt; float num = LevelXpMath.ApplyLevelScaling(localPlayer, biome, totalXp); if (!(num <= 0f)) { ((Character)localPlayer).RaiseSkill(SkillsReworked.M2CharacterLevelSkillType, num); GroupXp.TryBroadcastGroupShareFromKiller(killerName, killerPos, num, biomeInt); } } } internal static void RPC_SetPlayerKeyOnBossDeath(long sender, string key, Vector3 position) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (Object.op_Implicit((Object)(object)localPlayer) && RpcRangeUtil.IsLocalPlayerWithinRange(position, 300f)) { ((Humanoid)localPlayer).AddUniqueKey(key); } } } [HarmonyPatch] public static class Patch_Hud { [HarmonyPostfix] [HarmonyPatch(typeof(Hud), "Update")] private static void Hud_Update_Postfix() { LevelXpHudManager.Update(Time.deltaTime); } [HarmonyPostfix] [HarmonyPatch(typeof(Hud), "OnDestroy")] private static void Hud_OnDestroy_Postfix(Hud __instance) { LevelXpHudManager.OnHudDestroy(__instance); } } [HarmonyPatch] public static class Patch_Player_OnSpawned { [HarmonyPostfix] [HarmonyPatch(typeof(Player), "OnSpawned")] private static void Player_OnSpawned_Postfix(Player __instance) { if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer) { LevelXpHudManager.RefreshForLocalPlayer(); } } } [HarmonyPatch(typeof(Player), "Awake")] public static class Patch_Player_Awake_GroupShareRpc { private static void Postfix(Player __instance) { if (!((Object)(object)((Character)(__instance?)).m_nview == (Object)null)) { ((Character)__instance).m_nview.Register<string, Vector3, float, int>("SkillsReworked_RPC_GroupShareLevelXp", (Method<string, Vector3, float, int>)GroupXp.RPC_AwardGroupShare); } } } [HarmonyPatch(typeof(SkillsDialog), "SelectFirstEntry")] public static class Patch_SkillsDialog_SelectFirstEntry { [CompilerGenerated] private sealed class <EmptyEnumerator>d__1 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <EmptyEnumerator>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static bool Prefix(ref IEnumerator __result) { if (SkillUiSession.SuppressAutoScroll) { __result = EmptyEnumerator(); return false; } return true; } [IteratorStateMachine(typeof(<EmptyEnumerator>d__1))] private static IEnumerator EmptyEnumerator() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <EmptyEnumerator>d__1(0); } } [HarmonyPatch(typeof(SkillsDialog), "Setup")] public static class Patch_SkillsDialog_Setup { private static void Postfix(SkillsDialog __instance, Player player) { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Expected O, but got Unknown //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Expected O, but got Unknown //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Expected O, but got Unknown //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Expected O, but got Unknown //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Expected O, but got Unknown if ((Object)(object)__instance == (Object)null || (Object)(object)player == (Object)null) { return; } Skills skills = ((Character)player).GetSkills(); if ((Object)(object)skills == (Object)null) { return; } List<Skill> skillList = skills.GetSkillList(); for (int i = 0; i < skillList.Count && i < __instance.m_elements.Count; i++) { Skill val = skillList[i]; GameObject val2 = __instance.m_elements[i]; if ((Object)(object)val2 == (Object)null) { continue; } Transform transform = val2.transform; RectTransform val3 = (RectTransform)(object)((transform is RectTransform) ? transform : null); if (!((Object)(object)val3 == (Object)null)) { SkillType skill = val.m_info.m_skill; if (skill != SkillsReworked.M2CharacterLevelSkillType) { SkillUiHelper.EnsureButtons(val3, skill); } } } RectTransform val4 = null; Transform parent = ((Transform)__instance.m_listRoot).parent; RectTransform val5 = (RectTransform)(object)((parent is RectTransform) ? parent : null); if ((Object)(object)val5 != (Object)null) { Transform parent2 = ((Transform)val5).parent; val4 = (RectTransform)(object)((parent2 is RectTrans