Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Vikings Village v0.2.4
VikingsVillage.dll
Decompiled a month 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.Globalization; using System.IO; using System.IO.Compression; using System.Reflection; using System.Runtime.CompilerServices; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Splatform; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.UI; using YamlDotNet.Serialization; [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: AssemblyVersion("0.0.0.0")] namespace VikingsVillage; internal static class AdminUI { private const float W = 620f; private const float H = 520f; public static bool IsOpen; public static int ClosedFrame = -1; private static GameObject _root; private static Text _title; private static Text _info; private static InputField _name; private static Button _role; private static Button _sex; private static Button _age; private static Button _trait; private static Button _face; private static Button _rename; private static Button _save; private static Button _radius; private static Button _remove; private static float _removeArmed; private static VillageMarker _marker; private static Identity _id; private static float _rad; private static readonly Dictionary<Button, Transform> Labels = new Dictionary<Button, Transform>(); public static void OpenHome(VillageMarker m) { if (Prepare()) { _marker = m; ZDO zdo = m.Zdo; _id = (Identity.IsSet(zdo) ? Identity.Read(zdo) : Identity.Generate("villager", Random.Range(1, int.MaxValue))); Layout(home: true); Show(); } } public static void OpenStone(VillageMarker m) { if (Prepare()) { _marker = m; _rad = m.Radius; _id = null; Layout(home: false); _name.text = m.VillageName; Show(); } } private static bool Prepare() { if ((Object)(object)GUIManager.CustomGUIFront == (Object)null) { return false; } try { if ((Object)(object)_root == (Object)null) { Build(); } return true; } catch (Exception ex) { Plugin.Log.LogError((object)("Could not build the admin panel: " + ex)); if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); } _root = null; return false; } } private static void Show() { _root.SetActive(true); IsOpen = true; GUIManager.BlockInput(true); Refresh(); } public static void Close() { if ((Object)(object)_root != (Object)null) { _root.SetActive(false); } if (IsOpen) { GUIManager.BlockInput(false); } IsOpen = false; _marker = null; ClosedFrame = Time.frameCount; } public static void Rebuild() { if (IsOpen) { Close(); } if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); } _root = null; Labels.Clear(); } private static void Build() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Expected O, but got Unknown //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Expected O, but got Unknown //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Expected O, but got Unknown //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Expected O, but got Unknown //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Expected O, but got Unknown //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Expected O, but got Unknown //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Expected O, but got Unknown //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Expected O, but got Unknown //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Expected O, but got Unknown Labels.Clear(); _root = GUIManager.Instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, 620f, 520f, true); ((Object)_root).name = "VV_Admin"; Transform transform = _root.transform; _title = Ui.Txt(transform, "", 28, Ui.Orange, GUIManager.Instance.NorseBold, (TextAnchor)4); Ui.Place(((Component)_title).gameObject, 60f, 16f, 500f, 40f); Ui.Btn(transform, "X", 558f, 18f, 40f, 40f, new UnityAction(Close)); Text val = Ui.Txt(transform, Loc.T("adm_name"), 16, Ui.Beige, GUIManager.Instance.AveriaSerifBold, (TextAnchor)3); Ui.Place(((Component)val).gameObject, 40f, 76f, 140f, 36f); _name = Ui.Field(transform, 180f, 76f, 300f, 36f, 40); _rename = Ui.Btn(transform, Loc.T("adm_rename"), 488f, 76f, 96f, 36f, (UnityAction)delegate { if (_id != null) { Random r = new Random(Random.Range(1, int.MaxValue)); _id.Name = Identity.MakeName(Content.Current, r, _id.Female == 1, Content.Current.Role(_id.Role).Child); _name.text = _id.Name; } }); _role = Row(transform, 124f, Loc.T("adm_role"), (UnityAction)delegate { Cycle("role"); }); _sex = Row(transform, 168f, Loc.T("adm_sex"), (UnityAction)delegate { Cycle("sex"); }); _age = Row(transform, 212f, Loc.T("adm_age"), (UnityAction)delegate { Cycle("age"); }); _trait = Row(transform, 256f, Loc.T("adm_trait"), (UnityAction)delegate { Cycle("trait"); }); _radius = Row(transform, 124f, Loc.T("adm_radius"), (UnityAction)delegate { float[] array = new float[9] { 20f, 30f, 40f, 50f, 60f, 80f, 100f, 130f, 160f }; int num = Array.FindIndex(array, (float x) => x > _rad + 0.5f); _rad = ((num < 0) ? array[0] : array[num]); Refresh(); }); _face = Ui.Btn(transform, Loc.T("adm_face"), 40f, 306f, 540f, 40f, (UnityAction)delegate { if (_id != null) { _id.Seed = Random.Range(1, int.MaxValue); Refresh(); SetInfo(Loc.T("adm_face_hint")); } }); _info = Ui.Txt(transform, "", 14, Ui.Grey, GUIManager.Instance.AveriaSerif, (TextAnchor)0); Ui.Place(((Component)_info).gameObject, 40f, 352f, 540f, 80f); Ui.Fit(_info, 10, 14); ((Graphic)_info).raycastTarget = false; _save = Ui.Btn(transform, Loc.T("adm_save"), 40f, 444f, 340f, 46f, new UnityAction(Save)); _remove = Ui.Btn(transform, Loc.T("adm_remove"), 388f, 444f, 192f, 46f, new UnityAction(Remove)); Ui.SetBtnColor(_remove, Ui.Bad); _root.SetActive(false); } private static Button Row(Transform t, float y, string label, UnityAction a) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) Text val = Ui.Txt(t, label, 16, Ui.Beige, GUIManager.Instance.AveriaSerifBold, (TextAnchor)3); Ui.Place(((Component)val).gameObject, 40f, y, 140f, 36f); ((Graphic)val).raycastTarget = false; Button val2 = Ui.Btn(t, "", 180f, y, 404f, 36f, a); Labels[val2] = ((Component)val).transform; return val2; } private static void Layout(bool home) { _title.text = (home ? Loc.T("adm_title_home") : Loc.T("adm_title_stone")); ((Component)_remove).gameObject.SetActive(home); Ui.SetBtnText(_remove, Loc.T("adm_remove")); _removeArmed = 0f; Button[] array = (Button[])(object)new Button[6] { _role, _sex, _age, _trait, _face, _rename }; foreach (Button val in array) { ((Component)val).gameObject.SetActive(home); Transform val2 = FindLabel(val); if ((Object)(object)val2 != (Object)null) { ((Component)val2).gameObject.SetActive(home); } } ((Component)_radius).gameObject.SetActive(!home); Transform val3 = FindLabel(_radius); if ((Object)(object)val3 != (Object)null) { ((Component)val3).gameObject.SetActive(!home); } if (home) { _name.text = _id.Name; } SetInfo(home ? Loc.T("adm_home_help") : Loc.T("adm_stone_help")); } private static Transform FindLabel(Button b) { if (!((Object)(object)b != (Object)null) || !Labels.TryGetValue(b, out var value)) { return null; } return value; } private static void SetInfo(string s) { if ((Object)(object)_info != (Object)null) { _info.text = s; } } private static void Cycle(string what) { if (_id == null) { return; } switch (what) { case "role": { List<RoleDef> roleList = Content.Current.RoleList; int num2 = roleList.FindIndex((RoleDef roleDef2) => string.Equals(roleDef2.Id, _id.Role, StringComparison.OrdinalIgnoreCase)); RoleDef roleDef = ((roleList.Count == 0) ? null : roleList[(num2 + 1) % roleList.Count]); if (roleDef != null) { bool child = Content.Current.Role(_id.Role).Child; _id.Role = roleDef.Id; if (roleDef.Female >= 0) { _id.Female = roleDef.Female; } if (roleDef.Child) { _id.Age = 0; } if (roleDef.Child != child) { Random r = new Random(_id.Seed); _id.Name = Identity.MakeName(Content.Current, r, _id.Female == 1, roleDef.Child); _name.text = _id.Name; } } break; } case "sex": _id.Female = 1 - _id.Female; break; case "age": _id.Age = (_id.Age + 1) % 3; break; case "trait": { int num = Array.IndexOf(Identity.Traits, _id.Trait); _id.Trait = Identity.Traits[(num + 1) % Identity.Traits.Length]; break; } } Refresh(); } private static void Refresh() { if (_id != null) { RoleDef roleDef = Content.Current.Role(_id.Role); Ui.SetBtnText(_role, roleDef.Title + (string.IsNullOrEmpty(roleDef.Shop) ? "" : (" <color=#C8B88A>(" + Loc.T("adm_shop") + ")</color>"))); Ui.SetBtnText(_sex, Loc.T((_id.Female == 1) ? "adm_female" : "adm_male")); Ui.SetBtnText(_age, Loc.T("adm_age_" + _id.Age)); Ui.SetBtnText(_trait, Loc.T("trait_" + _id.Trait)); } else { Ui.SetBtnText(_radius, Mathf.RoundToInt(_rad) + " m"); } } private static void Remove() { if (!((Object)(object)_marker == (Object)null) && _id != null) { if (Time.time > _removeArmed) { _removeArmed = Time.time + 4f; Ui.SetBtnText(_remove, Loc.T("adm_remove_confirm")); return; } string text = Removal.RemoveHome(_marker); ((Character)Player.m_localPlayer).Message((MessageType)2, Loc.T("adm_removed", (text.Length > 0) ? text : Loc.T("villager")), 0, (Sprite)null, false); Close(); } } private static void Save() { if ((Object)(object)_marker == (Object)null) { Close(); return; } if (_id != null) { string text = (_name.text ?? "").Trim(); if (text.Length > 0) { _id.Name = text; } _marker.WriteIdentity(_id); ((Character)Player.m_localPlayer).Message((MessageType)2, Loc.T("adm_saved", _id.Name), 0, (Sprite)null, false); } else { _marker.SetVillage((_name.text ?? "").Trim(), _rad); ((Character)Player.m_localPlayer).Message((MessageType)2, Loc.T("adm_stone_saved"), 0, (Sprite)null, false); } Close(); } public static void Update() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) if (!IsOpen) { return; } if (_removeArmed > 0f && Time.time > _removeArmed) { _removeArmed = 0f; Ui.SetBtnText(_remove, Loc.T("adm_remove")); } if (!((Object)(object)_marker == (Object)null) && !((Object)(object)Player.m_localPlayer == (Object)null)) { Vector3 val = ((Component)_marker).transform.position - ((Component)Player.m_localPlayer).transform.position; if (!(((Vector3)(ref val)).sqrMagnitude > 144f)) { return; } } Close(); } } internal class BpPiece { public string Prefab; public Vector3 Pos; public Quaternion Rot = Quaternion.identity; public string Data = ""; public int Lot; } internal class Blueprint { public string Name = ""; public string File = ""; public string Description = ""; public readonly List<BpPiece> Pieces = new List<BpPiece>(); public int Missing; public Vector3 Size; public float Ground; public static string Dir => Path.Combine(Path.Combine(Paths.ConfigPath, "VikingsVillage"), "blueprints"); public static List<Blueprint> LoadAll() { List<Blueprint> list = new List<Blueprint>(); try { Directory.CreateDirectory(Dir); List<string> list2 = new List<string>(); string[] array = new string[3] { "*.vvb", "*.blueprint", "*.vbuild" }; foreach (string searchPattern in array) { list2.AddRange(Directory.GetFiles(Dir, searchPattern, SearchOption.AllDirectories)); } list2.Sort(StringComparer.OrdinalIgnoreCase); foreach (string item in list2) { try { Blueprint blueprint = Load(item); if (blueprint != null && blueprint.Pieces.Count > 0) { list.Add(blueprint); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Blueprint " + Path.GetFileName(item) + ": " + ex.Message)); } } } catch (Exception ex2) { Plugin.Log.LogWarning((object)("Blueprints: " + ex2.Message)); } return list; } private static float F(string s) { return float.Parse(s.Trim(), NumberStyles.Float, CultureInfo.InvariantCulture); } public static Blueprint Load(string path) { return Parse(System.IO.File.ReadAllLines(path), Path.GetExtension(path).ToLowerInvariant(), Path.GetFileNameWithoutExtension(path), path); } public static Blueprint FromText(string text) { return Parse((text ?? "").Split('\n'), ".vvb", "blueprint", ""); } private static Blueprint Parse(string[] lines, string ext, string name, string path) { //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) Blueprint blueprint = new Blueprint(); blueprint.File = path; blueprint.Name = name; bool flag = ext != ".blueprint"; foreach (string text in lines) { string text2 = text.Trim(); if (text2.Length == 0) { continue; } if (text2.StartsWith("#")) { string text3 = text2.ToLowerInvariant(); if (text3.StartsWith("#name:")) { blueprint.Name = text2.Substring(6).Trim(); } else if (text3.StartsWith("#description:")) { blueprint.Description = text2.Substring(13).Trim().Trim('"'); } else if (text3.StartsWith("# name:")) { blueprint.Name = text2.Substring(7).Trim(); } else if (text3.StartsWith("# description:")) { blueprint.Description = text2.Substring(14).Trim(); } else if (text3.StartsWith("# ground:")) { float.TryParse(text2.Substring(9).Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out blueprint.Ground); } else if (text3.StartsWith("#pieces")) { flag = true; } else if (text3.StartsWith("#snappoints") || text3.StartsWith("#terrain")) { flag = false; } } else { if (!flag) { continue; } BpPiece bpPiece = new BpPiece(); if (ext == ".vbuild") { string[] array = text2.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (array.Length < 8) { continue; } bpPiece.Prefab = array[0]; bpPiece.Rot = new Quaternion(F(array[1]), F(array[2]), F(array[3]), F(array[4])); bpPiece.Pos = new Vector3(F(array[5]), F(array[6]), F(array[7])); } else if (ext == ".blueprint") { string[] array2 = text2.Split(';'); if (array2.Length < 9) { continue; } bpPiece.Prefab = array2[0]; bpPiece.Pos = new Vector3(F(array2[2]), F(array2[3]), F(array2[4])); bpPiece.Rot = new Quaternion(F(array2[5]), F(array2[6]), F(array2[7]), F(array2[8])); } else { string[] array3 = text2.Split(';'); if (array3.Length < 8) { continue; } bpPiece.Prefab = array3[0]; bpPiece.Pos = new Vector3(F(array3[1]), F(array3[2]), F(array3[3])); bpPiece.Rot = new Quaternion(F(array3[4]), F(array3[5]), F(array3[6]), F(array3[7])); if (array3.Length > 8) { bpPiece.Data = array3[8].Trim(); } if (array3.Length > 9) { int.TryParse(array3[9].Trim(), out bpPiece.Lot); } } blueprint.Pieces.Add(bpPiece); } } blueprint.Normalize(); return blueprint; } public void Normalize() { //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) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_005d: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) if (Pieces.Count == 0) { return; } Vector3 val = Pieces[0].Pos; Vector3 val2 = Pieces[0].Pos; foreach (BpPiece piece in Pieces) { val = Vector3.Min(val, piece.Pos); val2 = Vector3.Max(val2, piece.Pos); } Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor((val.x + val2.x) / 2f, val.y, (val.z + val2.z) / 2f); Ground += 0f - val.y; foreach (BpPiece piece2 in Pieces) { piece2.Pos -= val3; } Size = val2 - val; Pieces.Sort((BpPiece a, BpPiece c) => a.Pos.y.CompareTo(c.Pos.y)); } public void CountMissing() { Missing = 0; if ((Object)(object)ZNetScene.instance == (Object)null) { return; } foreach (BpPiece piece in Pieces) { if ((Object)(object)ZNetScene.instance.GetPrefab(piece.Prefab) == (Object)null) { Missing++; } } } public void Save(string path) { Directory.CreateDirectory(Path.GetDirectoryName(path)); System.IO.File.WriteAllText(path, ToText()); File = path; } public string ToText() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("# name: " + Name); if (Description.Length > 0) { stringBuilder.AppendLine("# description: " + Description); } if (Mathf.Abs(Ground) > 0.001f) { stringBuilder.AppendLine("# ground: " + Ground.ToString("0.###", CultureInfo.InvariantCulture)); } stringBuilder.AppendLine("# Vikings Village blueprint: prefab;x;y;z;qx;qy;qz;qw[;role for village markers] (metres, relative to the base centre)"); CultureInfo invariantCulture = CultureInfo.InvariantCulture; foreach (BpPiece piece in Pieces) { stringBuilder.AppendLine(string.Format(invariantCulture, "{0};{1:0.###};{2:0.###};{3:0.###};{4:0.#####};{5:0.#####};{6:0.#####};{7:0.#####}", piece.Prefab, piece.Pos.x, piece.Pos.y, piece.Pos.z, piece.Rot.x, piece.Rot.y, piece.Rot.z, piece.Rot.w) + ((piece.Lot != 0) ? (";" + (piece.Data ?? "") + ";" + piece.Lot) : (string.IsNullOrEmpty(piece.Data) ? "" : (";" + piece.Data)))); } return stringBuilder.ToString(); } } internal static class Architect { private class LevelLot { public int Id; public Vector2 Min; public Vector2 Max; public float H; public float Area; } private const float W = 860f; private const float H = 640f; public const string BlueprintPieceKey = "vv_bp"; private const float FlatPad = 1.5f; private const float Ramp = 5f; public static bool IsOpen; public static int ClosedFrame = -1; private static GameObject _root; private static GameObject _scroll; private static RectTransform _content; private static Text _info; private static Text _status; private static readonly List<KeyValuePair<Blueprint, Image>> _rows = new List<KeyValuePair<Blueprint, Image>>(); private static List<Blueprint> _list = new List<Blueprint>(); private static Blueprint _sel; public static bool Placing; private static Blueprint _bp; private static GameObject _ghost; private static float _yaw; private static float _lift; private static bool _level; private static Vector3 _at; private static bool _valid; private static readonly Queue<KeyValuePair<GameObject, BpPiece>> _queue = new Queue<KeyValuePair<GameObject, BpPiece>>(); private static Vector3 _placeAt; private static Quaternion _placeRot; private static int _placed; private static bool _siteMode; private static readonly Dictionary<string, KeyValuePair<string, byte[]>> PendingSites = new Dictionary<string, KeyValuePair<string, byte[]>>(); private static readonly Dictionary<string, string> PendingTitles = new Dictionary<string, string>(); public static readonly List<KeyValuePair<string, ZDOID>> LastPlaced = new List<KeyValuePair<string, ZDOID>>(); private static bool _quiet; private static readonly List<LevelLot> _lots = new List<LevelLot>(); private static readonly Queue<Heightmap> _hmQueue = new Queue<Heightmap>(); private static Vector3 _lvAt; private static Quaternion _lvInv = Quaternion.identity; private static float _steep; private static float _levelDoneAt = -10f; private static bool _levelSearched; private static FieldInfo _fLevel; private static FieldInfo _fSmooth; private static FieldInfo _fModified; private static FieldInfo _fInit; private static MethodInfo _mSave; private static float _resetRadius; public static bool BlocksInput => Placing; public static void Open() { if (!Rpc.LocalIsAdmin()) { Message(Rpc.AdminDenied()); } else { if ((Object)(object)GUIManager.CustomGUIFront == (Object)null) { return; } try { if ((Object)(object)_root == (Object)null) { Build(); } } catch (Exception ex) { Plugin.Log.LogError((object)("Could not build the architect window: " + ex)); if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); } _root = null; return; } Buildings.EnsureStarterSet(); _list = Blueprint.LoadAll(); foreach (Blueprint item in _list) { item.CountMissing(); } _root.SetActive(true); IsOpen = true; GUIManager.BlockInput(true); Fill(); } } public static void Close() { if ((Object)(object)_root != (Object)null) { _root.SetActive(false); } if (IsOpen) { GUIManager.BlockInput(false); } IsOpen = false; ClosedFrame = Time.frameCount; } public static void Rebuild() { if (IsOpen) { Close(); } if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); } _root = null; _rows.Clear(); } private static void Build() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Expected O, but got Unknown //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Expected O, but got Unknown _root = GUIManager.Instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, 860f, 640f, true); ((Object)_root).name = "VV_Architect"; Transform transform = _root.transform; Text val = Ui.Txt(transform, Loc.T("arch_title"), 32, Ui.Orange, GUIManager.Instance.NorseBold, (TextAnchor)4); Ui.Place(((Component)val).gameObject, 120f, 14f, 620f, 46f); ((Graphic)val).raycastTarget = false; Ui.Btn(transform, "X", 794f, 22f, 40f, 40f, new UnityAction(Close)); _content = Ui.Scroll(transform, "VV_BpList", 30f, 80f, 400f, 480f, out _scroll); Image val2 = Ui.Img(transform, "Info", 450f, 80f, 380f, 420f, Ui.PanelDark); _info = Ui.Txt(((Component)val2).transform, "", 15, Ui.Beige, GUIManager.Instance.AveriaSerif, (TextAnchor)0); Ui.Place(((Component)_info).gameObject, 14f, 10f, 352f, 400f); Ui.Fit(_info, 10, 15); ((Graphic)_info).raycastTarget = false; Ui.Btn(transform, Loc.T("arch_place"), 450f, 510f, 186f, 46f, (UnityAction)delegate { if (_sel != null) { BeginPlace(_sel); } }); Ui.Btn(transform, Loc.T("arch_folder"), 644f, 510f, 186f, 46f, (UnityAction)delegate { Application.OpenURL("file:///" + Blueprint.Dir.Replace('\\', '/')); }); _status = Ui.Txt(transform, Loc.T("arch_help"), 13, Ui.Grey, GUIManager.Instance.AveriaSerif, (TextAnchor)4); Ui.Place(((Component)_status).gameObject, 30f, 572f, 800f, 44f); Ui.Fit(_status, 10, 13); ((Graphic)_status).raycastTarget = false; _root.SetActive(false); } private static void Fill() { //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown Ui.Clear(_content); _rows.Clear(); foreach (Blueprint item in _list) { Blueprint bb = item; string text = "<b>" + item.Name + "</b>\n<size=12><color=#A89F8A>" + Loc.T("arch_row", item.Pieces.Count, Mathf.RoundToInt(item.Size.x), Mathf.RoundToInt(item.Size.z), Mathf.RoundToInt(item.Size.y)) + ((item.Missing > 0) ? (" <color=#FF8866>" + Loc.T("arch_missing", item.Missing) + "</color>") : "") + "</color></size>"; Text label; Image value = Ui.Row(_content, text, 15, (UnityAction)delegate { _sel = bb; Highlight(); }, out label); _rows.Add(new KeyValuePair<Blueprint, Image>(item, value)); } if (_sel == null && _list.Count > 0) { _sel = _list[0]; } Highlight(); } private static void Highlight() { //IL_0032: 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) foreach (KeyValuePair<Blueprint, Image> row in _rows) { ((Graphic)row.Value).color = ((row.Key == _sel) ? Ui.RowSel : Ui.RowBase); } if (_sel == null) { _info.text = Loc.T("arch_empty", Blueprint.Dir); return; } Dictionary<string, int> dictionary = new Dictionary<string, int>(); foreach (BpPiece piece in _sel.Pieces) { dictionary.TryGetValue(piece.Prefab, out var value); dictionary[piece.Prefab] = value + 1; } List<KeyValuePair<string, int>> list = new List<KeyValuePair<string, int>>(dictionary); list.Sort((KeyValuePair<string, int> a, KeyValuePair<string, int> b) => b.Value.CompareTo(a.Value)); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("<size=20><color=#FFB75E>").Append(_sel.Name).Append("</color></size>\n"); if (_sel.Description.Length > 0) { stringBuilder.Append("<i>").Append(_sel.Description).Append("</i>\n"); } stringBuilder.Append(Loc.T("arch_row", _sel.Pieces.Count, Mathf.RoundToInt(_sel.Size.x), Mathf.RoundToInt(_sel.Size.z), Mathf.RoundToInt(_sel.Size.y))).Append("\n\n"); int num = 0; foreach (KeyValuePair<string, int> item in list) { bool flag = (Object)(object)ZNetScene.instance != (Object)null && (Object)(object)ZNetScene.instance.GetPrefab(item.Key) == (Object)null; stringBuilder.Append(flag ? "<color=#FF8866>" : "").Append(item.Value).Append(" × ") .Append(item.Key) .Append(flag ? "</color>" : "") .Append('\n'); if (++num >= 22) { stringBuilder.Append("…"); break; } } _info.text = stringBuilder.ToString(); } private static void Message(string s) { if ((Object)(object)MessageHud.instance != (Object)null) { MessageHud.instance.ShowMessage((MessageType)2, s, 0, (Sprite)null, false, true); } if ((Object)(object)Console.instance != (Object)null) { Console.instance.Print(s); } } public static void BeginPlace(Blueprint bp) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (!Rpc.LocalIsAdmin()) { Message(Rpc.AdminDenied()); return; } Close(); CancelPlace(); _bp = bp; _yaw = (((Object)(object)Player.m_localPlayer != (Object)null) ? (Mathf.Round(((Component)Player.m_localPlayer).transform.eulerAngles.y / 15f) * 15f) : 0f); _lift = 0f; _level = bp.Name.IndexOf("Template", StringComparison.OrdinalIgnoreCase) >= 0; _siteMode = false; _ghost = MakeGhost(bp); Placing = true; Message(Loc.T("arch_placing", bp.Name)); } public static bool BeginPlace(string name) { Buildings.EnsureStarterSet(); foreach (Blueprint item in Blueprint.LoadAll()) { if (string.Equals(item.Name, name, StringComparison.OrdinalIgnoreCase) || string.Equals(Path.GetFileNameWithoutExtension(item.File), name, StringComparison.OrdinalIgnoreCase)) { BeginPlace(item); return true; } } return false; } public static void CancelPlace() { if ((Object)(object)_ghost != (Object)null) { Object.Destroy((Object)(object)_ghost); } _ghost = null; Placing = false; } private static GameObject MakeGhost(Blueprint bp) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("VV_BlueprintGhost"); int num = 0; foreach (BpPiece piece in bp.Pieces) { GameObject val2 = (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab(piece.Prefab) : null); if ((Object)(object)val2 == (Object)null) { continue; } GameObject val3 = new GameObject(piece.Prefab); val3.transform.SetParent(val.transform, false); val3.transform.localPosition = piece.Pos; val3.transform.localRotation = piece.Rot; MeshFilter[] componentsInChildren = val2.GetComponentsInChildren<MeshFilter>(false); foreach (MeshFilter val4 in componentsInChildren) { MeshRenderer component = ((Component)val4).GetComponent<MeshRenderer>(); if (!((Object)(object)component == (Object)null) && !((Object)(object)val4.sharedMesh == (Object)null) && ((Renderer)component).enabled && (!((Object)(object)((Component)val4).gameObject.GetComponentInParent<LODGroup>() != (Object)null) || IsLod0(((Component)val4).transform))) { GameObject val5 = new GameObject("m"); val5.transform.SetParent(val3.transform, false); Transform transform = ((Component)val4).transform; val5.transform.localPosition = val2.transform.InverseTransformPoint(transform.position); val5.transform.localRotation = Quaternion.Inverse(val2.transform.rotation) * transform.rotation; val5.transform.localScale = transform.lossyScale; val5.AddComponent<MeshFilter>().sharedMesh = val4.sharedMesh; MeshRenderer val6 = val5.AddComponent<MeshRenderer>(); ((Renderer)val6).sharedMaterials = ((Renderer)component).sharedMaterials; ((Renderer)val6).shadowCastingMode = (ShadowCastingMode)0; } } if (++num > Plugin.MaxBlueprintPieces.Value) { break; } } return val; } private static bool IsLod0(Transform t) { LODGroup componentInParent = ((Component)t).GetComponentInParent<LODGroup>(); if ((Object)(object)componentInParent == (Object)null) { return true; } LOD[] lODs = componentInParent.GetLODs(); if (lODs.Length == 0) { return true; } Renderer component = ((Component)t).GetComponent<Renderer>(); Renderer[] renderers = lODs[0].renderers; foreach (Renderer val in renderers) { if ((Object)(object)val == (Object)(object)component) { return true; } } return false; } public static void Update() { //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) PlaceQueued(); if (!Placing) { return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || (Object)(object)_ghost == (Object)null) { CancelPlace(); return; } if (Input.GetKeyDown((KeyCode)27) || Input.GetMouseButtonDown(1)) { CancelPlace(); Message(Loc.T("arch_cancel")); return; } float axis = Input.GetAxis("Mouse ScrollWheel"); if (axis > 0.01f || Input.GetKeyDown((KeyCode)275)) { _yaw += 15f; } if (axis < -0.01f || Input.GetKeyDown((KeyCode)276)) { _yaw -= 15f; } if (Input.GetKeyDown((KeyCode)108)) { _level = !_level; Message(Loc.T(_level ? "arch_level_on" : "arch_level_off")); } if (Input.GetKeyDown((KeyCode)98)) { _siteMode = !_siteMode; if (_siteMode) { _level = true; } Message(_siteMode ? Loc.T("arch_site_on", SiteCostText(SiteCost(_bp))) : Loc.T("arch_site_off")); } if (Input.GetKeyDown((KeyCode)280)) { _lift += 0.25f; } if (Input.GetKeyDown((KeyCode)281)) { _lift -= 0.25f; } Camera mainCamera = Utils.GetMainCamera(); _valid = false; if ((Object)(object)mainCamera != (Object)null) { int mask = LayerMask.GetMask(new string[6] { "Default", "static_solid", "Default_small", "piece", "terrain", "vehicle" }); RaycastHit val = default(RaycastHit); if (Physics.Raycast(((Component)mainCamera).transform.position, ((Component)mainCamera).transform.forward, ref val, 120f, mask)) { _at = ((RaycastHit)(ref val)).point; _valid = true; } } _ghost.SetActive(_valid); if (_valid) { _ghost.transform.position = _at + Vector3.up * (_lift - _bp.Ground); _ghost.transform.rotation = Quaternion.Euler(0f, _yaw, 0f); } if (_valid && (Input.GetMouseButtonDown(0) || Input.GetKeyDown((KeyCode)13))) { if (_siteMode) { PlaceSite(_bp, _ghost.transform.position, _ghost.transform.rotation); } else { Place(_bp, _ghost.transform.position, _ghost.transform.rotation); } CancelPlace(); } } private static Dictionary<string, int> SiteCost(Blueprint bp) { Dictionary<string, float> dictionary = new Dictionary<string, float>(); if (bp != null && (Object)(object)ZNetScene.instance != (Object)null) { foreach (BpPiece piece in bp.Pieces) { GameObject prefab = ZNetScene.instance.GetPrefab(piece.Prefab); Piece val = (((Object)(object)prefab != (Object)null) ? prefab.GetComponent<Piece>() : null); if ((Object)(object)val == (Object)null || val.m_resources == null || piece.Prefab.StartsWith("VV_", StringComparison.Ordinal)) { continue; } Requirement[] resources = val.m_resources; foreach (Requirement val2 in resources) { if (val2 != null && !((Object)(object)val2.m_resItem == (Object)null) && val2.m_amount > 0) { string name = ((Object)((Component)val2.m_resItem).gameObject).name; dictionary.TryGetValue(name, out var value); dictionary[name] = value + (float)val2.m_amount; } } } } Dictionary<string, int> dictionary2 = new Dictionary<string, int>(); foreach (KeyValuePair<string, float> item in dictionary) { int num = Mathf.CeilToInt(item.Value * Plugin.SiteCostMultiplier.Value); if (num > 0) { dictionary2[item.Key] = num; } } return dictionary2; } private static string SiteCostText(Dictionary<string, int> cost) { List<string> list = new List<string>(); foreach (KeyValuePair<string, int> item in cost) { ItemDrop val = ItemRecord.PrefabDrop(item.Key); list.Add(item.Value + "× " + (((Object)(object)val != (Object)null && Localization.instance != null) ? Localization.instance.Localize(val.m_itemData.m_shared.m_name) : item.Key)); } if (list.Count <= 0) { return "—"; } return string.Join(", ", list.ToArray()); } private static void PlaceSite(Blueprint bp, Vector3 at, Quaternion rot) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) Dictionary<string, int> dictionary = SiteCost(bp); if (dictionary.Count == 0) { Message(Loc.T("arch_site_free")); Place(bp, at, rot); return; } Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(float.MaxValue, float.MaxValue); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(float.MinValue, float.MinValue); foreach (BpPiece piece in bp.Pieces) { if (!piece.Prefab.StartsWith("VV_Mark_", StringComparison.Ordinal)) { val = Vector2.Min(val, new Vector2(piece.Pos.x, piece.Pos.z)); val2 = Vector2.Max(val2, new Vector2(piece.Pos.x, piece.Pos.z)); } } if (val.x > val2.x) { return; } string text = VillageIndex.NewKey().ToString("X"); List<string> list = new List<string>(); foreach (KeyValuePair<string, int> item in dictionary) { list.Add(item.Key + ":" + item.Value); } PendingSites["@" + text] = new KeyValuePair<string, byte[]>(string.Join(",", list.ToArray()), Rpc.Gzip(bp.ToText())); PendingTitles["@" + text] = (bp.Name.StartsWith("Village - ") ? bp.Name.Substring(10) : bp.Name); Blueprint blueprint = new Blueprint(); blueprint.Name = bp.Name; blueprint.Ground = bp.Ground; blueprint.Pieces.AddRange(Buildings.SitePieces(val, val2, bp.Ground, text)); Place(blueprint, at, rot); Message(Loc.T("arch_site_placed", PendingTitles["@" + text], SiteCostText(dictionary))); } public static void PlaceDirect(Blueprint bp, Vector3 at, Quaternion rot, bool level) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) _level = level; LastPlaced.Clear(); Place(bp, at, rot); } private static void Place(Blueprint bp, Vector3 at, Quaternion rot) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_0564: Unknown result type (might be due to invalid IL or missing references) //IL_0565: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ZNetScene.instance == (Object)null) { return; } _placeAt = at; _placeRot = rot; _placed = 0; LastPlaced.Clear(); Dictionary<int, float> dictionary = new Dictionary<int, float>(); if (_level && CanLevel()) { Dictionary<int, Vector4> dictionary2 = new Dictionary<int, Vector4>(); foreach (BpPiece piece in bp.Pieces) { if (piece.Lot >= 0 && !piece.Prefab.StartsWith("VV_Mark_", StringComparison.Ordinal)) { if (!dictionary2.TryGetValue(piece.Lot, out var value)) { value = new Vector4(piece.Pos.x, piece.Pos.z, piece.Pos.x, piece.Pos.z); } dictionary2[piece.Lot] = new Vector4(Mathf.Min(value.x, piece.Pos.x), Mathf.Min(value.y, piece.Pos.z), Mathf.Max(value.z, piece.Pos.x), Mathf.Max(value.w, piece.Pos.z)); } } _lots.Clear(); foreach (KeyValuePair<int, Vector4> item in dictionary2) { LevelLot levelLot = new LevelLot(); levelLot.Min = new Vector2(item.Value.x - 1f, item.Value.y - 1f); levelLot.Max = new Vector2(item.Value.z + 1f, item.Value.w + 1f); levelLot.Area = (levelLot.Max.x - levelLot.Min.x) * (levelLot.Max.y - levelLot.Min.y); levelLot.H = MedianGround(at, rot, levelLot.Min, levelLot.Max, at.y + bp.Ground); levelLot.Id = item.Key; _lots.Add(levelLot); } float num = at.y + bp.Ground; LevelLot levelLot2 = _lots.Find((LevelLot l) => l.Id == 0); if (levelLot2 != null) { num = levelLot2.H; } else if (_lots.Count > 0) { List<float> list = _lots.ConvertAll((LevelLot l) => l.H); list.Sort(); num = list[list.Count / 2]; } at.y = num - bp.Ground; _placeAt = at; foreach (LevelLot lot in _lots) { dictionary[lot.Id] = lot.H - num; } Vector3 val = Vector3.positiveInfinity; Vector3 val2 = Vector3.negativeInfinity; foreach (BpPiece piece2 in bp.Pieces) { val = Vector3.Min(val, piece2.Pos); val2 = Vector3.Max(val2, piece2.Pos); } ClearArea(at, rot, val - new Vector3(2.5f, 0f, 2.5f), val2 + new Vector3(2.5f, 0f, 2.5f)); _lvAt = at; _lvInv = Quaternion.Inverse(rot); _steep = 0f; _hmQueue.Clear(); Vector3 val3 = at + rot * new Vector3((val.x + val2.x) / 2f, 0f, (val.z + val2.z) / 2f); Vector2 val4 = new Vector2(val2.x - val.x, val2.z - val.z); float num2 = ((Vector2)(ref val4)).magnitude / 2f + 1.5f + 5f + 2f; List<Heightmap> list2 = new List<Heightmap>(); Heightmap.FindHeightmap(val3, num2, list2); foreach (Heightmap item2 in list2) { if ((Object)(object)item2 != (Object)null && !item2.IsDistantLod) { _hmQueue.Enqueue(item2); } } } int num3 = 0; foreach (BpPiece piece3 in bp.Pieces) { GameObject prefab = ZNetScene.instance.GetPrefab(piece3.Prefab); if (!((Object)(object)prefab == (Object)null)) { dictionary.TryGetValue(piece3.Lot, out var value2); _queue.Enqueue(new KeyValuePair<GameObject, BpPiece>(prefab, World(piece3, at, rot, value2))); if (++num3 >= Plugin.MaxBlueprintPieces.Value) { break; } } } Message(Loc.T("arch_building", bp.Name, num3)); } private static BpPiece World(BpPiece p, Vector3 at, Quaternion rot, float dy) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) BpPiece bpPiece = new BpPiece(); bpPiece.Prefab = p.Prefab; bpPiece.Pos = at + rot * (p.Pos + Vector3.up * dy); bpPiece.Rot = rot * p.Rot; bpPiece.Data = p.Data; bpPiece.Lot = p.Lot; return bpPiece; } public static void PlaceBuilding(List<BpPiece> pieces, Vector3 ground, Quaternion rot) { //IL_006a: 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) if ((Object)(object)ZNetScene.instance == (Object)null) { return; } List<BpPiece> list = new List<BpPiece>(pieces); list.Sort((BpPiece a, BpPiece c) => a.Pos.y.CompareTo(c.Pos.y)); foreach (BpPiece item in list) { GameObject prefab = ZNetScene.instance.GetPrefab(item.Prefab); if ((Object)(object)prefab != (Object)null) { _queue.Enqueue(new KeyValuePair<GameObject, BpPiece>(prefab, World(item, ground, rot, 0f))); } } _quiet = true; } private static void PlaceQueued() { //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) if (_hmQueue.Count > 0) { LevelHeightmap(_hmQueue.Dequeue()); if (_hmQueue.Count == 0) { _levelDoneAt = Time.time; if (_steep > 8f) { Plugin.Log.LogWarning((object)("Terrain under the blueprint differs by up to " + _steep.ToString("0.0") + " m — the game can only raise or lower terrain by 8 m.")); Message(Loc.T("arch_too_steep", _steep.ToString("0"))); } } } else { if (Time.time - _levelDoneAt < 1.5f || _queue.Count == 0) { return; } long num = (((Object)(object)Player.m_localPlayer != (Object)null) ? Player.m_localPlayer.GetPlayerID() : 0); for (int i = 0; i < 40; i++) { if (_queue.Count <= 0) { break; } KeyValuePair<GameObject, BpPiece> keyValuePair = _queue.Dequeue(); Vector3 pos = keyValuePair.Value.Pos; Quaternion rot = keyValuePair.Value.Rot; GameObject val = Object.Instantiate<GameObject>(keyValuePair.Key, pos, rot); ZNetView component = val.GetComponent<ZNetView>(); if ((Object)(object)component != (Object)null && component.IsValid()) { component.GetZDO().Set("vv_bp", true); } if (!string.IsNullOrEmpty(keyValuePair.Value.Data) && keyValuePair.Value.Data.StartsWith("sign:", StringComparison.Ordinal)) { if ((Object)(object)component != (Object)null && component.IsValid() && (Object)(object)val.GetComponent<Sign>() != (Object)null) { component.GetZDO().Set(ZDOVars.s_text, keyValuePair.Value.Data.Substring(5)); } } else if (keyValuePair.Value.Data == "site") { if ((Object)(object)component != (Object)null && component.IsValid()) { component.GetZDO().Set("vv_site", true); } } else if (!string.IsNullOrEmpty(keyValuePair.Value.Data) && keyValuePair.Value.Data.StartsWith("plot:", StringComparison.Ordinal)) { if ((Object)(object)component != (Object)null && component.IsValid() && (Object)(object)val.GetComponent<VillagePlot>() != (Object)null) { component.GetZDO().Set("vv_plot", keyValuePair.Value.Data.Substring(5)); component.GetZDO().Set("vv_key", VillageIndex.NewKey()); string text = keyValuePair.Value.Data.Substring(5).Split(':')[0]; if (text.StartsWith("@") && PendingSites.TryGetValue(text, out var value)) { component.GetZDO().Set("vv_plot_cost", value.Key); component.GetZDO().Set("vv_plot_bp", value.Value); if (PendingTitles.TryGetValue(text, out var value2)) { component.GetZDO().Set("vv_plot_title", value2); } PendingSites.Remove(text); PendingTitles.Remove(text); } } } else if (!string.IsNullOrEmpty(keyValuePair.Value.Data)) { ZNetView component2 = val.GetComponent<ZNetView>(); if ((Object)(object)component2 != (Object)null && component2.IsValid() && (Object)(object)val.GetComponent<VillageMarker>() != (Object)null) { if (keyValuePair.Value.Data.StartsWith("r:") && float.TryParse(keyValuePair.Value.Data.Substring(2), NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { component2.GetZDO().Set("vv_vrad", result); } else { component2.GetZDO().Set("vv_mrole", keyValuePair.Value.Data); } } } ZNetView component3 = val.GetComponent<ZNetView>(); if ((Object)(object)component3 != (Object)null && component3.IsValid()) { LastPlaced.Add(new KeyValuePair<string, ZDOID>(keyValuePair.Value.Prefab, component3.GetZDO().m_uid)); } Piece component4 = val.GetComponent<Piece>(); if ((Object)(object)component4 != (Object)null && num != 0) { try { component4.SetCreator(num, Rpc.LocalPlatformId()); } catch { } } _placed++; } if (_queue.Count == 0) { if (!_quiet) { Message(Loc.T("arch_done", _placed)); } _quiet = false; } } } [HarmonyPatch(typeof(Piece), "DropResources")] [HarmonyPrefix] private static bool NoFreeResources(Piece __instance) { ZNetView val = (((Object)(object)__instance != (Object)null) ? ((Component)__instance).GetComponent<ZNetView>() : null); if (!((Object)(object)val == (Object)null) && val.IsValid()) { return !val.GetZDO().GetBool("vv_bp", false); } return true; } private static bool CanLevel() { if (!_levelSearched) { _levelSearched = true; _fLevel = AccessTools.Field(typeof(TerrainComp), "m_levelDelta"); _fSmooth = AccessTools.Field(typeof(TerrainComp), "m_smoothDelta"); _fModified = AccessTools.Field(typeof(TerrainComp), "m_modifiedHeight"); _fInit = AccessTools.Field(typeof(TerrainComp), "m_initialized"); _mSave = AccessTools.Method(typeof(TerrainComp), "Save", new Type[1] { typeof(bool) }, (Type[])null); if (_fLevel == null || _fSmooth == null || _fModified == null || _mSave == null) { Plugin.Log.LogWarning((object)"TerrainComp internals not found — blueprints are placed without levelling."); } } if (_fLevel != null && _fSmooth != null && _fModified != null) { return _mSave != null; } return false; } private static bool GroundAt(Vector3 w, out float h) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) h = 0f; if ((Object)(object)ZoneSystem.instance != (Object)null) { return ZoneSystem.instance.GetGroundHeight(new Vector3(w.x, w.y + 200f, w.z), ref h); } return false; } private static bool TargetAt(Vector3 world, float natural, out float target, out bool flat) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) target = natural; flat = false; Vector3 val = _lvInv * (world - _lvAt); LevelLot levelLot = null; float num = 0f; float num2 = 0f; float num3 = 0f; foreach (LevelLot lot in _lots) { float num4 = Mathf.Max(0f, Mathf.Max(lot.Min.x - val.x, val.x - lot.Max.x)); float num5 = Mathf.Max(0f, Mathf.Max(lot.Min.y - val.z, val.z - lot.Max.y)); float num6 = Mathf.Sqrt(num4 * num4 + num5 * num5); if (num6 <= 1.5f) { if (levelLot == null || lot.Area < levelLot.Area) { levelLot = lot; } } else if (!(num6 >= 6.5f)) { float num7 = 1f - Mathf.SmoothStep(0f, 1f, (num6 - 1.5f) / 5f); num += num7; num2 += num7 * lot.H; num3 = Mathf.Max(num3, num7); } } if (levelLot != null) { target = levelLot.H; flat = true; return true; } if (num <= 0f) { return false; } target = Mathf.Lerp(natural, num2 / num, num3); return true; } public static void ResetTerrain(Vector3 center, float radius) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (!CanLevel() || (Object)(object)ZNetScene.instance == (Object)null) { return; } _lots.Clear(); _lvAt = center; _lvInv = Quaternion.identity; _resetRadius = Mathf.Clamp(radius, 2f, 120f); _steep = 0f; List<Heightmap> list = new List<Heightmap>(); Heightmap.FindHeightmap(center, _resetRadius + 2f, list); foreach (Heightmap item in list) { if ((Object)(object)item != (Object)null && !item.IsDistantLod) { LevelHeightmap(item); } } _resetRadius = 0f; Message(Loc.T("arch_terrain_reset", Mathf.RoundToInt(radius))); } private static void LevelHeightmap(Heightmap hm) { //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0235: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)hm == (Object)null || !CanLevel()) { return; } try { TerrainComp andCreateTerrainCompiler = hm.GetAndCreateTerrainCompiler(); if ((Object)(object)andCreateTerrainCompiler == (Object)null) { return; } ZNetView component = ((Component)andCreateTerrainCompiler).GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || !component.IsValid() || (_fInit != null && !(bool)_fInit.GetValue(andCreateTerrainCompiler))) { return; } if (!component.IsOwner()) { component.ClaimOwnership(); } float[] array = (float[])_fLevel.GetValue(andCreateTerrainCompiler); float[] array2 = (float[])_fSmooth.GetValue(andCreateTerrainCompiler); bool[] array3 = (bool[])_fModified.GetValue(andCreateTerrainCompiler); int width = hm.m_width; int num = width / 2; float scale = hm.m_scale; Vector3 position = ((Component)hm).transform.position; bool flag = false; for (int i = 0; i <= width; i++) { for (int j = 0; j <= width; j++) { int num2 = i * (width + 1) + j; if (num2 >= array.Length) { continue; } float height = hm.GetHeight(j, i); float num3 = height - array[num2] - array2[num2]; Vector3 val = position + new Vector3((float)(j - num) * scale, 0f, (float)(i - num) * scale); float target; bool flat; if (_resetRadius > 0f) { if (Utils.DistanceXZ(val, _lvAt) > _resetRadius) { continue; } target = num3; flat = false; } else if (!TargetAt(val, num3, out target, out flat)) { continue; } if (flat) { _steep = Mathf.Max(_steep, Mathf.Abs(target - num3)); } float num4 = Mathf.Clamp(target - num3, -8f, 8f); if (!(Mathf.Abs(num4 - array[num2]) < 0.005f) || array2[num2] != 0f) { array[num2] = num4; array2[num2] = 0f; array3[num2] = true; flag = true; } } } if (flag) { _mSave.Invoke(andCreateTerrainCompiler, new object[1] { false }); hm.Poke(1, false); if ((Object)(object)ClutterSystem.instance != (Object)null) { ClutterSystem.instance.ResetGrass(position, (float)width * scale * 0.75f); } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Terrain levelling failed: " + ex.Message)); } } private static void ClearArea(Vector3 at, Quaternion rot, Vector3 min, Vector3 max) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) Quaternion val = Quaternion.Inverse(rot); int num = 0; List<GameObject> list = new List<GameObject>(); MonoBehaviour[] array = Object.FindObjectsByType<MonoBehaviour>((FindObjectsSortMode)0); foreach (MonoBehaviour val2 in array) { if (!(val2 is TreeBase) && !(val2 is TreeLog) && !(val2 is Destructible) && !(val2 is MineRock) && !(val2 is MineRock5) && !(val2 is Pickable)) { continue; } GameObject gameObject = ((Component)val2).gameObject; if (!((Object)(object)gameObject.GetComponent<Piece>() != (Object)null) && !list.Contains(gameObject)) { Vector3 val3 = val * (gameObject.transform.position - at); if (!(val3.x < min.x) && !(val3.x > max.x) && !(val3.z < min.z) && !(val3.z > max.z)) { list.Add(gameObject); } } } foreach (GameObject item in list) { ZNetView component = item.GetComponent<ZNetView>(); if (!((Object)(object)component == (Object)null) && component.IsValid()) { component.ClaimOwnership(); ZNetScene.instance.Destroy(item); num++; } } if (num > 0) { Plugin.Log.LogInfo((object)("Cleared " + num + " trees, rocks and bushes under the blueprint.")); } } private static float MedianGround(Vector3 at, Quaternion rot, Vector2 min, Vector2 max, float fallback) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) List<float> list = new List<float>(); for (float num = min.x; num <= max.x + 0.01f; num += 1.5f) { for (float num2 = min.y; num2 <= max.y + 0.01f; num2 += 1.5f) { Vector3 w = at + rot * new Vector3(num, 0f, num2); if (GroundAt(w, out var h)) { list.Add(h); } } } if (list.Count == 0) { return fallback; } list.Sort(); return list[list.Count / 2]; } public static void Capture(string name, float radius) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } if (!Rpc.LocalIsAdmin()) { Message(Rpc.AdminDenied()); return; } List<Piece> list = new List<Piece>(); Piece.GetAllPiecesInRadius(((Component)localPlayer).transform.position, radius, list); Blueprint blueprint = new Blueprint(); blueprint.Name = name; Vector3 position = ((Component)localPlayer).transform.position; foreach (Piece item in list) { if ((Object)(object)item == (Object)null) { continue; } ZNetView component = ((Component)item).GetComponent<ZNetView>(); if (!((Object)(object)component == (Object)null) && component.IsValid()) { BpPiece bpPiece = new BpPiece(); bpPiece.Prefab = Utils.GetPrefabName(((Component)item).gameObject); bpPiece.Pos = ((Component)item).transform.position - position; bpPiece.Rot = ((Component)item).transform.rotation; VillageMarker component2 = ((Component)item).GetComponent<VillageMarker>(); if ((Object)(object)component2 != (Object)null) { bpPiece.Data = ((component2.Kind == "stone") ? ("r:" + Mathf.RoundToInt(component2.Radius)) : component2.RoleFilter); } blueprint.Pieces.Add(bpPiece); } } if (blueprint.Pieces.Count == 0) { Message(Loc.T("arch_capture_none")); return; } blueprint.Normalize(); string text = name; char[] invalidFileNameChars = Path.GetInvalidFileNameChars(); foreach (char oldChar in invalidFileNameChars) { text = text.Replace(oldChar, '_'); } string text2 = Path.Combine(Blueprint.Dir, text + ".vvb"); blueprint.Save(text2); Message(Loc.T("arch_captured", blueprint.Pieces.Count, text2)); } } internal static class Barks { private static readonly Dictionary<string, int> LastLine = new Dictionary<string, int>(); public static string Pick(Villager v, string kind, Saga saga, CondCtx ctx) { Content current = Content.Current; string text = VillagerAI.PhaseNow(); List<string> list = new List<string>(); for (int i = 0; i < current.Barks.Count; i++) { BarkDef barkDef = current.Barks[i]; if (barkDef.Kind != kind || (barkDef.Roles.Count > 0 && !Has(barkDef.Roles, v.Id.Role)) || (barkDef.Traits.Count > 0 && !Has(barkDef.Traits, v.Id.Trait)) || (barkDef.When != "any" && barkDef.When != text)) { continue; } if (barkDef.If.Count > 0) { if (saga == null || ctx == null) { if (!WorldOnly(barkDef.If)) { continue; } } else if (!Cond.All(barkDef.If, saga, current, ctx)) { continue; } } for (int j = 0; j < barkDef.Lines.Count; j++) { list.Add("#b:" + i + ":" + j); } } if (list.Count == 0) { return ""; } string key = ((Object)v).GetInstanceID() + kind; LastLine.TryGetValue(key, out var value); int num = Random.Range(0, list.Count); if (list.Count > 1 && num == value) { num = (num + 1) % list.Count; } LastLine[key] = num; return list[num]; } public static string Resolve(string token) { if (string.IsNullOrEmpty(token) || !token.StartsWith("#b:")) { return token ?? ""; } string text = ""; int num = token.IndexOf('|'); if (num >= 0) { text = token.Substring(num + 1); token = token.Substring(0, num); } string[] array = token.Substring(3).Split(':'); int result = -1; if (array.Length < 2 || !int.TryParse(array[0], out var result2) || !int.TryParse(array[1], out var result3)) { return ""; } if (array.Length > 2) { int.TryParse(array[2], out result); } List<BarkDef> barks = Content.Current.Barks; if (result2 < 0 || result2 >= barks.Count || barks[result2].Lines.Count == 0) { return ""; } string text2 = barks[result2].Lines[result3 % barks[result2].Lines.Count]; if (result >= 0) { string[] array2 = text2.Split('|'); text2 = ((result < array2.Length) ? array2[result].Trim() : ""); } return text2.Replace("{near}", (text.Length > 0) ? text : Loc.T("traveller")); } public static int Parts(string token) { string text = Resolve(token); if (text.Length != 0) { return text.Split('|').Length; } return 0; } private static bool Has(List<string> list, string s) { foreach (string item in list) { if (string.Equals(item, s, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } private static bool WorldOnly(List<string> conds) { foreach (string cond in conds) { string text = cond.Trim(); bool flag = text.StartsWith("!"); if (flag) { text = text.Substring(1); } bool flag2; if (text.StartsWith("key:", StringComparison.OrdinalIgnoreCase)) { flag2 = VillageClient.HasKeyLive(text.Substring(4).Trim()); } else { if (!text.StartsWith("time:", StringComparison.OrdinalIgnoreCase)) { return false; } flag2 = VillagerAI.PhaseNow() == text.Substring(5).Trim().ToLowerInvariant(); } if (flag) { flag2 = !flag2; } if (!flag2) { return false; } } return true; } } internal static class Dialogue { public static string Fill(string text, Villager npc) { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(text) || text.IndexOf('{') < 0) { return text ?? ""; } StringBuilder stringBuilder = new StringBuilder(text); Player localPlayer = Player.m_localPlayer; stringBuilder.Replace("{player}", ((Object)(object)localPlayer != (Object)null) ? localPlayer.GetPlayerName() : "traveller"); if ((Object)(object)npc != (Object)null) { stringBuilder.Replace("{npc}", npc.DisplayName); stringBuilder.Replace("{role}", npc.Role.Title); } Vector3 val = (((Object)(object)npc != (Object)null) ? ((Component)npc).transform.position : (((Object)(object)localPlayer != (Object)null) ? ((Component)localPlayer).transform.position : Vector3.zero)); stringBuilder.Replace("{village}", Village.NameAt(val)); string[] array = new string[10] { "jarl", "skald", "gothi", "smith", "merchant", "hunter", "brewer", "fisher", "farmer", "guard" }; foreach (string text2 in array) { string text3 = "{" + text2 + "}"; if (text.IndexOf(text3, StringComparison.Ordinal) >= 0) { stringBuilder.Replace(text3, NameOfRole(text2, val)); } } stringBuilder.Replace("{tier}", Loc.T("tier_" + Cond.Tier(VillageClient.Saga.Rep))); string text4 = Integrations.LocalPatron(); stringBuilder.Replace("{patron}", (text4.Length > 0) ? Loc.T("god_" + text4) : Loc.T("no_patron")); return stringBuilder.ToString(); } public static string NameOfRole(string role, Vector3 near) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) Villager villager = null; float num = 22500f; foreach (Villager item in Villager.All) { if (!((Object)(object)item == (Object)null) && item.Ready && string.Equals(item.Id.Role, role, StringComparison.OrdinalIgnoreCase)) { Vector3 val = ((Component)item).transform.position - near; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; villager = item; } } } if ((Object)(object)villager != (Object)null) { return villager.DisplayName; } return Loc.T("the_role", Content.Current.Role(role).Title); } } internal static class Buildings { private class Hall { private readonly Gen g; public readonly int Tw; public readonly int Tl; public readonly int Rows; public readonly List<int> DoorsLeft = new List<int>(); public readonly List<int> DoorsRight = new List<int>(); public int SmokeHole = -1; public bool Open; public bool Doors; public string SignText; public float FloorY; public float HalfW; public float HalfL; public float T; public float Eave; public Hall(Gen gen, int tilesWide, int tilesLong, int rows) { g = gen; Tw = tilesWide; Tl = tilesLong; Rows = rows; } public void Build() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_073d: Unknown result type (might be due to invalid IL or missing references) //IL_06ec: Unknown result type (might be due to invalid IL or missing references) //IL_06f1: Unknown result type (might be due to invalid IL or missing references) T = Mathf.Max(1f, g.Size("wood_floor").x); HalfW = (float)Tw * T / 2f; HalfL = (float)Tl * T / 2f; string prefab = g.Pick("stone_wall_2x1", "stone_wall_1x1", "woodwall"); float num = Mathf.Max(0.25f, g.Size(prefab).y); FloorY = num - 0.4f; for (int i = 0; i < Tw; i++) { float x = 0f - HalfW + T * ((float)i + 0.5f); g.Wall(prefab, x, FloorY - num, 0f - HalfL, alongX: true); g.Wall(prefab, x, FloorY - num, HalfL, alongX: true); } for (int j = 0; j < Tl; j++) { float z = 0f - HalfL + T * ((float)j + 0.5f); g.Wall(prefab, 0f - HalfW, FloorY - num, z, alongX: false); g.Wall(prefab, HalfW, FloorY - num, z, alongX: false); } for (int k = 0; k < Tw; k++) { for (int l = 0; l < Tl; l++) { g.Top("wood_floor", 0f - HalfW + T * ((float)k + 0.5f), FloorY, 0f - HalfL + T * ((float)l + 0.5f), 0f); } } string prefab2 = g.Pick("woodwall", "wood_wall_log"); float num2 = Mathf.Max(1f, g.Size(prefab2).y); float num3 = FloorY + (float)Rows * num2; if (Open) { string prefab3 = g.Pick("wood_pole_log", "wood_pole2"); float num4 = Mathf.Max(0.5f, g.Size(prefab3).y); int num5 = Mathf.Max(1, Mathf.RoundToInt((float)Rows * num2 / num4)); num3 = FloorY + (float)num5 * num4; for (int m = 0; m < num5; m++) { for (int n = 0; n <= Tw; n += 2) { float[] array = new float[2] { 0f - HalfL + 0.15f, HalfL - 0.15f }; foreach (float z2 in array) { g.Center(prefab3, 0f - HalfW + T * (float)n + ((n == 0) ? 0.15f : ((n == Tw) ? (-0.15f) : 0f)), FloorY + (float)m * num4, z2, 0f); } } for (int num7 = 1; num7 < Tl; num7++) { float[] array2 = new float[2] { 0f - HalfW + 0.15f, HalfW - 0.15f }; foreach (float x2 in array2) { g.Center(prefab3, x2, FloorY + (float)m * num4, 0f - HalfL + T * (float)num7, 0f); } } } } else { string text = g.Pick("wood_door"); for (int num9 = 0; num9 < Rows; num9++) { float y = FloorY + (float)num9 * num2; for (int num10 = 0; num10 < Tw; num10++) { float x3 = 0f - HalfW + T * ((float)num10 + 0.5f); g.Wall(prefab2, x3, y, 0f - HalfL, alongX: true); g.Wall(prefab2, x3, y, HalfL, alongX: true); } for (int num11 = 0; num11 < Tl; num11++) { float z3 = 0f - HalfL + T * ((float)num11 + 0.5f); bool flag = num9 == 0 && DoorsLeft.Contains(num11); bool flag2 = num9 == 0 && DoorsRight.Contains(num11); if (flag) { if (Doors && text != null) { g.Wall(text, 0f - HalfW, y, z3, alongX: false); } } else { g.Wall(prefab2, 0f - HalfW, y, z3, alongX: false); } if (flag2) { if (Doors && text != null) { g.Wall(text, HalfW, y, z3, alongX: false); } } else { g.Wall(prefab2, HalfW, y, z3, alongX: false); } } } foreach (int item in DoorsLeft) { Steps(0f - HalfW, 0f - HalfL + T * ((float)item + 0.5f), -1f); } foreach (int item2 in DoorsRight) { Steps(HalfW, 0f - HalfL + T * ((float)item2 + 0.5f), 1f); } if (!string.IsNullOrEmpty(SignText) && DoorsLeft.Count > 0) { int num12 = DoorsLeft[0]; int num13 = ((num12 + 1 < Tl) ? (num12 + 1) : (num12 - 1)); g.Sign(SignText, new Vector3(0f - HalfW, 0f, 0f - HalfL + T * ((float)num13 + 0.5f)), Vector3.left, FloorY + 1.5f); } string prefab4 = g.Pick("wood_pole_log", "wood_pole2"); float num14 = Mathf.Max(0.5f, g.Size(prefab4).y); float[] array3 = new float[2] { 0f - HalfW, HalfW }; foreach (float x4 in array3) { float[] array4 = new float[2] { 0f - HalfL, HalfL }; foreach (float z4 in array4) { for (float num17 = FloorY; num17 < num3 - 0.1f; num17 += num14) { g.Center(prefab4, x4, num17, z4, 0f); } } } } Eave = num3; Roof(num3); } private void Steps(float wallX, float z, float outDir) { string text = g.Pick("stone_floor_2x2", "wood_floor"); if (text != null) { float num = FloorY - 0.22f; g.Top(text, wallX + outDir * T * 0.5f, num, z, 0f); if (num > 0.35f) { g.Top(text, wallX + outDir * T * 1.5f, num * 0.5f, z, 0f); } } } private void Roof(float eave) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) string prefab = g.Pick("wood_roof_45", "wood_roof"); Vector3 val = g.Size(prefab); float num = Mathf.Max(0.5f, g.RoofRun(prefab)); float num2 = Mathf.Max(0.5f, val.y); int num3 = Mathf.Max(1, Mathf.RoundToInt(HalfW / num)); for (int i = -1; i <= 1; i += 2) { Vector3 up = ((i < 0) ? Vector3.right : Vector3.left); for (int j = 0; j < num3; j++) { float x = (float)i * (HalfW - num * ((float)j + 0.5f)); float y = eave + (float)j * num2; for (int k = 0; k < Tl; k++) { if (j != num3 - 1 || k != SmokeHole) { g.Roof(prefab, x, y, 0f - HalfL + T * ((float)k + 0.5f), up); } } } } float num4 = eave + (float)num3 * num2; string text = g.Pick("wood_roof_top_45", "wood_roof_top"); if (text != null) { Vector3 val2 = g.Size(text); float yaw = ((val2.x >= val2.z) ? 90f : 0f); for (int l = 0; l < Tl; l++) { if (l != SmokeHole) { g.Center(text, 0f, num4 - val2.y, 0f - HalfL + T * ((float)l + 0.5f), yaw); } } } if (Open) { return; } string text2 = g.Pick("wood_wall_roof_45", "wood_wall_roof"); string prefab2 = g.Pick("woodwall", "wood_wall_log"); float[] array = new float[2] { 0f - HalfL, HalfL }; foreach (float z in array) { for (int n = 0; n < num3; n++) { float y2 = eave + (float)n * num2; int num5 = Mathf.RoundToInt((HalfW - (float)n * num) * 2f / T); for (int num6 = 0; num6 < num5; num6++) { float num7 = 0f - (HalfW - (float)n * num) + (float)num6 * T; float x2 = num7 + T / 2f; bool flag = num6 == 0; bool flag2 = num6 == num5 - 1; if (flag && text2 != null) { g.Triangle(text2, x2, y2, z, Vector3.right); } else if (flag2 && text2 != null) { g.Triangle(text2, x2, y2, z, Vector3.left); } else { g.Wall(prefab2, x2, y2, z, alongX: true); } } } } } } private class Gen { public readonly List<BpPiece> Pieces = new List<BpPiece>(); private static readonly Dictionary<string, Bounds> Boxes = new Dictionary<string, Bounds>(); private static readonly Dictionary<string, Vector3> Slopes = new Dictionary<string, Vector3>(); private int _nextLot = 1; public bool Has(string prefab) { if (!string.IsNullOrEmpty(prefab)) { return (Object)(object)ZNetScene.instance.GetPrefab(prefab) != (Object)null; } return false; } public string Pick(params string[] names) { foreach (string text in names) { if (Has(text)) { return text; } } return null; } public Bounds Box(string prefab) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_0316: 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_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) if (Boxes.TryGetValue(prefab, out var value)) { return value; } GameObject prefab2 = ZNetScene.instance.GetPrefab(prefab); value = new Bounds(Vector3.zero, Vector3.zero); bool flag = false; List<Vector3> list = new List<Vector3>(); if ((Object)(object)prefab2 != (Object)null) { Transform[] componentsInChildren = prefab2.GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if (!((Object)(object)val == (Object)(object)prefab2.transform) && ((Component)val).CompareTag("snappoint")) { Vector3 val2 = prefab2.transform.InverseTransformPoint(val.position); list.Add(val2); if (!flag) { value = new Bounds(val2, Vector3.zero); flag = true; } else { ((Bounds)(ref value)).Encapsulate(val2); } } } if (!flag || (((Bounds)(ref value)).size.x < 0.05f && ((Bounds)(ref value)).size.z < 0.05f)) { MeshFilter[] componentsInChildren2 = prefab2.GetComponentsInChildren<MeshFilter>(false); foreach (MeshFilter val3 in componentsInChildren2) { if ((Object)(object)val3.sharedMesh == (Object)null) { continue; } Bounds bounds = val3.sharedMesh.bounds; for (int k = 0; k < 8; k++) { Vector3 val4 = ((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3((float)(((k & 1) != 0) ? 1 : (-1)), (float)(((k & 2) != 0) ? 1 : (-1)), (float)(((k & 4) != 0) ? 1 : (-1)))); Vector3 val5 = prefab2.transform.InverseTransformPoint(((Component)val3).transform.TransformPoint(val4)); if (!flag) { value = new Bounds(val5, Vector3.zero); flag = true; } else { ((Bounds)(ref value)).Encapsulate(val5); } } } } } Boxes[prefab] = value; if (list.Count >= 3) { float num = float.MaxValue; float num2 = float.MinValue; foreach (Vector3 item in list) { num = Mathf.Min(num, item.y); num2 = Mathf.Max(num2, item.y); } Vector3 val6 = Vector3.zero; Vector3 val7 = Vector3.zero; int num3 = 0; int num4 = 0; foreach (Vector3 item2 in list) { if (item2.y < num + 0.2f) { val6 += item2; num3++; } if (item2.y > num2 - 0.2f) { val7 += item2; num4++; } } if (num3 > 0 && num4 > 0 && num2 - num > 0.3f) { Vector3 val8 = val7 / (float)num4 - val6 / (float)num3; val8.y = 0f; if (((Vector3)(ref val8)).sqrMagnitude > 0.01f) { Slopes[prefab] = ((Vector3)(ref val8)).normalized; } } } return value; } public Vector3 Size(string prefab) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(prefab) && Has(prefab)) { Bounds val = Box(prefab); return ((Bounds)(ref val)).size; } return Vector3.zero; } public float RoofRun(string prefab) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0040: 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) Bounds val = Box(prefab); if (Slopes.TryGetValue(prefab, out var value)) { if (!(Mathf.Abs(value.x) > Mathf.Abs(value.z))) { return ((Bounds)(ref val)).size.z; } return ((Bounds)(ref val)).size.x; } return Mathf.Min(((Bounds)(ref val)).size.x, ((Bounds)(ref val)).size.z); } private static Bounds Rotated(Bounds b, float yaw) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) Quaternion val = Quaternion.Euler(0f, yaw, 0f); Bounds result = default(Bounds); ((Bounds)(ref result))..ctor(val * ((Bounds)(ref b)).center, Vector3.zero); for (int i = 0; i < 8; i++) { Vector3 val2 = ((Bounds)(ref b)).center + Vector3.Scale(((Bounds)(ref b)).extents, new Vector3((float)(((i & 1) != 0) ? 1 : (-1)), (float)(((i & 2) != 0) ? 1 : (-1)), (float)(((i & 4) != 0) ? 1 : (-1)))); ((Bounds)(ref result)).Encapsulate(val * val2); } return result; } private void Add(string prefab, Vector3 pivot, float yaw, string data) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_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) BpPiece bpPiece = new BpPiece(); bpPiece.Prefab = prefab; bpPiece.Pos = pivot; bpPiece.Rot = Quaternion.Euler(0f, yaw, 0f); bpPiece.Data = data ?? ""; Pieces.Add(bpPiece); } public void Center(string prefab, float x, float y, float z, float yaw, bool centerY = false) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (Has(prefab)) { Bounds val = Rotated(Box(prefab), yaw); float num = (centerY ? (y - ((Bounds)(ref val)).center.y) : (y - ((Bounds)(ref val)).min.y)); Add(prefab, new Vector3(x - ((Bounds)(ref val)).center.x, num, z - ((Bounds)(ref val)).center.z), yaw, null); } } public void Top(string prefab, float x, float y, float z, float yaw) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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_002c: 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) if (Has(prefab)) { Bounds val = Rotated(Box(prefab), yaw); Add(prefab, new Vector3(x - ((Bounds)(ref val)).center.x, y - ((Bounds)(ref val)).max.y, z - ((Bounds)(ref val)).center.z), yaw, null); } } public void Wall(string prefab, float x, float y, float z, bool alongX) { //IL_000c: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (Has(prefab)) { Bounds val = Box(prefab); bool flag = ((Bounds)(ref val)).size.x >= ((Bounds)(ref val)).size.z; float yaw = ((alongX == flag) ? 0f : 90f); Center(prefab, x, y, z, yaw); } } public void Roof(string prefab, float x, float y, float z, Vector3 up) { //IL_000c: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (Has(prefab)) { Box(prefab); if (!Slopes.TryGetValue(prefab, out var value)) { value = Vector3.forward; } float num = Vector3.SignedAngle(value, up, Vector3.up); num = Mathf.Round(num / 90f) * 90f; Center(prefab, x, y, z, num); } } public void Triangle(string prefab, float x, float y, float z, Vector3 up) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) Roof(prefab, x, y, z, up); } public Bounds MeshBox(string prefab) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or m