Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Valheim Skill Customizer v1.3.0
Valheim Skill Customizer.dll
Decompiled a day agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Valheim_Skill_Customizer")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Valheim_Skill_Customizer")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("7d63e296-22ed-4ab3-8f0e-8cf2451a403c")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace ValheimSkillCustomizer { [BepInPlugin("com.viking.valheimskillcustomizer", "Valheim Skill Customizer", "1.2.0")] public class SkillCustomizerPlugin : BaseUnityPlugin { public enum DeathPenaltyMode { NoSkillDrain, HalfSkillDrain, NormalSkillDrain, DoubleSkillDrain } [HarmonyPatch(typeof(Skills), "RaiseSkill")] private static class Patch_RaiseSkill { private static void Prefix(SkillType skillType, ref float factor) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (ModEnabled.Value) { factor *= GlobalXpMultiplier.Value; if (IndividualSkillMultipliers.TryGetValue(skillType, out var value)) { factor *= value.Value; } } } } [HarmonyPatch(typeof(Skills), "OnDeath")] private static class Patch_OnDeath { private static bool Prefix(Skills __instance) { if (!ModEnabled.Value) { return true; } if (DeathPenaltySetting.Value == DeathPenaltyMode.NoSkillDrain) { return false; } float num = 1f; switch (DeathPenaltySetting.Value) { case DeathPenaltyMode.HalfSkillDrain: num = 0.5f; break; case DeathPenaltyMode.DoubleSkillDrain: num = 2f; break; default: return true; } float num2 = 0.05f; float num3 = num2 * num; FieldInfo fieldInfo = AccessTools.Field(typeof(Skills), "m_skillData"); if (fieldInfo.GetValue(__instance) is IDictionary dictionary) { foreach (DictionaryEntry item in dictionary) { object value = item.Value; FieldInfo fieldInfo2 = AccessTools.Field(value.GetType(), "m_level"); if (fieldInfo2 != null) { float num4 = (float)fieldInfo2.GetValue(value); num4 -= num4 * num3; if (num4 < 0f) { num4 = 0f; } fieldInfo2.SetValue(value, num4); } } } FieldInfo fieldInfo3 = AccessTools.Field(typeof(Skills), "m_player"); object? value2 = fieldInfo3.GetValue(__instance); Player val = (Player)((value2 is Player) ? value2 : null); if ((Object)(object)val != (Object)null) { ((Character)val).Message((MessageType)1, "$msg_skills_lowered", 0, (Sprite)null, false); } return false; } } private const string ModGUID = "com.viking.valheimskillcustomizer"; private const string ModName = "Valheim Skill Customizer"; private const string ModVersion = "1.2.0"; private readonly Harmony harmony = new Harmony("com.viking.valheimskillcustomizer"); public static ConfigEntry<bool> IsConfigLocked; public static ConfigEntry<bool> ModEnabled; public static ConfigEntry<DeathPenaltyMode> DeathPenaltySetting; public static ConfigEntry<float> GlobalXpMultiplier; public static Dictionary<SkillType, ConfigEntry<float>> IndividualSkillMultipliers = new Dictionary<SkillType, ConfigEntry<float>>(); private void Awake() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Invalid comparison between Unknown and I4 //IL_013b: Unknown result type (might be due to invalid IL or missing references) ConfigurationManagerAttributes configurationManagerAttributes = new ConfigurationManagerAttributes { Order = 210 }; IsConfigLocked = ((BaseUnityPlugin)this).Config.Bind<bool>("0. Master Settings (Made by viking)", "Lock Configuration", true, new ConfigDescription("If true, configuration settings will be locked to server-side values via ConditionalConfigSync for non-admin players.", (AcceptableValueBase)null, new object[1] { configurationManagerAttributes })); ModEnabled = BindConfig("0. Master Settings (Made by viking)", "Mod Enabled", value: true, "Enable or disable this mod's entire functionality completely. [Synced with Server]", 200); DeathPenaltySetting = BindConfig("1. Death Penalty", "Skill Drain Modifier", DeathPenaltyMode.NormalSkillDrain, "Choose how much skill XP you lose upon death. [Synced with Server]", 100); GlobalXpMultiplier = BindConfigRange("2. Global XP Modifier", "All Skills Global Multiplier", 1f, "Global multiplier stacked on top of individual skill settings. [Synced with Server]", 99); BindStepEnforcer(GlobalXpMultiplier); int num = 90; foreach (SkillType value in Enum.GetValues(typeof(SkillType))) { if ((int)value != 0 && (int)value != 999) { string text = ((object)value/*cast due to .constrained prefix*/).ToString(); ConfigEntry<float> val2 = BindConfigRange("3. Individual Skill Multipliers", text + " XP Multiplier", 1f, text + " experience point multiplier. [Synced with Server]", num--); BindStepEnforcer(val2); IndividualSkillMultipliers[value] = val2; } } harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Valheim Skill Customizer loaded successfully! Made by Viking."); } private ConfigEntry<T> BindConfig<T>(string group, string name, T value, string description, int order) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown ConfigurationManagerAttributes configurationManagerAttributes = new ConfigurationManagerAttributes { Order = order }; return ((BaseUnityPlugin)this).Config.Bind<T>(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, new object[1] { configurationManagerAttributes })); } private ConfigEntry<float> BindConfigRange(string group, string name, float value, string description, int order) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown ConfigurationManagerAttributes configurationManagerAttributes = new ConfigurationManagerAttributes { Order = order, ShowRangeAsPercent = false }; return ((BaseUnityPlugin)this).Config.Bind<float>(group, name, value, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), new object[1] { configurationManagerAttributes })); } private void BindStepEnforcer(ConfigEntry<float> configEntry) { configEntry.SettingChanged += delegate { float num = (float)Math.Round(configEntry.Value * 2f, MidpointRounding.AwayFromZero) / 2f; if (Math.Abs(configEntry.Value - num) > 0.01f) { configEntry.Value = num; } }; } } public class ConfigurationManagerAttributes { public bool? Browsable; public bool? ShowRangeAsPercent; public int? Order; } } namespace Valheim_Skill_Customizer.MonoBehaviours { internal class Valheim_Skill_CustomizerComponent : MonoBehaviour { public void Awake() { } public void Start() { } public void Update() { } public void LateUpdate() { } } }