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 Smith and Saga v0.3.0
plugins/SmithAndSaga.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.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace SmithAndSaga; internal static class Baked { public const string Items = "[ArmorBronzeChest]\narmor = 10\n[ArmorBronzeLegs]\narmor = 10\n[ArmorCarapaceChest]\narmor = 34\n[ArmorCarapaceLegs]\narmor = 34\n[ArmorDeepNorthHeavyChest]\narmor = 46\n[ArmorDeepNorthHeavylegs]\narmor = 46\n[ArmorDress1]\narmorLv = 2\n[ArmorDress10]\narmorLv = 2\n[ArmorDress2]\narmorLv = 2\n[ArmorDress3]\narmorLv = 2\n[ArmorDress4]\narmorLv = 2\n[ArmorDress5]\narmorLv = 2\n[ArmorDress6]\narmorLv = 2\n[ArmorDress7]\narmorLv = 2\n[ArmorDress8]\narmorLv = 2\n[ArmorDress9]\narmorLv = 2\n[ArmorFenringChest]\narmor = 12\n[ArmorFenringLegs]\narmor = 12\n[ArmorFlametalChest]\narmor = 40\n[ArmorFlametalLegs]\narmor = 40\n[ArmorHarvester1]\narmorLv = 2\n[ArmorHarvester2]\narmorLv = 2\n[ArmorIronChest]\narmor = 16\n[ArmorIronLegs]\narmor = 16\n[ArmorLoxChest]\narmor = 18\n[ArmorLoxLegs]\narmor = 18\n[ArmorPaddedCuirass]\narmor = 28\n[ArmorPaddedGreaves]\narmor = 28\n[ArmorRagsChest]\narmorLv = 1\n[ArmorRagsLegs]\narmorLv = 1\n[ArmorRootChest]\narmor = 10\nmovement = -0.02\nres.Fire = 1\n[ArmorRootLegs]\narmor = 10\n[ArmorTunic1]\narmorLv = 2\n[ArmorTunic10]\narmorLv = 2\n[ArmorTunic2]\narmorLv = 2\n[ArmorTunic3]\narmorLv = 2\n[ArmorTunic4]\narmorLv = 2\n[ArmorTunic5]\narmorLv = 2\n[ArmorTunic6]\narmorLv = 2\n[ArmorTunic7]\narmorLv = 2\n[ArmorTunic8]\narmorLv = 2\n[ArmorTunic9]\narmorLv = 2\n[ArmorWolfChest]\narmor = 22\n[ArmorWolfLegs]\narmor = 22\n[ArrowBloodGold]\nattackForce = 60\nweight = 0\n[ArrowBronze]\nattackForce = 55\ndmg.pierce = 35\nweight = 0\n[ArrowCarapace]\nattackForce = 40\ndmg.pierce = 75\nweight = 0\n[ArrowCharred]\nattackForce = 40\ndmg.pierce = 85\nweight = 0\n[ArrowFire]\ndmg.fire = 36\ndmg.pierce = 11\nweight = 0\n[ArrowFlint]\nattackForce = 30\ndmg.pierce = 30\nweight = 0\n[ArrowFrost]\nattackForce = 30\nweight = 0\n[ArrowIron]\nattackForce = 55\ndmg.pierce = 45\nweight = 0\n[ArrowNeedle]\nattackForce = 40\ndmg.pierce = 65\nweight = 0\n[ArrowObsidian]\nattackForce = 45\nweight = 0\n[ArrowPoison]\nattackForce = 30\nweight = 0\n[ArrowSilver]\nattackForce = 50\ndmg.pierce = 26\ndmg.spirit = 56\nweight = 0\n[ArrowWood]\ndmg.pierce = 22\nweight = 0\n[AtgeirBlackmetal]\nattackStamina = 14\nblockPowerLv = 2\ndeflectionLv = 0\ndurability = 180\nparryBonus = 2.5\nsecondaryStamina = 28\n[AtgeirBronze]\nattackStamina = 11\nblockPowerLv = 2\ndeflectionLv = 0\ndurability = 120\nparryBonus = 2.5\nsecondaryStamina = 22\n[AtgeirHimminAfl]\nattackStamina = 15\nblockPowerLv = 2\ndeflectionLv = 0\nparryBonus = 2.5\nsecondaryStamina = 30\n[AtgeirIron]\nattackStamina = 12\nblockPowerLv = 2\ndeflectionLv = 0\ndurability = 180\nparryBonus = 2.5\nsecondaryStamina = 24\n[AxeBerzerkr]\nblockPowerLv = 1\nparryBonus = 2.5\n[AxeBlackMetal]\nattackForce = 40\nattackStamina = 9\nblockPower = 42\nblockPowerLv = 2\ndeflection = 30\ndeflectionLv = 0\ndmg.blunt = 51\ndmg.slash = 51\ndmgLv.blunt = 2.5\ndmgLv.slash = 2.5\ndurability = 180\nmovement = -0.03\nparryBonus = 2.5\nsecondaryStamina = 9\n[AxeBronze]\nattackForce = 40\nattackStamina = 6\nblockPower = 15\nblockPowerLv = 2\ndeflection = 30\ndeflectionLv = 0\ndmg.blunt = 21\ndmg.slash = 21\ndmgLv.blunt = 2.5\ndmgLv.slash = 2.5\ndurability = 120\nmovement = -0.03\nparryBonus = 2.5\nsecondaryStamina = 6\nweight = 1.5\n[AxeEarly]\nblockPower = 6\nblockPowerLv = 2\ndeflectionLv = 0\ndurability = 180\n[AxeFlint]\nattackForce = 40\nattackStamina = 5\nblockPower = 7\nblockPowerLv = 2\ndeflection = 30\ndeflectionLv = 0\ndmg.blunt = 11\ndmg.slash = 11\ndmgLv.blunt = 2.5\ndmgLv.slash = 2.5\nmovement = -0.03\nparryBonus = 2.5\nsecondaryStamina = 5\n[AxeGold]\nattackForce = 40\nattackStamina = 11\nblockPower = 69\nblockPowerLv = 2\ndeflection = 30\ndeflectionLv = 0\ndmg.blunt = 89\ndmg.slash = 89\ndmgLv.blunt = 5\ndmgLv.slash = 5\nmovement = -0.03\nparryBonus = 2.5\nsecondaryStamina = 11\nweight = 2.5\n[AxeGold_BloodLightning]\nattackForce = 40\nattackStamina = 12\nblockPower = 69\nblockPowerLv = 2\ndeflection = 30\ndeflectionLv = 0\ndmg.blunt = 99\ndmg.slash = 99\ndmgLv.blunt = 3\ndmgLv.slash = 3\nmovement = -0.03\nparryBonus = 2.5\nsecondaryStamina = 12\n[AxeGold_FrostFire]\nattackForce = 40\nattackStamina = 12\nblockPower = 69\nblockPowerLv = 2\ndeflection = 30\ndeflectionLv = 0\ndmg.blunt = 73\ndmg.slash = 73\ndmgLv.blunt = 3\ndmgLv.slash = 3\nmovement = -0.03\nparryBonus = 2.5\nsecondaryStamina = 12\n[AxeIron]\nattackForce = 40\nattackStamina = 7\nblockPower = 24\nblockPowerLv = 2\ndeflection = 30\ndeflectionLv = 0\ndmg.blunt = 31\ndmg.slash = 31\ndmgLv.blunt = 2.5\ndmgLv.slash = 2.5\ndurability = 180\nmovement = -0.03\nparryBonus = 2.5\nsecondaryStamina = 7\nweight = 1.5\n[AxeJotunBane]\nattackForce = 40\nattackStamina = 10\nblockPower = 51\nblockPowerLv = 2\ndeflection = 30\ndeflectionLv = 0\ndmg.blunt = 41\ndmg.poison = 58\ndmg.slash = 41\ndmgLv.blunt = 2.5\ndmgLv.poison = 8\ndmgLv.slash = 2.5\nmovement = -0.03\nparryBonus = 2.5\nsecondaryStamina = 10\n[Battleaxe]\nattackForce = 60\nattackStamina = 8\nblockPower = 30\nblockPowerLv = 2\ndeflection = 50\ndeflectionLv = 0\nmovement = -0.1\nparryBonus = 2.5\nsecondaryStamina = 4\nweight = 4\n[BattleaxeBlackmetal]\nattackForce = 60\nattackStamina = 10\nblockPowerLv = 2\ndeflection = 50\ndeflectionLv = 0\nmovement = -0.1\nparryBonus = 2.5\nsecondaryStamina = 5\n[BattleaxeCrystal]\nattackForce = 60\nattackStamina = 9\nblockPowerLv = 2\ndeflection = 30\ndeflectionLv = 0\ndmgLv.spirit = 0.5\nmovement = -0.1\nparryBonus = 2.5\nsecondaryStamina = 5\n[BattleaxeGold]\nattackStamina = 13\nblockPowerLv = 2\ndeflection = 50\ndeflectionLv = 0\nmovement = -0.1\nsecondaryStamina = 7\n[BattleaxeGold_BloodLightning]\nattackForce = 60\nattackStamina = 13\nblockPowerLv = 2\ndeflection = 50\ndeflectionLv = 0\nmovement = -0.1\nparryBonus = 2.5\nsecondaryStamina = 7\n[BattleaxeGold_FrostFire]\nattackForce = 60\nattackStamina = 13\nblockPowerLv = 2\ndeflection = 50\ndeflectionLv = 0\nsecondaryStamina = 7\n[BattleaxeSkullSplittur]\nattackForce = 60\nattackStamina = 11\nblockPowerLv = 2\ndeflection = 50\ndeflectionLv = 0\nmovement = -0.1\nparryBonus = 2.5\nsecondaryStamina = 6\n[BattleaxeWood]\nattackForce = 55\nblockPower = 10\nblockPowerLv = 1\ndeflection = 50\ndeflectionLv = 0\ndmg.chop = 35\ndmg.slash = 30\ndmgLv.chop = 5\ndmgLv.slash = 6\nmovement = -0.1\nparryBonus = 2.5\nweight = 3\n[BowAshlands]\ndrawStamina = 10\nsecondaryStamina = 20\n[BowAshlandsBlood]\ndrawStamina = 10\nsecondaryStamina = 20\n[BowAshlandsRoot]\ndrawStamina = 10\nsecondaryStamina = 20\n[BowAshlandsStorm]\ndrawStamina = 10\nsecondaryStamina = 20\n[BowDraugrFang]\ndrawStamina = 7\nsecondaryStamina = 14\n[BowFineWood]\ndrawStamina = 5\nsecondaryStamina = 10\n[BowGold]\nattackForce = 30\ndrawStamina = 11\nsecondaryStamina = 22\n[BowGold_BloodLightning]\ndrawStamina = 11\nsecondaryStamina = 22\n[BowGold_FrostFire]\ndrawStamina = 11\nsecondaryStamina = 22\n[BowHuntsman]\ndrawStamina = 6\nsecondaryStamina = 12\n[BowSpineSnap]\ndrawStamina = 9\nsecondaryStamina = 18\n[CapeDeerHide]\nstaminaMod.home = -0.15\nstaminaMod.swim = -0.2\n[CapeFeather]\narmor = 10\n[CapeLinen]\narmor = 10\nres.Frost = 1\nstaminaMod.block = -0.1\nstaminaMod.dodge = -0.1\nstaminaMod.run = 0\nweight = 0.5\n[CapeLox]\narmor = 10\nstaminaMod.attack = -0.05\nwetproof = 1\n[CapeTrollHide]\narmor = 4\nstaminaMod.sneak = -0.5\n[CapeWolf]\narmor = 7\nstaminaMod.jump = -0.1\nstaminaMod.run = -0.1\nweight = 1\n[Club]\nblockPower = 6\nblockPowerLv = 2\ndeflectionLv = 0\ndmg.blunt = 15\nparryBonus = 2.5\nweight = 1.5\n[CrossbowArbalest]\nbackstab = 6\n[CrossbowGold]\nbackstab = 6\n[CrossbowRipper]\nbackstab = 6\n[CrossbowRipperBlood]\nbackstab = 6\n[CrossbowRipperLightning]\nbackstab = 6\n[CrossbowRipperNature]\nbackstab = 6\n[FistBjornClaw]\nblockPowerLv = 2\ndeflectionLv = 0\n[FistBjornUndeadClaw]\nattackStamina = 10\nblockPower = 20\ndeflectionLv = 0\ndmg.pierce = 20\ndmg.slash = 60\nsecondaryStamina = 20\n[FistFenrirClaw]\nattackStamina = 9\nblockPower = 10\nsecondaryStamina = 18\n[FistGold]\nattackStamina = 13\nblockPower = 36\nblockPowerLv = 2\ndeflectionLv = 0\n[HelmetBronze]\narmor = 10\n[HelmetCarapace]\narmor = 34\n[HelmetCelebration]\nres.Frost = 1\n[HelmetDNHeavy]\narmor = 46\n[HelmetDrake]\narmor = 22\n[HelmetDverger]\narmor = 10\narmorLv = 2\nuseDurability = 1\nwetproof = 1\n[HelmetFenring]\narmor = 12\n[HelmetFlametal]\narmor = 40\n[HelmetIron]\narmor = 16\n[HelmetLox]\narmor = 18\n[HelmetMidsummerCrown]\narmorLv = 2\nres.Frost = 1\nuseDurability = 1\n[HelmetPadded]\narmor = 28\n[HelmetPointyHat]\narmor = 0\narmorLv = 2\nres.Frost = 1\nwetproof = 1\n[HelmetRoot]\narmor = 10\n[HelmetSweatBand]\narmorLv = 2\nstaminaMod.block = -0.1\nstaminaMod.dodge = -0.1\nstaminaMod.jump = -0.1\nstaminaMod.run = -0.1\nstaminaMod.sneak = -0.1\nstaminaMod.swim = -0.1\nwetproof = 1\n[HelmetYule]\narmorLv = 2\nres.Frost = 1\n[KnifeBlackMetal]\nattackStamina = 7\nblockPower = 22\nblockPowerLv = 1\ndeflectionLv = 0\nsecondaryStamina = 21\nweight = 1\n[KnifeChitin]\nattackStamina = 5\nblockPower = 12\nblockPowerLv = 1\ndeflectionLv = 0\nsecondaryStamina = 15\nweight = 1\n[KnifeCopper]\nattackStamina = 4\nblockPower = 7\nblockPowerLv = 1\ndeflectionLv = 0\nsecondaryStamina = 12\nweight = 1\n[KnifeFlint]\nattackStamina = 3\nblockPower = 2\nblockPowerLv = 1\ndeflectionLv = 0\nsecondaryStamina = 9\nweight = 1\n[KnifeGold]\nattackStamina = 10\nblockPower = 39\nblockPowerLv = 2\ndeflectionLv = 0\nsecondaryStamina = 30\nweight = 1\n[KnifeSilver]\nattackStamina = 6\nblockPower = 17\nblockPowerLv = 1\ndeflectionLv = 0\ndmgLv.spirit = 0.5\nsecondaryStamina = 18\nweight = 1\n[KnifeSkollAndHati]\nattackStamina = 12\nblockPowerLv = 2\ndeflectionLv = 0\nsecondaryStamina = 36\nweight = 2\n[KnifeWood]\nweight = 0.5\n[MaceBronze]\nattackForce = 55\nattackStamina = 6\nblockPower = 17\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\nparryBonus = 2.5\nsecondaryStamina = 3\nweight = 3\n[MaceEldner]\nattackForce = 55\nattackStamina = 11\nblockPower = 62\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\nparryBonus = 2.5\nsecondaryStamina = 6\nweight = 4\n[MaceEldnerBlood]\nattackForce = 55\nattackStamina = 11\nblockPower = 62\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\nparryBonus = 2.5\nsecondaryStamina = 6\nweight = 4\n[MaceEldnerLightning]\nattackForce = 55\nattackStamina = 11\nblockPower = 62\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\ndmgLv.lightning = 5\nparryBonus = 2.5\nsecondaryStamina = 6\nweight = 4\n[MaceEldnerNature]\nattackForce = 55\nattackStamina = 11\nblockPower = 62\nblockPowerLv = 2\ndeflection = 40\ndmgLv.poison = 5\nsecondaryStamina = 6\nweight = 4\n[MaceGold]\nattackForce = 55\nattackStamina = 12\nblockPower = 71\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\nparryBonus = 2.5\nsecondaryStamina = 6\nweight = 4.5\n[MaceGold_BloodLightning]\nattackForce = 55\nattackStamina = 12\nblockPower = 71\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\ndmgLv.blunt = 6\nparryBonus = 2.5\nsecondaryStamina = 6\nweight = 4.5\n[MaceGold_FrostFire]\nattackForce = 55\nattackStamina = 12\nblockPower = 71\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\ndmgLv.blunt = 6\nparryBonus = 2.5\nsecondaryStamina = 6\nweight = 4.5\n[MaceIron]\nattackForce = 55\nattackStamina = 7\nblockPower = 26\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\nparryBonus = 2.5\nsecondaryStamina = 4\nweight = 3\n[MaceNeedle]\nattackForce = 55\nattackStamina = 9\nblockPower = 44\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\ndmgLv.blunt = 6\ndmgLv.pierce = 2\ndmgLv.poison = 3\nparryBonus = 2.5\nsecondaryStamina = 5\nweight = 3.5\n[MaceSilver]\nattackForce = 55\nattackStamina = 8\nblockPower = 35\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\ndmgLv.blunt = 3\ndmgLv.frost = 3\ndmgLv.spirit = 1\nparryBonus = 2.5\nsecondaryStamina = 4\nweight = 3.5\n[MaceWood]\nattackForce = 55\nattackStamina = 4\nblockPower = 8\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\ndmg.blunt = 15\ndmgLv.blunt = 6\nparryBonus = 2.5\nsecondaryStamina = 2\n[PickaxeAntler]\nattackForce = 70\nblockPower = 4\nblockPowerLv = 2\ndeflectionLv = 0\ndmg.blunt = 11\ndmg.pickaxe = 22\ndmg.pierce = 11\ndmgLv.blunt = 2\ndmgLv.pickaxe = 6\ndmgLv.pierce = 4\nparryBonus = 2.5\n[PickaxeBlackMetal]\nattackForce = 70\nattackStamina = 10\nblockPower = 31\nblockPowerLv = 2\ndeflectionLv = 0\ndmg.blunt = 51\ndmg.pierce = 51\ndmgLv.blunt = 2\ndmgLv.pickaxe = 6\ndmgLv.pierce = 4\nparryBonus = 2.5\n[PickaxeBronze]\nattackForce = 70\nblockPower = 13\nblockPowerLv = 2\ndeflectionLv = 0\ndmg.blunt = 21\ndmg.pierce = 21\ndmgLv.blunt = 2\ndmgLv.chop = 0\ndmgLv.pickaxe = 6\ndmgLv.pierce = 4\ndurability = 150\nparryBonus = 2.5\n[PickaxeIron]\nattackForce = 70\nattackStamina = 9\nblockPower = 22\nblockPowerLv = 2\ndeflectionLv = 0\ndmg.blunt = 31\ndmg.pierce = 31\ndmgLv.blunt = 2\ndmgLv.pickaxe = 6\ndmgLv.pierce = 4\nparryBonus = 2.5\n[ShieldBanded]\ndeflectionLv = 0\n[ShieldBlackmetal]\ndeflectionLv = 0\n[ShieldBlackmetalTower]\nblockPower = 117\nblockPowerLv = 9\n[ShieldBoneTower]\nblockPower = 37\nblockPowerLv = 9\n[ShieldBronzeBuckler]\nblockPower = 16\nblockPowerLv = 6\nmovement = 0\n[ShieldCarapaceBuckler]\nmovement = 0\n[ShieldFlametalTower]\nblockPower = 157\nblockPowerLv = 9\n[ShieldIronBuckler]\nmovement = 0\n[ShieldIronTower]\nblockPower = 57\nblockPowerLv = 9\n[ShieldRoots]\nblockPower = 53\nblockPowerLv = 7\ndeflectionLv = 0\n[ShieldSerpentscale]\nblockPower = 77\nblockPowerLv = 9\n[ShieldWoodTower]\nblockPower = 17\nblockPowerLv = 9\n[SledgeDemolisher]\nblockPowerLv = 1\ndeflectionLv = 0\nmovement = -0.1\nparryBonus = 2.5\n[SledgeGold]\nblockPowerLv = 2\ndeflectionLv = 0\nmovement = -0.1\nparryBonus = 2.5\n[SledgeIron]\nblockPowerLv = 2\ndeflectionLv = 0\nmovement = -0.1\nparryBonus = 2.5\n[SledgeStagbreaker]\nblockPowerLv = 2\ndeflectionLv = 0\ndmgLv.pierce = 0.5\nparryBonus = 2.5\n[Snowball]\nweight = 0.5\n[SpearBronze]\nattackStamina = 5\nbackstab = 6\nblockPower = 14\nblockPowerLv = 2\ndeflection = 60\ndeflectionLv = 0\nmovement = -0.03\nsecondaryStamina = 5\n[SpearCarapace]\nattackStamina = 9\nbackstab = 6\nblockPower = 50\nblockPowerLv = 2\ndeflection = 60\ndeflectionLv = 0\nmovement = -0.03\nsecondaryStamina = 9\n[SpearChitin]\nblockPower = 23\nblockPowerLv = 2\ndeflection = 60\ndeflectionLv = 0\ndmg.pierce = 1\ndmgLv.pierce = 6\ndurability = 150\nmovement = -0.03\n[SpearElderbark]\nattackStamina = 6\nbackstab = 6\nblockPower = 23\nblockPowerLv = 2\ndeflection = 60\ndeflectionLv = 0\nmovement = -0.03\nsecondaryStamina = 6\n[SpearFlint]\nattackStamina = 4\nbackstab = 6\nblockPower = 6\nblockPowerLv = 2\ndeflection = 60\ndeflectionLv = 0\ndmg.pierce = 15\nmovement = -0.03\nsecondaryStamina = 4\n[SpearGold]\nattackStamina = 11\nbackstab = 6\nblockPower = 68\nblockPowerLv = 2\ndeflection = 60\ndeflectionLv = 0\nmovement = -0.03\nsecondaryStamina = 11\n[SpearGold_BloodLightning]\nattackStamina = 11\nbackstab = 6\nblockPower = 68\nblockPowerLv = 2\ndeflection = 60\ndeflectionLv = 0\ndmgLv.pierce = 6\nmovement = -0.03\nsecondaryStamina = 11\n[SpearGold_FrostFire]\nattackStamina = 11\nbackstab = 6\nblockPower = 68\nblockPowerLv = 2\ndeflection = 60\ndeflectionLv = 0\ndmgLv.pierce = 6\nmovement = -0.03\nsecondaryStamina = 11\n[SpearSplitner]\nattackStamina = 10\nbackstab = 6\nblockPower = 59\nblockPowerLv = 2\ndeflection = 60\ndeflectionLv = 0\nmovement = -0.03\nsecondaryStamina = 10\n[SpearSplitner_Blood]\nattackStamina = 10\nbackstab = 6\nblockPower = 59\nblockPowerLv = 2\ndeflection = 60\nmovement = -0.03\nsecondaryStamina = 10\n[SpearSplitner_Lightning]\nattackStamina = 10\nbackstab = 6\nblockPower = 59\nblockPowerLv = 2\ndeflection = 60\ndeflectionLv = 0\ndmgLv.lightning = 5\nmovement = -0.03\nsecondaryStamina = 10\n[SpearSplitner_Nature]\nattackStamina = 10\nbackstab = 6\nblockPower = 59\nblockPowerLv = 2\ndeflection = 60\ndeflectionLv = 2.5\ndmgLv.poison = 5\nmovement = -0.03\nsecondaryStamina = 10\n[SpearWolfFang]\nattackStamina = 7\nbackstab = 6\nblockPower = 32\nblockPowerLv = 2\ndeflection = 60\ndeflectionLv = 0\nmovement = -0.03\nsecondaryStamina = 7\n[SwordBlackmetal]\nattackStamina = 11\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\nsecondaryStamina = 22\nweight = 3.5\n[SwordBronze]\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\nparryBonus = 2\nweight = 2\n[SwordDyrnwyn]\nattackStamina = 14\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\ndmg.fire = 20\ndmg.slash = 140\ndmgLv.fire = 6\ndmgLv.slash = 3\nmovement = 0\nparryBonus = 2.5\nweight = 2\n[SwordGold]\nattackStamina = 14\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\nweight = 4\n[SwordGold_BloodLightning]\nattackStamina = 14\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\ndmgLv.slash = 6\nweight = 4\n[SwordGold_FrostFire]\nattackStamina = 14\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\ndmgLv.slash = 6\nweight = 4\n[SwordIron]\nattackStamina = 9\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\nsecondaryStamina = 18\nweight = 2\n[SwordMistwalker]\nattackStamina = 12\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\ndmgLv.frost = 4\ndmgLv.slash = 3\ndmgLv.spirit = 4\nsecondaryStamina = 24\nweight = 2\n[SwordNiedhogg]\nattackStamina = 13\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\nsecondaryStamina = 26\nweight = 3.5\n[SwordNiedhoggBlood]\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\nweight = 3.5\n[SwordNiedhoggLightning]\nattackStamina = 14\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\ndmgLv.lightning = 5\nweight = 3.5\n[SwordNiedhoggNature]\nattackStamina = 14\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\ndmgLv.poison = 5\nweight = 3.5\n[SwordSilver]\nattackStamina = 10\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\nsecondaryStamina = 20\nweight = 3\n[SwordWood]\nblockPower = 3\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\ndmg.slash = 15\ndmgLv.slash = 6\nsecondaryStamina = 8\nweight = 1.5\n[THSwordGold]\nattackStamina = 16\nblockPowerLv = 2\ndeflectionLv = 0\nparryBonus = 2.5\nsecondaryStamina = 32\n[THSwordKrom]\nattackForce = 50\nblockPowerLv = 1\ndeflectionLv = 0\nparryBonus = 2.5\n[THSwordSlayer]\nattackForce = 50\nblockPowerLv = 1\ndeflectionLv = 0\nparryBonus = 2.5\n[THSwordWood]\nattackForce = 50\nblockPowerLv = 1\ndeflectionLv = 0\ndmg.slash = 29\ndmgLv.slash = 4.5\nparryBonus = 2.5\n[TrinketBronzeStamina]\narmor = 20\nwetproof = 1\n"; public const string Motion = "Axes.primary.finisher = 1\nAxes.secondary.damage = 2\nAxes.secondary.force = 1\nAxes.secondary.stagger = 2\nAxes2H.primary.finisher = 2.5\nAxes2H.secondary.stagger = 6\nBows.secondary.damage = 0.5\nClubs.primary.finisher = 2.5\nClubs.primary.stagger = 1.1\nClubs.secondary.damage = 3\nClubs.secondary.force = 3\nClubs.secondary.stagger = 3\nKnives.primary.finisher = 2\nKnives.secondary.force = 1\nPickaxes.primary.stagger = 2\nPickaxes.secondary.damage = 2\nSpears.secondary.stagger = 1.5\nUnarmed.primary.finisher = 2.5\n"; public static readonly string[][] Settings = new string[67][] { new string[3] { "AnimationSpeed", "Swords", "1" }, new string[3] { "AnimationSpeed", "Knives", "1" }, new string[3] { "AnimationSpeed", "Clubs", "1" }, new string[3] { "AnimationSpeed", "Polearms", "1.05" }, new string[3] { "AnimationSpeed", "Spears", "1" }, new string[3] { "AnimationSpeed", "Axes", "1.15" }, new string[3] { "AnimationSpeed", "Bows", "1.2" }, new string[3] { "AnimationSpeed", "Crossbows", "1" }, new string[3] { "AnimationSpeed", "ElementalMagic", "1" }, new string[3] { "AnimationSpeed", "BloodMagic", "1" }, new string[3] { "AnimationSpeed", "Unarmed", "1.05" }, new string[3] { "AnimationSpeed", "Pickaxes", "1.1" }, new string[3] { "AnimationSpeed", "Swords (two-handed)", "1" }, new string[3] { "AnimationSpeed", "Axes (two-handed)", "1.2" }, new string[3] { "AnimationSpeed", "Clubs (two-handed)", "1.2" }, new string[3] { "AnimationSpeed (secondary)", "Swords", "1.1" }, new string[3] { "AnimationSpeed (secondary)", "Knives", "1" }, new string[3] { "AnimationSpeed (secondary)", "Clubs", "1.2" }, new string[3] { "AnimationSpeed (secondary)", "Polearms", "1" }, new string[3] { "AnimationSpeed (secondary)", "Spears", "1" }, new string[3] { "AnimationSpeed (secondary)", "Axes", "1.15" }, new string[3] { "AnimationSpeed (secondary)", "Bows", "1" }, new string[3] { "AnimationSpeed (secondary)", "Crossbows", "1" }, new string[3] { "AnimationSpeed (secondary)", "ElementalMagic", "1" }, new string[3] { "AnimationSpeed (secondary)", "BloodMagic", "1" }, new string[3] { "AnimationSpeed (secondary)", "Unarmed", "1" }, new string[3] { "AnimationSpeed (secondary)", "Pickaxes", "1" }, new string[3] { "AnimationSpeed (secondary)", "Swords (two-handed)", "1.1" }, new string[3] { "AnimationSpeed (secondary)", "Axes (two-handed)", "1" }, new string[3] { "AnimationSpeed (secondary)", "Clubs (two-handed)", "1" }, new string[3] { "Combat", "Skill speed cap", "60" }, new string[3] { "Combat", "Pickaxe secondary", "true" }, new string[3] { "Combat", "Pickaxe secondary source", "AtgeirIron" }, new string[3] { "Combat", "Sledge secondary", "true" }, new string[3] { "Combat", "Sledge secondary source", "Battleaxe" }, new string[3] { "Combat", "Bow secondary", "true" }, new string[3] { "Combat", "Bow secondary source", "PlayerUnarmed" }, new string[3] { "Equipment", "Enable stat edits", "true" }, new string[3] { "Equipment", "Enable animation speed", "true" }, new string[3] { "Recipes", "Wooden weapons", "true" }, new string[3] { "Recipes", "Wooden weapon items", "AxeWood,SwordWood,KnifeWood,BattleaxeWood,AtgeirWood,MaceWood,SledgeWood,SpearWood,THSwordWood" }, new string[3] { "Recipes", "Unlocked max quality", "4" }, new string[3] { "Recipes", "Upgrade unlock", "true" }, new string[3] { "Recipes", "Trader helmets", "true" }, new string[3] { "Recipes", "Upgrade unlock items", "SpearChitin,PickaxeAntler,HelmetMidsummerCrown,HelmetPointyHat,HelmetYule" }, new string[3] { "Recipes", "Seasonal items", "HelmetMidsummerCrown,HelmetPointyHat,HelmetYule" }, new string[3] { "Set bonus", "Warrior set", "true" }, new string[3] { "Set bonus", "Warrior damage reduction", "0.125" }, new string[3] { "Set bonus", "Warrior knockback", "0.5" }, new string[3] { "Set bonus", "Warrior block skill", "20" }, new string[3] { "Set bonus", "Nimble set", "true" }, new string[3] { "Set bonus", "Nimble run skill", "10" }, new string[3] { "Set bonus", "Nimble dodge skill", "10" }, new string[3] { "Set bonus", "Series sets", "true" }, new string[3] { "Set bonus", "Flametal helmet heat resistance", "true" }, new string[3] { "Set bonus", "Home set", "true" }, new string[3] { "Set bonus", "Home set stamina", "-0.5" }, new string[3] { "Skills", "XP multiplier", "1.3" }, new string[3] { "Skills", "No skill loss on death", "true" }, new string[3] { "Upgrades", "Max item level", "100" }, new string[3] { "Upgrades", "Forge level lock", "7" }, new string[3] { "Upgrades", "Workbench level lock", "5" }, new string[3] { "Upgrades", "Other table level lock", "0" }, new string[3] { "Upgrades", "Resource per level reduce", "1" }, new string[3] { "Upgrades", "Stats per level increase", "1" }, new string[3] { "Upgrades", "Fixed upgrade cost", "0" }, new string[3] { "Upgrades", "Upgrade station level", "1" } }; } internal static class CheatToggle { [HarmonyPatch(typeof(InventoryGui), "OnOpenAchievements")] private static class AchievementsOpen { private static void Postfix(InventoryGui __instance) { try { Ensure(__instance.m_achievementsPanel); Refresh(); } catch (Exception ex) { SnS.Log.LogWarning((object)("Cheat toggle: " + ex)); } } } private const float Box = 28f; private static GameObject root; private static Image check; private static TMP_Text label; private static void Ensure(AchievementsGui gui) { //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00e4: 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_00ec: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_052f: Expected O, but got Unknown //IL_0544: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Expected O, but got Unknown //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Expected O, but got Unknown //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Expected O, but got Unknown //IL_0302: 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_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Expected O, but got Unknown if ((Object)(object)root != (Object)null || (Object)(object)gui == (Object)null) { return; } Transform val = ((Component)gui).transform.Find("AchFrame"); Transform obj = ((!((Object)(object)val != (Object)null)) ? ((Component)gui).transform : val); RectTransform val2 = (RectTransform)(object)((obj is RectTransform) ? obj : null); RectTransform val3 = (RectTransform)((!((Object)(object)val != (Object)null)) ? null : /*isinst with value type is only supported in some contexts*/); if ((Object)(object)val3 != (Object)null) { val3.anchoredPosition += new Vector2(0f, 16f); } root = new GameObject("SmithAndSaga_CheatToggle", new Type[1] { typeof(RectTransform) }); root.transform.SetParent((Transform)(object)val2, false); RectTransform component = root.GetComponent<RectTransform>(); Vector2 anchorMin = (component.anchorMax = new Vector2(1f, 0f)); component.anchorMin = anchorMin; component.pivot = new Vector2(1f, 0f); component.sizeDelta = new Vector2(320f, 28f); component.anchoredPosition = new Vector2(-34f, 14f); Button val5 = SkillUi.Template(); GameObject val6; if ((Object)(object)val5 != (Object)null) { val6 = Object.Instantiate<GameObject>(((Component)val5).gameObject, root.transform); } else { val6 = new GameObject("box", new Type[3] { typeof(RectTransform), typeof(Image), typeof(Button) }); val6.transform.SetParent(root.transform, false); } ((Object)val6).name = "Box"; SkillUi.Strip(val6); TMP_Text[] componentsInChildren = val6.GetComponentsInChildren<TMP_Text>(true); foreach (TMP_Text val7 in componentsInChildren) { val7.text = string.Empty; } Button component2 = val6.GetComponent<Button>(); component2.onClick = new ButtonClickedEvent(); ((UnityEvent)component2.onClick).AddListener(new UnityAction(Toggle)); ((Selectable)component2).interactable = true; RectTransform component3 = val6.GetComponent<RectTransform>(); anchorMin = (component3.anchorMax = new Vector2(1f, 0.5f)); component3.anchorMin = anchorMin; component3.pivot = new Vector2(1f, 0.5f); component3.sizeDelta = new Vector2(28f, 28f); component3.anchoredPosition = Vector2.zero; GameObject val9 = new GameObject("Check", new Type[2] { typeof(RectTransform), typeof(Image) }); val9.transform.SetParent(val6.transform, false); RectTransform component4 = val9.GetComponent<RectTransform>(); anchorMin = (component4.anchorMax = new Vector2(0.5f, 0.5f)); component4.anchorMin = anchorMin; component4.sizeDelta = new Vector2(22.4f, 22.4f); check = val9.GetComponent<Image>(); check.sprite = SortIcons.Check(); check.preserveAspect = true; ((Graphic)check).raycastTarget = false; TMP_Text val11 = null; try { val11 = Traverse.Create((object)InventoryGui.instance).Field("m_achievementsCheatedText").GetValue<TMP_Text>(); } catch { } if ((Object)(object)val11 == (Object)null && (Object)(object)InventoryGui.instance != (Object)null) { val11 = ((Component)InventoryGui.instance).GetComponentInChildren<TMP_Text>(true); } if ((Object)(object)val11 != (Object)null) { GameObject val12 = Object.Instantiate<GameObject>(((Component)val11).gameObject, root.transform); ((Object)val12).name = "Label"; val12.SetActive(true); SkillUi.Strip(val12); foreach (Transform item in val12.transform) { Transform val13 = item; Object.Destroy((Object)(object)((Component)val13).gameObject); } label = val12.GetComponent<TMP_Text>(); RectTransform rectTransform = label.rectTransform; anchorMin = (rectTransform.anchorMax = new Vector2(1f, 0.5f)); rectTransform.anchorMin = anchorMin; rectTransform.pivot = new Vector2(1f, 0.5f); rectTransform.sizeDelta = new Vector2(280f, 28f); rectTransform.anchoredPosition = new Vector2(-36f, 0f); label.alignment = (TextAlignmentOptions)4100; label.textWrappingMode = (TextWrappingModes)0; label.enableAutoSizing = false; label.fontSize = 18f; ((Graphic)label).raycastTarget = true; Button val15 = val12.GetComponent<Button>() ?? val12.AddComponent<Button>(); ((Selectable)val15).transition = (Transition)0; val15.onClick = new ButtonClickedEvent(); ((UnityEvent)val15.onClick).AddListener(new UnityAction(Toggle)); } root.transform.SetAsLastSibling(); } private static void Toggle() { SnS.RemoveCheatedFlag.Value = !SnS.RemoveCheatedFlag.Value; if (SnS.RemoveCheatedFlag.Value && (Object)(object)Player.m_localPlayer != (Object)null) { Upgrades.ClearCheated(((Humanoid)Player.m_localPlayer).GetInventory()); } Refresh(); } private static void Refresh() { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) bool value = SnS.RemoveCheatedFlag.Value; if ((Object)(object)check != (Object)null) { ((Behaviour)check).enabled = value; } if ((Object)(object)label != (Object)null) { bool flag = false; try { flag = Localization.instance != null && Localization.instance.GetSelectedLanguage() == "Japanese"; } catch { } label.text = ((!flag) ? "Remove cheat flag" : "チート判定を消す"); ((Graphic)label).color = ((!value) ? new Color(0.75f, 0.75f, 0.75f, 1f) : new Color(1f, 0.86f, 0.5f, 1f)); } } } internal static class Combat { internal class SwapRule { public string Name; public Func<GameObject, SharedData, bool> Match; public Func<ConfigEntry<bool>> Enabled; public Func<string> Source; public string[] Fallbacks; public DamageType DamageType; public bool SourceEffects; public bool NoAmmo; public string Animation; public SharedData SourceShared; public readonly HashSet<string> Prefabs = new HashSet<string>(StringComparer.OrdinalIgnoreCase); } public static readonly List<SwapRule> Rules = new List<SwapRule> { new SwapRule { Name = "pickaxe", Match = (GameObject go, SharedData s) => (int)s.m_skillType == 12 && Stats.IsWeapon(s), Enabled = () => SnS.SwapPickaxes, Source = () => SnS.PickaxeSecondarySource.Value, Fallbacks = new string[2] { "AtgeirIron", "AtgeirBronze" }, DamageType = (DamageType)1, SourceEffects = false }, new SwapRule { Name = "sledge", Match = (GameObject go, SharedData s) => Stats.IsWeapon(s) && ((Object)go).name.StartsWith("Sledge", StringComparison.OrdinalIgnoreCase), Enabled = () => SnS.SwapSledges, Source = () => SnS.SledgeSecondarySource.Value, Fallbacks = new string[2] { "Battleaxe", "BattleaxeBlackmetal" }, DamageType = (DamageType)1, SourceEffects = true }, new SwapRule { Name = "bow", Match = (GameObject go, SharedData s) => (int)s.m_itemType == 4 && (int)s.m_skillType == 8, Enabled = () => SnS.SwapBows, Source = () => SnS.BowSecondarySource.Value, Fallbacks = new string[1] { "PlayerUnarmed" }, DamageType = (DamageType)4, SourceEffects = true, NoAmmo = true } }; private static readonly Dictionary<string, Attack> originalSecondary = new Dictionary<string, Attack>(); private static readonly Dictionary<string, Attack> appliedSecondary = new Dictionary<string, Attack>(); private static bool swapReported; public static float SkillProgress(Character c, SkillType skill) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) Player val = (Player)(object)((c is Player) ? c : null); if ((Object)(object)val == (Object)null || (Object)(object)((Character)val).GetSkills() == (Object)null) { return 1f; } float num = Mathf.Max(1f, SnS.SkillSpeedCap.Value); return Mathf.Clamp01(((Character)val).GetSkills().GetSkillLevel(skill) / num); } public static float SpeedAt(float edited, float progress) { return 1f + (Mathf.Clamp(edited, 0.25f, 3f) - 1f) * Mathf.Clamp01(progress); } public static bool IsTwoHanded(SharedData s) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 return s != null && ((int)s.m_itemType == 14 || (int)s.m_itemType == 22); } public static ConfigEntry<float> SpeedEntry(SkillType skill, bool twoHanded, bool secondary) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (twoHanded && ((!secondary) ? SnS.AnimSpeed2H : SnS.AnimSpeedSecondary2H).TryGetValue(skill, out var value)) { return value; } return (!((!secondary) ? SnS.AnimSpeed : SnS.AnimSpeedSecondary).TryGetValue(skill, out value)) ? null : value; } public static SkillType WeaponSkill(Character c) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) Humanoid val = (Humanoid)(object)((c is Humanoid) ? c : null); ItemData val2 = ((!((Object)(object)val != (Object)null)) ? null : val.GetCurrentWeapon()); return (SkillType)((val2 == null || val2.m_shared == null) ? 11 : ((int)val2.m_shared.m_skillType)); } public static string PrefabName(ItemData w) { return (w == null || !((Object)(object)w.m_dropPrefab != (Object)null)) ? null : ((Object)w.m_dropPrefab).name; } public static SwapRule RuleFor(ItemData w, Attack atk) { string text = PrefabName(w); if (text == null || atk == null) { return null; } foreach (SwapRule rule in Rules) { if (rule.Prefabs.Contains(text) && rule.Animation != null && atk.m_attackAnimation == rule.Animation) { return rule; } } return null; } public static void ApplySecondarySwaps(ObjectDB db) { //IL_01b6: Unknown result type (might be due to invalid IL or missing references) List<string> list = new List<string>(); foreach (SwapRule rule in Rules) { rule.Prefabs.Clear(); GameObject itemPrefab = db.GetItemPrefab(rule.Source()); string[] fallbacks = rule.Fallbacks; foreach (string text in fallbacks) { if ((Object)(object)itemPrefab == (Object)null) { itemPrefab = db.GetItemPrefab(text); } } ItemDrop val = ((!((Object)(object)itemPrefab != (Object)null)) ? null : itemPrefab.GetComponent<ItemDrop>()); Attack val2 = ((!((Object)(object)val != (Object)null)) ? null : val.m_itemData.m_shared.m_secondaryAttack); rule.Animation = val2?.m_attackAnimation; rule.SourceShared = ((!((Object)(object)val != (Object)null)) ? null : val.m_itemData.m_shared); list.Add(string.Concat(" [", rule.Name, "] source ", (!((Object)(object)itemPrefab != (Object)null)) ? ("NOT FOUND (" + rule.Source() + ")") : ((Object)itemPrefab).name, (val2 == null) ? string.Empty : (": animation '" + val2.m_attackAnimation + "', damage x" + val2.m_damageMultiplier + ", stamina " + val2.m_attackStamina), ", damage type ", rule.DamageType, ", effects from ", (!rule.SourceEffects) ? "weapon" : "source")); foreach (GameObject item in db.m_items) { if ((Object)(object)item == (Object)null) { continue; } ItemDrop component = item.GetComponent<ItemDrop>(); if ((Object)(object)component == (Object)null || component.m_itemData == null || component.m_itemData.m_shared == null) { continue; } SharedData shared = component.m_itemData.m_shared; if (!rule.Match(item, shared)) { continue; } if (!originalSecondary.ContainsKey(((Object)item).name)) { originalSecondary[((Object)item).name] = shared.m_secondaryAttack; } Attack val3 = originalSecondary[((Object)item).name]; bool flag = val2 != null && rule.Enabled().Value; if (flag) { if (!appliedSecondary.TryGetValue(((Object)item).name, out var value) || shared.m_secondaryAttack != value) { value = val2.Clone(); appliedSecondary[((Object)item).name] = value; shared.m_secondaryAttack = value; } rule.Prefabs.Add(((Object)item).name); } else { shared.m_secondaryAttack = val3; } list.Add(" " + ((Object)item).name + ": " + ((!flag) ? "vanilla" : "swapped") + " (vanilla secondary: " + ((val3 == null || string.IsNullOrEmpty(val3.m_attackAnimation)) ? "none" : ("'" + val3.m_attackAnimation + "'")) + ")"); } } if (!swapReported) { swapReported = true; SnS.Log.LogInfo((object)("Secondary attack swaps:\n" + string.Join("\n", list.ToArray()))); } } } internal static class SwapRuntime { internal class State { public SharedData Shared; public DamageTypes Dmg; public DamageTypes DmgLv; public bool Effects; public EffectList Hit; public EffectList HitTerrain; public EffectList Trigger; public EffectList Start; public EffectList Trail; public string Ammo; public bool Damage; public GameObject SpawnTerrain; } [HarmonyPatch(typeof(Player), "PlayerAttackInput")] private static class BowSecondaryInput { private static void Postfix(Player __instance) { if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer || !SnS.SwapBows.Value) { return; } ItemData currentWeapon = ((Humanoid)__instance).GetCurrentWeapon(); if (currentWeapon != null && currentWeapon.m_shared != null && currentWeapon.m_shared.m_attack.m_bowDraw && currentWeapon.HaveSecondaryAttack() && !(bool)fAttackHold.GetValue(__instance) && ((bool)fSecAttack.GetValue(__instance) || (bool)fSecHold.GetValue(__instance)) && !((Character)__instance).InAttack()) { bool flag = (bool)mStartAttack.Invoke(__instance, new object[2] { null, true }); if (!bowInputLogged) { bowInputLogged = true; SnS.Log.LogInfo((object)("Bow secondary input: StartAttack -> " + flag)); } } } } [HarmonyPatch(typeof(Attack), "Start")] private static class AttackStart { private static void Prefix(Attack __instance, ItemData weapon, out State __state) { __state = Begin(__instance, weapon, damage: false, ammo: true); } private static Exception Finalizer(State __state, Exception __exception) { End(__state); return __exception; } } [HarmonyPatch(typeof(Attack), "OnAttackTrigger")] private static class AttackTrigger { private static void Prefix(Attack __instance, out State __state) { __state = Begin(__instance, W(__instance), damage: false, ammo: true); } private static Exception Finalizer(State __state, Exception __exception) { End(__state); return __exception; } } [HarmonyPatch(typeof(Attack), "DoMeleeAttack")] private static class Melee { private static void Prefix(Attack __instance, out State __state) { __state = Begin(__instance, W(__instance), damage: true, ammo: false); } private static Exception Finalizer(State __state, Exception __exception) { End(__state); return __exception; } } [HarmonyPatch(typeof(Attack), "ModifyDamage")] private static class HitFilter { private static void Postfix(Attack __instance, HitData hitData) { //IL_003f: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) try { if (hitData == null) { return; } ItemData w = W(__instance); Combat.SwapRule swapRule = Combat.RuleFor(w, __instance); if (swapRule != null) { float pickaxe = hitData.m_damage.m_pickaxe; float chop = hitData.m_damage.m_chop; hitData.m_damage = Only(hitData.m_damage, swapRule.DamageType); hitData.m_toolTier = 0; string text = Combat.PrefabName(w) ?? "?"; if (hitLogged.Add(text)) { SnS.Log.LogInfo((object)string.Concat("Secondary hit filter: ", text, " -> ", swapRule.DamageType, " ", Pick(hitData.m_damage, swapRule.DamageType).ToString("0.#"), " (removed pickaxe ", pickaxe.ToString("0.#"), ", chop ", chop.ToString("0.#"), ")")); } } } catch (Exception ex) { SnS.Log.LogWarning((object)("Secondary hit filter: " + ex.Message)); } } } [HarmonyPatch(typeof(Attack), "DoAreaAttack")] private static class Area { private static void Prefix(Attack __instance, out State __state) { __state = Begin(__instance, W(__instance), damage: true, ammo: false); } private static Exception Finalizer(State __state, Exception __exception) { End(__state); return __exception; } } [HarmonyPatch(typeof(Attack), "Update")] private static class AttackUpdate { private static void Prefix(Attack __instance, out State __state) { __state = Begin(__instance, W(__instance), damage: false, ammo: false); } private static Exception Finalizer(State __state, Exception __exception) { End(__state); return __exception; } } [HarmonyPatch(typeof(Attack), "OnTrailStart")] private static class TrailStart { private static void Prefix(Attack __instance, out State __state) { __state = Begin(__instance, W(__instance), damage: false, ammo: false); } private static Exception Finalizer(State __state, Exception __exception) { End(__state); return __exception; } } private static readonly FieldInfo fWeapon = AccessTools.Field(typeof(Attack), "m_weapon"); private static readonly HashSet<string> diagnosed = new HashSet<string>(); private static readonly FieldInfo fSecAttack = AccessTools.Field(typeof(Character), "m_secondaryAttack"); private static readonly FieldInfo fSecHold = AccessTools.Field(typeof(Character), "m_secondaryAttackHold"); private static readonly FieldInfo fAttackHold = AccessTools.Field(typeof(Character), "m_attackHold"); private static readonly MethodInfo mStartAttack = AccessTools.Method(typeof(Humanoid), "StartAttack", (Type[])null, (Type[])null); private static bool bowInputLogged; private static readonly HashSet<string> hitLogged = new HashSet<string>(); private static float Pick(DamageTypes d, DamageType t) { //IL_0000: 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_0018: Expected I4, but got Unknown return (t - 1) switch { 0 => d.m_blunt, 1 => d.m_slash, 3 => d.m_pierce, _ => 0f, }; } private static DamageTypes Only(DamageTypes d, DamageType t) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 //IL_0047: Unknown result type (might be due to invalid IL or missing references) DamageTypes result = default(DamageTypes); float num = Pick(d, t); if ((int)t == 1) { result.m_blunt = num; } else if ((int)t == 2) { result.m_slash = num; } else if ((int)t == 4) { result.m_pierce = num; } return result; } internal static State Begin(Attack atk, ItemData w, bool damage, bool ammo) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) try { if (w == null || w.m_shared == null) { return null; } Combat.SwapRule swapRule = Combat.RuleFor(w, atk); if (swapRule == null) { return null; } Diagnose(w, swapRule); SharedData shared = w.m_shared; State state = new State(); state.Shared = shared; state.Dmg = shared.m_damages; state.DmgLv = shared.m_damagesPerLevel; state.Ammo = shared.m_ammoType; State state2 = state; if (damage) { shared.m_damages = Only(state2.Dmg, swapRule.DamageType); shared.m_damagesPerLevel = Only(state2.DmgLv, swapRule.DamageType); state2.Damage = true; state2.SpawnTerrain = shared.m_spawnOnHitTerrain; shared.m_spawnOnHitTerrain = null; } if (swapRule.SourceEffects && swapRule.SourceShared != null) { SharedData sourceShared = swapRule.SourceShared; state2.Effects = true; state2.Hit = shared.m_hitEffect; state2.HitTerrain = shared.m_hitTerrainEffect; state2.Trigger = shared.m_triggerEffect; state2.Start = shared.m_startEffect; state2.Trail = shared.m_trailStartEffect; shared.m_hitEffect = sourceShared.m_hitEffect; shared.m_hitTerrainEffect = sourceShared.m_hitTerrainEffect; shared.m_triggerEffect = sourceShared.m_triggerEffect; shared.m_startEffect = sourceShared.m_startEffect; shared.m_trailStartEffect = sourceShared.m_trailStartEffect; } if (ammo && swapRule.NoAmmo) { shared.m_ammoType = string.Empty; } return state2; } catch (Exception ex) { SnS.Log.LogWarning((object)("Secondary swap: " + ex.Message)); } return null; } internal static void End(State st) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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) if (st != null) { SharedData shared = st.Shared; shared.m_damages = st.Dmg; shared.m_damagesPerLevel = st.DmgLv; shared.m_ammoType = st.Ammo; if (st.Damage) { shared.m_spawnOnHitTerrain = st.SpawnTerrain; } if (st.Effects) { shared.m_hitEffect = st.Hit; shared.m_hitTerrainEffect = st.HitTerrain; shared.m_triggerEffect = st.Trigger; shared.m_startEffect = st.Start; shared.m_trailStartEffect = st.Trail; } } } private static void Diagnose(ItemData w, Combat.SwapRule rule) { string text = Combat.PrefabName(w) ?? "(null)"; if (diagnosed.Add(text)) { SnS.Log.LogInfo((object)("Secondary swap active: " + text + " -> " + rule.Name)); } } private static ItemData W(Attack a) { object? value = fWeapon.GetValue(a); return (ItemData)((value is ItemData) ? value : null); } } internal class MotionDef { public string Key; public string Label; public bool Secondary; public float Min; public float Max; public float Step; public Func<Attack, float> Get; public Action<Attack, float> Set; } internal static class Motion { public static readonly List<MotionDef> Defs = new List<MotionDef> { new MotionDef { Key = "primary.damage", Label = "通常攻撃 ダメージ倍率", Min = 0f, Max = 5f, Step = 0.05f, Get = (Attack a) => a.m_damageMultiplier, Set = delegate(Attack a, float v) { a.m_damageMultiplier = v; } }, new MotionDef { Key = "primary.finisher", Label = "コンボ最後の一撃 倍率", Min = 0f, Max = 5f, Step = 0.05f, Get = (Attack a) => a.m_lastChainDamageMultiplier, Set = delegate(Attack a, float v) { a.m_lastChainDamageMultiplier = v; } }, new MotionDef { Key = "primary.force", Label = "通常攻撃 ノックバック倍率", Min = 0f, Max = 5f, Step = 0.05f, Get = (Attack a) => a.m_forceMultiplier, Set = delegate(Attack a, float v) { a.m_forceMultiplier = v; } }, new MotionDef { Key = "primary.stagger", Label = "通常攻撃 よろめき倍率", Min = 0f, Max = 5f, Step = 0.05f, Get = (Attack a) => a.m_staggerMultiplier, Set = delegate(Attack a, float v) { a.m_staggerMultiplier = v; } }, new MotionDef { Key = "secondary.damage", Label = "副次攻撃 ダメージ倍率", Secondary = true, Min = 0f, Max = 6f, Step = 0.05f, Get = (Attack a) => a.m_damageMultiplier, Set = delegate(Attack a, float v) { a.m_damageMultiplier = v; } }, new MotionDef { Key = "secondary.force", Label = "副次攻撃 ノックバック倍率", Secondary = true, Min = 0f, Max = 6f, Step = 0.05f, Get = (Attack a) => a.m_forceMultiplier, Set = delegate(Attack a, float v) { a.m_forceMultiplier = v; } }, new MotionDef { Key = "secondary.stagger", Label = "副次攻撃 よろめき倍率", Secondary = true, Min = 0f, Max = 6f, Step = 0.05f, Get = (Attack a) => a.m_staggerMultiplier, Set = delegate(Attack a, float v) { a.m_staggerMultiplier = v; } } }; private static readonly string FilePath = Path.Combine(SnS.DataFolder, "motion.cfg"); private static readonly Dictionary<string, float> overrides = new Dictionary<string, float>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<Attack, Dictionary<string, float>> originals = new Dictionary<Attack, Dictionary<string, float>>(); private static readonly List<KeyValuePair<string, SharedData>> weapons = new List<KeyValuePair<string, SharedData>>(); private static bool dirty; public unsafe static string Group(SkillType skill, bool twoHanded) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) return (!twoHanded || Array.IndexOf(SnS.SplitTwoHanded, skill) < 0) ? ((object)(*(SkillType*)(&skill))/*cast due to .constrained prefix*/).ToString() : string.Concat(skill, "2H"); } public static void Load() { string[] array = "Axes.primary.finisher = 1\nAxes.secondary.damage = 2\nAxes.secondary.force = 1\nAxes.secondary.stagger = 2\nAxes2H.primary.finisher = 2.5\nAxes2H.secondary.stagger = 6\nBows.secondary.damage = 0.5\nClubs.primary.finisher = 2.5\nClubs.primary.stagger = 1.1\nClubs.secondary.damage = 3\nClubs.secondary.force = 3\nClubs.secondary.stagger = 3\nKnives.primary.finisher = 2\nKnives.secondary.force = 1\nPickaxes.primary.stagger = 2\nPickaxes.secondary.damage = 2\nSpears.secondary.stagger = 1.5\nUnarmed.primary.finisher = 2.5\n".Split('\n'); foreach (string text in array) { string text2 = text.Trim(); int num = text2.IndexOf('='); if (num > 0 && float.TryParse(text2.Substring(num + 1).Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { overrides[text2.Substring(0, num).Trim()] = result; } } } public static void SaveIfDirty() { } public static void Apply(ObjectDB db) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) weapons.Clear(); foreach (GameObject item in db.m_items) { if ((Object)(object)item == (Object)null) { continue; } ItemDrop d = item.GetComponent<ItemDrop>(); if (!((Object)(object)d == (Object)null) && d.m_itemData != null && d.m_itemData.m_shared != null) { SharedData shared = d.m_itemData.m_shared; if (Stats.IsWeapon(shared) && SnS.AnimSpeed.ContainsKey(shared.m_skillType) && db.m_recipes.Any((Recipe r) => (Object)(object)r != (Object)null && (Object)(object)r.m_item == (Object)(object)d)) { weapons.Add(new KeyValuePair<string, SharedData>(Group(shared.m_skillType, Combat.IsTwoHanded(shared)), shared)); } } } ApplyCached(); } private static void ApplyCached() { foreach (KeyValuePair<string, SharedData> weapon in weapons) { foreach (MotionDef def in Defs) { Attack val = ((!def.Secondary) ? weapon.Value.m_attack : weapon.Value.m_secondaryAttack); if (val != null) { if (!originals.TryGetValue(val, out var value)) { value = new Dictionary<string, float>(); originals[val] = value; } if (!value.ContainsKey(def.Key)) { value[def.Key] = def.Get(val); } def.Set(val, (!overrides.TryGetValue(weapon.Key + "." + def.Key, out var value2)) ? value[def.Key] : value2); } } } } public static float Baseline(string group, MotionDef def) { List<float> list = new List<float>(); foreach (KeyValuePair<string, SharedData> weapon in weapons) { if (!(weapon.Key != group)) { Attack val = ((!def.Secondary) ? weapon.Value.m_attack : weapon.Value.m_secondaryAttack); if (val != null && originals.TryGetValue(val, out var value) && value.ContainsKey(def.Key)) { list.Add(value[def.Key]); } } } if (list.Count == 0) { return float.NaN; } return (from v in list group v by Mathf.Round(v * 1000f)).OrderByDescending(Enumerable.Count).First().First(); } public static bool Has(string group, MotionDef def) { return weapons.Any((KeyValuePair<string, SharedData> kv) => kv.Key == group && ((!def.Secondary) ? kv.Value.m_attack : kv.Value.m_secondaryAttack) != null); } public static bool IsOverridden(string group, MotionDef def) { return overrides.ContainsKey(group + "." + def.Key); } public static float Current(string group, MotionDef def) { float value; return (!overrides.TryGetValue(group + "." + def.Key, out value)) ? Baseline(group, def) : value; } public static void Set(string group, MotionDef def, float v) { overrides[group + "." + def.Key] = v; dirty = true; ApplyCached(); } public static void Reset(string group, MotionDef def) { if (overrides.Remove(group + "." + def.Key)) { dirty = true; ApplyCached(); } } } [BepInPlugin("caldera.SmithAndSaga", "Smith & Saga", "0.3.0")] [BepInIncompatibility("renair.MoreUpgrades")] [BepInIncompatibility("caldera.EquipmentEditor")] [BepInIncompatibility("caldera.ExtraRecipes")] [BepInIncompatibility("caldera.FixedKnockbackBlock")] [BepInIncompatibility("caldera.SmithAndSaga.Dev")] [BepInProcess("valheim.exe")] public class SnS : BaseUnityPlugin { [HarmonyPatch(typeof(ObjectDB), "Awake")] private static class ObjectDBAwake { [HarmonyPriority(0)] private static void Postfix(ObjectDB __instance) { ApplyDatabase(__instance); } } [HarmonyPatch(typeof(ObjectDB), "CopyOtherDB")] private static class ObjectDBCopy { [HarmonyPriority(0)] private static void Postfix(ObjectDB __instance) { ApplyDatabase(__instance); } } public const string ModGuid = "caldera.SmithAndSaga"; public const string ModName = "Smith & Saga"; public const string ModVersion = "0.3.0"; internal static SnS Instance; internal static ManualLogSource Log; internal static readonly string DataFolder = Path.Combine(Paths.ConfigPath, "SmithAndSaga"); private readonly Harmony harmony = new Harmony("caldera.SmithAndSaga"); internal static ConfigEntry<int> MaxItemLevel; internal static ConfigEntry<int> ForgeLevelLock; internal static ConfigEntry<int> WorkbenchLevelLock; internal static ConfigEntry<int> OtherTableLevelLock; internal static ConfigEntry<int> FixedUpgradeCost; internal static ConfigEntry<int> UpgradeStationLevel; internal static ConfigEntry<float> ResPerLevelReduce; internal static ConfigEntry<float> StatsIncrease; internal static ConfigEntry<bool> RemoveCheatedFlag; internal static ConfigEntry<bool> UnlockWood; internal static ConfigEntry<bool> UnlockUpgrades; internal static ConfigEntry<string> WoodItems; internal static ConfigEntry<string> UpgradeItems; internal static ConfigEntry<string> SeasonalItems; internal static ConfigEntry<int> WoodMaxQuality; internal static ConfigEntry<bool> TraderHelmets; internal static ConfigEntry<bool> EnableStats; internal static ConfigEntry<bool> EnableAnimSpeed; internal static ConfigEntry<int> UiFontSize; internal static readonly SkillType[] WeaponSkills; internal static readonly Dictionary<SkillType, ConfigEntry<float>> AnimSpeed; internal static ConfigEntry<float> XpMultiplier; internal static ConfigEntry<bool> NoDeathSkillLoss; internal static ConfigEntry<float> SkillSpeedCap; internal static ConfigEntry<bool> SwapPickaxes; internal static ConfigEntry<bool> SwapSledges; internal static ConfigEntry<bool> SwapBows; internal static ConfigEntry<string> PickaxeSecondarySource; internal static ConfigEntry<string> SledgeSecondarySource; internal static ConfigEntry<string> BowSecondarySource; internal static readonly Dictionary<SkillType, ConfigEntry<float>> AnimSpeedSecondary; internal static readonly SkillType[] SplitTwoHanded; internal static readonly Dictionary<SkillType, ConfigEntry<float>> AnimSpeed2H; internal static readonly Dictionary<SkillType, ConfigEntry<float>> AnimSpeedSecondary2H; internal static ConfigEntry<bool> WarriorSet; internal static ConfigEntry<float> WarriorReduction; internal static ConfigEntry<float> WarriorKnockback; internal static ConfigEntry<float> WarriorBlockBonus; internal static ConfigEntry<bool> NimbleSet; internal static ConfigEntry<float> NimbleRunBonus; internal static ConfigEntry<float> NimbleDodgeBonus; internal static ConfigEntry<bool> HomeSet; internal static ConfigEntry<bool> SeriesSets; internal static ConfigEntry<bool> FlametalHelmetHeat; internal static ConfigEntry<float> HomeStamina; internal static ConfigEntry<int> CraftSortMode; private float saveTimer; private unsafe void Awake() { //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025e: 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_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Expected O, but got Unknown //IL_0785: Unknown result type (might be due to invalid IL or missing references) //IL_0793: Expected O, but got Unknown //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Expected O, but got Unknown //IL_044f: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Expected O, but got Unknown //IL_04b9: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04e8: Unknown result type (might be due to invalid IL or missing references) //IL_0508: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; bool flag = false; ConfigFile val = FixedConfig(); MaxItemLevel = val.Bind<int>("Upgrades", "Max item level", 100, "Max upgrade level for items that are upgradeable."); ForgeLevelLock = val.Bind<int>("Upgrades", "Forge level lock", 7, "Max forge level a recipe can require. 0 = auto."); WorkbenchLevelLock = val.Bind<int>("Upgrades", "Workbench level lock", 5, "Max workbench level a recipe can require. 0 = auto."); OtherTableLevelLock = val.Bind<int>("Upgrades", "Other table level lock", 0, "Max level other stations can require. 0 = auto (station's real max level)."); ResPerLevelReduce = val.Bind<float>("Upgrades", "Resource per level reduce", 1f, "Divide per-level upgrade materials (1 = vanilla)."); StatsIncrease = val.Bind<float>("Upgrades", "Stats per level increase", 1f, "Multiplier for per-level stats. Restart required."); FixedUpgradeCost = val.Bind<int>("Upgrades", "Fixed upgrade cost", flag ? 1 : 0, "If > 0, every upgrade costs exactly this many of each material. 0 = off."); UpgradeStationLevel = val.Bind<int>("Upgrades", "Upgrade station level", 1, "If > 0, upgrades never require a station level higher than this. 0 = off."); RemoveCheatedFlag = ((BaseUnityPlugin)this).Config.Bind<bool>("Cheats", "Remove cheated flag", false, "Remove the 'obtained with cheats' item flag and stop high-damage items from being flagged. Toggle in the achievements panel."); UnlockWood = val.Bind<bool>("Recipes", "Wooden weapons", true, "Wooden weapon series craftable and upgradeable."); WoodItems = val.Bind<string>("Recipes", "Wooden weapon items", "AxeWood,SwordWood,KnifeWood,BattleaxeWood,AtgeirWood,MaceWood,SledgeWood,SpearWood,THSwordWood", "Prefab names."); WoodMaxQuality = val.Bind<int>("Recipes", "Unlocked max quality", 4, "Base max quality for unlocked items (raised further by 'Max item level')."); UnlockUpgrades = val.Bind<bool>("Recipes", "Upgrade unlock", true, "Make the listed items upgradeable; seasonal items craftable all year."); TraderHelmets = val.Bind<bool>("Recipes", "Trader helmets", true, "Helmets sold by NPC traders can be upgraded at the workbench, using copies of the same helmet (+1 per level)."); UpgradeItems = val.Bind<string>("Recipes", "Upgrade unlock items", "SpearChitin,PickaxeAntler,HelmetMidsummerCrown,HelmetPointyHat,HelmetYule", "Prefab names."); SeasonalItems = val.Bind<string>("Recipes", "Seasonal items", "HelmetMidsummerCrown,HelmetPointyHat,HelmetYule", "Prefab names."); EnableStats = val.Bind<bool>("Equipment", "Enable stat edits", true, "Apply item stat edits (BepInEx/config/SmithAndSaga/items)."); EnableAnimSpeed = val.Bind<bool>("Equipment", "Enable animation speed", true, "Apply attack animation speed changes."); UiFontSize = ((BaseUnityPlugin)this).Config.Bind<int>("Equipment", "UI font size", 16, "Font size of the windows (at 1080p)."); SkillType[] weaponSkills = WeaponSkills; for (int i = 0; i < weaponSkills.Length; i++) { SkillType val2 = weaponSkills[i]; AnimSpeed[val2] = val.Bind<float>("AnimationSpeed", ((object)(*(SkillType*)(&val2))/*cast due to .constrained prefix*/).ToString(), 1f, new ConfigDescription("Attack animation speed multiplier for " + val2, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 3f), Array.Empty<object>())); } XpMultiplier = val.Bind<float>("Skills", "XP multiplier", 1.3f, "Skill experience gain multiplier (1.3 = +30%)."); NoDeathSkillLoss = val.Bind<bool>("Skills", "No skill loss on death", true, "Dying does not lower skills."); SkillSpeedCap = val.Bind<float>("Combat", "Skill speed cap", 60f, "Skill level where the edited animation speed is fully applied (skill 0 = x1.00, grows linearly up to this level)."); SwapPickaxes = val.Bind<bool>("Combat", "Pickaxe secondary", true, "Pickaxes get another weapon's secondary attack (blunt damage only, pickaxe effects)."); PickaxeSecondarySource = val.Bind<string>("Combat", "Pickaxe secondary source", "AtgeirIron", "Item whose secondary attack pickaxes use."); SwapSledges = val.Bind<bool>("Combat", "Sledge secondary", true, "Sledges get another weapon's secondary attack (blunt damage only, source effects / sounds)."); SledgeSecondarySource = val.Bind<string>("Combat", "Sledge secondary source", "Battleaxe", "Item whose secondary attack sledges use."); SwapBows = val.Bind<bool>("Combat", "Bow secondary", true, "Bows get the bare-hand kick (pierce damage only, kick effects / sounds, no arrows needed)."); BowSecondarySource = val.Bind<string>("Combat", "Bow secondary source", "PlayerUnarmed", "Item whose secondary attack bows use."); SkillType[] weaponSkills2 = WeaponSkills; for (int j = 0; j < weaponSkills2.Length; j++) { SkillType val3 = weaponSkills2[j]; AnimSpeedSecondary[val3] = val.Bind<float>("AnimationSpeed (secondary)", ((object)(*(SkillType*)(&val3))/*cast due to .constrained prefix*/).ToString(), 1f, new ConfigDescription("Secondary attack animation speed multiplier for " + val3, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 3f), Array.Empty<object>())); } SkillType[] splitTwoHanded = SplitTwoHanded; foreach (SkillType val4 in splitTwoHanded) { AnimSpeed2H[val4] = val.Bind<float>("AnimationSpeed", string.Concat(val4, " (two-handed)"), AnimSpeed[val4].Value, new ConfigDescription("Attack animation speed multiplier for two-handed " + val4, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 3f), Array.Empty<object>())); AnimSpeedSecondary2H[val4] = val.Bind<float>("AnimationSpeed (secondary)", string.Concat(val4, " (two-handed)"), AnimSpeedSecondary[val4].Value, new ConfigDescription("Secondary attack animation speed multiplier for two-handed " + val4, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 3f), Array.Empty<object>())); } WarriorSet = val.Bind<bool>("Set bonus", "Warrior set", true, "Bronze / Iron / Padded / Silver(Drake+Wolf) / Carapace / Flametal: helmet+chest+legs from these series (may be mixed) give the '戦士' buff. Restart required."); WarriorReduction = val.Bind<float>("Set bonus", "Warrior damage reduction", 0.125f, "Blunt / slash damage taken is lowered by this fraction while the '戦士' buff is active (0.125 = 12.5%)."); WarriorKnockback = val.Bind<float>("Set bonus", "Warrior knockback", 0.5f, "Knockback taken is multiplied by this while the '戦士' buff is active (0.5 = half)."); WarriorBlockBonus = val.Bind<float>("Set bonus", "Warrior block skill", 20f, "Blocking skill bonus of the '戦士' buff. Restart required."); NimbleSet = val.Bind<bool>("Set bonus", "Nimble set", true, "Leather / Troll / Root / Fenris / Lox / Ask: helmet+chest+legs from these series (may be mixed) give the '身軽' buff, on top of any vanilla set bonus."); NimbleRunBonus = val.Bind<float>("Set bonus", "Nimble run skill", 10f, "Run skill bonus of the '身軽' buff. Restart required."); NimbleDodgeBonus = val.Bind<float>("Set bonus", "Nimble dodge skill", 10f, "Dodge skill bonus of the '身軽' buff. Restart required."); SeriesSets = val.Bind<bool>("Set bonus", "Series sets", true, "Silver / Padded / Carapace / Flametal: helmet+chest+legs of one series give a series bonus (frost / blunt / pierce / slash resistance). Restart required."); FlametalHelmetHeat = val.Bind<bool>("Set bonus", "Flametal helmet heat resistance", true, "The flametal helmet gets the same heat resistance as the chest and legs. Restart required."); HomeSet = val.Bind<bool>("Set bonus", "Home set", true, "Hildir's clothes that already lower base-item stamina: any such helmet + chest give the home buff."); HomeStamina = val.Bind<float>("Set bonus", "Home set stamina", -0.5f, "Base-item (building, hoe, cultivator...) stamina change of the home buff (-0.5 = 50% less). Restart required."); CraftSortMode = ((BaseUnityPlugin)this).Config.Bind<int>("Crafting", "Sort mode", 0, "Crafting list sort (craftable first): 0 = game default, 1 = name, 2 = category (lower station level first)."); ApplyBaked(val); StatStore.LoadAll(); Motion.Load(); int num = 0; int num2 = 0; Type[] types = typeof(SnS).Assembly.GetTypes(); foreach (Type type in types) { if (type.GetCustomAttributes(typeof(HarmonyPatch), inherit: true).Length != 0) { try { harmony.CreateClassProcessor(type).Patch(); num++; } catch (Exception ex) { num2++; Log.LogWarning((object)("Patch " + type.Name + " failed: " + (ex.InnerException ?? ex).Message)); } } } try { harmony.Patch((MethodBase)AccessTools.Method(typeof(Inventory), "Changed", (Type[])null, (Type[])null), new HarmonyMethod(AccessTools.Method(typeof(Upgrades.InventoryChangedPatch), "Prefix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); num++; } catch (Exception ex2) { num2++; Log.LogWarning((object)("Inventory.Changed patch failed: " + ex2.Message)); } Log.LogInfo((object)("Smith & Saga 0.3.0 loaded. Patches: " + num + " ok, " + num2 + " failed. Item edit files: " + StatStore.OverrideCount)); } private static ConfigFile FixedConfig() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown ConfigFile val = new ConfigFile(Path.Combine(Paths.CachePath, "caldera.SmithAndSaga.fixed.cfg"), false); val.SaveOnConfigSet = false; return val; } private static void ApplyBaked(ConfigFile f) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown int num = 0; string[][] settings = Baked.Settings; foreach (string[] array in settings) { ConfigDefinition val = new ConfigDefinition(array[0], array[1]); if (!f.ContainsKey(val)) { Log.LogWarning((object)("Baked setting not found: [" + array[0] + "] " + array[1])); continue; } f[val].SetSerializedValue(array[2]); num++; } FixedUpgradeCost.Value = 0; Log.LogInfo((object)("Fixed settings applied: " + num)); } private void Update() { saveTimer += Time.unscaledDeltaTime; if (saveTimer > 1f) { saveTimer = 0f; StatStore.SaveDirty(); Motion.SaveIfDirty(); } Ui.Tick(); } private void OnGUI() { Ui.Draw(); } private void OnDestroy() { StatStore.SaveDirty(); Motion.SaveIfDirty(); } internal static void ApplyDatabase(ObjectDB db) { if (!((Object)(object)db == (Object)null) && db.m_items != null && db.m_items.Count != 0) { Step("recipes", delegate { Recipes.Apply(db); }); Step("upgrades", delegate { Upgrades.ApplyAll(db); }); Step("secondary swaps", delegate { Combat.ApplySecondarySwaps(db); }); Step("set bonus", delegate { SetBonus.Apply(db); }); Step("home set", delegate { HomeBonus.Apply(db); }); Step("motion", delegate { Motion.Apply(db); }); Step("trader helmets", delegate { TraderHelmetUpgrades.Apply(db); }); Step("item edits", delegate { StatStore.ApplyAll(db); }); } } private static void Step(string name, Action a) { try { a(); } catch (Exception ex) { Log.LogError((object)("Step '" + name + "' failed: " + ex)); } } static SnS() { SkillType[] array = new SkillType[12]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); WeaponSkills = (SkillType[])(object)array; AnimSpeed = new Dictionary<SkillType, ConfigEntry<float>>(); AnimSpeedSecondary = new Dictionary<SkillType, ConfigEntry<float>>(); SkillType[] array2 = new SkillType[3]; RuntimeHelpers.InitializeArray(array2, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); SplitTwoHanded = (SkillType[])(object)array2; AnimSpeed2H = new Dictionary<SkillType, ConfigEntry<float>>(); AnimSpeedSecondary2H = new Dictionary<SkillType, ConfigEntry<float>>(); } } internal class StatDef { public string Key; public string Label; public string Group; public string Note; public float Min; public float Max; public float Step; public bool Percent; public bool Toggle; public bool NeedsDurability; public bool FixedRange; public Func<SharedData, float> Get; public Action<SharedData, float> Set; public Func<SharedData, bool> Applies; } internal static class Stats { public static readonly List<StatDef> All; public static readonly string[] DamageNames; public static readonly string[] DamageLabels; public static readonly DamageType[] ResistTypes; public static readonly string[] ResistLabels; static Stats() { All = new List<StatDef>(); DamageNames = new string[10] { "blunt", "slash", "pierce", "chop", "pickaxe", "fire", "frost", "lightning", "poison", "spirit" }; DamageLabels = new string[10] { "打撃", "斬撃", "刺突", "伐採", "採掘", "炎", "冷気", "雷", "毒", "霊" }; DamageType[] array = new DamageType[8]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); ResistTypes = (DamageType[])(object)array; ResistLabels = new string[8] { "打撃耐性", "斬撃耐性", "刺突耐性", "炎耐性", "寒さ(冷気)耐性", "雷耐性", "毒耐性", "霊耐性" }; Func<SharedData, bool> applies = (SharedData s) => IsWeapon(s) || IsAmmo(s); Func<SharedData, bool> applies2 = (SharedData s) => IsWeapon(s) || IsShield(s); Func<SharedData, bool> applies3 = (SharedData s) => true; for (int num = 0; num < DamageNames.Length; num++) { int idx = num; Add("dmg." + DamageNames[num], DamageLabels[num] + "ダメージ", "攻撃", 0f, 300f, 1f, applies, (SharedData s) => GetDmg(s.m_damages, idx), delegate(SharedData s, float v) { SetDmg(ref s.m_damages, idx, v); }); } for (int num2 = 0; num2 < DamageNames.Length; num2++) { int idx2 = num2; Add("dmgLv." + DamageNames[num2], DamageLabels[num2] + " (強化1回ごと)", "攻撃(強化)", 0f, 50f, 0.5f, applies, (SharedData s) => GetDmg(s.m_damagesPerLevel, idx2), delegate(SharedData s, float v) { SetDmg(ref s.m_damagesPerLevel, idx2, v); }); } Add("attackForce", "$item_knockback", "攻撃", 0f, 300f, 1f, applies, (SharedData s) => s.m_attackForce, delegate(SharedData s, float v) { s.m_attackForce = v; }).Note = "攻撃が当たった敵を押し返す力"; Add("backstab", "$item_backstab", "攻撃", 1f, 20f, 0.5f, IsWeapon, (SharedData s) => s.m_backstabBonus, delegate(SharedData s, float v) { s.m_backstabBonus = v; }); Add("attackStamina", "$item_staminause", "攻撃", 0f, 100f, 1f, (SharedData s) => IsWeapon(s) && s.m_attack != null, (SharedData s) => s.m_attack.m_attackStamina, delegate(SharedData s, float v) { s.m_attack.m_attackStamina = v; }); Add("secondaryStamina", "$item_staminause (特殊攻撃)", "攻撃", 0f, 150f, 1f, (SharedData s) => IsWeapon(s) && s.m_secondaryAttack != null, (SharedData s) => s.m_secondaryAttack.m_attackStamina, delegate(SharedData s, float v) { s.m_secondaryAttack.m_attackStamina = v; }); Add("drawStamina", "$item_staminahold", "攻撃", 0f, 50f, 0.5f, (SharedData s) => IsWeapon(s) && s.m_attack != null && s.m_attack.m_bowDraw, (SharedData s) => s.m_attack.m_drawStaminaDrain, delegate(SharedData s, float v) { s.m_attack.m_drawStaminaDrain = v; }).Note = "弓を引き絞っている間、1秒ごとに消費するスタミナ"; Add("blockPower", "$item_blockarmor", "防御", 0f, 300f, 1f, applies2, (SharedData s) => s.m_blockPower, delegate(SharedData s, float v) { s.m_blockPower = v; }).Note = "ブロック時に防げるダメージ量"; Add("blockPowerLv", "$item_blockarmor (強化1回ごと)", "防御", 0f, 50f, 0.5f, applies2, (SharedData s) => s.m_blockPowerPerLevel, delegate(SharedData s, float v) { s.m_blockPowerPerLevel = v; }); Add("deflection", "$item_blockforce", "防御", 0f, 300f, 1f, applies2, (SharedData s) => s.m_deflectionForce, delegate(SharedData s, float v) { s.m_deflectionForce = v; }).Note = "ブロック時に敵を押し返す力 (ノックバック)"; Add("deflectionLv", "$item_blockforce (強化1回ごと)", "防御", 0f, 50f, 0.5f, applies2, (SharedData s) => s.m_deflectionForcePerLevel, delegate(SharedData s, float v) { s.m_deflectionForcePerLevel = v; }); Add("parryBonus", "$item_parrybonus", "防御", 0f, 10f, 0.1f, applies2, (SharedData s) => s.m_timedBlockBonus, delegate(SharedData s, float v) { s.m_timedBlockBonus = v; }).Note = "タイミングよく防いだ時にブロックアーマーに掛かる倍率"; Add("armor", "$item_armor", "防御", 0f, 200f, 1f, IsArmor, (SharedData s) => s.m_armor, delegate(SharedData s, float v) { s.m_armor = v; }); Add("armorLv", "$item_armor (強化1回ごと)", "防御", 0f, 30f, 0.5f, IsArmor, (SharedData s) => s.m_armorPerLevel, delegate(SharedData s, float v) { s.m_armorPerLevel = v; }); Func<SharedData, bool> applies4 = (SharedData s) => IsWeapon(s) || IsShield(s) || IsArmor(s); StatDef statDef = Add("useDurability", "耐久値あり", "その他", 0f, 1f, 1f, applies4, (SharedData s) => (!s.m_useDurability) ? 0f : 1f, delegate(SharedData s, float v) { s.m_useDurability = v > 0.5f; }); statDef.Toggle = true; statDef.Note = "オンにすると耐久値が減るようになり、修理が必要になります"; Add("durability", "$item_durability", "その他", 0f, 5000f, 10f, applies4, (SharedData s) => s.m_maxDurability, delegate(SharedData s, float v) { s.m_maxDurability = v; }).NeedsDurability = true; Add("durabilityLv", "$item_durability (強化1回ごと)", "その他", 0f, 1000f, 5f, applies4, (SharedData s) => s.m_durabilityPerLevel, delegate(SharedData s, float v) { s.m_durabilityPerLevel = v; }).NeedsDurability = true; Add("durabilityDrain", "使用ごとの耐久消費", "その他", 0f, 10f, 0.1f, (SharedData s) => s.m_useDurability && IsWeapon(s), (SharedData s) => s.m_useDurabilityDrain, delegate(SharedData s, float v) { s.m_useDurabilityDrain = v; }); Add("weight", "$item_weight", "その他", 0f, 100f, 0.5f, applies3, (SharedData s) => s.m_weight, delegate(SharedData s, float v) { s.m_weight = v; }); StatDef statDef2 = Add("movement", "移動速度補正", "その他", -0.5f, 0.5f, 0.01f, (SharedData s) => IsArmor(s) || IsWeapon(s) || IsShield(s), (SharedData s) => s.m_movementModifier, delegate(SharedData s, float v) { s.m_movementModifier = v; }); statDef2.Percent = true; string[,] array2 = new string[8, 2] { { "staminaMod.attack", "攻撃時の消費スタミナ" }, { "staminaMod.block", "ブロック時の消費スタミナ" }, { "staminaMod.dodge", "回避時の消費スタミナ" }, { "staminaMod.run", "走行時の消費スタミナ" }, { "staminaMod.jump", "ジャンプ時の消費スタミナ" }, { "staminaMod.swim", "水泳時の消費スタミナ" }, { "staminaMod.sneak", "しゃがみ移動時の消費スタミナ" }, { "staminaMod.home", "建築・農具・鍬などの消費スタミナ" } }; for (int num3 = 0; num3 < array2.GetLength(0); num3++) { string k = array2[num3, 0]; StatDef statDef3 = Add(k, array2[num3, 1], "スタミナ補正", -0.5f, 0.5f, 0.05f, applies4, (SharedData sh) => GetStam(sh, k), delegate(SharedData sh, float v) { SetStam(sh, k, v); }); statDef3.Percent = true; statDef3.FixedRange = true; if (num3 == 0) { statDef3.Note = "マイナスで消費が減ります (例: -10% = 1割軽減)"; } } } public static bool IsWeapon(SharedData s) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected I4, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 ItemType itemType = s.m_itemType; switch (itemType - 14) { default: if ((int)itemType != 3 && (int)itemType != 4 && (int)itemType != 22) { return false; } goto case 0; case 0: case 1: case 5: return true; } } public static bool IsAmmo(SharedData s) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 return (int)s.m_itemType == 9 || (int)s.m_itemType == 23; } public static bool IsShield(SharedData s) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 return (int)s.m_itemType == 5; } public static bool IsArmor(SharedData s) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected I4, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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 ItemType itemType = s.m_itemType; switch (itemType - 6) { default: if ((int)itemType != 17 && (int)itemType != 18 && (int)itemType != 24) { return false; } goto case 0; case 0: case 1: case 5: return true; } } public static bool IsEditable(SharedData s) { return IsWeapon(s) || IsAmmo(s) || IsShield(s) || IsArmor(s); } private static float GetStam(SharedData s, string k) { return k switch { "staminaMod.attack" => s.m_attackStaminaModifier, "staminaMod.block" => s.m_blockStaminaModifier, "staminaMod.dodge" => s.m_dodgeStaminaModifier, "staminaMod.run" => s.m_runStaminaModifier, "staminaMod.jump" => s.m_jumpStaminaModifier, "staminaMod.swim" => s.m_swimStaminaModifier, "staminaMod.sneak" => s.m_sneakStaminaModifier, _ => s.m_homeItemsStaminaModifier, }; } private static void SetStam(SharedData s, string k, float v) { switch (k) { case "staminaMod.attack": s.m_attackStaminaModifier = v; break; case "staminaMod.block": s.m_blockStaminaModifier = v; break; case "staminaMod.dodge": s.m_dodgeStaminaModifier = v; break; case "staminaMod.run": s.m_runStaminaModifier = v; break; case "staminaMod.jump": s.m_jumpStaminaModifier = v; break; case "staminaMod.swim": s.m_swimStaminaModifier = v; break; case "staminaMod.sneak": s.m_sneakStaminaModifier = v; break; default: s.m_homeItemsStaminaModifier = v; break; } } private static StatDef Add(string key, string label, string group, float min, float max, float step, Func<SharedData, bool> applies, Func<SharedData, float> get, Action<SharedData, float> set) { StatDef statDef = new StatDef(); statDef.Key = key; statDef.Label = label; statDef.Group = group; statDef.Min = min; statDef.Max = max; statDef.Step = step; statDef.Applies = applies; statDef.Get = get; statDef.Set = set; StatDef statDef2 = statDef; All.Add(statDef2); return statDef2; } public static StatDef Find(string key) { return All.FirstOrDefault((StatDef d) => d.Key == key); } private static float GetDmg(DamageTypes d, int i) { return i switch { 0 => d.m_blunt, 1 => d.m_slash, 2 => d.m_pierce, 3 => d.m_chop, 4 => d.m_pickaxe, 5 => d.m_fire, 6 => d.m_frost, 7 => d.m_lightning, 8 => d.m_poison, _ => d.m_spirit, }; } private static void SetDmg(ref DamageTypes d, int i, float v) { switch (i) { case 0: d.m_blunt = v; break; case 1: d.m_slash = v; break; case 2: d.m_pierce = v; break; case 3: d.m_chop = v; break; case 4: d.m_pickaxe = v; break; case 5: d.m_fire = v; break; case 6: d.m_frost = v; break; case 7: d.m_lightning = v; break; case 8: d.m_poison = v; break; default: d.m_spirit = v; break; } } public static bool HasResist(List<DamageModPair> mods, DamageType t) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Invalid comparison between Unknown and I4 //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Invalid comparison between Unknown and I4 if (mods == null) { return false; } foreach (DamageModPair mod in mods) { if (mod.m_type == t && ((int)mod.m_modifier == 1 || (int)mod.m_modifier == 5 || (int)mod.m_modifier == 7 || (int)mod.m_modifier == 3 || (int)mod.m_modifier == 4)) { return true; } } return false; } } internal class Original { public Dictionary<string, float> Values = new Dictionary<string, float>(); public List<DamageModPair> Mods; } internal static class StatStore { public static readonly string Folder = Path.Combine(Paths.ConfigPath, "SmithAndSaga", "items"); private static readonly Dictionary<string, Dictionary<string, float>> overrides = new Dictionary<string, Dictionary<string, float>>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<string, Original> originals = new Dictionary<string, Original>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<string, SharedData> shared = new Dictionary<string, SharedData>(StringComparer.OrdinalIgnoreCase); private static readonly HashSet<string> dirty = new HashSet<string>(StringComparer.OrdinalIgnoreCase); public static int OverrideCount => overrides.Count; public static void LoadAll() { LoadBaked(); } private static void LoadBaked() { Dictionary<string, float> dictionary = null; string[] array = "[ArmorBronzeChest]\narmor = 10\n[ArmorBronzeLegs]\narmor = 10\n[ArmorCarapaceChest]\narmor = 34\n[ArmorCarapaceLegs]\narmor = 34\n[ArmorDeepNorthHeavyChest]\narmor = 46\n[ArmorDeepNorthHeavylegs]\narmor = 46\n[ArmorDress1]\narmorLv = 2\n[ArmorDress10]\narmorLv = 2\n[ArmorDress2]\narmorLv = 2\n[ArmorDress3]\narmorLv = 2\n[ArmorDress4]\narmorLv = 2\n[ArmorDress5]\narmorLv = 2\n[ArmorDress6]\narmorLv = 2\n[ArmorDress7]\narmorLv = 2\n[ArmorDress8]\narmorLv = 2\n[ArmorDress9]\narmorLv = 2\n[ArmorFenringChest]\narmor = 12\n[ArmorFenringLegs]\narmor = 12\n[ArmorFlametalChest]\narmor = 40\n[ArmorFlametalLegs]\narmor = 40\n[ArmorHarvester1]\narmorLv = 2\n[ArmorHarvester2]\narmorLv = 2\n[ArmorIronChest]\narmor = 16\n[ArmorIronLegs]\narmor = 16\n[ArmorLoxChest]\narmor = 18\n[ArmorLoxLegs]\narmor = 18\n[ArmorPaddedCuirass]\narmor = 28\n[ArmorPaddedGreaves]\narmor = 28\n[ArmorRagsChest]\narmorLv = 1\n[ArmorRagsLegs]\narmorLv = 1\n[ArmorRootChest]\narmor = 10\nmovement = -0.02\nres.Fire = 1\n[ArmorRootLegs]\narmor = 10\n[ArmorTunic1]\narmorLv = 2\n[ArmorTunic10]\narmorLv = 2\n[ArmorTunic2]\narmorLv = 2\n[ArmorTunic3]\narmorLv = 2\n[ArmorTunic4]\narmorLv = 2\n[ArmorTunic5]\narmorLv = 2\n[ArmorTunic6]\narmorLv = 2\n[ArmorTunic7]\narmorLv = 2\n[ArmorTunic8]\narmorLv = 2\n[ArmorTunic9]\narmorLv = 2\n[ArmorWolfChest]\narmor = 22\n[ArmorWolfLegs]\narmor = 22\n[ArrowBloodGold]\nattackForce = 60\nweight = 0\n[ArrowBronze]\nattackForce = 55\ndmg.pierce = 35\nweight = 0\n[ArrowCarapace]\nattackForce = 40\ndmg.pierce = 75\nweight = 0\n[ArrowCharred]\nattackForce = 40\ndmg.pierce = 85\nweight = 0\n[ArrowFire]\ndmg.fire = 36\ndmg.pierce = 11\nweight = 0\n[ArrowFlint]\nattackForce = 30\ndmg.pierce = 30\nweight = 0\n[ArrowFrost]\nattackForce = 30\nweight = 0\n[ArrowIron]\nattackForce = 55\ndmg.pierce = 45\nweight = 0\n[ArrowNeedle]\nattackForce = 40\ndmg.pierce = 65\nweight = 0\n[ArrowObsidian]\nattackForce = 45\nweight = 0\n[ArrowPoison]\nattackForce = 30\nweight = 0\n[ArrowSilver]\nattackForce = 50\ndmg.pierce = 26\ndmg.spirit = 56\nweight = 0\n[ArrowWood]\ndmg.pierce = 22\nweight = 0\n[AtgeirBlackmetal]\nattackStamina = 14\nblockPowerLv = 2\ndeflectionLv = 0\ndurability = 180\nparryBonus = 2.5\nsecondaryStamina = 28\n[AtgeirBronze]\nattackStamina = 11\nblockPowerLv = 2\ndeflectionLv = 0\ndurability = 120\nparryBonus = 2.5\nsecondaryStamina = 22\n[AtgeirHimminAfl]\nattackStamina = 15\nblockPowerLv = 2\ndeflectionLv = 0\nparryBonus = 2.5\nsecondaryStamina = 30\n[AtgeirIron]\nattackStamina = 12\nblockPowerLv = 2\ndeflectionLv = 0\ndurability = 180\nparryBonus = 2.5\nsecondaryStamina = 24\n[AxeBerzerkr]\nblockPowerLv = 1\nparryBonus = 2.5\n[AxeBlackMetal]\nattackForce = 40\nattackStamina = 9\nblockPower = 42\nblockPowerLv = 2\ndeflection = 30\ndeflectionLv = 0\ndmg.blunt = 51\ndmg.slash = 51\ndmgLv.blunt = 2.5\ndmgLv.slash = 2.5\ndurability = 180\nmovement = -0.03\nparryBonus = 2.5\nsecondaryStamina = 9\n[AxeBronze]\nattackForce = 40\nattackStamina = 6\nblockPower = 15\nblockPowerLv = 2\ndeflection = 30\ndeflectionLv = 0\ndmg.blunt = 21\ndmg.slash = 21\ndmgLv.blunt = 2.5\ndmgLv.slash = 2.5\ndurability = 120\nmovement = -0.03\nparryBonus = 2.5\nsecondaryStamina = 6\nweight = 1.5\n[AxeEarly]\nblockPower = 6\nblockPowerLv = 2\ndeflectionLv = 0\ndurability = 180\n[AxeFlint]\nattackForce = 40\nattackStamina = 5\nblockPower = 7\nblockPowerLv = 2\ndeflection = 30\ndeflectionLv = 0\ndmg.blunt = 11\ndmg.slash = 11\ndmgLv.blunt = 2.5\ndmgLv.slash = 2.5\nmovement = -0.03\nparryBonus = 2.5\nsecondaryStamina = 5\n[AxeGold]\nattackForce = 40\nattackStamina = 11\nblockPower = 69\nblockPowerLv = 2\ndeflection = 30\ndeflectionLv = 0\ndmg.blunt = 89\ndmg.slash = 89\ndmgLv.blunt = 5\ndmgLv.slash = 5\nmovement = -0.03\nparryBonus = 2.5\nsecondaryStamina = 11\nweight = 2.5\n[AxeGold_BloodLightning]\nattackForce = 40\nattackStamina = 12\nblockPower = 69\nblockPowerLv = 2\ndeflection = 30\ndeflectionLv = 0\ndmg.blunt = 99\ndmg.slash = 99\ndmgLv.blunt = 3\ndmgLv.slash = 3\nmovement = -0.03\nparryBonus = 2.5\nsecondaryStamina = 12\n[AxeGold_FrostFire]\nattackForce = 40\nattackStamina = 12\nblockPower = 69\nblockPowerLv = 2\ndeflection = 30\ndeflectionLv = 0\ndmg.blunt = 73\ndmg.slash = 73\ndmgLv.blunt = 3\ndmgLv.slash = 3\nmovement = -0.03\nparryBonus = 2.5\nsecondaryStamina = 12\n[AxeIron]\nattackForce = 40\nattackStamina = 7\nblockPower = 24\nblockPowerLv = 2\ndeflection = 30\ndeflectionLv = 0\ndmg.blunt = 31\ndmg.slash = 31\ndmgLv.blunt = 2.5\ndmgLv.slash = 2.5\ndurability = 180\nmovement = -0.03\nparryBonus = 2.5\nsecondaryStamina = 7\nweight = 1.5\n[AxeJotunBane]\nattackForce = 40\nattackStamina = 10\nblockPower = 51\nblockPowerLv = 2\ndeflection = 30\ndeflectionLv = 0\ndmg.blunt = 41\ndmg.poison = 58\ndmg.slash = 41\ndmgLv.blunt = 2.5\ndmgLv.poison = 8\ndmgLv.slash = 2.5\nmovement = -0.03\nparryBonus = 2.5\nsecondaryStamina = 10\n[Battleaxe]\nattackForce = 60\nattackStamina = 8\nblockPower = 30\nblockPowerLv = 2\ndeflection = 50\ndeflectionLv = 0\nmovement = -0.1\nparryBonus = 2.5\nsecondaryStamina = 4\nweight = 4\n[BattleaxeBlackmetal]\nattackForce = 60\nattackStamina = 10\nblockPowerLv = 2\ndeflection = 50\ndeflectionLv = 0\nmovement = -0.1\nparryBonus = 2.5\nsecondaryStamina = 5\n[BattleaxeCrystal]\nattackForce = 60\nattackStamina = 9\nblockPowerLv = 2\ndeflection = 30\ndeflectionLv = 0\ndmgLv.spirit = 0.5\nmovement = -0.1\nparryBonus = 2.5\nsecondaryStamina = 5\n[BattleaxeGold]\nattackStamina = 13\nblockPowerLv = 2\ndeflection = 50\ndeflectionLv = 0\nmovement = -0.1\nsecondaryStamina = 7\n[BattleaxeGold_BloodLightning]\nattackForce = 60\nattackStamina = 13\nblockPowerLv = 2\ndeflection = 50\ndeflectionLv = 0\nmovement = -0.1\nparryBonus = 2.5\nsecondaryStamina = 7\n[BattleaxeGold_FrostFire]\nattackForce = 60\nattackStamina = 13\nblockPowerLv = 2\ndeflection = 50\ndeflectionLv = 0\nsecondaryStamina = 7\n[BattleaxeSkullSplittur]\nattackForce = 60\nattackStamina = 11\nblockPowerLv = 2\ndeflection = 50\ndeflectionLv = 0\nmovement = -0.1\nparryBonus = 2.5\nsecondaryStamina = 6\n[BattleaxeWood]\nattackForce = 55\nblockPower = 10\nblockPowerLv = 1\ndeflection = 50\ndeflectionLv = 0\ndmg.chop = 35\ndmg.slash = 30\ndmgLv.chop = 5\ndmgLv.slash = 6\nmovement = -0.1\nparryBonus = 2.5\nweight = 3\n[BowAshlands]\ndrawStamina = 10\nsecondaryStamina = 20\n[BowAshlandsBlood]\ndrawStamina = 10\nsecondaryStamina = 20\n[BowAshlandsRoot]\ndrawStamina = 10\nsecondaryStamina = 20\n[BowAshlandsStorm]\ndrawStamina = 10\nsecondaryStamina = 20\n[BowDraugrFang]\ndrawStamina = 7\nsecondaryStamina = 14\n[BowFineWood]\ndrawStamina = 5\nsecondaryStamina = 10\n[BowGold]\nattackForce = 30\ndrawStamina = 11\nsecondaryStamina = 22\n[BowGold_BloodLightning]\ndrawStamina = 11\nsecondaryStamina = 22\n[BowGold_FrostFire]\ndrawStamina = 11\nsecondaryStamina = 22\n[BowHuntsman]\ndrawStamina = 6\nsecondaryStamina = 12\n[BowSpineSnap]\ndrawStamina = 9\nsecondaryStamina = 18\n[CapeDeerHide]\nstaminaMod.home = -0.15\nstaminaMod.swim = -0.2\n[CapeFeather]\narmor = 10\n[CapeLinen]\narmor = 10\nres.Frost = 1\nstaminaMod.block = -0.1\nstaminaMod.dodge = -0.1\nstaminaMod.run = 0\nweight = 0.5\n[CapeLox]\narmor = 10\nstaminaMod.attack = -0.05\nwetproof = 1\n[CapeTrollHide]\narmor = 4\nstaminaMod.sneak = -0.5\n[CapeWolf]\narmor = 7\nstaminaMod.jump = -0.1\nstaminaMod.run = -0.1\nweight = 1\n[Club]\nblockPower = 6\nblockPowerLv = 2\ndeflectionLv = 0\ndmg.blunt = 15\nparryBonus = 2.5\nweight = 1.5\n[CrossbowArbalest]\nbackstab = 6\n[CrossbowGold]\nbackstab = 6\n[CrossbowRipper]\nbackstab = 6\n[CrossbowRipperBlood]\nbackstab = 6\n[CrossbowRipperLightning]\nbackstab = 6\n[CrossbowRipperNature]\nbackstab = 6\n[FistBjornClaw]\nblockPowerLv = 2\ndeflectionLv = 0\n[FistBjornUndeadClaw]\nattackStamina = 10\nblockPower = 20\ndeflectionLv = 0\ndmg.pierce = 20\ndmg.slash = 60\nsecondaryStamina = 20\n[FistFenrirClaw]\nattackStamina = 9\nblockPower = 10\nsecondaryStamina = 18\n[FistGold]\nattackStamina = 13\nblockPower = 36\nblockPowerLv = 2\ndeflectionLv = 0\n[HelmetBronze]\narmor = 10\n[HelmetCarapace]\narmor = 34\n[HelmetCelebration]\nres.Frost = 1\n[HelmetDNHeavy]\narmor = 46\n[HelmetDrake]\narmor = 22\n[HelmetDverger]\narmor = 10\narmorLv = 2\nuseDurability = 1\nwetproof = 1\n[HelmetFenring]\narmor = 12\n[HelmetFlametal]\narmor = 40\n[HelmetIron]\narmor = 16\n[HelmetLox]\narmor = 18\n[HelmetMidsummerCrown]\narmorLv = 2\nres.Frost = 1\nuseDurability = 1\n[HelmetPadded]\narmor = 28\n[HelmetPointyHat]\narmor = 0\narmorLv = 2\nres.Frost = 1\nwetproof = 1\n[HelmetRoot]\narmor = 10\n[HelmetSweatBand]\narmorLv = 2\nstaminaMod.block = -0.1\nstaminaMod.dodge = -0.1\nstaminaMod.jump = -0.1\nstaminaMod.run = -0.1\nstaminaMod.sneak = -0.1\nstaminaMod.swim = -0.1\nwetproof = 1\n[HelmetYule]\narmorLv = 2\nres.Frost = 1\n[KnifeBlackMetal]\nattackStamina = 7\nblockPower = 22\nblockPowerLv = 1\ndeflectionLv = 0\nsecondaryStamina = 21\nweight = 1\n[KnifeChitin]\nattackStamina = 5\nblockPower = 12\nblockPowerLv = 1\ndeflectionLv = 0\nsecondaryStamina = 15\nweight = 1\n[KnifeCopper]\nattackStamina = 4\nblockPower = 7\nblockPowerLv = 1\ndeflectionLv = 0\nsecondaryStamina = 12\nweight = 1\n[KnifeFlint]\nattackStamina = 3\nblockPower = 2\nblockPowerLv = 1\ndeflectionLv = 0\nsecondaryStamina = 9\nweight = 1\n[KnifeGold]\nattackStamina = 10\nblockPower = 39\nblockPowerLv = 2\ndeflectionLv = 0\nsecondaryStamina = 30\nweight = 1\n[KnifeSilver]\nattackStamina = 6\nblockPower = 17\nblockPowerLv = 1\ndeflectionLv = 0\ndmgLv.spirit = 0.5\nsecondaryStamina = 18\nweight = 1\n[KnifeSkollAndHati]\nattackStamina = 12\nblockPowerLv = 2\ndeflectionLv = 0\nsecondaryStamina = 36\nweight = 2\n[KnifeWood]\nweight = 0.5\n[MaceBronze]\nattackForce = 55\nattackStamina = 6\nblockPower = 17\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\nparryBonus = 2.5\nsecondaryStamina = 3\nweight = 3\n[MaceEldner]\nattackForce = 55\nattackStamina = 11\nblockPower = 62\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\nparryBonus = 2.5\nsecondaryStamina = 6\nweight = 4\n[MaceEldnerBlood]\nattackForce = 55\nattackStamina = 11\nblockPower = 62\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\nparryBonus = 2.5\nsecondaryStamina = 6\nweight = 4\n[MaceEldnerLightning]\nattackForce = 55\nattackStamina = 11\nblockPower = 62\nblockPowerLv = 2\ndeflection = 40\ndeflectionLv = 0\ndmgLv.lightning = 5\nparryBonus = 2.5\nsecondaryStamina = 6\nweight = 4\n[MaceEldnerNature]\nattackForce = 55\nattackStamina = 11\nblockPower = 62\nblockPowerLv = 2\ndeflection = 40\ndmgLv.poison = 5\nsecondaryStamina = 6\nweight = 4\n[MaceGold]\nattackForce = 55\nattackStamina = 12\nblockPower = 71\nblockPowerLv = 2\ndeflection