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 LoxMilkMod v2.0.2
BepInEx/plugins/loxmilkmod/LoxMilkMod.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LoxMilkMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LoxMilkMod")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("9b8b76d8-a423-44e1-80d0-104d6058d5d1")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace LoxMilkMod; [HarmonyPatch(typeof(Fermenter), "AddItem")] public static class BlockCheeseBaseInFermenterPatch { private static bool Prefix(Fermenter __instance, ItemData item) { if ((Object)(object)__instance == (Object)null || item == null || (Object)(object)item.m_dropPrefab == (Object)null) { return true; } if (((Object)__instance).name != "fermenter(Clone)") { return true; } string text = ((Object)item.m_dropPrefab).name ?? string.Empty; bool flag = text.StartsWith("CheeseBase_", StringComparison.Ordinal); return !flag; } } public sealed class ButterChurnAnimator : MonoBehaviour { public string RotorTag = "churnrotor"; public string PlungerTag = "plunger"; public float RotorSpeed = 90f; public float PlungerAmplitude = 0.1f; public float PlungerSpeed = 1.5f; private Transform _rotor; private Transform _plunger; private Vector3 _plungerStartPosition; private Fermenter _fermenter; private ZNetView _networkView; private void Awake() { _fermenter = ((Component)this).GetComponent<Fermenter>(); _networkView = ((Component)this).GetComponent<ZNetView>(); FindAnimatedParts(); } private void FindAnimatedParts() { //IL_00a6: 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) Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { string text = ((Object)val).name.ToLowerInvariant(); if ((Object)(object)_rotor == (Object)null && text.Contains(RotorTag.ToLowerInvariant())) { _rotor = val; } if ((Object)(object)_plunger == (Object)null && text.Contains(PlungerTag.ToLowerInvariant())) { _plunger = val; } } if ((Object)(object)_plunger != (Object)null) { _plungerStartPosition = _plunger.localPosition; } } private void Update() { //IL_0031: 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_0077: 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) if (IsWorking()) { float deltaTime = Time.deltaTime; if ((Object)(object)_rotor != (Object)null) { _rotor.Rotate(Vector3.right, RotorSpeed * deltaTime, (Space)1); } if ((Object)(object)_plunger != (Object)null) { float num = Mathf.Sin(Time.time * PlungerSpeed) * PlungerAmplitude; Vector3 plungerStartPosition = _plungerStartPosition; plungerStartPosition.y += num; _plunger.localPosition = plungerStartPosition; } } } private bool IsWorking() { if ((Object)(object)_fermenter == (Object)null || (Object)(object)_networkView == (Object)null || !_networkView.IsValid()) { return false; } ZDO zDO = _networkView.GetZDO(); if (zDO == null) { return false; } string value = zDO.GetString("Content", string.Empty); return !string.IsNullOrEmpty(value); } } public sealed class ButtermilkTankRotorAnimator : MonoBehaviour { public string LeftGearTag = "gearleft"; public string RightGearTag = "gearright"; public string RotorNameContains = "rotor"; public Vector3 RotationAxis = Vector3.up; public float RotationSpeed = 120f; public float GearSpeed = 180f; private Transform _leftGear; private Transform _rightGear; private Transform _rotor; private Fermenter _fermenter; private ZNetView _networkView; private void Awake() { _fermenter = ((Component)this).GetComponent<Fermenter>(); _networkView = ((Component)this).GetComponent<ZNetView>(); FindAnimatedParts(); } private void FindAnimatedParts() { string value = LeftGearTag.ToLowerInvariant(); string value2 = RightGearTag.ToLowerInvariant(); string value3 = RotorNameContains.ToLowerInvariant(); Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { string text = ((Object)val).name.ToLowerInvariant(); if ((Object)(object)_leftGear == (Object)null && text.Contains(value)) { _leftGear = val; } if ((Object)(object)_rightGear == (Object)null && text.Contains(value2)) { _rightGear = val; } if ((Object)(object)_rotor == (Object)null && text.Contains(value3)) { _rotor = val; } } } private void Update() { //IL_0032: 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) if (IsWorking()) { float deltaTime = Time.deltaTime; if ((Object)(object)_rotor != (Object)null) { _rotor.Rotate(RotationAxis, RotationSpeed * deltaTime, (Space)1); } if ((Object)(object)_leftGear != (Object)null) { _leftGear.Rotate(Vector3.forward, GearSpeed * deltaTime, (Space)1); } if ((Object)(object)_rightGear != (Object)null) { _rightGear.Rotate(Vector3.forward, (0f - GearSpeed) * deltaTime, (Space)1); } } } private bool IsWorking() { if ((Object)(object)_fermenter == (Object)null || (Object)(object)_networkView == (Object)null || !_networkView.IsValid()) { return false; } ZDO zDO = _networkView.GetZDO(); if (zDO == null) { return false; } string value = zDO.GetString("Content", string.Empty); return !string.IsNullOrEmpty(value); } } [HarmonyPatch(typeof(Player), "EatFood")] public static class CheeseExtendPatch { private static void Postfix(Player __instance, ItemData item) { if ((Object)(object)__instance == (Object)null || item == null) { return; } SEMan sEMan = ((Character)__instance).GetSEMan(); if (sEMan == null) { return; } int stableHashCode = StringExtensionMethods.GetStableHashCode("SE_SatiatedVisual"); if (sEMan.HaveStatusEffect(stableHashCode)) { return; } float cheeseBonus = GetCheeseBonus(item); if (cheeseBonus <= 0f) { return; } foreach (Food food in __instance.GetFoods()) { if (food != null && food.m_item != null && !((Object)(object)food.m_item.m_dropPrefab == (Object)(object)item.m_dropPrefab)) { food.m_time += cheeseBonus; } } Sprite icon = null; if (item.m_shared != null && item.m_shared.m_icons != null && item.m_shared.m_icons.Length != 0) { icon = item.m_shared.m_icons[0]; } CheeseSatiatedEffect.Apply(__instance, icon, cheeseBonus); } private static float GetCheeseBonus(ItemData item) { if (item == null || (Object)(object)item.m_dropPrefab == (Object)null) { return 0f; } return (((Object)item.m_dropPrefab).name ?? string.Empty) switch { "TwarogItem" => 300f, "GoudaCheese" => 600f, "LazurCheese" => 900f, "SerTopionyItem" => 1200f, _ => 0f, }; } } public static class CheeseSatiatedEffect { public const string EffectName = "SE_SatiatedVisual"; public static void Apply(Player player, Sprite icon, float duration) { if (!((Object)(object)player == (Object)null)) { SEMan sEMan = ((Character)player).GetSEMan(); if (sEMan != null) { SE_Stats val = ScriptableObject.CreateInstance<SE_Stats>(); ((Object)val).name = "SE_SatiatedVisual"; ((StatusEffect)val).m_name = "Stuffed"; ((StatusEffect)val).m_tooltip = "You will feel full longer."; ((StatusEffect)val).m_ttl = duration; ((StatusEffect)val).m_icon = icon; sEMan.AddStatusEffect((StatusEffect)(object)val, false, 0, 0f); } } } } public sealed class ConversionRegistrar { private const string CheeseMachinePieceName = "CheeseMachine"; private const string ButterChurnPieceName = "piece_butterchurn"; private const string ButtermilkTankPieceName = "piece_buttermilktank"; private const string OvenPieceName = "piece_oven"; public void RegisterAll() { RegisterCheeseMachineConversions(); RegisterButterChurnConversion(); RegisterDairyCauldronConversions(); RegisterMilkBreadOvenConversion(); Logger.LogInfo((object)"[LoxMilkMod] Conversion registration completed."); } private static void RegisterCheeseMachineConversions() { AddFermenterConversion("CheeseBase_Lazur", "LazurCheese", "CheeseMachine", 3); AddFermenterConversion("CheeseBase_SerTopiony", "SerTopionyItem", "CheeseMachine", 3); AddFermenterConversion("CheeseBase_Twarog", "TwarogItem", "CheeseMachine", 3); AddFermenterConversion("CheeseBase_Gouda", "GoudaCheese", "CheeseMachine", 3); } private static void RegisterButterChurnConversion() { AddFermenterConversion("LoxMilkItem", "ButterItem", "piece_butterchurn", 3); } private static void RegisterDairyCauldronConversions() { AddFermenterConversion("LoxMilkItem", "ButtermilkItem", "piece_buttermilktank", 3); AddFermenterConversion("CheeseBase_Skyr", "skyrItem", "piece_buttermilktank", 3); } private static void RegisterMilkBreadOvenConversion() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown CookingConversionConfig val = new CookingConversionConfig { FromItem = "LoxMilkBreadDough", ToItem = "LoxMilkBread", Station = "piece_oven", CookTime = 40f }; ItemManager.Instance.AddItemConversion(new CustomItemConversion((ConversionConfig)(object)val)); Logger.LogInfo((object)"[LoxMilkMod] Added conversion: LoxMilkBreadDough -> LoxMilkBread."); } private static void AddFermenterConversion(string fromItem, string toItem, string station, int producedItems) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown FermenterConversionConfig val = new FermenterConversionConfig { FromItem = fromItem, ToItem = toItem, Station = station, ProducedItems = producedItems }; ItemManager.Instance.AddItemConversion(new CustomItemConversion((ConversionConfig)(object)val)); Logger.LogInfo((object)("[LoxMilkMod] Added conversion: " + fromItem + " -> " + toItem + ", station: " + station + ".")); } } public sealed class DecorRegistrar { private const string DecorDescription = "Dairy decoration."; private readonly ModAssets _assets; public DecorRegistrar(ModAssets assets) { _assets = assets; } public void RegisterAll() { if (_assets == null) { Logger.LogError((object)"[LoxMilkMod] DecorRegistrar: ModAssets is null."); return; } if (!_assets.IsLoaded) { Logger.LogError((object)"[LoxMilkMod] DecorRegistrar: AssetBundle isn't loaded."); return; } RegisterMilkCrate(); RegisterButtermilkCrate(); RegisterButterBucket(); RegisterGoudaDecorations(); RegisterLazurDecorations(); RegisterTwarogDecorations(); Logger.LogInfo((object)"[LoxMilkMod] decoration registration has been completed."); } private void RegisterMilkCrate() { //IL_0039: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0055: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown RegisterDecorPiece("piece_loxmilk_crate", "Crate of lox milk", _assets.MilkCrateModel, _assets.MilkStackIcon, 1.2f, 0f, 0.45f, new RequirementConfig { Item = "LoxMilkItem", Amount = 4 }, new RequirementConfig { Item = "Wood", Amount = 2 }); } private void RegisterButtermilkCrate() { //IL_0039: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0056: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown RegisterDecorPiece("piece_buttermilk_crate", "Crate of lox buttermilk", _assets.ButtermilkCrateModel, _assets.ButtermilkStackIcon, 1f, 0f, 0.25f, new RequirementConfig { Item = "ButtermilkItem", Amount = 9 }, new RequirementConfig { Item = "Wood", Amount = 2 }); } private void RegisterButterBucket() { //IL_0039: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0056: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown RegisterDecorPiece("piece_butter_bucket", "Bucket of butter", _assets.ButterBucketModel, _assets.ButterStackIcon, 1.6f, 0f, 0.5f, new RequirementConfig { Item = "ButterItem", Amount = 10 }, new RequirementConfig { Item = "Wood", Amount = 2 }); } private void RegisterGoudaDecorations() { //IL_0039: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //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) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00e9: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown RegisterDecorPiece("piece_gouda_single", "Gouda cheese", _assets.GoudaDecorModel, _assets.GoudaDecor1Icon, 2.3f, -0.01f, 0.3f, new RequirementConfig { Item = "GoudaCheese", Amount = 1 }); RegisterDecorPiece("piece_gouda_double1", "Two gouda cheeses", _assets.GoudaDecor2Model, _assets.GoudaDecor2Icon, 2f, -0.01f, 0.48f, new RequirementConfig { Item = "GoudaCheese", Amount = 2 }); RegisterDecorPiece("piece_gouda_double2", "Two gouda cheeses", _assets.GoudaDecor3Model, _assets.GoudaDecor3Icon, 2f, -0.01f, 0.55f, new RequirementConfig { Item = "GoudaCheese", Amount = 2 }); } private void RegisterLazurDecorations() { //IL_0039: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //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) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00e9: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown RegisterDecorPiece("piece_lazur_single", "Blue cheese", _assets.LazurDecorModel, _assets.LazurDecor1Icon, 2f, 0f, 0.3f, new RequirementConfig { Item = "LazurCheese", Amount = 1 }); RegisterDecorPiece("piece_lazur_double1", "Two blue cheeses", _assets.LazurDecor2Model, _assets.LazurDecor2Icon, 2f, 0f, 0.5f, new RequirementConfig { Item = "LazurCheese", Amount = 2 }); RegisterDecorPiece("piece_lazur_double2", "Two blue cheeses", _assets.LazurDecor3Model, _assets.LazurDecor3Icon, 2f, 0f, 0.6f, new RequirementConfig { Item = "LazurCheese", Amount = 2 }); } private void RegisterTwarogDecorations() { //IL_0039: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //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) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown RegisterDecorPiece("piece_twarog_bowl1", "Small bowl of cottage cheese", _assets.TwarogBowl1Model, _assets.TwarogDecor1Icon, 2f, -0.01f, 0.22f, new RequirementConfig { Item = "TwarogItem", Amount = 1 }); RegisterDecorPiece("piece_twarog_bowl2", "Medium bowl of cottage cheese", _assets.TwarogBowl2Model, _assets.TwarogDecor2Icon, 1.3f, -0.02f, 0.15f, new RequirementConfig { Item = "TwarogItem", Amount = 10 }); RegisterDecorPiece("piece_twarog_bowl3", "Large bowl of cottage cheese", _assets.TwarogBowl3Model, _assets.TwarogDecor3Icon, 1.7f, 0.28f, 0.4f, new RequirementConfig { Item = "TwarogItem", Amount = 20 }); } private void RegisterDecorPiece(string pieceName, string displayName, GameObject model, Sprite icon, float scale, float yOffset, float boxHeight, params RequirementConfig[] requirements) { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown GameObject prefab = PrefabManager.Instance.GetPrefab("piece_chair"); if ((Object)(object)prefab == (Object)null) { Logger.LogError((object)"[LoxMilkMod] prefab not found piece_chair."); return; } GameObject val = PrefabManager.Instance.CreateClonedPrefab(pieceName, prefab); if ((Object)(object)val == (Object)null) { Logger.LogError((object)("[LoxMilkMod] failed to create decoration: " + pieceName + ".")); return; } DisableOriginalVisuals(val); RemoveOriginalColliders(val); RemoveChairComponent(val); ConfigureWearAndTear(val); Piece val2 = ConfigurePiece(val); AddDecorationVisual(val, model, scale, yOffset); AddDecorationCollider(val, boxHeight); val2.m_name = displayName; val2.m_description = "Dairy decoration."; PieceConfig val3 = CreatePieceConfig(displayName, icon, requirements); CustomPiece val4 = new CustomPiece(val, false, val3); PieceManager.Instance.AddPiece(val4); Logger.LogInfo((object)("[LoxMilkMod] decoration added: " + displayName)); } private static void DisableOriginalVisuals(GameObject piece) { MeshRenderer[] componentsInChildren = piece.GetComponentsInChildren<MeshRenderer>(true); MeshRenderer[] array = componentsInChildren; foreach (MeshRenderer val in array) { ((Renderer)val).enabled = false; } } private static void RemoveOriginalColliders(GameObject piece) { Collider[] componentsInChildren = piece.GetComponentsInChildren<Collider>(true); Collider[] array = componentsInChildren; foreach (Collider val in array) { Object.DestroyImmediate((Object)(object)val); } } private static void RemoveChairComponent(GameObject piece) { Chair component = piece.GetComponent<Chair>(); if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } } private static void ConfigureWearAndTear(GameObject piece) { WearNTear component = piece.GetComponent<WearNTear>(); if (!((Object)(object)component == (Object)null)) { component.m_health = 50f; component.m_noRoofWear = true; component.m_noSupportWear = true; } } private static Piece ConfigurePiece(GameObject piece) { Piece val = piece.GetComponent<Piece>(); if ((Object)(object)val == (Object)null) { val = piece.AddComponent<Piece>(); } val.m_groundOnly = false; val.m_groundPiece = false; val.m_clipEverything = false; val.m_canBeRemoved = true; val.m_blockRadius = 0f; return val; } private static void AddDecorationVisual(GameObject piece, GameObject model, float scale, float yOffset) { //IL_0057: 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_0079: 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) if ((Object)(object)model == (Object)null) { Logger.LogWarning((object)("[LoxMilkMod] no model for decoration: " + ((Object)piece).name + ".")); return; } GameObject val = Object.Instantiate<GameObject>(model, piece.transform); ((Object)val).name = "LoxMilkMod_Visual"; val.transform.localPosition = new Vector3(0f, yOffset, 0f); val.transform.localRotation = Quaternion.identity; val.transform.localScale = Vector3.one * scale; Collider[] componentsInChildren = val.GetComponentsInChildren<Collider>(true); Collider[] array = componentsInChildren; foreach (Collider val2 in array) { Object.DestroyImmediate((Object)(object)val2); } MeshRenderer[] componentsInChildren2 = val.GetComponentsInChildren<MeshRenderer>(true); MeshRenderer[] array2 = componentsInChildren2; foreach (MeshRenderer val3 in array2) { ((Renderer)val3).enabled = true; } } private static void AddDecorationCollider(GameObject piece, float boxHeight) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) BoxCollider val = piece.AddComponent<BoxCollider>(); val.size = new Vector3(1f, boxHeight, 1f); val.center = new Vector3(0f, boxHeight / 2f, 0f); ((Collider)val).isTrigger = false; } private static PieceConfig CreatePieceConfig(string displayName, Sprite icon, RequirementConfig[] requirements) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0026: 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_003b: Expected O, but got Unknown PieceConfig val = new PieceConfig { PieceTable = "Hammer", Name = displayName, Description = "Dairy decoration.", Category = "Misc", Icon = icon }; if (requirements == null) { return val; } foreach (RequirementConfig val2 in requirements) { if (val2 != null) { val.AddRequirement(val2.Item, val2.Amount, true); } } return val; } } public static class FeasterRegistrar { private sealed class FoodRegistration { public CustomItem Item; public string Category; } private const string FeasterPieceTableName = "Feaster"; private static readonly List<FoodRegistration> Registrations = new List<FoodRegistration>(); public static void RegisterFood(CustomItem item, string category) { //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown if (item == null) { Logger.LogError((object)"[LoxMilkMod] FeasterRegistrar: CustomItem is null."); return; } if ((Object)(object)item.ItemPrefab == (Object)null) { Logger.LogError((object)"[LoxMilkMod] FeasterRegistrar: ItemPrefab is null."); return; } if ((Object)(object)item.ItemDrop == (Object)null) { Logger.LogError((object)("[LoxMilkMod] FeasterRegistrar: " + ((Object)item.ItemPrefab).name + " don't have ItemDrop.")); return; } Piece component = item.ItemPrefab.GetComponent<Piece>(); if ((Object)(object)component == (Object)null) { Logger.LogError((object)("[LoxMilkMod] FeasterRegistrar: " + ((Object)item.ItemPrefab).name + " don't haave Piece component.")); return; } SharedData val = item.ItemDrop.m_itemData?.m_shared; if (val == null) { Logger.LogError((object)("[LoxMilkMod] FeasterRegistrar: " + ((Object)item.ItemPrefab).name + " don't have SharedData.")); return; } if (string.IsNullOrEmpty(category)) { category = PieceCategories.Food; } component.m_name = val.m_name; component.m_description = val.m_description; if (val.m_icons != null && val.m_icons.Length != 0 && (Object)(object)val.m_icons[0] != (Object)null) { component.m_icon = val.m_icons[0]; } component.m_resources = (Requirement[])(object)new Requirement[1] { new Requirement { m_resItem = item.ItemDrop, m_amount = 1, m_recover = true } }; component.m_canBeRemoved = true; AddOrUpdateRegistration(item, category); Logger.LogInfo((object)("[LoxMilkMod] prepared for Serving Tray: " + ((Object)item.ItemPrefab).name + ", category: " + category + ".")); } public static void RegisterPendingFoods() { PieceTable pieceTable = PieceManager.Instance.GetPieceTable("Feaster"); if ((Object)(object)pieceTable == (Object)null) { Logger.LogError((object)"[LoxMilkMod] FeasterRegistrar: tab Feaster still not found."); return; } foreach (FoodRegistration registration in Registrations) { if (registration != null && registration.Item != null && !((Object)(object)registration.Item.ItemPrefab == (Object)null)) { GameObject itemPrefab = registration.Item.ItemPrefab; if (!pieceTable.m_pieces.Contains(itemPrefab)) { PieceManager.Instance.RegisterPieceInPieceTable(itemPrefab, "Feaster", registration.Category); Logger.LogInfo((object)("[LoxMilkMod] added to Serving Tray: " + ((Object)itemPrefab).name + ", category: " + registration.Category + ".")); } } } } public static void RegisterFood(CustomItem item) { RegisterFood(item, PieceCategories.Food); } public static void RegisterMead(CustomItem item) { RegisterFood(item, PieceCategories.Mead); } public static void RegisterFeast(CustomItem item) { RegisterFood(item, PieceCategories.Feasts); } private static void AddOrUpdateRegistration(CustomItem item, string category) { string name = ((Object)item.ItemPrefab).name; foreach (FoodRegistration registration in Registrations) { object obj; if (registration == null) { obj = null; } else { CustomItem item2 = registration.Item; obj = ((item2 != null) ? item2.ItemPrefab : null); } if ((Object)obj == (Object)null || ((Object)registration.Item.ItemPrefab).name != name) { continue; } registration.Item = item; registration.Category = category; return; } Registrations.Add(new FoodRegistration { Item = item, Category = category }); } } public static class FermenterDurationController { private const string CheeseMachinePrefab = "CheeseMachine"; private const string CheeseMachineDisplayName = "Cheese machine"; private const string DairyCauldronPrefab = "piece_buttermilktank"; private const string DairyCauldronDisplayName = "Dairy cauldron"; private const string ButterChurnPrefab = "piece_butterchurn"; private const string ButterChurnDisplayName = "Butter churn"; private const string SkyrBasePrefab = "CheeseBase_Skyr"; private const string LoxMilkPrefab = "LoxMilkItem"; public static void Apply(Fermenter fermenter, string contentPrefabName) { if ((Object)(object)fermenter == (Object)null || !ModConfig.IsInitialized) { return; } float num; if (IsCheeseMachine(fermenter)) { num = ModConfig.CheeseFermentationSeconds; } else if (IsButterChurn(fermenter)) { num = ModConfig.ButterFermentationSeconds; } else { if (!IsDairyCauldron(fermenter)) { return; } if (ContainsPrefabName(contentPrefabName, "CheeseBase_Skyr")) { num = ModConfig.SkyrFermentationSeconds; } else { if (!ContainsPrefabName(contentPrefabName, "LoxMilkItem")) { return; } num = ModConfig.ButtermilkFermentationSeconds; } } if (!(Math.Abs(fermenter.m_fermentationDuration - num) < 0.01f)) { fermenter.m_fermentationDuration = num; } } private static bool IsCheeseMachine(Fermenter fermenter) { string cleanObjectName = GetCleanObjectName(fermenter); string a = fermenter.m_name ?? string.Empty; return string.Equals(cleanObjectName, "CheeseMachine", StringComparison.OrdinalIgnoreCase) || string.Equals(a, "Cheese machine", StringComparison.OrdinalIgnoreCase); } private static bool IsButterChurn(Fermenter fermenter) { string cleanObjectName = GetCleanObjectName(fermenter); string a = fermenter.m_name ?? string.Empty; return string.Equals(cleanObjectName, "piece_butterchurn", StringComparison.OrdinalIgnoreCase) || string.Equals(a, "Butter churn", StringComparison.OrdinalIgnoreCase); } private static bool IsDairyCauldron(Fermenter fermenter) { string cleanObjectName = GetCleanObjectName(fermenter); string a = fermenter.m_name ?? string.Empty; return string.Equals(cleanObjectName, "piece_buttermilktank", StringComparison.OrdinalIgnoreCase) || string.Equals(a, "Dairy cauldron", StringComparison.OrdinalIgnoreCase); } private static bool ContainsPrefabName(string actualName, string expectedName) { if (string.IsNullOrEmpty(actualName)) { return false; } return actualName.IndexOf(expectedName, StringComparison.OrdinalIgnoreCase) >= 0; } private static string GetCleanObjectName(Fermenter fermenter) { if ((Object)(object)fermenter == (Object)null || (Object)(object)((Component)fermenter).gameObject == (Object)null) { return string.Empty; } string text = ((Object)((Component)fermenter).gameObject).name ?? string.Empty; return text.Replace("(Clone)", string.Empty).Trim(); } } [HarmonyPatch(typeof(Fermenter), "RPC_AddItem", new Type[] { typeof(long), typeof(string) })] public static class FermenterRpcAddItemDurationPatch { private static void Prefix(Fermenter __instance, string __1) { FermenterDurationController.Apply(__instance, __1); } } [HarmonyPatch(typeof(Fermenter), "GetStatus")] public static class FermenterGetStatusDurationPatch { private static void Prefix(Fermenter __instance) { if ((Object)(object)__instance == (Object)null) { return; } ZNetView component = ((Component)__instance).GetComponent<ZNetView>(); if (!((Object)(object)component == (Object)null) && component.IsValid()) { ZDO zDO = component.GetZDO(); if (zDO != null) { string contentPrefabName = zDO.GetString("Content", string.Empty); FermenterDurationController.Apply(__instance, contentPrefabName); } } } } public sealed class ItemRegistrar { private readonly ModAssets _assets; public ItemRegistrar(ModAssets assets) { _assets = assets; } public void RegisterAll() { if (_assets == null) { Logger.LogError((object)"[LoxMilkMod] ItemRegistrar: ModAssets is null."); return; } if (!_assets.IsLoaded) { Logger.LogError((object)"[LoxMilkMod] ItemRegistrar: AssetBundle is not loaded."); return; } RegisterLoxMilk(); RegisterMilkSoup(); RegisterMilkBread(); RegisterGouda(); RegisterLazur(); RegisterCheesecake(); RegisterMeltedCheese(); RegisterTwarog(); RegisterRennet(); RegisterCheeseBases(); RegisterButter(); RegisterButtermilk(); RegisterSkyr(); RegisterBearSoup(); RegisterFulingDelicacy(); RegisterCheesePlate(); FixRegisteredIcons(); Logger.LogInfo((object)"[LoxMilkMod] Item registration completed."); } private void RegisterLoxMilk() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) ItemConfig val = new ItemConfig { Name = "Lox milk", Description = "Fresh milk from a lox.", Enabled = true }; CustomItem val2 = new CustomItem("LoxMilkItem", "QueensJam", val); ItemManager.Instance.AddItem(val2); SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_itemType = (ItemType)2; shared.m_maxStackSize = 20; shared.m_food = 10f; shared.m_foodStamina = 80f; shared.m_foodBurnTime = 1800f; shared.m_foodRegen = 1f; SetIcon(shared, _assets.LoxMilkIcon); if ((Object)(object)_assets.MilkBottleModel != (Object)null) { ItemVisuals.OverrideDropModel(((Component)val2.ItemDrop).gameObject, _assets.MilkBottleModel); ItemVisuals.FixDropScale(((Component)val2.ItemDrop).gameObject, 1.1f); ItemVisuals.FixDropCollider(((Component)val2.ItemDrop).gameObject, 0.25f); } FeasterRegistrar.RegisterFood(val2); } private void RegisterMilkSoup() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Expected O, but got Unknown //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Expected O, but got Unknown //IL_0189: 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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown ItemConfig val = new ItemConfig { Name = "Lox milk soup", Description = "Creamy soup made with lox milk.", Enabled = true }; CustomItem val2 = new CustomItem("LoxMilkSoup", "TurnipStew", val); ItemManager.Instance.AddItem(val2); if ((Object)(object)_assets.MilkSoupModel != (Object)null) { ItemVisuals.OverrideDropModel(((Component)val2.ItemDrop).gameObject, _assets.MilkSoupModel); ItemVisuals.FixDropScale(((Component)val2.ItemDrop).gameObject, 1.3f); } SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_food = 40f; shared.m_foodStamina = 75f; shared.m_foodBurnTime = 2100f; shared.m_foodRegen = 2f; SetIcon(shared, _assets.MilkSoupIcon); ItemVisuals.FixDropCollider(((Component)val2.ItemDrop).gameObject, 0.3f); RecipeConfig val3 = new RecipeConfig(); val3.Name = "Recipe_LoxMilkSoup"; val3.Item = "LoxMilkSoup"; val3.Amount = 1; val3.CraftingStation = "piece_cauldron"; val3.Requirements = (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig { Item = "LoxMilkItem", Amount = 1 }, new RequirementConfig { Item = "BarleyFlour", Amount = 1 }, new RequirementConfig { Item = "ChickenEgg", Amount = 2 }, new RequirementConfig { Item = "Honey", Amount = 1 } }; RecipeConfig recipe = val3; AddRecipe(recipe); FeasterRegistrar.RegisterFood(val2); } private void RegisterMilkBread() { RegisterMilkBreadDough(); RegisterFinishedMilkBread(); } private void RegisterMilkBreadDough() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_0109: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected O, but got Unknown ItemConfig val = new ItemConfig { Name = "Milk bread dough", Description = "Dough for fluffy bread made with lox milk.", Enabled = true }; CustomItem val2 = new CustomItem("LoxMilkBreadDough", "BreadDough", val); ItemManager.Instance.AddItem(val2); if ((Object)(object)_assets.MilkBreadDoughModel != (Object)null) { ItemVisuals.OverrideDropModel(((Component)val2.ItemDrop).gameObject, _assets.MilkBreadDoughModel); } SharedData shared = val2.ItemDrop.m_itemData.m_shared; ClearFoodValues(shared); SetIcon(shared, _assets.MilkBreadDoughIcon); RecipeConfig val3 = new RecipeConfig(); val3.Name = "Recipe_LoxMilkBreadDough"; val3.Item = "LoxMilkBreadDough"; val3.Amount = 1; val3.CraftingStation = "piece_preptable"; val3.MinStationLevel = 1; val3.Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "LoxMilkItem", Amount = 1 }, new RequirementConfig { Item = "BarleyFlour", Amount = 10 } }; RecipeConfig recipe = val3; AddRecipe(recipe); } private void RegisterFinishedMilkBread() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ItemConfig val = new ItemConfig { Name = "Milk bread", Description = "Soft and fluffy milk bread.", Enabled = true }; CustomItem val2 = new CustomItem("LoxMilkBread", "Bread", val); ItemManager.Instance.AddItem(val2); if ((Object)(object)_assets.MilkBreadModel != (Object)null) { ItemVisuals.OverrideDropModel(((Component)val2.ItemDrop).gameObject, _assets.MilkBreadModel); } SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_food = 25f; shared.m_foodStamina = 60f; shared.m_foodBurnTime = 1200f; shared.m_foodRegen = 3f; SetIcon(shared, _assets.MilkBreadIcon); ItemVisuals.RemoveSteamEffect(val2.ItemPrefab); FeasterRegistrar.RegisterFood(val2); } private void RegisterGouda() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ItemConfig val = new ItemConfig { Name = "Gouda cheese", Description = "Cheese made from lox milk. Consuming it applies the Stuffed effect, extending the duration of previously eaten foods (except cheeses) by 10 minutes.", Enabled = true }; CustomItem val2 = new CustomItem("GoudaCheese", "TurnipStew", val); ItemManager.Instance.AddItem(val2); if ((Object)(object)_assets.GoudaModel != (Object)null) { ItemVisuals.OverrideDropModel(((Component)val2.ItemDrop).gameObject, _assets.GoudaModel); ItemVisuals.FixDropScale(((Component)val2.ItemDrop).gameObject, 1.3f); } SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_food = 60f; shared.m_foodStamina = 20f; shared.m_foodBurnTime = 900f; shared.m_foodRegen = 2f; SetIcon(shared, _assets.GoudaIcon); ItemVisuals.FixDropCollider(((Component)val2.ItemDrop).gameObject, 0.18f); ItemVisuals.RemoveSteamEffect(val2.ItemPrefab); FeasterRegistrar.RegisterFood(val2); } private void RegisterLazur() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ItemConfig val = new ItemConfig { Name = "Blue cheese", Description = "Cheese made from lox milk. Consuming it applies the Stuffed effect, extending the duration of previously eaten foods (except cheeses) by 15 minutes.", Enabled = true }; CustomItem val2 = new CustomItem("LazurCheese", "TurnipStew", val); ItemManager.Instance.AddItem(val2); if ((Object)(object)_assets.LazurModel != (Object)null) { ItemVisuals.OverrideDropModel(((Component)val2.ItemDrop).gameObject, _assets.LazurModel); ItemVisuals.FixDropScale(((Component)val2.ItemDrop).gameObject, 1.3f); } SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_food = 13f; shared.m_foodStamina = 13f; shared.m_foodEitr = 90f; shared.m_foodBurnTime = 600f; shared.m_foodRegen = 2f; SetIcon(shared, _assets.LazurIcon); ItemVisuals.FixDropCollider(((Component)val2.ItemDrop).gameObject, 0.18f); ItemVisuals.RemoveSteamEffect(val2.ItemPrefab); FeasterRegistrar.RegisterFood(val2); } private void RegisterCheesecake() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown //IL_0109: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown ItemConfig val = new ItemConfig { Name = "Nordic cheesecake", Description = "A sweet cheesecake made from lox milk.", Enabled = true }; CustomItem val2 = new CustomItem("SernikItem", "LoxPie", val); ItemManager.Instance.AddItem(val2); if ((Object)(object)_assets.CheesecakeModel != (Object)null) { ItemVisuals.OverrideDropModel(((Component)val2.ItemDrop).gameObject, _assets.CheesecakeModel); } SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_food = 48f; shared.m_foodStamina = 48f; shared.m_foodBurnTime = 1500f; shared.m_foodRegen = 3f; SetIcon(shared, _assets.CheesecakeIcon); RecipeConfig val3 = new RecipeConfig(); val3.Name = "Recipe_SernikItem"; val3.Item = "SernikItem"; val3.Amount = 1; val3.CraftingStation = "piece_cauldron"; val3.Requirements = (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig { Item = "LoxMilkItem", Amount = 1 }, new RequirementConfig { Item = "Cloudberry", Amount = 2 }, new RequirementConfig { Item = "ChickenEgg", Amount = 2 } }; RecipeConfig recipe = val3; AddRecipe(recipe); ItemVisuals.RemoveSteamEffect(val2.ItemPrefab); FeasterRegistrar.RegisterFood(val2); } private void RegisterMeltedCheese() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ItemConfig val = new ItemConfig { Name = "Melted cheese", Description = "Cheese made from lox milk. Consuming it applies the Stuffed effect, extending the duration of previously eaten foods (except cheeses) by 20 minutes.", Enabled = true }; CustomItem val2 = new CustomItem("SerTopionyItem", "TurnipStew", val); ItemManager.Instance.AddItem(val2); if ((Object)(object)_assets.MeltCheeseModel != (Object)null) { ItemVisuals.OverrideDropModel(((Component)val2.ItemDrop).gameObject, _assets.MeltCheeseModel); ItemVisuals.FixDropScale(((Component)val2.ItemDrop).gameObject, 1.5f); ItemVisuals.FixDropCollider(((Component)val2.ItemDrop).gameObject, 0.25f); } SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_food = 80f; shared.m_foodStamina = 35f; shared.m_foodBurnTime = 1800f; shared.m_foodRegen = 4f; SetIcon(shared, _assets.MeltCheeseIcon); FeasterRegistrar.RegisterFood(val2); } private void RegisterTwarog() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ItemConfig val = new ItemConfig { Name = "White cheese", Description = "Cheese made from lox milk. Consuming it applies the Stuffed effect, extending the duration of previously eaten foods (except cheeses) by 5 minutes.", Enabled = true }; CustomItem val2 = new CustomItem("TwarogItem", "TurnipStew", val); ItemManager.Instance.AddItem(val2); if ((Object)(object)_assets.TwarogModel != (Object)null) { ItemVisuals.OverrideDropModel(((Component)val2.ItemDrop).gameObject, _assets.TwarogModel); ItemVisuals.FixDropScale(((Component)val2.ItemDrop).gameObject, 0.8f); ItemVisuals.FixDropCollider(((Component)val2.ItemDrop).gameObject, 0.25f); } SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_food = 20f; shared.m_foodStamina = 60f; shared.m_foodBurnTime = 600f; shared.m_foodRegen = 2f; SetIcon(shared, _assets.WhiteCheeseIcon); ItemVisuals.RemoveSteamEffect(val2.ItemPrefab); FeasterRegistrar.RegisterFood(val2); } private void RegisterCheeseBases() { RegisterTwarogBase(); RegisterMeltedCheeseBase(); RegisterGoudaBase(); RegisterLazurBase(); RegisterSkyrBase(); } private void RegisterTwarogBase() { //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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown CreateCheeseBase("CheeseBase_Twarog", "Cheese base: White cheese", "Requires fermentation in a cheese maker.", _assets.BaseTwarogModel, _assets.BaseTwarogIcon, 1f, 0.2f); AddCheeseBaseRecipe("CheeseBase_Twarog", new RequirementConfig { Item = "RennetItem", Amount = 1 }, new RequirementConfig { Item = "LoxMilkItem", Amount = 2 }, new RequirementConfig { Item = "Onion", Amount = 1 }); } private void RegisterMeltedCheeseBase() { //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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown CreateCheeseBase("CheeseBase_SerTopiony", "Cheese base: Melted cheese", "Requires fermentation in a cheese maker.", _assets.BaseMeltCheeseModel, _assets.BaseMeltCheeseIcon, 1f, 0.2f); AddCheeseBaseRecipe("CheeseBase_SerTopiony", new RequirementConfig { Item = "RennetItem", Amount = 1 }, new RequirementConfig { Item = "LoxMilkItem", Amount = 2 }, new RequirementConfig { Item = "SpiceMistlands", Amount = 1 }); } private void RegisterGoudaBase() { //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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown CreateCheeseBase("CheeseBase_Gouda", "Cheese base: Gouda cheese", "Requires fermentation in a cheese maker.", _assets.BaseGoudaModel, _assets.BaseGoudaIcon, 1f, 0.2f); AddCheeseBaseRecipe("CheeseBase_Gouda", new RequirementConfig { Item = "RennetItem", Amount = 1 }, new RequirementConfig { Item = "LoxMilkItem", Amount = 2 }, new RequirementConfig { Item = "FragrantBundle", Amount = 1 }); } private void RegisterLazurBase() { //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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown CreateCheeseBase("CheeseBase_Lazur", "Cheese base: Blue cheese", "Requires fermentation in a cheese maker.", _assets.BaseLazurModel, _assets.BaseLazurIcon, 1f, 0.25f); AddCheeseBaseRecipe("CheeseBase_Lazur", new RequirementConfig { Item = "RennetItem", Amount = 1 }, new RequirementConfig { Item = "LoxMilkItem", Amount = 2 }, new RequirementConfig { Item = "MushroomMagecap", Amount = 1 }); } private void RegisterSkyrBase() { //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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown CreateCheeseBase("CheeseBase_Skyr", "Fermentation base: Skyr", "Base used to produce skyr.", _assets.BaseSkyrModel, _assets.BaseSkyrIcon, 1f, 0.2f); AddCheeseBaseRecipe("CheeseBase_Skyr", new RequirementConfig { Item = "LoxMilkItem", Amount = 1 }, new RequirementConfig { Item = "Honey", Amount = 2 }); } private CustomItem CreateCheeseBase(string prefabName, string displayName, string description, GameObject model, Sprite icon, float modelScale, float colliderHeight) { //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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown CustomItem val = new CustomItem(prefabName, "MeadBaseHealthMedium", new ItemConfig { Name = displayName, Description = description }); ItemManager.Instance.AddItem(val); SharedData shared = val.ItemDrop.m_itemData.m_shared; ClearFoodValues(shared); shared.m_description = description; SetIcon(shared, icon); if ((Object)(object)model != (Object)null) { ItemVisuals.ReplaceDropVisual(((Component)val.ItemDrop).gameObject, model, modelScale); ItemVisuals.FixDropCollider(((Component)val.ItemDrop).gameObject, colliderHeight); } return val; } private static void AddCheeseBaseRecipe(string itemName, params RequirementConfig[] requirements) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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_0028: 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_003d: Expected O, but got Unknown RecipeConfig recipe = new RecipeConfig { Name = "Recipe_" + itemName, Item = itemName, Amount = 1, CraftingStation = "piece_MeadCauldron", Requirements = requirements }; AddRecipe(recipe); } private void RegisterRennet() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown //IL_014c: 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_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Expected O, but got Unknown ItemConfig val = new ItemConfig { Name = "Rennet", Description = "Special ingredient used in cheese making.", Enabled = true }; CustomItem val2 = new CustomItem("RennetItem", "Amber", val); ItemManager.Instance.AddItem(val2); ItemDrop itemDrop = val2.ItemDrop; if ((Object)(object)itemDrop == (Object)null) { Logger.LogError((object)"[LoxMilkMod] RennetItem nie ma ItemDrop."); return; } SharedData shared = itemDrop.m_itemData.m_shared; ClearFoodValues(shared); SetIcon(shared, _assets.RennetIcon); if ((Object)(object)_assets.RennetModel != (Object)null) { ItemVisuals.OverrideDropModel(((Component)itemDrop).gameObject, _assets.RennetModel); ItemVisuals.FixDropScale(((Component)itemDrop).gameObject, 1.5f); ItemVisuals.FixDropCollider(((Component)itemDrop).gameObject, 0.25f); } else { Logger.LogWarning((object)"[LoxMilkMod] Rennet model not found replaced by model Amber."); } RecipeConfig val3 = new RecipeConfig(); val3.Name = "Recipe_RennetItem"; val3.Item = "RennetItem"; val3.Amount = 3; val3.CraftingStation = "piece_preptable"; val3.Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "RottenMeat", Amount = 1 }, new RequirementConfig { Item = "LeatherScraps", Amount = 1 } }; RecipeConfig recipe = val3; AddRecipe(recipe); Logger.LogInfo((object)"[LoxMilkMod] Rennet recepie added."); } private void RegisterButter() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ItemConfig val = new ItemConfig { Name = "Butter", Description = "Butter churned from lox milk.", Enabled = true }; CustomItem val2 = new CustomItem("ButterItem", "Amber", val); ItemManager.Instance.AddItem(val2); if ((Object)(object)_assets.ButterModel != (Object)null) { ItemVisuals.OverrideDropModel(((Component)val2.ItemDrop).gameObject, _assets.ButterModel); ItemVisuals.FixDropScale(((Component)val2.ItemDrop).gameObject, 2f); } SharedData shared = val2.ItemDrop.m_itemData.m_shared; ClearFoodValues(shared); SetIcon(shared, _assets.ButterIcon); ItemVisuals.FixDropCollider(((Component)val2.ItemDrop).gameObject, 0.18f); } private void RegisterButtermilk() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ItemConfig val = new ItemConfig { Name = "Buttermilk", Description = "Refreshing buttermilk from lox milk. Good for your bones.", Enabled = true }; CustomItem val2 = new CustomItem("ButtermilkItem", "QueensJam", val); ItemManager.Instance.AddItem(val2); ConfigureTallContainerModel(val2, _assets.ButtermilkModel, 0.95f); SharedData shared = val2.ItemDrop.m_itemData.m_shared; ClearConsumableValues(shared); SetIcon(shared, _assets.ButtermilkIcon); SE_StrongBones sE_StrongBones = ScriptableObject.CreateInstance<SE_StrongBones>(); ((Object)sE_StrongBones).name = "SE_StrongBones"; ((StatusEffect)sE_StrongBones).m_name = "Strong bones"; ((StatusEffect)sE_StrongBones).m_tooltip = "You take 50% less fall damage."; ((StatusEffect)sE_StrongBones).m_ttl = 600f; ((StatusEffect)sE_StrongBones).m_icon = _assets.ButtermilkIcon; shared.m_consumeStatusEffect = (StatusEffect)(object)sE_StrongBones; FeasterRegistrar.RegisterMead(val2); } private void RegisterSkyr() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ItemConfig val = new ItemConfig { Name = "Skyr", Description = "Tastes like home...", Enabled = true }; CustomItem val2 = new CustomItem("skyrItem", "QueensJam", val); ItemManager.Instance.AddItem(val2); ConfigureTallContainerModel(val2, _assets.SkyrModel, 1.2f); SharedData shared = val2.ItemDrop.m_itemData.m_shared; ClearConsumableValues(shared); SetIcon(shared, _assets.SkyrIcon); SE_Skyr sE_Skyr = ScriptableObject.CreateInstance<SE_Skyr>(); ((Object)sE_Skyr).name = "SE_Skyr"; ((StatusEffect)sE_Skyr).m_name = "Skyr"; ((StatusEffect)sE_Skyr).m_tooltip = "You regain the rest effect for a short time."; ((StatusEffect)sE_Skyr).m_ttl = 600f; ((StatusEffect)sE_Skyr).m_icon = _assets.SkyrIcon; shared.m_consumeStatusEffect = (StatusEffect)(object)sE_Skyr; FeasterRegistrar.RegisterMead(val2); } private static void ConfigureTallContainerModel(CustomItem item, GameObject model, float scale) { if (item != null && !((Object)(object)item.ItemDrop == (Object)null) && !((Object)(object)model == (Object)null)) { GameObject gameObject = ((Component)item.ItemDrop).gameObject; ItemVisuals.OverrideDropModel(gameObject, model); ItemVisuals.FixDropScale(gameObject, scale); ItemVisuals.FixDropCollider(gameObject, 0.55f); Rigidbody component = gameObject.GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.mass = 5f; component.drag = 5f; component.angularDrag = 999f; component.constraints = (RigidbodyConstraints)112; } } } private void RegisterBearSoup() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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_0152: Expected O, but got Unknown //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) ItemConfig val = new ItemConfig { Name = "Bear soup", Description = "Thick soup made from bear meat and butter.", Enabled = true }; CustomItem val2 = new CustomItem("BearSoup", "MeatPlatter", val); ItemManager.Instance.AddItem(val2); if ((Object)(object)_assets.BearSoupModel != (Object)null) { ItemVisuals.ReplaceDropVisual(((Component)val2.ItemDrop).gameObject, _assets.BearSoupModel, 1.3f, new Vector3(0f, -0.04f, 0f)); } SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_food = 80f; shared.m_foodStamina = 26f; shared.m_foodBurnTime = 1800f; shared.m_foodRegen = 5f; SetIcon(shared, _assets.BearSoupIcon); ItemVisuals.FixDropCollider(((Component)val2.ItemDrop).gameObject, 0.2f); RecipeConfig val3 = new RecipeConfig(); val3.Name = "Recipe_BearSoup"; val3.Item = "BearSoup"; val3.Amount = 1; val3.CraftingStation = "piece_cauldron"; val3.Requirements = (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig { Item = "ButterItem", Amount = 1 }, new RequirementConfig { Item = "CookedBjornMeat", Amount = 1 }, new RequirementConfig { Item = "Turnip", Amount = 1 } }; RecipeConfig recipe = val3; AddRecipe(recipe); FeasterRegistrar.RegisterFood(val2); } private void RegisterFulingDelicacy() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown //IL_0161: 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_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) ItemConfig val = new ItemConfig { Name = "Fuling delicacy", Description = "A gourmet dish made with fish and butter.", Enabled = true }; CustomItem val2 = new CustomItem("FulingDelicacy", "FishWraps", val); ItemManager.Instance.AddItem(val2); if ((Object)(object)_assets.FulingDelicacyModel != (Object)null) { ItemVisuals.ReplaceDropVisualCentered(((Component)val2.ItemDrop).gameObject, _assets.FulingDelicacyModel, 2f, Vector3.zero); } SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_food = 80f; shared.m_foodStamina = 26f; shared.m_foodBurnTime = 1800f; shared.m_foodRegen = 3f; SetIcon(shared, _assets.FulingDelicacyIcon); ItemVisuals.FixDropCollider(((Component)val2.ItemDrop).gameObject, 0.18f); RecipeConfig val3 = new RecipeConfig(); val3.Name = "Recipe_FulingDelicacy"; val3.Item = "FulingDelicacy"; val3.Amount = 1; val3.CraftingStation = "piece_cauldron"; val3.Requirements = (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig { Item = "Needle", Amount = 2 }, new RequirementConfig { Item = "FishCooked", Amount = 1 }, new RequirementConfig { Item = "ButterItem", Amount = 1 } }; RecipeConfig recipe = val3; AddRecipe(recipe); FeasterRegistrar.RegisterFood(val2); } private void RegisterCheesePlate() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected O, but got Unknown //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_015a: Expected O, but got Unknown //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Expected O, but got Unknown //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Expected O, but got Unknown ItemConfig val = new ItemConfig { Name = "Cheese plate", Description = "Rich platter of cheeses made from lox milk.", Enabled = true }; CustomItem val2 = new CustomItem("CheesePlateItem", "MeatPlatter", val); ItemManager.Instance.AddItem(val2); if ((Object)(object)_assets.CheesePlateModel != (Object)null) { ItemVisuals.OverrideDropModel(((Component)val2.ItemDrop).gameObject, _assets.CheesePlateModel); ItemVisuals.FixDropScale(((Component)val2.ItemDrop).gameObject, 1.5f); ItemVisuals.FixDropCollider(((Component)val2.ItemDrop).gameObject, 0.25f); } SharedData shared = val2.ItemDrop.m_itemData.m_shared; shared.m_food = 100f; shared.m_foodStamina = 100f; shared.m_foodEitr = 100f; shared.m_foodBurnTime = 1800f; shared.m_foodRegen = 5f; SetIcon(shared, _assets.CheesePlateIcon); RecipeConfig val3 = new RecipeConfig(); val3.Name = "Recipe_CheesePlate"; val3.Item = "CheesePlateItem"; val3.Amount = 1; val3.CraftingStation = "piece_preptable"; val3.Requirements = (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig { Item = "LazurCheese", Amount = 1 }, new RequirementConfig { Item = "GoudaCheese", Amount = 1 }, new RequirementConfig { Item = "TwarogItem", Amount = 1 } }; RecipeConfig recipe = val3; AddRecipe(recipe); ItemVisuals.RemoveSteamEffect(val2.ItemPrefab); FeasterRegistrar.RegisterFeast(val2); } private void FixRegisteredIcons() { ItemVisuals.FixItemIcon("RennetItem", _assets.RennetIcon); } private static void AddRecipe(RecipeConfig recipe) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown ItemManager.Instance.AddRecipe(new CustomRecipe(recipe)); } private static void SetIcon(SharedData data, Sprite icon) { if (data != null && !((Object)(object)icon == (Object)null)) { data.m_icons = (Sprite[])(object)new Sprite[1] { icon }; } } private static void ClearFoodValues(SharedData data) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (data != null) { data.m_consumeStatusEffect = null; data.m_itemType = (ItemType)1; data.m_food = 0f; data.m_foodStamina = 0f; data.m_foodEitr = 0f; data.m_foodBurnTime = 0f; data.m_foodRegen = 0f; } } private static void ClearConsumableValues(SharedData data) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (data != null) { data.m_consumeStatusEffect = null; data.m_itemType = (ItemType)2; data.m_food = 0f; data.m_foodStamina = 0f; data.m_foodEitr = 0f; data.m_foodBurnTime = 0f; data.m_foodRegen = 0f; } } } public static class ItemVisuals { public static void RemoveSteamEffect(GameObject itemPrefab) { //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) if ((Object)(object)itemPrefab == (Object)null) { return; } ParticleSystem[] componentsInChildren = itemPrefab.GetComponentsInChildren<ParticleSystem>(true); ParticleSystem[] array = componentsInChildren; foreach (ParticleSystem val in array) { if (!((Object)(object)val == (Object)null)) { val.Stop(true, (ParticleSystemStopBehavior)0); EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).enabled = false; ParticleSystemRenderer component = ((Component)val).GetComponent<ParticleSystemRenderer>(); if ((Object)(object)component != (Object)null) { ((Renderer)component).enabled = false; } ((Component)val).gameObject.SetActive(false); } } } public static void ReplaceDropVisualCentered(GameObject dropObject, GameObject modelPrefab, float scale, Vector3 extraOffset) { //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)dropObject == (Object)null || (Object)(object)modelPrefab == (Object)null) { return; } Transform val = dropObject.transform.Find("LoxMilkMod_Visual"); if ((Object)(object)val != (Object)null) { Object.DestroyImmediate((Object)(object)((Component)val).gameObject); } MeshRenderer[] componentsInChildren = dropObject.GetComponentsInChildren<MeshRenderer>(true); MeshRenderer[] array = componentsInChildren; foreach (MeshRenderer val2 in array) { ((Renderer)val2).enabled = false; } SkinnedMeshRenderer[] componentsInChildren2 = dropObject.GetComponentsInChildren<SkinnedMeshRenderer>(true); SkinnedMeshRenderer[] array2 = componentsInChildren2; foreach (SkinnedMeshRenderer val3 in array2) { ((Renderer)val3).enabled = false; } GameObject val4 = Object.Instantiate<GameObject>(modelPrefab, dropObject.transform); ((Object)val4).name = "LoxMilkMod_Visual"; val4.transform.localPosition = Vector3.zero; val4.transform.localRotation = Quaternion.identity; val4.transform.localScale = Vector3.one * scale; Collider[] componentsInChildren3 = val4.GetComponentsInChildren<Collider>(true); Collider[] array3 = componentsInChildren3; foreach (Collider val5 in array3) { Object.DestroyImmediate((Object)(object)val5); } Renderer[] componentsInChildren4 = val4.GetComponentsInChildren<Renderer>(true); if (componentsInChildren4.Length == 0) { Logger.LogWarning((object)("[LoxMilkMod] ReplaceDropVisualCentered: model don't have Renderers: " + ((Object)modelPrefab).name)); return; } Renderer[] array4 = componentsInChildren4; foreach (Renderer val6 in array4) { val6.enabled = true; } Bounds bounds = componentsInChildren4[0].bounds; for (int m = 1; m < componentsInChildren4.Length; m++) { ((Bounds)(ref bounds)).Encapsulate(componentsInChildren4[m].bounds); } Vector3 val7 = dropObject.transform.InverseTransformPoint(((Bounds)(ref bounds)).center); Vector3 val8 = default(Vector3); ((Vector3)(ref val8))..ctor(0f - val7.x, 0f, 0f - val7.z); val4.transform.localPosition = val8 + extraOffset; } public static void FixDropCollider(GameObject dropObject, float height) { //IL_0055: 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) if (!((Object)(object)dropObject == (Object)null)) { Collider[] componentsInChildren = dropObject.GetComponentsInChildren<Collider>(true); Collider[] array = componentsInChildren; foreach (Collider val in array) { Object.DestroyImmediate((Object)(object)val); } BoxCollider val2 = dropObject.AddComponent<BoxCollider>(); val2.size = new Vector3(0.35f, height, 0.35f); val2.center = new Vector3(0f, height / 2f, 0f); ((Collider)val2).isTrigger = false; Rigidbody component = dropObject.GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.constraints = (RigidbodyConstraints)112; component.drag = 5f; component.angularDrag = 999f; } } } public static void OverrideDropModel(GameObject targetPrefab, GameObject sourcePrefab) { if (!((Object)(object)targetPrefab == (Object)null) && !((Object)(object)sourcePrefab == (Object)null)) { MeshFilter componentInChildren = sourcePrefab.GetComponentInChildren<MeshFilter>(true); MeshRenderer componentInChildren2 = sourcePrefab.GetComponentInChildren<MeshRenderer>(true); MeshFilter componentInChildren3 = targetPrefab.GetComponentInChildren<MeshFilter>(true); MeshRenderer componentInChildren4 = targetPrefab.GetComponentInChildren<MeshRenderer>(true); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren3 != (Object)null) { componentInChildren3.sharedMesh = componentInChildren.sharedMesh; } else { Logger.LogWarning((object)"[LoxMilkMod] OverrideDropModel: MeshFilter is not found."); } if ((Object)(object)componentInChildren2 != (Object)null && (Object)(object)componentInChildren4 != (Object)null) { ((Renderer)componentInChildren4).sharedMaterials = ((Renderer)componentInChildren2).sharedMaterials; } else { Logger.LogWarning((object)"[LoxMilkMod] OverrideDropModel: MeshRenderer is not found."); } } } public static GameObject ReplaceDropVisual(GameObject dropObject, GameObject modelPrefab, float scale) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) return ReplaceDropVisual(dropObject, modelPrefab, scale, Vector3.zero); } public static GameObject ReplaceDropVisual(GameObject dropObject, GameObject modelPrefab, float scale, Vector3 localPosition) { //IL_00d0: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)dropObject == (Object)null || (Object)(object)modelPrefab == (Object)null) { return null; } Transform val = dropObject.transform.Find("LoxMilkMod_Visual"); if ((Object)(object)val != (Object)null) { Object.DestroyImmediate((Object)(object)((Component)val).gameObject); } MeshRenderer[] componentsInChildren = dropObject.GetComponentsInChildren<MeshRenderer>(true); MeshRenderer[] array = componentsInChildren; foreach (MeshRenderer val2 in array) { ((Renderer)val2).enabled = false; } SkinnedMeshRenderer[] componentsInChildren2 = dropObject.GetComponentsInChildren<SkinnedMeshRenderer>(true); SkinnedMeshRenderer[] array2 = componentsInChildren2; foreach (SkinnedMeshRenderer val3 in array2) { ((Renderer)val3).enabled = false; } GameObject val4 = Object.Instantiate<GameObject>(modelPrefab, dropObject.transform); ((Object)val4).name = "LoxMilkMod_Visual"; val4.transform.localPosition = localPosition; val4.transform.localRotation = Quaternion.identity; val4.transform.localScale = Vector3.one * scale; Collider[] componentsInChildren3 = val4.GetComponentsInChildren<Collider>(true); Collider[] array3 = componentsInChildren3; foreach (Collider val5 in array3) { Object.DestroyImmediate((Object)(object)val5); } MeshRenderer[] componentsInChildren4 = val4.GetComponentsInChildren<MeshRenderer>(true); MeshRenderer[] array4 = componentsInChildren4; foreach (MeshRenderer val6 in array4) { ((Renderer)val6).enabled = true; } SkinnedMeshRenderer[] componentsInChildren5 = val4.GetComponentsInChildren<SkinnedMeshRenderer>(true); SkinnedMeshRenderer[] array5 = componentsInChildren5; foreach (SkinnedMeshRenderer val7 in array5) { ((Renderer)val7).enabled = true; } return val4; } public static void FixDropScale(GameObject dropObject, float scale) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)dropObject == (Object)null)) { MeshFilter componentInChildren = dropObject.GetComponentInChildren<MeshFilter>(true); if ((Object)(object)componentInChildren == (Object)null) { Logger.LogWarning((object)("[LoxMilkMod] FixDropScale: MeshFilter is not found " + ((Object)dropObject).name + ".")); } else { ((Component)componentInChildren).transform.localScale = Vector3.one * scale; } } } public static void EnsureItemHasIcon(ItemDrop itemDrop, Sprite fallbackIcon) { if ((Object)(object)itemDrop == (Object)null) { return; } SharedData val = itemDrop.m_itemData?.m_shared; if (val != null && (val.m_icons == null || val.m_icons.Length == 0 || !((Object)(object)val.m_icons[0] != (Object)null))) { if ((Object)(object)fallbackIcon != (Object)null) { val.m_icons = (Sprite[])(object)new Sprite[1] { fallbackIcon }; Logger.LogInfo((object)("[LoxMilkMod] Added backup icon: " + ((Object)itemDrop).name)); } else { Logger.LogWarning((object)("[LoxMilkMod] No backup icon for: " + ((Object)itemDrop).name)); } } } public static void FixItemIcon(string itemName, Sprite fallbackIcon) { if ((Object)(object)ObjectDB.instance == (Object)null) { Logger.LogWarning((object)"[LoxMilkMod] FixItemIcon: ObjectDB is not ready."); return; } GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(itemName); if ((Object)(object)itemPrefab == (Object)null) { Logger.LogWarning((object)("[LoxMilkMod] FixItemIcon: prefab is not found " + itemName + ".")); return; } ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); if ((Object)(object)component == (Object)null) { Logger.LogWarning((object)("[LoxMilkMod] FixItemIcon: " + itemName + " ItemDrop component not found.")); } else { EnsureItemHasIcon(component, fallbackIcon); } } } [HarmonyPatch(typeof(Character), "GetHoverText")] public static class LoxMilkHoverPatch { private const float MilkerDistance = 5f; private static void Postfix(Character __instance, ref string __result) { //IL_00f2: 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) if ((Object)(object)__instance == (Object)null) { return; } string text = __instance.m_name ?? string.Empty; string text2 = (((Object)(object)((Component)__instance).gameObject != (Object)null) ? ((Object)((Component)__instance).gameObject).name : string.Empty); if (!text.ToLowerInvariant().Contains("lox") && !text2.ToLowerInvariant().Contains("lox")) { return; } Tameable component = ((Component)__instance).GetComponent<Tameable>(); if ((Object)(object)component == (Object)null || !component.IsTamed()) { return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } bool flag = false; foreach (MobileLoxWorkbench instance in MobileLoxWorkbench.Instances) { if (!((Object)(object)instance == (Object)null)) { float num = Vector3.Distance(((Component)localPlayer).transform.position, ((Component)instance).transform.position); if (num <= 5f) { flag = true; break; } } } if (flag && (string.IsNullOrEmpty(__result) || !__result.Contains("<color=yellow>[Ctrl+C]</color> Milking lox"))) { __result += "\n<color=yellow>[Ctrl+C]</color> Milking lox"; } } } public sealed class LoxMilkingController : MonoBehaviour { private const float MilkerDistance = 5f; private const float LoxLookDistance = 8f; private const float LookSphereRadius = 0.5f; private const string MilkPrefabName = "LoxMilkItem"; private readonly Dictionary<int, float> _loxNextMilkTime = new Dictionary<int, float>(); private static float MilkCooldown => ModConfig.IsInitialized ? ModConfig.LoxMilkingCooldownSeconds : 1260f; private static int MilkPerLox => ModConfig.IsInitialized ? ModConfig.MilkPerMilking.Value : 5; private void Update() { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { bool key = Input.GetKey((KeyCode)306); bool keyDown = Input.GetKeyDown((KeyCode)99); if (key && keyDown) { TryMilkNearbyLox(localPlayer); } } } private void TryMilkNearbyLox(Player player) { if ((Object)(object)player == (Object)null) { return; } if (!PlayerIsNearMobileWorkbench(player)) { ShowMessage(player, "You must stand near the Milker to milk a lox."); return; } Character lookedAtLox = GetLookedAtLox(player, 8f); if ((Object)(object)lookedAtLox == (Object)null) { ShowMessage(player, "Look at a tamed lox."); return; } Tameable component = ((Component)lookedAtLox).GetComponent<Tameable>(); if ((Object)(object)component == (Object)null || !component.IsTamed()) { ShowMessage(player, "The lox must be tamed."); return; } if (!CanMilkLox(lookedAtLox, out var remainingSeconds)) { ShowMessage(player, $"Lox needs to rest ({remainingSeconds}s)."); return; } if ((Object)(object)ObjectDB.instance == (Object)null) { ShowMessage(player, "Error: ObjectDB is not ready."); Logger.LogError((object)"[LoxMilkMod] Can't milk lox: ObjectDB.instance is null."); return; } GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("LoxMilkItem"); if ((Object)(object)itemPrefab == (Object)null) { ShowMessage(player, "Error: lox milk prefab not found."); Logger.LogError((object)"[LoxMilkMod] prefabu is not foundLoxMilkItem."); return; } bool flag = TryPutMilkIntoNearestCart(player, itemPrefab, MilkPerLox); StartLoxCooldown(lookedAtLox); PlayLoxPetEffects(lookedAtLox); if (flag) { ShowMessage(player, "You milked the lox - milk was placed in the Milker."); return; } Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory == null) { ShowMessage(player, "You milked the lox, but no inventory was found."); Logger.LogError((object)"[LoxMilkMod] Player.GetInventory() is null."); } else if (inventory.AddItem(itemPrefab, MilkPerLox)) { ShowMessage(player, "You milked the lox - milk was added to your inventory because the Milker is full."); } else { ShowMessage(player, "You milked the lox, but both inventories are full."); Logger.LogWarning((object)"[LoxMilkMod] Could not add milk neither to Milker nor to the player's inventory."); } } private bool CanMilkLox(Character lox, out int remainingSeconds) { remainingSeconds = 0; if ((Object)(object)lox == (Object)null) { return false; } int instanceID = ((Object)lox).GetInstanceID(); float time = Time.time; if (!_loxNextMilkTime.TryGetValue(instanceID, out var value)) { return true; } if (time >= value) { _loxNextMilkTime.Remove(instanceID); return true; } float num = value - time; remainingSeconds = Mathf.CeilToInt(num); return false; } private void StartLoxCooldown(Character lox) { if (!((Object)(object)lox == (Object)null)) { int instanceID = ((Object)lox).GetInstanceID(); _loxNextMilkTime[instanceID] = Time.time + MilkCooldown; } } private MobileLoxWorkbench GetNearestMobileWorkbench(Player player, float maxDistance) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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) if ((Object)(object)player == (Object)null) { return null; } List<MobileLoxWorkbench> instances = MobileLoxWorkbench.Instances; if (instances == null || instances.Count == 0) { return null; } Vector3 position = ((Component)player).transform.position; MobileLoxWorkbench result = null; float num = maxDistance; foreach (MobileLoxWorkbench item in instances) { if (!((Object)(object)item == (Object)null)) { float num2 = Vector3.Distance(position, ((Component)item).transform.position); if (num2 <= num) { num = num2; result = item; } } } return result; } private bool PlayerIsNearMobileWorkbench(Player player, float maxDistance = 5f) { return (Object)(object)GetNearestMobileWorkbench(player, maxDistance) != (Object)null; } private bool TryPutMilkIntoNearestCart(Player player, GameObject milkPrefab, int amount) { if ((Object)(object)player == (Object)null || (Object)(object)milkPrefab == (Object)null || amount <= 0) { return false; } MobileLoxWorkbench nearestMobileWorkbench = GetNearestMobileWorkbench(player, 5f); if ((Object)(object)nearestMobileWorkbench == (Object)null) { return false; } Container componentInChildren = ((Component)nearestMobileWorkbench).GetComponentInChildren<Container>(true); if ((Object)(object)componentInChildren == (Object)null) { Logger.LogWarning((object)"[LoxMilkMod] Nearest Milkerhas no Container component."); return false; } Inventory inventory = componentInChildren.GetInventory(); if (inventory == null) { Logger.LogWarning((object)"[LoxMilkMod] Container Milker no equipment."); return false; } return inventory.AddItem(milkPrefab, amount); } private static bool IsLox(Character character) { if ((Object)(object)character == (Object)null) { return false; } string text = ((Object)((Component)character).gameObject).name ?? string.Empty; string text2 = character.m_name ?? string.Empty; return text.IndexOf("lox", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("lox", StringComparison.OrdinalIgnoreCase) >= 0; } private static Character GetLookedAtLox(Player player, float maxDistance) { //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_0050: 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_0058: 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_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) if ((Object)(object)player == (Object)null) { return null; } Camera main = Camera.main; if ((Object)(object)main == (Object)null) { Logger.LogWarning((object)"[LoxMilkMod] Camera.main is null."); return null; } Vector3 position = ((Component)main).transform.position; Vector3 forward = ((Component)main).transform.forward; int num = -1; RaycastHit[] array = Physics.SphereCastAll(position, 0.5f, forward, maxDistance, num, (QueryTriggerInteraction)1); if (array == null || array.Length == 0) { return null; } Array.Sort(array, (RaycastHit first, RaycastHit second) => ((RaycastHit)(ref first)).distance.CompareTo(((RaycastHit)(ref second)).distance)); RaycastHit[] array2 = array; for (int num2 = 0; num2 < array2.Length; num2++) { RaycastHit val = array2[num2]; if (!((Object)(object)((RaycastHit)(ref val)).collider == (Object)null)) { Character componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<Character>(); if (!((Object)(object)componentInParent == (Object)null) && !((Object)(object)componentInParent == (Object)(object)player) && IsLox(componentInParent)) { return componentInParent; } } } return null; } private static void PlayLoxPetEffects(Character lox) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)lox == (Object)null)) { Tameable component = ((Component)lox).GetComponent<Tameable>(); if (!((Object)(object)component == (Object)null) && component.m_petEffect != null) { component.m_petEffect.Create(((Component)lox).transform.position, Quaternion.identity, ((Component)lox).transform, 1f, -1); } } } private static void ShowMessage(Player player, string message) { if (!((Object)(object)player == (Object)null) && !string.IsNullOrEmpty(message)) { ((Character)player).Message((MessageType)2, message, 0, (Sprite)null); } } } [BepInPlugin("Jax.LoxMilkMod", "Lox Milk Mod", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class LoxMilkMod : BaseUnityPlugin { public class RequireNearbyPiece : MonoBehaviour { public string RequiredPieceName; public float RequiredDistance = 5f; private Piece _piece; private void Awake() { _piece = ((Component)this).GetComponent<Piece>(); if (!IsRequiredPieceNearby()) { ZNetView component = ((Component)this).GetComponent<ZNetView>(); if ((Object)(object)component != (Object)null && component.IsValid()) { component.Destroy(); } else { Object.Destroy((Object)(object)((Component)this).gameObject); } } } private bool IsRequiredPieceNearby() { //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_003f: 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) Vector3 position = ((Component)this).transform.position; Piece[] array = Object.FindObjectsOfType<Piece>(); foreach (Piece val in array) { if (!((Object)(object)val == (Object)null) && ((Object)val).name == RequiredPieceName && Vector3.Distance(position, ((Component)val).transform.position) <= RequiredDistance) { return true; } } return false; } } public const string ModGUID = "Jax.LoxMilkMod"; public const string ModName = "Lox Milk Mod"; public const string Version = "1.0.0"; public static LoxMilkMod Instance; private ModAssets _assets; private Harmony _harmony; private void Awake() { //IL_0013: Unknown