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 KongStrongEnergy v1.2.2
plugins/KongStrong.dll
Decompiled 5 days 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.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = "")] [assembly: AssemblyCompany("KongStrong")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.2.2.0")] [assembly: AssemblyInformationalVersion("1.2.2+f48e9bfdea367272118b5d7ebfa5c6fa370283ea")] [assembly: AssemblyProduct("KongStrong")] [assembly: AssemblyTitle("KongStrong")] [assembly: AssemblyMetadata("UpdateRepo", "Stanni97/valheim-kong-strong")] [assembly: AssemblyVersion("1.2.2.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 KongStrong { internal static class ConfigBinder { public static T Bind<T>(ConfigFile config, string section, string key, T value, ConfigDescription description, IEnumerable<T> oldDefaults = null) { ConfigEntry<T> entry = config.Bind<T>(section, key, value, description); if (oldDefaults != null && !object.Equals(entry.Value, value) && oldDefaults.Any((T old) => object.Equals(entry.Value, old))) { entry.Value = value; } return entry.Value; } public static T Bind<T>(ConfigFile config, string section, string key, T value, string description, IEnumerable<T> oldDefaults = null) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown return Bind(config, section, key, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), oldDefaults); } } internal sealed class Drink { public string Key; public string PrefabName; public string[] BasePrefabs = new string[3] { "MeadStaminaMinor", "MeadStaminaMedium", "MeadTasty" }; public float Weight = 0.5f; public int StackSize = 20; public float ModelScale = 1f; public bool CausesCrash; public bool Shout = true; public string Model = "can"; public string Texture; public float Metallic = 0.55f; public float Smoothness = 0.6f; public Color? Glow; public bool Fermented; public string FermenterBase = "MeadBaseTasty"; public int FermenterYield = 6; public Dictionary<string, string[]> Previous = new Dictionary<string, string[]>(); public bool Enabled = true; public float Duration = 300f; public float InstantStamina; public float InstantEitr; public float HealOverTime; public int StaminaRegenBonus; public int HealthRegenBonus; public int EitrRegenBonus; public int SpeedBonus; public int RunStaminaReduction; public int JumpStaminaReduction; public float CarryWeightBonus; public DamageModifier FireResistance; public DamageModifier FrostResistance; public DamageModifier PoisonResistance; public bool ReturnsEmpty = true; public string CraftingStation = "Cauldron"; public string Ingredients = ""; public int Amount = 1; public string Token => "kong_" + Key.ToLowerInvariant(); public string IconResource => "KongStrong." + Key.ToLowerInvariant() + ".png"; public string BasePrefabName => PrefabName + "Base"; public void Bind(ConfigFile config) { //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Expected O, but got Unknown Enabled = B(config, "Enabled", Enabled, "Adds this drink to the game."); Duration = B(config, "DurationSeconds", Duration, "How long the buff lasts, in seconds."); InstantStamina = B(config, "InstantStamina", InstantStamina, "Stamina restored immediately when drinking."); InstantEitr = B(config, "InstantEitr", InstantEitr, "Eitr restored immediately when drinking."); HealOverTime = B(config, "HealOverTime", HealOverTime, "Health restored over the first 10 seconds."); StaminaRegenBonus = B(config, "StaminaRegenBonusPercent", StaminaRegenBonus, "Faster stamina regeneration, in percent."); HealthRegenBonus = B(config, "HealthRegenBonusPercent", HealthRegenBonus, "Faster health regeneration, in percent."); EitrRegenBonus = B(config, "EitrRegenBonusPercent", EitrRegenBonus, "Faster eitr regeneration, in percent."); SpeedBonus = B(config, "MoveSpeedBonusPercent", SpeedBonus, "Faster movement, in percent."); RunStaminaReduction = B(config, "RunStaminaReductionPercent", RunStaminaReduction, "Less stamina used while running, in percent."); JumpStaminaReduction = B(config, "JumpStaminaReductionPercent", JumpStaminaReduction, "Less stamina used per jump, in percent."); CarryWeightBonus = B(config, "CarryWeightBonus", CarryWeightBonus, "Extra carry weight."); FireResistance = B<DamageModifier>(config, "FireResistance", FireResistance, "Fire damage while the buff is active. Normal = no change, Resistant = half damage."); FrostResistance = B<DamageModifier>(config, "FrostResistance", FrostResistance, "Frost damage while the buff is active. Resistant or better also prevents freezing."); PoisonResistance = B<DamageModifier>(config, "PoisonResistance", PoisonResistance, "Poison damage while the buff is active."); ReturnsEmpty = B(config, "ReturnsEmpty", ReturnsEmpty, "Drinking leaves an empty can or bottle (Leergut) in the inventory."); CraftingStation = ConfigBinder.Bind(config, Key, "CraftingStation", CraftingStation, new ConfigDescription(Fermented ? "Where the fermenter base is crafted." : "Where the drink is crafted.", (AcceptableValueBase)(object)CraftingStations.GetAcceptableValueList(), Array.Empty<object>()), Old("CraftingStation")); Ingredients = ConfigBinder.Bind(config, Key, "Ingredients", Ingredients, "Comma separated list of ItemPrefab:Amount" + (Fermented ? " for the fermenter base." : "."), Old("Ingredients")); Amount = B(config, "Amount", Amount, Fermented ? "Fermenter bases produced per craft." : "Drinks produced per craft."); if (Fermented) { FermenterYield = B(config, "FermenterYield", FermenterYield, "Drinks one base turns into in the fermenter."); } } private T B<T>(ConfigFile config, string key, T value, string description) { return ConfigBinder.Bind(config, Key, key, value, description); } private IEnumerable<string> Old(string key) { if (!Previous.TryGetValue(key, out var value)) { return Enumerable.Empty<string>(); } return value; } } internal static class Icons { private static readonly Dictionary<string, Sprite> Cache = new Dictionary<string, Sprite>(); public static Sprite Get(string name) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (Cache.TryGetValue(name, out var value)) { return value; } Texture2D val = Texture(name); Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); Cache[name] = val2; return val2; } public static Texture2D Texture(string name) { string text = "KongStrong." + name + ".png"; using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(text); if (stream == null) { throw new FileNotFoundException("Embedded resource missing: " + text); } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); return AssetUtils.LoadImage(memoryStream.ToArray()); } } internal class KongDepositMachine : MonoBehaviour, Hoverable, Interactable { internal const string EmptyToken = "$item_kong_empty"; internal static int CoinsPerEmpty = 1; public string GetHoverName() { return Localization.instance.Localize("$piece_kong_automat"); } public float GetHoverOffset() { return 0f; } public string GetHoverText() { int num = ((!((Object)(object)Player.m_localPlayer == (Object)null)) ? ((Humanoid)Player.m_localPlayer).GetInventory().CountItems("$item_kong_empty", -1, true) : 0); return Localization.instance.Localize($"$piece_kong_automat\n[<color=yellow><b>$KEY_Use</b></color>] $piece_kong_automat_use ({num} × {CoinsPerEmpty} $item_coins)"); } public bool Interact(Humanoid user, bool hold, bool alt) { if (!hold) { Player val = (Player)(object)((user is Player) ? user : null); if (val != null && !((Object)(object)val != (Object)(object)Player.m_localPlayer)) { Inventory inventory = ((Humanoid)val).GetInventory(); int num = inventory.CountItems("$item_kong_empty", -1, true); if (num <= 0) { ((Character)val).Message((MessageType)2, "$msg_kong_noempties", 0, (Sprite)null, false); return false; } GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("Coins"); int num2 = num * Mathf.Max(0, CoinsPerEmpty); if ((Object)(object)itemPrefab == (Object)null || (num2 > 0 && !inventory.CanAddItem(itemPrefab, num2))) { ((Character)val).Message((MessageType)2, "$inventory_full", 0, (Sprite)null, false); return false; } inventory.RemoveItem("$item_kong_empty", num, -1, true); if (num2 > 0) { inventory.AddItem(itemPrefab, num2); } ((Character)val).Message((MessageType)2, string.Format(Localization.instance.Localize("$msg_kong_deposit"), num, num2), 0, (Sprite)null, false); return true; } } return false; } public bool UseItem(Humanoid user, ItemData item) { return false; } } internal class KongTap : MonoBehaviour, Hoverable, Interactable { internal const string XxlToken = "$item_kong_xxl"; internal static int Full = 38; internal static StatusEffect Effect; private const string ServingsKey = "kong_servings"; private ZNetView _nview; private int Servings { get { if (!((Object)(object)_nview != (Object)null) || !_nview.IsValid()) { return 0; } return Mathf.Max(0, _nview.GetZDO().GetInt("kong_servings", 0)); } } private void Awake() { _nview = ((Component)this).GetComponent<ZNetView>(); if (!((Object)(object)_nview == (Object)null) && _nview.GetZDO() != null && _nview.IsOwner() && _nview.GetZDO().GetInt("kong_servings", -1) < 0) { _nview.GetZDO().Set("kong_servings", Full); } } public string GetHoverName() { return Localization.instance.Localize("$piece_kong_tap"); } public float GetHoverOffset() { return 0f; } public string GetHoverText() { string text = $"$piece_kong_tap ({Servings}/{Full})\n" + ((Servings > 0) ? "[<color=yellow><b>$KEY_Use</b></color>] $piece_kong_tap_use\n" : "") + "[<color=yellow><b>1-8</b></color>] $piece_kong_tap_refill"; return Localization.instance.Localize(text); } public bool Interact(Humanoid user, bool hold, bool alt) { if (!hold) { Player val = (Player)(object)((user is Player) ? user : null); if (val != null && !((Object)(object)val != (Object)(object)Player.m_localPlayer) && !((Object)(object)_nview == (Object)null) && _nview.IsValid()) { int servings = Servings; if (servings <= 0) { ((Character)val).Message((MessageType)2, "$msg_kong_tapempty", 0, (Sprite)null, false); return false; } if ((Object)(object)Effect == (Object)null) { return false; } if (((Character)val).GetSEMan().HaveStatusEffectCategory(Effect.m_category)) { ((Character)val).Message((MessageType)2, "$msg_cantconsume", 0, (Sprite)null, false); return false; } _nview.ClaimOwnership(); _nview.GetZDO().Set("kong_servings", servings - 1); ((Character)val).GetSEMan().AddStatusEffect(Effect.NameHash(), true, 0, 0f, (short)(-1)); return true; } } return false; } public bool UseItem(Humanoid user, ItemData item) { if (item != null && !(item.m_shared.m_name != "$item_kong_xxl")) { Player val = (Player)(object)((user is Player) ? user : null); if (val != null && !((Object)(object)_nview == (Object)null) && _nview.IsValid()) { ((Humanoid)val).GetInventory().RemoveOneItem(item); _nview.ClaimOwnership(); _nview.GetZDO().Set("kong_servings", Full); ((Character)val).Message((MessageType)2, "$msg_kong_refilled", 0, (Sprite)null, false); return true; } } return false; } } [BepInPlugin("felix.kongstrong", "Kong Strong Energy", "1.2.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] internal class KongStrongPlugin : BaseUnityPlugin { public const string PluginGUID = "felix.kongstrong"; public const string PluginName = "Kong Strong Energy"; public const string PluginVersion = "1.2.2"; private const string StatusCategory = "kongstrong"; private const string EmptyPrefab = "KongLeergut"; private static readonly HashSet<string> ReturnsEmpty = new HashSet<string>(); private static bool _emptiesEnabled = true; private readonly Drink[] _drinks = new Drink[8] { new Drink { Key = "SugarFree", PrefabName = "KongStrongSugarFree", Texture = "tex_can_sugarfree", Duration = 300f, InstantStamina = 40f, StaminaRegenBonus = 50, SpeedBonus = 10, RunStaminaReduction = 25, JumpStaminaReduction = 25, Ingredients = "Blueberries:3,Thistle:1,MushroomYellow:1", Amount = 2, Previous = { ["Ingredients"] = new string[1] { "Honey:1,Raspberry:3" }, ["CraftingStation"] = new string[1] { "Workbench" } } }, new Drink { Key = "Classic", PrefabName = "KongStrongClassic", CausesCrash = true, Texture = "tex_can_classic", Duration = 180f, InstantStamina = 80f, StaminaRegenBonus = 75, SpeedBonus = 15, RunStaminaReduction = 25, JumpStaminaReduction = 25, Ingredients = "Honey:2,Raspberry:3,Bloodbag:1,MushroomYellow:1", Amount = 2, Previous = { ["Ingredients"] = new string[1] { "Honey:2,Raspberry:3" }, ["CraftingStation"] = new string[1] { "Workbench" } } }, new Drink { Key = "Skyr", PrefabName = "KongSkyrEnergy", Model = "skyr", Shout = false, Texture = "tex_skyr", Metallic = 0f, Smoothness = 0.35f, BasePrefabs = new string[2] { "MeadTasty", "MeadStaminaMinor" }, Duration = 600f, InstantStamina = 20f, StaminaRegenBonus = 25, HealthRegenBonus = 25, CarryWeightBonus = 50f, Ingredients = "ChickenEgg:1,Honey:1,Blueberries:2", Amount = 2, Previous = { ["Ingredients"] = new string[1] { "Honey:1,Blueberries:3,DeerMeat:1" } } }, new Drink { Key = "XXL", PrefabName = "KongStrongXXL", Model = "canister", Texture = "tex_xxl", Metallic = 0f, Smoothness = 0.4f, BasePrefabs = new string[2] { "MeadStaminaMedium", "MeadStaminaMinor" }, Weight = 19f, StackSize = 1, ModelScale = 1.8f, ReturnsEmpty = false, FireResistance = (DamageModifier)1, Duration = 1200f, InstantStamina = 40f, StaminaRegenBonus = 50, SpeedBonus = 10, RunStaminaReduction = 25, JumpStaminaReduction = 25, Ingredients = "Vineberry:6,MushroomSmokePuff:3,MushroomYellow:3", Amount = 1, Previous = { ["Ingredients"] = new string[1] { "Honey:5,Raspberry:15" }, ["CraftingStation"] = new string[1] { "Workbench" } } }, new Drink { Key = "Frost", PrefabName = "KongStrongFrost", Texture = "tex_can_frost", Glow = new Color(0.6f, 0.85f, 1f), FrostResistance = (DamageModifier)1, Duration = 600f, InstantStamina = 30f, StaminaRegenBonus = 25, SpeedBonus = 5, RunStaminaReduction = 15, JumpStaminaReduction = 15, Ingredients = "Blueberries:3,FreezeGland:1,MushroomYellow:1", Amount = 2 }, new Drink { Key = "Toxic", PrefabName = "KongStrongToxic", Texture = "tex_can_toxic", Glow = new Color(0.55f, 1f, 0.45f), PoisonResistance = (DamageModifier)1, Duration = 600f, InstantStamina = 30f, StaminaRegenBonus = 25, SpeedBonus = 5, RunStaminaReduction = 15, JumpStaminaReduction = 15, Ingredients = "Blueberries:2,Ooze:1,Thistle:1,MushroomYellow:1", Amount = 2 }, new Drink { Key = "Eitr", PrefabName = "KongStrongEitr", Texture = "tex_can_eitr", Glow = new Color(0.8f, 0.55f, 1f), Duration = 600f, InstantStamina = 20f, InstantEitr = 25f, StaminaRegenBonus = 25, EitrRegenBonus = 50, Ingredients = "Sap:1,MushroomMagecap:1,MushroomYellow:1,Blueberries:2", Amount = 2 }, new Drink { Key = "MetBombe", PrefabName = "KongMetBombe", Fermented = true, Shout = false, Model = "meadbottle", Texture = "tex_metbombe", Metallic = 0.1f, Smoothness = 0.7f, BasePrefabs = new string[2] { "MeadTasty", "MeadStaminaMinor" }, FermenterBase = "MeadBaseTasty", Weight = 1f, StackSize = 10, ReturnsEmpty = false, Duration = 300f, HealOverTime = 50f, StaminaRegenBonus = 50, SpeedBonus = 10, RunStaminaReduction = 25, JumpStaminaReduction = 25, Ingredients = "Honey:5,KongStrongSugarFree:2,Raspberry:5", Amount = 1, FermenterYield = 6 } }; private readonly SkyrCupSettings _skyrCup = new SkyrCupSettings(); private bool _crashEnabled; private float _crashDuration; private int _crashRegenPenalty; private int _crashSpeedPenalty; private bool _heartEnabled; private float _heartDuration; private int _heartHealthPenalty; private int _heartStaminaPenalty; private bool _dumpPrefabs; private bool _customModels; private readonly Dictionary<string, Mesh> _meshes = new Dictionary<string, Mesh>(); private readonly Dictionary<string, SE_Kong> _effects = new Dictionary<string, SE_Kong>(); private bool _shout; private float _shoutVolume; private string _shoutFile; private float _shoutBoost; private GameObject _shoutSfx; private bool _shoutLoaded; internal static string EmptyFor(string itemToken) { if (!_emptiesEnabled || !ReturnsEmpty.Contains(itemToken)) { return null; } return "KongLeergut"; } private void Awake() { Drink[] drinks = _drinks; for (int i = 0; i < drinks.Length; i++) { drinks[i].Bind(((BaseUnityPlugin)this).Config); } _skyrCup.Bind(((BaseUnityPlugin)this).Config); Pieces.Bind(((BaseUnityPlugin)this).Config); BindGeneral(); Texts.Register(Get, _skyrCup); Harmony.CreateAndPatchAll(typeof(Patches), "felix.kongstrong"); PrefabManager.OnVanillaPrefabsAvailable += AddContent; } private void BindGeneral() { //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Expected O, but got Unknown //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Expected O, but got Unknown Patches.TooAwakeToSleep = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "TooAwakeToSleep", true, "Beds refuse to let you sleep while a Kong buff is active.").Value; _emptiesEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Empties", true, "Drinks leave an empty (Leergut) behind, for the deposit machine and the can pyramid.").Value; _crashEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("SugarCrash", "Enabled", true, "Urban Classic is followed by a sugar crash when its buff runs out.").Value; _crashDuration = ((BaseUnityPlugin)this).Config.Bind<float>("SugarCrash", "DurationSeconds", 60f, "How long the sugar crash lasts, in seconds.").Value; _crashRegenPenalty = ((BaseUnityPlugin)this).Config.Bind<int>("SugarCrash", "StaminaRegenPenaltyPercent", 25, "Slower stamina regeneration during the crash, in percent.").Value; _crashSpeedPenalty = ((BaseUnityPlugin)this).Config.Bind<int>("SugarCrash", "MoveSpeedPenaltyPercent", 5, "Slower movement during the crash, in percent.").Value; ToleranceSettings tolerance = SE_Kong.Tolerance; tolerance.Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("CaffeineTolerance", "Enabled", true, "Drinks taken shortly after each other work less.").Value; tolerance.WindowMinutes = ((BaseUnityPlugin)this).Config.Bind<float>("CaffeineTolerance", "WindowMinutes", 15f, "Drinks within this many minutes count as drunk in a row.").Value; tolerance.SecondDrinkPercent = ((BaseUnityPlugin)this).Config.Bind<int>("CaffeineTolerance", "SecondDrinkEffectPercent", 50, "Strength of the second drink in a row, in percent.").Value; tolerance.FurtherDrinkPercent = ((BaseUnityPlugin)this).Config.Bind<int>("CaffeineTolerance", "FurtherDrinkEffectPercent", 25, "Strength of the third and every further drink in a row, in percent.").Value; tolerance.HeartRacingFromDrink = ((BaseUnityPlugin)this).Config.Bind<int>("CaffeineTolerance", "HeartRacingFromDrink", 3, "From this drink in a row on you get heart racing. 0 turns it off.").Value; _heartEnabled = tolerance.HeartRacingFromDrink > 0; _heartDuration = ((BaseUnityPlugin)this).Config.Bind<float>("HeartRacing", "DurationSeconds", 120f, "How long heart racing lasts, in seconds.").Value; _heartHealthPenalty = ((BaseUnityPlugin)this).Config.Bind<int>("HeartRacing", "HealthRegenPenaltyPercent", 50, "Slower health regeneration during heart racing, in percent.").Value; _heartStaminaPenalty = ((BaseUnityPlugin)this).Config.Bind<int>("HeartRacing", "StaminaRegenPenaltyPercent", 25, "Slower stamina regeneration during heart racing, in percent.").Value; _shout = ConfigBinder.Bind(((BaseUnityPlugin)this).Config, "Sound", "Shout", value: true, "Every Kong Strong drink (cans, XXL, tap) is followed by a shouted \"D K!\".", new bool[1]); _customModels = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "CustomModels", true, "Cans, bottles and the canister get their own models. Off: they look like the vanilla meads.").Value; SE_Kong.PowerAnimation = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "PowerAnimation", true, "Drinking Kong raises your arms like activating a Forsaken power, with Eikthyr's glow.").Value; _shoutVolume = ConfigBinder.Bind(((BaseUnityPlugin)this).Config, "Sound", "ShoutVolume", 1f, new ConfigDescription("Volume of the shout (the clip itself is raised to full level).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()), new float[1] { 0.8f }); _shoutFile = ((BaseUnityPlugin)this).Config.Bind<string>("Sound", "CustomShoutFile", "KongStrong/shout.wav", "Your own 16 bit PCM WAV for the shout, relative to BepInEx/config or absolute. The mod ships no sound; without this file nothing is played.").Value; _shoutBoost = ((BaseUnityPlugin)this).Config.Bind<float>("Sound", "ShoutBoost", 2.5f, new ConfigDescription("Makes the shout louder than full scale allows by soft limiting (1 = off).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 8f), Array.Empty<object>())).Value; _dumpPrefabs = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "DumpPrefabs", false, "Logs the structure of some vanilla prefabs once at startup (development aid).").Value; } private Drink Get(string key) { return _drinks.First((Drink d) => d.Key == key); } private void AddContent() { PrefabManager.OnVanillaPrefabsAvailable -= AddContent; if (_dumpPrefabs) { PrefabDump.Dump(((BaseUnityPlugin)this).Logger, new string[15] { "MeadStaminaMinor", "MeadStaminaMedium", "MeadTasty", "MeadBaseTasty", "QueensJam", "Coins", "piece_chest_wood", "piece_chest", "piece_workbench", "piece_table", "piece_banner01", "piece_bench01", "barrell", "fermenter", "piece_cauldron" }); PrefabDump.ExportIcons(((BaseUnityPlugin)this).Logger, new string[17] { "MeadStaminaMinor", "MeadTasty", "MeadBaseTasty", "MeadFrostResist", "MeadPoisonResist", "MeadEitrMinor", "QueensJam", "CarrotSoup", "Coins", "Blueberries", "Honey", "Raspberry", "FreezeGland", "Bronze", "piece_chest_wood", "fermenter", "piece_cauldron" }); } Try("the sugar crash", delegate { if (_crashEnabled && _drinks.Any((Drink d) => d.Enabled && d.CausesCrash)) { SE_Kong.Crash = AddDebuff("SE_KongSugarCrash", "se_kong_crash", "crash", _crashDuration, 1f - (float)_crashRegenPenalty / 100f, 1f, (float)(-_crashSpeedPenalty) / 100f); } }); Try("heart racing", delegate { if (_heartEnabled && SE_Kong.Tolerance.Enabled) { SE_Kong.HeartRacing = AddDebuff("SE_KongHeartRacing", "se_kong_heartracing", "heartracing", _heartDuration, 1f - (float)_heartStaminaPenalty / 100f, 1f - (float)_heartHealthPenalty / 100f, 0f); } }); Try("the power effect", AddPowerEffect); Try("KongLeergut", AddEmpty); foreach (Drink drink in _drinks.Where((Drink d) => d.Enabled)) { Try(drink.PrefabName, delegate { AddDrink(drink); }); } if (_skyrCup.Enabled) { Try("KongSkyrCup", AddSkyrCup); } KongTap.Effect = (StatusEffect)(object)(_effects.TryGetValue("SugarFree", out var value) ? value : (_effects.TryGetValue("XXL", out var value2) ? value2 : null)); Pieces.Register(ParseRequirements, Try); } private Mesh MeshFor(string model) { if (!_meshes.TryGetValue(model, out var value)) { value = (Mesh)(model switch { "skyr" => Models.SkyrBottle(), "canister" => Models.Canister(), "meadbottle" => Models.MeadBottle(), "barrel" => Models.Barrel(), "cup" => Models.Cup(), "crushed" => Models.CrushedCan(), _ => Models.Can(), }); _meshes[model] = value; } return value; } private void Dress(CustomItem item, string model, string texture, float metallic, float smoothness, Color? glow, Sprite icon) { Piece component = item.ItemPrefab.GetComponent<Piece>(); if ((Object)(object)component != (Object)null) { component.m_name = item.ItemDrop.m_itemData.m_shared.m_name; component.m_description = item.ItemDrop.m_itemData.m_shared.m_description; component.m_icon = icon; } if (_customModels) { Visuals.ApplyItem(item.ItemPrefab, MeshFor(model), Visuals.ItemMaterial(texture, metallic, smoothness), glow); } } private void AddPowerEffect() { //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Expected O, but got Unknown //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Expected O, but got Unknown object obj = Cache.GetPrefab<StatusEffect>("GP_Eikthyr"); if (obj == null) { ObjectDB instance = ObjectDB.instance; obj = ((instance != null) ? instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode("GP_Eikthyr")) : null); } StatusEffect val = (StatusEffect)obj; if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"GP_Eikthyr not found, drinking plays the power animation without the glow."); return; } List<EffectData> list = new List<EffectData>(); EffectData[] array = (EffectData[])(((object)val.m_startEffects?.m_effectPrefabs) ?? ((object)new EffectData[0])); foreach (EffectData val2 in array) { if ((Object)(object)val2?.m_prefab == (Object)null || (Object)(object)val2.m_prefab.GetComponent<ZSFX>() != (Object)null) { continue; } GameObject val3 = val2.m_prefab; if ((Object)(object)val3.GetComponentInChildren<ZSFX>(true) != (Object)null || (Object)(object)val3.GetComponentInChildren<AudioSource>(true) != (Object)null) { val3 = PrefabManager.Instance.CreateClonedPrefab("kong_" + ((Object)val2.m_prefab).name, val2.m_prefab); ZSFX[] componentsInChildren = val3.GetComponentsInChildren<ZSFX>(true); for (int j = 0; j < componentsInChildren.Length; j++) { Object.DestroyImmediate((Object)(object)componentsInChildren[j]); } AudioSource[] componentsInChildren2 = val3.GetComponentsInChildren<AudioSource>(true); for (int j = 0; j < componentsInChildren2.Length; j++) { Object.DestroyImmediate((Object)(object)componentsInChildren2[j]); } } list.Add(new EffectData { m_prefab = val3, m_enabled = val2.m_enabled, m_variant = val2.m_variant, m_attach = val2.m_attach, m_follow = val2.m_follow, m_inheritParentRotation = val2.m_inheritParentRotation, m_inheritParentScale = val2.m_inheritParentScale, m_multiplyParentVisualScale = val2.m_multiplyParentVisualScale, m_randomRotation = val2.m_randomRotation, m_scale = val2.m_scale, m_childTransform = val2.m_childTransform }); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Power effect from GP_Eikthyr: " + string.Join(", ", list.Select((EffectData v) => ((Object)v.m_prefab).name)) + " " + $"(of {(val.m_startEffects?.m_effectPrefabs?.Length).GetValueOrDefault()} effects)")); if (list.Count > 0) { SE_Kong.PowerEffects = new EffectList { m_effectPrefabs = list.ToArray() }; } } private void Try(string what, Action action) { try { action(); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Failed to add {what}: {arg}"); } } private StatusEffect AddDebuff(string name, string token, string icon, float duration, float staminaRegen, float healthRegen, float speed) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown SE_Stats val = ScriptableObject.CreateInstance<SE_Stats>(); ((Object)val).name = name; ((StatusEffect)val).m_name = "$" + token; ((StatusEffect)val).m_tooltip = ((StatusEffect)val).m_name + "_tooltip"; ((StatusEffect)val).m_category = "kongstrong"; ((StatusEffect)val).m_icon = Icons.Get(icon); ((StatusEffect)val).m_ttl = duration; ((StatusEffect)val).m_startMessageType = (MessageType)2; ((StatusEffect)val).m_startMessage = ((StatusEffect)val).m_name + "_start"; val.m_staminaRegenMultiplier = Mathf.Max(0f, staminaRegen); val.m_healthRegenMultiplier = Mathf.Max(0f, healthRegen); val.m_speedModifier = speed; ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)val, false)); return (StatusEffect)(object)val; } private void AddDrink(Drink drink) { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Expected O, but got Unknown //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Expected O, but got Unknown //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) string text = drink.BasePrefabs.FirstOrDefault((string n) => (Object)(object)PrefabManager.Instance.GetPrefab(n) != (Object)null); if (text == null) { ((BaseUnityPlugin)this).Logger.LogError((object)("None of the base prefabs (" + string.Join(", ", drink.BasePrefabs) + ") exist, " + drink.PrefabName + " not added.")); return; } Sprite icon = Icons.Get(drink.Key.ToLowerInvariant()); StatusEffect consumeStatusEffect = PrefabManager.Instance.GetPrefab(text).GetComponent<ItemDrop>().m_itemData.m_shared.m_consumeStatusEffect; SE_Kong sE_Kong = CreateEffect(drink, icon, consumeStatusEffect); ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)sE_Kong, false)); _effects[drink.Key] = sE_Kong; ItemConfig val = new ItemConfig { Name = "$item_" + drink.Token, Description = "$item_" + drink.Token + "_desc", Icon = icon, Weight = drink.Weight, StackSize = drink.StackSize }; if (!drink.Fermented) { val.CraftingStation = CraftingStations.GetInternalName(drink.CraftingStation); val.Amount = Mathf.Max(1, drink.Amount); val.Requirements = ParseRequirements(drink.PrefabName, drink.Ingredients); } CustomItem val2 = new CustomItem(drink.PrefabName, text, val); val2.ItemDrop.m_itemData.m_shared.m_consumeStatusEffect = (StatusEffect)(object)sE_Kong; if (!_customModels) { Transform transform = val2.ItemPrefab.transform; transform.localScale *= drink.ModelScale; } Dress(val2, drink.Model, drink.Texture, drink.Metallic, drink.Smoothness, drink.Glow, icon); ItemManager.Instance.AddItem(val2); if (drink.ReturnsEmpty) { ReturnsEmpty.Add(val.Name); } if (drink.Fermented) { AddFermenterBase(drink); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Added " + drink.PrefabName + " (cloned from " + text + ").")); } private SE_Kong CreateEffect(Drink drink, Sprite icon, StatusEffect baseEffect) { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) SE_Kong sE_Kong = ScriptableObject.CreateInstance<SE_Kong>(); bool flag = (sE_Kong.CausesCrash = drink.CausesCrash && (Object)(object)SE_Kong.Crash != (Object)null); ((Object)sE_Kong).name = "SE_" + drink.PrefabName; ((StatusEffect)sE_Kong).m_name = "$se_" + drink.Token; ((StatusEffect)sE_Kong).m_tooltip = "$se_" + drink.Token + "_tooltip"; ((StatusEffect)sE_Kong).m_category = "kongstrong"; ((StatusEffect)sE_Kong).m_icon = icon; ((StatusEffect)sE_Kong).m_ttl = drink.Duration; ((StatusEffect)sE_Kong).m_startMessageType = (MessageType)2; ((StatusEffect)sE_Kong).m_startMessage = "$se_" + drink.Token + "_start"; if (!flag) { ((StatusEffect)sE_Kong).m_stopMessageType = (MessageType)1; ((StatusEffect)sE_Kong).m_stopMessage = "$se_kong_stop"; } ((SE_Stats)sE_Kong).m_staminaUpFront = drink.InstantStamina; ((SE_Stats)sE_Kong).m_eitrUpFront = drink.InstantEitr; if (drink.HealOverTime > 0f) { ((SE_Stats)sE_Kong).m_healthOverTime = drink.HealOverTime; ((SE_Stats)sE_Kong).m_healthOverTimeDuration = 10f; ((SE_Stats)sE_Kong).m_healthOverTimeInterval = 1f; } ((SE_Stats)sE_Kong).m_staminaRegenMultiplier = 1f + (float)drink.StaminaRegenBonus / 100f; ((SE_Stats)sE_Kong).m_healthRegenMultiplier = 1f + (float)drink.HealthRegenBonus / 100f; ((SE_Stats)sE_Kong).m_eitrRegenMultiplier = 1f + (float)drink.EitrRegenBonus / 100f; ((SE_Stats)sE_Kong).m_speedModifier = (float)drink.SpeedBonus / 100f; ((SE_Stats)sE_Kong).m_runStaminaDrainModifier = (float)(-drink.RunStaminaReduction) / 100f; ((SE_Stats)sE_Kong).m_jumpStaminaUseModifier = (float)(-drink.JumpStaminaReduction) / 100f; ((SE_Stats)sE_Kong).m_addMaxCarryWeight = drink.CarryWeightBonus; List<DamageModPair> mods = new List<DamageModPair>(); AddResistance(mods, (DamageType)32, drink.FireResistance); AddResistance(mods, (DamageType)64, drink.FrostResistance); AddResistance(mods, (DamageType)256, drink.PoisonResistance); ((SE_Stats)sE_Kong).m_mods = mods; if ((Object)(object)baseEffect != (Object)null) { if (_shout && !_shoutLoaded && !GUIManager.IsHeadless()) { _shoutLoaded = true; Try("the shout", delegate { AudioClip val = LoadShout(); if ((Object)(object)val != (Object)null) { _shoutSfx = Sounds.CreateSfx("sfx_kong_dk", val, baseEffect.m_startEffects, _shoutVolume, 0.35f); } }); } ((StatusEffect)sE_Kong).m_startEffects = ((_shout && drink.Shout) ? Sounds.With(baseEffect.m_startEffects, _shoutSfx) : baseEffect.m_startEffects); ((StatusEffect)sE_Kong).m_stopEffects = baseEffect.m_stopEffects; } return sE_Kong; } private AudioClip LoadShout() { string text = (string.IsNullOrEmpty(_shoutFile) ? null : (Path.IsPathRooted(_shoutFile) ? _shoutFile : Path.Combine(Paths.ConfigPath, _shoutFile))); if (text != null && File.Exists(text)) { try { AudioClip clip = Sounds.LoadWavFile(text); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Using your shout from {text} (boost x{_shoutBoost})."); return Sounds.Normalize(clip, _shoutBoost); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not read " + text + ": " + ex.Message)); } } else { ((BaseUnityPlugin)this).Logger.LogInfo((object)("No shout file at " + text + ", so no \"D K!\". The mod ships none.")); } return null; } private static void AddResistance(List<DamageModPair> mods, DamageType type, DamageModifier modifier) { //IL_0000: 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_000e: 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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if ((int)modifier != 0) { mods.Add(new DamageModPair { m_type = type, m_modifier = modifier }); } } private void AddFermenterBase(Drink drink) { //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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Expected O, but got Unknown //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Expected O, but got Unknown ItemConfig val = new ItemConfig { Name = "$item_" + drink.Token + "_base", Description = "$item_" + drink.Token + "_base_desc", Icon = Icons.Get(drink.Key.ToLowerInvariant() + "_base"), CraftingStation = CraftingStations.GetInternalName(drink.CraftingStation), Amount = Mathf.Max(1, drink.Amount), Requirements = ParseRequirements(drink.BasePrefabName, drink.Ingredients) }; CustomItem val2 = new CustomItem(drink.BasePrefabName, drink.FermenterBase, val); Dress(val2, "barrel", "tex_barrel", 0f, 0.25f, null, val.Icon); ItemManager.Instance.AddItem(val2); ItemManager.Instance.AddItemConversion(new CustomItemConversion((ConversionConfig)new FermenterConversionConfig { FromItem = drink.BasePrefabName, ToItem = drink.PrefabName, ProducedItems = Mathf.Max(1, drink.FermenterYield) })); } private void AddEmpty() { //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_002b: 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_003f: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) ItemConfig val = new ItemConfig { Name = "$item_kong_empty", Description = "$item_kong_empty_desc", Icon = Icons.Get("empty"), Weight = 0.1f, StackSize = 50 }; CustomItem val2 = new CustomItem("KongLeergut", "MeadStaminaMinor", val); SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_itemType = (ItemType)1; shared.m_consumeStatusEffect = null; shared.m_food = (shared.m_foodStamina = (shared.m_foodEitr = 0f)); Dress(val2, "can", "tex_empty", 0.6f, 0.5f, null, val.Icon); ItemManager.Instance.AddItem(val2); } private void AddSkyrCup() { //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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) ItemConfig val = new ItemConfig { Name = "$item_kong_skyrcup", Description = "$item_kong_skyrcup_desc", Icon = Icons.Get("skyrcup"), CraftingStation = CraftingStations.GetInternalName(_skyrCup.CraftingStation), Amount = Mathf.Max(1, _skyrCup.Amount), Requirements = ParseRequirements("KongSkyrCup", _skyrCup.Ingredients), StackSize = 10 }; CustomItem val2 = new CustomItem("KongSkyrCup", "QueensJam", val); SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_itemType = (ItemType)2; shared.m_consumeStatusEffect = null; shared.m_food = _skyrCup.Health; shared.m_foodStamina = _skyrCup.Stamina; shared.m_foodEitr = _skyrCup.Eitr; shared.m_foodBurnTime = _skyrCup.Duration; shared.m_foodRegen = _skyrCup.Regen; Dress(val2, "cup", "tex_skyrcup", 0f, 0.3f, null, val.Icon); ItemManager.Instance.AddItem(val2); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Added KongSkyrCup (cloned from QueensJam)."); } private RequirementConfig[] ParseRequirements(string owner, string value) { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown List<RequirementConfig> list = new List<RequirementConfig>(); string[] array = value.Split(','); foreach (string text in array) { string[] array2 = text.Split(':'); string text2 = array2[0].Trim(); if (text2.Length != 0) { int result = 1; if (array2.Length > 1 && !int.TryParse(array2[1].Trim(), out result)) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Invalid amount in ingredient '" + text + "', using 1.")); result = 1; } if ((Object)(object)PrefabManager.Instance.GetPrefab(text2) == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)(owner + ": ingredient '" + text2 + "' was not found, check the prefab name.")); } list.Add(new RequirementConfig(text2, Mathf.Max(1, result), 0, true)); } } return list.ToArray(); } } internal readonly struct Ring { public readonly float R; public readonly float Y; public readonly float V; public Ring(float r, float y, float v) { R = r; Y = y; V = v; } } internal static class Models { private static readonly Rect FridgeDoorUv = new Rect(0f, 0f, 0.5f, 1f); private static readonly Rect FridgeSide = new Rect(0.5f, 0.5f, 0.5f, 0.5f); private static readonly Rect FridgeTop = new Rect(0.5f, 0f, 0.25f, 0.5f); private static readonly Rect FridgeInside = new Rect(0.75f, 0f, 0.25f, 0.5f); public const float FridgeWidth = 0.9f; public const float FridgeHeight = 1.6f; public const float FridgeDepth = 0.75f; public const float DoorThickness = 0.06f; public static Mesh Lathe(string name, Ring[] profile, int segments = 32, Func<float, float> shape = null, float depth = 1f, float uMin = 0f, float uMax = 1f) { //IL_003a: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0275: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) int num = profile.Length; Vector2[] array = (Vector2[])(object)new Vector2[num]; Vector2 val2; for (int i = 0; i < num; i++) { bool flag = i > 0 && Point(i) == Point(i - 1); bool flag2 = i < num - 1 && Point(i) == Point(i + 1); Vector2 val = ((!(i == 0 || flag)) ? ((!(i == num - 1 || flag2)) ? (Point(i + 1) - Point(i - 1)) : (Point(i) - Point(i - 1))) : (Point(Math.Min(i + 1 + (flag2 ? 1 : 0), num - 1)) - Point(i))); int num2 = i; val2 = new Vector2(val.y, 0f - val.x); array[num2] = ((Vector2)(ref val2)).normalized; } List<Vector3> list = new List<Vector3>(); List<Vector3> list2 = new List<Vector3>(); List<Vector2> list3 = new List<Vector2>(); List<int> list4 = new List<int>(); for (int j = 0; j < num; j++) { for (int k = 0; k <= segments; k++) { float num3 = (float)k / (float)segments; float num4 = num3 * (float)Math.PI * 2f; Vector2 val3 = Section(num4); Vector2 val4 = Section(num4 + 0.001f) - Section(num4 - 0.001f); val2 = new Vector2(val4.y, 0f - val4.x); Vector2 normalized = ((Vector2)(ref val2)).normalized; list.Add(new Vector3(val3.x * profile[j].R, profile[j].Y, val3.y * profile[j].R)); Vector3 val5 = new Vector3(normalized.x * array[j].x, array[j].y, normalized.y * array[j].x); list2.Add(((Vector3)(ref val5)).normalized); list3.Add(new Vector2(uMin + (uMax - uMin) * num3, profile[j].V)); } } int num5 = segments + 1; for (int l = 0; l < num - 1; l++) { for (int m = 0; m < segments; m++) { int num6 = l * num5 + m; int num7 = (l + 1) * num5 + m; int num8 = num6 + 1; int num9 = num7 + 1; list4.AddRange(new int[6] { num6, num7, num8, num7, num9, num8 }); } } return Build(name, list, list2, list3, list4); Vector2 Point(int num10) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) return new Vector2(profile[num10].R, profile[num10].Y); } Vector2 Section(float a) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) float num10 = shape?.Invoke(a) ?? 1f; return new Vector2(Mathf.Cos(a) * num10, Mathf.Sin(a) * num10 * depth); } } public static Mesh Box(string name, Vector3 center, Vector3 size, Rect front, Rect back, Rect left, Rect right, Rect top, Rect bottom) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00bc: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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_0118: Unknown result type (might be due to invalid IL or missing references) List<Vector3> vertices = new List<Vector3>(); List<Vector3> normals = new List<Vector3>(); List<Vector2> uvs = new List<Vector2>(); List<int> triangles = new List<int>(); Vector3 val = size * 0.5f; Face(Vector3.forward, Vector3.up, size.x, size.y, val.z, front); Face(Vector3.back, Vector3.up, size.x, size.y, val.z, back); Face(Vector3.left, Vector3.up, size.z, size.y, val.x, left); Face(Vector3.right, Vector3.up, size.z, size.y, val.x, right); Face(Vector3.up, Vector3.forward, size.x, size.z, val.y, top); Face(Vector3.down, Vector3.back, size.x, size.z, val.y, bottom); return Build(name, vertices, normals, uvs, triangles); void Face(Vector3 normal, Vector3 up, float width, float height, float distance, Rect uv) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_0072: 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_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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) Vector3 val2 = Vector3.Cross(up, -normal); Vector3 val3 = center + normal * distance; int count = vertices.Count; vertices.Add(val3 - val2 * width / 2f - up * height / 2f); vertices.Add(val3 + val2 * width / 2f - up * height / 2f); vertices.Add(val3 + val2 * width / 2f + up * height / 2f); vertices.Add(val3 - val2 * width / 2f + up * height / 2f); uvs.Add(new Vector2(((Rect)(ref uv)).xMin, ((Rect)(ref uv)).yMin)); uvs.Add(new Vector2(((Rect)(ref uv)).xMax, ((Rect)(ref uv)).yMin)); uvs.Add(new Vector2(((Rect)(ref uv)).xMax, ((Rect)(ref uv)).yMax)); uvs.Add(new Vector2(((Rect)(ref uv)).xMin, ((Rect)(ref uv)).yMax)); for (int i = 0; i < 4; i++) { normals.Add(normal); } triangles.AddRange(new int[6] { count, count + 3, count + 2, count, count + 2, count + 1 }); } } public static Mesh Box(string name, Vector3 center, Vector3 size, Rect all) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return Box(name, center, size, all, all, all, all, all, all); } public static Mesh Combine(string name, params (Mesh mesh, Matrix4x4 matrix)[] parts) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown CombineInstance[] array = parts.Select(delegate((Mesh mesh, Matrix4x4 matrix) p) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) CombineInstance result = default(CombineInstance); (((CombineInstance)(ref result)).mesh, ((CombineInstance)(ref result)).transform) = p; return result; }).ToArray(); Mesh val = new Mesh { name = name }; val.CombineMeshes(array, true, true); val.RecalculateBounds(); return val; } private static Mesh Build(string name, List<Vector3> vertices, List<Vector3> normals, List<Vector2> uvs, List<int> triangles) { //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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown Mesh val = new Mesh { name = name }; val.SetVertices(vertices); val.SetNormals(normals); val.SetUVs(0, uvs); val.SetTriangles(triangles, 0); val.RecalculateBounds(); return val; } private static Matrix4x4 At(float x, float y, float z, float yaw = 0f, float pitch = 0f) { //IL_0003: 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) //IL_001a: Unknown result type (might be due to invalid IL or missing references) return Matrix4x4.TRS(new Vector3(x, y, z), Quaternion.Euler(pitch, yaw, 0f), Vector3.one); } private static float RoundedSquare(float a) { return 1f / Mathf.Pow(Mathf.Pow(Mathf.Abs(Mathf.Cos(a)), 4f) + Mathf.Pow(Mathf.Abs(Mathf.Sin(a)), 4f), 0.25f); } public static Mesh Can() { return Lathe("kong_can", new Ring[10] { new Ring(0f, 0.006f, 0f), new Ring(0.04f, 0f, 0.03f), new Ring(0.05f, 0.01f, 0.06f), new Ring(0.05f, 0.018f, 0.08f), new Ring(0.05f, 0.208f, 0.88f), new Ring(0.046f, 0.226f, 0.92f), new Ring(0.042f, 0.236f, 0.95f), new Ring(0.043f, 0.24f, 0.96f), new Ring(0.038f, 0.236f, 0.98f), new Ring(0f, 0.232f, 1f) }); } public static Mesh CrushedCan() { return Lathe("kong_can_crushed", new Ring[9] { new Ring(0f, 0.006f, 0f), new Ring(0.044f, 0f, 0.03f), new Ring(0.054f, 0.01f, 0.06f), new Ring(0.058f, 0.04f, 0.3f), new Ring(0.05f, 0.075f, 0.5f), new Ring(0.06f, 0.11f, 0.7f), new Ring(0.05f, 0.14f, 0.92f), new Ring(0.043f, 0.15f, 0.96f), new Ring(0f, 0.146f, 1f) }, 24, (float a) => 1f + 0.07f * Mathf.Sin(a * 3f) + 0.04f * Mathf.Sin(a * 7f + 1f)); } public static Mesh SkyrBottle() { return Lathe("kong_skyr", new Ring[15] { new Ring(0f, 0.004f, 0f), new Ring(0.05f, 0f, 0.02f), new Ring(0.055f, 0.012f, 0.05f), new Ring(0.055f, 0.08f, 0.3f), new Ring(0.048f, 0.095f, 0.36f), new Ring(0.055f, 0.11f, 0.42f), new Ring(0.055f, 0.15f, 0.58f), new Ring(0.055f, 0.158f, 0.61f), new Ring(0.05f, 0.185f, 0.72f), new Ring(0.036f, 0.205f, 0.82f), new Ring(0.024f, 0.215f, 0.86f), new Ring(0.024f, 0.222f, 0.9f), new Ring(0.029f, 0.222f, 0.9f), new Ring(0.029f, 0.255f, 0.98f), new Ring(0f, 0.258f, 1f) }); } public static Mesh MeadBottle() { return Lathe("kong_meadbottle", new Ring[12] { new Ring(0f, 0.005f, 0f), new Ring(0.058f, 0f, 0.03f), new Ring(0.065f, 0.015f, 0.08f), new Ring(0.065f, 0.05f, 0.2f), new Ring(0.065f, 0.17f, 0.62f), new Ring(0.06f, 0.195f, 0.7f), new Ring(0.035f, 0.225f, 0.8f), new Ring(0.022f, 0.25f, 0.88f), new Ring(0.022f, 0.265f, 0.92f), new Ring(0.026f, 0.265f, 0.93f), new Ring(0.026f, 0.295f, 0.99f), new Ring(0f, 0.298f, 1f) }); } public static Mesh Barrel() { return Lathe("kong_barrel", new Ring[9] { new Ring(0f, 0.004f, 0f), new Ring(0.105f, 0f, 0.02f), new Ring(0.11f, 0.01f, 0.03f), new Ring(0.125f, 0.07f, 0.2f), new Ring(0.132f, 0.14f, 0.5f), new Ring(0.125f, 0.21f, 0.8f), new Ring(0.11f, 0.27f, 0.97f), new Ring(0.1f, 0.274f, 0.985f), new Ring(0f, 0.27f, 1f) }, 20); } public static Mesh Cup() { return Lathe("kong_cup", new Ring[7] { new Ring(0f, 0.003f, 0f), new Ring(0.05f, 0f, 0.03f), new Ring(0.05f, 0.006f, 0.05f), new Ring(0.063f, 0.112f, 0.95f), new Ring(0.067f, 0.118f, 0.955f), new Ring(0.066f, 0.12f, 0.97f), new Ring(0f, 0.118f, 1f) }); } public static Mesh Canister() { //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) Mesh item = Lathe("kong_canister_body", new Ring[7] { new Ring(0f, 0.004f, 0f), new Ring(0.15f, 0f, 0.02f), new Ring(0.17f, 0.02f, 0.05f), new Ring(0.17f, 0.43f, 0.8f), new Ring(0.15f, 0.47f, 0.86f), new Ring(0.06f, 0.49f, 0.86f), new Ring(0f, 0.492f, 0.86f) }, 40, RoundedSquare, 0.7f); Mesh item2 = Lathe("kong_canister_cap", new Ring[4] { new Ring(0f, 0.47f, 0.9f), new Ring(0.035f, 0.47f, 0.9f), new Ring(0.035f, 0.53f, 0.97f), new Ring(0f, 0.532f, 1f) }, 16, null, 1f, 0.62f, 0.98f); Rect all = default(Rect); ((Rect)(ref all))..ctor(0.45f, 0.4f, 0.05f, 0.05f); Mesh item3 = Box("kong_canister_post", new Vector3(0f, 0.035f, 0f), new Vector3(0.03f, 0.07f, 0.045f), all); Mesh item4 = Box("kong_canister_bar", Vector3.zero, new Vector3(0.15f, 0.03f, 0.045f), all); return Combine("kong_canister", (item, Matrix4x4.identity), (item2, At(-0.085f, 0f, 0f)), (item3, At(0.02f, 0.47f, 0f)), (item3, At(0.15f, 0.47f, 0f)), (item4, At(0.085f, 0.555f, 0f))); } public static Mesh FridgeBody() { //IL_0014: 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_002d: 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) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) return Box("kong_fridge_body", new Vector3(0f, 0.8f, 0f), new Vector3(0.9f, 1.6f, 0.75f), FridgeInside, FridgeSide, FridgeSide, FridgeSide, FridgeTop, FridgeTop); } public static Mesh FridgeDoor() { //IL_0014: 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_002d: 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) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) return Box("kong_fridge_door", new Vector3(-0.45f, 0.8f, 0.03f), new Vector3(0.9f, 1.6f, 0.06f), FridgeDoorUv, FridgeSide, FridgeSide, FridgeSide, FridgeTop, FridgeTop); } public static Mesh Automat() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) Rect front = default(Rect); ((Rect)(ref front))..ctor(0f, 0f, 0.5f, 1f); Rect val = default(Rect); ((Rect)(ref val))..ctor(0.5f, 0f, 0.42f, 1f); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(0.96f, 0.3f, 0.03f, 0.3f); return Box("kong_automat", new Vector3(0f, 0.95f, 0f), new Vector3(1f, 1.9f, 0.8f), front, val, val, val, val2, val2); } public static Mesh PyramidRow(int row) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) Mesh item = Can(); int num = 4 - row; List<(Mesh, Matrix4x4)> list = new List<(Mesh, Matrix4x4)>(); for (int i = 0; i < num; i++) { float x = ((float)i - (float)(num - 1) / 2f) * 0.104f; list.Add((item, At(x, (float)row * 0.241f, 0f, 37f * (float)(i + row)))); } return Combine("kong_pyramid_row" + row, list.ToArray()); } public static Mesh TapStand() { //IL_0020: 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) //IL_0039: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_010d: 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) Rect all = default(Rect); ((Rect)(ref all))..ctor(0f, 0f, 1f, 1f); Mesh item = Box("kong_tap_plate", Vector3.zero, new Vector3(0.48f, 0.04f, 0.36f), all); Mesh item2 = Box("kong_tap_leg", Vector3.zero, new Vector3(0.05f, 0.6f, 0.05f), all); return Combine("kong_tap_stand", (item, At(0f, 0.6f, 0f)), (item2, At(0.2f, 0.3f, 0.14f)), (item2, At(-0.2f, 0.3f, 0.14f)), (item2, At(0.2f, 0.3f, -0.14f)), (item2, At(-0.2f, 0.3f, -0.14f))); } public static Mesh TapCanister() { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) Mesh item = Lathe("kong_spigot", new Ring[4] { new Ring(0f, 0f, 0.9f), new Ring(0.016f, 0f, 0.9f), new Ring(0.016f, 0.09f, 0.97f), new Ring(0f, 0.092f, 1f) }, 12, null, 1f, 0.62f, 0.98f); return Combine("kong_tap_canister", (Canister(), At(0f, 0.62f, 0f)), (item, At(0f, 0.68f, 0.1f, 0f, 90f))); } } internal static class Patches { internal static bool TooAwakeToSleep = true; [HarmonyPatch(typeof(Bed), "Interact")] [HarmonyPrefix] private static bool BedInteract(Bed __instance, Humanoid human, bool repeat, ref bool __result) { if (!TooAwakeToSleep || repeat || (Object)(object)human == (Object)null || (Object)(object)human != (Object)(object)Player.m_localPlayer) { return true; } if (!__instance.IsCurrent() || !EnvMan.CanSleep() || !SE_Kong.HasActiveDrink((Character)(object)human)) { return true; } ((Character)human).Message((MessageType)2, "$msg_kong_tooawake", 0, (Sprite)null, false); __result = false; return false; } [HarmonyPatch(typeof(Player), "ActivateGuardianPower")] [HarmonyPrefix] private static bool ActivateGuardianPower(Player __instance, ref bool __result) { if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer || Time.time > SE_Kong.SuppressGuardianPowerUntil) { return true; } SE_Kong.SuppressGuardianPowerUntil = 0f; __result = false; return false; } [HarmonyPatch(typeof(Player), "ConsumeItem")] [HarmonyPostfix] private static void ConsumeItem(Player __instance, ItemData item, bool __result) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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) if (!__result || item == null || (Object)(object)__instance != (Object)(object)Player.m_localPlayer) { return; } string text = KongStrongPlugin.EmptyFor(item.m_shared.m_name); GameObject val = ((text == null || (Object)(object)ObjectDB.instance == (Object)null) ? null : ObjectDB.instance.GetItemPrefab(text)); if (!((Object)(object)val == (Object)null)) { Inventory inventory = ((Humanoid)__instance).GetInventory(); if (inventory.CanAddItem(val, 1)) { inventory.AddItem(val, 1); return; } Transform transform = ((Component)__instance).transform; Object.Instantiate<GameObject>(val, transform.position + transform.forward * 0.5f + Vector3.up, Quaternion.identity); } } } internal sealed class PieceSettings { public string Key; public bool Enabled = true; public string Ingredients; public void Bind(ConfigFile config) { Enabled = config.Bind<bool>(Key, "Enabled", Enabled, "Adds this piece to the hammer.").Value; Ingredients = config.Bind<string>(Key, "Ingredients", Ingredients, "Comma separated list of ItemPrefab:Amount.").Value; } } internal static class Pieces { public static readonly PieceSettings Fridge = new PieceSettings { Key = "Fridge", Ingredients = "FineWood:6,Bronze:2,FreezeGland:1" }; public static readonly PieceSettings Pyramid = new PieceSettings { Key = "CanPyramid", Ingredients = "KongLeergut:10" }; public static readonly PieceSettings Automat = new PieceSettings { Key = "DepositMachine", Ingredients = "FineWood:8,Bronze:3" }; public static readonly PieceSettings Tap = new PieceSettings { Key = "Tap", Ingredients = "KongStrongXXL:1,Wood:6" }; public static void Bind(ConfigFile config) { Fridge.Bind(config); Pyramid.Bind(config); Automat.Bind(config); Tap.Bind(config); KongDepositMachine.CoinsPerEmpty = config.Bind<int>(Automat.Key, "CoinsPerEmpty", 1, "Coins paid for each empty.").Value; KongTap.Full = Mathf.Max(1, config.Bind<int>(Tap.Key, "Servings", 38, "Drinks in one XXL canister on the tap.").Value); } public static void Register(Func<string, string, RequirementConfig[]> parse, Action<string, Action> attempt) { if (Fridge.Enabled) { attempt("piece_kong_fridge", delegate { AddFridge(parse); }); } if (Pyramid.Enabled) { attempt("piece_kong_pyramid", delegate { AddPyramid(parse); }); } if (Automat.Enabled) { attempt("piece_kong_automat", delegate { AddAutomat(parse); }); } if (Tap.Enabled) { attempt("piece_kong_tap", delegate { AddTap(parse); }); } } private static GameObject FromChest(string name, bool keepContainer, out Transform model) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown GameObject val = PrefabManager.Instance.CreateClonedPrefab(name, "piece_chest_wood"); Transform val2 = val.transform.Find("floor_2x2_snow"); if ((Object)(object)val2 != (Object)null) { Object.DestroyImmediate((Object)(object)((Component)val2).gameObject); } model = val.transform.Find("New"); List<GameObject> list = new List<GameObject>(); foreach (Transform item in model) { Transform val3 = item; list.Add(((Component)val3).gameObject); } list.ForEach((Action<GameObject>)Object.DestroyImmediate); LODGroup component = ((Component)model).GetComponent<LODGroup>(); if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } if (!keepContainer) { Object.DestroyImmediate((Object)(object)val.GetComponent<Container>()); } return val; } private static void Add(GameObject prefab, string token, string icon, string category, string station, RequirementConfig[] requirements) { //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_0016: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown PieceConfig val = new PieceConfig { Name = "$" + token, Description = "$" + token + "_desc", Icon = Icons.Get(icon), PieceTable = PieceTables.Hammer, Category = category, CraftingStation = station, Requirements = requirements }; PieceManager.Instance.AddPiece(new CustomPiece(prefab, false, val)); } private static void AddFridge(Func<string, string, RequirementConfig[]> parse) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) Transform model; GameObject obj = FromChest("piece_kong_fridge", keepContainer: true, out model); Material material = Visuals.PieceMaterial("tex_fridge"); Visuals.AddPart(model, "body", Models.FridgeBody(), material, Vector3.zero, Quaternion.identity); Mesh mesh = Models.FridgeDoor(); Vector3 position = default(Vector3); ((Vector3)(ref position))..ctor(0.45f, 0f, 0.375f); GameObject closed = Visuals.AddPart(model, "door_closed", mesh, material, position, Quaternion.identity, collider: false); GameObject val = Visuals.AddPart(model, "door_open", mesh, material, position, Quaternion.Euler(0f, 100f, 0f), collider: false); val.SetActive(false); Container component = obj.GetComponent<Container>(); component.m_name = "$piece_kong_fridge"; component.m_width = 4; component.m_height = 4; component.m_open = val; component.m_closed = closed; Add(obj, "piece_kong_fridge", "fridge", PieceCategories.Furniture, CraftingStations.Workbench, parse("piece_kong_fridge", Fridge.Ingredients)); } private static void AddPyramid(Func<string, string, RequirementConfig[]> parse) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) Transform model; GameObject val = FromChest("piece_kong_pyramid", keepContainer: false, out model); string[] array = new string[4] { "tex_can_sugarfree", "tex_can_classic", "tex_can_frost", "tex_can_toxic" }; for (int i = 0; i < 4; i++) { Visuals.AddPart(model, "row" + i, Models.PyramidRow(i), Visuals.PieceMaterial(array[i]), Vector3.zero, Quaternion.identity, collider: false); } BoxCollider obj = ((Component)model).gameObject.AddComponent<BoxCollider>(); obj.center = new Vector3(0f, 0.48f, 0f); obj.size = new Vector3(0.42f, 0.96f, 0.1f); val.GetComponent<Piece>().m_comfort = 1; Add(val, "piece_kong_pyramid", "pyramid", PieceCategories.Furniture, null, parse("piece_kong_pyramid", Pyramid.Ingredients)); } private static void AddAutomat(Func<string, string, RequirementConfig[]> parse) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) Transform model; GameObject obj = FromChest("piece_kong_automat", keepContainer: false, out model); Visuals.AddPart(material: Visuals.PieceMaterial((Localization.instance != null && Localization.instance.GetSelectedLanguage() == "German") ? "tex_automat" : "tex_automat_en"), parent: model, name: "body", mesh: Models.Automat(), position: Vector3.zero, rotation: Quaternion.identity); obj.AddComponent<KongDepositMachine>(); Add(obj, "piece_kong_automat", "automat", PieceCategories.Misc, CraftingStations.Workbench, parse("piece_kong_automat", Automat.Ingredients)); } private static void AddTap(Func<string, string, RequirementConfig[]> parse) { //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_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) Transform model; GameObject val = FromChest("piece_kong_tap", keepContainer: false, out model); Visuals.AddPart(model, "stand", Models.TapStand(), Visuals.PieceMaterial("tex_wood"), Vector3.zero, Quaternion.identity); Visuals.AddPart(model, "canister", Models.TapCanister(), Visuals.PieceMaterial("tex_xxl"), Vector3.zero, Quaternion.identity); val.AddComponent<KongTap>(); RequirementConfig[] array = parse("piece_kong_tap", Tap.Ingredients); RequirementConfig[] array2 = array; foreach (RequirementConfig val2 in array2) { if (val2.Item == "KongStrongXXL") { val2.Recover = false; } } Add(val, "piece_kong_tap", "tap", PieceCategories.Misc, CraftingStations.Workbench, array); } } internal static class PrefabDump { public static void ExportIcons(ManualLogSource log, string[] names) { string text = Path.Combine(Paths.CachePath, "KongStrongDump"); Directory.CreateDirectory(text); foreach (string text2 in names) { try { GameObject prefab = PrefabManager.Instance.GetPrefab(text2); Sprite val = (((Object)(object)prefab == (Object)null) ? null : (prefab.GetComponent<ItemDrop>()?.m_itemData.m_shared.m_icons?.FirstOrDefault() ?? prefab.GetComponent<Piece>()?.m_icon)); if ((Object)(object)val == (Object)null) { log.LogInfo((object)("=== ICON " + text2 + ": none")); continue; } Texture2D val2 = Readable(val); File.WriteAllBytes(Path.Combine(text, text2 + ".png"), ImageConversion.EncodeToPNG(val2)); log.LogInfo((object)$"=== ICON {text2}: {((Texture)val2).width}x{((Texture)val2).height} -> {text}"); } catch (Exception ex) { log.LogWarning((object)("=== ICON " + text2 + ": " + ex.Message)); } } } private static Texture2D Readable(Sprite sprite) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown Texture2D texture = sprite.texture; Rect textureRect = sprite.textureRect; RenderTexture temporary = RenderTexture.GetTemporary(((Texture)texture).width, ((Texture)texture).height, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)2); RenderTexture active = RenderTexture.active; try { Graphics.Blit((Texture)(object)texture, temporary); RenderTexture.active = temporary; Texture2D val = new Texture2D((int)((Rect)(ref textureRect)).width, (int)((Rect)(ref textureRect)).height, (TextureFormat)4, false); val.ReadPixels(textureRect, 0, 0); val.Apply(); return val; } finally { RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); } } public static void Dump(ManualLogSource log, string[] names) { foreach (string text in names) { GameObject prefab = PrefabManager.Instance.GetPrefab(text); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("=== DUMP " + text + (((Object)(object)prefab == (Object)null) ? " NOT FOUND" : "")); if ((Object)(object)prefab != (Object)null) { Walk(prefab.transform, "", stringBuilder); } log.LogInfo((object)stringBuilder.ToString()); } } private static void Walk(Transform t, string indent, StringBuilder text) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_00ec: Expected O, but got Unknown text.AppendLine($"{indent}[{((Object)t).name}] active={((Component)t).gameObject.activeSelf} layer={LayerMask.LayerToName(((Component)t).gameObject.layer)} " + $"pos={t.localPosition:F3} rot={t.localEulerAngles:F1} scale={t.localScale:F3}"); Component[] components = ((Component)t).GetComponents<Component>(); foreach (Component val in components) { if (!((Object)(object)val == (Object)null) && !(val is Transform)) { text.AppendLine(indent + " - " + ((object)val).GetType().Name + Describe(val)); } } foreach (Transform item in t) { Walk(item, indent + " ", text); } } private static string Describe(Component c) { //IL_00a8: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) BoxCollider val = (BoxCollider)(object)((c is BoxCollider) ? c : null); if (val == null) { CapsuleCollider val2 = (CapsuleCollider)(object)((c is CapsuleCollider) ? c : null); if (val2 == null) { SphereCollider val3 = (SphereCollider)(object)((c is SphereCollider) ? c : null); if (val3 == null) { MeshCollider val4 = (MeshCollider)(object)((c is MeshCollider) ? c : null); if (val4 == null) { MeshFilter val5 = (MeshFilter)(object)((c is MeshFilter) ? c : null); if (val5 == null) { Renderer val6 = (Renderer)(object)((c is Renderer) ? c : null); if (val6 == null) { Container val7 = (Container)(object)((c is Container) ? c : null); if (val7 == null) { WearNTear val8 = (WearNTear)(object)((c is WearNTear) ? c : null); if (val8 == null) { Piece val9 = (Piece)(object)((c is Piece) ? c : null); if (val9 == null) { ItemDrop val10 = (ItemDrop)(object)((c is ItemDrop) ? c : null); if (val10 == null) { CraftingStation val11 = (CraftingStation)(object)((c is CraftingStation) ? c : null); if (val11 != null) { return " name=" + val11.m_name; } return ""; } return $" type={val10.m_itemData.m_shared.m_itemType} food={val10.m_itemData.m_shared.m_food} weight={val10.m_itemData.m_shared.m_weight}"; } return $" name={val9.m_name} comfort={val9.m_comfort} category={val9.m_category}"; } return string.Format(" new={0} worn={1} broken={2} hp={3} fragments={4}", Object.op_Implicit((Object)(object)val8.m_new) ? ((Object)val8.m_new).name : "-", Object.op_Implicit((Object)(object)val8.m_worn) ? ((Object)val8.m_worn).name : "-", Object.op_Implicit((Object)(object)val8.m_broken) ? ((Object)val8.m_broken).name : "-", val8.m_health, val8.m_fragmentRoots?.Length); } return string.Format(" name={0} size={1}x{2} open={3} closed={4}", val7.m_name, val7.m_width, val7.m_height, Object.op_Implicit((Object)(object)val7.m_open) ? ((Object)val7.m_open).name : "-", Object.op_Implicit((Object)(object)val7.m_closed) ? ((Object)val7.m_closed).name : "-"); } return " materials=[" + string.Join("; ", val6.sharedMaterials.Select((Material m) => (!((Object)(object)m == (Object)null)) ? (((Object)m).name + " shader=" + ((Object)m.shader).name + " tex=" + ((m.HasProperty("_MainTex") && Object.op_Implicit((Object)(object)m.mainTexture)) ? ((Object)m.mainTexture).name : "-") + string.Format(" color={0} queue={1}", m.HasProperty("_Color") ? ((object)m.color/*cast due to .constrained prefix*/).ToString() : "-", m.renderQueue) + " props=" + string.Join(",", m.GetTexturePropertyNames())) : "null")) + "]"; } if (!Object.op_Implicit((Object)(object)val5.sharedMesh)) { return " mesh=-"; } return $" mesh={((Object)val5.sharedMesh).name} verts={val5.sharedMesh.vertexCount} bounds={val5.sharedMesh.bounds}"; } return string.Format(" mesh={0} convex={1}", Object.op_Implicit((Object)(object)val4.sharedMesh) ? ((Object)val4.sharedMesh).name : "-", val4.convex); } return $" center={val3.center:F3} r={val3.radius:F3}"; } return $" center={val2.center:F3} r={val2.radius:F3} h={val2.height:F3} dir={val2.direction}"; } return $" center={val.center:F3} size={val.size:F3} trigger={((Collider)val).isTrigger}"; } } internal class SE_Kong : SE_Stats { internal static StatusEffect Crash; internal static StatusEffect HeartRacing; internal static ToleranceSettings Tolerance = new ToleranceSettings(); internal static bool PowerAnimation = true; internal static EffectList PowerEffects; internal static float SuppressGuardianPowerUntil; private static readonly FieldRef<Character, ZSyncAnimation> Zanim = AccessTools.FieldRefAccess<Character, ZSyncAnimation>("m_zanim"); public bool CausesCrash; public override void Setup(Character character) { if ((Object)(object)character != (Object)null && (Object)(object)character == (Object)(object)Player.m_localPlayer) { ApplyTolerance(character); if (PowerAnimation) { ((MonoBehaviour)character).StartCoroutine(PlayPowerAnimation(character)); } } ((SE_Stats)this).Setup(character); } public override void Stop() { ((StatusEffect)this).Stop(); if (CausesCrash && (Object)(object)Crash != (Object)null && ((StatusEffect)this).IsDone() && (Object)(object)((StatusEffect)this).m_character != (Object)null && (Object)(object)((StatusEffect)this).m_character == (Object)(object)Player.m_localPlayer) { ((StatusEffect)this).m_character.GetSEMan().AddStatusEffect(Crash.NameHash(), true, 0, 0f, (short)(-1)); } } private static IEnumerator PlayPowerAnimation(Character character) { yield return (object)new WaitForSeconds(0.5f); if (!((Object)(object)character == (Object)null) && !character.IsDead() && !character.InAttack() && !character.InDodge() && character.CanMove()) { ZSyncAnimation val = Zanim.Invoke(character); if ((Object)(object)val != (Object)null) { SuppressGuardianPowerUntil = Time.time + 3f; val.SetTrigger("gpower"); } EffectList powerEffects = PowerEffects; if (powerEffects != null) { powerEffects.Create(((Component)character).transform.position, ((Component)character).transform.rotation, ((Component)character).transform, 1f, -1, default(ZDOID)); } } } public static bool HasActiveDrink(Character character) { foreach (StatusEffect statusEffect in character.GetSEMan().GetStatusEffects()) { if (statusEffect is SE_Kong) { return true; } } return false; } private void ApplyTolerance(Character character) { if (!Tolerance.Enabled) { return; } int num = Caffeine.Register(Time.time, Tolerance.WindowMinutes * 60f); if (num >= 2) { float num2 = ((num == 2) ? Tolerance.SecondDrinkPercent : Tolerance.FurtherDrinkPercent); Scale(Mathf.Clamp01(num2 / 100f)); character.Message((MessageType)1, "$msg_kong_tolerance", 0, (Sprite)null, false); if ((Object)(object)HeartRacing != (Object)null && Tolerance.HeartRacingFromDrink > 0 && num >= Tolerance.HeartRacingFromDrink) { character.GetSEMan().AddStatusEffect(HeartRacing.NameHash(), true, 0, 0f, (short)(-1)); } } } private void Scale(float factor) { base.m_staminaUpFront *= factor; base.m_eitrUpFront *= factor; base.m_healthOverTime *= factor; base.m_staminaRegenMultiplier = ScaleMultiplier(base.m_staminaRegenMultiplier, factor); base.m_healthRegenMultiplier = ScaleMultiplier(base.m_healthRegenMultiplier, factor); base.m_eitrRegenMultiplier = ScaleMultiplier(base.m_eitrRegenMultiplier, factor); base.m_speedModifier *= factor; base.m_runStaminaDrainModifier *= factor; base.m_jumpStaminaUseModifier *= factor; base.m_addMaxCarryWeight *= factor; } private static float ScaleMultiplier(float multiplier, float factor) { if (!(multiplier > 1f)) { return multiplier; } return 1f + (multiplier - 1f) * factor; } } internal sealed class ToleranceSettings { public bool Enabled = true; public float WindowMinutes = 15f; public int SecondDrinkPercent = 50; public int FurtherDrinkPercent = 25; public int HeartRacingFromDrink = 3; } internal static class Caffeine { private static readonly List<float> Drinks = new List<float>(); public static int Register(float now, float window) { Drinks.RemoveAll((float time) => now - time > window || time > now); Drinks.Add(now); return Drinks.Count; } } internal sealed class SkyrCupSettings { private const string Section = "SkyrCup"; public bool Enabled = true; public float Health = 50f; public float Stamina = 20f; public float Eitr; public float Duration = 1800f; public float Regen = 3f; public string CraftingStation = "Cauldron"; public string Ingredients = "ChickenEgg:2,Cloudberry:2,Honey:1"; public int Amount = 2; public void Bind(ConfigFile config) { //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown Enabled = config.Bind<bool>("SkyrCup", "Enabled", Enabled, "Adds the Skyr cup (food) to the game.").Value; Health = config.Bind<float>("SkyrCup", "Health", Health, "Health the food