Decompiled source of LootGoblinsHeimUtils v2.0.0
LootGoblinsHeimUtils.dll
Decompiled 11 months 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.Globalization; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using JetBrains.Annotations; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using LootGoblinsUtils.Configuration; using LootGoblinsUtils.Conquest.Components.Spawners; using LootGoblinsUtils.Conquest.Components.Spawners.Boar; using LootGoblinsUtils.Conquest.Components.Spawners.Neck; using LootGoblinsUtils.Conquest.Creatures; using LootGoblinsUtils.Conquest.Creatures.Attacks; using LootGoblinsUtils.Conquest.Items; using LootGoblinsUtils.Conquest.Locations; using LootGoblinsUtils.Conquest.Locations.T1CoresLoaders; using LootGoblinsUtils.Conquest.Pieces; using LootGoblinsUtils.Conquest.Pieces.Core; using LootGoblinsUtils.Conquest.Pieces.DefenderTotem; using LootGoblinsUtils.Conquest.Pieces.Ghost; using LootGoblinsUtils.Conquest.TerminalCommands; using LootGoblinsUtils.Submods.Farming; using LootGoblinsUtils.Submods.Farming.Pieces; using LootGoblinsUtils.Submods.Farming.Pieces.Configurators; using LootGoblinsUtils.Submods.Farming.Pieces.Stations; using LootGoblinsUtils.Utils; using SimpleJson; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("LootGoblinsHeimUtils")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LootGoblinsHeimUtils")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")] [assembly: AssemblyFileVersion("0.0.1.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.1.0")] namespace LootGoblinsUtils { [BepInPlugin("com.lootgoblinsheim.utils", "LootGoblinsHeimUtils", "2.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] internal class LootGoblinsHeimUtilsPlugin : BaseUnityPlugin { public const string PluginGuid = "com.lootgoblinsheim.utils"; public const string PluginName = "LootGoblinsHeimUtils"; public const string PluginVersion = "2.0.0"; private readonly Harmony _harmony = new Harmony("com.lootgoblinsheim.utils"); public static readonly CustomLocalization Localization = LocalizationManager.Instance.GetLocalization(); public static ConfigFile CFG; private void Awake() { Logger.LogInfo((object)"------------ LootGoblinsHeimUtilsPlugin start ------------"); CFG = ((BaseUnityPlugin)this).Config; Blueprints.Init(); Assembly executingAssembly = Assembly.GetExecutingAssembly(); _harmony.PatchAll(executingAssembly); PluginConfiguration.InitConfigs((BaseUnityPlugin)(object)this); FarmingSetup.Init(); Logger.LogInfo((object)"------------ LootGoblinsHeimUtilsPlugin end ------------"); } } } namespace LootGoblinsUtils.Utils { public class Blueprint { public enum Format { VBuild, Blueprint } public string ID; public string Name; public string Creator; public string Description = string.Empty; public string Category = "Blueprints"; public PieceEntry[] PieceEntries; public GameObject Prefab; public KeyHintConfig KeyHint; public Bounds Bounds; public float GhostActiveTime; } public class SnapPointEntry { public string line; public float posX; public float posY; public float posZ; } public class TerrainModEntry { public string line; public string shape; public float posX; public float posY; public float posZ; public float radius; public int rotation; public float smooth; public string paint; } public static class Blueprints { public enum ParserState { SnapPoints, Terrain, Pieces } public static Blueprint RavenBP; public static void Init() { RavenBP = LoadBP("Relicv_Raven_V2.blueprint", "LGH_Raven_BP"); } private static Blueprint LoadBP(string filename, string targetName) { string text = AssetUtils.LoadTextFromResources(filename); if (text == null) { return null; } string[] lines = text.GetLines(removeEmptyLines: true).ToArray(); Blueprint blueprint = FromArray(targetName, lines, Blueprint.Format.Blueprint); Logger.LogInfo((object)$"Loaded BP: ${filename}; value = {blueprint.Name}; pieces = {blueprint.PieceEntries.Length}"); return blueprint; } public static void Instantiate(this Blueprint bp, Transform parent) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) if (bp == null) { Logger.LogError((object)"Blueprints.Instantiate: bp is null"); return; } ((Component)parent).gameObject.SetActive(false); PieceEntry[] pieceEntries = bp.PieceEntries; foreach (PieceEntry pieceEntry in pieceEntries) { if (pieceEntry == null || pieceEntry.name == null) { Logger.LogWarning((object)"Skipping empty bpPieceEntry"); continue; } GameObject prefab = PrefabManager.Instance.GetPrefab(pieceEntry.name); if ((Object)(object)prefab == (Object)null) { Logger.LogError((object)("Blueprint[" + bp.Name + "]: cant find prefab " + pieceEntry.name + " to instantiate")); } else { Object.Instantiate<GameObject>(prefab, pieceEntry.GetPosition(), pieceEntry.GetRotation(), parent); } } Logger.LogInfo((object)"Blueprints.Instantiate: done"); ((Component)parent).gameObject.SetActive(true); } public static Blueprint FromArray(string id, string[] lines, Blueprint.Format format) { Blueprint blueprint = new Blueprint { ID = id }; List<PieceEntry> list = new List<PieceEntry>(); ParserState parserState = ParserState.Pieces; foreach (string text in lines) { if (string.IsNullOrEmpty(text)) { continue; } if (text.StartsWith("#Name:")) { blueprint.Name = text.Substring("#Name:".Length); continue; } if (text.StartsWith("#Creator:")) { blueprint.Creator = text.Substring("#Creator:".Length); continue; } if (text.StartsWith("#Description:")) { blueprint.Description = text.Substring("#Description:".Length); if (blueprint.Description.StartsWith("\"")) { blueprint.Description = SimpleJson.DeserializeObject<string>(blueprint.Description); } continue; } if (text.StartsWith("#Category:")) { blueprint.Category = text.Substring("#Category:".Length); if (string.IsNullOrEmpty(blueprint.Category)) { blueprint.Category = "Blueprints"; } continue; } switch (text) { case "#SnapPoints": parserState = ParserState.SnapPoints; break; case "#Terrain": parserState = ParserState.Terrain; break; case "#Pieces": parserState = ParserState.Pieces; break; default: ParseLine(format, text, parserState, list); break; } } if (string.IsNullOrEmpty(blueprint.Name)) { blueprint.Name = blueprint.ID; } blueprint.PieceEntries = list.ToArray(); return blueprint; } private static void ParseLine(Blueprint.Format format, string line, ParserState parserState, List<PieceEntry> pieceEntryList) { if (line.StartsWith("#")) { return; } switch (parserState) { case ParserState.SnapPoints: break; case ParserState.Terrain: break; case ParserState.Pieces: switch (format) { case Blueprint.Format.VBuild: pieceEntryList.Add(PieceEntry.FromVBuild(line)); break; case Blueprint.Format.Blueprint: pieceEntryList.Add(PieceEntry.FromBlueprint(line)); break; } break; } } } public static class CustomPieceExtensions { public static CustomPiece ReplaceWntModel(this CustomPiece piece, GameObject targetModel, Vector3 targetScale) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) return piece.ReplaceWntModel(targetModel, targetScale, Vector3.zero); } public static CustomPiece ReplaceWntModel(this CustomPiece piece, GameObject targetModel, Vector3 targetScale, Vector3 offset) { //IL_0019: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(targetModel, piece.PiecePrefab.transform); Transform transform = val.transform; transform.localPosition += offset; val.transform.localScale = targetScale; WearNTear component = piece.PiecePrefab.GetComponent<WearNTear>(); if (Object.op_Implicit((Object)(object)component.m_new)) { Object.Destroy((Object)(object)component.m_new); } component.m_new = val; if (Object.op_Implicit((Object)(object)component.m_broken)) { Object.Destroy((Object)(object)component.m_broken); } component.m_broken = val; if (Object.op_Implicit((Object)(object)component.m_worn)) { Object.Destroy((Object)(object)component.m_worn); } component.m_worn = val; return piece; } public static CustomPiece RemoveExistingWntModels(this CustomPiece piece) { piece.PiecePrefab.DestroyIfExists("new"); piece.PiecePrefab.DestroyIfExists("worn"); piece.PiecePrefab.DestroyIfExists("broken"); return piece; } public static CustomPiece SetWntSupport(this CustomPiece piece, bool support) { piece.PiecePrefab.GetComponent<WearNTear>().m_noSupportWear = support; return piece; } public static CustomPiece SetPieceHealth(this CustomPiece piece, float health) { piece.PiecePrefab.GetComponent<WearNTear>().m_health = health; return piece; } public static CustomPiece RemoveColliders(this CustomPiece piece) { Collider[] componentsInChildren = piece.PiecePrefab.GetComponentsInChildren<Collider>(); for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy((Object)(object)componentsInChildren[i]); } return piece; } public static CustomPiece RemoveRenderers(this CustomPiece piece) { Renderer[] componentsInChildren = piece.PiecePrefab.GetComponentsInChildren<Renderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy((Object)(object)componentsInChildren[i]); } return piece; } } public static class GameObjectExtensions { public static void SetHuntCharacter(this GameObject monster, Player player) { if ((Object)(object)monster == (Object)null) { Logger.LogWarning((object)(((Object)monster).name + ".SetHuntCharacter: monster == null")); return; } MonsterAI component = monster.GetComponent<MonsterAI>(); if ((Object)(object)component == (Object)null) { Logger.LogWarning((object)(((Object)monster).name + ".SetHuntCharacter: monsterAi == null")); return; } ((BaseAI)component).SetHuntPlayer(true); component.SetTarget((Character)(object)player); ((BaseAI)component).SetPatrolPoint(); } public static void SetRendererColor(this GameObject target, Color color) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null) { Logger.LogError((object)"SetRendererColor target == null"); return; } MeshRenderer componentInChildren = ((Component)target.transform).GetComponentInChildren<MeshRenderer>(); if ((Object)(object)componentInChildren == (Object)null) { Logger.LogError((object)"SetRendererColor renderer == null"); } else { ((Renderer)componentInChildren).sharedMaterial.color = color; } } public static GameObject AddLightningEffect(this GameObject target, Vector3 fxScale) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Object.Instantiate<GameObject>(FinePrefabs.LightningUnitEffectCloned, target.transform); obj.transform.localPosition = Vector3.zero; obj.transform.localScale = fxScale; return target; } public static void DestroyIfExists(this GameObject target, string name) { Transform val = target.transform.Find(name); if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)((Component)val).gameObject); } } public static GameObject ClosestToPoint(this IEnumerable<GameObject> list, Vector3 point) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) GameObject[] source = (list as GameObject[]) ?? list.ToArray(); if (!source.Any()) { return null; } return (from x in source.ToDictionary((GameObject x) => x, (GameObject x) => Vector3.Distance(x.transform.position, point)) orderby x.Value select x).FirstOrDefault().Key; } public static bool PiecePlaced(this GameObject piece) { return ((Object)piece).name.Contains("(Clone)"); } } public static class Loader { public static void RunSafe(Action target, string name = null, [CallerMemberName] string caller = "") { try { Logger.LogInfo((object)((name ?? caller) + " start loading ...")); target(); Logger.LogInfo((object)((name ?? caller) + " loading completed")); } catch (Exception ex) { Logger.LogError((object)((name ?? caller) + " loading failed")); Logger.LogError((object)ex); } } } public static class MonoExtensions { public static bool IsPiecePlaced(this MonoBehaviour script) { return false; } } public class PieceEntry { public string line; public string name; public string category; public float posX; public float posY; public float posZ; public float rotX; public float rotY; public float rotZ; public float rotW; public string additionalInfo; public float scaleX; public float scaleY; public float scaleZ; public static PieceEntry FromBlueprint(string line) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) if (line.IndexOf(',') > -1) { line = line.Replace(',', '.'); } string[] array = line.Split(new char[1] { ';' }); string text = array[0]; string text2 = array[1]; float num = InvariantFloat(array[2]); float num2 = InvariantFloat(array[3]); float num3 = InvariantFloat(array[4]); float num4 = InvariantFloat(array[5]); float num5 = InvariantFloat(array[6]); float num6 = InvariantFloat(array[7]); float num7 = InvariantFloat(array[8]); Vector3 pos = default(Vector3); ((Vector3)(ref pos))..ctor(num, num2, num3); Quaternion val = new Quaternion(num4, num5, num6, num7); Quaternion normalized = ((Quaternion)(ref val)).normalized; string text3 = array[9]; string text4; if (!string.IsNullOrEmpty(text3) && !text3.Equals("\"\"")) { try { text4 = SimpleJson.DeserializeObject<string>(text3); } catch { text4 = array[9]; } } else { text4 = null; } Vector3 one = Vector3.one; if (array.Length > 10) { ((Vector3)(ref one))..ctor(InvariantFloat(array[10]), InvariantFloat(array[11]), InvariantFloat(array[12])); } return new PieceEntry(text, text2, pos, normalized, text4, one); } public static PieceEntry FromVBuild(string line) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) if (line.IndexOf(',') > -1) { line = line.Replace(',', '.'); } string[] array = line.Split(new char[1] { ' ' }); string text = array[0]; float num = InvariantFloat(array[1]); float num2 = InvariantFloat(array[2]); float num3 = InvariantFloat(array[3]); float num4 = InvariantFloat(array[4]); float num5 = InvariantFloat(array[5]); float num6 = InvariantFloat(array[6]); float num7 = InvariantFloat(array[7]); string text2 = "Building"; Quaternion val = new Quaternion(num, num2, num3, num4); Quaternion normalized = ((Quaternion)(ref val)).normalized; Vector3 pos = default(Vector3); ((Vector3)(ref pos))..ctor(num5, num6, num7); string empty = string.Empty; return new PieceEntry(text, text2, pos, normalized, empty, Vector3.one); } public PieceEntry(string name, string category, Vector3 pos, Quaternion rot, string additionalInfo, Vector3 scale) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_004b: 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_0065: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) this.name = name.Split(new char[1] { '(' })[0]; this.category = category; posX = pos.x; posY = pos.y; posZ = pos.z; rotX = rot.x; rotY = rot.y; rotZ = rot.z; rotW = rot.w; this.additionalInfo = additionalInfo; if (!string.IsNullOrEmpty(this.additionalInfo)) { this.additionalInfo = string.Concat(this.additionalInfo.Split(new char[1] { ';' })); } scaleX = scale.x; scaleY = scale.y; scaleZ = scale.z; line = string.Join(";", this.name, this.category, InvariantString(posX), InvariantString(posY), InvariantString(posZ), InvariantString(rotX), InvariantString(rotY), InvariantString(rotZ), InvariantString(rotW), SimpleJson.SerializeObject((object)additionalInfo), InvariantString(scaleX), InvariantString(scaleY), InvariantString(scaleZ)); } public Vector3 GetPosition() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return new Vector3(posX, posY, posZ); } public Quaternion GetRotation() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return new Quaternion(rotX, rotY, rotZ, rotW); } public Vector3 GetScale() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return new Vector3(scaleX, scaleY, scaleZ); } public static float InvariantFloat(string s) { if (!string.IsNullOrEmpty(s)) { return float.Parse(s, NumberStyles.Any, NumberFormatInfo.InvariantInfo); } return 0f; } public static string InvariantString(float f) { return f.ToString(NumberFormatInfo.InvariantInfo); } } public abstract class SlowMono : MonoBehaviour { protected float UpdateStep = 1f; private float _lastUpdate = Time.time; private void Update() { if (Time.time - _lastUpdate > UpdateStep) { _lastUpdate = Time.time; if (ZoneSystem.instance.IsActiveAreaLoaded() && !ZNetScene.instance.InLoadingScreen()) { SlowUpdate(); } } } public abstract void SlowUpdate(); } public static class StringExtensionMethods { public static IEnumerable<string> GetLines(this string str, bool removeEmptyLines = false) { return str.Split(new string[3] { "\r\n", "\r", "\n" }, removeEmptyLines ? StringSplitOptions.RemoveEmptyEntries : StringSplitOptions.None); } } public static class TextureExtensions { public static Texture2D DrawCircle(this Texture2D tex, Color color, int x, int y, int radius = 3) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) float num = radius * radius; for (int i = x - radius; i < x + radius + 1; i++) { for (int j = y - radius; j < y + radius + 1; j++) { if ((float)((x - i) * (x - i) + (y - j) * (y - j)) < num) { tex.SetPixel(i, j, color); } } } return tex; } } } namespace LootGoblinsUtils.Submods.ReliableBlock { [HarmonyPatch(typeof(Character), "AddStaggerDamage")] public static class Hook { public static void Postfix(ref bool __result) { if (PluginConfiguration.ReliableBlockToggle.Value) { __result = false; } } } } namespace LootGoblinsUtils.Submods.Farming { public static class FarmingSetup { public static void Init() { PrefabManager.OnVanillaPrefabsAvailable += Setup; ItemManager.OnItemsRegistered += ObjectDbLoaded; } private static void ObjectDbLoaded() { HoePatch.Patch(); } private static void Setup() { BushUtils.CacheDependencies(); FarmersTable.Configure(); FarmersTableExtensionT1.Configure(); RaspberryBush.Setup(); BlueberryBush.Setup(); CloudberryBush.Setup(); ThistleBush.Setup(); Mushroom.Configure(); MushroomYellow.Configure(); Dandelion.Configure(); Saplings.ReplaceRecipes(); PrefabManager.OnVanillaPrefabsAvailable -= Setup; } } public static class FarmingHooks { [HarmonyPatch(typeof(Fermenter), "GetHoverText")] public static class FermenterHoverText { public static bool Prefix(Fermenter __instance, ref string __result) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected I4, but got Unknown if (!((Object)((Component)__instance).gameObject).name.Contains("_LG")) { return true; } if (!PrivateArea.CheckAccess(((Component)__instance).transform.position, 0f, false, false)) { __result = "Доступ запрещён"; return false; } Piece component = ((Component)__instance).GetComponent<Piece>(); TimeSpan timeSpan = TimeSpan.FromSeconds((int)((double)__instance.m_fermentationDuration - __instance.GetFermentationTime())); Status status = __instance.GetStatus(); __result = (int)status switch { 0 => Localization.instance.Localize(component.m_name + " ( Пусто )\n[<color=yellow><b>$KEY_Use</b></color>] Добавить удобрение"), 1 => $"{component.m_name} ( <color=blue>Рост</color> )\nОсталось: {timeSpan.Minutes} мин. {timeSpan.Seconds} сек.", 3 => component.m_name + " ( <color=green>Готово</color> )", _ => component.m_name, }; return false; } } [HarmonyPatch(typeof(Fermenter), "UpdateCover")] public static class FermenterCoverSkip { private static bool Prefix(Fermenter __instance) { return !((Object)((Component)__instance).gameObject).name.Contains("_LG"); } } } public static class HoePatch { public static void Patch() { Loader.RunSafe(RemoveHoeRecipe, "HoePatch", "Patch"); } private static void RemoveHoeRecipe() { Recipe val = ((IEnumerable<Recipe>)ObjectDB.instance.m_recipes).FirstOrDefault((Func<Recipe, bool>)delegate(Recipe x) { object obj; if (x == null) { obj = null; } else { ItemDrop item = x.m_item; obj = ((item != null) ? ((Object)item).name : null); } return (string?)obj == "Hoe"; }); if ((Object)(object)val != (Object)null) { val.m_enabled = false; } } } } namespace LootGoblinsUtils.Submods.Farming.Pieces { public static class BlueberryBush { public static void Setup() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected O, but got Unknown //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown BushConfiguration bushConfiguration = new BushConfiguration(); bushConfiguration.Name = "Blueberries"; bushConfiguration.LocalizedBushName = "Куст черники"; bushConfiguration.ReadyObjectName = "Berrys"; bushConfiguration.FertilizerIcon = BushUtils.BlueberryBushIcon; bushConfiguration.NewBushModel = BushUtils.BlueberryBushModel; bushConfiguration.BushRequirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Blueberries", 5, 0, false), new RequirementConfig("BoneFragments", 3, 0, false) }; bushConfiguration.FertilizerConfigs = new BushConfiguration.FertilizerConfig[2] { new BushConfiguration.FertilizerConfig { LocalizedName = "Удобрение для черники", LocalizedDescription = "Добавьте в куст черники, чтобы запустить процесс роста", AmountProduced = 5, RecipeRequirements = (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("BoneFragments", 2, 0, false) } }, new BushConfiguration.FertilizerConfig { LocalizedName = "Удобрение для черники насыщенное", LocalizedDescription = "Добавьте в куст черники, чтобы запустить процесс роста. Увеличивает количество получаемого продукта", AmountProduced = 10, RecipeRequirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("BoneFragments", 2, 0, false), new RequirementConfig("Entrails", 1, 0, false) } } }; bushConfiguration.Configure(); } } public static class CloudberryBush { public static void Setup() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown BushConfiguration bushConfiguration = new BushConfiguration(); bushConfiguration.Name = "Cloudberry"; bushConfiguration.LocalizedBushName = "Куст морошки"; bushConfiguration.ReadyObjectName = "Berrys"; bushConfiguration.ColliderRadius = 0.7f; bushConfiguration.FertilizerIcon = BushUtils.CloudberryVisuals.Icon; bushConfiguration.NewBushModel = BushUtils.CloudberryVisuals.Model; bushConfiguration.BushRequirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Cloudberry", 5, 0, false), new RequirementConfig("Bloodbag", 2, 0, false) }; bushConfiguration.FertilizerConfigs = new BushConfiguration.FertilizerConfig[2] { new BushConfiguration.FertilizerConfig { LocalizedName = "Удобрение для морошки", LocalizedDescription = "Добавьте в куст морошки, чтобы запустить процесс роста", AmountProduced = 5, RecipeRequirements = (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("Bloodbag", 3, 0, false) } }, new BushConfiguration.FertilizerConfig { LocalizedName = "Удобрение для морошки насыщенное", LocalizedDescription = "Добавьте в куст морошки, чтобы запустить процесс роста. Увеличивает количество получаемого продукта", AmountProduced = 10, RecipeRequirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Bloodbag", 3, 0, false), new RequirementConfig("Ooze", 1, 0, false) } } }; bushConfiguration.Configure(); } } public static class Dandelion { public const string PieceName = "$piece_dandelion_LG"; public static void Configure() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown CustomLocalization localization = LootGoblinsHeimUtilsPlugin.Localization; string text = "Russian"; string text2 = "$piece_dandelion_LG"; localization.AddTranslation(ref text, ref text2, "Одуванчик"); CustomLocalization localization2 = LootGoblinsHeimUtilsPlugin.Localization; text = "English"; text2 = "$piece_dandelion_LG"; localization2.AddTranslation(ref text, ref text2, "Dandelion"); PlantConfiguration plantConfiguration = new PlantConfiguration(); plantConfiguration.Name = "$piece_dandelion_LG"; plantConfiguration.IconItemDropPrefabName = "Dandelion"; plantConfiguration.PickablePrefabName = "Pickable_Dandelion"; plantConfiguration.PieceRecipe = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Dandelion", 1, 0, false), new RequirementConfig("Resin", 1, 0, false) }; plantConfiguration.Configure(); } } public static class Mushroom { public const string PieceName = "$piece_mushroom_LG"; public static void Configure() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown CustomLocalization localization = LootGoblinsHeimUtilsPlugin.Localization; string text = "Russian"; string text2 = "$piece_mushroom_LG"; localization.AddTranslation(ref text, ref text2, "Гриб"); CustomLocalization localization2 = LootGoblinsHeimUtilsPlugin.Localization; text = "English"; text2 = "$piece_mushroom_LG"; localization2.AddTranslation(ref text, ref text2, "Mushroom"); PlantConfiguration plantConfiguration = new PlantConfiguration(); plantConfiguration.Name = "$piece_mushroom_LG"; plantConfiguration.IconItemDropPrefabName = "Mushroom"; plantConfiguration.PickablePrefabName = "Pickable_Mushroom"; plantConfiguration.PieceRecipe = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Mushroom", 1, 0, false), new RequirementConfig("Resin", 2, 0, false) }; plantConfiguration.Configure(); } } public static class MushroomYellow { public const string PieceName = "$piece_mushroom_yellow_LG"; public static void Configure() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown CustomLocalization localization = LootGoblinsHeimUtilsPlugin.Localization; string text = "Russian"; string text2 = "$piece_mushroom_yellow_LG"; localization.AddTranslation(ref text, ref text2, "Желтый гриб"); CustomLocalization localization2 = LootGoblinsHeimUtilsPlugin.Localization; text = "English"; text2 = "$piece_mushroom_yellow_LG"; localization2.AddTranslation(ref text, ref text2, "Yellow Mushroom"); PlantConfiguration plantConfiguration = new PlantConfiguration(); plantConfiguration.Name = "$piece_mushroom_yellow_LG"; plantConfiguration.IconItemDropPrefabName = "MushroomYellow"; plantConfiguration.PickablePrefabName = "Pickable_Mushroom_yellow"; plantConfiguration.PieceRecipe = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("MushroomYellow", 1, 0, false), new RequirementConfig("BoneFragments", 1, 0, false) }; plantConfiguration.Configure(); } } public static class RaspberryBush { public static void Setup() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected O, but got Unknown //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown BushConfiguration bushConfiguration = new BushConfiguration(); bushConfiguration.Name = "Raspberry"; bushConfiguration.LocalizedBushName = "Малиновый куст"; bushConfiguration.ReadyObjectName = "Berrys"; bushConfiguration.FertilizerIcon = BushUtils.RaspberryBushIcon; bushConfiguration.NewBushModel = BushUtils.RaspberryBushModel; bushConfiguration.BushRequirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Raspberry", 5, 0, false), new RequirementConfig("Resin", 3, 0, false) }; bushConfiguration.FertilizerConfigs = new BushConfiguration.FertilizerConfig[2] { new BushConfiguration.FertilizerConfig { LocalizedName = "Удобрение для малины", LocalizedDescription = "Добавьте в малиновый куст, чтобы запустить процесс роста", AmountProduced = 5, RecipeRequirements = (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("Resin", 3, 0, false) } }, new BushConfiguration.FertilizerConfig { LocalizedName = "Удобрение для малины насыщенное", LocalizedDescription = "Добавьте в малиновый куст, чтобы запустить процесс роста. Увеличивает количество получаемого продукта", AmountProduced = 10, RecipeRequirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Resin", 3, 0, false), new RequirementConfig("BoneFragments", 1, 0, false) } } }; bushConfiguration.Configure(); } } public static class Saplings { public static void ReplaceRecipes() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Expected O, but got Unknown //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Expected O, but got Unknown //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Expected O, but got Unknown //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Expected O, but got Unknown //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Expected O, but got Unknown //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Expected O, but got Unknown //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Expected O, but got Unknown //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Expected O, but got Unknown //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Expected O, but got Unknown //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Expected O, but got Unknown //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Expected O, but got Unknown PlantRecipeSwapper.SwapPieceRecipe("sapling_carrot", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("CarrotSeeds", 1, 0, false), new RequirementConfig("BoneFragments", 1, 0, false) }); PlantRecipeSwapper.SwapPieceRecipe("sapling_seedcarrot", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Carrot", 1, 0, false), new RequirementConfig("BoneFragments", 1, 0, false) }); PlantRecipeSwapper.SwapPieceRecipe("sapling_turnip", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("TurnipSeeds", 1, 0, false), new RequirementConfig("BoneFragments", 1, 0, false) }); PlantRecipeSwapper.SwapPieceRecipe("sapling_seedturnip", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Turnip", 1, 0, false), new RequirementConfig("BoneFragments", 1, 0, false) }); PlantRecipeSwapper.SwapPieceRecipe("sapling_onion", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("OnionSeeds", 1, 0, false), new RequirementConfig("Entrails", 1, 0, false) }); PlantRecipeSwapper.SwapPieceRecipe("sapling_seedonion", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Onion", 1, 0, false), new RequirementConfig("Entrails", 1, 0, false) }); PlantRecipeSwapper.SwapPieceRecipe("sapling_barley", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Barley", 1, 0, false), new RequirementConfig("Ooze", 1, 0, false) }); PlantRecipeSwapper.SwapPieceRecipe("sapling_flax", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Flax", 1, 0, false), new RequirementConfig("Ooze", 1, 0, false) }); PlantRecipeSwapper.SwapPieceRecipe("Beech_Sapling", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("BeechSeeds", 1, 0, false), new RequirementConfig("LeatherScraps", 1, 0, false) }); PlantRecipeSwapper.SwapPieceRecipe("Birch_Sapling", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("BirchSeeds", 1, 0, false), new RequirementConfig("LeatherScraps", 1, 0, false) }); PlantRecipeSwapper.SwapPieceRecipe("Oak_Sapling", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Acorn", 1, 0, false), new RequirementConfig("LeatherScraps", 1, 0, false) }); PlantRecipeSwapper.SwapPieceRecipe("FirTree_Sapling", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("FirCone", 1, 0, false), new RequirementConfig("LeatherScraps", 1, 0, false) }); PlantRecipeSwapper.SwapPieceRecipe("PineTree_Sapling", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("PineCone", 1, 0, false), new RequirementConfig("LeatherScraps", 1, 0, false) }); Logger.LogInfo((object)"Saplings recipes replaced"); } } public static class ThistleBush { public static void Setup() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected O, but got Unknown //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown BushConfiguration bushConfiguration = new BushConfiguration(); bushConfiguration.Name = "Thistle"; bushConfiguration.LocalizedBushName = "Чертополох"; bushConfiguration.ReadyObjectName = "bees"; bushConfiguration.FertilizerIcon = BushUtils.thistleIcon; bushConfiguration.NewBushModel = BushUtils.thistleModel; bushConfiguration.BushRequirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("Thistle", 5, 0, false), new RequirementConfig("BoneFragments", 3, 0, false) }; bushConfiguration.FertilizerConfigs = new BushConfiguration.FertilizerConfig[2] { new BushConfiguration.FertilizerConfig { LocalizedName = "Удобрение для чертополоха", LocalizedDescription = "Добавьте в чертополох, чтобы запустить процесс роста", AmountProduced = 5, RecipeRequirements = (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("BoneFragments", 2, 0, false) } }, new BushConfiguration.FertilizerConfig { LocalizedName = "Удобрение для чертополоха насыщенное", LocalizedDescription = "Добавьте в чертополох, чтобы запустить процесс роста. Увеличивает количество получаемого продукта", AmountProduced = 10, RecipeRequirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("BoneFragments", 2, 0, false), new RequirementConfig("Entrails", 1, 0, false) } } }; bushConfiguration.Configure(); } } } namespace LootGoblinsUtils.Submods.Farming.Pieces.Stations { public static class FarmersTable { public const string TableName = "$piece_farmersTable_LG"; public const string PieceCategory = "$piececategory_farming"; public static void Configure() { try { InnerSetup(); Logger.LogInfo((object)"$piece_farmersTable_LG constructing completed"); } catch (Exception ex) { Logger.LogError((object)"$piece_farmersTable_LG constructing failed"); Logger.LogError((object)ex); } } private static void InnerSetup() { //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_0177: Unknown result type (might be due to invalid IL or missing references) CustomLocalization localization = LootGoblinsHeimUtilsPlugin.Localization; string text = "Russian"; string text2 = "$piece_farmersTable_LG"; localization.AddTranslation(ref text, ref text2, "Столик фермера"); CustomLocalization localization2 = LootGoblinsHeimUtilsPlugin.Localization; text = "English"; text2 = "$piece_farmersTable_LG"; localization2.AddTranslation(ref text, ref text2, "Farmers Table"); CustomLocalization localization3 = LootGoblinsHeimUtilsPlugin.Localization; text = "Russian"; text2 = "$piececategory_farming"; localization3.AddTranslation(ref text, ref text2, "Фермерство"); CustomLocalization localization4 = LootGoblinsHeimUtilsPlugin.Localization; text = "English"; text2 = "$piececategory_farming"; localization4.AddTranslation(ref text, ref text2, "Farming"); GameObject prefab = PrefabManager.Instance.GetPrefab("cauldron_ext5_mortarandpestle"); GameObject gameObject = ((Component)ExposedGameObjectExtension.FindDeepChild(prefab, "new", (IterativeSearchType)1)).gameObject; Sprite icon = prefab.GetComponent<Piece>().m_icon; PieceManager.Instance.AddPieceCategory(PieceTables.Hammer, "$piececategory_farming"); PieceConfig val = new PieceConfig(); val.Name = Localization.instance.Localize("$piece_farmersTable_LG"); val.PieceTable = PieceTables.Hammer; val.Category = Localization.instance.Localize("$piececategory_farming"); val.Icon = icon; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig("FineWood", 15, 0, true), new RequirementConfig("Bronze", 2, 0, true) }; PieceConfig val2 = val; CustomPiece val3 = new CustomPiece("$piece_farmersTable_LG", CraftingStations.Workbench, val2); GameObject val4 = Object.Instantiate<GameObject>(gameObject, val3.PiecePrefab.transform); val4.transform.localScale = new Vector3(1.8f, 1.8f, 1.3f); WearNTear component = val3.PiecePrefab.GetComponent<WearNTear>(); component.m_broken = val4; component.m_new = val4; component.m_worn = val4; Object.Destroy((Object)(object)((Component)ExposedGameObjectExtension.FindDeepChild(val3.PiecePrefab, "New", (IterativeSearchType)1)).gameObject); Object.Destroy((Object)(object)((Component)ExposedGameObjectExtension.FindDeepChild(val3.PiecePrefab, "Worn", (IterativeSearchType)1)).gameObject); Object.Destroy((Object)(object)((Component)ExposedGameObjectExtension.FindDeepChild(val3.PiecePrefab, "Broken", (IterativeSearchType)1)).gameObject); CraftingStation component2 = val3.PiecePrefab.GetComponent<CraftingStation>(); component2.m_name = "$piece_farmersTable_LG"; component2.m_showBasicRecipies = false; PieceManager.Instance.AddPiece(val3); } } public static class FarmersTableExtensionT1 { public const string TableName = "$piece_farmersTable_ext1_LG"; public const string TableDescription = "$piece_farmersTable_ext1_description_LG"; public const string PieceCategory = "$piececategory_farming"; public static void Configure() { try { InnerSetup(); Logger.LogInfo((object)"$piece_farmersTable_ext1_LG constructing completed"); } catch (Exception ex) { Logger.LogError((object)"$piece_farmersTable_ext1_LG constructing failed"); Logger.LogError((object)ex); } } private static void InnerSetup() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown CustomLocalization localization = LootGoblinsHeimUtilsPlugin.Localization; string text = "Russian"; string text2 = "$piece_farmersTable_ext1_LG"; localization.AddTranslation(ref text, ref text2, "Фермерская сушилка для трав"); CustomLocalization localization2 = LootGoblinsHeimUtilsPlugin.Localization; text = "English"; text2 = "$piece_farmersTable_ext1_LG"; localization2.AddTranslation(ref text, ref text2, "Farmer's Spice Rack"); CustomLocalization localization3 = LootGoblinsHeimUtilsPlugin.Localization; text = "Russian"; text2 = "$piece_farmersTable_ext1_description_LG"; localization3.AddTranslation(ref text, ref text2, "Улучшение столика фермера"); CustomLocalization localization4 = LootGoblinsHeimUtilsPlugin.Localization; text = "English"; text2 = "$piece_farmersTable_ext1_description_LG"; localization4.AddTranslation(ref text, ref text2, "Farmer's Table improvement"); PieceConfig val = new PieceConfig(); val.Name = Localization.instance.Localize("$piece_farmersTable_ext1_LG"); val.Description = Localization.instance.Localize("$piece_farmersTable_ext1_description_LG"); val.PieceTable = PieceTables.Hammer; val.Category = Localization.instance.Localize("$piececategory_farming"); val.Requirements = (RequirementConfig[])(object)new RequirementConfig[5] { new RequirementConfig("Dandelion", 10, 0, true), new RequirementConfig("Carrot", 5, 0, true), new RequirementConfig("Mushroom", 5, 0, true), new RequirementConfig("Thistle", 5, 0, true), new RequirementConfig("Turnip", 3, 0, true) }; PieceConfig val2 = val; CustomPiece val3 = new CustomPiece("$piece_farmersTable_ext1_LG", "cauldron_ext1_spice", val2); val3.PiecePrefab.GetComponent<StationExtension>().m_craftingStation = PieceManager.Instance.GetPiece("$piece_farmersTable_LG").PiecePrefab.GetComponent<CraftingStation>(); PieceManager.Instance.AddPiece(val3); } } } namespace LootGoblinsUtils.Submods.Farming.Pieces.Configurators { public class BushConfiguration : Configurable { public struct FertilizerConfig { public string LocalizedName; public string LocalizedDescription; public RequirementConfig[] RecipeRequirements; public int AmountProduced; } public string LocalizedBushName; public string ReadyObjectName; public float ColliderRadius; public Sprite FertilizerIcon; public RequirementConfig[] BushRequirements; public GameObject NewBushModel; public FertilizerConfig[] FertilizerConfigs; private string BushName => "piece_" + Name + "Bush_LG"; private string FertilizerTierName(int tier) { return $"{Name}FertilizerT{tier}_LG"; } protected override void Setup() { CustomPiece val = MakeNewPiece(); Transform targetParentTransform = BushUtils.CleanupModel(val); Logger.LogInfo((object)(BushName + " CleanupModel complete")); GameObject val2 = BushUtils.SetupNewModel(NewBushModel, targetParentTransform); Logger.LogInfo((object)(BushName + " SetupNewModel complete")); CapsuleCollider obj = val2.GetComponent<CapsuleCollider>() ?? val2.AddComponent<CapsuleCollider>(); obj.radius = ((ColliderRadius == 0f) ? 1.6f : ColliderRadius); ((Collider)obj).isTrigger = true; Transform obj2 = ExposedGameObjectExtension.FindDeepChild(val2, ReadyObjectName, (IterativeSearchType)1); GameObject val3 = ((obj2 != null) ? ((Component)obj2).gameObject : null); if ((Object)(object)val3 == (Object)null) { Logger.LogWarning((object)(BushName + ".readyObject == null")); } else { val3.SetActive(false); } BushUtils.ConfigureFermenter(val.PiecePrefab.GetComponent<Fermenter>(), val3); PieceManager.Instance.AddPiece(val); MakeFertilizers(); } private CustomPiece MakeNewPiece() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown PieceConfig val = new PieceConfig { Name = LocalizedBushName, PieceTable = PieceTables.Cultivator, Category = PieceCategories.Misc, Icon = FertilizerIcon, Requirements = BushRequirements }; CustomPiece val2 = new CustomPiece(BushName, Fermenters.Fermenter, val); val2.Piece.m_craftingStation = null; val2.Piece.m_cultivatedGroundOnly = true; val2.Piece.m_groundOnly = true; val2.Piece.m_noClipping = false; Logger.LogInfo((object)(BushName + " newPiece setup complete")); return val2; } private void MakeFertilizers() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown for (int i = 0; i < FertilizerConfigs.Length; i++) { FertilizerConfig fertilizerConfig = FertilizerConfigs[i]; BushUtils.MakeFertilizer(fertilizerConfig.LocalizedName, FertilizerTierName(i + 1), fertilizerConfig.LocalizedDescription, fertilizerConfig.RecipeRequirements, i + 1); FermenterConversionConfig val = new FermenterConversionConfig { ToItem = Name, FromItem = FertilizerTierName(i + 1), Station = BushName, ProducedItems = fertilizerConfig.AmountProduced }; ItemManager.Instance.AddItemConversion(new CustomItemConversion((ConversionConfig)(object)val)); } } } public static class BushUtils { public struct VisualsGroup { public GameObject Prefab; public GameObject Model; public Sprite Icon; public VisualsGroup(string prefabName, string modelChildName) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) Prefab = PrefabManager.Instance.GetPrefab(prefabName); if ((Object)(object)Prefab == (Object)null) { Logger.LogWarning((object)("VisualsGroup.prefab[" + prefabName + "] is null")); } Model = ((Component)ExposedGameObjectExtension.FindDeepChild(Prefab, modelChildName, (IterativeSearchType)1)).gameObject; if ((Object)(object)Model == (Object)null) { Logger.LogWarning((object)("VisualsGroup.Model[" + modelChildName + " is null")); } Icon = RenderManager.Instance.Render(Prefab, RenderManager.IsometricRotation); if ((Object)(object)Icon == (Object)null) { Logger.LogWarning((object)("VisualsGroup.Icon[" + prefabName + " is null")); } } } private static GameObject _raspberryBushPrefab; public static GameObject RaspberryBushModel; public static Sprite RaspberryBushIcon; private static GameObject _blueberryBushPrefab; public static GameObject BlueberryBushModel; public static Sprite BlueberryBushIcon; public static VisualsGroup CloudberryVisuals; private static GameObject _thistlePrefab; public static GameObject thistleModel; public static Sprite thistleIcon; public static Sprite MeadIcon; public static void CacheDependencies() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) _raspberryBushPrefab = PrefabManager.Instance.GetPrefab("RaspberryBush"); RaspberryBushModel = ((Component)ExposedGameObjectExtension.FindDeepChild(_raspberryBushPrefab, "model", (IterativeSearchType)1)).gameObject; RaspberryBushIcon = RenderManager.Instance.Render(_raspberryBushPrefab, RenderManager.IsometricRotation); _blueberryBushPrefab = PrefabManager.Instance.GetPrefab("BlueberryBush"); BlueberryBushModel = ((Component)ExposedGameObjectExtension.FindDeepChild(_blueberryBushPrefab, "model", (IterativeSearchType)1)).gameObject; BlueberryBushIcon = RenderManager.Instance.Render(_blueberryBushPrefab, RenderManager.IsometricRotation); CloudberryVisuals = new VisualsGroup("CloudberryBush", "high"); ExposedGameObjectExtension.FindDeepChild(CloudberryVisuals.Prefab, "Berrys", (IterativeSearchType)1).parent = CloudberryVisuals.Model.transform; _thistlePrefab = PrefabManager.Instance.GetPrefab("Pickable_Thistle"); thistleModel = ((Component)ExposedGameObjectExtension.FindDeepChild(_thistlePrefab, "visual", (IterativeSearchType)1)).gameObject; thistleIcon = RenderManager.Instance.Render(_thistlePrefab, RenderManager.IsometricRotation); MeadIcon = PrefabManager.Instance.GetPrefab("MeadBaseTasty").GetComponent<ItemDrop>().m_itemData.GetIcon(); } public static GameObject SetupNewModel(GameObject targetModel, Transform targetParentTransform) { GameObject obj = Object.Instantiate<GameObject>(targetModel, targetParentTransform); obj.layer = LayerMask.NameToLayer("Default_small"); return obj; } public static Transform CleanupModel(CustomPiece newPiece) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) Transform val = ExposedGameObjectExtension.FindDeepChild(newPiece.PiecePrefab, "barrel", (IterativeSearchType)1); ((Component)val).gameObject.SetActive(false); Object.Destroy((Object)(object)((Component)((Component)ExposedGameObjectExtension.FindDeepChild(newPiece.PiecePrefab, "_top", (IterativeSearchType)1)).transform.GetChild(0)).gameObject); foreach (Transform item in ExposedGameObjectExtension.FindDeepChild(newPiece.PiecePrefab, "_fermenting", (IterativeSearchType)1)) { Object.Destroy((Object)(object)((Component)item).gameObject); } foreach (Transform item2 in ExposedGameObjectExtension.FindDeepChild(newPiece.PiecePrefab, "_ready", (IterativeSearchType)1)) { Object.Destroy((Object)(object)((Component)item2).gameObject); } return val.parent; } public static void ConfigureFermenter(Fermenter fermenterComponent, [CanBeNull] GameObject readyObject) { fermenterComponent.m_conversion.Clear(); fermenterComponent.m_fermentationDuration = PluginConfiguration.FertilizingDuration.Value; fermenterComponent.m_addedEffects = fermenterComponent.m_spawnEffects; fermenterComponent.m_tapEffects.m_effectPrefabs = Array.Empty<EffectData>(); fermenterComponent.m_tapDelay = 0.1f; fermenterComponent.m_readyObject = readyObject; } public static void MakeFertilizer(string localizedName, string itemName, string description, RequirementConfig[] requirements, int minStationLevel) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown ItemConfig val = new ItemConfig(); val.Name = localizedName; val.Description = description; val.CraftingStation = "$piece_farmersTable_LG"; val.MinStationLevel = minStationLevel; val.Icons = (Sprite[])(object)new Sprite[1] { MeadIcon }; ItemConfig val2 = val; val2.Requirements = requirements; CustomItem val3 = new CustomItem(itemName, "Stone", val2); Object.Destroy((Object)(object)((Component)val3.ItemPrefab.transform.GetChild(0)).gameObject); Object.Instantiate<GameObject>(((Component)PrefabManager.Instance.GetPrefab("MeadBaseTasty").transform.GetChild(0)).gameObject, val3.ItemPrefab.transform); ItemManager.Instance.AddItem(val3); } } public abstract class Configurable { public string Name; public void Configure() { try { Setup(); Logger.LogInfo((object)(Name + " constructing completed")); } catch (Exception ex) { Logger.LogError((object)(Name + " constructing failed")); Logger.LogError((object)ex); } } protected abstract void Setup(); } public class PlantConfiguration : Configurable { public string IconItemDropPrefabName; public RequirementConfig[] PieceRecipe; public string PickablePrefabName; protected override void Setup() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0065: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) Sprite icon = PrefabManager.Instance.GetPrefab(IconItemDropPrefabName).GetComponent<ItemDrop>().m_itemData.GetIcon(); PieceConfig val = new PieceConfig { Name = Localization.instance.Localize(Name), PieceTable = PieceTables.Cultivator, Category = PieceCategories.Misc, Icon = icon, Requirements = PieceRecipe }; CustomPiece val2 = new CustomPiece(Name, "sapling_onion", val); GameObject val3 = PrefabManager.Instance.CreateClonedPrefab(PickablePrefabName + "_LG", PickablePrefabName); Transform child = val3.transform.GetChild(0); val3.GetComponent<Pickable>().m_amount = 5; Plant component = val2.PiecePrefab.GetComponent<Plant>(); component.m_minScale = 1.2f; component.m_maxScale = 1.7f; component.m_growTime = PluginConfiguration.PlantGrowMinDuration.Value; component.m_growTimeMax = PluginConfiguration.PlantGrowMaxDuration.Value; component.m_name = Localization.instance.Localize(Name); component.m_grownPrefabs = (GameObject[])(object)new GameObject[1] { val3 }; foreach (Transform item in val2.PiecePrefab.transform) { Object.Destroy((Object)(object)((Component)item).gameObject); } GameObject gameObject = ((Component)Object.Instantiate<Transform>(child, val2.PiecePrefab.transform)).gameObject; ((Object)gameObject).name = "healthy"; gameObject.transform.localScale = Vector3.one * 0.5f; GameObject gameObject2 = ((Component)Object.Instantiate<Transform>(child, val2.PiecePrefab.transform)).gameObject; ((Object)gameObject2).name = "unhealthy"; gameObject2.transform.localScale = Vector3.one * 0.5f; GameObject gameObject3 = ((Component)Object.Instantiate<Transform>(child, val2.PiecePrefab.transform)).gameObject; ((Object)gameObject3).name = "healthyGrown"; GameObject gameObject4 = ((Component)Object.Instantiate<Transform>(child, val2.PiecePrefab.transform)).gameObject; ((Object)gameObject4).name = "unhealthyGrown"; component.m_healthy = gameObject; component.m_unhealthy = gameObject2; component.m_healthyGrown = gameObject3; component.m_unhealthyGrown = gameObject4; PieceManager.Instance.AddPiece(val2); } } public static class PlantRecipeSwapper { public static void SwapPieceRecipe(string prefabName, RequirementConfig[] requirementConfigs) { Piece component = PrefabManager.Instance.GetPrefab(prefabName).GetComponent<Piece>(); Requirement[] array = requirementConfigs.Select((RequirementConfig req) => req.GetRequirement()).ToArray(); Requirement[] array2 = array; for (int i = 0; i < array2.Length; i++) { PrefabExtension.FixReferences((object)array2[i]); } component.m_resources = array.ToArray(); } } } namespace LootGoblinsUtils.Conquest { public static class ConquestFeature { public static void Load() { ItemsLoader.Init(); PiecesLoader.Init(); LocationLoader.Init(); CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new CoresList()); } } } namespace LootGoblinsUtils.Conquest.TerminalCommands { public class CoresList : ConsoleCommand { public override string Name => "core_list"; public override string Help => "List cores nearby"; public override void Run(string[] args) { try { foreach (KeyValuePair<ConquestCore, float> item in from kvp in Object.FindObjectsOfType<ConquestCore>().ToDictionary((ConquestCore x) => x, delegate(ConquestCore x) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)x).transform.position - ((Component)Player.m_localPlayer).transform.position; return ((Vector3)(ref val)).magnitude; }) orderby kvp.Value descending select kvp) { Console.instance.Print($"Core[{((Object)item.Key).GetInstanceID()}]: {item.Value}"); } } catch (Exception ex) { Console.instance.Print(ex.ToString()); throw; } } } } namespace LootGoblinsUtils.Conquest.Pieces { public static class PiecesLoader { public static void Init() { PrefabManager.OnVanillaPrefabsAvailable += LoadAll; } private static void LoadAll() { CorePiece.Load(); GhostCoreBoar.Load(); GhostCoreNeck.Load(); DefenderTotemPiece.Load(); PrefabManager.OnVanillaPrefabsAvailable -= LoadAll; } } } namespace LootGoblinsUtils.Conquest.Pieces.Ghost { public class ConquestGhost : SlowMono { public enum States { CoreExists, CoreDestroyed, DefenderExists, DefenderProtected } public Location location; private States _state; private States _prevState; private DefendersSpawner _spawnerRaid; private DefendersSpawner _spawnerT1; private bool _coreExists; private bool _defenderExists; private Piece _defender; private ZNetView _nview; private float _awakeTime; private float _defenderSetupTime; private static float DefenderRaidTime => PluginConfiguration.Conquest.DefenderRaidTime.Value; private static float NoBuildRadius => PluginConfiguration.Conquest.PlayerAlertRadius.Value; private void Awake() { DefendersSpawner[] components = ((Component)this).GetComponents<DefendersSpawner>(); _spawnerRaid = components.FirstOrDefault((DefendersSpawner x) => x.SpawnerType == DefendersSpawner.SpawnerTypes.Raid); SetRaidSpawnerParams(componentEnabled: false, null); _spawnerT1 = components.FirstOrDefault((DefendersSpawner x) => x.SpawnerType == DefendersSpawner.SpawnerTypes.Common); SetCommonSpawnerParams(componentEnabled: false, null); UpdateStep = 3f; _awakeTime = Time.time; location = ((IEnumerable<Location>)Location.m_allLocations).FirstOrDefault((Func<Location, bool>)((Location x) => Vector3.Distance(((Component)this).transform.position, ((Component)x).transform.position) < 20f)); if ((Object)(object)location != (Object)null) { location.m_noBuild = true; location.m_noBuildRadiusOverride = NoBuildRadius; } } private void Start() { _nview = ((Component)this).GetComponent<ZNetView>(); if ((Object)(object)_nview != (Object)null && _nview.IsValid()) { if (_nview.GetZDO().GetBool("GhostDisabled", false)) { ((Component)this).gameObject.SetActive(false); ((Behaviour)this).enabled = false; } _state = (States)_nview.GetZDO().GetInt("ghost_state", 0); Logger.LogInfo((object)$"Ghost[{((Object)this).GetInstanceID()}]: Loaded state {_state}"); } } public override void SlowUpdate() { if (!(Time.time - _awakeTime < 5f)) { location = ((IEnumerable<Location>)Location.m_allLocations).FirstOrDefault((Func<Location, bool>)((Location x) => Vector3.Distance(((Component)this).transform.position, ((Component)x).transform.position) < 20f)); UpdateState(); ProcessStates(); } } private void UpdateState() { SearchCore(); SearchDefenderTotem(); switch (_state) { case States.CoreExists: if (!_coreExists) { SetState(States.CoreDestroyed); } break; case States.CoreDestroyed: if (_defenderExists) { MessageHud.instance.ShowMessage((MessageType)2, "Защищайте тотем!", 0, (Sprite)null); _defenderSetupTime = Time.time; SetState(States.DefenderExists); } break; case States.DefenderExists: if (!_defenderExists) { MessageHud.instance.ShowMessage((MessageType)2, "Тотем уничтожен! Защитник восстановлен!", 0, (Sprite)null); RestoreCore(); } else if (Time.time - _defenderSetupTime >= DefenderRaidTime) { MessageHud.instance.ShowMessage((MessageType)2, "Область захвачена!", 0, (Sprite)null); SetState(States.DefenderProtected); } break; case States.DefenderProtected: if (!_defenderExists) { MessageHud.instance.ShowMessage((MessageType)2, "Тотем уничтожен! Защитник восстановлен!", 0, (Sprite)null); RestoreCore(); } break; } } private void RestoreCore() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) location.m_noBuild = false; location.m_noBuildRadiusOverride = 0f; ((Component)this).gameObject.SetActive(false); ((Behaviour)this).enabled = false; _nview.GetZDO().Set("GhostDisabled", true); ZNetScene.instance.Destroy(((Component)((Component)location).transform.parent).gameObject); ZoneLocation randomT1CoreLocation = LocationLoader.GetRandomT1CoreLocation(); ZoneSystem.instance.SpawnLocation(randomT1CoreLocation, 0, ((Component)this).transform.position, Quaternion.identity, (SpawnMode)0, new List<GameObject>()); } private void ProcessStates() { switch (_state) { case States.CoreExists: SetCommonSpawnerParams(componentEnabled: true, null); SetRaidSpawnerParams(componentEnabled: false, null); location.m_noBuild = true; location.m_noBuildRadiusOverride = NoBuildRadius; break; case States.CoreDestroyed: SetCommonSpawnerParams(componentEnabled: true, null); SetRaidSpawnerParams(componentEnabled: false, null); location.m_noBuild = false; location.m_noBuildRadiusOverride = 0f; break; case States.DefenderExists: SetCommonSpawnerParams(componentEnabled: true, (StaticTarget)(object)_defender); SetRaidSpawnerParams(componentEnabled: true, (StaticTarget)(object)_defender); location.m_noBuild = false; location.m_noBuildRadiusOverride = 0f; if (Time.time - _defenderSetupTime < DefenderRaidTime) { MessageHud.instance.ShowMessage((MessageType)1, $"Осталось: {Math.Round(DefenderRaidTime - (Time.time - _defenderSetupTime), 2)}", 0, (Sprite)null); } break; case States.DefenderProtected: SetCommonSpawnerParams(componentEnabled: false, null); SetRaidSpawnerParams(componentEnabled: false, null); location.m_noBuild = false; location.m_noBuildRadiusOverride = 0f; break; } } private void SearchCore() { _coreExists = ConquestCore.ActiveCores.Any((ConquestCore x) => Vector3.Distance(((Component)this).transform.position, ((Component)x).transform.position) < 20f); } private void SearchDefenderTotem() { DefenderTotemComponent? defenderTotemComponent = DefenderTotemComponent.ActiveTotems.FirstOrDefault((DefenderTotemComponent x) => Vector3.Distance(((Component)this).transform.position, ((Component)x).transform.position) < 20f); _defender = ((defenderTotemComponent != null) ? ((Component)defenderTotemComponent).GetComponent<Piece>() : null); _defenderExists = (Object)(object)_defender != (Object)null; } private void SetState(States state) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (state != _state) { Logger.LogInfo((object)$"Ghost[{Vector3.Distance(((Component)this).transform.position, ((Component)Player.m_localPlayer).transform.position)}]: {_state} => {state}"); if (_nview.IsValid() && _nview.IsOwner()) { _nview.GetZDO().Set("ghost_state", (int)state); } } _prevState = _state; _state = state; } private void SetCommonSpawnerParams(bool componentEnabled, StaticTarget forceTargetStatic) { if ((Object)(object)_spawnerT1 != (Object)null) { ((Behaviour)_spawnerT1).enabled = componentEnabled; _spawnerT1.forcedStaticTarget = forceTargetStatic; } } private void SetRaidSpawnerParams(bool componentEnabled, StaticTarget forceTargetStatic) { if ((Object)(object)_spawnerRaid != (Object)null) { ((Behaviour)_spawnerRaid).enabled = componentEnabled; _spawnerRaid.forcedStaticTarget = forceTargetStatic; } } } public static class GhostCoreBoar { public static void Load() { Loader.RunSafe(InnerSetup, "GhostCoreBoar", "Load"); } private static void InnerSetup() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown PieceConfig val = new PieceConfig(); val.Name = "GhostCoreBoar"; val.PieceTable = "_BlueprintPieceTable"; val.Category = "utils"; val.CraftingStation = CraftingStations.None; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("LGH_GreenCore", 1, 0, true) }; PieceConfig val2 = val; CustomPiece val3 = new CustomPiece("GhostCoreBoar", "stone_wall_1x1", val2); val3.SetWntSupport(support: false).SetPieceHealth(20000f).RemoveColliders() .RemoveRenderers(); val3.PiecePrefab.AddComponent<ConquestGhost>(); ((Behaviour)val3.PiecePrefab.AddComponent<SpawnerBoarsRaid>()).enabled = false; ((Behaviour)val3.PiecePrefab.AddComponent<SpawnerBoarsT1>()).enabled = false; PieceManager.Instance.AddPiece(val3); } } public static class GhostCoreNeck { public static void Load() { Loader.RunSafe(InnerSetup, "GhostCoreNeck", "Load"); } private static void InnerSetup() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown PieceConfig val = new PieceConfig(); val.Name = "GhostCoreNeck"; val.PieceTable = "_BlueprintPieceTable"; val.Category = "utils"; val.CraftingStation = CraftingStations.None; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("LGH_GreenCore", 1, 0, true) }; PieceConfig val2 = val; CustomPiece val3 = new CustomPiece("GhostCoreNeck", "stone_wall_1x1", val2); val3.SetWntSupport(support: false).SetPieceHealth(20000f).RemoveColliders() .RemoveRenderers(); val3.PiecePrefab.AddComponent<ConquestGhost>(); ((Behaviour)val3.PiecePrefab.AddComponent<SpawnerNeckRaid>()).enabled = false; ((Behaviour)val3.PiecePrefab.AddComponent<SpawnerNeckT1>()).enabled = false; PieceManager.Instance.AddPiece(val3); } } } namespace LootGoblinsUtils.Conquest.Pieces.DefenderTotem { public class DefenderTotemComponent : SlowMono { public static readonly List<DefenderTotemComponent> ActiveTotems = new List<DefenderTotemComponent>(); private ZNetView _netView; private bool isPlaced; private void Awake() { UpdateStep = 1f; } private void Start() { _netView = ((Component)this).GetComponent<ZNetView>(); if ((Object)(object)_netView != (Object)null && _netView.IsValid()) { isPlaced = _netView.GetZDO().GetBool("isPlaced", false); } } private void OnDisable() { ActiveTotems.Remove(this); } private void OnDestroy() { ActiveTotems.Remove(this); } public override void SlowUpdate() { if (!((Component)this).gameObject.PiecePlaced() || ActiveTotems.Contains(this)) { return; } ActiveTotems.Add(this); if (isPlaced) { return; } isPlaced = true; if ((Object)(object)_netView != (Object)null && _netView.IsValid()) { _netView.GetZDO().Set("isPlaced", true); } foreach (WearNTear item in WearNTear.s_allInstances.Where((WearNTear wnt) => (Object)(object)((Component)wnt).gameObject != (Object)(object)((Component)this).gameObject && (Object)(object)((Component)wnt).GetComponent<ConquestGhost>() == (Object)null && Vector3.Distance(((Component)wnt).transform.position, ((Component)this).transform.position) < 20f)) { item.m_piece.m_resources = Array.Empty<Requirement>(); item.Destroy(); } } } public static class DefenderTotemPiece { public static void Load() { Loader.RunSafe(InnerLoad, "DefenderTotemPiece", "Load"); } private static void InnerLoad() { //IL_003c: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) GameObject obj = PrefabManager.Instance.CreateClonedPrefab("guard_stone_tmp", "guard_stone"); GameObject gameObject = ((Component)obj.transform.Find("new").GetChild(0)).gameObject; Sprite icon = obj.GetComponent<Piece>().m_icon; gameObject.AddLightningEffect(Vector3.one * 2f); PieceConfig val = new PieceConfig(); val.Name = "Защитный Тотем"; val.PieceTable = PieceTables.Hammer; val.Category = PieceCategories.Misc; val.CraftingStation = CraftingStations.Workbench; val.Icon = icon; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[5] { new RequirementConfig("Wood", 20, 0, true), new RequirementConfig("TrophyBoar", 5, 0, false), new RequirementConfig("TrophyNeck", 5, 0, false), new RequirementConfig("TrophyDeer", 5, 0, false), new RequirementConfig("Resin", 15, 0, true) }; PieceConfig val2 = val; CustomPiece val3 = new CustomPiece("DefenderTotem", "stone_pillar", val2); val3.ReplaceWntModel(gameObject, Vector3.one * 2f, new Vector3(0f, -1f, 0f)).SetPieceHealth(350f); val3.PiecePrefab.AddComponent<DefenderTotemComponent>(); PieceManager.Instance.AddPiece(val3); } } } namespace LootGoblinsUtils.Conquest.Pieces.Core { public class ConquestCore : SlowMono { public static readonly List<ConquestCore> ActiveCores = new List<ConquestCore>(); private void Awake() { UpdateStep = 1f; if (((Component)this).gameObject.PiecePlaced() && !ActiveCores.Contains(this)) { ActiveCores.Add(this); } } private void Start() { if (((Component)this).gameObject.PiecePlaced() && !ActiveCores.Contains(this)) { ActiveCores.Add(this); } } private void OnDisable() { ActiveCores.Remove(this); } private void OnDestroy() { ActiveCores.Remove(this); } public override void SlowUpdate() { if (((Component)this).gameObject.PiecePlaced() && !ActiveCores.Contains(this)) { ActiveCores.Add(this); } } } public static class CorePiece { public static void Load() { Loader.RunSafe(InnerSetup, "CorePiece", "Load"); } private static void InnerSetup() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) GameObject prefab = PrefabManager.Instance.GetPrefab("SurtlingCore"); GameObject gameObject = ((Component)prefab.transform.GetChild(0)).gameObject; PieceConfig val = new PieceConfig(); val.Name = "ConquestCore"; val.PieceTable = "_BlueprintPieceTable"; val.Category = "utils"; val.CraftingStation = null; val.Icon = RenderManager.Instance.Render(prefab); val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig("LGH_GreenCore", 1, 0, true) }; PieceConfig val2 = val; CustomPiece val3 = new CustomPiece("ConquestCore", "stone_wall_1x1", val2); val3.ReplaceWntModel(gameObject, new Vector3(5f, 5f, 5f)).SetWntSupport(support: false).SetPieceHealth(200f); val3.PiecePrefab.AddComponent<ConquestCore>(); PieceManager.Instance.AddPiece(val3); } } } namespace LootGoblinsUtils.Conquest.Locations { public static class LocationLoader { public static string[] PossibleT1Cores = new string[2] { "T1_Core_Boars", "T1_Core_Necks" }; public static ZoneLocation GetRandomT1CoreLocation() { CustomLocation customLocation = ZoneManager.Instance.GetCustomLocation(PossibleT1Cores[Random.Range(0, PossibleT1Cores.Length)]); if (customLocation == null) { return null; } return customLocation.ZoneLocation; } public static void Init() { LocationPatches.Patch(); ZoneManager.OnVanillaLocationsAvailable += Load; } private static void Load() { T1CoreBoars.Load(); T1CoreNecks.Load(); ZoneManager.OnVanillaLocationsAvailable -= Load; } } public static class LocationPatches { public static void Patch() { ZoneManager.OnVanillaLocationsAvailable += VanillaLocations; } private static void VanillaLocations() { PatchEikthyrnir(); ZoneManager.OnVanillaLocationsAvailable -= VanillaLocations; } private static void PatchEikthyrnir() { ZoneManager.Instance.GetZoneLocation("Eikthyrnir").m_minDistance = 900f; } } } namespace LootGoblinsUtils.Conquest.Locations.T1CoresLoaders { public static class T1CoreBoars { public static void Load() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown GameObject val = ZoneManager.Instance.CreateLocationContainer("T1_Core_Boars"); Blueprints.RavenBP.Instantiate(val.transform); Object.Instantiate<GameObject>(PieceManager.Instance.GetPiece("GhostCoreBoar").PiecePrefab, val.transform).transform.localPosition = Vector3.zero; LocationConfig val2 = new LocationConfig { Biome = (Biome)1, Quantity = 100, Priotized = true, ExteriorRadius = 20f, MinDistance = 200f, MinDistanceFromSimilar = 100f, Group = "T1_Cores", ClearArea = true }; CustomLocation val3 = new CustomLocation(val, false, val2); ZoneManager.Instance.AddCustomLocation(val3); val3.Location.m_noBuild = false; val3.Location.m_noBuildRadiusOverride = 0f; Logger.LogInfo((object)"Location T1_Core_Boars Loaded"); } } public static class T1CoreNecks { public static void Load() { //IL_0045: 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_006b: 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_007a: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown GameObject val = ZoneManager.Instance.CreateLocationContainer("T1_Core_Necks"); Blueprints.RavenBP.Instantiate(val.transform); GameObject obj = Object.Instantiate<GameObject>(PieceManager.Instance.GetPiece("GhostCoreNeck").PiecePrefab, val.transform); obj.transform.localPosition = Vector3.zero; ((Behaviour)obj.AddComponent<SpawnerNeckT1>()).enabled = false; ((Behaviour)obj.AddComponent<SpawnerNeckRaid>()).enabled = false; LocationConfig val2 = new LocationConfig { Biome = (Biome)1, Quantity = 100, Priotized = true, ExteriorRadius = 20f, MinDistance = 200f, MinDistanceFromSimilar = 100f, Group = "T1_Cores", ClearArea = true }; CustomLocation val3 = new CustomLocation(val, false, val2); ZoneManager.Instance.AddCustomLocation(val3); val3.Location.m_noBuild = false; val3.Location.m_noBuildRadiusOverride = 0f; Logger.LogInfo((object)"Location T1_Core_Necks Loaded"); } } } namespace LootGoblinsUtils.Conquest.Items { public static class GreenCore { public static void Load() { //IL_0016: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) GameObject val = PrefabManager.Instance.CreateClonedPrefab("LGH_GreenCore2", "BlackCore"); val.SetRendererColor(Color.green); Sprite val2 = RenderManager.Instance.Render(new RenderRequest(val) { Height = 64, Width = 64 }); ItemConfig val3 = new ItemConfig(); val3.Name = "Зелёное ядро защитника"; val3.Description = "Источник энергии ядер защиты мира Вальхейм. Используйте, чтобы сразиться с хранителем биома"; val3.Icons = (Sprite[])(object)new Sprite[1] { val2 }; val3.CraftingStation = CraftingStations.None; ItemConfig val4 = val3; CustomItem val5 = new CustomItem("LGH_GreenCore", "BlackCore", val4); val5.ItemPrefab.SetRendererColor(Color.green); Transform child = val5.ItemPrefab.transform.GetChild(0); child.localScale *= 2f; val5.ItemDrop.m_itemData.m_shared.m_weight = 25f; ItemManager.Instance.AddItem(val5); } } public static class ItemsLoader { public static void Init() { PrefabManager.OnVanillaPrefabsAvailable += Load; } private static void Load() { GreenCore.Load(); PrefabManager.OnVanillaPrefabsAvailable -= Load; } } } namespace LootGoblinsUtils.Conquest.Creatures { public static class CreatureDB { public static void Init() { CreatureManager.OnVanillaCreaturesAvailable += Load; } private static void Load() { StormBoar.Load(); StormHog.Load(); NeckShaman.Load(); NeckDragon.Load(); CreatureManager.OnVanillaCreaturesAvailable -= Load; } } public static class ExplorerHelpers { public static void AttackSharedData() { JsonUtility.ToJson((object)GameObject.Find("LG_StormBoar(Clone)").GetComponent<Humanoid>().m_defaultItems[0].GetComponent<ItemDrop>().m_itemData.m_shared); } } public static class FinePrefabs { public static GameObject FireExplosionProjectile => PrefabManager.Instance.GetPrefab("staff_fireball_projectile"); public static GameObject LightningUnitEffectCloned => ((Component)PrefabManager.Instance.CreateClonedPrefab("LG_fx_lightning", "fx_Lightning").transform.Find("Sparcs")).gameObject; public static AttackInfo EikthyrCharge => new AttackInfo("Eikthyr_charge"); public static AttackInfo ShamanFireball => new AttackInfo("GoblinShaman_attack_fireball"); public static AttackInfo GdkingShoot => new AttackInfo("gd_king_shoot"); } public class NeckDragon { public static void Load() { Loader.RunSafe(InnerLoad, "DragonNeck", "Load"); } private static void InnerLoad() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) CreatureConfig val = new CreatureConfig(); CustomCreature val2 = new CustomCreature("LG_DragonNeck", "Neck", val); GameObject prefab = val2.Prefab; Transform transform = prefab.transform; transform.localScale *= 3f; Humanoid component = prefab.GetComponent<Humanoid>(); ((Character)component).m_name = "Никс-дракон"; ((Character)component).m_health = 250f; float num = 0.7f; ((Character)component).m_speed = ((Character)component).m_speed * num; ((Character)component).m_turnSpeed = ((Character)component).m_turnSpeed * num; ((Character)component).m_runSpeed = ((Character)component).m_runSpeed * num; ((Character)component).m_runTurnSpeed = ((Character)component).m_runTurnSpeed * num; AttackInfo attackInfo = AttackInfo.FromCharacterAttack(val2.Prefab, 0, "neck_attack_2"); attackInfo.OverrideBy(FinePrefabs.ShamanFireball); attackInfo.GetSharedData().m_aiAttackInterval = 12f; attackInfo.GetSharedData().m_attackForce = 300f; attackInfo.GetSharedData().m_damages.m_damage = 30f; attackInfo.GetSharedData().m_damages.m_fire = 30f; attackInfo.AddToCharactersAttacks(val2.Prefab); CreatureManager.Instance.AddCreature(val2); } } public class NeckShaman { public static void Load() { Loader.RunSafe(InnerLoad, "ShamanNeck", "Load"); } private static void InnerLoad() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) CreatureConfig val = new CreatureConfig(); CustomCreature val2 = new CustomCreature("LG_ShamanNeck", "Neck", val); GameObject prefab = val2.Prefab; Transform transform = prefab.transform; transform.localScale *= 2f; Humanoid component = prefab.GetComponent<Humanoid>(); ((Character)component).m_name = "Никс-шаман"; ((Character)component).m_health = 90f; float num = 0.8f; ((Character)component).m_speed = ((Character)component).m_speed * num; ((Character)component).m_turnSpeed = ((Character)component).m_turnSpeed * num; ((Character)component).m_runSpeed = ((Character)component).m_runSpeed * num; ((Character)component).m_runTurnSpeed = ((Character)component).m_runTurnSpeed * num; AttackInfo attackInfo = AttackInfo.FromCharacterAttack(val2.Prefab, 0, "neck_attack_2"); attackInfo.OverrideBy(FinePrefabs.ShamanFireball); attackInfo.GetSharedData().m_aiAttackInterval = 8f; attackInfo.GetSharedData().m_attackForce = 100f; attackInfo.GetSharedData().m_damages.m_damage = 10f; attackInfo.GetSharedData().m_damages.m_fire = 20f; attackInfo.AddToCharactersAttacks(val2.Prefab); CreatureManager.Instance.AddCreature(val2); } } public static class StormBoar { public static void Load() { Loader.RunSafe(InnerLoad, "StormBoar", "Load"); } private static void InnerLoad() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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) CreatureConfig val = new CreatureConfig(); CustomCreature val2 = new CustomCreature("LG_StormBoar", "Boar", val); GameObject prefab = val2.Prefab; Transform transform = prefab.transform; transform.localScale *= 2f; val2.Prefab.AddLightningEffect(Vector3.one); Humanoid component = prefab.GetComponent<Humanoid>(); ((Character)component).m_name = "Штормовой Кабан"; ((Character)component).m_health = 120f; float num = 1.3f; ((Character)component).m_speed = ((Character)component).m_speed * num; ((Character)component).m_turnSpeed = ((Character)component).m_turnSpeed * num; ((Character)component).m_runSpeed = ((Character)component).m_runSpeed * num; ((Character)component).m_runTurnSpeed = ((Character)component).m_runTurnSpeed * num; AttackInfo attackInfo = AttackInfo.FromCharacterAttack(val2.Prefab, 0, "boar_attack_2"); attackInfo.OverrideBy(FinePrefabs.EikthyrCharge); attackInfo.GetSharedData().m_aiAttackInterval = 5f; attackInfo.GetSharedData().m_attackForce = 100f; attackInfo.GetSharedData().m_damages.m_lightning = 20f; attackInfo.GetSharedData().m_damages.m_blunt = 10f; attackInfo.AddToCharactersAttacks(val2.Prefab); CreatureManager.Instance.AddCreature(val2); } } public static class StormHog { public static void Load() { Loader.RunSafe(InnerLoad, "StormHog", "Load"); } private static void InnerLoad() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0048: Unknown result type (might be due to invalid IL or missing references) CreatureConfig val = new CreatureConfig(); CustomCreature val2 = new CustomCreature("LG_StormHog", "Boar", val); GameObject prefab = val2.Prefab; Transform transform = prefab.transform; transform.localScale *= 3f; val2.Prefab.AddLightningEffect(Vector3.one * 3f); Humanoid component = prefab.GetComponent<Humanoid>(); ((Character)component).m_name = "Штормовой Боров"; ((Character)component).m_health = 220f; float num = 0.9f; ((Character)component).m_speed = ((Character)component).m_speed * num; ((Character)component).m_turnSpeed = ((Character)component).m_turnSpeed * num; ((Character)component).m_runSpeed = ((Character)component).m_runSpeed * num; ((Character)component).m_runTurnSpeed = ((Character)component).m_runTurnSpeed * num; AttackInfo attackInfo = AttackInfo.FromCharacterAttack(val2.Prefab