using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Pipakin.SkillInjectorMod;
using TMPro;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("VitalityRewrite")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VitalityRewrite")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b6fe5d82-5883-4677-b77c-3a0d9cfbb356")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace VitalityRewrite
{
[BepInPlugin("VitalityRewrite", "Vitality Rewrite", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInIncompatibility("RD_Valheim_Vitality_Mod")]
public class VitalityRewrite : BaseUnityPlugin
{
[HarmonyPatch(typeof(Player), "UpdateFood")]
public static class HealthRegeneration
{
private static void Prefix(Player __instance, ref float ___m_foodRegenTimer)
{
if (___m_foodRegenTimer == 0f)
{
float value = cfgHealthRegen.Value;
float num = skillFactor * value / 100f + 1f;
if (num > 0f)
{
___m_foodRegenTimer = 10f - 10f / num;
}
}
}
}
[HarmonyPatch(typeof(Player), "SetMaxHealth")]
public static class MaxHealth
{
private static void Prefix(Player __instance, ref float health, bool flashBar)
{
float value = cfgMaxHealth.Value;
health += skillFactor * value;
}
}
[HarmonyPatch(typeof(Player), "SetMaxStamina")]
public static class MaxStamina
{
private static void Prefix(Player __instance, ref float stamina, bool flashBar)
{
float value = cfgMaxStamina.Value;
stamina += skillFactor * value;
}
}
[HarmonyPatch(typeof(Player), "SetMaxEitr")]
public static class MaxEitr
{
private static void Prefix(Player __instance, ref float eitr, bool flashBar)
{
if (eitr > 0f)
{
float value = cfgMaxEitr.Value;
eitr += skillFactor * value;
}
}
}
[HarmonyPatch(typeof(Player), "GetJogSpeedFactor")]
public static class VitalityWalkSpeed
{
private static void Postfix(Player __instance, ref float __result)
{
float value = cfgWalkSpeed.Value;
__result += skillFactor * value / 100f;
}
}
[HarmonyPatch(typeof(Player), "GetRunSpeedFactor")]
public static class VitalityRunSpeed
{
private static void Postfix(Player __instance, ref float __result)
{
float value = cfgRunSpeed.Value;
__result += skillFactor * value / 100f;
}
}
[HarmonyPatch(typeof(Character), "UpdateGroundContact")]
public static class FallDamageReduction
{
private static void Prefix(Character __instance, float dt, ref float ___m_maxAirAltitude, bool ___m_groundContact)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
if (!__instance.IsPlayer() || !___m_groundContact)
{
return;
}
float num = ___m_maxAirAltitude - ((Component)__instance).transform.position.y;
if (num > 4f)
{
if (_loggingEnabled.Value)
{
Log("Fall damage reduced from: " + Mathf.Clamp01((num - 4f) / 16f) * 100f);
}
float value = cfgFallDamage.Value;
___m_maxAirAltitude -= num * skillFactor * value / 100f;
if (_loggingEnabled.Value)
{
num = ___m_maxAirAltitude - ((Component)__instance).transform.position.y;
Log("to: " + Mathf.Clamp01((num - 4f) / 16f) * 100f);
}
}
}
}
[HarmonyPatch(typeof(Player), "OnJump")]
public static class FallDamageReductionDoubleJump
{
public static void Postfix(Player __instance, ref float ___m_maxAirAltitude)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
Log("___m_maxAirAltitude: " + ___m_maxAirAltitude);
if (((Character)__instance).IsPlayer() && cfgDoubleJumpFallDamageReset.Value)
{
___m_maxAirAltitude = ((Component)__instance).transform.position.y;
Log("___m_maxAirAltitude after: " + ___m_maxAirAltitude);
}
}
}
[HarmonyPatch(typeof(Player), "UpdateStats", new Type[] { typeof(float) })]
public static class IncreaseSkill
{
private static float stamina;
private static float runSwimSkill;
private static void Prefix(Player __instance, float dt)
{
if (((Character)__instance).IsFlying())
{
return;
}
if (((Character)__instance).IsRunning() && ((Character)__instance).IsOnGround())
{
runSwimSkill += 0.1f * dt;
}
if (((Character)__instance).InWater() && !((Character)__instance).IsOnGround())
{
if (stamina != ((Character)__instance).GetStaminaPercentage())
{
runSwimSkill += 0.25f * dt;
}
stamina = ((Character)__instance).GetStaminaPercentage();
}
if (runSwimSkill >= 1f)
{
Increase(__instance, runSwimSkill);
runSwimSkill = 0f;
}
}
}
[HarmonyPatch(typeof(Player), "Load")]
public static class AttributeOverWriteOnLoad
{
private static float m_jumpForce;
private static float m_maxCarryWeight;
private static float m_jumpStaminaUsage;
private static float m_staminaRegenDelay;
private static float m_staminaRegen;
private static float m_eitrRegen;
private static float m_swimStaminaDrainMinSkill;
private static float m_swimStaminaDrainMaxSkill;
private static float m_swimSpeed;
private static float m_swimTurnSpeed;
private static void Postfix(Player __instance, ZPackage pkg)
{
m_jumpForce = ((Character)__instance).m_jumpForce;
m_staminaRegen = __instance.m_staminaRegen;
m_eitrRegen = __instance.m_eiterRegen;
m_swimStaminaDrainMinSkill = __instance.m_swimStaminaDrainMinSkill;
m_swimStaminaDrainMaxSkill = __instance.m_swimStaminaDrainMaxSkill;
m_maxCarryWeight = __instance.m_maxCarryWeight;
m_jumpStaminaUsage = ((Character)__instance).m_jumpStaminaUsage;
m_staminaRegenDelay = __instance.m_staminaRegenDelay;
m_swimSpeed = ((Character)__instance).m_swimSpeed;
m_swimTurnSpeed = ((Character)__instance).m_swimTurnSpeed;
applyChangedValues(__instance);
}
public static void applyChangedValues(Player __instance)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
skillFactor = ((Character)__instance).GetSkillFactor(skill);
Log("Player: " + __instance.GetPlayerName() + " has skillfactor of " + skillFactor + " applied. ");
float value = cfgJumpHeight.Value;
Log("Base jump force changed from: " + ((Character)__instance).m_jumpForce);
((Character)__instance).m_jumpForce = m_jumpForce * (1f + skillFactor * value / 100f);
Log("to: " + ((Character)__instance).m_jumpForce);
value = cfgStaminaRegen.Value;
Log("Stamina base regeneration changed from: " + __instance.m_staminaRegen);
__instance.m_staminaRegen = m_staminaRegen * (1f + skillFactor * value / 100f);
Log("to: " + __instance.m_staminaRegen);
value = cfgEitrRegen.Value;
Log("Eitr base regeneration changed from: " + __instance.m_eiterRegen);
__instance.m_eiterRegen = m_eitrRegen * (1f + skillFactor * value / 100f);
Log("to: " + __instance.m_eiterRegen);
value = cfgStaminaSwim.Value;
Log("Base swim stamina strain at zero skill changed from: " + __instance.m_swimStaminaDrainMinSkill);
__instance.m_swimStaminaDrainMinSkill = m_swimStaminaDrainMinSkill * (1f - skillFactor * value / 100f);
Log("to: " + __instance.m_swimStaminaDrainMinSkill);
Log("Base swim stamina strain at max skill changed from: " + __instance.m_swimStaminaDrainMaxSkill);
__instance.m_swimStaminaDrainMaxSkill = m_swimStaminaDrainMaxSkill * (1f - skillFactor * value / 100f);
Log("to: " + __instance.m_swimStaminaDrainMaxSkill);
value = cfgCarryWeight.Value;
Log("Base carry weight changed from: " + __instance.m_maxCarryWeight);
__instance.m_maxCarryWeight = m_maxCarryWeight + skillFactor * value;
Log("to: " + __instance.m_maxCarryWeight);
value = cfgStaminaJump.Value;
Log("Base jump stamina use changed from: " + ((Character)__instance).m_jumpStaminaUsage);
((Character)__instance).m_jumpStaminaUsage = m_jumpStaminaUsage * (1f - skillFactor * value / 100f);
Log("to: " + ((Character)__instance).m_jumpStaminaUsage);
value = cfgStaminaDelay.Value;
Log("Base stamina regeneration delay changed from: " + __instance.m_staminaRegenDelay);
__instance.m_staminaRegenDelay = m_staminaRegenDelay * (1f - skillFactor * value / 100f);
Log("to: " + __instance.m_staminaRegenDelay);
value = cfgSwimSpeed.Value;
Log("Base swim speed changed from: " + ((Character)__instance).m_swimSpeed);
((Character)__instance).m_swimSpeed = m_swimSpeed * (1f + skillFactor * value / 100f);
Log("to: " + ((Character)__instance).m_swimSpeed);
Log("Base swim turning speed changed from: " + ((Character)__instance).m_swimTurnSpeed);
((Character)__instance).m_swimTurnSpeed = m_swimTurnSpeed * (1f + skillFactor * value / 100f);
Log("to: " + ((Character)__instance).m_swimTurnSpeed);
if (_loggingEnabled.Value)
{
value = cfgHealthRegen.Value;
float num = skillFactor * value / 100f + 1f;
Log("Health regenation value set to " + (10f - 10f / num) + " (out of 10) whenever it reaches zero");
value = cfgMaxHealth.Value;
Log("Health increased by " + skillFactor * value);
value = cfgMaxStamina.Value;
Log("Stamina increased by " + skillFactor * value);
value = cfgMaxEitr.Value;
Log("Eitr increased by " + skillFactor * value);
value = cfgWalkSpeed.Value;
Log("Base walk speed increased by " + skillFactor * value + "%");
value = cfgRunSpeed.Value;
Log("Base run speed increased by " + skillFactor * value + "%");
}
}
}
[HarmonyPatch(typeof(Player), "OnSkillLevelup")]
public static class LevelUpSkillApplyValues
{
private static void Postfix(Player __instance, SkillType skill, float level)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (skill == VitalityRewrite.skill)
{
AttributeOverWriteOnLoad.applyChangedValues(__instance);
}
}
}
[HarmonyPatch(typeof(Player), "OnJump")]
public static class VitalitySkillOnJump
{
private static void Prefix(Player __instance)
{
float num = ((Character)__instance).m_jumpStaminaUsage - ((Character)__instance).m_jumpStaminaUsage * ((Character)__instance).GetEquipmentJumpStaminaModifier();
if (((Character)__instance).HaveStamina(num * Game.m_moveStaminaRate))
{
Increase(__instance, 0.14f);
}
}
}
[HarmonyPatch(typeof(MineRock5), "DamageArea")]
public static class Mining_Big_Rocks
{
private static void Prefix(MineRock5 __instance, HitData hit, float __state)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Invalid comparison between Unknown and I4
Player localPlayer = Player.m_localPlayer;
if (!((Object)(object)localPlayer == (Object)null) && ((Character)localPlayer).GetZDOID() == hit.m_attacker && (int)hit.m_skill == 12)
{
float value = cfgPickAxe.Value;
hit.m_damage.m_pickaxe *= 1f + skillFactor * value / 100f;
float value2 = 0.04f + hit.m_damage.m_pickaxe * 0.00075f * cfgSkillGainByWorkDamageMultiplier.Value;
Increase(localPlayer, value2);
Log("(MineRock5) Player: " + localPlayer.GetPlayerName() + " hit on: " + ((Object)__instance).name + " used Skill: " + ((object)(SkillType)(ref hit.m_skill)).ToString() + " damage done: " + hit.m_damage.m_pickaxe + " skill gain: " + value2);
}
}
}
[HarmonyPatch(typeof(Destructible), "Damage")]
public static class Destroy_Little_Things
{
private static void Prefix(Destructible __instance, HitData hit)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Invalid comparison between Unknown and I4
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Invalid comparison between Unknown and I4
Player localPlayer = Player.m_localPlayer;
if (!((Object)(object)localPlayer == (Object)null) && ((Character)localPlayer).GetZDOID() == hit.m_attacker)
{
if (((Object)__instance).name.ToLower().Contains("rock") && (int)hit.m_skill == 12)
{
float value = cfgPickAxe.Value;
hit.m_damage.m_pickaxe *= 1f + skillFactor * value / 100f;
float value2 = 0.1f + hit.m_damage.m_pickaxe * 0.001f * cfgSkillGainByWorkDamageMultiplier.Value;
Increase(localPlayer, value2);
Log("(Destructible) Player: " + localPlayer.GetPlayerName() + " hit on: " + ((Object)__instance).name + " used Skill: " + ((object)(SkillType)(ref hit.m_skill)).ToString() + " damage done: " + hit.m_damage.m_pickaxe + " skill gain: " + value2);
}
else if ((int)hit.m_skill == 13)
{
float value3 = cfgTreeLogging.Value;
hit.m_damage.m_chop *= 1f + skillFactor * value3 / 100f;
float value4 = 0.1f + hit.m_damage.m_chop * 0.001f * cfgSkillGainByWorkDamageMultiplier.Value;
Increase(localPlayer, value4);
Log("(Destructible) Player: " + localPlayer.GetPlayerName() + " hit on: " + ((Object)__instance).name + " used Skill: " + ((object)(SkillType)(ref hit.m_skill)).ToString() + " damage done: " + hit.m_damage.m_chop + " skill gain: " + value4);
}
}
}
}
[HarmonyPatch(typeof(TreeBase), "Damage")]
public static class WoodCutting
{
private static void Prefix(TreeBase __instance, HitData hit)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Invalid comparison between Unknown and I4
Player localPlayer = Player.m_localPlayer;
if (!((Object)(object)localPlayer == (Object)null) && ((Character)localPlayer).GetZDOID() == hit.m_attacker && (int)hit.m_skill == 13 && hit.m_toolTier >= __instance.m_minToolTier)
{
float value = cfgTreeLogging.Value;
hit.m_damage.m_chop *= 1f + skillFactor * value / 100f;
float value2 = 0.1f + hit.m_damage.m_chop * 0.001f * cfgSkillGainByWorkDamageMultiplier.Value;
Increase(localPlayer, value2);
Log("(TreeBase) Player: " + localPlayer.GetPlayerName() + " hit on: " + ((Object)__instance).name + " used Skill: " + ((object)(SkillType)(ref hit.m_skill)).ToString() + " damage done: " + hit.m_damage.m_chop + " skill gain: " + value2);
}
}
}
[HarmonyPatch(typeof(TreeLog), "Damage")]
public static class WoodCutting_II
{
private static void Prefix(TreeLog __instance, HitData hit)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Invalid comparison between Unknown and I4
Player localPlayer = Player.m_localPlayer;
if (!((Object)(object)localPlayer == (Object)null) && ((Character)localPlayer).GetZDOID() == hit.m_attacker && (int)hit.m_skill == 13 && hit.m_toolTier >= __instance.m_minToolTier)
{
float value = cfgTreeLogging.Value;
hit.m_damage.m_chop *= 1f + skillFactor * value / 100f;
float value2 = 0.1f + hit.m_damage.m_chop * 0.001f * cfgSkillGainByWorkDamageMultiplier.Value;
Increase(localPlayer, value2);
Log("(TreeLog) Player: " + localPlayer.GetPlayerName() + " hit on: " + ((Object)__instance).name + " used Skill: " + ((object)(SkillType)(ref hit.m_skill)).ToString() + " damage done: " + hit.m_damage.m_chop + " skill gain: " + value2);
}
}
}
[HarmonyPatch(typeof(Terminal), "InputText")]
private static class InputText_Patch
{
private static void Postfix(Terminal __instance)
{
if (((TMP_InputField)__instance.m_input).text.ToLower().Contains("raiseskill vitality") && (Object)(object)Player.m_localPlayer != (Object)null)
{
AttributeOverWriteOnLoad.applyChangedValues(Player.m_localPlayer);
}
}
private static bool Prefix(Terminal __instance)
{
string text = ((TMP_InputField)__instance.m_input).text;
if (text.ToLower().Equals("vitalityrewrite reload"))
{
((BaseUnityPlugin)_instance).Config.Reload();
foreach (Player allPlayer in Player.GetAllPlayers())
{
AttributeOverWriteOnLoad.applyChangedValues(allPlayer);
}
Traverse.Create((object)__instance).Method("AddString", new object[1] { text }).GetValue();
Traverse.Create((object)__instance).Method("AddString", new object[1] { "Vitality rewrite config reloaded" }).GetValue();
return false;
}
if (text.ToLower().Equals("vitalityrewrite apply"))
{
foreach (Player allPlayer2 in Player.GetAllPlayers())
{
AttributeOverWriteOnLoad.applyChangedValues(allPlayer2);
}
Traverse.Create((object)__instance).Method("AddString", new object[1] { text }).GetValue();
Traverse.Create((object)__instance).Method("AddString", new object[1] { "Vitality rewrite config applied" }).GetValue();
return false;
}
return true;
}
}
[HarmonyPatch(typeof(Terminal), "InitTerminal")]
public static class TerminalInitConsole_Patch
{
private static void Postfix()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
new ConsoleCommand("vitalityrewrite", "with keyword 'reload': Reload config of VitalityRewrite. With keyword 'apply': Apply changes done in-game (Configuration Manager)", (ConsoleEventFailable)null, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false);
}
}
public const string PluginId = "VitalityRewrite";
private static VitalityRewrite _instance;
private static ConfigEntry<bool> _loggingEnabled;
private static readonly int skillId = 638;
private static readonly SkillType skill = (SkillType)skillId;
private static ConfigEntry<float> cfgMaxHealth;
private static ConfigEntry<float> cfgHealthRegen;
private static ConfigEntry<float> cfgMaxStamina;
private static ConfigEntry<float> cfgMaxEitr;
private static ConfigEntry<float> cfgStaminaRegen;
private static ConfigEntry<float> cfgEitrRegen;
private static ConfigEntry<float> cfgStaminaDelay;
private static ConfigEntry<float> cfgStaminaJump;
private static ConfigEntry<float> cfgStaminaSwim;
private static ConfigEntry<float> cfgWalkSpeed;
private static ConfigEntry<float> cfgRunSpeed;
private static ConfigEntry<float> cfgSwimSpeed;
private static ConfigEntry<float> cfgCarryWeight;
private static ConfigEntry<float> cfgJumpHeight;
private static ConfigEntry<float> cfgFallDamage;
private static ConfigEntry<bool> cfgDoubleJumpFallDamageReset;
private static ConfigEntry<float> cfgTreeLogging;
private static ConfigEntry<float> cfgPickAxe;
private static ConfigEntry<float> cfgSkillGainMultiplier;
private static ConfigEntry<float> cfgSkillGainByWorkDamageMultiplier;
private static float skillFactor;
private Harmony _harmony;
private void Awake()
{
_instance = this;
_harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "VitalityRewrite");
Init();
}
public void Init()
{
_loggingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Logging", "Logging Enabled", false, "Enable logging.");
cfgMaxHealth = ((BaseUnityPlugin)this).Config.Bind<float>("Health", "MaxIncrease", 125f, "Amount of additional max health at vitality skill 100. Additive to other modification.");
cfgHealthRegen = ((BaseUnityPlugin)this).Config.Bind<float>("Health", "RegenerationIncrease", 100f, "Increase of base health regeneration in percent at vitality skill 100. Implemented by reducing the time between regenerations accordingly. Multiplicative to other modifications.");
cfgMaxStamina = ((BaseUnityPlugin)this).Config.Bind<float>("Stamina", "MaxIncrease", 40f, "Amount of additional max stamina at vitality skill 100. Additive to other modification.");
cfgMaxEitr = ((BaseUnityPlugin)this).Config.Bind<float>("Eitr", "MaxIncrease", 40f, "Amount of additional max Eitr at vitality skill 100. Only active if the food Eitr is above zero. Additive to other modification.");
cfgStaminaRegen = ((BaseUnityPlugin)this).Config.Bind<float>("Stamina", "Regeneration increase", 72f, "Increase of base stamina regeneration in percent at vitality skill 100. Multiplicative to other modifications.");
cfgEitrRegen = ((BaseUnityPlugin)this).Config.Bind<float>("Eitr", "Regeneration increase", 72f, "Increase of base eitr regeneration in percent at vitality skill 100. Multiplicative to other modifications.");
cfgStaminaDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Stamina", "RegenerationDelayReduction", 50f, "Decrease the delay for stamina regeneration to start after usage in percent at vitality skill 100. Be aware that at 100% or higher this means regeneration while using stamina (except swimming). Multiplicative to other modifications.");
cfgStaminaJump = ((BaseUnityPlugin)this).Config.Bind<float>("Stamina", "JumpCostReduction", 25f, "Decrease of stamina cost per jump in percent at vitality skill 100. Values above 100% have no other effects than 100%. Multiplicative to other modifications.");
cfgStaminaSwim = ((BaseUnityPlugin)this).Config.Bind<float>("Stamina", "SwimCostReduction", 33f, "Decrease of stamina cost while swimming in percent at vitality skill 100. Values above 100% means you regenerate stamina while swimming. Don't do that. Multiplicative to other modifications.");
cfgWalkSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Speed", "WalkingBase", 12.5f, "Increase of base walking speed at vitality skill 100. Additive to other modification.");
cfgRunSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Speed", "RunBase", 12.5f, "Increase of base running speed at vitality skill 100. Additive to other modification.");
cfgSwimSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Speed", "SwimBase", 100f, "Increase of base swimming speed and swimming turning speed at vitality skill 100. Additive to other modification.");
cfgCarryWeight = ((BaseUnityPlugin)this).Config.Bind<float>("Various", "Carryweight", 400f, "Amount of additional carry weight at vitality skill 100. Additive to other modification.");
cfgJumpHeight = ((BaseUnityPlugin)this).Config.Bind<float>("Various", "JumpHeight", 10f, "Increase of base jump height in percent at vitality skill 100. Multiplicative to other modifications.");
cfgFallDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Various", "FallDamageReduction", 10f, "Reduces the fall height and thus fall damage in percent at vitality skill 100. Multiplicative to other modifications.");
cfgDoubleJumpFallDamageReset = ((BaseUnityPlugin)this).Config.Bind<bool>("Various", "DoubleJumpFallDamageReset", true, "Set the current fall height to zero whenever a successful jump is performed. No effect without a mod that allows jumping in the air, like EpicLoot Double-/Air-Jump.");
cfgTreeLogging = ((BaseUnityPlugin)this).Config.Bind<float>("Various", "WoodcuttingIncrease", 25f, "Increase chop damage done to trees in percent at vitality skill 100. Multiplicative to other modifications.");
cfgPickAxe = ((BaseUnityPlugin)this).Config.Bind<float>("Various", "MiningIncrease", 25f, "Increase pickaxe damage done to stones and ores in percent at vitality skill 100. Multiplicative to other modifications.");
cfgSkillGainMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("SkillGain", "GeneralMultiplier", 1f, "Multiplier determining how fast skill is gained. Higher values increase skill gain.");
cfgSkillGainByWorkDamageMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("SkillGain", "WorkDamageMultiplier", 1f, "Multiplier determining how fast skill is gained via damage of your tools. Higher values mean increased skill gain in late game. Be aware, that this is multiplicative with 'GeneralMultiplier' for tool damage.");
SkillInjector.RegisterNewSkill(skillId, "Vitality", "Increase base stats", 1f, LoadCustomTexture("heart.png"), (SkillType)0);
}
private void OnDestroy()
{
_instance = null;
Harmony harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
public static void Log(string message)
{
if (_loggingEnabled.Value)
{
((BaseUnityPlugin)_instance).Logger.LogInfo((object)message);
}
}
public static void LogWarning(string message)
{
if (_loggingEnabled.Value)
{
((BaseUnityPlugin)_instance).Logger.LogWarning((object)message);
}
}
public static void LogError(string message)
{
((BaseUnityPlugin)_instance).Logger.LogError((object)message);
}
public static void Increase(Player player, float value)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
((Character)player).RaiseSkill(skill, value * cfgSkillGainMultiplier.Value);
}
private static Sprite LoadCustomTexture(string filename)
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("VitalityRewrite.Resources." + filename);
byte[] array = new byte[manifestResourceStream.Length];
manifestResourceStream.Read(array, 0, (int)manifestResourceStream.Length);
Texture2D val = new Texture2D(2, 2);
ImageConversion.LoadImage(val, array);
val.Apply();
return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0f, 0f), 50f);
}
}
}
namespace VitalityRewrite.Properties
{
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
internal class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
resourceMan = new ResourceManager("VitalityRewrite.Properties.Resources", typeof(Resources).Assembly);
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
internal static Bitmap heart => (Bitmap)ResourceManager.GetObject("heart", resourceCulture);
internal Resources()
{
}
}
}