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 OlympianArsenal v1.0.1
OlympianArsenal.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using HarmonyLib; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Extensions; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using OlympianArsenal.Armor; using OlympianArsenal.DebugTools; using OlympianArsenal.Runtime; using OlympianArsenal.Weapons; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = "")] [assembly: AssemblyCompany("OlympianArsenal")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1+ff5ed96e77477f7054a8d1ed59edd0a900b11a1f")] [assembly: AssemblyProduct("OlympianArsenal")] [assembly: AssemblyTitle("OlympianArsenal")] [assembly: AssemblyVersion("1.0.1.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace OlympianArsenal { [BepInPlugin("com.olympianarsenal.valheim", "OlympianArsenal", "1.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static string Dir; internal static ConfigEntry<bool> TraceAttacks; private Harmony _harmony; private void Awake() { //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Expected O, but got Unknown Dir = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); Cfg.BindVersion(((BaseUnityPlugin)this).Config); TraceAttacks = Cfg.Advanced(((BaseUnityPlugin)this).Config, "Debug", "Trace attacks", def: false, "Log every attack trigger of our weapons (for tuning)."); Controls.BindConfig(((BaseUnityPlugin)this).Config); StructureGuard.BindConfig(((BaseUnityPlugin)this).Config); QualityLooks.BindConfig(((BaseUnityPlugin)this).Config); SkyBolt.BindConfig(((BaseUnityPlugin)this).Config); BladeOfOlympus.BindConfig(((BaseUnityPlugin)this).Config); BladesOfChaos.BindConfig(((BaseUnityPlugin)this).Config); LeviathanAxe.BindConfig(((BaseUnityPlugin)this).Config); Mjolnir.BindConfig(((BaseUnityPlugin)this).Config); HuldraPick.BindConfig(((BaseUnityPlugin)this).Config); GuardianShield.BindConfig(((BaseUnityPlugin)this).Config); ValkyrieArmor.BindConfig(((BaseUnityPlugin)this).Config); UpgradeCosts.BindConfig(((BaseUnityPlugin)this).Config, BladesOfChaos.Costs, LeviathanAxe.Costs, Mjolnir.Costs, BladeOfOlympus.Costs, ValkyrieArmor.ChestCosts, ValkyrieArmor.LegsCosts, ValkyrieArmor.HelmetCosts, HuldraPick.Costs, GuardianShield.Costs); SpecialAttacks.BindConfig(((BaseUnityPlugin)this).Config); Cfg.StampVersion(); Controls.AddInput(); Mjolnir.AddInput(); SpecialKeys.AddInput(); KeyRows.Watch(); ThrowRegistry.Register(LeviathanThrown.CreateDef()); CustomLocalization localization = LocalizationManager.Instance.GetLocalization(); string text = "English"; localization.AddTranslation(ref text, Controls.English); text = "English"; localization.AddTranslation(ref text, BladeOfOlympus.English); text = "English"; localization.AddTranslation(ref text, BladesOfChaos.English); text = "English"; localization.AddTranslation(ref text, ChaosWarmth.English); text = "English"; localization.AddTranslation(ref text, LeviathanAxe.English); text = "English"; localization.AddTranslation(ref text, LeviathanFrost.English); text = "English"; localization.AddTranslation(ref text, Mjolnir.English); text = "English"; localization.AddTranslation(ref text, HuldraPick.English); text = "English"; localization.AddTranslation(ref text, GuardianShield.English); text = "English"; localization.AddTranslation(ref text, ValkyrieArmor.English); text = "English"; localization.AddTranslation(ref text, UpgradeCosts.English); text = "English"; localization.AddTranslation(ref text, SpecialAttacks.English); text = "English"; localization.AddTranslation(ref text, KeyRows.English); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new OlyDumpCommand()); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new OlyTuneCommand()); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new OlyFxCommand()); PrefabManager.OnVanillaPrefabsAvailable += AddItems; _harmony = new Harmony("com.olympianarsenal.valheim"); _harmony.PatchAll(typeof(Plugin).Assembly); Logger.LogInfo((object)("OlympianArsenal 1.0.1 loaded from " + Dir)); } private void Start() { Controls.WarnAboutKeyConflicts(); } private void AddItems() { PrefabManager.OnVanillaPrefabsAvailable -= AddItems; Safe("Shared effects", SkyBolt.Register); Safe("Blade of Olympus", BladeOfOlympus.Register); Safe("Blades of Chaos", BladesOfChaos.Register); Safe("Leviathan Axe", LeviathanAxe.Register); Safe("Mjolnir", Mjolnir.Register); Safe("Huldra Pick", HuldraPick.Register); Safe("Guardian Shield", GuardianShield.Register); Safe("Special attacks", SpecialAttacks.Register); Safe("Valkyrie armor", ValkyrieArmor.Register); Safe("Level icons", LevelIcons.Register); } private static void Safe(string what, Action register) { try { register(); } catch (Exception arg) { Logger.LogError((object)$"{what} failed to register: {arg}"); } } private void Update() { ThrowController.Tick(); SpecialController.Tick(); PlayerFlight.Tick(); LightningDash.Tick(); ArsenalQueue.Tick(); Controls.TickClashNote(); } private void FixedUpdate() { ThrowController.FixedTick(); SpecialController.FixedTick(); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } internal static class PluginInfo { public const string Guid = "com.olympianarsenal.valheim"; public const string Name = "OlympianArsenal"; public const string Version = "1.0.1"; } } namespace OlympianArsenal.Weapons { internal static class BladeOfOlympus { public const string Prefab = "OLY_BladeOfOlympus"; public const string Token = "$item_oly_bladeofolympus"; private const string BasePrefab = "THSwordKrom"; private const string ChainPrefab = "OLY_ChainLightning_Olympus"; internal const string LookKey = "Olympus"; private static ConfigEntry<float> _slash; private static ConfigEntry<float> _slashPerLevel; private static ConfigEntry<float> _lightning; private static ConfigEntry<float> _lightningPerLevel; private static ConfigEntry<float> _chainChance; private static ConfigEntry<float> _chainChanceSecondary; private static ConfigEntry<float> _chainDamage; private static ConfigEntry<float> _chainJump; private static ConfigEntry<float> _slamDamage; private static ConfigEntry<float> _slamStamina; private static ConfigEntry<float> _slamRadius; private static ConfigEntry<float> _glowIntensity; internal static ConfigEntry<Vector3> ModelOffset; internal static ConfigEntry<Vector3> ModelEuler; internal static ConfigEntry<float> ModelScale; public static readonly Dictionary<string, string> English = new Dictionary<string, string> { { "item_oly_bladeofolympus", "Blade of Olympus" }, { "item_oly_bladeofolympus_description", "A god-forged greatsword humming with stolen thunder. Its strikes can leap to nearby foes as chain lightning, and its heavy blow, Divine Reckoning, smites the ground with the fury of the storm." }, { "oly_olympus_power", "Power of Olympus" }, { "oly_olympus_unlock_chain", "Chain lightning forks to one more enemy at every jump" }, { "oly_olympus_unlock_storm", "Storm strike: Divine Reckoning calls a sky bolt onto the strongest enemy it hits" }, { "oly_olympus_unlock_wrath", "Wrath of Olympus: a wider Divine Reckoning that staggers every enemy it hits" }, { "oly_olympus_unlocks_off", "Upgrade powers are switched off" } }; private static readonly Color Lightning = new Color(0.55f, 0.85f, 1f); private static readonly float[] GlowStrength = new float[4] { 0.63f, 0.63f, 2.5f, 2.5f }; private static readonly float[] EdgeStrength = new float[4] { 0f, 0f, 0f, 2.5f }; private const float BladeGlowStrength = 2f; internal static readonly UpgradeCosts.Path Costs = new UpgradeCosts.Path { Prefab = "OLY_BladeOfOlympus", Weapon = "Blade of Olympus", WeaponId = 1, Classic = new UpgradeCosts.Row[5] { new UpgradeCosts.Row("BlackMetal", 20, 7), new UpgradeCosts.Row("Eitr", 10, 3), new UpgradeCosts.Row("Thunderstone", 4, 1), new UpgradeCosts.Row("Coins", 200, 50), new UpgradeCosts.Row("TrophyEikthyr", 1, 0) }, Craft = "BlackMetal:20, Eitr:10, Thunderstone:4, TrophyEikthyr:1", Level2 = "BlackMetal:7, Eitr:3, Thunderstone:1, Coins:100", Level3 = "FlametalNew:10, Eitr:6, Thunderstone:2, Coins:200", Level4 = "FaderDrop:1, FlametalNew:15, GemstoneBlue:1, Thunderstone:4", Where2 = "$oly_where_mistlands", Where3 = "$oly_where_ashlands", Where4 = "$oly_where_fader" }; public static void BindConfig(ConfigFile cfg) { //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) _slash = Cfg.Baked(cfg, "Blade of Olympus", "Slash damage", 125f, "Base slash damage (Krom: 150)."); _slashPerLevel = Cfg.Baked(cfg, "Blade of Olympus", "Slash per upgrade", 6f, "Extra slash damage per quality level."); _lightning = Cfg.Baked(cfg, "Blade of Olympus", "Lightning damage", 35f, "Base lightning damage."); _lightningPerLevel = Cfg.Baked(cfg, "Blade of Olympus", "Lightning per upgrade", 5f, "Extra lightning damage per quality level."); _chainChance = Cfg.Baked(cfg, "Blade of Olympus", "Chain lightning chance", 0.2f, "Chance per hit for the primary attack to chain lightning to nearby enemies.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f)); _chainChanceSecondary = Cfg.Baked(cfg, "Blade of Olympus", "Divine Reckoning chain chance", 1f, "Chance per enemy hit by the heavy slam to release chain lightning.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f)); _chainDamage = Cfg.Baked(cfg, "Blade of Olympus", "Chain lightning damage", 60f, "Lightning damage of each chain jump."); _chainJump = Cfg.Baked(cfg, "Blade of Olympus", "Chain jump chance", 1f, "Chance for chain lightning to jump on to each nearby enemy (vanilla weapons: 0.3).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f)); _slamDamage = Cfg.Baked(cfg, "Blade of Olympus", "Divine Reckoning damage multiplier", 1.5f, "Damage of the heavy slam relative to a normal hit."); _slamStamina = Cfg.Baked(cfg, "Blade of Olympus", "Divine Reckoning stamina", 35f, "Stamina cost of the heavy slam."); _slamRadius = Cfg.Baked(cfg, "Blade of Olympus", "Divine Reckoning radius", 4f, "Radius (m) of the slam's impact area."); Cfg.Migrate(_slash, 155f, 125f, "0.4.0"); Cfg.Migrate(_slamDamage, 2f, 1.5f, "0.4.0"); _glowIntensity = cfg.Bind<float>("Blade of Olympus", "Glow light intensity", 1.2f, "Brightness of the blade's light (0 = off)."); OlympusUnlocks.BindConfig(cfg); ModelOffset = Cfg.Advanced<Vector3>(cfg, "Debug: model fit", "Olympus offset", new Vector3(0f, 0f, 0f), "Model position in the hand (use oly_tune in game)."); ModelEuler = Cfg.Advanced<Vector3>(cfg, "Debug: model fit", "Olympus rotation", Vector3.zero, "Extra model rotation in degrees."); ModelScale = Cfg.Advanced(cfg, "Debug: model fit", "Olympus scale", 1.1f, "Model scale."); } public static ModelSpec Spec() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) return new ModelSpec { Obj = "blade_of_olympus.obj", MeshChild = "attach/Krom", Offset = ModelOffset.Value, Euler = ModelEuler.Value, Scale = ModelScale.Value, TrailBase = 0.2f, TrailTip = 1.3f, GlowLight = new Color(0.55f, 0.85f, 1f, 1f), GlowIntensity = _glowIntensity.Value, GlowRange = 3f, GlowAt = 0.75f, Surfaces = Surfaces(1), LookKey = "Olympus", SurfacesFor = Surfaces }; } private static Dictionary<string, SurfaceSpec> Surfaces(int q) { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) q = Quality.Clamp(q); float num = QualityLooks.K(q); string texture = ((q >= 2) ? WeaponVisuals.TextureOr("OLY_Olympus_Blade_Q" + q, "OLY_Olympus_Blade") : "OLY_Olympus_Blade"); string emissionTexture = ((q >= 2) ? WeaponVisuals.TextureOr("OLY_Olympus_Blade_Glow_Q" + q, "OLY_Olympus_Blade_Glow") : "OLY_Olympus_Blade_Glow"); Color metalColor = default(Color); ((Color)(ref metalColor))..ctor(1f, 0.82f, 0.45f); Color metalColor2 = default(Color); ((Color)(ref metalColor2))..ctor(0.92f, 0.95f, 1f); float num2 = EdgeStrength[q - 1] * num; return new Dictionary<string, SurfaceSpec> { ["OLY_OlyBlade"] = new SurfaceSpec { Texture = texture, Metallic = 0.8f, Glossiness = 0.5f, MetalColor = Color.white, EmissionTexture = emissionTexture, Emission = Color.white * (2f * num) }, ["OLY_OlySilver"] = new SurfaceSpec { Texture = "OLY_Olympus_Silver", Metallic = 0.85f, Glossiness = 0.6f, MetalColor = metalColor2 }, ["OLY_OlyGold"] = new SurfaceSpec { Texture = "OLY_Olympus_Gold", Metallic = 0.8f, Glossiness = 0.5f, MetalColor = metalColor }, ["OLY_OlySteel"] = new SurfaceSpec { Texture = "OLY_Olympus_Steel", Metallic = 0.85f, Glossiness = 0.55f, MetalColor = metalColor2 }, ["OLY_OlyLeather"] = new SurfaceSpec { Texture = "OLY_Olympus_Leather", Metallic = 0f, Glossiness = 0.15f }, ["OLY_OlyGlow"] = new SurfaceSpec { Texture = "OLY_Olympus_Glow", Emission = Lightning * (GlowStrength[q - 1] * num) }, ["OLY_OlyEdge"] = new SurfaceSpec { Texture = WeaponVisuals.TextureOr("OLY_Olympus_Edge", "OLY_Olympus_Silver"), Metallic = 0.85f, Glossiness = 0.6f, MetalColor = metalColor2, Emission = ((num2 > 0f) ? (Lightning * num2) : Color.black) }, ["OLY_Gold"] = new SurfaceSpec { Texture = "OLY_Olympus_Gold", Metallic = 0.8f, Glossiness = 0.55f, MetalColor = metalColor }, ["OLY_Engraved"] = new SurfaceSpec { Texture = WeaponVisuals.TextureOr("OLY_Olympus_Engraved", "OLY_Olympus_Gold"), Metallic = 0.75f, Glossiness = 0.45f, MetalColor = new Color(1f, 0.8f, 0.42f) }, ["OLY_Silver"] = new SurfaceSpec { Texture = "OLY_Olympus_Silver", Metallic = 0.85f, Glossiness = 0.65f, MetalColor = metalColor2 }, ["OLY_Glow"] = new SurfaceSpec { Texture = "OLY_Olympus_Glow", Emission = new Color(0.9f, 1.6f, 2.4f) } }; } public static void Register() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) ItemConfig val = new ItemConfig { Name = "$item_oly_bladeofolympus", Description = "$item_oly_bladeofolympus_description", CraftingStation = CraftingStations.BlackForge, MinStationLevel = 1 }; UpgradeCosts.AddClassicRows(val, Costs); CustomItem val2 = new CustomItem("OLY_BladeOfOlympus", "THSwordKrom", val); if ((Object)(object)val2.ItemPrefab == (Object)null) { Logger.LogError((object)"could not clone THSwordKrom"); return; } CustomRecipe recipe = val2.Recipe; if (Object.op_Implicit((Object)(object)((recipe != null) ? recipe.Recipe : null))) { Recipe recipe2 = val2.Recipe.Recipe; ((Object)recipe2).hideFlags = (HideFlags)(((Object)recipe2).hideFlags | 0x20); } if (!ItemManager.Instance.AddItem(val2)) { Logger.LogError((object)"could not register OLY_BladeOfOlympus"); return; } UpgradeCosts.Apply(val2, Costs); SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_damages.m_slash = _slash.Value; shared.m_damages.m_lightning = _lightning.Value; shared.m_damagesPerLevel.m_slash = _slashPerLevel.Value; shared.m_damagesPerLevel.m_lightning = _lightningPerLevel.Value; shared.m_hitVariant = -1; shared.m_maxQuality = 4; shared.m_hitEffect = Effects.With(shared.m_hitEffect, "fx_lightningweapon_hit", "sfx_weapons_lightning_impact"); GameObject val3 = CreateChainLightning(); if (Object.op_Implicit((Object)(object)val3)) { shared.m_attack.m_spawnOnHit = val3; shared.m_attack.m_spawnOnHitChance = _chainChance.Value; } OlympusUnlocks.Register(val3); Attack val4 = CreateDivineReckoning(val3); if (val4 != null) { shared.m_secondaryAttack = val4; AreaAttackOverride.Register("Olympus", IsOurs, OlympusReckoning.Execute); if (!AreaAttackOverride.Installed) { Logger.LogWarning((object)"area-attack override not installed: Divine Reckoning keeps the vanilla area attack (it also hits buildings; no Storm strike or Wrath of Olympus)"); } } if (!Object.op_Implicit((Object)(object)shared.m_equipStatusEffect)) { UnlockTooltips.Register(1, OlympusUnlocks.TooltipLines); shared.m_equipStatusEffect = (StatusEffect)(object)UnlockTooltips.CreateInfoSE<SE_OLY_UnlockInfo>("SE_OLY_OlympusPower", 1, "$oly_olympus_power"); } UpgradeCosts.RegisterTooltip(Costs); WeaponVisuals.Apply(val2.ItemPrefab, Spec()); string text = WeaponVisuals.FindAsset("Icons", "icon_blade_of_olympus.png"); Sprite val5 = ((text != null) ? AssetUtils.LoadSpriteFromFile(text) : null); if (Object.op_Implicit((Object)(object)val5)) { shared.m_icons = (Sprite[])(object)new Sprite[1] { val5 }; } else { Logger.LogWarning((object)"Blade of Olympus icon not found; keeping Krom's"); } } private static Attack CreateDivineReckoning(GameObject chain) { GameObject prefab = Cache.GetPrefab<GameObject>("SledgeIron"); Attack val = ((!Object.op_Implicit((Object)(object)prefab)) ? null : prefab.GetComponent<ItemDrop>()?.m_itemData?.m_shared?.m_attack); if (val == null) { Logger.LogWarning((object)"SledgeIron not found; keeping Krom's heavy attack"); return null; } Attack val2 = Effects.CloneAttack(val); val2.m_damageMultiplier = _slamDamage.Value; val2.m_attackStamina = _slamStamina.Value; val2.m_attackRayWidth = _slamRadius.Value; val2.m_forceMultiplier = 2f; val2.m_staggerMultiplier = 3f; val2.m_startEffect = Effects.With(val.m_startEffect, "sfx_StaffLightning_charge"); val2.m_triggerEffect = Effects.With(val.m_triggerEffect, "fx_eikthyr_stomp", "fx_himminafl_hit", "sfx_staffthunderblood_thunder"); if (Object.op_Implicit((Object)(object)chain)) { val2.m_spawnOnHit = chain; val2.m_spawnOnHitChance = _chainChanceSecondary.Value; } return val2; } private static GameObject CreateChainLightning() { GameObject val = PrefabManager.Instance.CreateClonedPrefab("OLY_ChainLightning_Olympus", "ChainLightning"); if (!Object.op_Implicit((Object)(object)val)) { Logger.LogWarning((object)"ChainLightning not found; Blade of Olympus will hit without chain lightning"); return null; } Aoe component = val.GetComponent<Aoe>(); if (Object.op_Implicit((Object)(object)component)) { component.m_chainObj = val; component.m_hitVariant = -1; component.m_damage.m_lightning = _chainDamage.Value; component.m_chainStartChance = 1f; component.m_chainChancePerTarget = _chainJump.Value; } PrefabManager.Instance.AddPrefab(val); return val; } public static bool IsOurs(ItemData item) { if (item?.m_shared != null) { if (!Object.op_Implicit((Object)(object)item.m_dropPrefab) || !(((Object)item.m_dropPrefab).name == "OLY_BladeOfOlympus")) { return item.m_shared.m_name == "$item_oly_bladeofolympus"; } return true; } return false; } } internal static class BladesOfChaos { internal enum EyeGemColour { Ember, Blood } private sealed class RingHeat { public Mesh Mesh; public Material[] Mats; } public const string Prefab = "OLY_BladesOfChaos"; public const string Token = "$item_oly_bladesofchaos"; private const string BasePrefab = "KnifeSkollAndHati"; private const string Obj = "blades_of_chaos.obj"; private static readonly Vector3 HiltLocal = new Vector3(0f, -0.11f, 0f); private static readonly Quaternion MeshInHand = new Quaternion(0f, 0.7071068f, 0.7071068f, 0f); private const string LookKey = "chaos"; private const string RingKey = "chaosring"; private const string RingObj = "blades_of_chaos_ringheat.obj"; private const int RingFrom = 3; private const string PowerSE = "SE_OLY_ChaosPower"; private static ConfigEntry<float> _slash; private static ConfigEntry<float> _slashPerLevel; private static ConfigEntry<float> _fire; private static ConfigEntry<float> _firePerLevel; private static ConfigEntry<float> _reach; private static ConfigEntry<float> _spinStamina; private static ConfigEntry<float> _spinRange; private static ConfigEntry<float> _spinRangeLow; private static ConfigEntry<float> _lightIntensity; internal static ConfigEntry<Vector3> OffsetR; internal static ConfigEntry<Vector3> OffsetL; internal static ConfigEntry<Vector3> EulerR; internal static ConfigEntry<Vector3> EulerL; internal static ConfigEntry<float> ModelScale; internal static ConfigEntry<bool> Chains; internal static ConfigEntry<float> WrapRadius; internal static ConfigEntry<float> WrapArmour; internal static ConfigEntry<float> ChainWidth; internal static ConfigEntry<bool> SpinFlyOut; internal static ConfigEntry<ChainGlowStyle> ChainGlow; internal static ConfigEntry<bool> FlamesOnlyWhenFighting; internal static ConfigEntry<float> FlamesLinger; internal static ConfigEntry<Vector3> BackOffset; internal static ConfigEntry<Vector3> BackEuler; internal static ConfigEntry<float> BackSpread; private static ConfigEntry<bool> _scareFire; private static ConfigEntry<bool> _warmth; private static ConfigEntry<bool> _warmthSheathed; private static Transform s_backCross; private static Transform s_groundCross; public static readonly Dictionary<string, string> English = new Dictionary<string, string> { { "item_oly_bladesofchaos", "Blades of Chaos" }, { "item_oly_bladesofchaos_description", "Twin blades forged in the fires of the underworld, chained to their bearer's arms. They strike from afar and set foes ablaze. Upgrading them awakens their powers." }, { "se_oly_chaospower", "Powers of Chaos" }, { "oly_chaos_level", "Level {0}" }, { "oly_chaos_locked", "not yet unlocked" }, { "oly_chaos_hotter", "Hotter flames: burns last {0} s, +{1}% fire damage" }, { "oly_chaos_ember", "Ember burst: every {0} hits on one enemy set off a fire burst around it" }, { "oly_chaos_cyclone", "Cyclone of Chaos: the spin flings the blades out on their chains" }, { "se_oly_chaosflame", "Chaos flames" } }; private static ConfigEntry<EyeGemColour> _eyeGem; private const float DefaultRuneGlow = 1.5f; internal static ConfigEntry<float> RuneGlowLevel; internal static readonly UpgradeCosts.Path Costs = new UpgradeCosts.Path { Prefab = "OLY_BladesOfChaos", Weapon = "Blades of Chaos", WeaponId = 2, Classic = new UpgradeCosts.Row[4] { new UpgradeCosts.Row("Iron", 16, 5), new UpgradeCosts.Row("Chain", 3, 0), new UpgradeCosts.Row("SurtlingCore", 3, 1), new UpgradeCosts.Row("LeatherScraps", 4, 2) }, Craft = "Iron:16, Chain:3, SurtlingCore:3, LeatherScraps:4", Level2 = "Iron:5, SurtlingCore:1, LeatherScraps:2", Level3 = "Silver:10, Obsidian:5, SurtlingCore:2", Level4 = "BlackMetal:15, Silver:5, SurtlingCore:4", Where2 = "$oly_where_swamp", Where3 = "$oly_where_mountains", Where4 = "$oly_where_plains" }; private const float GripApart = 0.03f; private const float CrossDepth = 0.02f; private const float DefaultSpread = 68f; private static Color RuneGlow { get { //IL_001a: Unknown result type (might be due to invalid IL or missing references) float num = ((RuneGlowLevel != null) ? RuneGlowLevel.Value : 1.5f); return new Color(num, num, num); } } public static void BindConfig(ConfigFile cfg) { //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Expected O, but got Unknown //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Expected O, but got Unknown //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Expected O, but got Unknown //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) _slash = Cfg.Baked(cfg, "Blades of Chaos", "Slash damage", 40f, "Base slash damage."); _slashPerLevel = Cfg.Baked(cfg, "Blades of Chaos", "Slash per upgrade", 4f, "Extra slash damage per quality level."); _fire = Cfg.Baked(cfg, "Blades of Chaos", "Fire damage", 20f, "Base fire damage (sets enemies burning)."); _firePerLevel = Cfg.Baked(cfg, "Blades of Chaos", "Fire per upgrade", 3f, "Extra fire damage per quality level."); _reach = Cfg.Baked(cfg, "Blades of Chaos", "Reach", 4.5f, "Reach of the whip-like primary attack in metres (vanilla knives: ~1.8)."); _spinStamina = Cfg.Baked(cfg, "Blades of Chaos", "Cyclone of Chaos stamina", 30f, "Stamina cost of the 360° spin."); _spinRange = Cfg.Synced(cfg, "Blades of Chaos", "Cyclone of Chaos range", 4.5f, "Radius (m) of the full Cyclone of Chaos, where the blades are thrown out on their chains."); _spinRangeLow = Cfg.Synced(cfg, "Blades of Chaos", "Spin range below Cyclone level", 3f, "Radius (m) of the ordinary spin before the Cyclone unlocks, or with it switched off (vanilla atgeir spin: 3)."); ChaosUnlocks.BindConfig(cfg, "Blades of Chaos"); _lightIntensity = Cfg.Baked(cfg, "Blades of Chaos", "Fire light intensity", 0.8f, "Brightness of each blade's firelight (0 = off). At 1, two blades together are about as bright as a torch."); Cfg.Migrate(_lightIntensity, 1f, 0.8f, "1.0.0"); FlamesOnlyWhenFighting = Cfg.Local(cfg, "Blades of Chaos", "Flames only when fighting", def: true, "Show the fire along the blades only while you fight: it flares up when a blade hits a creature (and during the spin), stays for \"Flames linger\" seconds after the last hit and goes out again, so the blades' pattern shows while you walk. The firelight, the fire that keeps animals away and the warmth stay as they are. Off: the blades burn all the time, as before. Changes live; your own view (what other players see follows their setting)."); FlamesLinger = Cfg.Local(cfg, "Blades of Chaos", "Flames linger", 6f, "Seconds the flames keep burning after your last hit on a creature.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 60f)); _warmth = Cfg.Synced(cfg, "Blades of Chaos", "Warmth", def: true, "While equipped, the blades' fire keeps you warm: no Cold or Freezing (like the wolf cape), which also means frost resistance."); _warmthSheathed = Cfg.Synced(cfg, "Blades of Chaos", "Warmth while sheathed", def: true, "Keep the warmth while the blades are on your back, not only while drawn."); _warmth.SettingChanged += delegate { ChaosWarmth.Enabled = _warmth.Value; }; _warmthSheathed.SettingChanged += delegate { ChaosWarmth.WhileSheathed = _warmthSheathed.Value; }; ChaosWarmth.Enabled = _warmth.Value; ChaosWarmth.WhileSheathed = _warmthSheathed.Value; _eyeGem = cfg.Bind<EyeGemColour>("Blades of Chaos", "Eye gem", EyeGemColour.Ember, "Colour of the glowing gems in the guards' eye sockets."); _eyeGem.SettingChanged += delegate { QualityLooks.Refresh("chaos"); }; RuneGlowLevel = Cfg.Local(cfg, "Blades of Chaos", "Rune glow", 1.5f, "Brightness of the ember Greek key cut into the blades (and of the heated edge from level 2). It glows all the time, flames or not; 0 = off. Changes live.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 4f)); RuneGlowLevel.SettingChanged += delegate { QualityLooks.Refresh("chaos"); }; _scareFire = Cfg.Baked(cfg, "Blades of Chaos", "Scare fire-fearing creatures", def: true, "While drawn, the blades count as fire like a carried torch: creatures that fear fire keep away."); Chains = cfg.Bind<bool>("Blades of Chaos", "Show chains", true, "Draw the chains from the forearms to the blades."); WrapRadius = cfg.Bind<float>("Blades of Chaos", "Chain wrap radius", 0.07f, new ConfigDescription("How far (m) the chain wraps out from the forearm bone. Raise it if the chain sinks into your arms.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.03f, 0.15f), Array.Empty<object>())); Cfg.Migrate(WrapRadius, 0.058f, 0.07f, "1.0.0"); ChainWidth = cfg.Bind<float>("Blades of Chaos", "Chain thickness", 0.045f, new ConfigDescription("Thickness (m) of the chains.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.015f, 0.12f), Array.Empty<object>())); SpinFlyOut = cfg.Bind<bool>("Blades of Chaos", "Cyclone blades fly out", true, "During Cyclone of Chaos the blades fly out on their chains to the spin's damage radius."); WrapArmour = cfg.Bind<float>("Blades of Chaos", "Chain wrap extra with chest armour", 0.046f, new ConfigDescription("Extra wrap radius (m) while chest armour (which covers the arms) is worn.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.1f), Array.Empty<object>())); Cfg.Migrate(WrapArmour, 0.016f, 0.046f, "1.0.0"); ChainGlow = cfg.Bind<ChainGlowStyle>("Blades of Chaos", "Chain glow", ChainGlowStyle.Links, "With Looks / Upgrade looks on, the chains glow from the pommel out from level 2 (level 4: the whole chain). Links: each heated link glows in its own shape. Band: a glowing core down the middle of the chain (try it if the glowing links don't sit on the chain's links). Off: no chain glow. Changes live."); OffsetR = Cfg.Advanced<Vector3>(cfg, "Debug: model fit", "Chaos right offset", Vector3.zero, "Right blade position in the hand (oly_tune chaosR)."); EulerR = Cfg.Advanced<Vector3>(cfg, "Debug: model fit", "Chaos right rotation", Vector3.zero, "Right blade extra rotation (degrees)."); OffsetL = Cfg.Advanced<Vector3>(cfg, "Debug: model fit", "Chaos left offset", Vector3.zero, "Left blade position in the hand (oly_tune chaosL)."); EulerL = Cfg.Advanced<Vector3>(cfg, "Debug: model fit", "Chaos left rotation", Vector3.zero, "Left blade extra rotation (degrees)."); ModelScale = Cfg.Advanced(cfg, "Debug: model fit", "Chaos scale", 1f, "Blade scale in the hands."); BackOffset = Cfg.Advanced<Vector3>(cfg, "Debug: model fit", "Chaos back offset", new Vector3(0f, 0.1f, 0f), "Where the crossed blades sit on your back, in metres from the back slot: x = to your right, y = up, z = forward (into the back). (0, 0, 0) = the blades cross right at the slot. Changes live."); BackEuler = Cfg.Advanced<Vector3>(cfg, "Debug: model fit", "Chaos back rotation", Vector3.zero, "Extra turn of the crossed blades, in degrees: x tilts the tips towards (+) or away from (-) your back, y turns the pair about the vertical, z leans the whole X to your left (+) or right (-). (0, 0, 0) = upright and flat on the back, like the inventory icon. Changes live."); BackSpread = Cfg.Advanced(cfg, "Debug: model fit", "Chaos back spread", 68f, "Angle (degrees) between the two sheathed blades (also on the ground and on item stands): 68 = the inventory icon's X, 34 degrees each side of vertical. Changes live.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 150f)); BackOffset.SettingChanged += delegate { RefreshBack(); }; BackEuler.SettingChanged += delegate { RefreshBack(); }; BackSpread.SettingChanged += delegate { RefreshBack(); }; PushRigSettings(); FlamesOnlyWhenFighting.SettingChanged += delegate { PushRigSettings(); }; FlamesLinger.SettingChanged += delegate { PushRigSettings(); }; OffsetR.SettingChanged += delegate { PushRigSettings(); }; OffsetL.SettingChanged += delegate { PushRigSettings(); }; EulerR.SettingChanged += delegate { PushRigSettings(); }; EulerL.SettingChanged += delegate { PushRigSettings(); }; ModelScale.SettingChanged += delegate { PushRigSettings(); }; Chains.SettingChanged += delegate { PushRigSettings(); }; WrapRadius.SettingChanged += delegate { PushRigSettings(); }; WrapArmour.SettingChanged += delegate { PushRigSettings(); }; ChainWidth.SettingChanged += delegate { PushRigSettings(); }; SpinFlyOut.SettingChanged += delegate { PushRigSettings(); }; ChainGlow.SettingChanged += delegate { PushRigSettings(); }; _spinRange.SettingChanged += delegate { PushRigSettings(); }; ChaosUnlocks.Cyclone.On.SettingChanged += delegate { PushRigSettings(); }; ChaosUnlocks.Cyclone.Level.SettingChanged += delegate { PushRigSettings(); }; } private static SurfaceSpec GemSurface() { //IL_0070: 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_0075: Unknown result type (might be due to invalid IL or missing references) bool flag = _eyeGem != null && _eyeGem.Value == EyeGemColour.Blood; return new SurfaceSpec { Texture = (flag ? "OLY_Chaos_Gem_Blood" : "OLY_Chaos_Gem"), EmissionTexture = (flag ? "OLY_Chaos_GemGlow_Blood" : "OLY_Chaos_GemGlow"), Emission = (flag ? new Color(1.8f, 1.8f, 1.8f) : new Color(1.5f, 1.5f, 1.5f)), Metallic = 0f, Glossiness = 0.6f }; } public static void PushRigSettings() { //IL_0005: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) ChaosBladesRig.OffsetR = OffsetR.Value; ChaosBladesRig.OffsetL = OffsetL.Value; ChaosBladesRig.EulerR = EulerR.Value; ChaosBladesRig.EulerL = EulerL.Value; ChaosBladesRig.Scale = ModelScale.Value; ChaosBladesRig.ChainsOn = Chains.Value; ChaosBladesRig.WrapRadius = WrapRadius.Value; ChaosBladesRig.WrapArmourExtra = WrapArmour.Value; ChaosBladesRig.ChainWidth = ChainWidth.Value; ChaosBladesRig.SpinFlyOut = SpinFlyOut.Value; ChaosBladesRig.SpinReach = _spinRange.Value; ChaosBladesRig.CycloneOn = ChaosUnlocks.Cyclone.On.Value; ChaosBladesRig.CycloneLevel = ChaosUnlocks.Cyclone.Level.Value; if (ChainGlow != null) { ChaosChainHeat.Style = ChainGlow.Value; } if (FlamesOnlyWhenFighting != null) { ChaosBladesRig.FlamesGated = FlamesOnlyWhenFighting.Value; } if (FlamesLinger != null) { ChaosBladesRig.FlamesLinger = FlamesLinger.Value; } } private static Dictionary<string, SurfaceSpec> Surfaces() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) return new Dictionary<string, SurfaceSpec> { ["OLY_ChaosSteel"] = new SurfaceSpec { Texture = "OLY_Chaos_Steel", Metallic = 0.45f, Glossiness = 0.25f, MetalColor = new Color(0.9f, 0.85f, 0.8f), EmissionTexture = "OLY_Chaos_SteelGlow", Emission = RuneGlow }, ["OLY_ChaosGem"] = GemSurface(), ["OLY_ChaosEdge"] = new SurfaceSpec { Texture = "OLY_Chaos_Edge", Metallic = 0.6f, Glossiness = 0.4f, MetalColor = new Color(0.95f, 0.95f, 0.95f) }, ["OLY_ChaosIron"] = new SurfaceSpec { Texture = "OLY_Chaos_Iron", Metallic = 0.7f, Glossiness = 0.35f, MetalColor = new Color(0.85f, 0.85f, 0.85f) }, ["OLY_ChaosLeather"] = new SurfaceSpec { Texture = "OLY_Chaos_Leather", Metallic = 0f, Glossiness = 0.15f } }; } private static Dictionary<string, SurfaceSpec> SurfacesFor(int level) { //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) Dictionary<string, SurfaceSpec> dictionary = Surfaces(); int num = Quality.Clamp(level); if (num > 1 && dictionary.TryGetValue("OLY_ChaosSteel", out var value) && WeaponVisuals.HasTexture("OLY_Chaos_Steel_Q" + num) && WeaponVisuals.HasTexture("OLY_Chaos_SteelGlow_Q" + num)) { value.Texture = "OLY_Chaos_Steel_Q" + num; value.EmissionTexture = "OLY_Chaos_SteelGlow_Q" + num; } float num2 = QualityLooks.K(num); if (num2 != 1f) { string[] array = new string[2] { "OLY_ChaosSteel", "OLY_ChaosGem" }; foreach (string key in array) { if (dictionary.TryGetValue(key, out var value2)) { value2.Emission = new Color(value2.Emission.r * num2, value2.Emission.g * num2, value2.Emission.b * num2, value2.Emission.a); } } } return dictionary; } private static float FlameScale(int quality) { if (!QualityLooks.Enabled || !ChaosUnlocks.Hotter.At(quality)) { return 1f; } return ChaosUnlocks.HotFlameSize.Value; } public static void Register() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) ItemConfig val = new ItemConfig { Name = "$item_oly_bladesofchaos", Description = "$item_oly_bladesofchaos_description", CraftingStation = CraftingStations.Forge, MinStationLevel = 2 }; UpgradeCosts.AddClassicRows(val, Costs); CustomItem val2 = new CustomItem("OLY_BladesOfChaos", "KnifeSkollAndHati", val); if ((Object)(object)val2.ItemPrefab == (Object)null) { Logger.LogError((object)"could not clone KnifeSkollAndHati"); return; } CustomRecipe recipe = val2.Recipe; if (Object.op_Implicit((Object)(object)((recipe != null) ? recipe.Recipe : null))) { Recipe recipe2 = val2.Recipe.Recipe; ((Object)recipe2).hideFlags = (HideFlags)(((Object)recipe2).hideFlags | 0x20); } if (!ItemManager.Instance.AddItem(val2)) { Logger.LogError((object)"could not register OLY_BladesOfChaos"); return; } UpgradeCosts.Apply(val2, Costs); SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_damages.m_slash = _slash.Value; shared.m_damages.m_pierce = 0f; shared.m_damages.m_fire = _fire.Value; shared.m_damagesPerLevel.m_slash = _slashPerLevel.Value; shared.m_damagesPerLevel.m_pierce = 0f; shared.m_damagesPerLevel.m_fire = _firePerLevel.Value; shared.m_hitVariant = 0; shared.m_maxQuality = 4; shared.m_attachOverride = (ItemType)5; shared.m_weight = 2f; Attack attack = shared.m_attack; attack.m_attackRange = _reach.Value; attack.m_attackAngle = 100f; attack.m_attackRayWidth = 0.35f; attack.m_attackHeight = 0.8f; attack.m_attackRayWidthCharExtra = 0.2f; attack.m_attackHeightChar1 = -0.55f; attack.m_attackHeightChar2 = 1f; attack.m_maxYAngle = 20f; GameObject prefab = Cache.GetPrefab<GameObject>("AtgeirIron"); Attack val3 = ((!Object.op_Implicit((Object)(object)prefab)) ? null : prefab.GetComponent<ItemDrop>()?.m_itemData?.m_shared?.m_secondaryAttack); if (val3 != null) { Attack val4 = Effects.CloneAttack(val3); val4.m_attackRange = _spinRangeLow.Value; val4.m_attackStamina = _spinStamina.Value; shared.m_secondaryAttack = val4; } else { Logger.LogWarning((object)"AtgeirIron not found; Blades of Chaos keep Skoll and Hati's secondary"); } BuildVisuals(val2.ItemPrefab); string text = WeaponVisuals.FindAsset("Icons", "icon_blades_of_chaos.png"); Sprite val5 = ((text != null) ? AssetUtils.LoadSpriteFromFile(text) : null); if (Object.op_Implicit((Object)(object)val5)) { shared.m_icons = (Sprite[])(object)new Sprite[1] { val5 }; } ChaosWarmth.Register(Object.op_Implicit((Object)(object)val5) ? val5 : shared.m_icons[0]); SE_OLY_Power equipStatusEffect = UnlockTooltips.CreateInfoSE<SE_OLY_Power>("SE_OLY_ChaosPower", 2, "$se_oly_chaospower"); shared.m_equipStatusEffect = (StatusEffect)(object)equipStatusEffect; SE_OLY_Power.RegisterHitHook(2, IsOurs, OnHit); UnlockTooltips.Register(2, ChaosUnlocks.TooltipLines); UpgradeCosts.RegisterTooltip(Costs); ChaosUnlocks.Register(); } private static void OnHit(SE_OLY_Power se, Player p, ItemData weapon, Character target, ref HitData hit) { ChaosUnlocks.OnHit(se, p, weapon, target, ref hit); if (Object.op_Implicit((Object)(object)target)) { ChaosBladesRig.MarkHot(p); } } private static void BuildVisuals(GameObject prefab) { //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) if (!WeaponVisuals.LoadModel("blades_of_chaos.obj", out var mesh, out var names)) { return; } Transform obj = prefab.transform.Find("attach/skoll"); object obj2; if (obj == null) { obj2 = null; } else { MeshRenderer component = ((Component)obj).GetComponent<MeshRenderer>(); obj2 = ((component != null) ? ((Renderer)component).sharedMaterial : null); } Material val = (Material)obj2; if (!Object.op_Implicit((Object)(object)val)) { Logger.LogError((object)"Skoll and Hati material not found"); return; } Material[] mats = QualityLooks.Build("chaos", val, names, SurfacesFor)[0]; RingHeat ring = BuildRingHeat(val); GameObject prefab2 = Cache.GetPrefab<GameObject>("SwordDyrnwyn"); GameObject prefab3 = Cache.GetPrefab<GameObject>("SwordIronFire"); Transform val2 = prefab.transform.Find("attach_skin"); if (Object.op_Implicit((Object)(object)val2)) { for (int num = val2.childCount - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)((Component)val2.GetChild(num)).gameObject); } Animator component2 = ((Component)val2).GetComponent<Animator>(); if (Object.op_Implicit((Object)(object)component2)) { Object.DestroyImmediate((Object)(object)component2); } List<Renderer> list = new List<Renderer>(); List<Light> list2 = new List<Light>(); List<ParticleSystem> list3 = new List<ParticleSystem>(); MakeHandBlade(val2, "blade_R", mesh, mats, prefab2, prefab3, withLight: true, list, list2, list3, ring); MakeHandBlade(val2, "blade_L", mesh, mats, prefab2, prefab3, withLight: true, list, list2, list3, ring); MakeEquipped(val2); LineRenderer val3 = MakeChain(val2, "chain_R"); MakeChain(val2, "chain_L"); ChaosChainHeat.Setup(Cache.GetPrefab<Material>("red_trail") ?? Cache.GetPrefab<Material>("club_trail"), Object.op_Implicit((Object)(object)val3) ? ((Renderer)val3).sharedMaterial : null); ((Component)val2).gameObject.AddComponent<ChaosBladesRig>(); QualityLooks.Attach(val2, "chaos", list.ToArray(), list2.ToArray(), list3.ToArray(), FlameScale); } Transform val4 = prefab.transform.Find("attach"); if (Object.op_Implicit((Object)(object)val4)) { Renderer[] componentsInChildren = ((Component)val4).GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } Collider[] componentsInChildren2 = ((Component)val4).GetComponentsInChildren<Collider>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { componentsInChildren2[i].enabled = false; } List<Renderer> list4 = new List<Renderer>(); s_groundCross = BuildCross(val4, mesh, mats, ring, withCollider: true, list4); s_groundCross.localRotation = MeshInHand; QualityLooks.Attach(val4, "chaos", list4.ToArray()); Transform val5 = prefab.transform.Find("attach_back"); if (Object.op_Implicit((Object)(object)val5)) { Object.DestroyImmediate((Object)(object)((Component)val5).gameObject); } GameObject val6 = new GameObject("attach_back") { layer = ((Component)val4).gameObject.layer }; val6.SetActive(false); val6.transform.SetParent(prefab.transform, false); val6.transform.SetAsFirstSibling(); List<Renderer> list5 = new List<Renderer>(); s_backCross = BuildCross(val6.transform, mesh, mats, ring, withCollider: false, list5); QualityLooks.Attach(val6.transform, "chaos", list5.ToArray()); ApplyBackPose(); } } private static Transform BuildCross(Transform parent, Mesh mesh, Material[] mats, RingHeat ring, bool withCollider, List<Renderer> renderers) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) int layer = ((Component)parent).gameObject.layer; GameObject val = new GameObject("OLY_cross") { layer = layer }; val.transform.SetParent(parent, false); for (int i = 0; i < 2; i++) { GameObject val2 = new GameObject((i == 0) ? "OLY_static_R" : "OLY_static_L") { layer = layer }; val2.transform.SetParent(val.transform, false); val2.AddComponent<MeshFilter>().sharedMesh = mesh; MeshRenderer val3 = val2.AddComponent<MeshRenderer>(); ((Renderer)val3).sharedMaterials = mats; renderers.Add((Renderer)(object)val3); if (i == 0 && withCollider) { BoxCollider obj = val2.AddComponent<BoxCollider>(); Bounds bounds = mesh.bounds; obj.center = ((Bounds)(ref bounds)).center; bounds = mesh.bounds; obj.size = Vector3.Max(((Bounds)(ref bounds)).size, Vector3.one * 0.03f); } AddRingHeat(val2.transform, ring); } LayoutCross(val.transform, (BackSpread != null) ? BackSpread.Value : 68f); return val.transform; } private static void LayoutCross(Transform pivot, float spread) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)pivot)) { float num = Mathf.Clamp(spread, 1f, 179f) * 0.5f; float num2 = 0.03f / Mathf.Tan(num * ((float)Math.PI / 180f)); Transform val = pivot.Find("OLY_static_R"); Transform val2 = pivot.Find("OLY_static_L"); if (Object.op_Implicit((Object)(object)val)) { val.localPosition = new Vector3(-0.03f, 0f - num2, -0.02f); val.localRotation = Quaternion.Euler(0f, 0f, 0f - num); } if (Object.op_Implicit((Object)(object)val2)) { val2.localPosition = new Vector3(0.03f, 0f - num2, 0.02f); val2.localRotation = Quaternion.Euler(0f, 0f, num) * Quaternion.Euler(0f, 180f, 0f); } } } private static void ApplyBackPose() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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) float spread = ((BackSpread != null) ? BackSpread.Value : 68f); LayoutCross(s_groundCross, spread); LayoutCross(s_backCross, spread); if (Object.op_Implicit((Object)(object)s_backCross)) { SheathPose.Pose(s_backCross, SheathPose.BackShieldJoint, Quaternion.identity, Vector3.zero, (Vector3)((BackOffset != null) ? BackOffset.Value : new Vector3(0f, 0.1f, 0f)), (BackEuler != null) ? BackEuler.Value : Vector3.zero); } } private static void RefreshBack() { ApplyBackPose(); SheathPose.RefreshLocalBack(); } private static RingHeat BuildRingHeat(Material template) { if (WeaponVisuals.FindAsset("Models", "blades_of_chaos_ringheat.obj") == null || !WeaponVisuals.LoadModel("blades_of_chaos_ringheat.obj", out var mesh, out var names)) { Logger.LogWarning((object)"blades_of_chaos_ringheat.obj not found: the Blades of Chaos' pommel ring won't glow at levels 3-4"); return null; } Material[] mats = QualityLooks.Build("chaosring", template, names, RingSurfaces)[0]; return new RingHeat { Mesh = mesh, Mats = mats }; } private static Dictionary<string, SurfaceSpec> RingSurfaces(int level) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) int num = Quality.Clamp(level); string text = ((num >= 4) ? WeaponVisuals.TextureOr("OLY_Chaos_RingHeat_Q4", "OLY_Chaos_RingHeat_Q3") : "OLY_Chaos_RingHeat_Q3"); float num2 = QualityLooks.K(num) * 1.5f; return new Dictionary<string, SurfaceSpec> { ["OLY_ChaosRingHeat"] = new SurfaceSpec { Texture = text, EmissionTexture = text, Emission = new Color(num2, num2, num2), Metallic = 0f, Glossiness = 0.3f } }; } private static void AddRingHeat(Transform bladeMesh, RingHeat ring) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (ring != null && Object.op_Implicit((Object)(object)bladeMesh)) { GameObject val = new GameObject("OLY_ringheat") { layer = ((Component)bladeMesh).gameObject.layer }; val.transform.SetParent(bladeMesh, false); val.AddComponent<MeshFilter>().sharedMesh = ring.Mesh; MeshRenderer val2 = val.AddComponent<MeshRenderer>(); ((Renderer)val2).sharedMaterials = ring.Mats; ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val2).enabled = false; QualityLooks.Attach(bladeMesh, "chaosring", (Renderer[])(object)new Renderer[1] { (Renderer)val2 }, null, null, null, 3); } } private static void MakeHandBlade(Transform skin, string name, Mesh mesh, Material[] mats, GameObject dyrnwyn, GameObject fireSword, bool withLight, List<Renderer> renderers, List<Light> lights, List<ParticleSystem> flames, RingHeat ring) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Invalid comparison between Unknown and I4 //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) Transform transform = new GameObject(name).transform; transform.SetParent(skin, false); GameObject val = new GameObject("model"); val.layer = 12; val.transform.SetParent(transform, false); val.transform.localRotation = MeshInHand; val.AddComponent<MeshFilter>().sharedMesh = mesh; MeshRenderer val2 = val.AddComponent<MeshRenderer>(); ((Renderer)val2).sharedMaterials = mats; renderers.Add((Renderer)(object)val2); Transform transform2 = new GameObject("hilt").transform; transform2.SetParent(val.transform, false); transform2.localPosition = HiltLocal; AddRingHeat(val.transform, ring); GameObject val3 = WeaponVisuals.CopyChild(dyrnwyn, "attach/Burny vfx", transform); if (Object.op_Implicit((Object)(object)val3)) { val3.transform.localPosition = new Vector3(0f, 0f, 0.37f); ParticleSystem[] componentsInChildren = val3.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val4 in componentsInChildren) { ShapeModule shape = val4.shape; if ((int)((ShapeModule)(ref shape)).shapeType == 5) { ((ShapeModule)(ref shape)).scale = new Vector3(((ShapeModule)(ref shape)).scale.x * 0.8f, ((ShapeModule)(ref shape)).scale.y * 0.8f, 0.48f); } MainModule main = val4.main; ((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)0; ((MainModule)(ref main)).startSizeMultiplier = ((MainModule)(ref main)).startSizeMultiplier * 0.8f; flames.Add(val4); } ((Object)val3).name = "OLY_deferred_fx"; val3.SetActive(false); } if (withLight) { GameObject val5 = WeaponVisuals.CopyChild(dyrnwyn, "attach/Point Light", transform); if (Object.op_Implicit((Object)(object)val5)) { val5.transform.localPosition = new Vector3(0f, 0f, 0.36f); Light component = val5.GetComponent<Light>(); if (Object.op_Implicit((Object)(object)component)) { component.intensity = _lightIntensity.Value; component.range = 8f; ((Behaviour)component).enabled = _lightIntensity.Value > 0f; lights.Add(component); } } } GameObject val6 = WeaponVisuals.CopyChild(fireSword, "attach/equiped/trail", transform); if (Object.op_Implicit((Object)(object)val6)) { Transform val7 = val6.transform.Find("base"); Transform val8 = val6.transform.Find("tip"); if (Object.op_Implicit((Object)(object)val7)) { val7.localPosition = new Vector3(0f, 0f, 0.13f); } if (Object.op_Implicit((Object)(object)val8)) { val8.localPosition = new Vector3(0f, 0f, 0.6f); } } } private static void MakeEquipped(Transform skin) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("equiped"); val.transform.SetParent(skin, false); val.SetActive(false); if (_scareFire.Value) { GameObject val2 = WeaponVisuals.CopyChild(Cache.GetPrefab<GameObject>("Torch"), "attach/equiped/FireWarmth", val.transform); if (Object.op_Implicit((Object)(object)val2)) { val2.transform.localPosition = Vector3.zero; } } } private static LineRenderer MakeChain(Transform skin, string name) { //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_0073: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(skin, false); LineRenderer val2 = val.AddComponent<LineRenderer>(); val2.useWorldSpace = true; val2.positionCount = 0; val2.widthMultiplier = 0.045f; val2.textureMode = (LineTextureMode)1; val2.alignment = (LineAlignment)0; val2.numCornerVertices = 2; ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; Material prefab = Cache.GetPrefab<Material>("GrapplingHookWire"); if (Object.op_Implicit((Object)(object)prefab)) { ((Renderer)val2).sharedMaterial = prefab; val2.textureScale = new Vector2(22f, 1f); } else { Logger.LogWarning((object)"GrapplingHookWire material not found; chains will use the default material"); } return val2; } public static float SpinRangeFor(int quality) { if (!ChaosUnlocks.Cyclone.At(quality)) { return _spinRangeLow.Value; } return _spinRange.Value; } public static bool IsOurs(ItemData item) { if (item?.m_shared != null) { if (!Object.op_Implicit((Object)(object)item.m_dropPrefab) || !(((Object)item.m_dropPrefab).name == "OLY_BladesOfChaos")) { return item.m_shared.m_name == "$item_oly_bladesofchaos"; } return true; } return false; } } internal static class GuardianShield { public const string Prefab = "OLY_GuardianShield"; public const string Token = "$item_oly_guardianshield"; public const string Section = "Guardian Shield"; public const string LookKey = "guardian"; internal const int WeaponId = 9; internal const string PowerSE = "SE_OLY_GuardianShield"; private static readonly string[] BasePrefabs = new string[3] { "ShieldIronBuckler", "ShieldBronzeBuckler", "ShieldBanded" }; private const string Obj = "guardian_shield.obj"; private const string MeshChildPath = "attach/model (1)"; internal static readonly Quaternion MeshInHand = new Quaternion(-0.537127f, 0.461411f, 0.525591f, 0.471538f); internal static readonly Vector3 GripOffset = new Vector3(0.0074f, -0.0572f, 0.0024f); internal static readonly Vector3 TiltPivot = new Vector3(0f, -0.03f, 0.014f); internal static readonly Quaternion MeshOnBack = new Quaternion(0.696364f, 0.122788f, 0.122788f, 0.696364f); private const float BaseScale = 1f; internal const float GlowStrength = 1.6f; internal static readonly Color GlowColour = new Color(1f, 0.7f, 0.28f); internal const float ClassicBlockPerLevel = 6f; private static readonly float[] DefaultBlock = new float[5] { 0f, 12f, 45f, 64f, 88f }; private static readonly ConfigEntry<float>[] _block = new ConfigEntry<float>[5]; private static ConfigEntry<float> _parry; private static ConfigEntry<float> _parry4; private static ConfigEntry<float> _push; private static ConfigEntry<float> _pushPerLevel; private static ConfigEntry<float> _durability; private static ConfigEntry<float> _durabilityPerLevel; private static ConfigEntry<float> _weight; private static ConfigEntry<float> _movement; internal static Unlock Stride; internal static Unlock Bash; internal static ConfigEntry<float> BashDamage; internal static ConfigEntry<float> BashPush; internal static ConfigEntry<bool> FoldingShield; internal static ConfigEntry<bool> ParryFlash; internal static ConfigEntry<bool> StayOnForearm; internal static ConfigEntry<float> FoldSpeed; internal static ConfigEntry<float> ArmGap; internal static ConfigEntry<float> ArmGapArmour; internal static ConfigEntry<float> ElbowTilt; internal const float DefaultArmGap = -0.008f; internal const float DefaultArmGapArmour = 0.016f; internal static ConfigEntry<Vector3> ModelOffset; internal static ConfigEntry<Vector3> ModelEuler; internal static ConfigEntry<Vector3> BackOffset; internal static ConfigEntry<Vector3> BackEuler; internal static ConfigEntry<float> ModelScale; private static readonly float[] s_block = (float[])DefaultBlock.Clone(); private static float s_blockStep = 25f; private static float s_parry = 2f; private static float s_parry4 = 2.5f; private static float s_push1 = 25f; private static float s_pushStep = 10f; private static float s_dur1 = 200f; private static float s_durStep = 50f; private static float s_weight = 4f; private static float s_move = -0.05f; private static string s_meshChild = "attach/model (1)"; private static bool s_vanillaPose; private static Vector3 s_vanillaPos; private static Vector3 s_vanillaScale = Vector3.one; private static Quaternion s_vanillaRot = Quaternion.identity; private const string GlowPrefix = "OLY_Guardian_Face_Glow_Q"; private static readonly Texture2D[] s_glowMaps = (Texture2D[])(object)new Texture2D[5]; private static readonly bool[] s_glowLooked = new bool[5]; private static bool s_warnedBack; public static readonly Dictionary<string, string> English = new Dictionary<string, string> { { "item_oly_guardianshield", "Guardian Shield" }, { "item_oly_guardianshield_description", "A round parry shield of dark steel and bronze. It rests folded on your forearm as a slim bar and snaps open the moment you raise it. It grows with you: crafted in the Meadows, upgraded with the Swamp's, the Plains' and the Ashlands' materials, its runes glowing brighter at every level. Weaker than a big round shield for holding a block, but made for parrying." }, { "se_oly_guardianshield", "Level abilities" }, { "se_oly_guardparry", "Parry" }, { "oly_guard_level", "Level {0}" }, { "oly_guard_locked", "not yet unlocked" }, { "oly_guard_stride", "Folded stride" }, { "oly_guard_stride_on", "no slowdown while the shield is folded ({0} while you block)" }, { "oly_guard_stride_hint", "no slowdown while folded" }, { "oly_guard_bash", "Shield bash" }, { "oly_guard_bash_on", "a clean parry of a melee hit strikes back: blunt damage ({0}% of the hit) and a hard push" }, { "oly_guard_bash_hint", "parries strike back" }, { "oly_guard_parry4", "Stronger parry" }, { "oly_guard_parry4_on", "parry bonus {0}x" }, { "oly_guard_held", "Held: the cross-biome upgrade costs are not in use (Upgrades / Upgrade pathing). Each upgrade adds +6 block, the parry stays {0}x and the level abilities are off." } }; internal static readonly UpgradeCosts.Path Costs = new UpgradeCosts.Path { Prefab = "OLY_GuardianShield", Weapon = "Guardian Shield", WeaponId = 9, Classic = new UpgradeCosts.Row[5] { new UpgradeCosts.Row("Wood", 10, 5), new UpgradeCosts.Row("Flint", 6, 0), new UpgradeCosts.Row("LeatherScraps", 6, 3), new UpgradeCosts.Row("Resin", 4, 0), new UpgradeCosts.Row("Iron", 0, 5) }, Craft = "Wood:10, Flint:6, LeatherScraps:6, Resin:4", Level2 = "Iron:10, ElderBark:4, Bronze:4", Level3 = "BlackMetal:10, LinenThread:6, Chain:3", Level4 = "FlametalNew:10, Blackwood:8, AskHide:3", Where2 = "$oly_where_swamp", Where3 = "$oly_where_plains", Where4 = "$oly_where_ashlands" }; private static readonly Color SteelTint = new Color(0.86f, 0.9f, 0.98f); private static readonly Color BronzeTint = new Color(1f, 0.78f, 0.5f); private static readonly float[] SteelMetal = new float[5] { 0f, 0.35f, 0.5f, 0.4f, 0.48f }; private static readonly float[] SteelGloss = new float[5] { 0f, 0.2f, 0.42f, 0.64f, 0.83f }; private static readonly float[] BronzeMetal = new float[5] { 0f, 0.45f, 0.6f, 0.5f, 0.58f }; private static readonly float[] BronzeGloss = new float[5] { 0f, 0.26f, 0.48f, 0.7f, 0.86f }; private static readonly float[] TrimMetal = new float[5] { 0f, 0.35f, 0.5f, 0.4f, 0.48f }; private static readonly float[] TrimGloss = new float[5] { 0f, 0.17f, 0.39f, 0.61f, 0.8f }; private static readonly float[] BackMetal = new float[5] { 0f, 0.3f, 0.38f, 0.4f, 0.45f }; private static readonly float[] BackGloss = new float[5] { 0f, 0.15f, 0.34f, 0.5f, 0.62f }; internal static float TiltDeg { get { if (ElbowTilt == null) { return 6f; } return ElbowTilt.Value; } } internal static Quaternion Tilt => Quaternion.AngleAxis(0f - TiltDeg, Vector3.right); internal static Vector3 HandOffset => GripOffset + MeshInHand * (TiltPivot - Tilt * TiltPivot); internal static GameObject ItemPrefab { get; private set; } internal static bool HasModel { get; private set; } internal static bool Held { get; private set; } internal static float ParryBonus => s_parry; internal static float Level4Parry => s_parry4; internal static float Level4ParryFactor { get { if (!(s_parry > 0f)) { return 1f; } return s_parry4 / s_parry; } } internal static float MovementModifier => s_move; internal static float Size => 1f * ((ModelScale != null) ? ModelScale.Value : 1f); internal static Quaternion HandRotation(Vector3 tuneEuler) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0015: Unknown result type (might be due to invalid IL or missing references) return MeshInHand * Tilt * Quaternion.Euler(tuneEuler); } public static void BindConfig(ConfigFile cfg) { //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) for (int i = 1; i <= 4; i++) { _block[i] = Cfg.Baked(cfg, "Guardian Shield", "Block at level " + i, DefaultBlock[i], "Block power at item level " + i + " (before your Blocking skill adds up to half again). The approved values are 12, 45, 64 and 88: always under the best vanilla shield you can own at that point, fully upgraded (a maxed Flametal shield has 126). With \"Upgrades / Upgrade pathing\" = Classic the shield ignores levels 2-4 and gets +6 per upgrade instead, like vanilla shields.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 1000f)); } _parry = Cfg.Baked(cfg, "Guardian Shield", "Parry bonus", 2f, "How much a parry (a block within a quarter second of raising the shield) multiplies the block power. Vanilla bucklers have 2.5, round shields 1.5. It can't go below 1.05: at 1 or less the game turns parrying off.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1.05f, 5f)); _parry4 = Cfg.Baked(cfg, "Guardian Shield", "Level 4 parry bonus", 2.5f, "The parry bonus at item level 4 (the shield's tooltip lists it under \"Level abilities\"). It is never lower than \"Parry bonus\" (a lower value counts as equal). Not used while the shield is held (Classic).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1.05f, 5f)); _push = Cfg.Baked(cfg, "Guardian Shield", "Push at level 1", 25f, "How hard a blocked attacker is pushed back at level 1 (the tooltip's \"Block force\").", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 500f)); _pushPerLevel = Cfg.Baked(cfg, "Guardian Shield", "Push per upgrade", 10f, "Extra push per upgrade (10 = 25, 35, 45 and 55).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f)); _durability = Cfg.Baked(cfg, "Guardian Shield", "Durability at level 1", 200f, "How many blocks the shield takes at level 1 before it breaks (parries wear it less). A broken shield is kept, and repaired at the Workbench.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 2000f)); _durabilityPerLevel = Cfg.Baked(cfg, "Guardian Shield", "Durability per upgrade", 50f, "Extra durability per upgrade (50 = 200, 250, 300 and 350).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1000f)); _weight = Cfg.Baked(cfg, "Guardian Shield", "Weight", 4f, "The shield's weight (a vanilla buckler weighs 4).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 50f)); _movement = Cfg.Baked(cfg, "Guardian Shield", "Movement", -0.05f, "Movement speed change while the shield is in your hand (-0.05 = 5% slower, like vanilla bucklers and round shields). \"Folded stride\" takes exactly this away while the shield is folded.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-0.5f, 0f)); Stride = Unlock.Bind(cfg, "Guardian Shield", "Folded stride", 2, "Level ability: no walking or running slowdown from the shield while it is folded on your arm; the slowdown (\"Movement\") comes back while you hold block. Off, or below its level, the shield always slows you a little. Off while the shield is held (Classic)."); Bash = Unlock.Bind(cfg, "Guardian Shield", "Shield bash", 3, "Level ability: a clean parry of a melee hit strikes back at the attacker: blunt damage and an extra push. Creatures only (never players or tamed animals); bosses take the damage and the push but no extra stagger. Arrows and other ranged hits never trigger it. Off while the shield is held (Classic)."); BashDamage = Cfg.Synced(cfg, "Guardian Shield", "Shield bash damage", 0.25f, "Shield bash: the blunt damage dealt back, as a share of the parried hit (0.25 = a quarter of the hit as it reached your shield).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f)); BashPush = Cfg.Synced(cfg, "Guardian Shield", "Shield bash push", 1f, "Shield bash: the extra push, as a multiple of the parry's own push (1 = the attacker is pushed back twice as hard as a normal parry pushes it; 0 = no extra push).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f)); FoldingShield = Cfg.Local(cfg, "Guardian Shield", "Folding shield", def: true, "On: the shield rests folded on your forearm (also when put away, see \"Stay on forearm when put away\") and opens when you raise it to block. Off = the plain round shield in the hand and on the back, everywhere. Only your own view; it blocks exactly the same either way. Changes live."); FoldSpeed = Cfg.Local(cfg, "Guardian Shield", "Fold speed", 1f, "How fast the shield opens and folds (1 = opens in 0.065 s, folds in 0.25 s; 2 = twice as fast). It never opens slower than the arm rises (0.1 s) nor folds slower than it lowers (0.25 s). Changes live.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.65f, 3f)); ParryFlash = Cfg.Local(cfg, "Guardian Shield", "Parry flash", def: true, "The shield's runes flash on a parry (yours and other players'), brighter at higher levels. Off only hides the flash on your own screen; other players still see yours. Changes live."); ArmGap = Cfg.Local(cfg, "Guardian Shield", "Arm gap", -0.008f, "How far (m) the shield sits out from the forearm, on top of its built-in fit. Raise it if the cuff or the shield sinks into your sleeve; lower it (below 0) if it floats off a bare arm. Only your own view; changes live.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-0.03f, 0.08f)); ArmGapArmour = Cfg.Local(cfg, "Guardian Shield", "Arm gap extra with chest armour", 0.016f, "Extra gap (m) while a character wears chest armour (its sleeves or bracers cover the forearm), worked out for each character you see from what they wear, like the Blades of Chaos chain wrap. Changes live.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.08f)); Cfg.Migrate(ArmGap, 0f, -0.008f, "1.0.0"); Cfg.Migrate(ArmGapArmour, 0.01f, 0.016f, "1.0.0"); ElbowTilt = Cfg.Local(cfg, "Guardian Shield", "Elbow tilt", 6f, "Degrees the shield tilts away from the forearm toward the elbow, turning about its hand end (the forearm is thicker near the elbow). Raise it if the elbow end sinks into your arm or sleeve. Only your own view; changes live.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 20f)); ElbowTilt.SettingChanged += delegate { RefitHand(); }; StayOnForearm = Cfg.Local(cfg, "Guardian Shield", "Stay on forearm when put away", def: true, "On: when weapons are put away the shield stays folded on the forearm, where it is worn, instead of going to the back (every character you see). Off: it hangs folded on the back like other shields. Only your own view; changes live (other players' shields the next time they put their weapons away)."); StayOnForearm.SettingChanged += delegate { RefreshBack(); }; ModelOffset = Cfg.Advanced<Vector3>(cfg, "Debug: model fit", "Guardian Shield offset", Vector3.zero, "Model position in the hand (oly_tune shield)."); ModelEuler = Cfg.Advanced<Vector3>(cfg, "Debug: model fit", "Guardian Shield rotation", Vector3.zero, "Extra model rotation in degrees."); ModelScale = Cfg.Advanced(cfg, "Debug: model fit", "Guardian Shield scale", 1f, "Extra size multiplier on top of the shield's real size."); BackOffset = Cfg.Advanced<Vector3>(cfg, "Debug: model fit", "Guardian Shield back offset", Vector3.zero, "Where the shield sits on your back when put away (with \"Stay on forearm when put away\" off), in metres from where the game hangs every shield: x = to your right, y = up, z = forward (into the back). Changes live."); BackEuler = Cfg.Advanced<Vector3>(cfg, "Debug: model fit", "Guardian Shield back rotation", Vector3.zero, "Extra turn of the shield on your back, in degrees. (0, 0, 0) = the way the game hangs every shield. Changes live."); BackOffset.SettingChanged += delegate { RefreshBack(); }; BackEuler.SettingChanged += delegate { RefreshBack(); }; ModelOffset.SettingChanged += delegate { RefreshBack(); }; ModelEuler.SettingChanged += delegate { RefreshBack(); }; ModelScale.SettingChanged += delegate { RefreshBack(); }; } private static void RefitHand() { try { GameObject prefab = PrefabManager.Instance.GetPrefab("OLY_GuardianShield"); if (Object.op_Implicit((Object)(object)prefab)) { WeaponVisuals.ApplyTransform(prefab, Spec()); } ShieldModel.RefreshLocalHand(); ShieldModel.RefreshBack(); } catch (Exception ex) { Logger.LogWarning((object)("Guardian Shield: elbow tilt not applied live (re-equip to see it): " + ex.Message)); } } private static void RefreshBack() { try { ShieldModel.RefreshBack(); } catch (Exception ex) { if (!s_warnedBack) { s_warnedBack = true; Logger.LogWarning((object)("Guardian Shield: back copy not re-posed: " + ex.Message)); } } } internal static float BlockAt(int quality) { return s_block[Quality.Clamp(quality)]; } internal static float BlockDelta(int quality) { int num = Quality.Clamp(quality); return s_block[num] - (s_block[1] + s_blockStep * (float)(num - 1)); } private static void Snapshot() { for (int i = 1; i <= 4; i++) { s_block[i] = ((_block[i] != null) ? Mathf.Max(0f, _block[i].Value) : DefaultBlock[i]); } s_blockStep = Mathf.Round((s_block[4] - s_block[1]) / 3f); s_parry = Mathf.Max(1.05f, (_parry != null) ? _parry.Value : 2f); float num = ((_parry4 != null) ? _parry4.Value : 2.5f); s_parry4 = Mathf.Max(s_parry, num); if (num < s_parry) { Logger.LogInfo((object)($"Guardian Shield: \"Level 4 parry bonus\" ({num:0.##}) is below \"Parry bonus\" " + $"({s_parry:0.##}), so level 4 parries the same as the other levels")); } s_push1 = ((_push != null) ? Mathf.Max(0f, _push.Value) : 25f); s_pushStep = ((_pushPerLevel != null) ? Mathf.Max(0f, _pushPerLevel.Value) : 10f); s_dur1 = ((_durability != null) ? Mathf.Max(10f, _durability.Value) : 200f); s_durStep = ((_durabilityPerLevel != null) ? Mathf.Max(0f, _durabilityPerLevel.Value) : 50f); s_weight = ((_weight != null) ? Mathf.Max(0f, _weight.Value) : 4f); s_move = ((_movement != null) ? Mathf.Clamp(_movement.Value, -0.5f, 0f) : (-0.05f)); } public static void Register() { //IL_000b: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) Snapshot(); ItemConfig val = new ItemConfig { Name = "$item_oly_guardianshield", Description = "$item_oly_guardianshield_description", CraftingStation = CraftingStations.Workbench, MinStationLevel = 1 }; UpgradeCosts.AddClassicRows(val, Costs); string text = null; string[] basePrefabs = BasePrefabs; foreach (string text2 in basePrefabs) { if (Object.op_Implicit((Object)(object)Cache.GetPrefab<ItemDrop>(text2))) { text = text2; break; } } if (text == null) { Logger.LogError((object)("Guardian Shield: no vanilla shield to clone (" + string.Join(", ", BasePrefabs) + ")")); return; } if (text != BasePrefabs[0]) { Logger.LogWarning((object)("Guardian Shield: " + BasePrefabs[0] + " not found; cloning " + text)); } CustomItem item = new CustomItem("OLY_GuardianShield", text, val); if ((Object)(object)item.ItemPrefab == (Object)null) { Logger.LogError((object)("could not clone " + text)); return; } CustomRecipe recipe = item.Recipe; if (Object.op_Implicit((Object)(object)((recipe != null) ? recipe.Recipe : null))) { Recipe recipe2 = item.Recipe.Recipe; ((Object)recipe2).hideFlags = (HideFlags)(((Object)recipe2).hideFlags | 0x20); } if (!ItemManager.Instance.AddItem(item)) { Logger.LogError((object)"could not register OLY_GuardianShield"); return; } ItemPrefab = item.ItemPrefab; SharedData shared = item.ItemDrop.m_itemData.m_shared; SetStats(shared); Safe("costs", delegate { UpgradeCosts.Apply(item, Costs); }); Held = !Costs.Active; if (Held) { shared.m_blockPowerPerLevel = 6f; Logger.LogInfo((object)("Guardian Shield: held (its upgrades are not the cross-biome ones): block " + $"{Line(s_block[1], 6f)}, parry stays {s_parry:0.##}x, level abilities off")); } Safe("parry stamp", delegate { shared.m_perfectBlockStatusEffect = (StatusEffect)(object)SE_OLY_GuardianParry.Create(); }); Safe("level abilities", delegate { RegisterPower(shared); }); Safe("upgrade tooltip", delegate { UpgradeCosts.RegisterTooltip(Costs); }); Safe("model", delegate { SetupVisuals(item.ItemPrefab, shared); }); if (Held) { Logger.LogInfo((object)($"Guardian Shield: block {Line(s_block[1], 6f)}, parry {s_parry:0.##}x, " + $"push {s_push1:0}-{s_push1 + 3f * s_pushStep:0}, durability {s_dur1:0}-{s_dur1 + 3f * s_durStep:0}")); return; } Logger.LogInfo((object)($"Guardian Shield: block {s_block[1]:0.#} / {s_block[2]:0.#} / {s_block[3]:0.#} / {s_block[4]:0.#}, " + $"parry {s_parry:0.##}x" + ((s_parry4 > s_parry) ? $" ({s_parry4:0.##}x at level 4)" : "") + $", push {s_push1:0}-{s_push1 + 3f * s_pushStep:0}, durability {s_dur1:0}-{s_dur1 + 3f * s_durStep:0}")); } private static string Line(float first, float step) { return $"{first:0.#} / {first + step:0.#} / {first + 2f * step:0.#} / {first + 3f * step:0.#}"; } private static void Safe(string what, Action step) { try { step(); } catch (Exception arg) { Logger.LogError((object)$"Guardian Shield: {what} not available: {arg}"); } } private static void SetStats(SharedData shared) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) Expect(ref shared.m_itemType, (ItemType)5, "item type"); Expect(ref shared.m_skillType, (SkillType)6, "skill"); shared.m_attachOverride = (ItemType)0; shared.m_blockPower = s_block[1]; shared.m_blockPowerPerLevel = s_blockStep; shared.m_timedBlockBonus = s_parry; shared.m_deflectionForce = s_push1; shared.m_deflectionForcePerLevel = s_pushStep; shared.m_maxQuality = 4; shared.m_useDurability = true; shared.m_maxDurability = s_dur1; shared.m_durabilityPerLevel = s_durStep; shared.m_durabilityDrain = 0f; shared.m_destroyBroken = false; shared.m_canBeReparied = true; shared.m_weight = s_weight; shared.m_movementModifier = s_move; shared.m_blockAdrenaline = 1f; shared.m_perfectBlockAdrenaline = 5f; shared.m_perfectBlockStaminaRegen = 0f; shared.m_damageModifiers = new List<DamageModPair>(); shared.m_buildBlockCharges = false; shared.m_scaleByQuality = 0f; shared.m_scaleWeightByQuality = 0f; shared.m_value = 0; shared.m_teleportable = true; } private static void Expect<T>(ref T field, T value, string what) { if (!EqualityComparer<T>.Default.Equals(field, value)) { Logger.LogWarning((object)$"Guardian Shield: the base shield's {what} was {field}; set to {value}"); } field = value; } private static void RegisterPower(SharedData shared) { if (Object.op_Implicit((Object)(object)shared.m_equipStatusEffect)) { Logger.LogWarning((object)("Guardian Shield: the base shield had an equip effect (" + ((Object)shared.m_equipStatusEffect).name + "); replaced")); } shared.m_equipStatusEffect = (StatusEffect)(object)UnlockTooltips.CreateInfoSE<SE_OLY_GuardianShield>("SE_OLY_GuardianShield", 9, "$se_oly_guardianshield"); UnlockTooltips.Register(9, ShieldTooltip.Lines); } public static ModelSpec Spec() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) ModelSpec modelSpec = new ModelSpec { Obj = "guardian_shield.obj", MeshChild = s_meshChild, MeshRotation = MeshInHand, Offset = HandOffset + ((ModelOffset != null) ? ModelOffset.Value : Vector3.zero), Euler = new Vector3(0f - TiltDeg, 0f, 0f) + ((ModelEuler != null) ? ModelEuler.Value : Vector3.zero), Scale = Size, GlowLight = Color.clear, Surfaces = Surfaces(1), LookKey = "guardian", SurfacesFor = Surfaces }; if (s_vanillaPose) { modelSpec.MeshRotation = s_vanillaRot; modelSpec.Offset += s_vanillaPos; modelSpec.Scale = s_vanillaScale.x * ((ModelScale != null) ? ModelScale.Value : 1f); modelSpec.LookKey = null; modelSpec.SurfacesFor = null; } return modelSpec; } internal static Dictionary<string, SurfaceSpec> Surfaces(int q) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) q = Quality.Clamp(q); string texture = Level("OLY_Guardian_Face", q); string texture2 = Level("OLY_Guardian_Trim", q); string texture3 = Level("OLY_Guardian_Back", q); string text = GlowFile(q); Color val = Color.white * (1.6f * QualityLooks.K(q)); val.a = 1f; return new Dictionary<string, SurfaceSpec> { ["OLY_GuardianSteel"] = new SurfaceSpec { Texture = texture, Metallic = SteelMetal[q], Glossiness = SteelGloss[q], MetalColor = SteelTint }, ["OLY_GuardianBronze"] = new SurfaceSpec { Texture = texture, Metallic = BronzeMetal[q], Glossiness = BronzeGloss[q], MetalColor = BronzeTint, EmissionTexture = text, Emission = ((text != null) ? val : Color.black) }, ["OLY_GuardianTrim"] = new SurfaceSpec { Texture = texture2, Metallic = TrimMetal[q], Glossiness = TrimGloss[q], MetalColor = SteelTint }, ["OLY_GuardianBack"] = new SurfaceSpec { Texture = texture3, Metallic = BackMetal[q], Glossiness = BackGloss[q], MetalColor = SteelTint } }; } private static string Level(string file, int q) { if (q < 2) { return file; } return WeaponVisuals.TextureOr(file + "_Q" + q, file); } private static string GlowFile(int level) { level = Quality.Clamp(level); if (level < 2) { return null; } string text = "OLY_Guardian_Face_Glow_Q" + level; if (!WeaponVisuals.HasTexture(text)) { return null; } return text; } internal static Texture2D GlowMap(int level) { level = Mathf.Max(2, Quality.Clamp(level)); if (!s_glowLooked[level]) { s_glowLooked[level] = true; string text = GlowFile(level); s_glowMaps[level] = ((text != null) ? WeaponVisuals.GetTexture(text) : null); } return s_glowMaps[level]; } private static void SetupVisuals(GameObject prefab, SharedData shared) { //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) Transform val = prefab.transform.Find("attach"); if (!Object.op_Implicit((Object)(object)val)) { Logger.LogWarning((object)"Guardian Shield: the base shield has no 'attach'; keeping its look as it is"); return; } RemoveChild(val, "UpgraderGlow"); RemoveChild(val, "Point light"); if (!Object.op_Implicit((Object)(object)prefab.transform.Find("attach/model (1)"))) { s_meshChild = null; Logger.LogWarning((object)"Guardian Shield: no attach/model (1); using the first mesh under 'attach'"); } if (WeaponVisuals.FindAsset("Models", "guardian_shield.obj") != null && WeaponVisuals.LoadModel("guardian_shield.obj", out var _, out var names)) { Transform val2 = WeaponVisuals.MeshChildOf(prefab, new ModelSpec { MeshChild = s_meshChild }); if (Object.op_Implicit((Object)(object)val2) && !Object.op_Implicit((Object)(object)prefab.GetComponentInChildren<BoxCollider>(true))) { MeshCollider component = ((Component)val2).GetComponent<MeshCollider>(); if (Object.op_Implicit((Object)(object)component)) { Object.DestroyImmediate((Object)(object)component); ((Component)val2).gameObject.AddComponent<BoxCollider>(); } } HasModel = WeaponVisuals.Apply(prefab, Spec()); if (HasModel) { try { ShieldModel.Build(prefab, WeaponVisuals.MeshChildOf(prefab, Spec()), names); } catch (Exception ex) { Logger.LogError((object)("Guardian Shield fold not available (" + ex.Message + "): the plain round shield is used (it blocks the same)")); } } } else { Logger.LogWarning((object)"guardian_shield.obj not found: the Guardian Shield keeps the iron buckler's look (it works the same)"); } if (!HasModel) { Transform val3 = WeaponVisuals.MeshChildOf(prefab, new ModelSpec { MeshChild = s_meshChild }); if (Object.op_Implicit((Object)(object)val3)) { s_vanillaPose = true; s_vanillaPos = val3.localPosition; s_vanillaRot = val3.localRotation; s_vanillaScale = val3.localScale; } } string text = WeaponVisuals.FindAsset("Icons", "icon_guardian_shield.png"); Sprite val4 = ((text != null) ? AssetUtils.LoadSpriteFromFile(text) : null); if (Object.op_Implicit((Object)(object)val4)) { shared.m_icons = (Sprite[])(object)new Sprite[1] { val4 }; } else { Logger.LogWarning((object)"Guardian Shield icon not found; keeping the iron buckler's"); } } private static void RemoveChild(Transform parent, string name) { Transform val = parent.Find(name); if (Object.op_Implicit((Object)(object)val)) { Object.DestroyImmediate((Object)(object)((Component)val).gameObject); } } public static bool IsOurs(ItemData item) { if (item?.m_shared != null) { if (!Object.op_Implicit((Object)(object)item.m_dropPrefab) || !(((Object)item.m_dropPrefab).name == "OLY_GuardianShield")) { return item.m_shared.m_name == "$item_oly_guardianshield"; } return true; } return false; } public static bool IsOursFast(ItemData item) { if (item?.m_shared != null) { return item.m_shared.m_name == "$item_oly_guardianshield"; } return false; } } internal static class HuldraPick { public const string Prefab = "OLY_HuldraPick"; public const string Token = "$item_oly_huldrapick"; public const string Section = "Huldra Pick"; public const string LookKey = "huldra"; internal const int WeaponId = 8; internal const string WhereBlackForest = "$oly_where_blackforest"; internal const string PowerSE = "SE_OLY_HuldraPick"; private static readonly string[] BasePrefabs = new string[3] { "PickaxeIron", "PickaxeBronze", "PickaxeAntler" }; private const string Obj = "huldra_pick.obj"; private const string MeshChildPath = "attach/pickaxe"; internal static readonly Quaternion MeshInHand = new Quaternion(0.7071068f, 0f, 0f, 0.7071068f); private const float BaseScale = 1f; internal const float GlowStrength = 1.6f; private static readonly int[] ToolTiers = new int[5] { 0, 0, 1, 2, 3 }; private static readonly float[] DefaultDamage = new float[5] { 0f, 18f, 30f, 45f, 60f }; private static readonly float[] DefaultStamina = new float[5] { 0f, 6f, 8f, 10f, 12f }; private static readonly ConfigEntry<float>[] _damage = new ConfigEntry<float>[5]; private static readonly ConfigEntry<float>[] _stamina = new ConfigEntry<float>[5]; private static ConfigEntry<float> _durability; private static ConfigEntry<float> _durabilityPerLevel; internal static Unlock Sense; internal static ConfigEntry<float> SenseRange; internal static ConfigEntry<float> GlowPulse; internal static ConfigEntry<Vector3> ModelOffset; internal static ConfigEntry<Vector3> ModelEuler; internal static ConfigEntry<float> ModelScale; private static readonly float[] s_damage = (float[])DefaultDamage.Clone(); private static readonly float[] s_stamina = (float[])DefaultStamina.Clone(); private static float s_damagePerLevel = (DefaultDamage[4] - DefaultDamage[1]) / 3f; private static float s_staminaRef = DefaultStamina[1]; private static string s_meshChild = "attach/pickaxe"; private static bool s_vanillaPose; private static Vector3 s_vanillaPos; private static Vector3 s_vanillaScale = Vector3.one; private static Quaternion s_vanillaRot = Quaternion.identity; internal const int SlotIron = 0; internal const int SlotWood = 1; internal const int SlotBronze = 2; internal const int SlotCount = 3; private static readonly string[] SlotGroups = new string[3] { "OLY_PickIron", "OLY_PickWood", "OLY_PickBronze" }; private static readonly string[] GlowFiles = new string[3] { "OLY_Pick_Iron_Glow_Q", "OLY_Pick_Haft_Glow_Q", "OLY_Pick_Bronze_Glow_Q" }; internal static readonly int[] GlowSlots = new int[3] { -1, -1, -1 }; private static readonly Texture2D[,] s_glowMaps = new Texture2D[3, 5]; private static readonly bool[,] s_glowLooked